Source: kmod Source-Version: 33+20240816-2 Severity: normal Tags: patch Hi!
Here are several fixes and improvements for the build and packaging. There are a couple of changes I was unsure whether to make them or not, but ended up with the conservative approach but I'm happy to rework them if needed: - Preserved the environment CC if set in the autopkgtest, but pondered simply hardcoding gcc (not sure whether the intention was to be able to support stuff like clang). - Pondered adding a commit for «wrap-and-sort -ast» to reduce diff delta on changes, but as the dependencies seemed to be grouped, ended up leaving this alone. - Left the unused staging package directory variables in debian/rules, assuming they are desired placeholders for potential future use (given the existing unused variable), but I can remove them otherwise. The changes seem to pass salsa CI <https://salsa.debian.org/guillem/kmod/-/pipelines/722017>. They produce no apparent relevant changes from debdiff. The noudeb profile seems to work with «dpkg-buildpackage -us -uc -b -Pnoudeb». Thanks, Guillem
From 1ee70da94614c735dce95d258964dcdc4c52b90d Mon Sep 17 00:00:00 2001 From: Guillem Jover <guil...@debian.org> Date: Wed, 21 Aug 2024 19:03:46 +0200 Subject: [PATCH 1/9] Add a debian/.gitignore file This ignores all build artifacts and currently generated files from build tooling and helpers. --- debian/.gitignore | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 debian/.gitignore diff --git a/debian/.gitignore b/debian/.gitignore new file mode 100644 index 0000000..7622629 --- /dev/null +++ b/debian/.gitignore @@ -0,0 +1,12 @@ +*.log +*.substvars +.debhelper/ +autoreconf.after +autoreconf.before +debhelper-build-stamp +files +kmod-udeb/ +kmod/ +libkmod-dev/ +libkmod2-udeb/ +libkmod2/ -- 2.45.2
From a8c4f5f5a131a255c418b56dc2f4cc09ce3f66ac Mon Sep 17 00:00:00 2001 From: Guillem Jover <guil...@debian.org> Date: Wed, 21 Aug 2024 17:03:10 +0200 Subject: [PATCH 2/9] Move udeb omission from dh arguments to the Build-Profiles field This lets the packaging system automatically handle the omission of these packages when the profile is active, instead of having to do that manually from debian/rules. --- debian/control | 2 ++ debian/rules | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/control b/debian/control index c179cea..eccc54d 100644 --- a/debian/control +++ b/debian/control @@ -52,6 +52,7 @@ Package: kmod-udeb Package-Type: udeb Section: debian-installer Architecture: linux-any +Build-Profiles: <!noudeb> Pre-Depends: ${misc:Pre-Depends} Depends: ${shlibs:Depends}, ${misc:Depends} Description: libkmod shared library @@ -61,6 +62,7 @@ Package: libkmod2-udeb Package-Type: udeb Section: debian-installer Architecture: linux-any +Build-Profiles: <!noudeb> Pre-Depends: ${misc:Pre-Depends} Depends: ${shlibs:Depends}, ${misc:Depends} Description: libkmod shared library diff --git a/debian/rules b/debian/rules index 435c4db..3dabbba 100755 --- a/debian/rules +++ b/debian/rules @@ -34,13 +34,11 @@ include /usr/share/dpkg/architecture.mk ifdef BUILD_UDEB BUILD_UDEB_TARGET := build-udeb/.stamp-build -else - NO_PACKAGE := --no-package=kmod-udeb --no-package=libkmod2-udeb endif ############################################################################## %: - dh $@ $(NO_PACKAGE) + dh $@ override_dh_clean: rm -rf build-*deb -- 2.45.2
From 90f52ff879accaf765fb9f88c0c1fc0d6c63cff9 Mon Sep 17 00:00:00 2001 From: Guillem Jover <guil...@debian.org> Date: Wed, 21 Aug 2024 17:03:12 +0200 Subject: [PATCH 3/9] Fix typo to properly clean up udeb empty directories during build --- debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index 3dabbba..9f07e57 100755 --- a/debian/rules +++ b/debian/rules @@ -92,7 +92,7 @@ ifdef BUILD_UDEB rm $(DU)/usr/lib/*/*.la $(DU)/usr/lib/*/*.so mv $(DU)/usr/lib/*/libkmod.so.* $(DKU)/usr/lib/ egrep -i '^[a-z]' debian/extra/aliases.conf > $(DU)/etc/modprobe.d/aliases.conf - find $D/usr -type d -empty -delete + find $(DU)/usr -type d -empty -delete endif override_dh_installdocs: -- 2.45.2
From b295a935e2dc18943f88aec5f26cb69c79e649c3 Mon Sep 17 00:00:00 2001 From: Guillem Jover <guil...@debian.org> Date: Wed, 21 Aug 2024 17:12:59 +0200 Subject: [PATCH 4/9] Switch from pkg-config to pkgconf for debian/tests --- debian/tests/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/tests/control b/debian/tests/control index 6f7497c..d0d0787 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1,3 +1,3 @@ Tests: lsmod Restrictions: isolation-container -Depends: build-essential, libkmod-dev, pkg-config +Depends: build-essential, libkmod-dev, pkgconf -- 2.45.2
From 866e8405d6a89ee78f74e5cd460134321a8eec65 Mon Sep 17 00:00:00 2001 From: Guillem Jover <guil...@debian.org> Date: Wed, 21 Aug 2024 17:13:29 +0200 Subject: [PATCH 5/9] Make CC and PKG_CONFIG cross-compile aware Instead of having to remember to prefix all current (and future) instances of gcc and pkg-config invocations, setup the variables to be cross-compiling aware, and then just use the variables on the call sites. Preserve the ability to set CC from the environment. --- debian/tests/lsmod | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/debian/tests/lsmod b/debian/tests/lsmod index db98867..3d6762d 100755 --- a/debian/tests/lsmod +++ b/debian/tests/lsmod @@ -8,13 +8,18 @@ if [ -z "$AUTOPKGTEST_TMP" ]; then fi cd $AUTOPKGTEST_TMP -CROSS_COMPILE="${DEB_HOST_GNU_TYPE:+$DEB_HOST_GNU_TYPE-}" -CC="${CC:-gcc}" +if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then + CC="$DEB_HOST_GNU_TYPE-${CC:-gcc}" + PKG_CONFIG="$DEB_HOST_GNU_TYPE-pkg-config" +else + : ${CC:=gcc} + PKG_CONFIG=pkg-config +fi echo '1..2' -${CROSS_COMPILE}$CC -o lsmod $TEST_DIR/lsmod.c \ - $(${CROSS_COMPILE}pkg-config --cflags --libs libkmod) +$CC -o lsmod $TEST_DIR/lsmod.c \ + $($PKG_CONFIG --cflags --libs libkmod) echo "ok 1 - build" ./lsmod -- 2.45.2
From 4da829aaf49ee3f7b7a6f392a2e7b6ae8c082822 Mon Sep 17 00:00:00 2001 From: Guillem Jover <guil...@debian.org> Date: Wed, 21 Aug 2024 17:20:57 +0200 Subject: [PATCH 6/9] Perform full /usr-move on all absolute paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Look for LSB helper functions, kernel modules and our own binaries under /usr. This makes all file references use their canonical location both from the packaging and on disk point of view, which avoids pointless indirection via symlinks, and when confronted with such pathnames passing them to stuff like «dpkg -S» will work properly. --- debian/kmod.init | 4 ++-- debian/rules | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/kmod.init b/debian/kmod.init index 19af546..b3454ba 100644 --- a/debian/kmod.init +++ b/debian/kmod.init @@ -13,10 +13,10 @@ # Silently exit if the kernel does not support modules. [ -f /proc/modules ] || exit 0 -[ -x /sbin/modprobe ] || exit 0 +[ -x /usr/sbin/modprobe ] || exit 0 [ -f /etc/default/rcS ] && . /etc/default/rcS -. /lib/lsb/init-functions +. /usr/lib/lsb/init-functions PATH='/usr/sbin:/usr/bin:/sbin:/bin' diff --git a/debian/rules b/debian/rules index 9f07e57..5c5d0ac 100755 --- a/debian/rules +++ b/debian/rules @@ -13,7 +13,7 @@ DKU := $(CURDIR)/debian/libkmod2-udeb CONFFLAGS = \ --sysconfdir=/etc \ --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \ - --with-module-directory=/lib/modules \ + --with-module-directory=/usr/lib/modules \ --with-rootlibdir=/usr/lib/$(DEB_HOST_MULTIARCH) CONFFLAGS_deb = $(CONFFLAGS) \ $(shell DEB_BUILD_MAINT_OPTIONS="hardening=+bindnow" \ -- 2.45.2
From ca043bb7bfe50859824ca8fdfbe11595314dcfca Mon Sep 17 00:00:00 2001 From: Guillem Jover <guil...@debian.org> Date: Sun, 25 Aug 2024 14:26:21 +0200 Subject: [PATCH 7/9] Remove explicit installation of initramfs hook handled by dh_installinitramfs We do not need to install the hook manually, as that is already done by dh_installinitramfs. --- debian/rules | 2 -- 1 file changed, 2 deletions(-) diff --git a/debian/rules b/debian/rules index 5c5d0ac..4c08945 100755 --- a/debian/rules +++ b/debian/rules @@ -85,8 +85,6 @@ override_dh_install: rm $D/usr/lib/*/*.la dh_movefiles --sourcedir=debian/kmod cp debian/extra/aliases.conf $D/usr/lib/modprobe.d/ - install --mode=755 debian/kmod.initramfs-hook \ - $D/usr/share/initramfs-tools/hooks/kmod find $D/usr -type d -empty -delete ifdef BUILD_UDEB rm $(DU)/usr/lib/*/*.la $(DU)/usr/lib/*/*.so -- 2.45.2
From c7184db26141cc10fd08560d7ed9b06dbda5491d Mon Sep 17 00:00:00 2001 From: Guillem Jover <guil...@debian.org> Date: Wed, 21 Aug 2024 18:49:37 +0200 Subject: [PATCH 8/9] Switch to use debhelper dh_install* fragment files We switch from the deprecated dh_movefiles, to install the files into the debian/tmp and debian/tmp-udeb staging directories, from where the various dh_install* commands will install into the final package directories, removing part of the imperative code in debian/rules. We can now remove entries from .dirs fragment files, as those are now generated automatically by dh_install* commands. We switch to be more explicit about the paths to be installed, so that we do not end up accidentally installing new or bogus things on new upstream releases (such as SONAME bumps with no package rename, or new programs). This also avoids having to remove unwanted files which we can now declare in debian/not-installed. And can then make use of dh_missing to automatically tell us if we missed any new files. Although because we use debian/tmp-udeb, dh_missing will not take effect for udebs (which we could override), but that seems fine as udebs are supposed to be tiny and restricted. Leave old and new unused package staging variables alone, as these seem to be intended to be placeholders for potential future use. --- debian/.gitignore | 2 ++ debian/kmod-udeb.install | 1 + debian/kmod.dirs | 2 -- debian/kmod.docs | 1 + debian/kmod.install | 3 +++ debian/kmod.manpages | 2 ++ debian/libkmod-dev.files | 5 ----- debian/libkmod-dev.install | 5 +++++ debian/libkmod2-udeb.dirs | 1 - debian/libkmod2-udeb.install | 2 ++ debian/libkmod2.files | 1 - debian/libkmod2.install | 2 ++ debian/not-installed | 1 + debian/rules | 17 +++++++---------- 14 files changed, 26 insertions(+), 19 deletions(-) create mode 100644 debian/kmod-udeb.install create mode 100644 debian/kmod.docs create mode 100644 debian/kmod.install create mode 100644 debian/kmod.manpages delete mode 100644 debian/libkmod-dev.files create mode 100644 debian/libkmod-dev.install delete mode 100644 debian/libkmod2-udeb.dirs create mode 100644 debian/libkmod2-udeb.install delete mode 100644 debian/libkmod2.files create mode 100644 debian/libkmod2.install create mode 100644 debian/not-installed diff --git a/debian/.gitignore b/debian/.gitignore index 7622629..14b7cba 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -10,3 +10,5 @@ kmod/ libkmod-dev/ libkmod2-udeb/ libkmod2/ +tmp-udeb/ +tmp/ diff --git a/debian/kmod-udeb.install b/debian/kmod-udeb.install new file mode 100644 index 0000000..8930726 --- /dev/null +++ b/debian/kmod-udeb.install @@ -0,0 +1 @@ +usr/bin/kmod diff --git a/debian/kmod.dirs b/debian/kmod.dirs index 93b5259..a5d7772 100644 --- a/debian/kmod.dirs +++ b/debian/kmod.dirs @@ -1,4 +1,2 @@ /etc/modprobe.d/ -/usr/lib/modprobe.d/ -/usr/share/doc/libkmod2/ /usr/share/initramfs-tools/hooks/ diff --git a/debian/kmod.docs b/debian/kmod.docs new file mode 100644 index 0000000..b43bf86 --- /dev/null +++ b/debian/kmod.docs @@ -0,0 +1 @@ +README.md diff --git a/debian/kmod.install b/debian/kmod.install new file mode 100644 index 0000000..4bd5078 --- /dev/null +++ b/debian/kmod.install @@ -0,0 +1,3 @@ +debian/extra/aliases.conf usr/lib/modprobe.d/ +usr/bin/kmod +usr/share/bash-completion/ diff --git a/debian/kmod.manpages b/debian/kmod.manpages new file mode 100644 index 0000000..95494ce --- /dev/null +++ b/debian/kmod.manpages @@ -0,0 +1,2 @@ +usr/share/man/man5/*.5 +usr/share/man/man8/*.8 diff --git a/debian/libkmod-dev.files b/debian/libkmod-dev.files deleted file mode 100644 index 3cb23a6..0000000 --- a/debian/libkmod-dev.files +++ /dev/null @@ -1,5 +0,0 @@ -/usr/include/ -/usr/lib/*/pkgconfig/ -/usr/share/pkgconfig/ -/usr/lib/*/libkmod.* -/usr/share/gtk-doc/ diff --git a/debian/libkmod-dev.install b/debian/libkmod-dev.install new file mode 100644 index 0000000..ccc50e4 --- /dev/null +++ b/debian/libkmod-dev.install @@ -0,0 +1,5 @@ +usr/include/ +usr/lib/*/libkmod.so +usr/lib/*/pkgconfig/libkmod.pc +usr/share/gtk-doc/ +usr/share/pkgconfig/kmod.pc diff --git a/debian/libkmod2-udeb.dirs b/debian/libkmod2-udeb.dirs deleted file mode 100644 index fce258f..0000000 --- a/debian/libkmod2-udeb.dirs +++ /dev/null @@ -1 +0,0 @@ -/usr/lib/ diff --git a/debian/libkmod2-udeb.install b/debian/libkmod2-udeb.install new file mode 100644 index 0000000..e5d7040 --- /dev/null +++ b/debian/libkmod2-udeb.install @@ -0,0 +1,2 @@ +usr/lib/*/libkmod.so.2 usr/lib/ +usr/lib/*/libkmod.so.2.* usr/lib/ diff --git a/debian/libkmod2.files b/debian/libkmod2.files deleted file mode 100644 index 2c4a66a..0000000 --- a/debian/libkmod2.files +++ /dev/null @@ -1 +0,0 @@ -usr/lib/*/libkmod.so.* diff --git a/debian/libkmod2.install b/debian/libkmod2.install new file mode 100644 index 0000000..c869eb7 --- /dev/null +++ b/debian/libkmod2.install @@ -0,0 +1,2 @@ +usr/lib/*/libkmod.so.2 +usr/lib/*/libkmod.so.2.* diff --git a/debian/not-installed b/debian/not-installed new file mode 100644 index 0000000..f403946 --- /dev/null +++ b/debian/not-installed @@ -0,0 +1 @@ +usr/lib/*/*.la diff --git a/debian/rules b/debian/rules index 4c08945..6d05ad8 100755 --- a/debian/rules +++ b/debian/rules @@ -10,6 +10,8 @@ DD := $(CURDIR)/debian/libkmod-dev DU := $(CURDIR)/debian/kmod-udeb DKU := $(CURDIR)/debian/libkmod2-udeb +TU := $(CURDIR)/debian/tmp-udeb + CONFFLAGS = \ --sysconfdir=/etc \ --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \ @@ -42,6 +44,7 @@ endif override_dh_clean: rm -rf build-*deb + rm -rf $(TU) dh_clean $$(find m4/ build-aux/ libkmod/ -type l) libkmod/docs/gtk-doc.make: @@ -76,26 +79,20 @@ override_dh_auto_test: dh_auto_test --builddir=build-deb override_dh_auto_install: - dh_auto_install --builddir=build-deb --destdir=$D + dh_auto_install --builddir=build-deb ifdef BUILD_UDEB - cd build-udeb && $(MAKE) DESTDIR=$(DU) install-binPROGRAMS + cd build-udeb && $(MAKE) DESTDIR=$(TU) install-binPROGRAMS endif override_dh_install: - rm $D/usr/lib/*/*.la - dh_movefiles --sourcedir=debian/kmod - cp debian/extra/aliases.conf $D/usr/lib/modprobe.d/ - find $D/usr -type d -empty -delete + dh_install -Nkmod-udeb -Nlibkmod2-udeb ifdef BUILD_UDEB - rm $(DU)/usr/lib/*/*.la $(DU)/usr/lib/*/*.so - mv $(DU)/usr/lib/*/libkmod.so.* $(DKU)/usr/lib/ + dh_install --sourcedir=$(TU) -pkmod-udeb -plibkmod2-udeb egrep -i '^[a-z]' debian/extra/aliases.conf > $(DU)/etc/modprobe.d/aliases.conf - find $(DU)/usr -type d -empty -delete endif override_dh_installdocs: dh_installdocs -pkmod -plibkmod-dev --link-doc=libkmod2 - dh_installdocs -pkmod --link-doc=libkmod2 README.md dh_installdocs -plibkmod2 cp libkmod/README $(DD)/usr/share/doc/libkmod2/README.libkmod -- 2.45.2
From 3e3b0b9492872706d0a5991abad256a937a17e85 Mon Sep 17 00:00:00 2001 From: Guillem Jover <guil...@debian.org> Date: Wed, 21 Aug 2024 19:01:09 +0200 Subject: [PATCH 9/9] Remove unused shlibs:Depends substvar from libkmod-dev --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index eccc54d..e477cb2 100644 --- a/debian/control +++ b/debian/control @@ -41,7 +41,7 @@ Section: libdevel Priority: optional Architecture: linux-any Multi-Arch: same -Depends: ${shlibs:Depends}, ${misc:Depends}, libkmod2 (= ${binary:Version}) +Depends: ${misc:Depends}, libkmod2 (= ${binary:Version}) Breaks: kmod (<< 33+20240816-2) Replaces: kmod (<< 33+20240816-2) Description: libkmod development files -- 2.45.2