[Pkg-haskell-commits] r831 - in /packages/haskell-devscripts/trunk: debian/changelog dh_haskell dh_haskell_prep

arjan at users.alioth.debian.org arjan at users.alioth.debian.org
Sun Dec 30 18:09:50 UTC 2007


Author: arjan
Date: Sun Dec 30 18:09:50 2007
New Revision: 831

URL: http://svn.debian.org/wsvn/pkg-haskell/?sc=1&rev=831
Log:
[project @ change dh_haskell she-bang line]

Original author: Arjan Oosting <arjanoosting at home.nl>
Date: 2006-10-06 21:23:36+00:00

Modified:
    packages/haskell-devscripts/trunk/debian/changelog
    packages/haskell-devscripts/trunk/dh_haskell
    packages/haskell-devscripts/trunk/dh_haskell_prep

Modified: packages/haskell-devscripts/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-devscripts/trunk/debian/changelog?rev=831&op=diff
==============================================================================
--- packages/haskell-devscripts/trunk/debian/changelog (original)
+++ packages/haskell-devscripts/trunk/debian/changelog Sun Dec 30 18:09:50 2007
@@ -1,6 +1,8 @@
 haskell-devscripts (0.5.13~arjan1) unstable; urgency=low
 
   * Move debhelper to Build-Depends as suggested by lintian.
+  * Change she-bang for dh_haskell to /bin/sh as does not use any
+    bashims. 
 
  -- Arjan Oosting <arjanoosting at home.nl>  Fri,  6 Oct 2006 22:30:10 +0200
 

Modified: packages/haskell-devscripts/trunk/dh_haskell
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-devscripts/trunk/dh_haskell?rev=831&op=diff
==============================================================================
--- packages/haskell-devscripts/trunk/dh_haskell (original)
+++ packages/haskell-devscripts/trunk/dh_haskell Sun Dec 30 18:09:50 2007
@@ -1,266 +1,6 @@
-#!/usr/bin/perl -w
-# arch-tag: Debhelper script for Haskell
-#
-# Copyright (C) 2004 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
-#    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.
+#!/bin/sh
 
-#    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#
+set -e
+dh_haskell_prep "$@"
+dh_haskell_buildinst "$@"
 
-=head1 NAME
-
-dh_haskell - Builds Cabalized libraries, calculates Haskell dependencies, and adds postinst and prerm Haskell scripts
-
-=cut
-
-use strict;
-use File::Find;
-use Debian::Debhelper::Dh_Lib;
-
-=head1 SYNOPSIS
-
-B<dh_haskell> [S<I<debhelper options>>] 
-
-=head1 DESCRIPTION
-
-dh_haskell is a debhelper program that helps with building Haskell libraries.
-
-It does several things.  It can generate postinst and prerm scripts when
-necessary.  It automates building libraries for the different supported
-Haskell systems in Debian.  It generates substvars for your control
-file so that the library packages depend on the appropriate packages.
-In short, it can drive the entire process.
-
-=head1 REQUIREMENTS
-
-dh_haskell assumes that your packages are adhering to the draft Haskell policy.
-
-Your control file must build the binary library files using packages
-named libI<type>-I<name>-I<variation>, where I<type> is ghc5, ghc6, or
-nhc98; I<name> is the name of your package; and I<variation> is dev or
-prof. These packages should be Architecture: any.
-
-The I<prof> package contains profiling enabled libraries. Currently
-only GHC supports profiling. Due to restrictions of the GHC compiler,
-if you provide a I<dev> package you should also provide a
-corresponding I<prof> package.
-
-If you build a Hugs package, name it libhugs-I<name>.  However, dh_haskell
-will also accept libhugs-I<name>-dev for consistency.  Most Hugs packages
-should be Architecture: all.  If your package uses foreign methods,
-maybe it should be Architecture: any (please let me know if you have
-an answer to that).
-
-dh_haskell figures out how to build your package based on the I<type>,
-so you must adhere to this naming scheme.
-
-dh_haskell assumes that the Haskell Cabal (see www.haskell.org/cabal) can
-be used to build your package.  It obtains package name and version
-information from the Cabal Setup.Description file.
-
-=head1 HOW TO PACKAGE A HASKELL LIBRARY
-
-Start from a basic debian/ directory.  Add entries to Build-Depends for
-haskell-devscripts and the compilers for any binaries you will build.
-
-In the clause in control for each binary package, make sure to add
-${haskell:Depends} to the Depends: line.
-
-In rules, in the install target, add dh_haskell.  Your build and configure
-targets should be empty.
-
-Remember that you should add -a to all debhelper calls for multi-binary
-packages.  That goes for dh_haskell too.
-
-Your clean target should contain:
-
-C<-./setup clean>
-C<--rm -rf setup Setup.hi Setup.ho Setup.o .*config* dist>
-
-That's it.  dh_haskell does the rest.
-
-=head1 EXAMPLES
-
-See the Debian source package for hunit.
-
-also see:
-
-darcs get --partial http://www.n-heptane.com/nhlab/repos/cabalDebianTemplate/
-
-=cut
-
-init();
-
-sub is_handled_package {
-    my $pkgname = shift;
-    if ($pkgname =~ m/^lib(ghc5|ghc6|nhc98|hugs)-.+-dev$/) {
-        return 1;
-    } elsif ($pkgname =~ m/libhugs-.+$/) {
-        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 dev_name {
-    my $package = shift;
-    my @pn = ($package =~ m/^lib(ghc5|ghc6|nhc98|hugs)-(.+)-prof$/);
-    return "lib$pn[0]-$pn[1]-dev";
-}
-
-sub type_of_package {
-    my $pkgname = shift;
-    if ($pkgname =~ m/^libhugs-.+$/) {
-        return "hugs";
-    } else {
-        my @pn = ($pkgname =~ m/^lib(ghc5|ghc6|nhc98|hugs)-.+-(dev|prof)$/);
-        return $pn[0];
-    }
-}
-
-sub version_of_debpkg {
-    my $pkgname = shift;
-    my $retval = `dpkg -s $pkgname | grep -i ^Version | awk '{print \$2}'`;
-    chomp $retval;
-    return $retval;
-    }
-
-sub version_of_type {
-    my $pkgtype = shift;
-    return version_of_debpkg($pkgtype);
-}
-
-sub upstream_version {
-    my $inver = shift;
-    if ($inver =~ m/-/) {
-        my @v = ($inver =~ m/^(.+)-[^-]+$/);
-        return $v[0];
-    }
-}
-            
-
-sub getcabalname {
-    my $retval = `grep -i ^Name *.cabal | awk '{print \$2}'`;
-    chomp $retval;
-    return $retval;
-}
-
-sub getcabalversion {
-    my $retval = `grep -i ^Version *.cabal | awk '{print \$2}'`;
-    chomp $retval;
-    return $retval;
-}
-
-sub getcabalnameversion {
-    return getcabalname() . "-" . getcabalversion();
-}
-
-sub getcabalbasepath {
-    my $pkgtype = shift;
-    return "/usr/lib/haskell-packages/$pkgtype";
-}
-
-sub getcabalpkglibpath {
-    my $pkgtype = shift;
-    return getcabalbasepath($pkgtype) . "/lib/" . getcabalnameversion();
-}
-
-sub safesystem {
-    my $program = shift;
-    print "Running: $program\n";
-    system($program) == 0
-        or die "$program files: $?";
-}
-
-print "Generating meta-information...\n";
-
-foreach my $package (@{$dh{DOPACKAGES}}) {
-	my $tmp = tmpdir($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%");
-                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)));
-	    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);
-	    addsubstvar($package, "haskell:Depends",
-			dev_name($package), "= " . $dh{VERSION});
-
-	    # add depends on ghc?-prof
-	    if (($pkgtype eq "ghc5" || $pkgtype eq "ghc6")) {
-		addsubstvar($package, "haskell:Depends",
-			    $pkgtype . "-prof");
-	    }
-	}
-}
-
-=head1 BUGS
-
-hugs, ghc6, and ghc5 are the only supported targets at the moment.  Cabal does
-not yet support nhc98.  Note though that there are some known bugs in
-Cabal relating to ghc5 support.
-
-=head1 SEE ALSO
-
-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

Modified: packages/haskell-devscripts/trunk/dh_haskell_prep
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-devscripts/trunk/dh_haskell_prep?rev=831&op=diff
==============================================================================
--- packages/haskell-devscripts/trunk/dh_haskell_prep (original)
+++ packages/haskell-devscripts/trunk/dh_haskell_prep Sun Dec 30 18:09:50 2007
@@ -36,7 +36,7 @@
 
 dh_haskell is a debhelper program that helps with building Haskell libraries.
 
-It does several things.  It can generat postinst and prerm scripts when
+It does several things.  It can generate postinst and prerm scripts when
 necessary.  It automates building libraries for the different supported
 Haskell systems in Debian.  It generates substvars for your control
 file so that the library packages depend on the appropriate packages.
@@ -46,10 +46,15 @@
 
 dh_haskell assumes that your packages are adhering to the draft Haskell policy.
 
-Your control file must build the binary library files using packages named
-libI<type>-I<name>-dev, where I<type> is ghc5, ghc6, or nhc98; and
-I<name> is the name of your package.  These packages should be Architecture:
-any.
+Your control file must build the binary library files using packages
+named libI<type>-I<name>-I<variation>, where I<type> is ghc5, ghc6, or
+nhc98; I<name> is the name of your package; and I<variation> is dev or
+prof. These packages should be Architecture: any.
+
+The I<prof> package contains profiling enabled libraries. Currently
+only GHC supports profiling. Due to restrictions of the GHC compiler,
+if you provide a I<dev> package you should also provide a
+corresponding I<prof> package.
 
 If you build a Hugs package, name it libhugs-I<name>.  However, dh_haskell
 will also accept libhugs-I<name>-dev for consistency.  Most Hugs packages
@@ -85,9 +90,13 @@
 
 That's it.  dh_haskell does the rest.
 
-=head1 EXAMPLE
+=head1 EXAMPLES
 
 See the Debian source package for hunit.
+
+also see:
+
+darcs get --partial http://www.n-heptane.com/nhlab/repos/cabalDebianTemplate/
 
 =cut
 
@@ -104,19 +113,34 @@
     }
 }
 
+sub is_handled_profiling {
+    my $pkgname = shift;
+    if ($pkgname =~ m/^lib(ghc5|ghc6|nhc98|hugs)-.+-prof$/) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+sub dev_name {
+    my $package = shift;
+    my @pn = ($package =~ m/^lib(ghc5|ghc6|nhc98|hugs)-(.+)-prof$/);
+    return "lib$pn[0]-$pn[1]-dev";
+}
+
 sub type_of_package {
     my $pkgname = shift;
     if ($pkgname =~ m/^libhugs-.+$/) {
         return "hugs";
     } else {
-        my @pn = ($pkgname =~ m/^lib(ghc5|ghc6|nhc98|hugs)-.+-dev$/);
+        my @pn = ($pkgname =~ m/^lib(ghc5|ghc6|nhc98|hugs)-.+-(dev|prof)$/);
         return $pn[0];
     }
 }
 
 sub version_of_debpkg {
     my $pkgname = shift;
-    my $retval = `dpkg -s $pkgname | grep ^Version | awk '{print \$2}'`;
+    my $retval = `dpkg -s $pkgname | grep -i ^Version | awk '{print \$2}'`;
     chomp $retval;
     return $retval;
     }
@@ -136,13 +160,13 @@
             
 
 sub getcabalname {
-    my $retval = `grep ^Name *.cabal | awk '{print \$2}'`;
+    my $retval = `grep -i ^Name *.cabal | awk '{print \$2}'`;
     chomp $retval;
     return $retval;
 }
 
 sub getcabalversion {
-    my $retval = `grep ^Version *.cabal | awk '{print \$2}'`;
+    my $retval = `grep -i ^Version *.cabal | awk '{print \$2}'`;
     chomp $retval;
     return $retval;
 }
@@ -173,7 +197,9 @@
 foreach my $package (@{$dh{DOPACKAGES}}) {
 	my $tmp = tmpdir($package);
 
+
         if (is_handled_package($package)) {
+	    # substitute ${haskell:Depends}
             my $pkgtype = type_of_package($package);
             delsubstvar($package, "haskell:Depends");
             addsubstvar($package, "haskell:Depends", 
@@ -182,7 +208,8 @@
                 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));
@@ -198,6 +225,26 @@
             }
         }
 
+        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)));
+	    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);
+	    addsubstvar($package, "haskell:Depends",
+			dev_name($package), "= " . $dh{VERSION});
+
+	    # add depends on ghc?-prof
+	    if (($pkgtype eq "ghc5" || $pkgtype eq "ghc6")) {
+		addsubstvar($package, "haskell:Depends",
+			    $pkgtype . "-prof");
+	    }
+	}
 }
 
 =head1 BUGS




More information about the Pkg-haskell-commits mailing list