mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 15:21:13 +03:00
Merge pull request #414 from jlaska/pbuilder
Build deb's using pbuilder
This commit is contained in:
commit
4d5b46780a
6
.dput.cf
Normal file
6
.dput.cf
Normal file
@ -0,0 +1,6 @@
|
||||
[mini_dinstall]
|
||||
fqdn = localhost
|
||||
method = local
|
||||
incoming = FIXME/deb-repo/mini-dinstall/incoming
|
||||
run_dinstall = 0
|
||||
post_upload_command = mini-dinstall -b -v
|
16
.mini-dinstall.cf
Normal file
16
.mini-dinstall.cf
Normal file
@ -0,0 +1,16 @@
|
||||
[DEFAULT]
|
||||
archivedir = FIXME/deb-repo
|
||||
mail_to =
|
||||
verify_sigs = false
|
||||
architectures = all, amd64
|
||||
archive_style = flat
|
||||
generate_release = true
|
||||
mail_on_success = false
|
||||
release_codename = ansible-tower
|
||||
release_description = Ansible Tower
|
||||
release_label = ansible-tower
|
||||
release_origin = ansible-tower
|
||||
|
||||
[trusty]
|
||||
|
||||
[precise]
|
155
Makefile
155
Makefile
@ -1,4 +1,4 @@
|
||||
PYTHON=python
|
||||
PYTHON = python
|
||||
SITELIB=$(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
|
||||
OFFICIAL ?= no
|
||||
PACKER ?= packer
|
||||
@ -67,7 +67,7 @@ SETUP_TAR_CHECKSUM=$(NAME)-setup-CHECKSUM
|
||||
DEBUILD_BIN ?= debuild
|
||||
DEBUILD_OPTS = --source-option="-I"
|
||||
DPUT_BIN ?= dput
|
||||
DPUT_OPTS ?=
|
||||
DPUT_OPTS ?= -c .dput.cf -u
|
||||
ifeq ($(OFFICIAL),yes)
|
||||
DEB_DIST ?= stable
|
||||
# Sign official builds
|
||||
@ -76,11 +76,20 @@ else
|
||||
DEB_DIST ?= unstable
|
||||
# Do not sign development builds
|
||||
DEBUILD_OPTS += -uc -us
|
||||
DPUT_OPTS += -u
|
||||
endif
|
||||
DEBUILD = $(DEBUILD_BIN) $(DEBUILD_OPTS)
|
||||
DEB_PPA ?= reprepro
|
||||
DEB_PPA ?= mini_dinstall
|
||||
DEB_ARCH ?= amd64
|
||||
DEB_NVR = $(NAME)_$(VERSION)-$(RELEASE)~$(DEB_DIST)
|
||||
DEB_NVRA = $(DEB_NVR)_$(DEB_ARCH)
|
||||
DEB_NVRS = $(DEB_NVR)_source
|
||||
DEB_TAR_NAME=$(NAME)-$(VERSION)
|
||||
DEB_TAR_FILE=$(NAME)_$(VERSION).orig.tar.gz
|
||||
|
||||
# pbuilder parameters
|
||||
PBUILDER_CACHE_DIR = /var/cache/pbuilder
|
||||
PBUILDER_BIN ?= pbuilder
|
||||
PBUILDER_OPTS ?= --debootstrapopts --variant=buildd --distribution $(DEB_DIST) --architecture $(DEB_ARCH) --basetgz $(PBUILDER_CACHE_DIR)/$(DEB_DIST)-$(DEB_ARCH)-base.tgz --buildresult $(PWD)/deb-build
|
||||
|
||||
# RPM build parameters
|
||||
MOCK_BIN ?= mock
|
||||
@ -107,11 +116,28 @@ OFFLINE_TAR_FILE = $(OFFLINE_TAR_NAME).tar.gz
|
||||
OFFLINE_TAR_LINK = $(NAME)-setup-bundle-latest.$(DIST_FULL).tar.gz
|
||||
OFFLINE_TAR_CHECKSUM=$(NAME)-setup-bundle-CHECKSUM
|
||||
|
||||
DISTRO := $(shell . /etc/os-release 2>/dev/null && echo $${ID} || echo redhat)
|
||||
# Detect underlying OS distribution
|
||||
DISTRO ?=
|
||||
ifneq (,$(wildcard /etc/lsb-release))
|
||||
DISTRO = $(shell . /etc/lsb-release && echo $${DISTRIB_ID} | tr '[:upper:]' '[:lower:]')
|
||||
endif
|
||||
ifneq (,$(wildcard /etc/os-release))
|
||||
DISTRO = $(shell . /etc/os-release && echo $${ID})
|
||||
endif
|
||||
ifneq (,$(wildcard /etc/fedora-release))
|
||||
DISTRO = fedora
|
||||
endif
|
||||
ifneq (,$(wildcard /etc/centos-release))
|
||||
DISTRO = centos
|
||||
endif
|
||||
ifneq (,$(wildcard /etc/redhat-release))
|
||||
DISTRO = redhat
|
||||
endif
|
||||
|
||||
# Adjust `setup.py install` parameters based on OS distribution
|
||||
SETUP_INSTALL_ARGS = --skip-build --no-compile --root=$(DESTDIR) -v
|
||||
ifeq ($(DISTRO),ubuntu)
|
||||
SETUP_INSTALL_ARGS = --skip-build --no-compile --root=$(DESTDIR) -v --install-layout=deb
|
||||
else
|
||||
SETUP_INSTALL_ARGS = --skip-build --no-compile --root=$(DESTDIR) -v
|
||||
SETUP_INSTALL_ARGS += --install-layout=deb
|
||||
endif
|
||||
|
||||
.DEFAULT_GOAL := build
|
||||
@ -122,7 +148,7 @@ endif
|
||||
receiver test test_coverage coverage_html ui_analysis_report test_ui test_jenkins dev_build \
|
||||
release_build release_clean sdist rpmtar mock-rpm mock-srpm rpm-sign \
|
||||
devjs minjs testjs testjs_ci node-tests browser-tests jshint ngdocs sync_ui \
|
||||
deb deb-src debian reprepro setup_tarball \
|
||||
deb deb-src debian debsign pbuilder reprepro setup_tarball \
|
||||
virtualbox-ovf virtualbox-centos-7 virtualbox-centos-6 \
|
||||
clean-bundle setup_bundle_tarball
|
||||
|
||||
@ -353,7 +379,8 @@ devjs: node_modules clean-ui Brocfile.js bower.json Gruntfile.js
|
||||
$(BROCCOLI) build awx/ui/dist -- --debug
|
||||
|
||||
# Build minified JS/CSS.
|
||||
minjs: node_modules clean-ui Brocfile.js
|
||||
minjs: awx/ui/dist/tower.min.css.gz
|
||||
awx/ui/dist/tower.min.css.gz: node_modules Brocfile.js
|
||||
$(BROCCOLI) build awx/ui/dist -- --silent --no-debug --no-tests --compress --no-docs --no-sourcemaps
|
||||
|
||||
minjs_ci: node_modules clean-ui Brocfile.js
|
||||
@ -391,7 +418,7 @@ tar-build/$(SETUP_TAR_CHECKSUM):
|
||||
|
||||
setup_tarball: tar-build/$(SETUP_TAR_FILE) tar-build/$(SETUP_TAR_CHECKSUM)
|
||||
@echo "#############################################"
|
||||
@echo "Setup artifacts:"
|
||||
@echo "Artifacts:"
|
||||
@echo tar-build/$(SETUP_TAR_FILE)
|
||||
@echo tar-build/$(SETUP_TAR_LINK)
|
||||
@echo tar-build/$(SETUP_TAR_CHECKSUM)
|
||||
@ -401,10 +428,14 @@ release_clean:
|
||||
-(rm *.tar)
|
||||
-(rm -rf ($RELEASE))
|
||||
|
||||
dist/$(SDIST_TAR_FILE):
|
||||
dist/$(SDIST_TAR_FILE): awx/ui/dist/tower.min.css.gz
|
||||
BUILD="$(BUILD)" $(PYTHON) setup.py sdist
|
||||
|
||||
sdist: minjs dist/$(SDIST_TAR_FILE)
|
||||
sdist: dist/$(SDIST_TAR_FILE)
|
||||
@echo "#############################################"
|
||||
@echo "Artifacts:"
|
||||
@echo dist/$(SDIST_TAR_FILE)
|
||||
@echo "#############################################"
|
||||
|
||||
# Build setup bundle tarball
|
||||
setup-bundle-build:
|
||||
@ -455,22 +486,22 @@ rpmtar: sdist rpm-build/$(SDIST_TAR_FILE)
|
||||
rpm-build/$(RPM_NVR).src.rpm: /etc/mock/$(MOCK_CFG).cfg
|
||||
$(MOCK_BIN) -r $(MOCK_CFG) --resultdir rpm-build --buildsrpm --spec rpm-build/$(NAME).spec --sources rpm-build \
|
||||
--define "tower_version $(VERSION)" --define "tower_release $(RELEASE)"
|
||||
@echo "#############################################"
|
||||
@echo "SRPM artifacts:"
|
||||
@echo rpm-build/$(RPM_NVR).src.rpm
|
||||
@echo "#############################################"
|
||||
|
||||
mock-srpm: rpmtar rpm-build/$(RPM_NVR).src.rpm
|
||||
@echo "#############################################"
|
||||
@echo "Artifacts:"
|
||||
@echo rpm-build/$(RPM_NVR).src.rpm
|
||||
@echo "#############################################"
|
||||
|
||||
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 \
|
||||
--define "tower_version $(VERSION)" --define "tower_release $(RELEASE)"
|
||||
@echo "#############################################"
|
||||
@echo "RPM artifacts:"
|
||||
@echo rpm-build/$(RPM_NVR).$(RPM_ARCH).rpm
|
||||
@echo "#############################################"
|
||||
|
||||
mock-rpm: rpmtar rpm-build/$(RPM_NVR).$(RPM_ARCH).rpm
|
||||
@echo "#############################################"
|
||||
@echo "Artifacts:"
|
||||
@echo rpm-build/$(RPM_NVR).$(RPM_ARCH).rpm
|
||||
@echo "#############################################"
|
||||
|
||||
ifeq ($(OFFICIAL),yes)
|
||||
rpm-build/$(GPG_FILE): rpm-build
|
||||
@ -483,63 +514,77 @@ endif
|
||||
deb-build:
|
||||
mkdir -p $@
|
||||
|
||||
deb-build/$(SDIST_TAR_NAME):
|
||||
mkdir -p deb-build
|
||||
deb-build/$(DEB_TAR_NAME): dist/$(SDIST_TAR_FILE)
|
||||
mkdir -p $(dir $@)
|
||||
tar -C deb-build/ -xvf dist/$(SDIST_TAR_FILE)
|
||||
cp -a packaging/debian deb-build/$(SDIST_TAR_NAME)/
|
||||
cp packaging/remove_tower_source.py deb-build/$(SDIST_TAR_NAME)/debian/
|
||||
sed -ie "s#^$(NAME) (\([^)]*\)) \([^;]*\);#$(NAME) ($(VERSION)-$(RELEASE)) $(DEB_DIST);#" deb-build/$(SDIST_TAR_NAME)/debian/changelog
|
||||
mv deb-build/$(SDIST_TAR_NAME) deb-build/$(DEB_TAR_NAME)
|
||||
cd deb-build && tar czf $(DEB_TAR_FILE) $(DEB_TAR_NAME)
|
||||
cp -a packaging/debian deb-build/$(DEB_TAR_NAME)/
|
||||
cp packaging/remove_tower_source.py deb-build/$(DEB_TAR_NAME)/debian/
|
||||
sed -ie "s#^$(NAME) (\([^)]*\)) \([^;]*\);#$(NAME) ($(VERSION)-$(RELEASE)~$(DEB_DIST)) $(DEB_DIST);#" deb-build/$(DEB_TAR_NAME)/debian/changelog
|
||||
|
||||
ifeq ($(OFFICIAL),yes)
|
||||
debian: sdist deb-build/$(SDIST_TAR_NAME) deb-build/$(GPG_FILE)
|
||||
debian: deb-build/$(DEB_TAR_NAME) deb-build/$(GPG_FILE)
|
||||
|
||||
deb-build/$(GPG_FILE): deb-build
|
||||
$(GPG_BIN) --export -a "${GPG_KEY}" > "$@"
|
||||
else
|
||||
debian: sdist deb-build/$(SDIST_TAR_NAME)
|
||||
debian: deb-build/$(DEB_TAR_NAME)
|
||||
endif
|
||||
|
||||
deb-build/$(NAME)_$(VERSION)-$(RELEASE)_$(DEB_ARCH).deb:
|
||||
cd deb-build/$(SDIST_TAR_NAME) && $(DEBUILD) -b
|
||||
deb-build/$(DEB_NVR).dsc: deb-build/$(DEB_TAR_NAME)
|
||||
cd deb-build/$(DEB_TAR_NAME) && $(DEBUILD) -S
|
||||
|
||||
deb-src: deb-build/$(DEB_NVR).dsc
|
||||
@echo "#############################################"
|
||||
@echo "DEB artifacts:"
|
||||
@echo deb-build/$(NAME)_$(VERSION)-$(RELEASE)_$(DEB_ARCH).deb
|
||||
@echo "Artifacts:"
|
||||
@echo deb-build/$(DEB_NVR).dsc
|
||||
@echo deb-build/$(DEB_NVRS).changes
|
||||
@echo "#############################################"
|
||||
|
||||
deb: debian deb-build/$(NAME)_$(VERSION)-$(RELEASE)_$(DEB_ARCH).deb
|
||||
$(PBUILDER_CACHE_DIR)/$(DEB_DIST)-$(DEB_ARCH)-base.tgz:
|
||||
$(PBUILDER_BIN) create $(PBUILDER_OPTS)
|
||||
|
||||
deb-build/$(NAME)_$(VERSION)-$(RELEASE)_source.changes:
|
||||
cd deb-build/$(SDIST_TAR_NAME) && $(DEBUILD) -S
|
||||
pbuilder: $(PBUILDER_CACHE_DIR)/$(DEB_DIST)-$(DEB_ARCH)-base.tgz deb-build/$(DEB_NVRA).deb
|
||||
|
||||
deb-build/$(DEB_NVRA).deb: deb-build/$(DEB_NVR).dsc $(PBUILDER_CACHE_DIR)/$(DEB_DIST)-$(DEB_ARCH)-base.tgz
|
||||
# cd deb-build/$(DEB_TAR_NAME) && $(DEBUILD) -b
|
||||
$(PBUILDER_BIN) update $(PBUILDER_OPTS)
|
||||
$(PBUILDER_BIN) execute $(PBUILDER_OPTS) --save-after-exec packaging/pbuilder/setup.sh $(DEB_DIST)
|
||||
$(PBUILDER_BIN) build $(PBUILDER_OPTS) deb-build/$(DEB_NVR).dsc
|
||||
|
||||
deb: deb-build/$(DEB_NVRA).deb
|
||||
@echo "#############################################"
|
||||
@echo "DEB artifacts:"
|
||||
@echo deb-build/$(NAME)_$(VERSION)-$(RELEASE)_source.changes
|
||||
@echo "Artifacts:"
|
||||
@echo deb-build/$(DEB_NVRA).deb
|
||||
@echo "#############################################"
|
||||
|
||||
deb-src: debian deb-build/$(NAME)_$(VERSION)-$(RELEASE)_source.changes
|
||||
deb-upload: deb-build/$(DEB_NVRA).changes
|
||||
$(DPUT_BIN) $(DPUT_OPTS) $(DEB_PPA) deb-build/$(DEB_NVRA).changes
|
||||
|
||||
deb-upload: deb
|
||||
$(DPUT_BIN) $(DPUT_OPTS) $(DEB_PPA) deb-build/$(NAME)_$(VERSION)-$(RELEASE)_$(DEB_ARCH).changes ; \
|
||||
dput: deb-build/$(DEB_NVRA).changes
|
||||
$(DPUT_BIN) $(DPUT_OPTS) $(DEB_PPA) deb-build/$(DEB_NVRA).changes
|
||||
|
||||
deb-src-upload: deb-src
|
||||
$(DPUT_BIN) $(DPUT_OPTS) $(DEB_PPA) deb-build/$(NAME)_$(VERSION)-$(RELEASE)_source.changes ; \
|
||||
deb-src-upload: deb-build/$(DEB_NVRS).changes
|
||||
$(DPUT_BIN) $(DPUT_OPTS) $(DEB_PPA) deb-build/$(DEB_NVRS).changes
|
||||
|
||||
reprepro: deb
|
||||
mkdir -p $@/conf
|
||||
cp -a packaging/reprepro/* $@/conf/
|
||||
debsign: deb-build/$(DEB_NVRS).changes debian deb-build/$(DEB_NVR).dsc
|
||||
debsign -k$(GPG_KEY) deb-build/$(DEB_NVRS).changes deb-build/$(DEB_NVR).dsc
|
||||
|
||||
reprepro/conf:
|
||||
mkdir -p $@
|
||||
cp -a packaging/reprepro/* $@/
|
||||
if [ "$(OFFICIAL)" = "yes" ] ; then \
|
||||
echo "ask-passphrase" >> $@/conf/options; \
|
||||
sed -i -e 's|^\(Codename:\)|SignWith: $(GPG_KEY)\n\1|' $@/conf/distributions ; \
|
||||
fi
|
||||
@DEB=deb-build/$(NAME)_$(VERSION)-$(RELEASE)_$(DEB_ARCH).deb ; \
|
||||
for DIST in trusty precise ; do \
|
||||
echo "Removing '$(NAME)' from the $${DIST} apt repo" ; \
|
||||
echo reprepro --export=force -b $@ remove $${DIST} $(NAME) ; \
|
||||
done; \
|
||||
reprepro --export=force -b $@ clearvanished; \
|
||||
for DIST in trusty precise ; do \
|
||||
echo "Adding $${DEB} to the $${DIST} apt repo"; \
|
||||
reprepro --keepunreferencedfiles --export=force -b $@ --ignore=brokenold includedeb $${DIST} $${DEB} ; \
|
||||
done; \
|
||||
|
||||
reprepro: deb-build/$(DEB_NVRA).deb reprepro/conf
|
||||
reprepro --export=force -b $@ clearvanished
|
||||
for COMPONENT in non-free ; do \
|
||||
reprepro --export=force -b $@ -C $$COMPONENT remove $(DEB_DIST) $(NAME) ; \
|
||||
reprepro --export=force -b $@ --keepunreferencedfiles --ignore=brokenold -C $$COMPONENT includedeb $(DEB_DIST) deb-build/$(DEB_NVRA).deb ; \
|
||||
done
|
||||
|
||||
#
|
||||
# Packer build targets
|
||||
|
Loading…
Reference in New Issue
Block a user