[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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



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/classppd
+	[ ! -e debian_previous_bkp.tar.gz ] || tar xvzf debian_previous_bkp.tar.gz
+	rm -f  debian_previous_bkp.tar.gz
 
 ##
 ##  Package build
 ##
 
-override_dh_auto_configure:
+override_dh_auto_configure: debian_previous_bkp.tar.gz
 	dh_auto_configure -- \
 		PYTHON="$(PYTHON)" \
 	 	--config-cache \
@@ -97,7 +106,7 @@ override_dh_auto_build:
 
 	# Rebuild the .drv.in files from drv.in.template
 	$(PYTHON) ./dat2drv.py
-	
+
 	dh_auto_build
 
 ##
-- 
2.49.0


Reply to: