[Pkg-haskell-commits] r860 - in /packages/haskell-devscripts/trunk: Dh_Haskell.pm debian/changelog debian/control debian/rules dh_haskell dh_haskell_build dh_haskell_install dh_haskell_prep

arjan at users.alioth.debian.org arjan at users.alioth.debian.org
Sun Dec 30 18:11:47 UTC 2007


Author: arjan
Date: Sun Dec 30 18:11:47 2007
New Revision: 860

URL: http://svn.debian.org/wsvn/pkg-haskell/?sc=1&rev=860
Log:
[project @ major upgrade]

Original author: Arjan Oosting <arjanoosting at home.nl>
Date: 2007-12-30 16:10:45+00:00

Modified:
    packages/haskell-devscripts/trunk/Dh_Haskell.pm
    packages/haskell-devscripts/trunk/debian/changelog
    packages/haskell-devscripts/trunk/debian/control
    packages/haskell-devscripts/trunk/debian/rules
    packages/haskell-devscripts/trunk/dh_haskell
    packages/haskell-devscripts/trunk/dh_haskell_build
    packages/haskell-devscripts/trunk/dh_haskell_install
    packages/haskell-devscripts/trunk/dh_haskell_prep

Modified: packages/haskell-devscripts/trunk/Dh_Haskell.pm
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-devscripts/trunk/Dh_Haskell.pm?rev=860&op=diff
==============================================================================
--- packages/haskell-devscripts/trunk/Dh_Haskell.pm (original)
+++ packages/haskell-devscripts/trunk/Dh_Haskell.pm Sun Dec 30 18:11:47 2007
@@ -24,49 +24,47 @@
 use Exporter;
 use vars qw(@ISA @EXPORT %dh);
 @ISA=qw(Exporter);
- at EXPORT = qw(&is_handled_package &is_handled_profiling
-	     &is_profiling_enabled &dev_name &type_of_package
+ at EXPORT = qw(&builddir &build_setup &is_handled_package
+	     &dev_name &type_of_package
 	     &version_of_debpkg &version_of_type &upstream_version
 	     &profiling_name &getcabalname &getcabalversion
-	     &getcabalbasepath &getcabalpkglibpath
+	     &getcabalbasepath &getcabalpkglibpath &getcabalpkgsharepath
 	     &safesystem);
+
+sub builddir {
+    my $package = shift;
+#    (my $pkgtype = shift) =~ s/haddock/ghc6/ ;
+    return "debian/tmp/build/$package/";
+}
+
+sub build_setup {
+    if (! -x "setup" ) {
+	print "Building setup...\n";
+	my $setup;
+	for my $candidate (qw(Setup.lhs Setup.hs)) {
+	    $setup = $candidate, last if -e $candidate;
+	}
+	die unless -e $setup;
+	safesystem("ghc6 -package Cabal $setup -o setup");
+    }
+}
 
 sub is_handled_package {
     my $pkgname = shift;
-    if ($pkgname =~ m/^lib(ghc5|ghc6|nhc98|hugs)-.+-dev$/) {
+    if ($pkgname =~ m/^lib(ghc6|hugs)-.+-(dev|prof)$/) {
 	return 1;
-    } elsif ($pkgname =~ m/libhugs-.+$/) {
+    } elsif ($pkgname =~ m/^libhugs-.+$/) {
+	return 1;
+    } elsif ($pkgname =~ m/^(haskell|libghc6)-.+doc$/) {
 	return 1;
     } else {
 	return 0;
     }
 }
 
-sub is_handled_profiling {
-    my $pkgname = shift;
-    if ($pkgname =~ m/^lib(ghc5|ghc6|nhc98|hugs)-.+-prof$/) {
-	return 1;
-    } else {
-	return 0;
-    }
-}
-
-sub is_profiling_enabled {
-    my $package = shift;
-    my $packages = shift;
-    my $profname = profiling_name($package);
-
-    foreach my $p (@{$packages}) {
-	if ($p =~ m/^$profname$/) {
-	    return 1;
-	}
-    }
-    return 0;
-}
-
 sub dev_name {
     my $package = shift;
-    my @pn = ($package =~ m/^lib(ghc5|ghc6|nhc98|hugs)-(.+)-prof$/);
+    my @pn = ($package =~ m/^lib(ghc6|hugs)-(.+)-prof$/);
     return "lib$pn[0]-$pn[1]-dev";
 }
 
@@ -74,9 +72,12 @@
     my $pkgname = shift;
     if ($pkgname =~ m/^libhugs-.+$/) {
 	return "hugs";
-    } else {
-	my @pn = ($pkgname =~ m/^lib(ghc5|ghc6|nhc98|hugs)-.+-(dev|prof)$/);
+    } elsif (my @pn = ($pkgname =~ m/^lib(ghc6|hugs)-.+-dev$/)) {
 	return $pn[0];
+    } elsif ($pkgname =~ m/^libghc6-.+-prof$/) {
+	return "ghc6-prof";
+    } elsif ($pkgname =~ m/^(haskell|libghc6)-.+-doc$/) {
+	return "haddock";
     }
 }
 
@@ -102,7 +103,7 @@
 
 sub profiling_name {
     my $package = shift;
-    my @pn = ($package =~ m/^lib(ghc5|ghc6|nhc98|hugs)-(.+)-dev$/);
+    my @pn = ($package =~ m/^lib(ghc6|hugs)-(.+)-dev$/);
     return "lib$pn[0]-$pn[1]-prof";
 }
 
@@ -124,12 +125,18 @@
 
 sub getcabalbasepath {
     my $pkgtype = shift;
+    $pkgtype =~ s/-prof// ;
     return "/usr/lib/haskell-packages/$pkgtype";
 }
 
 sub getcabalpkglibpath {
     my $pkgtype = shift;
     return getcabalbasepath($pkgtype) . "/lib/" . getcabalnameversion();
+}
+
+sub getcabalpkgsharepath {
+    my $pkgtype = shift;
+    return getcabalbasepath($pkgtype) . "/share/" . getcabalnameversion();
 }
 
 sub safesystem {

Modified: packages/haskell-devscripts/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-devscripts/trunk/debian/changelog?rev=860&op=diff
==============================================================================
--- packages/haskell-devscripts/trunk/debian/changelog (original)
+++ packages/haskell-devscripts/trunk/debian/changelog Sun Dec 30 18:11:47 2007
@@ -1,3 +1,40 @@
+haskell-devscripts (0.6.0~pre1) unstable; urgency=low
+
+  * New version with the following features:
+    - Separate build directories for each package haskell-devscripts
+      handles. Users can properly split the monolithic dh_haskell call
+      into a configure (dh_haskell_configure), build (dh_haskell_build)
+      and install (dh_haskell_install) step.
+    - Generates haddock generated API documentation, if the debian/control
+      files contains a package section which name matches
+      "haskell|libghc6)-.+-doc". The generated documentation is then
+      install in that package.
+    - Adds a new dh_haskell_depends command which generates the
+      ${haskell:Depends} substitution variable for each library package.
+      + For GHC6 libraries and GHC6 profiling libraries package this 
+        substitution variable contains a dependency on respectively ghc6
+        or ghc6-prof AND the (profiling) libraries the library depends on.
+      + For Hugs libraries it only contains a dependency on hugs. 
+  * Changes to generate haddock API documentation:
+    - Change Dh_haskell.pm to recognize packages which match
+      "haskell|libghc6)-.+-doc" as 'handled' packages.
+    - dh_haskell_build generates haddock API documentation.
+    - dh_haskell_install installs haddock API documentation.
+  * Stop shipping empty directories in generated libghc6-* packages: 
+    - dh_haskell_install removes directories which are empty after the
+      installation step.
+  * Add dh_haskell_depends script to package.
+  * Drop all code handling GHC 5 or nhc98 as Debian does not ship GHC5
+    anymore, and the code will most likely be broken now anyway:
+    - Cleanup dh_haskell_prep.
+    - Cleanup Dh_Haskell.pm.
+  * debian/control:
+    - Add xutils-dev to the Depends as dh_haskell_configure needs lndir.
+    - Add dctrl-tools to the Depends as dh_haskell_depends needs
+      grep-dctrl. 
+
+ -- Arjan Oosting <arjan at debian.org>  Sun, 30 Dec 2007 01:03:52 +0100
+
 haskell-devscripts (0.5.19) unstable; urgency=low
 
   * Make some cosmetic changes to the POD source of the man page(s) and

Modified: packages/haskell-devscripts/trunk/debian/control
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-devscripts/trunk/debian/control?rev=860&op=diff
==============================================================================
--- packages/haskell-devscripts/trunk/debian/control (original)
+++ packages/haskell-devscripts/trunk/debian/control Sun Dec 30 18:11:47 2007
@@ -9,7 +9,7 @@
 
 Package: haskell-devscripts
 Architecture: all
-Depends: debhelper, ghc6 (>= 6.4)
+Depends: dctrl-tools, debhelper, ghc6 (>= 6.4), xutils-dev
 Description: Tools to help Debian developers build Haskell packages
  This package provides a collection of scripts to help build Haskell
  packages for Debian.  Unlike haskell-utils, this package is not

Modified: packages/haskell-devscripts/trunk/debian/rules
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-devscripts/trunk/debian/rules?rev=860&op=diff
==============================================================================
--- packages/haskell-devscripts/trunk/debian/rules (original)
+++ packages/haskell-devscripts/trunk/debian/rules Sun Dec 30 18:11:47 2007
@@ -34,10 +34,7 @@
 	dh_clean -k 
 	dh_installdirs
 	pod2man --name=dh_haskell dh_haskell_build > dh_haskell.1
-	cp dh_haskell dh_haskell_install dh_haskell_buildinst dh_haskell_prep dh_haskell_build debian/haskell-devscripts/usr/bin/
-	cp p*-ghc debian/haskell-devscripts/usr/share/debhelper/autoscripts/
-	cp Dh_Haskell.pm debian/haskell-devscripts/usr/share/haskell-devscripts
-
+	dh_install
 
 binary-arch: build install
 # We have nothing to do by default.

Modified: packages/haskell-devscripts/trunk/dh_haskell
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-devscripts/trunk/dh_haskell?rev=860&op=diff
==============================================================================
--- packages/haskell-devscripts/trunk/dh_haskell (original)
+++ packages/haskell-devscripts/trunk/dh_haskell Sun Dec 30 18:11:47 2007
@@ -2,5 +2,7 @@
 
 set -e
 dh_haskell_prep "$@"
-dh_haskell_buildinst "$@"
+dh_haskell_configure "$@"
+dh_haskell_build "$@"
+dh_haskell_install "$@"
 

Modified: packages/haskell-devscripts/trunk/dh_haskell_build
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-devscripts/trunk/dh_haskell_build?rev=860&op=diff
==============================================================================
--- packages/haskell-devscripts/trunk/dh_haskell_build (original)
+++ packages/haskell-devscripts/trunk/dh_haskell_build Sun Dec 30 18:11:47 2007
@@ -1,7 +1,8 @@
 #!/usr/bin/perl -w
 # arch-tag: Debhelper script for Haskell
 #
-# Copyright (C) 2004 John Goerzen <jgoerzen at complete.org>
+# Copyright (C) 2004-2006 John Goerzen <jgoerzen at complete.org>
+#           (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 the GNU General Public License as published by
@@ -25,10 +26,12 @@
 =cut
 
 use strict;
+use Cwd;
 use File::Find;
 use Debian::Debhelper::Dh_Lib;
 
 use lib '/usr/share/haskell-devscripts/';
+#use lib '/home/arjan/checkout/haskell-devscripts/';
 use Dh_Haskell;
 
 =head1 SYNOPSIS
@@ -37,11 +40,15 @@
 
 B<dh_haskell_prep> [S<I<debhelper options>>]
 
+B<dh_haskell_configure> [S<I<debhelper options>>]
+
 B<dh_haskell_build> [S<I<debhelper options>>]
 
 B<dh_haskell_install> [S<I<debhelper options>>]
 
 B<dh_haskell_buildinst> [S<I<debhelper options>>]
+
+B<dh_haskell_depends> [S<I<debhelper options>>]
 
 =head1 DESCRIPTION
 
@@ -111,46 +118,39 @@
 
 =cut
 
+my @savedargv = @ARGV;
+
 init();
 
-if (! -x "setup" ) {
-    print "Building setup...\n";
-
-    my $setup;
-    for my $candidate (qw(Setup.lhs Setup.hs)) {
-	$setup = $candidate, last if -e $candidate;
-    }
-    die unless -e $setup;
-    safesystem("ghc6 -package Cabal $setup -o setup");
-}
+#build_setup();
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
     my $tmp = tmpdir($package);
     if (is_handled_package($package)) {
-        my $pkgtype = type_of_package($package);
-        
-        print "\n ****************************************** \n";
-        print " NOW BUILDING $package FOR $pkgtype\n";
-        print " OUTPUT TO $tmp\n\n";
-        
-        print "Cleaning...\n";
-        system("./setup clean");
-        safesystem("rm -f .*config*");
-        
-        if ($pkgtype eq "hugs") {
-            safesystem("./setup configure --hugs");
-            # Cabal always dies here.
-            print "Running: ./setup build\n";
-            system("./setup build");
-        } else {
-	    my $profiling_option = "";
-	    if (is_profiling_enabled($package,$dh{DOPACKAGES})) {
-		$profiling_option = " --enable-library-profiling ";
-	    }
-            safesystem("./setup configure " . $profiling_option . " --prefix=" . getcabalbasepath($pkgtype)
-                       . " --with-compiler=/usr/bin/$pkgtype");
-            safesystem("./setup build");
-        }
+	my $pkgtype = type_of_package($package);
+	my $builddir = builddir($package);
+
+	print "\n ****************************************** \n";
+	print " BUILDING $package FOR $pkgtype";
+	print "\n ****************************************** \n\n";
+
+	if (! -e "$builddir/.setup-config" ) {
+	    print "Running missing dh_haskell_configure call...\n";
+	    safesystem ("dh_haskell_configure", @savedargv);
+	    print "\n ****************************************** \n";
+	    print " CONTINUE BUILDING $package FOR $pkgtype";
+	    print "\n ****************************************** \n\n";
+	}
+
+
+	my $olddir = getcwd();
+	chdir($builddir);
+	if ( $pkgtype eq "haddock" ) {
+	    safesystem("./setup haddock");
+	} else {
+	    safesystem("./setup build");
+	}
+	chdir($olddir);
     }
 }
 

Modified: packages/haskell-devscripts/trunk/dh_haskell_install
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-devscripts/trunk/dh_haskell_install?rev=860&op=diff
==============================================================================
--- packages/haskell-devscripts/trunk/dh_haskell_install (original)
+++ packages/haskell-devscripts/trunk/dh_haskell_install Sun Dec 30 18:11:47 2007
@@ -1,7 +1,8 @@
 #!/usr/bin/perl -w
 # arch-tag: Debhelper script for Haskell
 #
-# Copyright (C) 2004 John Goerzen <jgoerzen at complete.org>
+# Copyright (C) 2004-2006 John Goerzen <jgoerzen at complete.org>
+#           (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 the GNU General Public License as published by
@@ -19,47 +20,110 @@
 #
 
 use strict;
+use Cwd;
 use File::Find;
+use File::Path;
 use Debian::Debhelper::Dh_Lib;
 
 use lib '/usr/share/haskell-devscripts/';
+#use lib '/home/arjan/checkout/haskell-devscripts/';
 use Dh_Haskell;
 
 init();
 
-if (! -x "setup" ) {
-    print "Building setup...\n";
-    my $setup;
-    for my $candidate (qw(Setup.lhs Setup.hs)) {
-	$setup = $candidate, last if -e $candidate;
+build_setup();
+
+sub remove_emptydir {
+    my $dir = $_;
+
+    if (-d $dir) {
+	opendir DH, $dir or die "Cannot open '$dir' : $!";
+	foreach my $file (readdir DH) {
+	    next if $file eq "." or $file eq "..";
+	    return;
+	}
+	print "Removing empty directory $File::Find::name\n";
+	rmdir $File::Find::name or die "Cannot remove 'dir': $!";
     }
-    die unless -e $setup;
-    safesystem("ghc6 -package Cabal $setup -o setup");
 }
 
-foreach my $package (@{$dh{DOPACKAGES}}) {
-    my $tmp = tmpdir($package);
-    if (is_handled_package($package)) {
-        my $pkgtype = type_of_package($package);
-        if ($pkgtype eq "hugs") {
-            safesystem("mkdir -p $tmp/usr/lib/hugs/packages/" . getcabalname());
-            safesystem("cp -rv dist/build/* $tmp/usr/lib/hugs/packages/" . getcabalname());
-        } else {
-            safesystem("mkdir -p $tmp/usr/share/doc/$package");
-            safesystem("mkdir -p $tmp" . getcabalbasepath($pkgtype));
-            safesystem("./setup copy --copy-prefix=$tmp" . getcabalbasepath($pkgtype));
-	    if (is_profiling_enabled($package, $dh{DOPACKAGES})) {
-		# Have to move all the profiling libraries into a
-		# seperate package. This seems a bit hackish though.
-		my $proftmp=tmpdir(profiling_name($package));
-		safesystem("mkdir -p $proftmp");
-		# NOTE: you might think you can using the -C option to
-		# tar instead using 'cd', but the --null disables -C
-		safesystem("find $tmp \\( -name \"*_p.a\" -o -name \"*.p_hi\" -o -name \"*.p_o\" \\) -printf \"%P\\0\" | " .
-			   "(cd $tmp ; tar -c --null --preserve --remove-files -T - ) | " .
-			   "tar -C $proftmp -x");
-	    }
-            safesystem("cp .installed-pkg-config $tmp" . getcabalpkglibpath($pkgtype) . "/installed-pkg-config");
-        }
+
+my $haddockpkg;
+foreach my $package (&getpackages("indep")) {
+    if (&is_handled_package($package) &&
+	&type_of_package($package) eq "haddock") {
+	$haddockpkg = $package
     }
 }
+
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+    my $tmp = getcwd() ."/" . tmpdir($package);
+    if (is_handled_package($package)) {
+	my $pkgtype = type_of_package($package);
+
+	print "\n ****************************************** \n";
+	print " INSTALLING $package FOR $pkgtype";
+	print "\n ****************************************** \n\n";
+
+	my $builddir = builddir($package);
+	my $olddir = getcwd();
+	chdir($builddir);
+
+	if ($pkgtype eq "hugs") {
+	    mkpath("$tmp/usr/lib/hugs/packages/" . getcabalname());
+	    safesystem("./setup copy --destdir=$tmp");
+	} elsif ($pkgtype eq "ghc6") {
+	    mkpath("$tmp" . getcabalbasepath($pkgtype));
+	    safesystem("./setup copy --destdir=$tmp");
+#	    safesystem("cp .installed-pkg-config $tmp" . 
+#		       getcabalpkglibpath($pkgtype) . "/installed-pkg-config");
+# Remove installed docs as the go into a separete package
+	    rmtree("$tmp" . getcabalpkgsharepath($pkgtype) . "/doc");
+# Remove empty directories from package
+	    finddepth({wanted => \&remove_emptydir}, "$tmp/usr/lib");
+
+	    open INCONFIG , "<", ".installed-pkg-config" or
+		die "Cannot read .installed-pkg-config: $!";
+	    open OUTCONFIG, ">", "$tmp" .
+		getcabalpkglibpath($pkgtype) . "/installed-pkg-config"
+		or die "Cannot write installed-pkg-config: $!";
+	    while (<INCONFIG>) {
+		chomp;
+		if (m%(\w+-dirs):\s+(.*)%) {
+		    $_ = "$1:";
+		    foreach my $dir (split(/\s+/, $2)) {
+			if ( -d "$tmp$dir" ) {
+			    $_ .= " $dir" ;
+			} else {
+			    print "Removing non-existing directory " .
+				$dir . " from $1 field";
+			}
+		    }
+		}
+		if (defined($haddockpkg)) {
+		    s%(haddock-interfaces:).*/doc(/html/.*\.haddock)%$1 /usr/share/doc/$haddockpkg$2%;
+		    s%(haddock-html:).*/doc(/html)%$1 /usr/share/doc/$haddockpkg$2%;
+		} else {
+		    s%(haddock-interfaces:).*%$1%;
+		    s%(haddock-html:).*%$1%;
+		}
+		print OUTCONFIG "$_\n";
+	    }
+	    close INCONFIG;
+	    close OUTCONFIG;
+# TODO: remove empty dirs from the .installed-pkg-config
+	} elsif ($pkgtype eq "ghc6-prof") {
+	    mkpath("$tmp" . getcabalbasepath($pkgtype));
+	    safesystem("./setup copy --destdir=$tmp");
+# Remove empty directories from package
+	    finddepth({wanted => \&remove_emptydir}, "$tmp/usr/lib");
+	} elsif ($pkgtype eq "haddock" ) {
+	    mkpath("$tmp" . "/usr/share/doc/$package");
+	    safesystem("cp -ar dist/doc/* $tmp" .
+		       "/usr/share/doc/$package");
+	}
+
+	chdir($olddir);
+    }
+}

Modified: packages/haskell-devscripts/trunk/dh_haskell_prep
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-devscripts/trunk/dh_haskell_prep?rev=860&op=diff
==============================================================================
--- packages/haskell-devscripts/trunk/dh_haskell_prep (original)
+++ packages/haskell-devscripts/trunk/dh_haskell_prep Sun Dec 30 18:11:47 2007
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 # arch-tag: Debhelper script for Haskell
 #
-# Copyright (C) 2004 John Goerzen <jgoerzen at complete.org>
+# Copyright (C) 2004-2006 John Goerzen <jgoerzen at complete.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
@@ -23,6 +23,7 @@
 use Debian::Debhelper::Dh_Lib;
 
 use lib '/usr/share/haskell-devscripts/';
+#use lib '/home/arjan/checkout/haskell-devscripts/';
 use Dh_Haskell;
 
 init();
@@ -33,41 +34,43 @@
 	my $tmp = tmpdir($package);
 
 
-        if (is_handled_package($package)) {
+	if (is_handled_package($package)) {
 	    # substitute ${haskell:Depends}
-            my $pkgtype = type_of_package($package);
-            delsubstvar($package, "haskell:Depends");
-            addsubstvar($package, "haskell:Depends", 
-                        $pkgtype, ">= " . upstream_version(version_of_type($pkgtype)));
-            if (! ($pkgtype eq "hugs")) {
-                addsubstvar($package, "haskell:Depends",
-                            $pkgtype, "<< " . upstream_version(version_of_type($pkgtype)) . "-999");
-            }
-
-	    # add postinst/prerm scripts
-            if ($pkgtype eq "ghc5" || $pkgtype eq "ghc6") {
-                # Build scripts
-                my $ghcver = "ghc-" . upstream_version(version_of_type($pkgtype));
-                my $pkglibdir = getcabalpkglibpath($pkgtype);
-                my $cabalname = getcabalname();
-                my $cabalversion = getcabalversion();
-
-                print "$ghcver $pkglibdir $cabalname $cabalversion\n";
-                autoscript($package,"postinst","postinst-ghc",
-                           "s%#GHCVER#%$ghcver%;s%#PKGLIBDIR#%$pkglibdir%;s%#CABALNAME#%$cabalname%;s%#CABALVERSION#%$cabalversion%");
-                autoscript($package,"prerm","prerm-ghc",
-                           "s%#GHCVER#%$ghcver%;s%#PKGLIBDIR#%$pkglibdir%;s%#CABALNAME#%$cabalname%;s%#CABALVERSION#%$cabalversion%");
-            }
-        }
-
-        if (is_handled_profiling($package)) {
-	    # substitute ${haskell:Depends} for profiling package
 	    my $pkgtype = type_of_package($package);
 	    delsubstvar($package, "haskell:Depends");
 	    addsubstvar($package, "haskell:Depends", 
 			$pkgtype, ">= " . upstream_version(version_of_type($pkgtype)));
+	    if (! ($pkgtype eq "hugs")) {
+		addsubstvar($package, "haskell:Depends",
+			    $pkgtype, "<< " . upstream_version(version_of_type($pkgtype)) . "-999");
+	    }
+
+	    # add postinst/prerm scripts
+	    if ($pkgtype eq "ghc6") {
+		# Build scripts
+		my $ghcver = "ghc-" . upstream_version(version_of_type($pkgtype));
+		my $pkglibdir = getcabalpkglibpath($pkgtype);
+		my $cabalname = getcabalname();
+		my $cabalversion = getcabalversion();
+
+		print "$ghcver $pkglibdir $cabalname $cabalversion\n";
+		autoscript($package,"postinst","postinst-ghc",
+			   "s%#GHCVER#%$ghcver%;s%#PKGLIBDIR#%$pkglibdir%;s%#CABALNAME#%$cabalname%;s%#CABALVERSION#%$cabalversion%");
+		autoscript($package,"prerm","prerm-ghc",
+			   "s%#GHCVER#%$ghcver%;s%#PKGLIBDIR#%$pkglibdir%;s%#CABALNAME#%$cabalname%;s%#CABALVERSION#%$cabalversion%");
+	    }
+	}
+
+	if (type_of_package($package) eq "ghc6-prof") {
+	    # substitute ${haskell:Depends} for profiling package
+	    my $pkgtype = type_of_package($package);
+	    delsubstvar($package, "haskell:Depends");
 	    addsubstvar($package, "haskell:Depends",
-			$pkgtype, "<< " . upstream_version(version_of_type($pkgtype)) . "-999");
+			$pkgtype, ">= " .
+			upstream_version(version_of_type($pkgtype)));
+	    addsubstvar($package, "haskell:Depends",
+			$pkgtype, "<< " .
+			upstream_version(version_of_type($pkgtype)) . "-999");
 	    # Call isnative becuase it sets $dh{VERSION}
 	    # as a side effect.
 	    isnative($package);
@@ -75,9 +78,6 @@
 			dev_name($package), "= " . $dh{VERSION});
 
 	    # add depends on ghc?-prof
-	    if (($pkgtype eq "ghc5" || $pkgtype eq "ghc6")) {
-		addsubstvar($package, "haskell:Depends",
-			    $pkgtype . "-prof");
-	    }
+	    addsubstvar($package, "haskell:Depends", $pkgtype . "-prof");
 	}
 }




More information about the Pkg-haskell-commits mailing list