[Reproducible-commits] [cdbs] 18/41: Refactor python snippets: Handle flavors (not versions). Introduce new variables cdbs_python_flavors cdbs_curpython, and per-implementation variables cdbs_$python_mainflavor. Drop unused variables cdbs_pythonsystem_python3 cdbs_python_stem cdbs_python_first_supported_version cdbs_python3_first_supported_version cdbs_python_nondefault_version cdbs_python3_nondefault_version cdbs_python_primary_version cdbs_python3_primary_version cdbs_curpythonbuildversions. Deprecate variables cdbs_curpythonstem cdbs_python_current_binary cdbs_python3_current_binary cdbs_python_current_version cdbs_python3_current_version cdbs_python_supported_versions cdbs_python3_supported_versions cdbs_python_build_versions.

Mattia Rizzolo mattia at debian.org
Tue May 10 14:42:27 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch reproducible
in repository cdbs.

commit d40acf0014fa0aff158c6e2ba280d5c32745508c
Author: Jonas Smedegaard <dr at jones.dk>
Date:   Sun Jan 19 03:44:17 2014 +0100

    Refactor python snippets: Handle flavors (not versions). Introduce new variables cdbs_python_flavors cdbs_curpython, and per-implementation variables cdbs_$python_mainflavor. Drop unused variables cdbs_pythonsystem_python3 cdbs_python_stem cdbs_python_first_supported_version cdbs_python3_first_supported_version cdbs_python_nondefault_version cdbs_python3_nondefault_version cdbs_python_primary_version cdbs_python3_primary_version cdbs_curpythonbuildversions. Deprecate variables cdbs_cu [...]
    
    Dropped variables verified against <http://codesearch.debian.net>.
---
 1/class/python-autotools.mk.in |  13 +++--
 1/class/python-distutils.mk.in |  14 ++---
 1/class/python-sugar.mk.in     |   8 +--
 1/class/python-vars.mk.in      | 114 ++++++++++++++++++++++++++---------------
 debian/TODO                    |   1 +
 5 files changed, 94 insertions(+), 56 deletions(-)

diff --git a/1/class/python-autotools.mk.in b/1/class/python-autotools.mk.in
index d2497b1..5c7c758 100644
--- a/1/class/python-autotools.mk.in
+++ b/1/class/python-autotools.mk.in
@@ -24,9 +24,10 @@ include $(_cdbs_class_path)/python-module.mk$(_cdbs_makefile_suffix)
 
 # Flavors are used if more than a single Python build is needed
 # Used in implicit rules, so must be set before including makefile
+# (leading "python" stripped to stay compatible with CDBS << 0.5)
 DEB_MAKE_FLAVORS ?= $(strip \
-	$(if $(word 2,$(cdbs_python_build_versions)),\
-		$(cdbs_python_build_versions)))
+	$(if $(word 2,$(cdbs_python_flavors)),\
+		$(strip python%,%,$(cdbs_python_flavors))))
 
 include $(_cdbs_class_path)/autotools.mk$(_cdbs_makefile_suffix)
 
@@ -40,9 +41,13 @@ CDBS_BUILD_DEPENDS += , $(CDBS_BUILD_DEPENDS_class_python-autotools)
 CDBS_BUILD_DEPENDS_class_python-autotools_python ?= $(cdbs_python_builddeps)
 CDBS_BUILD_DEPENDS += , $(CDBS_BUILD_DEPENDS_class_python-autotools_python)
 
+# (prepend "python" to digit flavors to stay compatible with CDBS << 0.5)
 cdbs_make_curpythonruntime = $(or $(strip \
-	$(python$(cdbs_python$(cdbs_curpythonstem)_nondefault_version):%=python%)),$(strip \
-	$(call cdbs_python_binary,python$(cdbs_make_curflavor))))
+	$(_cdbs_$(cdbs_curpython)_altflavor)),$(strip \
+	$(call cdbs_python_binary,$(strip \
+		$(patsubst 2%,python2%,\
+			$(patsubst 3%,python3%,\
+				$(cdbs_make_curflavor)))))))
 
 DEB_CONFIGURE_SCRIPT_ENV_PYTHON ?= PYTHON="$(cdbs_make_curpythonruntime)"
 cdbs_autotools_configure_env += $(DEB_CONFIGURE_SCRIPT_ENV_PYTHON)
diff --git a/1/class/python-distutils.mk.in b/1/class/python-distutils.mk.in
index d688147..e99b5f1 100644
--- a/1/class/python-distutils.mk.in
+++ b/1/class/python-distutils.mk.in
@@ -118,8 +118,8 @@ $(patsubst %,debian/python-module-stampdir/%,$(cdbs_python_indep_packages)) :: d
 $(patsubst %,debian/python-module-stampdir/%,$(cdbs_python_arch_packages)) :: debian/python-module-stampdir/%:
 	set -e; \
 	cd $(cdbs_python_distutils_srcdir) && \
-		$(foreach buildver,$(cdbs_curpythonbuildversions),\
-			$(call cdbs_python_binary,python$(buildver)) \
+		$(foreach flavor,$(cdbs_curpythonflavors),\
+			$(call cdbs_python_binary,$(flavor)) \
 				$(cdbs_python_setup_cmd) build \
 				$(cdbs_python_build_args); )
 	touch $@
@@ -139,13 +139,13 @@ $(patsubst %,install/%,$(cdbs_python_indep_packages)) :: install/%:
 $(patsubst %,install/%,$(cdbs_python_arch_packages)) :: install/%:
 	set -e; \
 	cd $(cdbs_python_distutils_srcdir) && \
-		$(foreach buildver,$(cdbs_curpythonbuildversions),\
-			$(call cdbs_python_binary,python$(buildver)) \
+		$(foreach flavor,$(cdbs_curpythonflavors),\
+			$(call cdbs_python_binary,$(flavor)) \
 				$(cdbs_python_setup_cmd) install \
 				--root="$(cdbs_python_destdir)" \
 				--install-layout=deb \
 				$(if $(DEB_PYTHON_DISTUTILS_INSTALLDIR_SKEL),\
-					--install-lib=$(call _cdbs_expand_python_distutils_skeldir,python$(buildver))) \
+					--install-lib=$(call _cdbs_expand_python_distutils_skeldir,$(flavor))) \
 				$(cdbs_python_install_args); )
 
 
@@ -160,8 +160,8 @@ $(patsubst %,python-module-clean/%,$(cdbs_python_indep_packages)) :: python-modu
 
 $(patsubst %,python-module-clean/%,$(cdbs_python_arch_packages)) :: python-module-clean/%:
 	-cd $(cdbs_python_distutils_srcdir) && \
-		$(foreach buildver,$(cdbs_curpythonbuildversions),\
-			$(call cdbs_python_binary,python$(buildver)) \
+		$(foreach flavor,$(cdbs_curpythonflavors),\
+			$(call cdbs_python_binary,$(flavor)) \
 				$(cdbs_python_setup_cmd) clean \
 				$(cdbs_python_clean_args); )
 
diff --git a/1/class/python-sugar.mk.in b/1/class/python-sugar.mk.in
index ef437e1..c62b823 100644
--- a/1/class/python-sugar.mk.in
+++ b/1/class/python-sugar.mk.in
@@ -100,8 +100,8 @@ $(patsubst %,build/%,$(DEB_PYTHON_SUGAR_PACKAGES)) :: build/%:
 			$(cdbs_cursrcdir)/MANIFEST.upstream \
 			> $(cdbs_cursrcdir)/MANIFEST
 	set -e; \
-	$(foreach buildver,$(cdbs_curpythonbuildversions),\
-		$(call cdbs_python_binary,python$(buildver)) \
+	$(foreach flavor,$(cdbs_curpythonflavors),\
+		$(call cdbs_python_binary,$(flavor)) \
 			$(cdbs_cursrcdir)/setup.py build; )
 	[ ! -e $(cdbs_cursrcdir)/MANIFEST.upstream ] \
 		|| IFS="`printf '\n'`" find "$(cdbs_cursrcdir)/locale" \
@@ -115,9 +115,9 @@ $(patsubst %,build/%,$(DEB_PYTHON_SUGAR_PACKAGES)) :: build/%:
 $(patsubst %,install/%,$(DEB_PYTHON_SUGAR_PACKAGES)) :: install/%:
 	mkdir -p $(DEB_DESTDIR)usr/share/sugar/activities
 	set -e; \
-	$(foreach buildver,$(cdbs_curpythonbuildversions),\
+	$(foreach flavor,$(cdbs_curpythonflavors),\
 		LANG=C XDG_DATA_HOME="$(DEB_DESTDIR)/usr/share" \
-			$(call cdbs_python_binary,python$(buildver)) \
+			$(call cdbs_python_binary,$(flavor)) \
 			$(cdbs_cursrcdir)/setup.py install \
 			--prefix="$(DEB_DESTDIR)/usr"; )
 
diff --git a/1/class/python-vars.mk.in b/1/class/python-vars.mk.in
index af0f551..81ba188 100644
--- a/1/class/python-vars.mk.in
+++ b/1/class/python-vars.mk.in
@@ -47,7 +47,6 @@ include $(_cdbs_class_path)/langcore.mk$(_cdbs_makefile_suffix)
 
 # implementations of Python itself
 _CDBS_PYTHONS = python2 python3
-_CDBS_PYTHONS_badly_named = python python3
 #  * uppercase implementation names
 $(foreach p,$(_CDBS_PYTHONS),$(eval _cdbs_$p_uc := $(call cdbs_uc,$p)))
 
@@ -56,6 +55,13 @@ $(foreach p,$(_CDBS_PYTHONS),$(eval _cdbs_$p_uc := $(call cdbs_uc,$p)))
 # (i.e. if not overridden by DEB_*_MODULE_PACKAGES)
 _cdbs_python2_pkgprefix = python
 
+# flavors of each implementation
+# resolve all/default flavor (if differing from implementation name)
+_cdbs_expand_python2_allflavors = $(shell pyversions -r)
+_cdbs_expand_python3_allflavors = $(shell py3versions -r)
+_cdbs_expand_python2_defaultflavor = $(shell pyversions -d)
+_cdbs_expand_python3_defaultflavor = $(shell py3versions -d)
+
 # binary packages in use
 cdbs_python_potential_packages = $(strip \
 	$(filter-out %-doc %-dev %-common,$(DEB_PACKAGES)))
@@ -122,42 +128,43 @@ _cdbs_python_singlesystem = $(strip \
 	or suppress the binary packages to operate on using either \
 	DEB_PYTHON3_PACKAGES or another DEB_*_PACKAGES variable)))
 
-# Calculate cdbs_python_build_versions
-cdbs_python_current_version := $(if $(DEB_PYTHON_SYSTEM)$(cdbs_pythonsystem_python2),$(shell pyversions -vd))
-cdbs_python3_current_version := $(if $(cdbs_pythonsystem_python3),$(shell py3versions -vd))
-cdbs_python_supported_versions := $(if $(DEB_PYTHON_SYSTEM)$(cdbs_pythonsystem_python2),$(shell pyversions -vr))
-cdbs_python3_supported_versions := $(if $(cdbs_pythonsystem_python3),$(shell py3versions -vr))
-cdbs_python_first_supported_version = $(firstword $(strip $(sort $(cdbs_python_supported_versions))))
-cdbs_python3_first_supported_version = $(firstword $(strip $(sort $(cdbs_python3_supported_versions))))
+# all/default flavors to use
+# variables _cdbs_$p_allflavors _cdbs_$p_defaultflavor
+#  1. resolved from _cdbs_expand_$p_*
+#  2. name of python implementation
+$(foreach p,$(_CDBS_PYTHONS),$(if $(cdbs_$p_packages),\
+	$(foreach v,allflavors defaultflavor,\
+		$(eval _cdbs_$p_$v := $(or $(call _cdbs_expand_$p_$v),$p)))))
 
-# versions to use
-# variables cdbs_$python_nondefault_version
+# flavors to use
+# variables _cdbs_$python_altflavor
 #  * arch-indep w/ default unsupported: first alternative available
-$(foreach p,$(_CDBS_PYTHONS_badly_named),$(eval cdbs_$p_nondefault_version = $(strip \
+$(foreach p,$(_CDBS_PYTHONS),$(eval _cdbs_$p_altflavor = $(strip \
 	$(if $(cdbs_python_arch_packages),\
 		,\
-		$(if $(filter $(cdbs_$p_current_version),$(cdbs_$p_supported_versions)),\
+		$(if $(filter $(_cdbs_$p_defaultflavor),$(_cdbs_$p_allflavors)),\
 			,\
-			$(cdbs_$p_first_supported_version))))))
-# variables cdbs_$python_primary_version
-$(foreach p,$(_CDBS_PYTHONS_badly_named),$(eval cdbs_$p_primary_version = $(or $(strip \
-	$(cdbs_$p_nondefault_version)),$(strip \
-	$(cdbs_$p_current_version)))))
-# variables cdbs_$python_build_versions
+			$(firstword $(strip $(sort $(_cdbs_$p_allflavors)))))))))
+# variables cdbs_$python_mainflavor
+$(foreach p,$(_CDBS_PYTHONS),$(eval cdbs_$p_mainflavor = $(or $(strip \
+	$(_cdbs_$p_altflavor)),$(strip \
+	$(_cdbs_$p_defaultflavor)))))
+# variables _cdbs_$python_flavors
 #  * arch(+indep): all; indep: current if supported, else first supported
-$(foreach p,$(_CDBS_PYTHONS_badly_named),$(eval cdbs_$p_build_versions = $(or $(strip \
+$(foreach p,$(_CDBS_PYTHONS),$(eval _cdbs_$p_flavors = $(or $(strip \
 	$(if $(cdbs_python_arch_packages),\
-		$(cdbs_$p_supported_versions))),$(strip \
-	$(cdbs_$p_primary_version)))))
+		$(_cdbs_$p_allflavors))),$(strip \
+	$(cdbs_$p_mainflavor)))))
+cdbs_python_flavors = $(strip \
+	$(foreach p,$(_CDBS_PYTHONS),\
+		$(_cdbs_$p_flavors)))
 
 # runtime to use
-cdbs_python_current_binary := $(if $(DEB_PYTHON_SYSTEM)$(cdbs_pythonsystem_python2),$(shell pyversions -d))
-cdbs_python3_current_binary := $(if $(cdbs_pythonsystem_python3),$(shell py3versions -d))
 # resolve from binary package and optional flavor
 cdbs_python_binary = $(strip \
-	$(if $(call cdbs_streq,$(cdbs_python$(cdbs_curpythonstem)_current_binary),$(1)),\
-		python$(cdbs_curpythonstem),\
-		$(1)))
+	$(if $(call cdbs_streq,$(cdbs_$(cdbs_curpython)_defaultflavor),$1),\
+		$(cdbs_curpython),\
+		$1))
 
 # resolve (implicitly) from binary package
 cdbs_curpythonsystems = $(strip $(if $(DEB_PYTHON_SYSTEM),\
@@ -167,16 +174,17 @@ cdbs_curpythonsystems = $(strip $(if $(DEB_PYTHON_SYSTEM),\
 			python2) \
 		$(if $(filter $(cdbs_curpkg),$(_cdbs_python3_packages)),\
 			python3))))
-cdbs_curpythonstem = $(strip \
+cdbs_curpython = $(strip \
 	$(if $(cdbs_python_single_system),\
-		$(patsubst python%,%,$(_cdbs_python_singlesystem)),\
-		$(if $(filter $(cdbs_curpkg),$(_cdbs_python3_packages)),\
-			3)))
-cdbs_curpythonindepbinary = python$(or $(strip \
-	$(cdbs_python$(cdbs_curpythonstem)_nondefault_version)),$(strip \
-	$(cdbs_curpythonstem)))
-cdbs_curpythonpribinary = python$(cdbs_python$(cdbs_curpythonstem)_primary_version)
-cdbs_curpythonbuildversions = $(cdbs_python$(cdbs_curpythonstem)_build_versions)
+		$(_cdbs_python_singlesystem),\
+		$(foreach p,$(_CDBS_PYTHONS),\
+			$(if $(filter $(cdbs_curpkg),$(_cdbs_$p_packages)),\
+				$p))))
+cdbs_curpythonindepbinary = $(or $(strip \
+	$(_cdbs_$(cdbs_curpython)_altflavor)),$(strip \
+	$(cdbs_curpython)))
+cdbs_curpythonpribinary = $(cdbs_$(cdbs_curpython)_mainflavor)
+cdbs_curpythonflavors = $(_cdbs_$(cdbs_curpython)_flavors)
 
 # package relations
 # Python-related dependencies according to Python policy, appendix A
@@ -190,12 +198,12 @@ cdbs_python2_builddeps = $(if $(cdbs_pythonsystem_python2),\
 	$(if $(_cdbs_python2_arch_packages),\
 		python-all-dev,\
 		python-dev (>= 2.3.5-7)\
-			$(cdbs_python_nondefault_version:%=, python%-dev)))
+			$(_cdbs_python2_altflavor:%=, %-dev)))
 cdbs_python3_builddeps = $(if $(cdbs_pythonsystem_python3),\
 	$(if $(_cdbs_python3_arch_packages),\
 		python3-all-dev (>= 3.1),\
 		python3-dev\
-			$(cdbs_python3_nondefault_version:%=, python%-dev)))
+			$(_cdbs_python3_altflavor:%=, %-dev)))
 cdbs_python_builddeps = \
 	$(cdbs_python_builddeps_legacy), \
 	$(cdbs_python2_builddeps), \
@@ -208,19 +216,19 @@ cdbs_python_builddeps_cdbs = $(strip \
 
 # check if build is possible
 $(if $(cdbs_pythonsystem_pysupport),\
-	$(if $(cdbs_python_build_versions),\
+	$(if $(_cdbs_python2_flavors),\
 		,\
 		$(error invalid setting in debian/pyversions)))
 $(if $(cdbs_pythonsystem_pycentral),\
-	$(if $(cdbs_python_build_versions),\
+	$(if $(_cdbs_python2_flavors),\
 		,\
 		$(error invalid setting for XS-Python-Version)))
 $(if $(cdbs_pythonsystem_python2),\
-	$(if $(cdbs_python_build_versions),\
+	$(if $(_cdbs_python2_flavors),\
 		,\
 		$(error invalid setting for X-Python-Version)))
 $(if $(cdbs_pythonsystem_python3),\
-	$(if $(cdbs_python3_build_versions),\
+	$(if $(_cdbs_python3_flavors),\
 		,\
 		$(error invalid setting for X-Python3-Version)))
 
@@ -231,5 +239,29 @@ cdbs_python_selected_pyversions = $(strip $(call cdbs_warn_deprecated,\
 		$(shell if [ -e debian/pyversions ]; then \
 			cat debian/pyversions; \
 		fi)))
+cdbs_curpythonstem = $(strip $(call cdbs_warn_deprecated,\
+	cdbs_curpythonstem,0.5,cdbs_curpython)\
+	$(filter 3,$(cdbs_curpython:python%=%)))
+cdbs_python_current_binary = $(strip $(call cdbs_warn_deprecated,\
+	cdbs_python_current_binary,0.5)\
+	$(_cdbs_python2_defaultflavor))
+cdbs_python3_current_binary = $(strip $(call cdbs_warn_deprecated,\
+	cdbs_python3_current_binary,0.5)\
+	$(_cdbs_python3_defaultflavor))
+cdbs_python_current_version = $(strip $(call cdbs_warn_deprecated,\
+	cdbs_python_current_version,0.5)\
+	$(_cdbs_python2_defaultflavor:python%=%))
+cdbs_python3_current_version = $(strip $(call cdbs_warn_deprecated,\
+	cdbs_python3_current_version,0.5)\
+	$(_cdbs_python3_defaultflavor:python%=%))
+cdbs_python_supported_versions = $(strip $(call cdbs_warn_deprecated,\
+	cdbs_python_supported_versions,0.5)\
+	$(_cdbs_python2_allflavors:python%=%))
+cdbs_python3_supported_versions = $(strip $(call cdbs_warn_deprecated,\
+	cdbs_python3_supported_versions,0.5)\
+	$(_cdbs_python3_allflavors:python%=%))
+cdbs_python_build_versions = $(strip $(call cdbs_warn_deprecated,\
+	cdbs_python_build_versions,0.5,cdbs_python_flavors)\
+	$(_cdbs_python2_flavors))
 
 endif
diff --git a/debian/TODO b/debian/TODO
index 4c64e16..af1715c 100644
--- a/debian/TODO
+++ b/debian/TODO
@@ -9,6 +9,7 @@ Ideas for 2nd epoch (i.e. /usr/share/cdbs/2/* files):
     + leading deb_ for package-specific, cdbs_ for global
     + allow early override (or register as special case)
     + always resolve *_ALL and *_$(pkg) for deb_* vars
+    + preserve leading "python" of flavors in python-autotools.mk
   * Use only early resolved ifeq constructs when deliberate
   * enable regression tests by default
   * enable parallel build by default

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/cdbs.git



More information about the Reproducible-commits mailing list