[Pkg-octave-commit] r1451 - in octave-pkg-dev/trunk: . debian

Rafael Laboissiere rafael at alioth.debian.org
Sat Mar 22 11:59:23 UTC 2008


Author: rafael
Date: 2008-03-22 11:59:23 +0000 (Sat, 22 Mar 2008)
New Revision: 1451

Modified:
   octave-pkg-dev/trunk/debian/changelog
   octave-pkg-dev/trunk/octave-pkg-dev.pl.in
Log:
Automatically add dependency relations to other octave-forge packages
by inspecting the DESCRIPTION file (if present)

Modified: octave-pkg-dev/trunk/debian/changelog
===================================================================
--- octave-pkg-dev/trunk/debian/changelog	2008-03-22 10:01:06 UTC (rev 1450)
+++ octave-pkg-dev/trunk/debian/changelog	2008-03-22 11:59:23 UTC (rev 1451)
@@ -1,3 +1,10 @@
+octave-pkg-dev (0.4) UNRELEASED; urgency=low
+
+  * octave-pkg-dev.pl.in: Automatically add dependency relations to other
+    octave-forge packages by inspecting the DESCRIPTION file (if present)
+
+ -- Rafael Laboissiere <rafael at debian.org>  Sat, 22 Mar 2008 12:58:59 +0100
+
 octave-pkg-dev (0.3.1) unstable; urgency=low
 
   * octave-pkg-dev.mk.in:

Modified: octave-pkg-dev/trunk/octave-pkg-dev.pl.in
===================================================================
--- octave-pkg-dev/trunk/octave-pkg-dev.pl.in	2008-03-22 10:01:06 UTC (rev 1450)
+++ octave-pkg-dev/trunk/octave-pkg-dev.pl.in	2008-03-22 11:59:23 UTC (rev 1451)
@@ -27,9 +27,37 @@
 
 init ();
 
+my $description = qx {tar tfz *.tar.gz | grep DESCRIPTION};
+my %depends = ();
+
+if ($description ne "") {
+    my $deps;
+    system "tar xfz *.tar.gz --strip=1 $description";
+    if (open (DESC, "< DESCRIPTION")) {
+        while (<DESC>) {
+            if (/Depends: (.*)/) {
+                $deps = $1;
+                last;
+            }
+        }
+        close DESC;
+        unlink "DESCRIPTION";
+        map {
+            if (/([^ ]+) \((.*)\)/) {
+                $depends {"octave-$1"} = $2;
+            } else {
+                $depends {"octave-$_"} = "";
+            }
+        } grep {not /^octave/} split (", ", $deps);
+    }
+}
+
 foreach my $package (@{$dh{DOPACKAGES}}) {
     delsubstvar ($package, 'octave:Depends');
     addsubstvar ($package, 'octave:Depends', '@PACKAGE@', '>= @VERSION@');
+    for my $pkg (keys %depends) {
+        addsubstvar ($package, 'octave:Depends', $pkg, $depends {$pkg});
+    }
     autoscript ($package, 'postinst', 'postinst', 's/#PACKAGE#/@PACKAGE@/');
     autoscript ($package, 'prerm', 'prerm', 's/#PACKAGE#/@PACKAGE@/');
 }




More information about the Pkg-octave-commit mailing list