Bug#1011556: dh-octave: provide dh-sequence-octave virtual package, dh_auto_install to debian/tmp

2022-05-28 Thread Rafael Laboissière

Thanks for this bug report and for the patch, Nicolas.

I integrated your commits into the Git repository of the dh-package at 
Salsa, on a side branch called bug-1011556 [1].


I had to make a series of adjustments to your code, in order to have it 
working correctly, namely :


 * buildsystem.pm: use Debian::Debhelper::Dh_Lib [2]
 * buildsystem.pm: Avoid wildcards in doit calls [3]
 * dh_octave_make.in: Use dh-sequence-octave in Build-Depends [4]
 * buildsystem.pm: Check whether directories exist before acting on them [5]

Please, check whether this changes suit you.

I tested the resulting dh-octave, by building a couple of Octave-Forge 
packages against it, after changing the Buidl-Depends from dh-octave to 
dh-sequence-octave and removing "--with=octave" from debian/rules. 
Everything seems to work. However, since the changes are quite 
substantial in relation to the previously released version of dh-octave, 
It would be great if other members of the DOG can revise them before 
releasing a new version of the package.


Best,

Rafael

 [1] https://salsa.debian.org/pkg-octave-team/dh-octave/-/tree/bug-1011556
 [2] https://salsa.debian.org/pkg-octave-team/dh-octave/-/commit/a5957eb5
 [3] https://salsa.debian.org/pkg-octave-team/dh-octave/-/commit/0b51e820
 [4] https://salsa.debian.org/pkg-octave-team/dh-octave/-/commit/1c8bbf2c
 [5] https://salsa.debian.org/pkg-octave-team/dh-octave/-/commit/d0ff2a4b

* Nicolas Boulenguez  [2022-05-24 23:11]:


Package: dh-octave
Severity: wishlist
Tags: patch

Hello. 
The attached suggestions may simplify the use of dh-octave, especially 
for source packages building several binary packages.



From 8f56b92d51e122a8c50e12c0c14da0c37bba6acb Mon Sep 17 00:00:00 2001

From: Nicolas Boulenguez 
Date: Tue, 24 May 2022 21:13:45 +0200
Subject: [PATCH 1/4] d/control: let dh-octave provide dh-sequence-octave

Debhelper recognizes this special formal packages in Build-Depends and 
adds --with=octave to the dh parameters.


---
debian/control | 1 +
1 file changed, 1 insertion(+)

diff --git a/debian/control b/debian/control
index 8cc3d4a..280752f 100644
--- a/debian/control
+++ b/debian/control
@@ -16,6 +16,7 @@ Vcs-Git: 
https://salsa.debian.org/pkg-octave-team/dh-octave.git
Rules-Requires-Root: no

Package: dh-octave
+Provides: dh-sequence-octave
Architecture: all
Depends: octave-dev,
 debhelper-compat (= 13),
--
2.30.2




From e67ffe5ff0858c3722e8c100bd71b1ffed975b09 Mon Sep 17 00:00:00 2001

From: Nicolas Boulenguez 
Date: Tue, 24 May 2022 22:13:54 +0200
Subject: [PATCH 2/4] =?UTF-8?q?install-pkg.m:=20implement=20non-octave=20p?=
=?UTF-8?q?arts=20with=20perl=E2=80=99s=20Dh=5FLib?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
buildsystem.pm | 22 +-
install-pkg.m  | 23 +--
2 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/buildsystem.pm b/buildsystem.pm
index 974b275..ffd3dab 100644
--- a/buildsystem.pm
+++ b/buildsystem.pm
@@ -10,13 +10,33 @@ sub DESCRIPTION {

sub install {
my $this = shift;
+my $destdir = "debian/" . sourcepackage();
+my $arch = dpkg_architecture_value("DEB_HOST_MULTIARCH");
+my $mpath = "$destdir/usr/share/octave/packages";
+my $bpath = "$destdir/usr/lib/$arch/octave/packages";
+
$this->doit_in_sourcedir ("octave",
  "--no-gui",
  "--no-history",
  "--silent",
  "--no-init-file",
  "--no-window-system",
-  "/usr/share/dh-octave/install-pkg.m")
+  "/usr/share/dh-octave/install-pkg.m",
+  $mpath, $bpath);
+
+doit ("rmdir", "--ignore-fail-on-non-empty", "-p", "$mpath", "$bpath");
+
+# Remove unnecessary documentation files
+doit ("rm", "-fr", "$mpath/*/doc");
+doit ("rm", "-f", "$mpath/*/packinfo/COPYING");
+
+# Fix permission of installed *.oct and *.mex files, as per FHS 3.0
+# sections 4.6 and 4.7 (see Bug#954149)
+doit ("chmod", "-x", "$bpath/*/*/*.oct");
+doit ("chmod", "-x", "$bpath/*/*/*.mex");
+
+# Remove left over files *-tst
+doit ("rm", "-f", "$bpath/*/*/*-tst");
}

sub clean {
diff --git a/install-pkg.m b/install-pkg.m
index 0a343ad..d586c13 100644
--- a/install-pkg.m
+++ b/install-pkg.m
@@ -24,12 +24,7 @@ if (exist ("./PKG_ADD") == 2)
movefile ("PKG_ADD", "PKG_ADD.bak");
endif

-package = sysout ("grep ^Source: debian/control | cut -f2 -d\\ ");
-debpkg = [pwd(), "/debian/", package];
-mpath = [debpkg, "/usr/share/octave/packages"];
-arch = sysout ("dpkg-architecture -qDEB_HOST_MULTIARCH");
-bpath = [debpkg, "/usr/lib/", arch, "/octave/packages"];
-pkg ("prefix", mpath, bpath);
+pkg ("prefix", argv(){1}, argv(){2});

pkg ("local_list", fullfile (pwd (), "local-list"));
pkg ("global_list", fullfile (pwd (), "global-list"));
@@ -41,19 +36,3 @@ if 

Bug#1011556: dh-octave: provide dh-sequence-octave virtual package, dh_auto_install to debian/tmp

2022-05-24 Thread Nicolas Boulenguez
Package: dh-octave
Severity: wishlist
Tags: patch

Hello.
The attached suggestions may simplify the use of dh-octave, especially
for source packages building several binary packages.
>From 8f56b92d51e122a8c50e12c0c14da0c37bba6acb Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez 
Date: Tue, 24 May 2022 21:13:45 +0200
Subject: [PATCH 1/4] d/control: let dh-octave provide dh-sequence-octave

Debhelper recognizes this special formal packages in Build-Depends and
adds --with=octave to the dh parameters.

This is quite convenient when the dependency is restricted to
architecture-independent builds or by profiles.  In such scenarios,
several non-trivial conditionals can be avoided in debian/rules.
---
 debian/control | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/control b/debian/control
index 8cc3d4a..280752f 100644
--- a/debian/control
+++ b/debian/control
@@ -16,6 +16,7 @@ Vcs-Git: https://salsa.debian.org/pkg-octave-team/dh-octave.git
 Rules-Requires-Root: no
 
 Package: dh-octave
+Provides: dh-sequence-octave
 Architecture: all
 Depends: octave-dev,
  debhelper-compat (= 13),
-- 
2.30.2

>From e67ffe5ff0858c3722e8c100bd71b1ffed975b09 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez 
Date: Tue, 24 May 2022 22:13:54 +0200
Subject: [PATCH 2/4] =?UTF-8?q?install-pkg.m:=20implement=20non-octave=20p?=
 =?UTF-8?q?arts=20with=20perl=E2=80=99s=20Dh=5FLib?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The effect should be equivalent, with a slight improvement when
debhelper verbose option is enabled.
---
 buildsystem.pm | 22 +-
 install-pkg.m  | 23 +--
 2 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/buildsystem.pm b/buildsystem.pm
index 974b275..ffd3dab 100644
--- a/buildsystem.pm
+++ b/buildsystem.pm
@@ -10,13 +10,33 @@ sub DESCRIPTION {
 
 sub install {
 my $this = shift;
+my $destdir = "debian/" . sourcepackage();
+my $arch = dpkg_architecture_value("DEB_HOST_MULTIARCH");
+my $mpath = "$destdir/usr/share/octave/packages";
+my $bpath = "$destdir/usr/lib/$arch/octave/packages";
+
 $this->doit_in_sourcedir ("octave",
   "--no-gui",
   "--no-history",
   "--silent",
   "--no-init-file",
   "--no-window-system",
-  "/usr/share/dh-octave/install-pkg.m")
+  "/usr/share/dh-octave/install-pkg.m",
+  $mpath, $bpath);
+
+doit ("rmdir", "--ignore-fail-on-non-empty", "-p", "$mpath", "$bpath");
+
+# Remove unnecessary documentation files
+doit ("rm", "-fr", "$mpath/*/doc");
+doit ("rm", "-f", "$mpath/*/packinfo/COPYING");
+
+# Fix permission of installed *.oct and *.mex files, as per FHS 3.0
+# sections 4.6 and 4.7 (see Bug#954149)
+doit ("chmod", "-x", "$bpath/*/*/*.oct");
+doit ("chmod", "-x", "$bpath/*/*/*.mex");
+
+# Remove left over files *-tst
+doit ("rm", "-f", "$bpath/*/*/*-tst");
 }
 
 sub clean {
diff --git a/install-pkg.m b/install-pkg.m
index 0a343ad..d586c13 100644
--- a/install-pkg.m
+++ b/install-pkg.m
@@ -24,12 +24,7 @@ if (exist ("./PKG_ADD") == 2)
 movefile ("PKG_ADD", "PKG_ADD.bak");
 endif
 
-package = sysout ("grep ^Source: debian/control | cut -f2 -d\\ ");
-debpkg = [pwd(), "/debian/", package];
-mpath = [debpkg, "/usr/share/octave/packages"];
-arch = sysout ("dpkg-architecture -qDEB_HOST_MULTIARCH");
-bpath = [debpkg, "/usr/lib/", arch, "/octave/packages"];
-pkg ("prefix", mpath, bpath);
+pkg ("prefix", argv(){1}, argv(){2});
 
 pkg ("local_list", fullfile (pwd (), "local-list"));
 pkg ("global_list", fullfile (pwd (), "global-list"));
@@ -41,19 +36,3 @@ if (exist ("PKG_ADD.bak") == 2)
 endif
 
 pkg -verbose -nodeps install .
-
-system (sprintf ("rmdir --ignore-fail-on-non-empty -p %s %s",
- mpath, bpath));
-
-### Remove unnecessary documentation files
-pkgdir = "debian/*/usr/share/octave/packages/*";
-system (sprintf ("rm -rf %s/doc", pkgdir));
-system (sprintf ("rm -f %s/packinfo/COPYING", pkgdir));
-
-### Fix permission of installed *.oct and *.mex files, as per FHS 3.0
-### sections 4.6 and 4.7 (see Bug#954149)
-system ("chmod -x debian/*/usr/lib/*/octave/packages/*/*/*.oct");
-system ("chmod -x debian/*/usr/lib/*/octave/packages/*/*/*.mex");
-
-### Remove left over files *-tst
-system ("rm -f debian/*/usr/lib/*/octave/packages/*/*/*-tst");
-- 
2.30.2

>From 215fc37d39001e56833b20e80a7c23bc0511af16 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez 
Date: Tue, 24 May 2022 22:17:02 +0200
Subject: [PATCH 3/4] =?UTF-8?q?buildsystem.pm:=20use=20debhelper=E2=80=99s?=
 =?UTF-8?q?=20tmpdir=20instead=20of=20debian/sourcepackage?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This change is intrusive, but may simplify source packages