launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #19636
[Merge] lp:~cjwatson/turnip/virtualenv into lp:turnip
Colin Watson has proposed merging lp:~cjwatson/turnip/virtualenv into lp:turnip.
Commit message:
Add targets to build a tarball with included virtualenv.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/turnip/virtualenv/+merge/274701
Add targets to build a tarball with included virtualenv.
This is the first step towards making our deployment system more sensible: it will eventually allow us to have a mojo manifest that builds the entire code asset in an appropriate container, virtualenv and all, run tests the whole thing, and upload it to swift for the charm to deploy. This will involve less downtime on upgrades and will support the autodeployment scheme currently being trialled by Canonical IS. As a bonus, since the intended use of this is to run the build step in an environment that matches the deployment target, we can switch to installing pygit2 from pip like everything else; 0.22.1 includes our current set of local patches.
This of course requires some additions to turnip-dependencies (pbr-1.8.1.tar.gz, pip-7.1.2.tar.gz, pygit2-0.22.1.tar.gz, setuptools-18.4.tar.gz), which I'll commit if this is accepted, and I'll also commit a similar change to turnipcake in that case so that the charms can remain consistent.
The turnip charm will need to be updated to use this, and that update will involve quite a bit of refactoring, but this part of it can be landed in advance of that, and as a bonus it makes "make check" much more reliable.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/turnip/virtualenv into lp:turnip.
=== modified file '.bzrignore'
--- .bzrignore 2015-05-20 23:32:18 +0000
+++ .bzrignore 2015-10-16 12:23:06 +0000
@@ -4,10 +4,11 @@
dist
download-cache
eggs
+env
*.egg*
*.egg-info
.installed.cfg
*.log
parts
tags
-TAGS
\ No newline at end of file
+TAGS
=== modified file 'Makefile'
--- Makefile 2015-03-12 07:51:28 +0000
+++ Makefile 2015-10-16 12:23:06 +0000
@@ -1,18 +1,50 @@
# Copyright 2005-2015 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
-PYTHON=python
-PSERVE=pserve
-FLAKE8=flake8
-
-check:
+ENV = $(CURDIR)/env
+
+PYTHON = $(ENV)/bin/python
+PSERVE = $(ENV)/bin/pserve
+FLAKE8 = $(ENV)/bin/flake8
+
+ifeq ($(PIP_SOURCE_DIR),)
+PIP_CACHE_ARGS :=
+else
+PIP_CACHE_ARGS := --no-index --find-links=file://$(realpath $(PIP_SOURCE_DIR))/
+endif
+
+# Create archives in labelled directories (e.g. r182/$(PROJECT_NAME).tar.gz)
+TARBALL_BUILD_LABEL ?= r$(shell bzr revno)
+TARBALL_FILE_NAME = turnip.tar.gz
+TARBALL_BUILDS_DIR ?= build
+TARBALL_BUILD_DIR = $(TARBALL_BUILDS_DIR)/$(TARBALL_BUILD_LABEL)
+TARBALL_BUILD_PATH = $(TARBALL_BUILD_DIR)/$(TARBALL_FILE_NAME)
+
+$(ENV):
+ mkdir -p $(ENV)
+ifneq ($(PIP_SOURCE_DIR),)
+ (echo '[easy_install]'; \
+ echo "allow_hosts = ''"; \
+ echo 'find_links = file://$(realpath $(PIP_SOURCE_DIR))/') \
+ >$(ENV)/.pydistutils.cfg
+endif
+ virtualenv $(ENV)
+ $(ENV)/bin/pip install $(PIP_CACHE_ARGS) --no-use-wheel \
+ -r bootstrap-requirements.txt
+ $(ENV)/bin/pip install $(PIP_CACHE_ARGS) --no-use-wheel \
+ -r requirements.txt \
+ -r deploy-requirements.txt \
+ -r test-requirements.txt
+
+check: $(ENV)
$(PYTHON) -m unittest discover turnip
clean:
find turnip -name '*.py[co]' -exec rm '{}' \;
+ rm -rf $(ENV)
dist:
- $(PYTHON) ./setup.py sdist
+ python ./setup.py sdist
TAGS:
ctags -e -R turnip
@@ -20,10 +52,21 @@
tags:
ctags -R turnip
-lint:
+lint: $(ENV)
@$(FLAKE8) turnip
-run-api:
+run-api: $(ENV)
$(PSERVE) api.ini --reload
+# XXX cjwatson 2015-10-16: limit to only interesting files
+build-tarball: $(ENV)
+ @echo "Creating deployment tarball at $(TARBALL_BUILD_PATH)"
+ mkdir -p $(TARBALL_BUILD_DIR)
+ tar -czf $(TARBALL_BUILD_PATH) \
+ --exclude-vcs \
+ --exclude build \
+ --exclude dist \
+ --exclude env/local \
+ ./
+
.PHONY: check clean dist lint run-api
=== added file 'bootstrap-requirements.txt'
--- bootstrap-requirements.txt 1970-01-01 00:00:00 +0000
+++ bootstrap-requirements.txt 2015-10-16 12:23:06 +0000
@@ -0,0 +1,2 @@
+pip==7.1.2
+setuptools==18.4
=== added file 'deploy-requirements.txt'
--- deploy-requirements.txt 1970-01-01 00:00:00 +0000
+++ deploy-requirements.txt 2015-10-16 12:23:06 +0000
@@ -0,0 +1,5 @@
+# This will be merged into requirements.txt once the turnip charm uses the
+# new tarball construction code.
+envdir==0.7
+gunicorn==19.3.0
+pygit2==0.22.1
Follow ups