[Git][haskell-team/haskell-devscripts][master] 2 commits: Fix GHC package directory registration (Closes: #1009883)

Scott Talbert (@swt2c) gitlab at salsa.debian.org
Wed Apr 27 16:10:54 BST 2022



Scott Talbert pushed to branch master at Debian Haskell Group / haskell-devscripts


Commits:
1a0832ea by Scott Talbert at 2022-04-27T10:47:19-04:00
Fix GHC package directory registration (Closes: #1009883)

When a GHC package uses internal or convenience libraries, package
registration will generate a directory (containing multiple files)
instead of a single file.  In this case, only install/parse the *first*
file in the directory as this should contain the public library and we
don't install/parse the internal library files.

- - - - -
e073b11a by Scott Talbert at 2022-04-27T11:08:20-04:00
Release version 0.16.14 into unstable.

- - - - -


3 changed files:

- debian/changelog
- dh_haskell_install_ghc_registration
- lib/Debian/Debhelper/Buildsystem/Haskell/Recipes.pm


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,16 @@
+haskell-devscripts (0.16.14) unstable; urgency=medium
+
+  * Team Upload.
+
+  [ Felix Lechner ]
+  * Anchor dot regex; amends commit 7a92a0a0.
+
+  [ Scott Talbert ]
+  * Add missing export for DEB_ENABLE_TESTS (Closes: #1010179)
+  * Fix GHC package directory registration (Closes: #1009883)
+
+ -- Scott Talbert <swt at techie.net>  Wed, 27 Apr 2022 11:04:45 -0400
+
 haskell-devscripts (0.16.13) unstable; urgency=medium
 
   * Drop dot placeholders for empty lines in (X-)Description.


=====================================
dh_haskell_install_ghc_registration
=====================================
@@ -45,29 +45,25 @@ for my $installable (@{ $dh{DOPACKAGES} }) {
         qw{--gen-pkg-config --verbose=verbose+nowrap});
 
     if ($output
-        =~ m{^Creating \s package \s registration \s file: \s+ (\S+) $}mx) {
+        =~ m{^Creating \s package \s registration \s (file|directory): \s+ (\S+) $}mx) {
 
-        my $path = $1;
+        my $path = $2;
+        my $pkg_config = $2;
 
-        my @pkg_configs;
         if (-d $path) {
-# https://downloads.haskell.org/cabal/Cabal-3.0.0.0/doc/users-guide/installing-packages.html#cmdoption-setup-register-gen-pkg-config
-            push(@pkg_configs, glob("$path/*.conf"));
-
-        } else {
-            push(@pkg_configs, $path);
+            # https://downloads.haskell.org/cabal/Cabal-3.0.0.0/doc/users-guide/installing-packages.html#cmdoption-setup-register-gen-pkg-config
+            # If the package registration is a directory, choose the first one since the other(s) will be internal libraries that we don't want to install.
+            my @pkg_configs = glob("$path/*");
+            $path = $pkg_configs[0];
         }
 
-        for my $pkg_config (@pkg_configs) {
-
-            run(qw{sed -i}, 's/^exposed: True$/exposed: False/',$pkg_config)
-              if length $ENV{HASKELL_HIDE_PACKAGES};
+        run(qw{sed -i}, 's/^exposed: True$/exposed: False/', $path)
+            if length $ENV{HASKELL_HIDE_PACKAGES};
 
-            run(qw{install -D --mode=644},
-                $pkg_config, "debian/$installable/$pkgdir/$pkg_config");
-        }
+        run(qw{install -D --mode=644},
+            $path, "debian/$installable/$pkgdir/$pkg_config");
 
-        run(qw{rm -rf}, $path);
+        run(qw{rm -rf}, $pkg_config);
 
     } else {
 


=====================================
lib/Debian/Debhelper/Buildsystem/Haskell/Recipes.pm
=====================================
@@ -367,42 +367,35 @@ sub own_cabal_prerequisites {
 
     my @hashed_ids;
     if ($output
-        =~ m{^Creating \s package \s registration \s file: \s+ (\S+) $}mx) {
+        =~ m{^Creating \s package \s registration \s (file|directory): \s+ (\S+) $}mx) {
 
-        my $path = $1;
+        my $pkg_config = $2;
 
-        my @pkg_configs;
-        if (-d $path) {
-# https://downloads.haskell.org/cabal/Cabal-3.0.0.0/doc/users-guide/installing-packages.html#cmdoption-setup-register-gen-pkg-config
-            push(@pkg_configs, glob("$path/*.conf"));
-
-        } else {
-            push(@pkg_configs, $path);
+        if (-d $pkg_config) {
+            # https://downloads.haskell.org/cabal/Cabal-3.0.0.0/doc/users-guide/installing-packages.html#cmdoption-setup-register-gen-pkg-config
+            # If the package registration is a directory, choose the first one since the other(s) will be internal libraries that we don't want to install.
+            my @pkg_configs = glob("$pkg_config/*");
+            $pkg_config = "$pkg_config/$pkg_config";
+            run('mv', $pkg_configs[0], $pkg_config);
         }
 
         my $ghc_pkg = ghc_pkg_command();
-        load_ghc_database($ghc_pkg, $tmp_db, @pkg_configs);
-
-        for my $pkg_config (@pkg_configs) {
+        load_ghc_database($ghc_pkg, $tmp_db, $pkg_config);
 
-            my $name = path($pkg_config)->basename(qr{ [.]conf $}x);
-            my $depends
-              = run($ghc_pkg, '--package-db', $tmp_db,
-                qw{--simple-output field},
-                $name, 'depends');
+        my $name = path($pkg_config)->basename(qr{ [.]conf $}x);
+        my $depends
+          = run($ghc_pkg, '--package-db', $tmp_db, qw{--simple-output field},
+            $name, 'depends');
 
-            push(@hashed_ids, split($SPACE, $depends // $EMPTY));
-        }
+        push(@hashed_ids, split($SPACE, $depends // $EMPTY));
 
-        run(qw{rm -rf}, $path);
+        run(qw{rm -rf}, $pkg_config);
 
     } else {
         warn encode_utf8('Cannot generate package registration.');
     }
 
-    my @unique = uniq @hashed_ids;
-
-    return @unique;
+    return @hashed_ids;
 }
 
 =item load_ghc_database



View it on GitLab: https://salsa.debian.org/haskell-team/haskell-devscripts/-/compare/c2ba211f0ae11a57e6ff01aa652e2406ec05d3b7...e073b11a41256239a4266dc7ce644e7329b76cb0

-- 
View it on GitLab: https://salsa.debian.org/haskell-team/haskell-devscripts/-/compare/c2ba211f0ae11a57e6ff01aa652e2406ec05d3b7...e073b11a41256239a4266dc7ce644e7329b76cb0
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-haskell-commits/attachments/20220427/21812a6e/attachment-0001.htm>


More information about the Pkg-haskell-commits mailing list