• Bug#1046748: hplip: Fails to build source after successful build

    From Agustin Martin@21:1/5 to Lucas Nussbaum on Mon Apr 14 11:30:01 2025
    Control: tags -1 + patch

    On Sun, Aug 13, 2023 at 09:20:47PM +0200, Lucas Nussbaum wrote:
    Source: hplip
    Version: 3.22.10+dfsg0-2
    Severity: minor
    Tags: trixie sid ftbfs
    User: lucas@debian.org
    Usertags: ftbfs-sab-20230813 ftbfs-source-after-build
    User: debian-qa@lists.debian.org
    Usertags: qa-doublebuild

    Hi,

    This package fails to build a source package after a successful build (dpkg-buildpackage ; dpkg-buildpackage -S).
    [...]
    dpkg-source: warning: file hplip-3.22.10+dfsg0/prnt/drv/foomatic_xml/hpijs/HP-tango.xml has no final newline (either original or modified version)
    dpkg-source: warning: file hplip-3.22.10+dfsg0/prnt/drv/foomatic_xml/hpijs/hpijs.xml has no final newline (either original or modified version)
    dpkg-source: error: unrepresentable changes to source
    dpkg-buildpackage: error: dpkg-source -b . subprocess returned exit status 1

    E: Command 'cd /<<PKGBUILDDIR>> && runuser -u user42 -- dpkg-buildpackage --sanitize-env -us -uc -rfakeroot -S' failed to run.


    Hi,

    Seems that some autogenerated or modified stuff is left behind
    after clean target. I have been playing with this to remove
    autogenerated stuff. For modified stuff, there are many modified
    things (in particular for ppd files gunzipping seems not enough), so
    I tested saving original stuff and restoring it from scratch at override_dh_clean target.

    I am attaching a patch with the changes I tested in my box. Here, they
    make package successfully build twice.

    Hope it helps,

    --
    Agustin

    From 848e907283116a254c5af9002c06f3b4ade1de16 Mon Sep 17 00:00:00 2001
    From: Agustin Martin Domingo <agmartin@debian.org>
    Date: Mon, 14 Apr 2025 10:28:56 +0200
    Subject: [PATCH] d/rules: Make sure things are restored on clean target
    (#1046748).

    This should allow building full package after successful build.

    Many things are changed under ppd, just gunzipping things is
    not enough, better restore initial contents from scratch.

    Other things left behind are removed or restored by this patch.
    ---
    debian/rules | 15 ++++++++++++---
    1 file changed, 12 insertions(+), 3 deletions(-)

    diff --git a/debian/rules b/debian/rules
    index f7c2b68..2079316 100755
    --- a/debian/rules
    +++ b/debian/rules
    @@ -37,6 +37,9 @@ GZIP = gzip -n --best
    override_dh_autoreconf:
    dh_autoreconf --as-needed sh -- debian/autogen.sh

    +debian_previous_bkp.tar.gz:
    + tar -cvzf $@ cups_drv.inc foomatic_drv.inc ppd prnt/drv
    +
    # Clean everything up, including everything auto-generated
    # at build time that needs not to be kept around in the Debian diff
    override_dh_clean:
    @@ -47,13 +50,19 @@ override_dh_clean:
    find -type d -name build -print0 | xargs -0 -r rm -rf \;
    # We prefer to regenerate these using pyuic
    (cd ui5 && for i in *.ui ; do rm -f $${i%.ui}.py ; done)
    -
    + # Other autogenerated or modified stuff that is left behind.
    + rm -rf prnt/drv/foomatic_xml
    + rm -f Dat2drv prnt/hpcups/libImageProcessor.so
    + # Many changes under ppd, so just restore it from scratch.
    + rm -rf ppd/hpijs ppd/hpcups ppd
  • From Agustin Martin@21:1/5 to Agustin Martin on Tue Apr 15 02:20:01 2025
    On Mon, Apr 14, 2025 at 11:25:11AM +0200, Agustin Martin wrote:
    Control: tags -1 + patch

    On Sun, Aug 13, 2023 at 09:20:47PM +0200, Lucas Nussbaum wrote:
    Source: hplip
    Version: 3.22.10+dfsg0-2
    Severity: minor
    Tags: trixie sid ftbfs
    User: lucas@debian.org
    Usertags: ftbfs-sab-20230813 ftbfs-source-after-build
    User: debian-qa@lists.debian.org
    Usertags: qa-doublebuild

    Hi,

    This package fails to build a source package after a successful build (dpkg-buildpackage ; dpkg-buildpackage -S).
    [...]
    dpkg-source: warning: file hplip-3.22.10+dfsg0/prnt/drv/foomatic_xml/hpijs/HP-tango.xml has no final newline (either original or modified version)
    dpkg-source: warning: file hplip-3.22.10+dfsg0/prnt/drv/foomatic_xml/hpijs/hpijs.xml has no final newline (either original or modified version)
    dpkg-source: error: unrepresentable changes to source
    dpkg-buildpackage: error: dpkg-source -b . subprocess returned exit status 1

    E: Command 'cd /<<PKGBUILDDIR>> && runuser -u user42 -- dpkg-buildpackage --sanitize-env -us -uc -rfakeroot -S' failed to run.

    I am attaching a patch with the changes I tested in my box. Here, they
    make package successfully build twice.

    Safer version of patch attached. Should work better with multiple
    "debian/rules clean" invocations.

    --
    Agustin

    From 587c9d2cea0cc7fa5825e444eef08f4eed729537 Mon Sep 17 00:00:00 2001
    From: Agustin Martin Domingo <agmartin@debian.org>
    Date: Mon, 14 Apr 2025 10:28:56 +0200
    Subject: [PATCH] d/rules: Make sure things are restored on clean target
    (#1046748).

    This should allow building full package after successful build.

    Many things are changed under ppd, just gunzipping things is
    not enough, better restore initial contents from scratch.

    Other things left behind are removed or restored by this patch.
    ---
    debian/rules | 18 ++++++++++++++++--
    1 file changed, 16 insertions(+), 2 deletions(-)

    diff --git a/debian/rules b/debian/rules
    index f7c2b68..56b94d5 100755
    --- a/debian/rules
    +++ b/debian/rules
    @@ -37,6 +37,9 @@ GZIP = gzip -n --best
    override_dh_autoreconf:
    dh_autoreconf --as-needed sh -- debian/autogen.sh

    +debian_previous_bkp.tar.gz:
    + tar -cvzf $@ cups_drv.inc foomatic_drv.inc ppd prnt/drv
    +
    # Clean everything up, including everything auto-generated
    # at build time that needs not to be kept around in the Debian diff
    override_dh_clean:
    @@ -47,13 +50,24 @@ override_dh_clean:
    find -type d -name build -print0 | xargs -0 -r rm -rf \;
    # We prefer to regenerate these using pyuic
    (cd ui5 && for i in *.ui ; do rm -f $${i%.ui}.py ; done)
    -
    + # Other autogenerated stuff that is left behind.
    + rm -rf prnt/drv/foomatic_xml
    + rm -f Dat2drv prnt/hpcups/libImageProcessor.so
    + rm -rf ppd/hpijs
    + rm -f ppd/hpcups/hp-laserjet_cp_1025nw.ppd \
    + ppd/hpcups/hp-laserjet_pro