changeset 38056:768bd75835d7

packaging: move most packaging targets to own Makefile Since we're putting everything packaging under one roof, let's define the make targets related to packaging there as well. I didn't move the "osx" target because it is non-trivial. Some targets did change slightly as part of the move. But it was mostly around path normalization. Differential Revision: https://phab.mercurial-scm.org/D3552
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 12 May 2018 18:05:50 -0700
parents 917f635b5c6a
children c76526d7d6e9
files Makefile contrib/packaging/Makefile
diffstat 2 files changed, 200 insertions(+), 115 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sat May 12 12:27:51 2018 -0700
+++ b/Makefile	Sat May 12 18:05:50 2018 -0700
@@ -164,6 +164,37 @@
 
 # Packaging targets
 
+packaging_targets := \
+  centos5 \
+  centos6 \
+  centos7 \
+  deb \
+  docker-centos5 \
+  docker-centos6 \
+  docker-centos7 \
+  docker-debian-jessie \
+  docker-debian-stretch \
+  docker-fedora20 \
+  docker-fedora21 \
+  docker-ubuntu-trusty \
+  docker-ubuntu-trusty-ppa \
+  docker-ubuntu-xenial \
+  docker-ubuntu-xenial-ppa \
+  docker-ubuntu-artful \
+  docker-ubuntu-artful-ppa \
+  docker-ubuntu-bionic \
+  docker-ubuntu-bionic-ppa \
+  fedora20 \
+  fedora21 \
+  linux-wheels \
+  linux-wheels-x86_64 \
+  linux-wheels-i686 \
+  ppa
+
+# Forward packaging targets for convenience.
+$(packaging_targets):
+	$(MAKE) -C contrib/packaging $@
+
 osx:
 	rm -rf build/mercurial
 	/usr/bin/python2.7 setup.py install --optimize=1 \
@@ -203,121 +234,8 @@
 	  --resources contrib/packaging/macosx/ \
 	  "$${OUTPUTDIR:-dist/}"/Mercurial-"$${HGVER}"-macosx"$${OSXVER}".pkg
 
-deb:
-	contrib/packaging/builddeb
-
-ppa:
-	contrib/packaging/builddeb --source-only
-
-contrib/packaging/docker/debian-%: contrib/packaging/docker/debian.template
-	sed "s/__CODENAME__/$*/" $< > $@
-
-docker-debian-jessie: contrib/packaging/docker/debian-jessie
-	contrib/packaging/dockerdeb debian jessie
-
-docker-debian-stretch: contrib/packaging/docker/debian-stretch
-	contrib/packaging/dockerdeb debian stretch
-
-contrib/packaging/docker/ubuntu-%: contrib/packaging/docker/ubuntu.template
-	sed "s/__CODENAME__/$*/" $< > $@
-
-docker-ubuntu-trusty: contrib/packaging/docker/ubuntu-trusty
-	contrib/packaging/dockerdeb ubuntu trusty
-
-docker-ubuntu-trusty-ppa: contrib/packaging/docker/ubuntu-trusty
-	contrib/packaging/dockerdeb ubuntu trusty --source-only
-
-docker-ubuntu-xenial: contrib/packaging/docker/ubuntu-xenial
-	contrib/packaging/dockerdeb ubuntu xenial
-
-docker-ubuntu-xenial-ppa: contrib/packaging/docker/ubuntu-xenial
-	contrib/packaging/dockerdeb ubuntu xenial --source-only
-
-docker-ubuntu-artful: contrib/packaging/docker/ubuntu-artful
-	contrib/packaging/dockerdeb ubuntu artful
-
-docker-ubuntu-artful-ppa: contrib/packaging/docker/ubuntu-artful
-	contrib/packaging/dockerdeb ubuntu artful --source-only
-
-docker-ubuntu-bionic: contrib/packaging/docker/ubuntu-bionic
-	contrib/packaging/dockerdeb ubuntu bionic
-
-docker-ubuntu-bionic-ppa: contrib/packaging/docker/ubuntu-bionic
-	contrib/packaging/dockerdeb ubuntu bionic --source-only
-
-fedora20:
-	mkdir -p packages/fedora20
-	contrib/packaging/buildrpm
-	cp rpmbuild/RPMS/*/* packages/fedora20
-	cp rpmbuild/SRPMS/* packages/fedora20
-	rm -rf rpmbuild
-
-docker-fedora20:
-	mkdir -p packages/fedora20
-	contrib/packaging/dockerrpm fedora20
-
-fedora21:
-	mkdir -p packages/fedora21
-	contrib/packaging/buildrpm
-	cp rpmbuild/RPMS/*/* packages/fedora21
-	cp rpmbuild/SRPMS/* packages/fedora21
-	rm -rf rpmbuild
-
-docker-fedora21:
-	mkdir -p packages/fedora21
-	contrib/packaging/dockerrpm fedora21
-
-centos5:
-	mkdir -p packages/centos5
-	contrib/packaging/buildrpm --withpython
-	cp rpmbuild/RPMS/*/* packages/centos5
-	cp rpmbuild/SRPMS/* packages/centos5
-
-docker-centos5:
-	mkdir -p packages/centos5
-	contrib/packaging/dockerrpm centos5 --withpython
-
-centos6:
-	mkdir -p packages/centos6
-	contrib/packaging/buildrpm --withpython
-	cp rpmbuild/RPMS/*/* packages/centos6
-	cp rpmbuild/SRPMS/* packages/centos6
-
-docker-centos6:
-	mkdir -p packages/centos6
-	contrib/packaging/dockerrpm centos6 --withpython
-
-centos7:
-	mkdir -p packages/centos7
-	contrib/packaging/buildrpm
-	cp rpmbuild/RPMS/*/* packages/centos7
-	cp rpmbuild/SRPMS/* packages/centos7
-
-docker-centos7:
-	mkdir -p packages/centos7
-	contrib/packaging/dockerrpm centos7
-
-linux-wheels: linux-wheels-x86_64 linux-wheels-i686
-
-linux-wheels-x86_64:
-	docker run -e "HGTEST_JOBS=$(shell nproc)" --rm -ti -v `pwd`:/src quay.io/pypa/manylinux1_x86_64 /src/contrib/packaging/build-linux-wheels.sh
-
-linux-wheels-i686:
-	docker run -e "HGTEST_JOBS=$(shell nproc)" --rm -ti -v `pwd`:/src quay.io/pypa/manylinux1_i686 linux32 /src/contrib/packaging/build-linux-wheels.sh
-
 .PHONY: help all local build doc cleanbutpackages clean install install-bin \
 	install-doc install-home install-home-bin install-home-doc \
 	dist dist-notests check tests check-code format-c update-pot \
-	osx deb ppa \
-	docker-debian-jessie \
-	docker-debian-stretch \
-	docker-ubuntu-trusty docker-ubuntu-trusty-ppa \
-	docker-ubuntu-xenial docker-ubuntu-xenial-ppa \
-	docker-ubuntu-artful docker-ubuntu-artful-ppa \
-	docker-ubuntu-bionic docker-ubuntu-bionic-ppa \
-	fedora20 docker-fedora20 \
-	fedora21 docker-fedora21 \
-	centos5 docker-centos5 \
-	centos6 docker-centos6 \
-	centos7 docker-centos7 \
-	linux-wheels
+	$(packaging_targets) \
+	osx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/packaging/Makefile	Sat May 12 18:05:50 2018 -0700
@@ -0,0 +1,167 @@
+$(eval HGROOT := $(shell cd ../..; pwd))
+
+help:
+	@echo 'Packaging Make Targets'
+	@echo ''
+	@echo 'docker-centos-{5, 6, 7}'
+	@echo '   Build an RPM for a specific CentOS version using Docker.'
+	@echo ''
+	@echo 'docker-debian-{jessie, stretch}'
+	@echo '   Build Debian packages specific to a Debian distro using Docker.'
+	@echo ''
+	@echo 'docker-fedora-{20, 21}'
+	@echo '   Build an RPM for a specific Fedora version using Docker.'
+	@echo ''
+	@echo 'docker-ubuntu-{trusty, xenial, artful, bionic}'
+	@echo '   Build Debian package specific to an Ubuntu distro using Docker.'
+	@echo ''
+	@echo 'docker-ubuntu-{trusty, xenial, artful, bionic}-ppa'
+	@echo '   Build a source-only Debian package specific to an Ubuntu distro'
+	@echo '   using Docker.'
+	@echo ''
+	@echo 'linux-wheels'
+	@echo '   Build Linux manylinux wheels using Docker.'
+	@echo ''
+	@echo 'linux-wheels-{x86_64, i686}'
+	@echo '   Build Linux manylinux wheels for a specific architecture using Docker'
+	@echo ''
+	@echo 'deb'
+	@echo '   Build a Debian package locally targeting the current system'
+	@echo ''
+	@echo 'ppa'
+	@echo '   Build a Debian source package locally targeting the current system'
+	@echo ''
+	@echo 'centos-{5, 6, 7}'
+	@echo '   Build an RPM for a specific CentOS version locally'
+	@echo ''
+	@echo 'fedora-{20, 21}'
+	@echo '   Build an RPM for a specific Fedora version locally'
+
+.PHONY: help
+
+.PHONY: deb
+deb:
+	./builddeb
+
+.PHONY: ppa
+ppa:
+	./builddeb --source-only
+
+docker/debian-%: docker/debian.template
+	sed "s/__CODENAME__/$*/" $< > $@
+
+.PHONY: docker-debian-jessie
+docker-debian-jessie: docker/debian-jessie
+	./dockerdeb debian jessie
+
+.PHONY: docker-debian-stretch
+docker-debian-stretch: docker/debian-stretch
+	./dockerdeb debian stretch
+
+docker/ubuntu-%: docker/ubuntu.template
+	sed "s/__CODENAME__/$*/" $< > $@
+
+.PHONY: docker-ubuntu-trusty
+docker-ubuntu-trusty: docker/ubuntu-trusty
+	./dockerdeb ubuntu trusty
+
+.PHONY: docker-ubuntu-trusty-ppa
+docker-ubuntu-trusty-ppa: docker/ubuntu-trusty
+	./dockerdeb ubuntu trusty --source-only
+
+.PHONY: docker-ubuntu-xenial
+docker-ubuntu-xenial: docker/ubuntu-xenial
+	./dockerdeb ubuntu xenial
+
+.PHONY: docker-ubuntu-xenial-ppa
+docker-ubuntu-xenial-ppa: docker/ubuntu-xenial
+	./dockerdeb ubuntu xenial --source-only
+
+.PHONY: docker-ubuntu-artful
+docker-ubuntu-artful: docker/ubuntu-artful
+	./dockerdeb ubuntu artful
+
+.PHONY: docker-ubuntu-artful-ppa
+docker-ubuntu-artful-ppa: docker/ubuntu-artful
+	./dockerdeb ubuntu artful --source-only
+
+.PHONY: docker-ubuntu-bionic
+docker-ubuntu-bionic: docker/ubuntu-bionic
+	./dockerdeb ubuntu bionic
+
+.PHONY: docker-ubuntu-bionic-ppa
+docker-ubuntu-bionic-ppa: docker/ubuntu-bionic
+	./dockerdeb ubuntu bionic --source-only
+
+.PHONY: fedora20
+fedora20:
+	mkdir -p $(HGROOT)/packages/fedora20
+	./buildrpm
+	cp $(HGROOT)/rpmbuild/RPMS/*/* $(HGROOT)/packages/fedora20
+	cp $(HGROOT)/rpmbuild/SRPMS/* $(HGROOT)/packages/fedora20
+	rm -rf $(HGROOT)/rpmbuild
+
+.PHONY: docker-fedora20
+docker-fedora20:
+	mkdir -p $(HGROOT)/packages/fedora20
+	./dockerrpm fedora20
+
+.PHONY: fedora21
+fedora21:
+	mkdir -p $(HGROOT)/packages/fedora21
+	./buildrpm
+	cp $(HGROOT)/rpmbuild/RPMS/*/* $(HGROOT)/packages/fedora21
+	cp $(HGROOT)/rpmbuild/SRPMS/* $(HGROOT)/packages/fedora21
+	rm -rf $(HGROOT)/rpmbuild
+
+.PHONY: docker-fedora21
+docker-fedora21:
+	mkdir -p $(HGROOT)packages/fedora21
+	./dockerrpm fedora21
+
+.PHONY: centos5
+centos5:
+	mkdir -p $(HGROOT)/packages/centos5
+	./buildrpm --withpython
+	cp $(HGROOT)/rpmbuild/RPMS/*/* $(HGROOT)/packages/centos5
+	cp $(HGROOT)/rpmbuild/SRPMS/* $(HGROOT)/packages/centos5
+
+.PHONY: docker-centos5
+docker-centos5:
+	mkdir -p $(HGROOT)/packages/centos5
+	./dockerrpm centos5 --withpython
+
+.PHONY: centos6
+centos6:
+	mkdir -p $(HGROOT)/packages/centos6
+	./buildrpm --withpython
+	cp $(HGROOT)/rpmbuild/RPMS/*/* $(HGROOT)/packages/centos6
+	cp $(HGROOT)/rpmbuild/SRPMS/* $(HGROOT)/packages/centos6
+
+.PHONY: docker-centos6
+docker-centos6:
+	mkdir -p $(HGROOT)/packages/centos6
+	./dockerrpm centos6 --withpython
+
+.PHONY: centos7
+centos7:
+	mkdir -p $(HGROOT)/packages/centos7
+	./buildrpm
+	cp $(HGROOT)/rpmbuild/RPMS/*/* $(HGROOT)/packages/centos7
+	cp $(HGROOT)/rpmbuild/SRPMS/* $(HGROOT)/packages/centos7
+
+.PHONY: docker-centos7
+docker-centos7:
+	mkdir -p $(HGROOT)/packages/centos7
+	./dockerrpm centos7
+
+.PHONY: linux-wheels
+linux-wheels: linux-wheels-x86_64 linux-wheels-i686
+
+.PHONY: linux-wheels-x86_64
+linux-wheels-x86_64:
+	docker run -e "HGTEST_JOBS=$(shell nproc)" --rm -ti -v `pwd`/../..:/src quay.io/pypa/manylinux1_x86_64 /src/contrib/packaging/build-linux-wheels.sh
+
+.PHONY: linux-wheels-i686
+linux-wheels-i686:
+	docker run -e "HGTEST_JOBS=$(shell nproc)" --rm -ti -v `pwd`/../..:/src quay.io/pypa/manylinux1_i686 linux32 /src/contrib/packaging/build-linux-wheels.sh