[PATCH 4 of 7 stable] packaging: introduce generic local rpm build target using python3

Mads Kiilerich mads at kiilerich.com
Sun Oct 27 19:37:12 EDT 2019


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1572198921 -3600
#      Sun Oct 27 18:55:21 2019 +0100
# Branch stable
# Node ID 467d582886f688e01fe59b1d6f2de244d7be1458
# Parent  32dbdaffb2ae030119890e05b87c4677706e7c6a
packaging: introduce generic local rpm build target using python3

It is unnecessary extra work to explicitly add Makefile targets for a random
selection of Fedora versions. Generally, it just works. If not, the root cause
should be fixed.

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -208,7 +208,8 @@ packaging_targets := \
   linux-wheels \
   linux-wheels-x86_64 \
   linux-wheels-i686 \
-  ppa
+  ppa \
+  rpm
 
 # Forward packaging targets for convenience.
 $(packaging_targets):
diff --git a/contrib/packaging/Makefile b/contrib/packaging/Makefile
--- a/contrib/packaging/Makefile
+++ b/contrib/packaging/Makefile
@@ -56,6 +56,9 @@ help:
 	@echo 'ppa'
 	@echo '   Build a Debian source package locally targeting the current system'
 	@echo ''
+	@echo 'rpm'
+	@echo '   Build a RPM targeting the current system using Python 3'
+	@echo ''
 	@echo 'centos{$(strip $(CENTOS_RELEASES))}'
 	@echo '   Build an RPM for a specific CentOS version locally'
 	@echo ''
@@ -96,6 +99,14 @@ endef
 
 $(foreach codename,$(UBUNTU_CODENAMES),$(eval $(call ubuntu_targets,$(codename))))
 
+# Generic RPM target, mainly for Fedora/CentOS/RHEL.
+rpm:
+	mkdir -p $$(HGROOT)/packages/rpm
+	./buildrpm --python3
+	cp $$(HGROOT)/contrib/packaging/rpmbuild/RPMS/*/* $$(HGROOT)/packages/rpm
+	cp $$(HGROOT)/contrib/packaging/rpmbuild/SRPMS/* $$(HGROOT)/packages/rpm
+	rm -rf $(HGROOT)/rpmbuild
+
 # Fedora targets.
 define fedora_targets
 .PHONY: fedora$(1)



More information about the Mercurial-devel mailing list