Package: cpio
Version: 2.15+dfsg-1
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu oracular ubuntu-patch

Dear Maintainer,

In Ubuntu, the attached patch was applied to achieve the following:

  * Use compat level 13.
    - Switch to use autoconf Debian Helper template.
    - Switch to use dh generated alternatives scripts.
    - Remove all manual installation steps from d/rules.

This also fixes #851631 (missing debug symbol package) in Debian.

Thanks for considering the patch.


-- System Information:
Debian Release: trixie/sid
  APT prefers noble-updates
  APT policy: (500, 'noble-updates'), (500, 'noble-security'), (500, 'noble'), 
(100, 'noble-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.8.0-35-generic (SMP w/10 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_CA:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru cpio-2.15+dfsg/debian/control cpio-2.15+dfsg/debian/control
--- cpio-2.15+dfsg/debian/control       2024-02-02 05:03:45.000000000 -0700
+++ cpio-2.15+dfsg/debian/control       2024-06-11 14:20:50.000000000 -0600
@@ -1,18 +1,17 @@
 Source: cpio
 Section: utils
 Priority: important
 Maintainer: Anibal Monsalve Salazar <ani...@debian.org>
 Uploaders: Chris Lamb <la...@debian.org>
-Build-Depends: texinfo, gettext, autotools-dev, autoconf, automake-1.16
+Build-Depends: debhelper-compat (= 13), texinfo, gettext
 Standards-Version: 4.6.2
 Homepage: https://www.gnu.org/software/cpio/
 Vcs-Git: https://salsa.debian.org/lamby/pkg-cpio.git
 Vcs-Browser: https://salsa.debian.org/lamby/pkg-cpio
-Rules-Requires-Root: binary-targets
 
 Package: cpio
 Architecture: any
-Depends: ${shlibs:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}
 Replaces: cpio-mt
 Conflicts: mt-st (<< 0.6), cpio-mt
 Multi-Arch: foreign
diff -Nru cpio-2.15+dfsg/debian/cpio.alternatives 
cpio-2.15+dfsg/debian/cpio.alternatives
--- cpio-2.15+dfsg/debian/cpio.alternatives     1969-12-31 17:00:00.000000000 
-0700
+++ cpio-2.15+dfsg/debian/cpio.alternatives     2024-06-11 14:20:50.000000000 
-0600
@@ -0,0 +1,7 @@
+Name: mt
+Link: /usr/bin/mt
+Alternative: /usr/bin/mt-gnu
+Dependents:
+ /usr/share/man/man1/mt.1.gz mt.1.gz /usr/share/man/man1/mt-gnu.1.gz
+Priority: 10
+
diff -Nru cpio-2.15+dfsg/debian/postinst cpio-2.15+dfsg/debian/postinst
--- cpio-2.15+dfsg/debian/postinst      2024-02-02 05:03:45.000000000 -0700
+++ cpio-2.15+dfsg/debian/postinst      2024-06-11 14:20:50.000000000 -0600
@@ -2,8 +2,4 @@
 
 set -e
 
-if [ "$1" = configure ]; then
-    update-alternatives --install /usr/bin/mt mt /usr/bin/mt-gnu 10 \
-      --slave \
-       /usr/share/man/man1/mt.1.gz mt.1.gz /usr/share/man/man1/mt-gnu.1.gz
-fi
+#DEBHELPER#
diff -Nru cpio-2.15+dfsg/debian/prerm cpio-2.15+dfsg/debian/prerm
--- cpio-2.15+dfsg/debian/prerm 2024-02-02 05:03:45.000000000 -0700
+++ cpio-2.15+dfsg/debian/prerm 2024-06-11 14:20:50.000000000 -0600
@@ -2,6 +2,4 @@
 
 set -e
 
-if [ "$1" = remove ]; then
-    update-alternatives --remove mt /usr/bin/mt-gnu
-fi
+#DEBHELPER#
diff -Nru cpio-2.15+dfsg/debian/rules cpio-2.15+dfsg/debian/rules
--- cpio-2.15+dfsg/debian/rules 2024-02-02 05:03:45.000000000 -0700
+++ cpio-2.15+dfsg/debian/rules 2024-06-11 14:20:50.000000000 -0600
@@ -1,131 +1,21 @@
 #!/usr/bin/make -f
 
-include /usr/share/dpkg/pkg-info.mk
+%:
+       dh $@
 
-package=cpio
-
-CFLAGS = -Wall -g
-INSTALL = install
-INSTALL_FILE    = $(INSTALL) -p    -o root -g root  -m  644
-INSTALL_PROGRAM = $(INSTALL) -p    -o root -g root  -m  755
-INSTALL_SCRIPT  = $(INSTALL) -p    -o root -g root  -m  755
-INSTALL_DIR     = $(INSTALL) -p -d -o root -g root  -m  755
-
-DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
-CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
-STRIP = $(DEB_HOST_GNU_TYPE)-strip
-else
-CROSS= --build $(DEB_BUILD_GNU_TYPE)
-STRIP = strip
-endif
-
-ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
-INSTALL_PROGRAM += -s
-endif
-
-obj/Makefile:
-       $(checkdir)
-       -test -r /usr/share/misc/config.sub && cp -f /usr/share/misc/config.sub 
build-aux/config.sub
-       -test -r /usr/share/misc/config.guess && cp -f 
/usr/share/misc/config.guess build-aux/config.guess
-       mkdir -p obj
-       cd obj && ../configure $(shell dpkg-buildflags --export=configure) 
--prefix=/usr --enable-mt $(CROSS) \
-              --mandir=/usr/share/man \
-              --infodir=/usr/share/info \
-              --bindir=/usr/bin \
-              --libexecdir=/usr/sbin
+override_dh_auto_configure:
+       dh_testdir
+       dh_auto_configure -- \
+               --enable-mt
 
        touch tests/testsuite tests/package.m4
 
-build-arch: build
-build-indep: build
-build: obj/Makefile
-       $(checkdir)
-       $(MAKE) -C obj
-       touch tests/testsuite.at tests/testsuite tests/package.m4
-ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
-       $(MAKE) -C obj check
-endif
-       touch build
-
-clean:
-       $(checkdir)
-       $(RM) build
-       test ! -f Makefile || $(MAKE) distclean
-       $(RM) config.cache
-       $(RM) -r obj
-       $(RM) -r *~ debian/tmp debian/*~ debian/files*
-       $(RM) -f debian/substvars
-       $(RM) -rf autom4te.cache
-       $(RM) -f build-aux/config.guess build-aux/config.sub
-
-binary-indep:  checkroot build
-       $(checkdir)
-
-binary-arch:   checkroot build
-       $(checkdir)
-       $(RM) -r debian/tmp
-       $(INSTALL_DIR) debian/tmp debian/tmp/DEBIAN
-       $(INSTALL_DIR) debian/tmp/usr/share/doc/$(package)
-# Install Debian package control information files
-       $(INSTALL_SCRIPT) debian/postinst \
-               debian/prerm debian/tmp/DEBIAN/.
-# Install directories
-       $(INSTALL_DIR)  \
-               debian/tmp/usr/bin      \
-               debian/tmp/usr/share/man/man1   \
-               debian/tmp/usr/share/info
-# Install files
-       $(MAKE) -C obj install DESTDIR=$(CURDIR)/debian/tmp
-       rm -rf debian/tmp/usr/libexec
-       rm -rf debian/tmp/usr/share/man/man8/rmt.8
-       mv debian/tmp/usr/bin/mt debian/tmp/usr/bin/mt-gnu
-       mv debian/tmp/usr/share/man/man1/mt.1 \
-         debian/tmp/usr/share/man/man1/mt-gnu.1
-# Strip binaries (including hack by policy wonks)
-ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
-       $(STRIP) -R.note -R.comment debian/tmp/usr/bin/*
-endif
-       rm -rf debian/tmp/usr/sbin
-# Install documentation
-       install -m 644 ChangeLog debian/tmp/usr/share/doc/$(package)/changelog
-       install -m 644 NEWS README debian/tmp/usr/share/doc/$(package)/.
-# Install changelog & copyright
-       install -m 644 debian/changelog \
-         debian/tmp/usr/share/doc/$(package)/changelog.Debian
-       gzip -9nv debian/tmp/usr/share/doc/$(package)/*
-       gzip -9nv debian/tmp/usr/share/man/*/*
-       find debian/tmp/usr/share/man/ -type d -empty -delete
-       rm -rf debian/tmp/usr/share/info
-       install -m 644 debian/copyright debian/tmp/usr/share/doc/$(package)/.
-# Determine shared library dependencies
-       dpkg-shlibdeps debian/tmp/usr/bin/cpio debian/tmp/usr/bin/mt-gnu
-
-# Generate md5sums
-       cd debian/tmp && find * -type f ! -regex '^DEBIAN/.*' -print0 | 
LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums
-
-# Generate deb file
-       dpkg-gencontrol -pcpio -Pdebian/tmp
-       chown -R root.root debian/tmp
-       chmod -R g-ws debian/tmp
-       find debian/tmp -depth -newermt '@$(SOURCE_DATE_EPOCH)' -print0 | \
-               xargs -0r touch --no-dereference --date='@$(SOURCE_DATE_EPOCH)'
-       dpkg-deb --build debian/tmp ..
-
-define checkdir
-       test -f src/$(package).h && test -f debian/rules
-endef
-
-# Below here is fairly generic really
-
-binary:                binary-indep binary-arch
-
-source diff:
-       @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
-
-checkroot:
-       $(checkdir)
-       test root = "`whoami`"
-
-.PHONY: binary binary-arch binary-indep clean checkroot
+override_dh_install:
+       dh_install
+       rm -rf debian/cpio/usr/libexec
+       rm -rf debian/cpio/usr/share/man/man8/rmt.8
+       mv debian/cpio/usr/bin/mt debian/cpio/usr/bin/mt-gnu
+       mv debian/cpio/usr/share/man/man1/mt.1 \
+         debian/cpio/usr/share/man/man1/mt-gnu.1
+       install -Dm 644 NEWS README -t debian/cpio/usr/share/doc/cpio/
+       gzip -9nv debian/cpio/usr/share/doc/cpio/*

Reply via email to