[Git][haskell-team/dh-haskell][master] 2 commits: Take advantage of ${perl:Depends} variable, provided by dh_perl(1). (Closes:…

Ilias Tsitsimpis gitlab at salsa.debian.org
Sun Jan 21 12:21:59 UTC 2018


Ilias Tsitsimpis pushed to branch master at Debian Haskell Group / dh-haskell


Commits:
791fcc13 by Dmitry Bogatov at 2016-09-29T11:23:43+03:00
Take advantage of ${perl:Depends} variable, provided by dh_perl(1). (Closes: #839020) (Thanks: Niko Tyni <ntyni at debian.org>) (Thanks: Chris Lamb <lamby at debian.org>)

- - - - -
056b76f0 by Sven Bartscher at 2016-10-09T21:24:09+02:00
Use ghc-pkg instead of manual package parsing for generating virtual
package names

- - - - -


3 changed files:

- debian/changelog
- debian/control
- lib/Debian/Debhelper/Buildsystem/haskell.pm


Changes:

=====================================
debian/changelog
=====================================
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,21 @@
+dh-haskell (0.4) experimental; urgency=low
+
+  * Use ghc-pkg to construct virtual package names instead of manual
+    parsing.
+
+ -- Sven Bartscher <kritzefitz at debian.org>  Sun, 09 Oct 2016 13:36:21 +0200
+
+dh-haskell (0.3.1) unstable; urgency=medium
+
+  * Take advantage of ${perl:Depends} variable, provided by dh_perl(1).
+    (Closes: #839020) (Thanks: Niko Tyni <ntyni at debian.org>)
+
+ -- Dmitry Bogatov <KAction at gnu.org>  Wed, 28 Sep 2016 19:27:54 +0300
+
 dh-haskell (0.3) unstable; urgency=medium
 
   * Avoid push on scalar, which in now forbidden (Closes: #838888)
+    (Thanks: Chris Lamb <lamby at debian.org>)
   * Replace git:// with https:// link in Vcs-Git
 
  -- Dmitry Bogatov <KAction at gnu.org>  Mon, 26 Sep 2016 10:44:07 +0300


=====================================
debian/control
=====================================
--- a/debian/control
+++ b/debian/control
@@ -12,7 +12,7 @@ Vcs-Git: https://anonscm.debian.org/cgit/pkg-haskell/dh-haskell.git
 
 Package: dh-haskell
 Architecture: all
-Depends: ${shlibs:Depends}, ${misc:Depends},
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends},
  debhelper (>= 9.20151220),
  dh-buildinfo,
  libparse-debcontrol-perl,


=====================================
lib/Debian/Debhelper/Buildsystem/haskell.pm
=====================================
--- a/lib/Debian/Debhelper/Buildsystem/haskell.pm
+++ b/lib/Debian/Debhelper/Buildsystem/haskell.pm
@@ -58,6 +58,7 @@ use parent qw(Debian::Debhelper::Buildsystem);
 use Readonly;
 use File::Find;
 use File::chdir;
+use File::Copy;
 use List::MoreUtils qw(any uniq);
 use Carp::Assert;
 
@@ -610,9 +611,17 @@ where I<SHORT_HASH> is first 5 digits of I<HASH>.
 =cut
 
 sub cabal_id_to_virtual_package {
-    my ( $flavor, $cabal_id ) = @_;
-    my ( $name, $version, $short_hash ) =
-      ( $cabal_id =~ m/^(.*)-([.0-9]+)-([0-9a-f]{5})[0-9a-f]{27}$/ );
+    my ( $flavor, $cabal_id, $db ) = @_;
+    my $command = "ghc-pkg --simple field '$cabal_id'";
+    if ($db) {
+        $command .= " --package-db '$db'";
+    }
+    my $name = `$command name` || die $!;
+    print "$name\n";
+    my $version = `$command version` || die $1;
+    print "$version\n";
+    my ($short_hash) = (`$command abi` || die $1) =~ m/^(.{5})/;
+    print "$short_hash\n";
     $name =~ s/(.*)/\L\1/;
     shouldnt( $flavor, 'doc' );
 
@@ -620,11 +629,11 @@ sub cabal_id_to_virtual_package {
 }
 
 sub substitute_provides {
-    my ($config) = @_;
+    my ($config, $tmp_db) = @_;
     my $id = $config->[0]->{'id'};
 
     for_binpkg qw(dev prof), sub {
-        my $provides = cabal_id_to_virtual_package( $type, $id );
+        my $provides = cabal_id_to_virtual_package( $type, $id, $tmp_db );
         addsubstvar( $binpkg, "haskell:Provides", $provides );
     };
 
@@ -774,13 +783,23 @@ sub manual_dh_shlibdeps {
     print_and_doit( 'rm', '-f', "$probefile.c", $probefile );
 }
 
+sub create_tmp_db {
+    my ($pkg_config) = @_;
+    my $tmp_db = "debian/tmp_db";
+    mkdir $tmp_db;
+    copy $pkg_config, $tmp_db;
+    print_and_doit('ghc-pkg', 'recache', '--package-db', $tmp_db);
+    return $tmp_db
+}
+
 sub install {
     run_setup( 'copy', "--destdir=$TMP_INSTALL_DIR" );
     do_install( do_dispatch() );
     my $pkg_config = install_pkg_config;
     if ( defined $pkg_config ) {
         my $config = new Parse::DebControl->parse_file($pkg_config);
-        substitute_provides $config;
+        my $tmp_db = create_tmp_db $pkg_config;
+        substitute_provides $config, $tmp_db;
         substitute_depends $config;
         if (USE_LEGACY) {
             manual_dh_shlibdeps $config;
@@ -797,6 +816,7 @@ sub clean {
     print_and_doit( 'rm', '-f', $SETUP_BIN_NAME );
     print_and_doit( 'rm', '-fr', $TMP_INSTALL_DIR );
     print_and_doit( 'rm', '-fr', $HC_BUILD_DIR );
+    print_and_doit( 'rm', '-fr', 'debian/tmp_db');
     for my $binpkg ( @{ $dh{DOPACKAGES} } ) {
         print_and_doit( 'rm', '-fr', "debian/$binpkg" );
     }



View it on GitLab: https://salsa.debian.org/haskell-team/dh-haskell/compare/91b10d34153ad2f3c4d2bd782753b67158e459ba...056b76f06629aeb5cdd4ac4f3bf31309004f0fc8

---
View it on GitLab: https://salsa.debian.org/haskell-team/dh-haskell/compare/91b10d34153ad2f3c4d2bd782753b67158e459ba...056b76f06629aeb5cdd4ac4f3bf31309004f0fc8
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-haskell-commits/attachments/20180121/d95ec5d7/attachment-0001.html>


More information about the Pkg-haskell-commits mailing list