[Git][haskell-team/haskell-devscripts][master] 3 commits: Obtain first match directly from regexes, automatically without the /g modifier.
Felix Lechner (@lechner)
gitlab at salsa.debian.org
Thu Apr 21 23:36:51 BST 2022
Felix Lechner pushed to branch master at Debian Haskell Group / haskell-devscripts
Commits:
d1a99b13 by Felix Lechner at 2022-04-21T14:16:54-07:00
Obtain first match directly from regexes, automatically without the /g modifier.
- - - - -
3ecd9392 by Felix Lechner at 2022-04-21T15:35:43-07:00
Handle GHC package registrations that are folders. (Closes: #1009883)
Fix tested with haskell-attoparsec_0.13.2.4-2.
Thanks to Scott Talbert for bringing this matter to our attention!
- - - - -
00ba0e52 by Felix Lechner at 2022-04-21T15:36:05-07:00
Expand DEB_SETUP_GHC_CONFIGURE_ARGS properly. (Closes: #1009925)
Fix tested with haskell-yaml_0.11.4.0-1.
Thanks to Scott Talbert for bringing this matter to our attention!
- - - - -
2 changed files:
- dh_haskell_install_ghc_registration
- lib/Debian/Debhelper/Buildsystem/Haskell/Recipes.pm
Changes:
=====================================
dh_haskell_install_ghc_registration
=====================================
@@ -47,18 +47,31 @@ for my $installable (@{ $dh{DOPACKAGES} }) {
if ($output
=~ m{^Creating \s package \s registration \s file: \s+ (\S+) $}mx) {
- my $pkg_config = $1;
+ my $path = $1;
- run(qw{sed -i}, 's/^exposed: True$/exposed: False/',$pkg_config)
- if length $ENV{HASKELL_HIDE_PACKAGES};
+ my @pkg_configs;
+ if (-d $path) {
+# https://downloads.haskell.org/cabal/Cabal-3.0.0.0/doc/users-guide/installing-packages.html#cmdoption-setup-register-gen-pkg-config
+ push(@pkg_configs, glob("$path/*.conf"));
- run(qw{install -D --mode=644},
- $pkg_config, "debian/$installable/$pkgdir/$pkg_config");
- run(qw{rm -f}, $pkg_config);
+ } else {
+ push(@pkg_configs, $path);
+ }
+
+ for my $pkg_config (@pkg_configs) {
+
+ run(qw{sed -i}, 's/^exposed: True$/exposed: False/',$pkg_config)
+ if length $ENV{HASKELL_HIDE_PACKAGES};
+
+ run(qw{install -D --mode=644},
+ $pkg_config, "debian/$installable/$pkgdir/$pkg_config");
+ }
+
+ run(qw{rm -rf}, $path);
} else {
- die encode_utf8('Cannot get package registration file.');
+ die encode_utf8('Cannot generate package registration.');
}
}
=====================================
lib/Debian/Debhelper/Buildsystem/Haskell/Recipes.pm
=====================================
@@ -63,6 +63,7 @@ use Unicode::UTF8 qw(encode_utf8 decode_utf8);
const my $EMPTY => q{};
const my $SPACE => q{ };
+const my $DOUBLE_QUOTE => q{"};
const my $NEWLINE => qq{\n};
const my $WAIT_STATUS_SHIFT => 8;
@@ -368,25 +369,40 @@ sub own_cabal_prerequisites {
if ($output
=~ m{^Creating \s package \s registration \s file: \s+ (\S+) $}mx) {
- my $pkg_config = $1;
+ my $path = $1;
+
+ my @pkg_configs;
+ if (-d $path) {
+# https://downloads.haskell.org/cabal/Cabal-3.0.0.0/doc/users-guide/installing-packages.html#cmdoption-setup-register-gen-pkg-config
+ push(@pkg_configs, glob("$path/*.conf"));
+
+ } else {
+ push(@pkg_configs, $path);
+ }
my $ghc_pkg = ghc_pkg_command();
- load_ghc_database($ghc_pkg, $tmp_db, $pkg_config);
+ load_ghc_database($ghc_pkg, $tmp_db, @pkg_configs);
- my $name = path($pkg_config)->basename(qr{ [.]conf $}x);
- my $depends
- = run($ghc_pkg, '--package-db', $tmp_db, qw{--simple-output field},
- $name, 'depends');
+ for my $pkg_config (@pkg_configs) {
- push(@hashed_ids, split($SPACE, $depends // $EMPTY));
+ my $name = path($pkg_config)->basename(qr{ [.]conf $}x);
+ my $depends
+ = run($ghc_pkg, '--package-db', $tmp_db,
+ qw{--simple-output field},
+ $name, 'depends');
- run(qw{rm -f}, $pkg_config);
+ push(@hashed_ids, split($SPACE, $depends // $EMPTY));
+ }
+
+ run(qw{rm -rf}, $path);
} else {
- warn encode_utf8('Cannot find package registration file.');
+ warn encode_utf8('Cannot generate package registration.');
}
- return @hashed_ids;
+ my @unique = uniq @hashed_ids;
+
+ return @unique;
}
=item load_ghc_database
@@ -504,14 +520,17 @@ sub make_setup_recipe {
my $cabal_path = "$ENV{CABAL_PACKAGE}.cabal";
my $cabal_contents = path($cabal_path)->slurp_utf8;
- my $cabal_version= first_value { length }
- ($cabal_contents
- =~ m{^ cabal-version: (?: \s+ [<>=]+ )? \s+ (\S+) \s* $}mix);
die encode_utf8("No cabal-version in $cabal_path")
- unless length $cabal_version;
+ unless $cabal_contents
+ =~ m{^ cabal-version: (?: \s+ [<>=]+ )? \s+ (\S+) \s* $}mix;
- my $build_type= first_value { length }
- ($cabal_contents =~ m{^ build-type: \s+ (\w+) \s* }mix);
+ my $cabal_version = $1;
+
+ my $build_type;
+
+ if ($cabal_contents =~ m{^ build-type: \s+ (\w+) \s* }mix) {
+ $build_type = $1;
+ }
# https://cabal.readthedocs.io/en/3.4/cabal-package.html#pkg-field-build-type
my $default_build_type = 'Simple';
@@ -583,9 +602,14 @@ sub configure_recipe {
my $htmldir = hc_htmldir($compiler, $ENV{CABAL_PACKAGE});
# DEB_SETUP_GHC_CONFIGURE_ARGS can contain multiple arguments
- # with their own quoting so run through shell a expansion
- my $ghc_configure_args = run_quiet(qw{sh -c echo -n},
- split($SPACE, $ENV{DEB_SETUP_GHC_CONFIGURE_ARGS} // $EMPTY));
+ # with their own quoting so run through a shell expansion
+ my $ghc_configure_args = run_quiet(
+ qw{sh -c},
+ 'echo -n '
+ . $DOUBLE_QUOTE
+ . ($ENV{DEB_SETUP_GHC_CONFIGURE_ARGS} // $EMPTY)
+ . $DOUBLE_QUOTE
+ );
# the versioned form DEB_SETUP_GHC6_CONFIGURE_ARGS should perhaps be
# abandoned in favor of the unversioned DEB_SETUP_GHC_CONFIGURE_ARGS
View it on GitLab: https://salsa.debian.org/haskell-team/haskell-devscripts/-/compare/4a448882066c72d556cf67845070863263f7cd3e...00ba0e52bf570c6c5fe26fe3dea9e0d617d6f748
--
View it on GitLab: https://salsa.debian.org/haskell-team/haskell-devscripts/-/compare/4a448882066c72d556cf67845070863263f7cd3e...00ba0e52bf570c6c5fe26fe3dea9e0d617d6f748
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/20220421/b2fcafce/attachment-0001.htm>
More information about the Pkg-haskell-commits
mailing list