Package: cracklib2
Version: 2.9.2-5.1
Severity: wishlist
Tags: patch
X-Debbugs-CC: debian-ri...@lists.debian.org
User: debian-ri...@lists.debian.org
Usertags: riscv64

Hello,

we are in the process of bootstrapping a Debian port for the
riscv64 architecture (https://wiki.debian.org/RISC-V). The
libcrack2-dev, libcrack2 and cracklib-runtime packages are part
of the build-dependency chain for the essential package set, so
we need to build them to be able to complete the bootstrap
process.

Currently the cracklib2 source package unconditionally
build-depends on python2 and python3, but those aren't available
during early architecture bootstrap and are only needed for
building python{,3}-cracklib, but not for cracklib-runtime,
libcrack2 and libcrack2-dev.  The package's debian/rules already
contains support for a build without python by setting the
DEB_STAGE variable to "stage1", but this mechanism has the
limitation that it requires manually adjusting the
build-dependency list and makes it hard to autobuild the package
in a bootstrapping context.  Because of this limitation, the
DEB_STAGE mechanism has been deprecated; packages should now
support build-profiles (https://wiki.debian.org/BuildProfileSpec).

Attached is a patch that adds support for the standard "nopython"
build-profile to the package while keeping the original
DEB_STAGE-based mechanism in place.  As the cracklib2 package is
on the "Low Threshold NMU" list, I intend to do an NMU with this
patch on the upcoming weekend unless you should object.

Regards,
Karsten
-- 
Gem. Par. 28 Abs. 4 Bundesdatenschutzgesetz widerspreche ich der Nutzung
sowie der Weitergabe meiner personenbezogenen Daten für Zwecke der
Werbung sowie der Markt- oder Meinungsforschung.
diff -Nur cracklib2-2.9.2.orig/debian/control cracklib2-2.9.2/debian/control
--- cracklib2-2.9.2.orig/debian/control
+++ cracklib2-2.9.2/debian/control
@@ -14,10 +14,10 @@
                docbook-xml,
                dpkg-dev (>= 1.16.1~),
                libtool,
-               python-all-dev (>= 2.6.6-3~),
-               python-setuptools,
-               python3-all-dev (>= 3.1.3-2~),
-               python3-setuptools
+               python-all-dev (>= 2.6.6-3~) <!nopython>,
+               python-setuptools <!nopython>,
+               python3-all-dev (>= 3.1.3-2~) <!nopython>,
+               python3-setuptools <!nopython>
 Homepage: http://sourceforge.net/projects/cracklib
 Vcs-Git: https://anonscm.debian.org/git/pkg-cracklib/pkg-cracklib.git
 Vcs-Browser: https://anonscm.debian.org/gitweb/?p=pkg-cracklib/pkg-cracklib.git
@@ -90,6 +90,7 @@
          ${shlibs:Depends}
 Provides: ${python:Provides}
 Conflicts: python-crack
+Build-Profiles: <!nopython>
 Description: Python bindings for password checker library cracklib2
  This package provides Python bindings for cracklib. It contains a
  pythonic interface to cracklib's functions and some Python
@@ -108,6 +109,7 @@
          ${python3:Depends},
          ${shlibs:Depends}
 Provides: ${python3:Provides}
+Build-Profiles: <!nopython>
 Description: Python3 bindings for password checker library cracklib2
  This package provides Python bindings for cracklib. It contains a
  pythonic interface to cracklib's functions and some Python
diff -Nur cracklib2-2.9.2.orig/debian/rules cracklib2-2.9.2/debian/rules
--- cracklib2-2.9.2.orig/debian/rules
+++ cracklib2-2.9.2/debian/rules
@@ -10,11 +10,13 @@
 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
 
-ifneq ($(DEB_STAGE),stage1)
+ifeq ($(filter stage1,$(DEB_STAGE))$(filter nopython,$(DEB_BUILD_PROFILES)),)
 PYVERS := $(shell pyversions -vs)
 PY3VERS := $(shell py3versions -vs)
+DH_WITH_PARAMETERS := python2,python3,autotools_dev
 else
 NOPYTHON_OPTIONS = -Npython-cracklib -Npython3-cracklib
+DH_WITH_PARAMETERS := autotools_dev
 endif
 
 ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
@@ -48,7 +50,7 @@
 
 override_dh_auto_build:
 	$(MAKE) -C $(CURDIR)/debian/buildtmp/base
-ifneq ($(DEB_STAGE),stage1)
+ifeq ($(filter stage1,$(DEB_STAGE))$(filter nopython,$(DEB_BUILD_PROFILES)),)
 	ln -s $(CURDIR)/debian/crack.py $(CURDIR)/python; \
 	for i in $(PYVERS) $(PY3VERS); do \
 		cd $(CURDIR)/debian/buildtmp/python$$i; \
@@ -62,7 +64,7 @@
 
 override_dh_auto_test:
 	mkdir $(CURDIR)/debian/tmp
-ifneq ($(DEB_STAGE),stage1)
+ifeq ($(filter stage1,$(DEB_STAGE))$(filter nopython,$(DEB_BUILD_PROFILES)),)
 	$(CRACKLIB_PACKER) $(CURDIR)/debian/tmp/cracklib_dict < \
 	 $(CURDIR)/dicts/cracklib-small
 	for i in $(PYVERS) $(PY3VERS); do \
@@ -120,7 +122,7 @@
 	  $(CURDIR)/debian/cracklib-runtime/usr/sbin/cracklib-packer \
 	  $(CURDIR)/debian/cracklib-runtime/usr/sbin/cracklib-unpacker
 
-ifneq ($(DEB_STAGE),stage1)
+ifeq ($(filter stage1,$(DEB_STAGE))$(filter nopython,$(DEB_BUILD_PROFILES)),)
 	for i in $(PYVERS); do \
 		cd $(CURDIR)/debian/buildtmp/python$$i/python; \
 		python$$i setup.py install --install-layout=deb --root $(CURDIR)/debian/python-cracklib; \
@@ -139,7 +141,7 @@
 override_dh_installchangelogs:
 	dh_installchangelogs NEWS
 
-ifneq ($(DEB_STAGE),stage1)
+ifeq ($(filter stage1,$(DEB_STAGE))$(filter nopython,$(DEB_BUILD_PROFILES)),)
 override_dh_python2:
 	dh_python2 -ppython-cracklib
 
@@ -148,4 +150,4 @@
 endif
 
 %:
-	dh $@ --with python2,python3,autotools_dev $(NOPYTHON_OPTIONS)
+	dh $@ --with $(DH_WITH_PARAMETERS) $(NOPYTHON_OPTIONS)

Reply via email to