[Git][haskell-team/haskell-devscripts][master] 13 commits: Date::Time is in libtimedate-perl and not in libdatetime-perl; require the former instead.

Felix Lechner (@lechner) gitlab at salsa.debian.org
Mon Apr 11 13:55:29 BST 2022



Felix Lechner pushed to branch master at Debian Haskell Group / haskell-devscripts


Commits:
df82789b by Felix Lechner at 2022-04-11T05:05:58-07:00
Date::Time is in libtimedate-perl and not in libdatetime-perl; require the former instead.

Avoids those build failures:

perl -d:Confess -MDebian::Debhelper::Buildsystem::Haskell::Recipes=/.*/ \
-E 'clean_recipe'
Can't locate Date/Parse.pm in @INC (you may need to install the Date::Parse module)
 (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.34.0
 /usr/local/share/perl/5.34.0 /usr/lib/x86_64-linux-gnu/perl5/5.34 /usr/share/perl5
 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.34 /usr/share/perl/5.34
 /usr/local/lib/site_perl)
 at /usr/share/perl5/Debian/Debhelper/Buildsystem/Haskell/Recipes.pm line 82.
Debian::Debhelper::Buildsystem::Haskell::Recipes::BEGIN() called
 at /usr/share/perl5/Debian/Debhelper/Buildsystem/Haskell/Recipes.pm line 82
eval {...} called at /usr/share/perl5/Debian/Debhelper/Buildsystem/Haskell/Recipes.pm line 82
require Debian/Debhelper/Buildsystem/Haskell/Recipes.pm called at -e line 0
main::BEGIN() called at /usr/share/perl5/Debian/Debhelper/Buildsystem/Haskell/Recipes.pm line 82
eval {...} called at /usr/share/perl5/Debian/Debhelper/Buildsystem/Haskell/Recipes.pm line 82
BEGIN failed--compilation aborted at /usr/share/perl5/Debian/Debhelper/Buildsystem/Haskell/Recipes.pm line 82.
require Debian/Debhelper/Buildsystem/Haskell/Recipes.pm called at -e line 0
main::BEGIN() called at /usr/share/perl5/Debian/Debhelper/Buildsystem/Haskell/Recipes.pm line 82
eval {...} called at /usr/share/perl5/Debian/Debhelper/Buildsystem/Haskell/Recipes.pm line 82
Compilation failed in require.
 at -e line 0.
main::BEGIN() called at -e line 0
eval {...} called at -e line 0
BEGIN failed--compilation aborted.
 at -e line 0.
make: *** [/usr/share/cdbs/1/class/hlibrary.mk:138: clean] Error 2
dpkg-buildpackage: error: debian/rules clean subprocess returned exit status 2

Seen at:

    https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/haskell-hoogle.html
    https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/haskell-hsh.html

and many others.

- - - - -
cd57b1b7 by Felix Lechner at 2022-04-11T05:05:58-07:00
Restrict Perl API to routines actually called from elsewhere.

Many of those were internal functions used only by the original shell script
library.

- - - - -
2449b460 by Felix Lechner at 2022-04-11T05:05:58-07:00
Drop unused Perl routines.

- - - - -
aac13641 by Felix Lechner at 2022-04-11T05:05:58-07:00
Move a 'clean' command closer to that directory's point of creation and use.

- - - - -
8c6d03db by Felix Lechner at 2022-04-11T05:05:58-07:00
Use array return types in Perl when appropriate.

- - - - -
8054c84a by Felix Lechner at 2022-04-11T05:43:10-07:00
Find the correct Debian installables for profiling libraries.

The bug was introduced in the first Perl version in commit 8d20067a.

- - - - -
802ce989 by Felix Lechner at 2022-04-11T05:43:30-07:00
Rename and refactor the calculation of Debian prerequisites.

- - - - -
46fd5f54 by Felix Lechner at 2022-04-11T05:43:30-07:00
Combine the different installation procedures into one install_recipe.

- - - - -
7ad285d1 by Felix Lechner at 2022-04-11T05:43:30-07:00
DEB_PACKAGES does not seem to be available in Debhelper; use dh_listpackages instead.

- - - - -
1ca04cd8 by Felix Lechner at 2022-04-11T05:43:30-07:00
Refuse to run dh_haskell_blurbs unless a default compiler appeared on the command line.

- - - - -
814b78c7 by Felix Lechner at 2022-04-11T05:43:39-07:00
Behave better when called on non-library packages (from Debhelper).

- - - - -
99fdd54d by Felix Lechner at 2022-04-11T05:44:03-07:00
Print output from run() only if there is any.

This used to break the shell script interface whenever it relied on output. The
last remaining use of that functionality is documented near hashed_dependency().

Let's hope it is not affected.

- - - - -
97b51e7d by Felix Lechner at 2022-04-11T05:44:46-07:00
Release version 0.16.6 into unstable.

- - - - -


9 changed files:

- Dh_Haskell.sh
- debian/changelog
- debian/control
- dh_haskell_blurbs
- dh_haskell_depends
- dh_haskell_provides
- dh_haskell_shlibdeps
- hlibrary.mk
- lib/Debian/Debhelper/Buildsystem/Haskell/Recipes.pm


Changes:

=====================================
Dh_Haskell.sh
=====================================
@@ -29,15 +29,6 @@ hashed_dependency(){
     recipe "${FUNCNAME[0]}" "$@"
 }
 
-# the ones below are only used in the CDBS module hlibrary.mk
-install_dev_recipe(){
-    recipe "${FUNCNAME[0]}" "$@"
-}
-
-install_prof_recipe(){
-    recipe "${FUNCNAME[0]}" "$@"
-}
-
-install_doc_recipe(){
+install_recipe(){
     recipe "${FUNCNAME[0]}" "$@"
 }


=====================================
debian/changelog
=====================================
@@ -1,3 +1,25 @@
+haskell-devscripts (0.16.6) unstable; urgency=medium
+
+  * Date::Time is in libtimedate-perl and not in libdatetime-perl; require
+    the former instead. (Fixes FTBFS on reproducible builds.)
+  * Find the correct Debian installables for profiling libraries (an
+    undocumented bug).
+  * Restrict Perl API to routines actually called from elsewhere.
+  * Drop unused Perl routines.
+  * Combine the different installation procedures into one install_recipe.
+  * Refuse to run dh_haskell_blurbs unless a default compiler appeared on
+    the command line.
+  * Move a 'clean' command closer to that directory's point of creation
+    and use.
+  * Behave better when called on non-library packages (from Debhelper).
+  * DEB_PACKAGES does not seem to be available in Debhelper; call
+    dh_listpackages instead.
+  * Rename and refactor the calculation of Debian prerequisites.
+  * Use array return types in Perl when appropriate.
+  * Print output from run() only if there is any.
+
+ -- Felix Lechner <felix.lechner at lease-up.com>  Mon, 11 Apr 2022 05:44:26 -0700
+
 haskell-devscripts (0.16.5) unstable; urgency=medium
 
   * Add libdevel-confess-perl to the runtime prerequisites.


=====================================
debian/control
=====================================
@@ -23,11 +23,11 @@ Depends: dctrl-tools
   , html-xml-utils
   , ghc-haddock
   , libconst-fast-perl
-  , libdatetime-perl
   , libdevel-confess-perl
   , libipc-run3-perl
   , liblist-someutils-perl
   , libpath-tiny-perl
+  , libtimedate-perl
   , libunicode-utf8-perl
   , perl
   , ${misc:Depends}


=====================================
dh_haskell_blurbs
=====================================
@@ -54,6 +54,9 @@ Getopt::Long::GetOptions(%options)
 my @args_bytes = grep { /^-/ } @ARGV;
 my ($default_compiler, @configs) = grep { !/^-/ } @ARGV;
 
+die encode_utf8("$program_name: Need default Haskell compiler")
+  unless length $default_compiler;
+
 die encode_utf8("Installed package description file $_ can not be found")
   for grep { !-e } @configs;
 


=====================================
dh_haskell_depends
=====================================
@@ -36,9 +36,8 @@ use Debian::Debhelper::Buildsystem::Haskell::Recipes qw(
   packages_hc
   find_config_for_ghc
   cabal_depends
-  depends_for_ghc
-  depends_for_ghc_prof
-  depends_for_hugs
+  ghc_depends
+  hugs_depends
 );
 
 const my $EMPTY => q{};
@@ -108,11 +107,8 @@ for my $installable (@installables) {
 
             if ($extension eq 'dev') {
 
-                push(
-                    @depends,
-                    split(
-                        m{ \s* , \s* }x,
-                        depends_for_ghc($haskell_compiler, @configs)));
+                push(@depends,
+                    ghc_depends($haskell_compiler, $extension, @configs));
 
                 my $prof = $installable;
                 $prof =~ s{ - [^-]+ $}{-prof}x;
@@ -135,11 +131,8 @@ for my $installable (@installables) {
                 $dev =~ s{ - [^-]+ $}{-dev}x;
 
                 push(@depends, "$dev (=\${binary:Version})");
-                push(
-                    @depends,
-                    split(
-                        m{ \s* , \s* }x,
-                        depends_for_ghc_prof($haskell_compiler, @configs)));
+                push(@depends,
+                    ghc_depends($haskell_compiler, $extension, @configs));
             }
         }
 
@@ -215,7 +208,7 @@ for my $installable (@installables) {
 
     if ($haskell_compiler eq 'hugs') {
 
-        push(@depends,split(m{ \s* , \s* }x,depends_for_hugs()));
+        push(@depends, hugs_depends());
     }
 
     local $ENV{LC_ALL} = 'C.UTF-8';
@@ -241,31 +234,37 @@ sub get_extra_depends {
         'register', "--builddir=dist-$compiler",
         qw{--gen-pkg-config --verbose=verbose+nowrap});
 
-    die encode_utf8('Cannot get name of package registration file.')
-      unless $output
-      =~ m{^Creating \s package \s registration \s file: \s+ (\S+) $}mx;
+    my @prerequisites;
 
-    my $pkg_config = $1;
+    if ($output
+        =~ m{^Creating \s package \s registration \s file: \s+ (\S+) $}mx) {
 
-    my @hackages = cabal_depends($pkg_config);
+        my $pkg_config = $1;
 
-    run(qw{rm -f}, $pkg_config);
+        my @hackages = cabal_depends($pkg_config);
 
-    my @prerequisites;
-    for my $hackage (@hackages) {
+        run(qw{rm -f}, $pkg_config);
+
+        for my $hackage (@hackages) {
 
-        next
-          unless $hackage =~ m{^ ([^-]+) - ([0-9.]+) - [0-9a-f]{32} $}x;
+            next
+              unless $hackage =~ m{^ ([^-]+) - ([0-9.]+) - [0-9a-f]{32} $}x;
 
-        my $name = $1;
-        my $version = $2;
+            my $name = $1;
+            my $version = $2;
 
-        my $extra_packages_file
-          = "/usr/lib/haskell-packages/extra-packages/$name-$version";
+            my $extra_packages_file
+              = "/usr/lib/haskell-packages/extra-packages/$name-$version";
+
+            push(@prerequisites,
+                split(m{ \s* , \s* }x, path($extra_packages_file)->slurp_utf8))
+              if -e $extra_packages_file;
+        }
 
-        push(@prerequisites,
-            split(m{ \s* , \s* }x, path($extra_packages_file)->slurp_utf8))
-          if -e $extra_packages_file;
+    } else {
+        warn encode_utf8(
+"$program_name: Skipping extra depends; cannot find package registration file (probablu not a library."
+        );
     }
 
     return @prerequisites;


=====================================
dh_haskell_provides
=====================================
@@ -36,10 +36,11 @@ use Debian::Debhelper::Buildsystem::Haskell::Recipes qw(
   package_hc
   find_config_for_ghc
   cabal_package_ids
-  composite_provides
+  ghc_provides
 );
 
 const my $SPACE => q{ };
+const my $COMMA => q{,};
 const my $NEWLINE => qq{\n};
 
 my $program_name = basename($0);
@@ -70,21 +71,20 @@ my @installables = split($SPACE, $output);
 for my $installable (@installables) {
 
     my $extension = package_ext($installable);
-    next
-      if none { $extension eq $_ } qw{dev prof};
 
     @configs = find_config_for_ghc($installable)
       unless @configs;
 
-    die encode_utf8(
-        'dh_haskell_provides - no installed package description files found')
+    warn encode_utf8(
+        "$program_name: No installed package description files found")
       unless @configs;
 
     my $compiler = package_hc($installable);
-    my $provides = composite_provides($compiler, $extension, @configs);
+    my @provides = ghc_provides($compiler, $extension, @configs);
 
     my $substvars_path = "debian/$installable.substvars";
-    replace_line($substvars_path, 'haskell:Provides', $provides);
+    replace_line($substvars_path, 'haskell:Provides',
+        join($COMMA . $SPACE, @provides));
 
     if ($extension eq 'dev') {
 


=====================================
dh_haskell_shlibdeps
=====================================
@@ -76,8 +76,7 @@ for my $installable (@installables) {
       unless @configs;
 }
 
-die encode_utf8(
-    'dh_haskell_shlibdeps - no installed package description files found')
+warn encode_utf8("$program_name: No installed package description files found")
   unless @configs;
 
 my $T_DIR = 'debian/dh_haskell_shlibdeps';
@@ -120,6 +119,8 @@ for my $installable (@installables) {
     run(qw{dpkg-shlibdeps --warnings=1}, "-T$substvars_path", $probe_path);
 }
 
+path($T_DIR)->remove_tree;
+
 exit;
 
 sub show_help {


=====================================
hlibrary.mk
=====================================
@@ -152,7 +152,8 @@ build-ghc-stamp: $(DEB_SETUP_BIN_NAME)
 build/%-dev build/%-prof build/%-doc:: build-ghc-stamp
 
 debian/tmp-inst-%: $(DEB_SETUP_BIN_NAME) build-ghc-stamp
-	$(DEB_SETUP_BIN_NAME) copy --builddir=dist-$* --destdir=$@
+	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
+	install_recipe "$@"
 
 dist-hugs: $(DEB_SETUP_BIN_NAME)
 	$(DEB_SETUP_BIN_NAME) configure --hugs --prefix=/usr -v2 \
@@ -161,39 +162,15 @@ dist-hugs: $(DEB_SETUP_BIN_NAME)
 build/libhugs-$(CABAL_PACKAGE):: dist-hugs
 	$(DEB_SETUP_BIN_NAME) build --builddir=dist-hugs
 
-install/libghc-$(CABAL_PACKAGE)-dev:: debian/tmp-inst-ghc
-	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
-	install_dev_recipe "$(notdir $@)"
-
-install/libghcjs-$(CABAL_PACKAGE)-dev:: debian/tmp-inst-ghcjs
-	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
-	install_dev_recipe "$(notdir $@)"
-
-install/libghc-$(CABAL_PACKAGE)-prof:: debian/tmp-inst-ghc install/libghc-$(CABAL_PACKAGE)-dev
-	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
-	install_prof_recipe "$(notdir $@)"
-
-install/libghcjs-$(CABAL_PACKAGE)-prof:: debian/tmp-inst-ghcjs install/libghcjs-$(CABAL_PACKAGE)-dev
-	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
-	install_prof_recipe "$(notdir $@)"
-
-install/libghc-$(CABAL_PACKAGE)-doc:: debian/tmp-inst-ghc
-	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
-	install_doc_recipe "$(notdir $@)"
+install/libghc-$(CABAL_PACKAGE)-dev install/libghc-$(CABAL_PACKAGE)-prof install/libghc-$(CABAL_PACKAGE)-doc:: debian/tmp-inst-ghc
 
-install/libghcjs-$(CABAL_PACKAGE)-doc:: debian/tmp-inst-ghcjs
-	. /usr/share/haskell-devscripts/Dh_Haskell.sh && \
-	install_doc_recipe "$(notdir $@)"
+install/libghcjs-$(CABAL_PACKAGE)-dev install/libghcjs-$(CABAL_PACKAGE)-prof install/libghcjs-$(CABAL_PACKAGE)-doc:: debian/tmp-inst-ghcjs
 
 install/libhugs-$(CABAL_PACKAGE):: $(DEB_SETUP_BIN_NAME) dist-hugs
 	$(DEB_SETUP_BIN_NAME) copy --destdir=debian/libhugs-$(CABAL_PACKAGE) --builddir=dist-hugs
 	rm -rf debian/libhugs-$(CABAL_PACKAGE)/usr/share/doc/*
 	dh_haskell_depends -p$(notdir $@)
 
-# Run dh_haskell_blurbs on all packags, useful e.g. for binary packages
-$(patsubst %,install/%,$(DEB_PACKAGES)) :: install/%:
-	dh_haskell_blurbs "$(DEB_DEFAULT_COMPILER)" -p$(cdbs_curpkg)
-
 
 # Support for installing executables
 define newline


=====================================
lib/Debian/Debhelper/Buildsystem/Haskell/Recipes.pm
=====================================
@@ -29,41 +29,16 @@ BEGIN {
 
     @EXPORT_OK = qw(
       run
-      cpu
-      os
-      ghcjs_version
-      ghcjs_ghc_version
-      package_prefix
       package_hc
       package_ext
       packages_hc
-      hc_libdir
-      package_libdir
-      hc_pkgdir
-      package_pkgdir
-      hc_prefix
-      hc_haddock
-      hc_docdir
-      hc_htmldir
-      hc_hoogle
-      strip_hash
-      sort_uniq
-      dependency
-      ghc_pkg_field
-      providing_package_for_ghc
-      providing_package_for_ghc_prof
       cabal_package_ids
       cabal_depends
       hashed_dependency
-      depends_for_ghc
-      depends_for_ghc_prof
-      usable_ghc_pkg
+      ghc_depends
       tmp_package_db
-      composite_provides
-      provides_for_ghc
-      provides_for_ghc_prof
-      package_id_to_virtual_package
-      depends_for_hugs
+      ghc_provides
+      hugs_depends
       find_config_for_ghc
       clean_recipe
       make_setup_recipe
@@ -71,9 +46,7 @@ BEGIN {
       build_recipe
       check_recipe
       haddock_recipe
-      install_dev_recipe
-      install_prof_recipe
-      install_doc_recipe
+      install_recipe
     );
 }
 
@@ -89,8 +62,6 @@ use Unicode::UTF8 qw(encode_utf8 decode_utf8);
 const my $EMPTY => q{};
 const my $SPACE => q{ };
 const my $PLUS => q{+};
-const my $HYPHEN => q{-};
-const my $COMMA => q{,};
 const my $SEMICOLON => q{;};
 const my $LESS_THAN => q{<};
 const my $DOUBLE_LESS_THAN => $LESS_THAN x 2;
@@ -161,74 +132,12 @@ sub run {
     my $output = run_quiet(@filtered);
 
     say {*STDERR} encode_utf8($output)
-      if !$ENV{DH_QUIET} || $ENV{DH_VERBOSE};
-
-    return $output;
-}
-
-=item cpu
-
-=cut
-
-sub cpu {
-    my () = @_;
-
-    my $output = run(qw{ghc -e}, 'putStr System.Info.arch');
+      if length $output
+      && (!$ENV{DH_QUIET} || $ENV{DH_VERBOSE});
 
     return $output;
 }
 
-=item os
-
-=cut
-
-sub os {
-    my () = @_;
-
-    my $output = run(qw{ghc -e}, 'putStr System.Info.os');
-
-    return $output;
-}
-
-=item ghcjs_version
-
-=cut
-
-sub ghcjs_version {
-    my () = @_;
-
-    my $output = run(qw{ghcjs --numeric-ghcjs-version});
-
-    return $output;
-}
-
-=item ghcjs_ghc_version
-
-=cut
-
-sub ghcjs_ghc_version {
-    my () = @_;
-
-    my $output = run(qw{ghcjs --numeric-ghc-version});
-
-    return $output;
-}
-
-=item package_prefix
-
-=cut
-
-sub package_prefix {
-    my ($installable) = @_;
-
-    my $prefix = $installable;
-
-    # strip hackage name
-    $prefix =~ s{ - .* $}{}x;
-
-    return $prefix;
-}
-
 =item package_hc
 
 =cut
@@ -244,10 +153,13 @@ sub package_hc {
     # strip hackage name
     $compiler =~ s{ - .* $}{}x;
 
-    # strip lib prefix
-    $compiler =~ s{^ lib }{}x;
+    # strip lib prefix, if any, and use result
+    if ($compiler =~ s{^ lib }{}x) {
+        return $compiler;
+    }
 
-    return $compiler;
+    # default if there is no lib prefix
+    return $ENV{DEB_DEFAULT_COMPILER};
 }
 
 =item package_ext
@@ -282,7 +194,10 @@ sub packages_hc {
     local $ENV{LC_ALL} = 'C.UTF-8';
 
     # should be in UTF-8
-    my @installables = split($SPACE, $ENV{DEB_PACKAGES} // $EMPTY);
+    my $package_list = run('dh_listpackages');
+    chomp $package_list;
+
+    my @installables = split($SPACE, $package_list);
 
     my @compilers = uniq map { package_hc($_) } @installables;
 
@@ -336,14 +251,12 @@ sub hc_pkgdir {
 
     if ($compiler eq 'ghcjs') {
 
-        my $quadruplet
-          = cpu()
-          . $HYPHEN
-          . os()
-          . $HYPHEN
-          . ghcjs_version()
-          . $HYPHEN
-          . ghcjs_ghc_version();
+        my $cpu = run(qw{ghc -e}, 'putStr System.Info.arch');
+        my $os = run(qw{ghc -e}, 'putStr System.Info.os');
+        my $ghcjs_version = run(qw{ghcjs --numeric-ghcjs-version});
+        my $ghcjs_ghc_version = run(qw{ghcjs --numeric-ghc-version});
+
+        my $quadruplet = "$cpu-$os-$ghcjs_version-$ghcjs_ghc_version";
 
         return "usr/lib/ghcjs/.ghcjs/$quadruplet/ghcjs/package.conf.d";
     }
@@ -417,44 +330,6 @@ sub hc_htmldir {
     return "usr/share/doc/lib$compiler-$hackage_name-doc/html/";
 }
 
-=item hc_hoogle
-
-=cut
-
-sub hc_hoogle {
-    my ($compiler) = @_;
-
-    return "/usr/lib/$compiler-doc/hoogle/";
-}
-
-=item strip_hash
-
-=cut
-
-sub strip_hash {
-    my ($with_hash) = @_;
-
-    my $without_hash = $with_hash;
-    $without_hash =~ s{ - [^-]{32} $}{}x;
-
-    return $without_hash;
-}
-
-=item sort_uniq
-
-=cut
-
-sub sort_uniq {
-    my (@items) = @_;
-
-    # fix sort order
-    local $ENV{LC_ALL} = 'C.UTF-8';
-
-    my @sorted = sort +uniq @items;
-
-    return @sorted;
-}
-
 =item dependency
 
 =cut
@@ -494,23 +369,18 @@ sub ghc_pkg_field {
 =cut
 
 sub providing_package_for_ghc {
-    my ($compiler, $package_id, $extension) = @_;
+    my ($compiler, $type, $package_id) = @_;
 
-    $extension //= $EMPTY;
+    my $extension = $EMPTY;
+    $extension = '_p'
+      if $type eq 'prof';
 
     my $ghc_version= run(qw{dpkg-query --showformat=${Version} --show ghc});
 
-    my $hackage_name;
-    if (
-        system(
-            qw{dpkg --compare-versions}, $ghc_version,
-            $DOUBLE_LESS_THAN, $MINIMUM_GHC_VERSION
-        ) == 0
-    ) {
-        $hackage_name = strip_hash($package_id);
-    } else {
-        $hackage_name = $package_id;
-    }
+    my $hackage_name = $package_id;
+    $hackage_name =~ s{ - [^-]{32} $}{}x
+      if system(qw{dpkg --compare-versions},
+        $ghc_version,$DOUBLE_LESS_THAN, $MINIMUM_GHC_VERSION) == 0;
 
     my $directory_line
       = ghc_pkg_field($compiler, $hackage_name, 'library-dirs');
@@ -539,17 +409,7 @@ sub providing_package_for_ghc {
     return ();
 }
 
-=item providing_package_for_ghc_prof
-
-=cut
-
-sub providing_package_for_ghc_prof {
-    my ($compiler, $package_id) = @_;
-
-    return providing_package_for_ghc($compiler, $package_id, '_p');
-}
-
-=item cabal_pkg_ids
+=item cabal_package_ids
 
 =cut
 
@@ -628,11 +488,11 @@ sub hashed_dependency {
     return ();
 }
 
-=item composite_constraints
+=item ghc_depends
 
 =cut
 
-sub composite_constraints {
+sub ghc_depends {
     my ($compiler, $type, @configs) = @_;
 
     my @package_ids = cabal_depends(@configs);
@@ -644,7 +504,8 @@ sub composite_constraints {
 
         if (!length $constraint) {
 
-            my $installable= providing_package_for_ghc($compiler, $package_id);
+            my $installable
+              = providing_package_for_ghc($compiler, $type, $package_id);
 
             $constraint = dependency($installable);
             if (!length $constraint) {
@@ -659,27 +520,7 @@ sub composite_constraints {
         push(@constraints, $constraint);
     }
 
-    return join($COMMA . $SPACE, @constraints);
-}
-
-=item depends_for_ghc_prof
-
-=cut
-
-sub depends_for_ghc {
-    my ($compiler, @configs) = @_;
-
-    return composite_constraints($compiler, 'dev', @configs);
-}
-
-=item depends_for_ghc_prof
-
-=cut
-
-sub depends_for_ghc_prof {
-    my ($compiler, @configs) = @_;
-
-    return composite_constraints($compiler, 'prof', @configs);
+    return @constraints;
 }
 
 =item usable_ghc_pkg
@@ -726,7 +567,8 @@ sub tmp_package_db {
     if (!-e 'debian/tmp-db/package.cache') {
 
         run(qw{mkdir debian/tmp-db});
-        run(qw{cp}, @configs, 'debian/tmp-db/');
+        run(qw{cp}, @configs, 'debian/tmp-db/')
+          if @configs;
 
         # Silence GHC 8.4's warning
         # "ignoring (possibly broken) abi-depends field for packages"
@@ -737,11 +579,11 @@ sub tmp_package_db {
     return (@ghc_pkg, qw{--package-db debian/tmp-db});
 }
 
-=item composite_provides
+=item ghc_provides
 
 =cut
 
-sub composite_provides {
+sub ghc_provides {
     my ($compiler, $type, @configs) = @_;
 
     my @ghc_pkg = tmp_package_db(@configs);
@@ -752,27 +594,7 @@ sub composite_provides {
         package_id_to_virtual_package($compiler, $type, $_, @ghc_pkg))
       for @package_ids;
 
-    return join($COMMA . $SPACE, @virtual);
-}
-
-=item provide_for_ghc
-
-=cut
-
-sub provides_for_ghc {
-    my ($compiler, @configs) = @_;
-
-    return composite_provides($compiler, 'dev', @configs);
-}
-
-=item provide_for_ghc_prof
-
-=cut
-
-sub provides_for_ghc_prof {
-    my ($compiler, @configs) = @_;
-
-    return composite_provides($compiler, 'prof', @configs);
+    return @virtual;
 }
 
 =item package_id_to_virtual_package
@@ -812,18 +634,18 @@ sub package_id_to_virtual_package {
     return $virtual;
 }
 
-=item depends_for_hugs
+=item hugs_depends
 
 =cut
 
-sub depends_for_hugs {
+sub hugs_depends {
     my () = @_;
 
     my $version= run(qw{dpkg-query --showformat=${Version} --show hugs});
     my $upstream_version = $version;
     $upstream_version =~ s{ - [^-]* $}{}x;
 
-    return "hugs (>= $upstream_version)";
+    return ("hugs (>= $upstream_version)");
 }
 
 =item find_config_for_ghc
@@ -841,8 +663,11 @@ sub find_config_for_ghc {
           unless $installable eq 'ghc';
     }
 
-    my @configs = grep { $_->is_file }
-      path("debian/$installable/$pkgdir")->children(qr{ [.]conf $}x);
+    my $confdir = "debian/$installable/$pkgdir";
+
+    my @configs;
+    @configs = grep { $_->is_file } path($confdir)->children(qr{ [.]conf $}x)
+      if -e $confdir;
 
     return @configs;
 }
@@ -872,7 +697,6 @@ sub clean_recipe {
     }
 
     run(qw{rm -f}, $ENV{MAKEFILE});
-    run(qw{rm -rf debian/dh_haskell_shlibdeps});
     run(qw{rm -rf debian/tmp-db});
 
     return;
@@ -954,7 +778,10 @@ sub configure_recipe {
 
     my $compiler = packages_hc();
 
-    my @installables = split($SPACE, $ENV{DEB_PACKAGES} // $EMPTY);
+    my $package_list = run('dh_listpackages');
+    chomp $package_list;
+
+    my @installables = split($SPACE, $package_list);
     my @extensions = map { package_ext($_) } @installables;
 
     my $profiling;
@@ -1073,162 +900,170 @@ sub haddock_recipe {
     return;
 }
 
-=item install_dev_recipe
+=item install_recipe
 
 =cut
 
-sub install_dev_recipe {
-    my ($installable) = @_;
+sub install_recipe {
+    my ($destination) = @_;
 
+    # fix sort order
     local $ENV{LC_ALL} = 'C.UTF-8';
 
-    my $compiler = package_hc($installable);
-    my $libdir = package_libdir($installable);
-    my $pkgdir = package_pkgdir($installable);
-
-    my $savedir = Cwd::getcwd;
-    chdir("debian/tmp-inst-$compiler")
-      or warn encode_utf8("Cannot change folder to debian/tmp-inst-$compiler");
-
-    run(qw{mkdir --parents}, $libdir);
-    run(
-        'find', $libdir,
-        qw{ ( ! -name *_p.a ! -name *.p_hi ! -type d ) },
-        qw{-exec install -Dm 644},
-        '{}', "../$installable/{}", $SEMICOLON
-    );
+    my $compiler = packages_hc();
 
-    chdir($savedir)
-      or warn encode_utf8("Cannot change folder to $savedir");
+    run($ENV{DEB_SETUP_BIN_NAME},
+        'copy', "--builddir=dist-$compiler", "--destdir=$destination");
 
-    my $output = run($ENV{DEB_SETUP_BIN_NAME},
-        'register', "--builddir=dist-$compiler",
-        qw{--gen-pkg-config --verbose=verbose+nowrap});
+    my $package_list = run('dh_listpackages');
+    chomp $package_list;
 
-    die encode_utf8('Cannot get name of package registration file.')
-      unless $output
-      =~ m{^Creating \s package \s registration \s file: \s+ (\S+) $}mx;
+    my @installables = split($SPACE, $package_list);
+    for my $installable (@installables) {
 
-    my $pkg_config = $1;
+        my $extension = package_ext($installable);
 
-    run(qw{sed -i}, 's/^exposed: True$/exposed: False/', $pkg_config)
-      if length $ENV{HASKELL_HIDE_PACKAGES};
+        if ($extension eq 'dev') {
 
-    run(qw{install -Dm 644},
-        $pkg_config, "debian/$installable/$pkgdir/$pkg_config");
-    run(qw{rm -f}, $pkg_config);
+            my $savedir = Cwd::getcwd;
+            chdir($destination)
+              or warn encode_utf8("Cannot change folder to $destination");
 
-    if (length $ENV{DEB_GHC_EXTRA_PACKAGES}) {
+            my $libdir = package_libdir($installable);
 
-        my $EP_DIR
-          = "debian/$installable/usr/lib/haskell-packages/extra-packages";
-        run(qw{mkdir --parents}, $EP_DIR);
+            run(qw{mkdir --parents}, $libdir);
+            run(
+                'find',
+                $libdir,
+                qw{ ( ! -name *_p.a ! -name *.p_hi ! -type d ) },
+                qw{-exec install -Dm 644},
+                '{}',
+                "../$installable/{}",
+                $SEMICOLON
+            );
 
-        path("$EP_DIR/$ENV{CABAL_PACKAGE}-$ENV{CABAL_VERSION}")
-          ->spew_utf8($ENV{DEB_GHC_EXTRA_PACKAGES});
-    }
+            chdir($savedir)
+              or warn encode_utf8("Cannot change folder to $savedir");
 
-    path($ENV{DEB_LINTIAN_OVERRIDES_FILE})
-      ->append_utf8('custom-library-search-path' . $NEWLINE)
-      unless -e $ENV{DEB_LINTIAN_OVERRIDES_FILE}
-      && path($ENV{DEB_LINTIAN_OVERRIDES_FILE})->slurp_utf8
-      =~ m{^ custom-library-search-path }x;
+            my $output = run($ENV{DEB_SETUP_BIN_NAME},
+                'register', "--builddir=dist-$compiler",
+                qw{--gen-pkg-config --verbose=verbose+nowrap});
 
-    run('dh_haskell_provides', "--package=$installable");
-    run('dh_haskell_depends', "--package=$installable");
-    run('dh_haskell_shlibdeps', "--package=$installable");
+            if ($output
+                =~ m{^Creating \s package \s registration \s file: \s+ (\S+) $}mx
+            ) {
 
-    return;
-}
+                my $pkg_config = $1;
 
-=item install_prof_recipe
+                run(qw{sed -i}, 's/^exposed: True$/exposed: False/',
+                    $pkg_config)
+                  if length $ENV{HASKELL_HIDE_PACKAGES};
 
-=cut
+                my $pkgdir = package_pkgdir($installable);
+                run(qw{install -Dm 644},
+                    $pkg_config, "debian/$installable/$pkgdir/$pkg_config");
+                run(qw{rm -f}, $pkg_config);
 
-sub install_prof_recipe {
-    my ($installable) = @_;
+                if (length $ENV{DEB_GHC_EXTRA_PACKAGES}) {
 
-    my $compiler = package_hc($installable);
-    my $libdir = package_libdir($installable);
+                    my $EP_DIR
+                      = "debian/$installable/usr/lib/haskell-packages/extra-packages";
+                    run(qw{mkdir --parents}, $EP_DIR);
 
-    my $savedir = Cwd::getcwd;
-    chdir("debian/tmp-inst-$compiler")
-      or warn encode_utf8("Cannot change folder to debian/tmp-inst-$compiler");
+                    path("$EP_DIR/$ENV{CABAL_PACKAGE}-$ENV{CABAL_VERSION}")
+                      ->spew_utf8($ENV{DEB_GHC_EXTRA_PACKAGES});
 
-    run(qw{mkdir --parents}, $libdir);
-    run(
-        'find', $libdir,
-        qw{ ( -name *_p.a -o -name *.p_hi ) },
-        qw{-exec install -Dm 644},
-        '{}', "../$installable/{}", $SEMICOLON
-    );
-
-    chdir($savedir)
-      or warn encode_utf8("Cannot change folder to $savedir");
+                } else {
+                    warn encode_utf8(
+'Skipping extra depends; cannot get package registration file (probably not a library).'
+                    );
+                }
+            }
+        }
 
-    run('dh_haskell_provides', "--package=$installable");
-    run('dh_haskell_depends', "--package=$installable");
+        if ($extension eq 'prof') {
 
-    return;
-}
+            my $savedir = Cwd::getcwd;
+            chdir($destination)
+              or warn encode_utf8("Cannot change folder to $destination");
 
-=item install_doc_recipe
+            my $libdir = package_libdir($installable);
 
-=cut
+            run(qw{mkdir --parents}, $libdir);
+            run(
+                'find', $libdir,
+                qw{ ( -name *_p.a -o -name *.p_hi ) },
+                qw{-exec install -Dm 644},
+                '{}', "../$installable/{}", $SEMICOLON
+            );
 
-sub install_doc_recipe {
-    my ($installable) = @_;
+            chdir($savedir)
+              or warn encode_utf8("Cannot change folder to $savedir");
+        }
 
-    my $compiler = package_hc($installable);
+        if ($extension eq 'doc') {
 
-    my $htmldir = hc_htmldir($compiler, $ENV{CABAL_PACKAGE});
-    run(qw{mkdir --parents}, "debian/$installable/$htmldir");
+            my $savedir = Cwd::getcwd;
+            chdir($destination)
+              or warn encode_utf8("Cannot change folder to $destination");
 
-    my $savedir = Cwd::getcwd;
-    chdir("debian/tmp-inst-$compiler")
-      or warn encode_utf8("Cannot change folder to debian/tmp-inst-$compiler");
+            my $htmldir = hc_htmldir($compiler, $ENV{CABAL_PACKAGE});
 
-    run(
-        'find', "./$htmldir",
-        qw{ ! -name *.haddock ! -type d},
-        qw{-exec install -Dm 644},
-        '{}', "../$installable/{}", $SEMICOLON
-    );
+            run(qw{mkdir --parents}, "debian/$installable/$htmldir");
+            run(
+                'find', "./$htmldir",
+                qw{ ! -name *.haddock ! -type d},
+                qw{-exec install -Dm 644},
+                '{}', "../$installable/{}", $SEMICOLON
+            );
 
-    chdir($savedir)
-      or warn encode_utf8("Cannot change folder to $savedir");
+            chdir($savedir)
+              or warn encode_utf8("Cannot change folder to $savedir");
 
-    my $docdir
-      = hc_docdir($compiler, "$ENV{CABAL_PACKAGE}-$ENV{CABAL_VERSION}");
+            my $docdir
+              = hc_docdir($compiler,"$ENV{CABAL_PACKAGE}-$ENV{CABAL_VERSION}");
 
-    my $tmp_inst_docdir = "debian/tmp-inst-$compiler/$docdir";
-    my $installable_docdir = "debian/$installable/$docdir";
+            my $tmp_inst_docdir = "$destination/$docdir";
+            my $installable_docdir = "debian/$installable/$docdir";
 
-    run(qw{mkdir --parents}, $installable_docdir);
+            run(qw{mkdir --parents}, $installable_docdir);
 
-    run(qw{cp --recursive}, $_->stringify, $installable_docdir)
-      for path($tmp_inst_docdir)->children(qr{ [.]haddock $}x);
+            run(qw{cp --recursive}, $_->stringify, $installable_docdir)
+              for path($tmp_inst_docdir)->children(qr{ [.]haddock $}x);
 
-    if ($ENV{DEB_ENABLE_HOOGLE} eq 'yes') {
+            if ($ENV{DEB_ENABLE_HOOGLE} eq 'yes') {
 
-        # We cannot just invoke dh_link here because that acts on
-        # either libghc-*-dev or all the binary packages, neither of
-        # which is desirable (see dh_link (1)).  So we just create a
-        # (policy-compliant) symlink ourselves
+                # We cannot just invoke dh_link here because that acts on
+                # either libghc-*-dev or all the binary packages, neither of
+                # which is desirable (see dh_link (1)).  So we just create a
+                # (policy-compliant) symlink ourselves
 
-        my $target = "debian/$installable/$htmldir/$ENV{CABAL_PACKAGE}.txt";
-        if (-e $target) {
+                my $target
+                  = "debian/$installable/$htmldir/$ENV{CABAL_PACKAGE}.txt";
+                if (-e $target) {
 
-            my $hoogle = hc_hoogle($compiler);
-            my $name = "debian/$installable$hoogle$installable.txt";
+                    my $hoogle = "/usr/lib/$compiler-doc/hoogle/";
+                    my $name = "debian/$installable$hoogle$installable.txt";
 
-            run(qw{mkdir --parents}, dirname($name));
-            run(qw{ln --symbolic --relative --no-target-directory},
-                $target, $name);
+                    run(qw{mkdir --parents}, dirname($name));
+                    run(qw{ln --symbolic --relative --no-target-directory},
+                        $target, $name);
+                }
+            }
         }
     }
 
-    run('dh_haskell_depends', "--package=$installable");
+    path($ENV{DEB_LINTIAN_OVERRIDES_FILE})
+      ->append_utf8('custom-library-search-path' . $NEWLINE)
+      unless -e $ENV{DEB_LINTIAN_OVERRIDES_FILE}
+      && path($ENV{DEB_LINTIAN_OVERRIDES_FILE})->slurp_utf8
+      =~ m{^ custom-library-search-path }x;
+
+    run('dh_haskell_provides');
+    run('dh_haskell_depends');
+    run('dh_haskell_shlibdeps');
+
+    run('dh_haskell_blurbs', $compiler);
 
     return;
 }



View it on GitLab: https://salsa.debian.org/haskell-team/haskell-devscripts/-/compare/7fdd3ba8612ffce27cfa7978d40bff8f699d21d5...97b51e7da3c9734f027147b02253d945dc9678e4

-- 
View it on GitLab: https://salsa.debian.org/haskell-team/haskell-devscripts/-/compare/7fdd3ba8612ffce27cfa7978d40bff8f699d21d5...97b51e7da3c9734f027147b02253d945dc9678e4
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/20220411/6038abcb/attachment-0001.htm>


More information about the Pkg-haskell-commits mailing list