[Git][haskell-team/haskell-devscripts][master] 3 commits: Use a consistent locale for sorting (C.UTF-8).

Felix Lechner (@lechner) gitlab at salsa.debian.org
Fri Apr 8 19:41:45 BST 2022



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


Commits:
c193784f by Felix Lechner at 2022-04-08T09:47:54-07:00
Use a consistent locale for sorting (C.UTF-8).

- - - - -
f48e97e1 by Felix Lechner at 2022-04-08T10:06:37-07:00
Use more wildcards in *.install specification for Debhelper.

- - - - -
9389c725 by Felix Lechner at 2022-04-08T10:55:01-07:00
Rewrite dh_* helpers in Perl; relicense under GPL-3+.

- - - - -


15 changed files:

- Dh_Haskell.sh
- debian/copyright
- debian/haskell-devscripts-minimal.install
- debian/rules
- dh_haskell_blurbs
- − dh_haskell_blurbs.pod
- dh_haskell_depends
- − dh_haskell_depends.pod
- dh_haskell_extra_depends
- − dh_haskell_extra_depends.pod
- dh_haskell_provides
- − dh_haskell_provides.pod
- dh_haskell_shlibdeps
- − dh_haskell_shlibdeps.pod
- lib/Debian/Debhelper/Buildsystem/Haskell/Recipes.pm


Changes:

=====================================
Dh_Haskell.sh
=====================================
@@ -1,3 +1,18 @@
+# Copyright © 2022 Felix Lechner <felix.lechner at lease-up.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
 recipe(){
     local -x RECIPE="$1"
     shift


=====================================
debian/copyright
=====================================
@@ -13,9 +13,12 @@ Copyright: Copyright 2008 Kari Pahula <kaol at debian.org>
            Held by the contributors mentioned in debian/changelog
 License: GPL-2+
 
-Files: dh_haskell_shlibdeps
-Copyright:  Copyright (C) 2009 Marco Silva <marcot at debian.org>
-License: CC0
+Files:
+  dh_*
+  lib/*
+  Dh_Haskell.sh
+Copyright:  2022 Felix Lechner <felix.lechner at lease-up.com>
+License: GPL-3+
 
 License: GPL-2
  This program is free software; you can redistribute it and/or modify
@@ -54,89 +57,16 @@ License: GPL-2+
  can be found in `/usr/share/common-licenses/GPL-2` and
  `/usr/share/common-licenses/GPL-3`.
 
-License: CC0
- CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL
- SERVICES. DISTRIBUTION OF THIS CC0 WAIVER DOES NOT CREATE AN
- ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON
- AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE
- INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
- ITS USE.
- .
- Statement of Purpose
- .
- The laws of various jurisdictions throughout the world automatically confer
- certain exclusive rights upon the creator of an original work of authorship
- and/or a database (each, a “Work”), and the subsequent owners thereof.
- .
- Some owners of these exclusive rights wish to permanently remove these
- restrictions from a Work for the purpose of contributing to a commons that
- the public can reliably build upon, modify, reuse and redistribute as
- freely as possible from such restrictions for any purposes and in any form
- whatsoever, whether modified or unmodified, in whole or in part. Such
- owners therefore wish to fully, permanently, irrevocably and
- unconditionally waive, abandon and relinquish their Copyright Related
- Rights (defined below) with respect to a Work to the fullest extent
- permitted by applicable law.
- .
- A Work associated with this CC0 Waiver may be protected by copyright and
- related or neighboring rights, database rights (such as those arising under
- Directive 96/9/EC of the European Parliament and of the Council of 11 March
- 1996 on the legal protection of databases, and under any national
- implementation thereof, (including any amended or successor version of such
- directive)), and/or other similar equivalent or corresponding rights
- throughout the world as such rights may be available under applicable law
- or treaty (and national implementations thereof), including but not limited
- to moral rights retained by the original author(s), publicity and privacy
- rights pertaining to an individual’s image or likeness depicted in a Work,
- rights protecting against unfair competition in regards to the Work, and
- any rights protecting the extraction, dissemination and reuse of data in
- the Work (such rights all, collectively, the “Copyright Related Rights”).
- .
- The person associating this CC0 Waiver with a Work is the owner of
- Copyright Related Rights in the Work (the “Affirmer”), and does openly,
- overtly and voluntarily elect to apply this CC0 Waiver to his or her Work
- with knowledge of his or her Copyright Related Rights in the Work and the
- meaning and intended legal effect of this CC0 Waiver.
- .
- Subject to rights of other persons in the Work, and any patent and
- trademark rights held by Affirmer, by associating this CC0 Waiver with a
- Work the Affirmer does intend to fully, permanently, irrevocably and
- unconditionally waive, abandon and relinquish all of his or her Copyright
- Related Rights in such Work, to the fullest extent permitted by (but not in
- contravention of) applicable law.
- .
- CC0 Waiver
- .
- 1.  To the fullest extent permitted by (but not in contravention of)
- applicable law, Affirmer hereby fully, permanently, irrevocably and
- unconditionally waives, abandons and relinquishes all of Affirmer’s
- Copyright Related Rights and associated claims and causes of action,
- whether present or future, vested or contingent, in the Work, (such waiver,
- abandonment, and relinquishment, the "Waiver"). Affirmer makes the Waiver
- for the benefit of each member of the public at large and to the detriment
- of Affirmer's heirs or successors.
- .
- 2. Should the Waiver for any reason be judged legally invalid or
- ineffective under applicable law, then the Waiver shall be preserved to the
- maximum extent permitted and Affirmer hereby grants to each such affected
- recipient of the Work a worldwide, royalty-free, non exclusive, perpetual
- (for the duration of the applicable copyright), non transferable, non
- sublicensable, irrevocable and unconditional license to exercise Affirmer’s
- Copyright Related Rights in the Work, which license shall be deemed
- effective as of the date this CC0 Waiver was applied by Affirmer to the
- Work.
- .
- 3. No trademark or patent rights held by Affirmer are waived, abandoned,
- relinquished, licensed or otherwise affected by this CC0 Waiver.
+License: GPL-3+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
  .
- 4. Affirmer hereby fully and completely disclaims responsibility for
- clearing rights of other persons that may apply to the Work or any intended
- use thereof, including without limitation any such person’s Copyright
- Related Rights (including privacy and publicity rights). Further, Affirmer
- hereby fully and completely disclaims responsibility for obtaining any
- necessary consents, permissions or other rights required for such intended
- use.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
  .
- 5. Affirmer understands and acknowledges that Creative Commons is not party
- to this CC0 Waiver and has no duty or obligation with respect to this CC0
- Waiver or use of the Work.
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.


=====================================
debian/haskell-devscripts-minimal.install
=====================================
@@ -1,11 +1,5 @@
-dh_haskell_provides       usr/bin/
-dh_haskell_depends        usr/bin/
-dh_haskell_shlibdeps      usr/bin/
-dh_haskell_extra_depends  usr/bin/
-dh_haskell_blurbs         usr/bin/
+dh_*                      usr/bin/
 Dh_Haskell.sh             usr/share/haskell-devscripts/
 hlibrary.mk               usr/share/cdbs/1/class
 lib/*                     usr/share/perl5/
-Setup-Make.hs             usr/share/haskell-devscripts/
-Setup-Simple.hs           usr/share/haskell-devscripts/
-Setup-Configure.hs        usr/share/haskell-devscripts/
+Setup-*.hs                usr/share/haskell-devscripts/


=====================================
debian/rules
=====================================
@@ -13,7 +13,7 @@ pod2man := pod2man --center 'Haskell devscripts documentation' --release 'Haskel
 execute_after_dh_auto_build:
 	set -e ; for MANUAL_PAGE in $(manual_pages) ; do \
 		BASENAME=$$(basename "$$MANUAL_PAGE" .1) ; \
-		$(pod2man) "$$BASENAME".pod > "$$MANUAL_PAGE" ; \
+		$(pod2man) "$$BASENAME" > "$$MANUAL_PAGE" ; \
 	done
 
 .PHONY: after_dh_auto_clean


=====================================
dh_haskell_blurbs
=====================================
@@ -1,113 +1,212 @@
-#! /bin/bash
+#!/usr/bin/perl
+
+# Copyright © 2022 Felix Lechner <felix.lechner at lease-up.com>
+#
+# based on a shell script by the same name
+#     Joachim Breitner <nomeata at debian.org>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
 #
-# Create substvars for the Haskell package description blurbs
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
 #
-# Copyright (C) 2013 Joachim Breitner <nomeata at debian.org>
-
-set -e 
-
-. /usr/share/haskell-devscripts/Dh_Haskell.sh
-
-DEB_DEFAULT_COMPILER=$1
-shift
-
-args=
-ignores=
-files=
-until [ -z "$1" ]
-do
-  case "$1" in
-      -X*)
-          pkg=${1##-X}
-          ignores="$ignores $pkg"
-          ;;
-
-      --exclude=*)
-          pkg=${1##--exclude=}
-          ignores="$ignores $pkg"
-          ;;
-
-      -*)
-          args="$args $1"
-          ;;
-      *)
-          if [ -f $1 ] ; then
-              files="$files $1"
-          else
-              echo "Installed package description file $1 can not be found" >&2
-              exit 1
-          fi
-          ;;
-  esac
-  shift
-done
-
-export DH_EXCLUDES="$ignores"
-
-if ! command -v grep-dctrl > /dev/null; then
-    echo "grep-dctrl is missing" >&2
-    exit 1
-fi
-
-# PS4=" + dh_haskell_blurbs> "
-# set -x
-
-packages=`dh_listpackages`
-hc=`packages_hc ${DEB_DEFAULT_COMPILER} ${packages}`
-
-for pkg in `dh_listpackages $args`; do
-    sfile=debian/$pkg.substvars
-    touch $sfile
-
-    grep -v -a \
-	-e ^haskell:Blurb \
-	-e ^haskell:ShortBlurb \
-	-e ^haskell:LongDescription \
-	-e ^haskell:ShortDescription \
-	$sfile > $sfile.tmp || true
-
-    ext=`package_ext ${pkg}`
-    case "$ext" in
-	dev) cat >> $sfile.tmp <<'__END__' ;;
-haskell:ShortBlurb=
-haskell:Blurb=This package provides a library for the Haskell programming language.${Newline}See http://www.haskell.org/ for more information on Haskell.
-__END__
-
-	prof) cat >> $sfile.tmp <<'__END__' ;;
-haskell:ShortBlurb=; profiling libraries
-haskell:Blurb=This package provides a library for the Haskell programming language, compiled${Newline}for profiling.  See http://www.haskell.org/ for more information on Haskell.
-__END__
-
-	doc) cat >> $sfile.tmp <<'__END__' ;;
-haskell:ShortBlurb=; documentation
-haskell:Blurb=This package provides the documentation for a library for the Haskell${Newline}programming language.${Newline}See http://www.haskell.org/ for more information on Haskell.
-__END__
-
-    esac
-
-    shortDescription="$(
-	cat debian/control |
-	grep-dctrl -F Source '' -s X-Description -n|
-	head -n1
-	)"
-
-    longDescription="$(
-	cat debian/control |
-	grep-dctrl -F Source '' -s X-Description -n|
-	sed 's/^[\t ]//;s/^\.$//'|	 # remove initial space
-	tail -n +2|			 # skip short description
-	perl -pe 's/\n$/\$\{Newline}/'|   # prepare for dpkg-gencontrol
-	perl -pe 's/\$\{Newline}$//'      # but not final lineline
-	)"
-
-    cat >> $sfile.tmp <<__END__
-haskell:ShortDescription=$shortDescription
-haskell:LongDescription=$longDescription
-__END__
-
-    version=$(dpkg-query --showformat='${version}' --show ${hc} | egrep -o ".*-" \
-	| egrep -o "[^-]*")
-    echo "haskell:${hc}-version=${hc} (>= ${version}), ${hc} (<< ${version}+)" >> $sfile.tmp
-
-    mv $sfile.tmp $sfile
-done
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use v5.20;
+use warnings;
+use utf8;
+
+use Const::Fast;
+use File::Basename;
+use Getopt::Long ();
+use Path::Tiny;
+use Unicode::UTF8 qw(encode_utf8);
+
+use Debian::Debhelper::Buildsystem::Haskell::Recipes qw(
+  run
+  package_ext
+  packages_hc
+);
+
+const my $EMPTY => q{};
+const my $SPACE => q{ };
+const my $NEWLINE => qq{\n};
+
+my $program_name = basename($0);
+
+my @excludes;
+
+my %options = (
+    'exclude|X=s' => \@excludes,
+    'help|h' => \&show_help,
+);
+
+Getopt::Long::Configure('gnu_getopt', 'pass_through');
+Getopt::Long::GetOptions(%options)
+  or die encode_utf8("error parsing options\n");
+
+my @args_bytes = grep { /^-/ } @ARGV;
+my ($default_compiler, @configs) = grep { !/^-/ } @ARGV;
+
+die encode_utf8("Installed package description file $_ can not be found")
+  for grep { !-e } @configs;
+
+$ENV{DH_EXCLUDES} = join($SPACE, @excludes);
+
+die encode_utf8('grep-dctrl is missing')
+  unless system('command -v grep-dctrl > /dev/null') == 0;
+
+$ENV{DEB_DEFAULT_COMPILER} = $default_compiler;
+my $compiler = packages_hc();
+
+my $output = run('dh_listpackages', @args_bytes);
+chomp $output;
+
+my @installables = split($SPACE, $output);
+
+for my $installable (@installables) {
+
+    my $substvars_path = "debian/$installable.substvars";
+
+    my $short_blurb;
+    my $blurb;
+
+    my $extension = package_ext($installable);
+    if ($extension eq 'dev') {
+
+        $short_blurb = $EMPTY;
+        $blurb
+          = 'This package provides a library for the Haskell programming language.${Newline}See http://www.haskell.org/ for more information on Haskell.';
+
+    }
+
+    if ($extension eq 'prof') {
+
+        $short_blurb = '; profiling libraries';
+        $blurb
+          = 'This package provides a library for the Haskell programming language, compiled${Newline}for profiling.  See http://www.haskell.org/ for more information on Haskell.';
+
+    }
+
+    if ($extension eq 'doc') {
+
+        $short_blurb = '; documentation';
+        $blurb
+          = 'This package provides the documentation for a library for the Haskell${Newline}programming language.${Newline}See http://www.haskell.org/ for more information on Haskell.';
+
+    }
+
+    replace_line($substvars_path, 'haskell:ShortBlurb',$short_blurb // $EMPTY);
+    replace_line($substvars_path, 'haskell:Blurb', $blurb // $EMPTY);
+
+    # need regex to avoid the empty string, which would be filtered by run()
+    my $description
+      = run(
+        qw{grep-dctrl --no-field-names --show-field=X-Description --field=Source --regex .* debian/control}
+      );
+    my ($short_description, $long_description) = split(m{\n}, $description, 2);
+
+    chomp $long_description;
+
+    # drop initial spaces
+    $long_description =~ s{^ [ ] }{}gmx;
+
+    # prepare for dpkg-gencontrol
+    $long_description =~ s{ \n }{\$\{Newline\}}gx;
+
+    replace_line($substvars_path, 'haskell:ShortDescription',
+        $short_description);
+    replace_line($substvars_path, 'haskell:LongDescription',$long_description);
+
+    my $version= run(qw{dpkg-query --showformat=${Version} --show}, $compiler);
+    chomp $version;
+
+    # drop Debian revision
+    $version =~ s{ - [^-]+ $}{}x;
+
+    replace_line($substvars_path, "haskell:$compiler-version",
+        "$compiler (>= $version), $compiler (<< $version+)");
+}
+
+exit;
+
+sub replace_line {
+    my ($path, $field, $value) = @_;
+
+    path($path)->touch;
+
+    my @lines = grep { !m{^ $field = }x } path($path)->lines_utf8;
+
+    push(@lines, "$field=$value" . $NEWLINE);
+
+    path($path)->spew_utf8(@lines);
+
+    return;
+}
+
+sub show_help {
+    my $message =<<"EOT";
+Usage: $program_name [options] cabal-file ...
+
+Options:
+    -X, --exclude INSTALLABLE    exclude INSTALLABLE from processing
+EOT
+
+    print encode_utf8($message);
+
+    exit;
+}
+
+=head1 NAME
+
+dh_haskell_blurb - standard haskell package description blurbs
+
+=head1 SYNOPSIS
+
+B<dh_haskell_blurbs> [S<I<debhelper options>>]
+[B<-X>I<package>]
+[B<--exclude=>I<package>]
+[S<I<file>> ...]
+
+=head1 DESCRIPTION
+
+dh_haskell_blurbs is a debhelper program provides substvars for the standard blurbs occurring in Haskell package descriptions.
+
+To use it, move the common parts of the description to the source stanza:
+
+ X-Description: Cool library
+  This is a pure Haskell implementation of coolness. It is cooler
+  than implementation via foreign languages, because we can.
+
+And then use the following for every Haskell library package stanza, C<dev>, C<prof> and C<doc>:
+
+ Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
+  ${haskell:LongDescription}
+  .
+  ${haskell:Blurb}
+
+
+=head1 SEE ALSO
+
+L<dh_haskell_depends(1)>
+L<dh_haskell_shlibdeps(1)>
+L<dh_haskell_provides(1)>
+L<debhelper(7)>
+
+=head1 AUTHOR
+
+Joachim Breitner <nomeata at debian.org>
+
+=cut
+
+# Local Variables:
+# indent-tabs-mode: nil
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl sw=4 sts=4 sr et


=====================================
dh_haskell_blurbs.pod deleted
=====================================
@@ -1,39 +0,0 @@
-=head1 NAME
-
-dh_haskell_blurb - standard haskell package description blurbs
-
-=head1 SYNOPSIS
-
-B<dh_haskell_blurbs> [S<I<debhelper options>>]
-[B<-X>I<package>]
-[B<--exclude=>I<package>]
-[S<I<file>> ...]
-
-=head1 DESCRIPTION
-
-dh_haskell_blurbs is a debhelper program provides substvars for the standard blurbs occurring in Haskell package descriptions.
-
-To use it, move the common parts of the description to the source stanza:
-
- X-Description: Cool library
-  This is a pure Haskell implementation of coolness. It is cooler
-  than implementation via foreign languages, because we can.
-
-And then use the following for every Haskell library package stanza, C<dev>, C<prof> and C<doc>:
-
- Description: ${haskell:ShortDescription}${haskell:ShortBlurb}
-  ${haskell:LongDescription}
-  .
-  ${haskell:Blurb}
-
-
-=head1 SEE ALSO
-
-L<dh_haskell_depends(1)>
-L<dh_haskell_shlibdeps(1)>
-L<dh_haskell_provides(1)>
-L<debhelper(7)>
-
-=head1 AUTHOR
-
-Joachim Breitner <nomeata at debian.org>


=====================================
dh_haskell_depends
=====================================
@@ -1,198 +1,306 @@
-#! /bin/bash
-#
-# Determine package dependencies from installed-pkg-config file
-#
-# Copyright (C) 2006-2007 Arjan Oosting <arjan at debian.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# 1) The terms of the GNU General Public License as published by
-#    the Free Software Foundation; either version 2 of the License, or
-#    (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License along
-#    with this program; if not, write to the Free Software Foundation, Inc.,
-#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# 2) BSD 3-clause license.
-# 
-#    All rights reserved.
-#
-#    Redistribution and use in source and binary forms, with or without
-#    modification, are permitted provided that the following conditions are
-#    met:
+#!/usr/bin/perl
+
+# Copyright © 2022 Felix Lechner <felix.lechner at lease-up.com>
 #
-#      * Redistributions of source code must retain the above copyright
-#        notice, this list of conditions and the following disclaimer.
+# based on a shell script by the same name
+#     Arjan Oosting <arjan at debian.org>
 #
-#      * Redistributions in binary form must reproduce the above
-#        copyright notice, this list of conditions and the following
-#        disclaimer in the documentation and/or other materials provided
-#        with the distribution.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
 #
-#      * The names of contributors may not be used to endorse or promote
-#        products derived from this software without specific prior
-#        written permission. 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
 #
-#    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-#    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-#    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-#    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-#    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-#    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-#    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-#    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE..
-
-set -e
-
-. /usr/share/haskell-devscripts/Dh_Haskell.sh
-
-args=
-ignores=
-files=
-until [ -z "$1" ]
-do
-  case "$1" in
-      -X*)
-          pkg=${1##-X}
-          ignores="$ignores $pkg"
-          ;;
-
-      --exclude=*)
-          pkg=${1##--exclude=}
-          ignores="$ignores $pkg"
-          ;;
-
-      -*)
-          args="$args $1"
-          ;;
-      *)
-          if [ -f $1 ] ; then
-              files="$files $1"
-          else
-              echo "Installed package description file $1 can not be found" >&2
-              exit 1
-          fi
-          ;;
-  esac
-  shift
-done
-
-export DH_EXCLUDES="$ignores"
-
-# PS4=" + dh_haskell_depends> "
-# set -x
-
-for pkg in `dh_listpackages $args`; do
-    sfile=debian/$pkg.substvars
-    touch $sfile
-
-    hc=`package_hc ${pkg}`
-    ext=`package_ext ${pkg}`
-
-    case "$hc,$ext" in
-        ghc,dev|ghc,prof|ghcjs,dev|ghcjs,prof)
-            if [ -z "$files" ] ; then
-                cfiles=`find_config_for_ghc $pkg`
-            else
-                cfiles="$files"
-            fi
-            if [ -z "$cfiles" ] ; then
-              echo "dh_haskell_depends - no installed package description files found" >&2
-              exit 1
-            fi
-            case "$ext" in
-                dev)
-                    grep -v -a \
-                        -e ^haskell:Extra-Depends \
-                        -e ^haskell:Depends \
-                        -e ^haskell:Recommends \
-                        -e ^haskell:Suggests \
-                        $sfile > $sfile.tmp || true
-                    depends="`depends_for_ghc ${hc} $cfiles`"
-                    echo "haskell:Depends=$depends" >> $sfile.tmp
-                    echo "haskell:Recommends=" >> $sfile.tmp
-                    doc=`echo $pkg | sed -e 's/-dev$/-doc/'`
-                    prof=`echo $pkg | sed -e 's/-dev$/-prof/'`
-                    grep -av '^#' debian/control | grep $doc > /dev/null \
-                        && suggests="$doc" \
-                        || suggests=""
-                    if grep -av '^#' debian/control | grep $prof > /dev/null
-                    then
-                        [ "$suggests" = "" ] \
-                            && suggests="$prof" \
-                            || suggests="$suggests, $prof"
-                    fi
-                    echo "haskell:Suggests=$suggests" >> $sfile.tmp
-                    ;;
-                prof)
-                    grep -a -v \
-                        -e ^haskell:Extra-Depends \
-                        -e ^haskell:Depends \
-                        -e ^haskell:Recommends \
-                        -e ^haskell:Suggests \
-                        $sfile > $sfile.tmp || true
-                    dev=`echo $pkg | sed -e 's/-prof$/-dev/'`
-                    version='(=${binary:Version})'
-                    depends="$dev ${version}, `depends_for_ghc_prof ${hc} $cfiles`"
-                    echo "haskell:Depends=$depends" >> $sfile.tmp
-                    echo "haskell:Recommends=" >> $sfile.tmp
-                    echo "haskell:Suggests=" >> $sfile.tmp
-                    ;;
-            esac
-            ;;
-        hugs,*)
-            grep -a -v \
-                -e ^haskell:Extra-Depends \
-                -e ^haskell:Depends \
-                -e ^haskell:Recommends \
-                -e ^haskell:Suggests \
-                $sfile > $sfile.tmp || true
-            echo "haskell:Depends=`depends_for_hugs`" >> $sfile.tmp
-            echo "haskell:Recommends=" >> $sfile.tmp
-            echo "haskell:Suggests=" >> $sfile.tmp
-            ;;
-        ghc,doc|ghcjs,doc)
-            grep -a -v \
-                -e ^haskell:Extra-Depends \
-                -e ^haskell:Depends \
-                -e ^haskell:Recommends \
-                -e ^haskell:Suggests \
-                $sfile > $sfile.tmp || true
-            depends=haddock-interface-`haddock --interface-version`
-            echo "haskell:Depends=$depends" >> $sfile.tmp
-            recommends=` \
-                find debian/$pkg -name \*.html -exec hxwls -r \{\} \; \
-                | sed -e 's,^file:/,,' \
-                | grep ^/ \
-                | cut -d# -f1 \
-                | LANG=C sort -u \
-                | xargs -r dpkg -S \
-                | cut -d: -f1 \
-                | sort -u \
-                | sed -e :a -e '$!N; s/\n/, /; ta'`
-            dev=`echo $pkg | sed -e 's/^[^-]\+-\(.\+\)-doc/lib${hc}-\1-dev/'`
-            grep -av '^#' debian/control | grep $dev > /dev/null \
-                && recommends="$recommends, $dev" \
-                || recommends="$recommends"
-            echo "haskell:Recommends=$recommends" >> $sfile.tmp
-            echo "haskell:Suggests=$suggests" >> $sfile.tmp
-            ;;
-        *)
-            cp $sfile $sfile.tmp
-            ;;
-    esac
-
-    echo "haskell:Extra-Depends=`cat debian/extra-depends-${hc}`" >> $sfile.tmp
-
-    mv $sfile.tmp $sfile
-done
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use v5.20;
+use warnings;
+use utf8;
+
+use Const::Fast;
+use File::Basename;
+use Getopt::Long ();
+use IPC::Run3;
+use List::SomeUtils qw(any uniq);
+use Path::Tiny;
+use Unicode::UTF8 qw(encode_utf8);
+
+use Debian::Debhelper::Buildsystem::Haskell::Recipes qw(
+  run
+  package_ext
+  package_hc
+  find_config_for_ghc
+  depends_for_ghc
+  depends_for_ghc_prof
+  depends_for_hugs
+);
+
+const my $EMPTY => q{};
+const my $SPACE => q{ };
+const my $COMMA => q{,};
+
+const my $NEWLINE => qq{\n};
+const my $NULL => qq{\0};
+
+const my $WAIT_STATUS_SHIFT => 8;
+
+my $program_name = basename($0);
+
+my @excludes;
+
+my %options = (
+    'exclude|X=s' => \@excludes,
+    'help|h' => \&show_help,
+);
+
+Getopt::Long::Configure('gnu_getopt', 'pass_through');
+Getopt::Long::GetOptions(%options)
+  or die encode_utf8("error parsing options\n");
+
+my @args_bytes = grep { /^-/ } @ARGV;
+my @configs = grep { !/^-/ } @ARGV;
+
+die encode_utf8("Installed package description file $_ can not be found")
+  for grep { !-e } @configs;
+
+$ENV{DH_EXCLUDES} = join($SPACE, @excludes);
+
+die encode_utf8('grep-dctrl is missing')
+  unless system('command -v grep-dctrl > /dev/null') == 0;
+
+my $output = run('dh_listpackages', @args_bytes);
+chomp $output;
+
+my @installables = split($SPACE, $output);
+
+for my $installable (@installables) {
+
+    my $substvars_path = "debian/$installable.substvars";
+
+    my $compiler = package_hc($installable);
+    my $extension = package_ext($installable);
+
+    my @depends;
+    my @recommends;
+    my @suggests;
+
+    if (any { $compiler eq $_ } qw{ghc ghcjs}) {
+
+        if (any { $extension eq $_ } qw{dev prof}) {
+
+            @configs = find_config_for_ghc($installable)
+              unless @configs;
+
+            die encode_utf8(
+'dh_haskell_depends - no installed package description files found'
+            )unless @configs;
+
+            if ($extension eq 'dev') {
+
+                push(
+                    @depends,
+                    split(
+                        m{ \s* , \s* }x,depends_for_ghc($compiler, @configs)));
+
+                my $prof = $installable;
+                $prof =~ s{ - [^-]+ $}{-prof}x;
+
+                my $doc = $installable;
+                $doc =~ s{ - [^-]+ $}{-doc}x;
+
+                push(@suggests, $doc)
+                  if system(qw{grep-dctrl --quiet --field=Package},
+                    $doc, 'debian/control') == 0;
+
+                push(@suggests, $prof)
+                  if system(qw{grep-dctrl --quiet --field=Package},
+                    $prof, 'debian/control') == 0;
+            }
+
+            if ($extension eq 'prof') {
+
+                my $dev = $installable;
+                $dev =~ s{ - [^-]+ $}{-dev}x;
+
+                push(@depends, "$dev (=\${binary:Version})");
+                push(
+                    @depends,
+                    split(
+                        m{ \s* , \s* }x,
+                        depends_for_ghc_prof($compiler, @configs)));
+            }
+        }
+
+        if ($extension eq 'doc') {
+
+            my $haddock_version = qx{haddock --interface-version};
+            chomp $haddock_version;
+
+            push(@depends, "haddock-interface-$haddock_version");
+
+            my @links =split(
+                m{\n}x,
+                run(
+                    'find', "debian/$installable",
+                    qw{-name *.html -exec hxwls -r \{\} ;}
+                ));
+
+            my @files;
+            for my $link (@links) {
+
+                # filter out fragment, too
+                next
+                  unless $link =~ m{^ file:// ([^#]*) }x;
+
+                my $file = $1;
+                push(@files, $file);
+            }
+
+            my @absolute = uniq +grep { m{^ / }x } @files;
+
+            # already in UTF-8
+            my $input_bytes = $EMPTY;
+            $input_bytes .= $_ . $NULL for @absolute;
+
+            my $stdout_bytes;
+            my $stderr_bytes;
+
+            my @combined = qw{xargs --null --no-run-if-empty dpkg --search};
+            run3(\@combined, \$input_bytes, \$stdout_bytes, \$stderr_bytes);
+
+            my $exitcode = $?;
+            my $status = ($exitcode >> $WAIT_STATUS_SHIFT);
+
+            # already in UTF-8
+            die encode_utf8("Non-zero exit code $exitcode.")
+              . $NEWLINE
+              . $stdout_bytes
+              . $stderr_bytes
+              if $exitcode;
+
+            my @lines = split(m{\n}, $stdout_bytes);
+
+            my @prerequisites;
+            for my $line (@lines) {
+
+                my ($origin) = split(m{:}, $line, 2);
+                next
+                  unless length $origin;
+
+                push(@prerequisites, $origin);
+            }
+
+            push(@recommends, @prerequisites);
+
+            my $dev = $installable;
+            $dev =~ s{ - [^-]+ $}{-dev}x;
+
+            push(@recommends, $dev)
+              if system(qw{grep-dctrl --quiet --field=Package},
+                $dev, 'debian/control') == 0;
+        }
+    }
+
+    if ($compiler eq 'hugs') {
+
+        push(@depends,split(m{ \s* , \s* }x,depends_for_hugs()));
+    }
+
+    local $ENV{LC_ALL} = 'C.UTF-8';
+
+    replace_line($substvars_path, 'haskell:Depends',
+        join($COMMA . $SPACE, (sort +uniq @depends)));
+    replace_line($substvars_path, 'haskell:Recommends',
+        join($COMMA . $SPACE, (sort +uniq @recommends)));
+    replace_line($substvars_path, 'haskell:Suggests',
+        join($COMMA . $SPACE, (sort +uniq @suggests)));
+
+    my $extra_depends = path("debian/extra-depends-$compiler")->slurp_utf8;
+    chomp $extra_depends;
+
+    replace_line($substvars_path, 'haskell:Extra-Depends', $extra_depends);
+}
+
+exit;
+
+sub replace_line {
+    my ($path, $field, $value) = @_;
+
+    path($path)->touch;
+
+    my @lines = grep { !m{^ $field = }x } path($path)->lines_utf8;
+
+    push(@lines, "$field=$value" . $NEWLINE);
+
+    path($path)->spew_utf8(@lines);
+
+    return;
+}
+
+sub show_help {
+    my $message =<<"EOT";
+Usage: $program_name [options] cabal-file ...
+
+Options:
+    -X, --exclude INSTALLABLE    exclude INSTALLABLE from processing
+EOT
+
+    print encode_utf8($message);
+
+    exit;
+}
+
+=head1 NAME
+
+dh_haskell_depends - calculates Haskell dependencies on Cabalized libraries
+
+=head1 SYNOPSIS
+
+B<dh_haskell_depends> [S<I<debhelper options>>]
+[B<-X>I<package>]
+[B<--exclude=>I<package>]
+[S<I<file>> ...]
+
+=head1 DESCRIPTION
+
+dh_haskell_depends is a debhelper program that helps with calculating dependencies
+for building Haskell libraries.
+
+It automates building libraries for the different supported Haskell systems in
+Debian.
+
+This script writes the debian/$package.substvars file, including in it the
+haskell:Depends, haskell:Recommends, haskell:Suggests and haskell:Extra-Depends
+variable.  So, to use this package, include in the Depends: field in debian/control
+${haskell:Depends}, and do the same for Recommends, Suggests and Extra-Depends.
+
+=head1 BUGS
+
+hugs and ghc are the only supported targets at the moment.  Cabal does
+not yet support nhc98.
+
+=head1 SEE ALSO
+
+L<dh_haskell_provides(1)>
+L<dh_haskell_shlibdeps(1)>
+L<dh_haskell_extra_depends(1)>
+L<debhelper(7)>
+
+=head1 AUTHOR
+
+John Goerzen <jgoerzen at complete.org>
+
+Based on ideas in dh_python by Josselin Mouette <joss at debian.org>
+
+=cut
+
+# Local Variables:
+# indent-tabs-mode: nil
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl sw=4 sts=4 sr et


=====================================
dh_haskell_depends.pod deleted
=====================================
@@ -1,41 +0,0 @@
-=head1 NAME
-
-dh_haskell_depends - calculates Haskell dependencies on Cabalized libraries
-
-=head1 SYNOPSIS
-
-B<dh_haskell_depends> [S<I<debhelper options>>]
-[B<-X>I<package>]
-[B<--exclude=>I<package>]
-[S<I<file>> ...]
-
-=head1 DESCRIPTION
-
-dh_haskell_depends is a debhelper program that helps with calculating dependencies
-for building Haskell libraries.
-
-It automates building libraries for the different supported Haskell systems in
-Debian.
-
-This script writes the debian/$package.substvars file, including in it the
-haskell:Depends, haskell:Recommends, haskell:Suggests and haskell:Extra-Depends
-variable.  So, to use this package, include in the Depends: field in debian/control
-${haskell:Depends}, and do the same for Recommends, Suggests and Extra-Depends.
-
-=head1 BUGS
-
-hugs and ghc are the only supported targets at the moment.  Cabal does
-not yet support nhc98.
-
-=head1 SEE ALSO
-
-L<dh_haskell_provides(1)>
-L<dh_haskell_shlibdeps(1)>
-L<dh_haskell_extra_depends(1)>
-L<debhelper(7)>
-
-=head1 AUTHOR
-
-John Goerzen <jgoerzen at complete.org>
-
-Based on ideas in dh_python by Josselin Mouette <joss at debian.org>


=====================================
dh_haskell_extra_depends
=====================================
@@ -1,107 +1,142 @@
-#! /bin/bash
-#
-# Determine package extra dependencies from package metadata
-#
-# Copyright (C) 2011 Giovanni Mascellani <gio at debian.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# 1) The terms of the GNU General Public License as published by
-#    the Free Software Foundation; either version 2 of the License, or
-#    (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License along
-#    with this program; if not, write to the Free Software Foundation, Inc.,
-#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# 2) BSD 3-clause license.
-# 
-#    All rights reserved.
-#
-#    Redistribution and use in source and binary forms, with or without
-#    modification, are permitted provided that the following conditions are
-#    met:
+#!/usr/bin/perl
+
+# Copyright © 2022 Felix Lechner <felix.lechner at lease-up.com>
 #
-#      * Redistributions of source code must retain the above copyright
-#        notice, this list of conditions and the following disclaimer.
+# based on a shell script by the same name
+#     by Giovanni Mascellani <gio at debian.org>
 #
-#      * Redistributions in binary form must reproduce the above
-#        copyright notice, this list of conditions and the following
-#        disclaimer in the documentation and/or other materials provided
-#        with the distribution.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
 #
-#      * The names of contributors may not be used to endorse or promote
-#        products derived from this software without specific prior
-#        written permission. 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
 #
-#    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-#    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-#    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-#    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-#    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-#    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-#    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-#    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE..
-
-set -e 
-
-. /usr/share/haskell-devscripts/Dh_Haskell.sh
-
-hc=$1
-shift
-
-args=
-ignores=
-files=
-until [ -z "$1" ]
-do
-  case "$1" in
-      -X*)
-          pkg=${1##-X}
-          ignores="$ignores $pkg"
-          ;;
-
-      --exclude=*)
-          pkg=${1##--exclude=}
-          ignores="$ignores $pkg"
-          ;;
-
-      -*)
-          args="$args $1"
-          ;;
-      *)
-          if [ -f $1 ] ; then
-              files="$files $1"
-          else
-              echo "Installed package description file $1 can not be found" >&2
-              exit 1
-          fi
-          ;;
-  esac
-  shift
-done
-
-export DH_EXCLUDES="$ignores"
-
-# PS4=" + dh_haskell_extra_depends> "
-# set -x
-
-extradeps=''
-for dep in `cabal_depends $files` ; do
-    dep_package_ver=`echo $dep | grep '^.\+-[0-9\.]\+-................................$' | sed 's|^\(.\+\)-\([0-9.]\+\)-[0-9a-f]\+$|\1-\2|'`
-    extra_packages_file=/usr/lib/haskell-packages/extra-packages/$dep_package_ver
-    if [ -f $extra_packages_file ] ; then
-        extradeps="$extradeps, `cat $extra_packages_file`"
-    fi
-done
-echo $extradeps | sed -e 's/^,[ ]*//' > debian/extra-depends-${hc}
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use v5.20;
+use warnings;
+use utf8;
+
+use Const::Fast;
+use File::Basename;
+use Getopt::Long ();
+use Path::Tiny;
+use Unicode::UTF8 qw(encode_utf8);
+
+use Debian::Debhelper::Buildsystem::Haskell::Recipes qw(
+  cabal_depends
+);
+
+const my $SPACE => q{ };
+const my $COMMA => q{,};
+
+my $program_name = basename($0);
+
+my @excludes;
+
+my %options = (
+    'exclude|X=s' => \@excludes,
+    'help|h' => \&show_help,
+);
+
+Getopt::Long::Configure('gnu_getopt', 'pass_through');
+Getopt::Long::GetOptions(%options)
+  or die encode_utf8("error parsing options\n");
+
+my @args_bytes = grep { /^-/ } @ARGV;
+my ($compiler, @configs) = grep { !/^-/ } @ARGV;
+
+die encode_utf8("Installed package description file $_ can not be found")
+  for grep { !-e } @configs;
+
+$ENV{DH_EXCLUDES} = join($SPACE, @excludes);
+
+my @extra_depends;
+
+my @prerequisites = cabal_depends(@configs);
+for my $prerequisite (@prerequisites) {
+
+    next
+      unless $prerequisite =~ m{^ ([^-]+) - ([0-9.]+) - [0-9a-f]{32} $}x;
+
+    my $name = $1;
+    my $version = $2;
+
+    my $extra_packages_file
+      = "/usr/lib/haskell-packages/extra-packages/$name-$version";
+
+    push(@extra_depends,
+        split(m{ \s* , \s* }x, path($extra_packages_file)->slurp_utf8))
+      if -e $extra_packages_file;
+}
+
+path("debian/extra-depends-$compiler")
+  ->spew_utf8(join($COMMA . $SPACE, @extra_depends));
+
+exit;
+
+sub show_help {
+    my $message =<<"EOT";
+Usage: $program_name [options] cabal-file ...
+
+Options:
+    -X, --exclude INSTALLABLE    exclude INSTALLABLE from processing
+EOT
+
+    print encode_utf8($message);
+
+    exit;
+}
+
+=head1 NAME
+
+dh_haskell_extra_depends - generate the extra-depends file in Haskell packages
+
+=head1 SYNOPSIS
+
+B<dh_extra_haskell_depends> [S<I<debhelper options>>]
+[B<-X>I<package>]
+[B<--exclude=>I<package>]
+[S<I<file>> ...]
+
+=head1 DESCRIPTION
+
+dh_haskell_extra_depends is a debhelper program that helps with calculating dependencies
+for building Haskell libraries.
+
+Since Haskell libraries are statically linked, packagers that use Haskell
+libraries cannot rely on the fact that dynamical libraries are dependencies
+of their packages to be sure that possible runtime data packages are installed
+at execution time. The extra dependencies mechanism allows libraries
+to declare some packages that are to be added to the dependency list of
+each package that uses them to build.
+
+This script scans the Haskell dependencies and harvest extra dependencies
+information, putting them in the file debian/extra-depends, which is later
+used by dh_haskell_depends to be included in the substvars file.
+
+=head1 BUGS
+
+None, as far as we know. :-)
+
+=head1 SEE ALSO
+
+L<dh_haskell_depends(1)>
+L<debhelper(7)>
+
+=head1 AUTHOR
+
+Giovanni Mascellani <gio at debian.org>
+
+=cut
 
+# Local Variables:
+# indent-tabs-mode: nil
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl sw=4 sts=4 sr et


=====================================
dh_haskell_extra_depends.pod deleted
=====================================
@@ -1,39 +0,0 @@
-=head1 NAME
-
-dh_haskell_extra_depends - generate the extra-depends file in Haskell packages
-
-=head1 SYNOPSIS
-
-B<dh_extra_haskell_depends> [S<I<debhelper options>>]
-[B<-X>I<package>]
-[B<--exclude=>I<package>]
-[S<I<file>> ...]
-
-=head1 DESCRIPTION
-
-dh_haskell_extra_depends is a debhelper program that helps with calculating dependencies
-for building Haskell libraries.
-
-Since Haskell libraries are statically linked, packagers that use Haskell
-libraries cannot rely on the fact that dynamical libraries are dependencies
-of their packages to be sure that possible runtime data packages are installed
-at execution time. The extra dependencies mechanism allows libraries
-to declare some packages that are to be added to the dependency list of
-each package that uses them to build.
-
-This script scans the Haskell dependencies and harvest extra dependencies
-information, putting them in the file debian/extra-depends, which is later
-used by dh_haskell_depends to be included in the substvars file.
-
-=head1 BUGS
-
-None, as far as we know. :-)
-
-=head1 SEE ALSO
-
-L<dh_haskell_depends(1)>
-L<debhelper(7)>
-
-=head1 AUTHOR
-
-Giovanni Mascellani <gio at debian.org>


=====================================
dh_haskell_provides
=====================================
@@ -1,147 +1,169 @@
-#! /bin/bash
-#
-# Calculated provides substvars for haskell library packages.
-#
-# Copyright (C) 2006-2007 Arjan Oosting <arjan at debian.org>
-# Copyright (C) 2009,2013 Joachim Breitner <nomeata at debian.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# 1) The terms of the GNU General Public License as published by
-#    the Free Software Foundation; either version 2 of the License, or
-#    (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License along
-#    with this program; if not, write to the Free Software Foundation, Inc.,
-#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# 2) BSD 3-clause license.
-# 
-#    All rights reserved.
-#
-#    Redistribution and use in source and binary forms, with or without
-#    modification, are permitted provided that the following conditions are
-#    met:
+#!/usr/bin/perl
+
+# Copyright © 2022 Felix Lechner <felix.lechner at lease-up.com>
 #
-#      * Redistributions of source code must retain the above copyright
-#        notice, this list of conditions and the following disclaimer.
+# based on a shell script by the same name
+#     by Arjan Oosting <arjan at debian.org>
+#     and Joachim Breitner <nomeata at debian.org>
 #
-#      * Redistributions in binary form must reproduce the above
-#        copyright notice, this list of conditions and the following
-#        disclaimer in the documentation and/or other materials provided
-#        with the distribution.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
 #
-#      * The names of contributors may not be used to endorse or promote
-#        products derived from this software without specific prior
-#        written permission. 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
 #
-#    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-#    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-#    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-#    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-#    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-#    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-#    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-#    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-#    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-#    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-#    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE..
-
-set -e
-
-if test -e debian/Dh_Haskell.sh
-then
-        . debian/Dh_Haskell.sh
-else
-        . /usr/share/haskell-devscripts/Dh_Haskell.sh
-fi
-
-args=
-ignores=
-files=
-until [ -z "$1" ]
-do
-  case "$1" in
-      -X*)
-          pkg=${1##-X}
-          ignores="$ignores $pkg"
-          ;;
-
-      --exclude=*)
-          pkg=${1##--exclude=}
-          ignores="$ignores $pkg"
-          ;;
-
-      -*)
-          args="$args $1"
-          ;;
-      *)
-          if [ -f $1 ] ; then
-              files="$files $1"
-          else
-              echo "Installed package description file $1 can not be found" >&2
-              exit 1
-          fi
-          ;;
-  esac
-  shift
-done
-
-export DH_EXCLUDES="$ignores"
-
-# PS4=" + dh_haskell_provides> "
-# set -x
-
-for pkg in `dh_listpackages $args`; do
-    sfile=debian/$pkg.substvars
-    touch $sfile
-
-    hc=`package_hc ${pkg}`
-    ext=`package_ext ${pkg}`
-
-    case "$ext" in
-        dev|prof)
-            if [ -z "$files" ] ; then
-                cfiles=`find_config_for_ghc $pkg`
-            else
-                cfiles="$files"
-            fi
-            if [ -z "$cfiles" ] ; then
-              echo "dh_haskell_provides - no installed package description files found" >&2
-              exit 1
-            fi
-            case "$ext" in
-                dev)
-                    grep -a -v \
-                        -e ^haskell:Provides \
-                        $sfile > $sfile.tmp || true
-                    provides="`provides_for_ghc $hc $cfiles`"
-                    echo "haskell:Provides=$provides" >> $sfile.tmp
-                    mv $sfile.tmp $sfile
-                    grep -a -v \
-                        -e ^haskell:${hc}-package \
-                        $sfile > $sfile.tmp || true
-                    package_ids="`cabal_package_ids $cfiles`"
-                    echo "haskell:${hc}-package=$package_ids" >> $sfile.tmp
-                    mv $sfile.tmp $sfile
-                    ;;
-                prof)
-                    grep -a -v \
-                        -e ^haskell:Provides \
-                        $sfile > $sfile.tmp || true
-                    provides="`provides_for_ghc_prof $hc $cfiles`"
-                    echo "haskell:Provides=$provides" >> $sfile.tmp
-                    mv $sfile.tmp $sfile
-                    ;;
-            esac
-            ;;
-        *)
-            ;;
-    esac
-done
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use v5.20;
+use warnings;
+use utf8;
+
+use Const::Fast;
+use File::Basename;
+use Getopt::Long ();
+use List::SomeUtils qw(none);
+use Path::Tiny;
+use Unicode::UTF8 qw(encode_utf8);
+
+use Debian::Debhelper::Buildsystem::Haskell::Recipes qw(
+  run
+  package_ext
+  package_hc
+  find_config_for_ghc
+  cabal_package_ids
+  composite_provides
+);
+
+const my $SPACE => q{ };
+const my $NEWLINE => qq{\n};
+
+my $program_name = basename($0);
+
+my @excludes;
+
+my %options = (
+    'exclude|X=s' => \@excludes,
+    'help|h' => \&show_help,
+);
+
+Getopt::Long::Configure('gnu_getopt', 'pass_through');
+Getopt::Long::GetOptions(%options)
+  or die encode_utf8("error parsing options\n");
+
+my @args_bytes = grep { /^-/ } @ARGV;
+my @configs = grep { !/^-/ } @ARGV;
+
+die encode_utf8("Installed package description file $_ can not be found")
+  for grep { !-e } @configs;
+
+$ENV{DH_EXCLUDES} = join($SPACE, @excludes);
+
+my $output = run('dh_listpackages', @args_bytes);
+chomp $output;
+
+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')
+      unless @configs;
+
+    my $compiler = package_hc($installable);
+    my $provides = composite_provides($compiler, $extension, @configs);
+
+    my $substvars_path = "debian/$installable.substvars";
+    replace_line($substvars_path, 'haskell:Provides', $provides);
+
+    if ($extension eq 'dev') {
+
+        my @package_ids = cabal_package_ids(@configs);
+        replace_line($substvars_path, "haskell:$compiler-package",
+            join($SPACE, @package_ids));
+    }
+}
+
+exit;
+
+sub replace_line {
+    my ($path, $field, $value) = @_;
+
+    path($path)->touch;
+
+    my @lines = grep { !m{^ $field = }x } path($path)->lines_utf8;
+
+    push(@lines, "$field=$value" . $NEWLINE);
+
+    path($path)->spew_utf8(@lines);
+
+    return;
+}
+
+sub show_help {
+    my $message =<<"EOT";
+Usage: $program_name [options] cabal-file ...
+
+Options:
+    -X, --exclude INSTALLABLE    exclude INSTALLABLE from processing
+EOT
+
+    print encode_utf8($message);
+
+    exit;
+}
+
+=head1 NAME
+
+dh_haskell_provides - calculates Haskell virtual package names on Cabalized libraries
+
+=head1 SYNOPSIS
+
+B<dh_haskell_provides> [S<I<debhelper options>>]
+[B<-X>I<package>]
+[B<--exclude=>I<package>]
+[S<I<file>> ...]
+
+=head1 DESCRIPTION
+
+dh_haskell_provides is a debhelper program that calculates the correct virtual
+package to provide, so that dependencies can guarantee ABI stability.
+
+For a package with an idea of package-version-longhashstring, it generates a
+virtual package of the form libghc-package-dev-version-longh for the -dev
+package and libghc-package-prof-version-longh for the prof package
+respectively.
+
+This script writes the debian/$package.substvars file, including in it the
+haskell:Provides.  So, to use this package, include in the Provides: field in
+debian/control ${haskell:Provides}.
+
+=head1 SEE ALSO
+
+L<dh_haskell_depends(1)>
+L<dh_haskell_shlibdeps(1)>
+L<debhelper(7)>
+
+=head1 AUTHOR
+
+Joachim Breitner <nomeata at debian.org>
+
+Based on ideas in dh_ocaml.
+
+=cut
+
+# Local Variables:
+# indent-tabs-mode: nil
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl sw=4 sts=4 sr et


=====================================
dh_haskell_provides.pod deleted
=====================================
@@ -1,36 +0,0 @@
-=head1 NAME
-
-dh_haskell_provides - calculates Haskell virtual package names on Cabalized libraries
-
-=head1 SYNOPSIS
-
-B<dh_haskell_provides> [S<I<debhelper options>>]
-[B<-X>I<package>]
-[B<--exclude=>I<package>]
-[S<I<file>> ...]
-
-=head1 DESCRIPTION
-
-dh_haskell_provides is a debhelper program that calculates the correct virtual
-package to provide, so that dependencies can guarantee ABI stability.
-
-For a package with an idea of package-version-longhashstring, it generates a
-virtual package of the form libghc-package-dev-version-longh for the -dev
-package and libghc-package-prof-version-longh for the prof package
-respectively.
-
-This script writes the debian/$package.substvars file, including in it the
-haskell:Provides.  So, to use this package, include in the Provides: field in
-debian/control ${haskell:Provides}.
-
-=head1 SEE ALSO
-
-L<dh_haskell_depends(1)>
-L<dh_haskell_shlibdeps(1)>
-L<debhelper(7)>
-
-=head1 AUTHOR
-
-Joachim Breitner <nomeata at debian.org>
-
-Based on ideas in dh_ocaml.


=====================================
dh_haskell_shlibdeps
=====================================
@@ -1,117 +1,186 @@
-#!/bin/bash
-# arch-tag: Debhelper script for Haskell
+#!/usr/bin/perl
+
+# Copyright © 2022 Felix Lechner <felix.lechner at lease-up.com>
+#
+# based on a shell script by the same name
+#     by Marco Túlio Gontijo e Silva <marcot at debian.org>
+#     and Joachim Breitner <nomeata at debian.org>
+# which in turn was based on
+#     mk-haskell-depends by Martin Sjögren <sjogren at debian.org>
 #
-# Copyright (C) 2009 Marco Túlio Gontijo e Silva <marcot at debian.org>
-# Copyright (C) 2014 Joachim Breitner <nomeata at debian.org>
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
 #
-# Based on mk-haskell-depends by Martin Sjögren <sjogren at debian.org>
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-set -e
-
-. /usr/share/haskell-devscripts/Dh_Haskell.sh
-
-args=
-ignores=
-files=
-until [ -z "$1" ]
-do
-  case "$1" in
-      -X*)
-          pkg=${1##-X}
-          ignores="$ignores $pkg"
-          ;;
-
-      --exclude=*)
-          pkg=${1##--exclude=}
-          ignores="$ignores $pkg"
-          ;;
-
-      -*)
-          args="$args $1"
-          ;;
-      *)
-          if [ -f $1 ] ; then
-              files="$files $1"
-          else
-              echo "Installed package description file $1 can not be found" >&2
-              exit 1
-          fi
-          ;;
-  esac
-  shift
-done
-
-export DH_EXCLUDES="$ignores"
-
-# PS4=" + dh_haskell_shlibdeps> "
-# set -x
-
-pkgs=`dh_listpackages $args`
-
-for pkg in $pkgs
-do
-    ext=`package_ext ${pkg}`
-    case "$ext" in
-        dev)
-            if [ -z "$files" ] ; then
-                files=`find_config_for_ghc $pkg`
-            fi
-            ;;
-    esac
-done
-
-if [ -z "$files" ]
-then
-        echo "dh_haskell_shlibdeps - no installed package description files found" >&2
-        exit 1
-fi
-
-T_DIR=debian/dh_haskell_shlibdeps
-mkdir $T_DIR 2> /dev/null || true
-
-args=""
-cpkgs="`basename -s .conf $files`"
-ghcpkg="`tmp_package_db $files`"
-for cpkg in ${cpkgs}
-do
-    ldirs="`${ghcpkg} --simple-output field "${cpkg}" library-dirs`"
-    for dir in ${ldirs}
-    do
-        args="$args -L$dir"
-    done
-    elibs="`${ghcpkg} --simple-output field "${cpkg}" extra-libraries`"
-    for lib in ${elibs}
-    do
-        args="$args -l$lib"
-    done
-done
-
-echo 'int main (void) {}' > $T_DIR/probe.c
-gcc $args $T_DIR/probe.c -o $T_DIR/probe
-
-for pkg in $pkgs
-do
-    ext=`package_ext ${pkg}`
-    case "$ext" in
-        dev)
-            dpkg-shlibdeps --warnings=1 -Tdebian/$pkg.substvars $T_DIR/probe
-            ;;
-    esac
-done
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use v5.20;
+use warnings;
+use utf8;
+
+use Const::Fast;
+use File::Basename;
+use Getopt::Long ();
+use Path::Tiny;
+use Unicode::UTF8 qw(encode_utf8 decode_utf8);
+
+use Debian::Debhelper::Buildsystem::Haskell::Recipes qw(
+  run
+  package_ext
+  find_config_for_ghc
+  tmp_package_db
+);
+
+const my $SPACE => q{ };
+const my $NEWLINE => qq{\n};
+
+my $program_name = basename($0);
+
+my @excludes;
+
+my %options = (
+    'exclude|X=s' => \@excludes,
+    'help|h' => \&show_help,
+);
+
+Getopt::Long::Configure('gnu_getopt', 'pass_through');
+Getopt::Long::GetOptions(%options)
+  or die encode_utf8("error parsing options\n");
+
+my @args_bytes = grep { /^-/ } @ARGV;
+my @configs = grep { !/^-/ } @ARGV;
+
+die encode_utf8("Installed package description file $_ can not be found")
+  for grep { !-e } @configs;
+
+$ENV{DH_EXCLUDES} = join($SPACE, @excludes);
+
+my $output = run('dh_listpackages', @args_bytes);
+chomp $output;
+
+my @installables = split($SPACE, $output);
+for my $installable (@installables) {
+
+    my $extension = package_ext($installable);
+    next
+      unless $extension eq 'dev';
+
+    @configs = find_config_for_ghc($installable)
+      unless @configs;
+}
+
+die encode_utf8(
+    'dh_haskell_shlibdeps - no installed package description files found')
+  unless @configs;
+
+my $T_DIR = 'debian/dh_haskell_shlibdeps';
+path($T_DIR)->mkpath;
+
+my @hackages = map { path($_)->basename(qr{ [.]conf $}x) } @configs;
+
+my @ghc_pkg = tmp_package_db(@configs);
+
+my @gcc_args;
+for my $hackage (@hackages) {
+
+    my $libdir_string = decode_utf8(
+        run(@ghc_pkg, qw{--simple-output field}, $hackage, 'library-dirs'));
+    my @lib_dirs = split($SPACE, $libdir_string);
+    push(@gcc_args, (map { "-L$_" } @lib_dirs));
+
+    my $library_string = decode_utf8(
+        run(@ghc_pkg, qw{--simple-output field}, $hackage, 'extra-libraries'));
+    my @libraries = split($SPACE, $library_string);
+    push(@gcc_args, (map { "-l$_" } @libraries));
+}
+
+my $source_path = "$T_DIR/probe.c";
+my $probe_path = "$T_DIR/probe";
+
+path($source_path)->spew_utf8('int main (void) {}');
+
+my @gcc_args_bytes = map { encode_utf8($_) } @gcc_args;
+run('gcc', @gcc_args_bytes, $source_path, '-o', $probe_path);
+
+for my $installable (@installables) {
+
+    my $extension = package_ext($installable);
+    next
+      unless $extension eq 'dev';
+
+    my $substvars_path = "debian/$installable.substvars";
+
+    run(qw{dpkg-shlibdeps --warnings=1}, "-T$substvars_path", $probe_path);
+}
+
+exit;
+
+sub show_help {
+    my $message =<<"EOT";
+Usage: $program_name [options] cabal-file ...
+
+Options:
+    -X, --exclude INSTALLABLE    exclude INSTALLABLE from processing
+EOT
+
+    print encode_utf8($message);
+
+    exit;
+}
+
+=head1 NAME
+
+dh_haskell_shlibdeps - calculates Haskell external dependencies on Cabalized
+libraries
+
+=encoding utf8
+=head1 SYNOPSIS
+
+B<dh_haskell_depends> [S<I<debhelper options>>]
+[B<-X>I<package>]
+[B<--exclude=>I<package>]
+[S<I<file>> ...]
+
+=head1 DESCRIPTION
+
+dh_haskell_shlibdeps is a debhelper program that helps with calculating
+external dependencies for building Haskell libraries.
+
+It automates building libraries for the different supported Haskell systems in
+Debian.
+
+This script writes the debian/$package.substvars file, including in it the
+shlibs:Depends variable.  So, to use this package, include in the Depends:
+field in debian/control ${shlibs:Depends}.
+
+=head1 BUGS
+
+hugs and ghc are the only supported targets at the moment.  Cabal does
+not yet support nhc98.
+
+=head1 SEE ALSO
+
+L<dh_haskell_depends(1)>
+L<dh_haskell_provides(1)>
+L<debhelper(7)>
+
+=head1 AUTHOR
+
+Marco Túlio Gontijo e Silva <marcot at debian.org>
+
+Based on ideas in mk-haskell-depends by Martin Sjögren <sjogren at debian.org>
+
+=cut
+
+# Local Variables:
+# indent-tabs-mode: nil
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl sw=4 sts=4 sr et


=====================================
dh_haskell_shlibdeps.pod deleted
=====================================
@@ -1,41 +0,0 @@
-=head1 NAME
-
-dh_haskell_shlibdeps - calculates Haskell external dependencies on Cabalized
-libraries
-
-=encoding utf8
-=head1 SYNOPSIS
-
-B<dh_haskell_depends> [S<I<debhelper options>>]
-[B<-X>I<package>]
-[B<--exclude=>I<package>]
-[S<I<file>> ...]
-
-=head1 DESCRIPTION
-
-dh_haskell_shlibdeps is a debhelper program that helps with calculating
-external dependencies for building Haskell libraries.
-
-It automates building libraries for the different supported Haskell systems in
-Debian.
-
-This script writes the debian/$package.substvars file, including in it the
-shlibs:Depends variable.  So, to use this package, include in the Depends:
-field in debian/control ${shlibs:Depends}.
-
-=head1 BUGS
-
-hugs and ghc are the only supported targets at the moment.  Cabal does
-not yet support nhc98.
-
-=head1 SEE ALSO
-
-L<dh_haskell_depends(1)>
-L<dh_haskell_provides(1)>
-L<debhelper(7)>
-
-=head1 AUTHOR
-
-Marco Túlio Gontijo e Silva <marcot at debian.org>
-
-Based on ideas in mk-haskell-depends by Martin Sjögren <sjogren at debian.org>


=====================================
lib/Debian/Debhelper/Buildsystem/Haskell/Recipes.pm
=====================================
@@ -1,8 +1,10 @@
 # Copyright © 2022 Felix Lechner <felix.lechner at lease-up.com>
 #
-# This program is free software; you can redistribute it and/or modify
+# based on a shell script library by John Goerzen
+#
+# This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful,
@@ -11,10 +13,7 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, you can find it on the World Wide
-# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
-# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
-# MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 package Debian::Debhelper::Buildsystem::Haskell::Recipes;
 
@@ -60,6 +59,7 @@ BEGIN {
       depends_for_ghc_prof
       usable_ghc_pkg
       tmp_package_db
+      composite_provides
       provides_for_ghc
       provides_for_ghc_prof
       package_id_to_virtual_package
@@ -280,7 +280,7 @@ sub packages_hc {
     my () = @_;
 
     # fix sort order
-    local $ENV{LC_ALL} = 'C';
+    local $ENV{LC_ALL} = 'C.UTF-8';
 
     # should be in UTF-8
     my @installables = split($SPACE, $ENV{DEB_PACKAGES} // $EMPTY);
@@ -449,7 +449,7 @@ sub sort_uniq {
     my (@items) = @_;
 
     # fix sort order
-    local $ENV{LC_ALL} = 'C';
+    local $ENV{LC_ALL} = 'C.UTF-8';
 
     my @sorted = sort +uniq @items;
 
@@ -578,7 +578,7 @@ sub cabal_depends {
     my (@configs) = @_;
 
     # fix sort order
-    local $ENV{LC_ALL} = 'C';
+    local $ENV{LC_ALL} = 'C.UTF-8';
 
     my @ghc_pkg = tmp_package_db(@configs);
 



View it on GitLab: https://salsa.debian.org/haskell-team/haskell-devscripts/-/compare/197da9b54232f58b74c0b5e08a5178c54a87ff0f...9389c725ddfddbd35d0ec182a9de4d8a5d28fd80

-- 
View it on GitLab: https://salsa.debian.org/haskell-team/haskell-devscripts/-/compare/197da9b54232f58b74c0b5e08a5178c54a87ff0f...9389c725ddfddbd35d0ec182a9de4d8a5d28fd80
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/20220408/77cba67b/attachment-0001.htm>


More information about the Pkg-haskell-commits mailing list