← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/lp-mailman:independent-dependencies into lp-mailman:master

 

Colin Watson has proposed merging ~cjwatson/lp-mailman:independent-dependencies into lp-mailman:master.

Commit message:
Use an independent dependencies repository

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/lp-mailman/+git/lp-mailman/+merge/401290

Piggybacking on lp:lp-source-dependencies made it difficult to work out when it was valid to remove files from that repository (and indeed I recently cleaned that up forgetting that lp-mailman was also using it).  Declare independence instead.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/lp-mailman:independent-dependencies into lp-mailman:master.
diff --git a/.gitignore b/.gitignore
index 4eedbe6..cabc8dd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,7 @@ build
 dist
 /download-cache
 /env
+/pip-cache
 /production-configs
 _trial_temp
 .cache
diff --git a/Makefile b/Makefile
index b5a3abb..3c7c5cb 100644
--- a/Makefile
+++ b/Makefile
@@ -8,18 +8,21 @@ PY=$(WD)/bin/py
 PYTHONPATH:=$(WD)/lib:${PYTHONPATH}
 VERBOSITY=-vv
 
+DEPENDENCY_REPO ?= lp:~launchpad/lp-mailman/+git/dependencies
+DEPENDENCY_DIR ?= $(WD)/download-cache
+
 # virtualenv and pip fail if setlocale fails, so force a valid locale.
 PIP_ENV := LC_ALL=C.UTF-8
 # Run with "make PIP_NO_INDEX=" if you want pip to find software
 # dependencies *other* than those in our download-cache.  Once you have the
-# desired software, commit it to lp:lp-source-dependencies if it is going to
-# be reviewed/merged/deployed.
+# desired software, commit it to lp:~launchpad/lp-mailman/+git/dependencies
+# if it is going to be reviewed/merged/deployed.
 PIP_NO_INDEX := 1
 PIP_ENV += PIP_NO_INDEX=$(PIP_NO_INDEX)
-PIP_ENV += PIP_FIND_LINKS="file://$(WD)/wheelhouse/ file://$(WD)/download-cache/dist/"
+PIP_ENV += PIP_FIND_LINKS="file://$(WD)/wheelhouse/ file://$(DEPENDENCY_DIR)/"
 
 VIRTUALENV := $(PIP_ENV) virtualenv
-PIP := PYTHONPATH= $(PIP_ENV) env/bin/pip --cache-dir=$(WD)/download-cache/
+PIP := PYTHONPATH= $(PIP_ENV) env/bin/pip --cache-dir=$(WD)/pip-cache/
 
 SITE_PACKAGES := \
 	$$(env/bin/python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')
@@ -66,24 +69,27 @@ inplace: build logs clean_logs
 
 build: compile
 
+# Create or update $(DEPENDENCY_DIR) if possible.  If the directory exists
+# but isn't a git repository, then assume that we're doing a deployment and
+# have already been provided with a suitable dependencies directory.
 bootstrap:
-	if [ -d download-cache ]; then \
-		git -C download-cache pull; \
+	if [ -d $(DEPENDENCY_DIR)/.git ]; then \
+		git -C $(DEPENDENCY_DIR) pull; \
+	elif [ -d $(DEPENDENCY_DIR) ]; then \
+		:; \
 	else \
-		git clone https://git.launchpad.net/lp-source-dependencies download-cache; \
+		git clone $(DEPENDENCY_REPO) $(DEPENDENCY_DIR); \
 	fi
 	utilities/update-sourcecode
 
 # LP_SOURCEDEPS_PATH should point to the sourcecode directory, but we
 # want the parent directory where the download-cache and env directories
 # are. We re-use the variable that is using for the rocketfuel-get script.
-download-cache:
+$(DEPENDENCY_DIR):
 ifdef LP_SOURCEDEPS_PATH
 	utilities/link-external-sourcecode $(LP_SOURCEDEPS_PATH)/..
 else
-	@echo "Missing ./download-cache."
-	@echo "Developers: please run utilities/link-external-sourcecode."
-	@exit 1
+	$(MAKE) bootstrap
 endif
 
 # This target is used by LOSAs to prepare a build to be pushed out to
@@ -110,12 +116,12 @@ build_wheels: $(PIP_BIN)
 # If we listed every target on the left-hand side, a parallel make would try
 # multiple copies of this rule to build them all.  Instead, we nominally build
 # just $(PY), and everything else is implicitly updated by that.
-$(PY): download-cache constraints.txt setup.py
+$(PY): $(DEPENDENCY_DIR) constraints.txt setup.py
 	rm -rf env
 	mkdir -p env
 	$(VIRTUALENV) \
 		--python=$(PYTHON) --never-download \
-		--extra-search-dir=$(WD)/download-cache/dist/ \
+		--extra-search-dir=$(DEPENDENCY_DIR)/ \
 		--extra-search-dir=$(WD)/wheelhouse/ \
 		env
 	ln -sfn env/bin bin