Gather pip requirements at package build time

Previously, requirements were gathered prior to the `sdist` target, and
included in the sdist tarball.  As some requirements are compiled, this caused
problems where the compiled dependencies were linked against the wrong
libraries.  This pull-request addresses that by moving the requirements
gathering into the `dh_prep` and `%build` steps of the packaging process.
This commit is contained in:
James Laska
2015-08-26 11:49:09 -04:00
parent 549809dfa4
commit 32a4a941e0
2 changed files with 21 additions and 15 deletions

View File

@@ -6,9 +6,8 @@ recursive-include awx/ui/templates *.html
recursive-include awx/ui/dist * recursive-include awx/ui/dist *
recursive-include awx/playbooks *.yml recursive-include awx/playbooks *.yml
recursive-include awx/lib/site-packages * recursive-include awx/lib/site-packages *
recursive-include requirements *.txt
recursive-include config * recursive-include config *
recursive-include config/deb *
recursive-include config/rpm *
recursive-exclude awx devonly.py* recursive-exclude awx devonly.py*
recursive-exclude awx/api/tests * recursive-exclude awx/api/tests *
recursive-exclude awx/main/tests * recursive-exclude awx/main/tests *
@@ -18,5 +17,6 @@ include tools/scripts/ansible-tower-service
include tools/munin_monitors/* include tools/munin_monitors/*
include tools/sosreport/* include tools/sosreport/*
include COPYING include COPYING
include Makefile
prune awx/public prune awx/public
prune awx/projects prune awx/projects

View File

@@ -71,11 +71,13 @@ else
endif endif
DEBUILD = $(DEBUILD_BIN) $(DEBUILD_OPTS) DEBUILD = $(DEBUILD_BIN) $(DEBUILD_OPTS)
DEB_PPA ?= reprepro DEB_PPA ?= reprepro
DEB_ARCH ?= amd64
# RPM build parameters # RPM build parameters
RPM_SPECDIR= packaging/rpm RPM_SPECDIR= packaging/rpm
RPM_SPEC = $(RPM_SPECDIR)/$(NAME).spec RPM_SPEC = $(RPM_SPECDIR)/$(NAME).spec
RPM_DIST ?= $(shell rpm --eval '%{?dist}' 2>/dev/null) RPM_DIST ?= $(shell rpm --eval '%{?dist}' 2>/dev/null)
RPM_ARCH ?= $(shell rpm --eval '%{_arch}' 2>/dev/null)
RPM_NVR = $(NAME)-$(VERSION)-$(RELEASE)$(RPM_DIST) RPM_NVR = $(NAME)-$(VERSION)-$(RELEASE)$(RPM_DIST)
MOCK_BIN ?= mock MOCK_BIN ?= mock
MOCK_CFG ?= MOCK_CFG ?=
@@ -149,15 +151,19 @@ push:
git push origin master git push origin master
# Install runtime, development and jenkins requirements # Install runtime, development and jenkins requirements
requirements requirements_dev requirements_jenkins: %: real-% awx/lib/site-packages/oslo/__init__.py awx/lib/site-packages/dogpile/__init__.py requirements requirements_dev requirements_jenkins: %: real-%
# Create missing __init__.py files # Create missing __init__.py files
awx/lib/site-packages/%/__init__.py: awx/lib/site-packages/%/__init__.py:
touch $@ touch $@
# Install third-party requirements needed for development environment. # Install third-party requirements needed for development environment.
# NOTE:
# * --target is only supported on newer versions of pip
# * https://github.com/pypa/pip/issues/3056 - the workaround is to override the `install-platlib`
# * --user (in conjunction with PYTHONUSERBASE="awx" may be a better option
real-requirements: real-requirements:
pip install -r requirements/requirements.txt --target awx/lib/site-packages/ --ignore-installed pip install -r requirements/requirements.txt --target awx/lib/site-packages/ --ignore-installed --install-option="--install-platlib=\$$base/lib/python"
real-requirements_dev: real-requirements real-requirements_dev: real-requirements
# (cat requirements/requirements.txt requirements/requirements_dev.txt > /tmp/req_dev.txt); # (cat requirements/requirements.txt requirements/requirements_dev.txt > /tmp/req_dev.txt);
@@ -368,7 +374,7 @@ release_clean:
dist/$(SDIST_TAR_FILE): dist/$(SDIST_TAR_FILE):
BUILD="$(BUILD)" $(PYTHON) setup.py sdist BUILD="$(BUILD)" $(PYTHON) setup.py sdist
sdist: minjs requirements dist/$(SDIST_TAR_FILE) sdist: minjs dist/$(SDIST_TAR_FILE)
# Build setup offline tarball # Build setup offline tarball
offline_tar-build/$(DIST_FULL)/$(OFFLINE_TAR_FILE): offline_tar-build/$(DIST_FULL)/$(OFFLINE_TAR_FILE):
@@ -410,22 +416,22 @@ rpm-build/$(RPM_NVR).src.rpm: /etc/mock/$(MOCK_CFG).cfg
mock-srpm: rpmtar rpm-build/$(RPM_NVR).src.rpm mock-srpm: rpmtar rpm-build/$(RPM_NVR).src.rpm
rpm-build/$(RPM_NVR).noarch.rpm: rpm-build/$(RPM_NVR).src.rpm rpm-build/$(RPM_NVR).$(RPM_ARCH).rpm: rpm-build/$(RPM_NVR).src.rpm
$(MOCK_BIN) -r $(MOCK_CFG) --resultdir rpm-build --rebuild rpm-build/$(RPM_NVR).src.rpm \ $(MOCK_BIN) -r $(MOCK_CFG) --resultdir rpm-build --rebuild rpm-build/$(RPM_NVR).src.rpm \
--define "tower_version $(VERSION)" --define "tower_release $(RELEASE)" --define "tower_version $(VERSION)" --define "tower_release $(RELEASE)"
@echo "#############################################" @echo "#############################################"
@echo "RPM artifacts:" @echo "RPM artifacts:"
@echo rpm-build/$(RPM_NVR).noarch.rpm @echo rpm-build/$(RPM_NVR).$(RPM_ARCH).rpm
@echo "#############################################" @echo "#############################################"
mock-rpm: rpmtar rpm-build/$(RPM_NVR).noarch.rpm mock-rpm: rpmtar rpm-build/$(RPM_NVR).$(RPM_ARCH).rpm
ifeq ($(OFFICIAL),yes) ifeq ($(OFFICIAL),yes)
rpm-build/$(GPG_FILE): rpm-build rpm-build/$(GPG_FILE): rpm-build
gpg --export -a "${GPG_KEY}" > "$@" gpg --export -a "${GPG_KEY}" > "$@"
rpm-sign: rpm-build/$(GPG_FILE) rpmtar rpm-build/$(RPM_NVR).noarch.rpm rpm-sign: rpm-build/$(GPG_FILE) rpmtar rpm-build/$(RPM_NVR).$(RPM_ARCH).rpm
rpm --define "_signature gpg" --define "_gpg_name $(GPG_KEY)" --addsign rpm-build/$(RPM_NVR).noarch.rpm rpm --define "_signature gpg" --define "_gpg_name $(GPG_KEY)" --addsign rpm-build/$(RPM_NVR).$(RPM_ARCH).rpm
endif endif
deb-build/$(SDIST_TAR_NAME): deb-build/$(SDIST_TAR_NAME):
@@ -437,14 +443,14 @@ deb-build/$(SDIST_TAR_NAME):
debian: sdist deb-build/$(SDIST_TAR_NAME) debian: sdist deb-build/$(SDIST_TAR_NAME)
deb-build/$(NAME)_$(VERSION)-$(RELEASE)_all.deb: deb-build/$(NAME)_$(VERSION)-$(RELEASE)_$(DEB_ARCH).deb:
cd deb-build/$(SDIST_TAR_NAME) && $(DEBUILD) -b cd deb-build/$(SDIST_TAR_NAME) && $(DEBUILD) -b
@echo "#############################################" @echo "#############################################"
@echo "DEB artifacts:" @echo "DEB artifacts:"
@echo deb-build/$(NAME)_$(VERSION)-$(RELEASE)_all.deb @echo deb-build/$(NAME)_$(VERSION)-$(RELEASE)_$(DEB_ARCH).deb
@echo "#############################################" @echo "#############################################"
deb: debian deb-build/$(NAME)_$(VERSION)-$(RELEASE)_all.deb deb: debian deb-build/$(NAME)_$(VERSION)-$(RELEASE)_$(DEB_ARCH).deb
deb-build/$(NAME)_$(VERSION)-$(RELEASE)_source.changes: deb-build/$(NAME)_$(VERSION)-$(RELEASE)_source.changes:
cd deb-build/$(SDIST_TAR_NAME) && $(DEBUILD) -S cd deb-build/$(SDIST_TAR_NAME) && $(DEBUILD) -S
@@ -456,7 +462,7 @@ deb-build/$(NAME)_$(VERSION)-$(RELEASE)_source.changes:
deb-src: debian deb-build/$(NAME)_$(VERSION)-$(RELEASE)_source.changes deb-src: debian deb-build/$(NAME)_$(VERSION)-$(RELEASE)_source.changes
deb-upload: deb deb-upload: deb
$(DPUT_BIN) $(DPUT_OPTS) $(DEB_PPA) deb-build/$(NAME)_$(VERSION)-$(RELEASE)_amd64.changes ; \ $(DPUT_BIN) $(DPUT_OPTS) $(DEB_PPA) deb-build/$(NAME)_$(VERSION)-$(RELEASE)_$(DEB_ARCH).changes ; \
deb-src-upload: deb-src deb-src-upload: deb-src
$(DPUT_BIN) $(DPUT_OPTS) $(DEB_PPA) deb-build/$(NAME)_$(VERSION)-$(RELEASE)_source.changes ; \ $(DPUT_BIN) $(DPUT_OPTS) $(DEB_PPA) deb-build/$(NAME)_$(VERSION)-$(RELEASE)_source.changes ; \
@@ -464,7 +470,7 @@ deb-src-upload: deb-src
reprepro: deb reprepro: deb
mkdir -p reprepro/conf mkdir -p reprepro/conf
cp -a packaging/reprepro/* reprepro/conf/ cp -a packaging/reprepro/* reprepro/conf/
@DEB=deb-build/$(NAME)_$(VERSION)-$(RELEASE)_all.deb ; \ @DEB=deb-build/$(NAME)_$(VERSION)-$(RELEASE)_$(DEB_ARCH).deb ; \
for DIST in trusty precise ; do \ for DIST in trusty precise ; do \
echo "Removing '$(NAME)' from the $${DIST} apt repo" ; \ echo "Removing '$(NAME)' from the $${DIST} apt repo" ; \
echo reprepro --export=force -b reprepro remove $${DIST} $(NAME) ; \ echo reprepro --export=force -b reprepro remove $${DIST} $(NAME) ; \