[Pkg-haskell-commits] r1137 - in /packages/haskell-devscripts/trunk: debian/changelog dh_haskell_install

arjan at users.alioth.debian.org arjan at users.alioth.debian.org
Tue Mar 25 22:34:34 UTC 2008


Author: arjan
Date: Tue Mar 25 22:34:34 2008
New Revision: 1137

URL: http://svn.debian.org/wsvn/pkg-haskell/?sc=1&rev=1137
Log:
 r37 at reddwarf:  arjan | 2008-03-25 23:26:01 +0100
 dh_install:
 - Make sure where are in the right directory when dh_install is
 called. 
 - Remove all non profiling files from the generated profiling
 packages, (Closes: #472654) 

Modified:
    packages/haskell-devscripts/trunk/debian/changelog
    packages/haskell-devscripts/trunk/dh_haskell_install

Modified: packages/haskell-devscripts/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-devscripts/trunk/debian/changelog?rev=1137&op=diff
==============================================================================
--- packages/haskell-devscripts/trunk/debian/changelog (original)
+++ packages/haskell-devscripts/trunk/debian/changelog Tue Mar 25 22:34:34 2008
@@ -1,3 +1,13 @@
+haskell-devscripts (0.6.10~pre1) unstable; urgency=low
+
+  * dh_install:
+    - Make sure where are in the right directory when dh_install is
+      called. 
+    - Remove all non profiling files from the generated profiling
+      packages, (Closes: #472654) 
+
+ -- Arjan Oosting <arjan at debian.org>  Tue, 25 Mar 2008 21:53:07 +0100
+
 haskell-devscripts (0.6.9) unstable; urgency=low
 
   * prerm-ghc:

Modified: packages/haskell-devscripts/trunk/dh_haskell_install
URL: http://svn.debian.org/wsvn/pkg-haskell/packages/haskell-devscripts/trunk/dh_haskell_install?rev=1137&op=diff
==============================================================================
--- packages/haskell-devscripts/trunk/dh_haskell_install (original)
+++ packages/haskell-devscripts/trunk/dh_haskell_install Tue Mar 25 22:34:34 2008
@@ -22,7 +22,6 @@
 use strict;
 use Cwd;
 use File::Find;
-use File::Path;
 use Debian::Debhelper::Dh_Lib;
 
 use lib '/usr/share/haskell-devscripts/';
@@ -42,8 +41,15 @@
 	    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': $!";
+	doit("rmdir", "$File::Find::name");
+    }
+}
+
+sub remove_non_prof_file {
+    my $file = $_;
+
+    if (-f $file && ! ($file =~ /(_p\.a|\.p_hi)$/)) {
+	doit("rm", "-f", "$File::Find::name");
     }
 }
 
@@ -58,6 +64,13 @@
 
 init();
 
+my $cwd = getcwd();
+
+if (! -e "$cwd/debian/control") {
+    error("\"debian/control\" not found. Are you sure you are in the correct "
+	  . "directory?");
+}
+
 build_setup();
 
 foreach my $pkg (&getpackages("indep")) {
@@ -67,8 +80,9 @@
     }
 }
 
+
 foreach my $package (@{$dh{DOPACKAGES}}) {
-    my $tmp = getcwd() ."/" . tmpdir($package);
+    my $tmp = "$cwd/" . tmpdir($package);
     if (is_handled_package($package)) {
 	my $pkgtype = type_of_package($package);
 
@@ -77,100 +91,113 @@
 	print "\n ****************************************** \n\n";
 
 	my $builddir = builddir($package);
-	my $olddir = getcwd();
 	chdir($builddir);
 
 	if ($pkgtype eq "hugs") {
-	    mkpath("$tmp/usr/lib/hugs/packages/$cabalname");
+	    doit("install", "-d", "$tmp/usr/lib/hugs/packages/$cabalname");
 	    doit("./setup", "copy", "--destdir=$tmp");
 	    # remove LICENSE file and empty directories
 	    doit("rm", "-f", "$tmp/usr/share/doc/$cabalnameversion/LICENSE");
-	    finddepth({wanted => \&remove_emptydir}, "$tmp/usr/share/doc");
+	    finddepth({wanted => \&remove_emptydir}, "$tmp/usr/share/doc")
+		unless $dh{NO_ACT};
 	} elsif ($pkgtype eq "ghc6") {
 	    my $pkgdir = getcabalbasepath($pkgtype);
-	    mkpath("$tmp$pkgdir");
+	    doit("install", "-d", "$tmp$pkgdir");
 	    doit("./setup", "copy", "--destdir=$tmp");
 	    # Remove installed docs as the go into a separete package
-	    rmtree("$tmp/usr/lib/haskell-packages/ghc6/share/$cabalnameversion/doc/");
-	    rmtree("$tmp/usr/lib/haskell-packages/ghc6/share/doc/$cabalnameversion/");
+	    doit("rm", "-rf", "$tmp/usr/lib/haskell-packages/ghc6/share/"
+		 . "$cabalnameversion/doc/");
+	    doit("rm", "-rf", "$tmp/usr/lib/haskell-packages/ghc6/share/"
+		 . "doc/$cabalnameversion/");
 	    # Remove empty directories from package
-	    finddepth({wanted => \&remove_emptydir}, "$tmp/usr/lib");
+	    finddepth({wanted => \&remove_emptydir}, "$tmp/usr/lib")
+		unless $dh{NO_ACT};
 
 	    my $inconfig = package_description();
 
-	    open INCONFIG , "<", $inconfig or
-		die "Cannot read $inconfig: $!";
-	    open OUTCONFIG, ">", "$tmp" .
-		getcabalpkglibpath($pkgtype) . "/installed-pkg-config"
-		or die "Cannot write installed-pkg-config: $!";
-	    my $field;
-	    while (<INCONFIG>) {
-		chomp;
-		my $out;
-		if (/([^\s:]+):(.*)/) {
-		    $field = $1;
-		    print OUTCONFIG "$field:";
-		    $_ = $2;
+	    if ( ! $dh{NO_ACT}) {
+		open INCONFIG , "<", $inconfig or
+		    die "Cannot read $inconfig: $!";
+		open OUTCONFIG, ">", "$tmp" .
+		    getcabalpkglibpath($pkgtype) . "/installed-pkg-config"
+		    or die "Cannot write installed-pkg-config: $!";
+		my $field;
+		while (<INCONFIG>) {
+		    chomp;
+		    my $out;
+		    if (/([^\s:]+):(.*)/) {
+			$field = $1;
+			print OUTCONFIG "$field:";
+			$_ = $2;
+		    }
+		    if ($field =~ /\w+-dirs/) {
+			s/^\s+//;
+			s/\s+$//;
+			foreach my $dir (split(/\s+/, $_)) {
+			    if ($dir =~ /^$pkgdir/ ) {
+				if ( -d "$tmp$dir" ) {
+				    print OUTCONFIG " $dir";
+				} else {
+				    print "Removing non-existing directory "
+					. "$dir from the $field field.\n";
+				}
+			    } else {
+				if ( ! -d "$dir") {
+				    print "WARNING: package description file "
+					. "mentions non-existing directory \'"
+					. $dir . "\'\n";
+				}
+				print OUTCONFIG " $dir";
+			    }
+			}
+			print OUTCONFIG "\n";
+		    } elsif ($field eq "haddock-interfaces") {
+			if (defined($haddockpkg)) {
+			    if(cabal_version_ge(1.2)) {
+				s%.*/doc/$cabalnameversion/html/(.*\.haddock)%
+                             \ /usr/share/doc/$haddockpkg/html/$cabalname/$1%x;
+			    } else {
+				s%.*/doc(/html/.*\.haddock)%
+                             \ /usr/share/doc/$haddockpkg$1%x;
+			    }
+			    print OUTCONFIG "$_\n";
+			} else {
+			    print OUTCONFIG "\n";
+			}
+		    } elsif ($field eq "haddock-html") {
+			if (defined($haddockpkg)) {
+			    if(cabal_version_ge(1.2)) {
+				s%.*/doc/$cabalnameversion/html%
+                                \ /usr/share/doc/$haddockpkg/html/$cabalname%x;
+			    } else {
+				s%.*/doc(/html)% /usr/share/doc/$haddockpkg$1%;
+			    }
+			    print OUTCONFIG "$_\n";
+			} else {
+			    print OUTCONFIG "\n";
+			}
+		    } else {
+			print OUTCONFIG "$_\n";
+		    }
 		}
-		if ($field =~ /\w+-dirs/) {
-		    s/^\s+//;
-		    s/\s+$//;
-		    foreach my $dir (split(/\s+/, $_)) {
-			if ($dir =~ /^$pkgdir/ ) {
-			    if ( -d "$tmp$dir" ) {
-				print OUTCONFIG " $dir";
-			    } else {
-				print "Removing non-existing directory $dir "
-				    . "from the $field field.\n";
-			    }
-			} else {
-			    if ( ! -d "$dir") {
-				print "WARNING: package description file "
-				    . "mentions non-existing directory \'"
-				    . $dir . "\'\n";
-			    }
-			    print OUTCONFIG " $dir";
-			}
-		    }
-		    print OUTCONFIG "\n";
-		} elsif ($field eq "haddock-interfaces") {
-		    if (defined($haddockpkg)) {
-			if(cabal_version_ge(1.2)) {
-			    s%.*/doc/$cabalnameversion/html/(.*\.haddock)% /usr/share/doc/$haddockpkg/html/$cabalname/$1%;
-			} else {
-			    s%.*/doc(/html/.*\.haddock)% /usr/share/doc/$haddockpkg$1%;
-			}
-			print OUTCONFIG "$_\n";
-		    } else {
-			print OUTCONFIG "\n";
-		    }
-		} elsif ($field eq "haddock-html") {
-		    if (defined($haddockpkg)) {
-			if(cabal_version_ge(1.2)) {
-			    s%.*/doc/$cabalnameversion/html% /usr/share/doc/$haddockpkg/html/$cabalname%;
-			} else {
-			    s%.*/doc(/html)% /usr/share/doc/$haddockpkg$1%;
-			}
-			print OUTCONFIG "$_\n";
-		    } else {
-			print OUTCONFIG "\n";
-		    }
-		} else {
-		    print OUTCONFIG "$_\n";
-		}
+		close INCONFIG;
+		close OUTCONFIG;
 	    }
-	    close INCONFIG;
-	    close OUTCONFIG;
 	} elsif ($pkgtype eq "ghc6-prof") {
-	    mkpath("$tmp" . getcabalbasepath($pkgtype));
+	    doit("install", "-d", "$tmp" . getcabalbasepath($pkgtype));
 	    doit("./setup", "copy", "--destdir=$tmp");
-	    # Remove LICENSE file and empty directories from package
-	    doit("rm", "-f", "$tmp/usr/lib/haskell-packages/ghc6/share/doc/$cabalnameversion/LICENSE");
-	    finddepth({wanted => \&remove_emptydir}, "$tmp/usr/lib");
+	    # Remove the share directory and all none .p_hi and .p_a files.
+	    doit("rm", "-rf", "$tmp/usr/lib/haskell-packages/ghc6/share/");
+	    doit("rm", "-rf", "$tmp/usr/lib/haskell-packages/ghc6/lib/"
+		 . "$cabalnameversion/include");
+	    finddepth({wanted => \&remove_non_prof_file}, "$tmp/usr/lib")
+		unless $dh{NO_ACT};
+	    finddepth({wanted => \&remove_emptydir}, "$tmp/usr/lib")
+		unless $dh{NO_ACT};
 	} elsif ($pkgtype eq "haddock" ) {
-	    mkpath("$tmp" . "/usr/share/doc/$package");
+	    doit("install", "-d", "$tmp" . "/usr/share/doc/$package");
 	    doit("cp", "-ar", "dist/doc/html", "$tmp/usr/share/doc/$package");
 	}
-	chdir($olddir);
-    }
-}
+	chdir($cwd);
+    }
+}




More information about the Pkg-haskell-commits mailing list