Debian Weekly News - Mail Page

Date: Sun, 10 Jan 1999 13:31:09 -0500
From: Ben Collins <bmc@visi.net>
To: debian-devel@lists.debian.org
Cc: debian-dpkg@lists.debian.org
Subject: Source-Depends implementation
X-Mailer: Mutt 0.95i
X-Mailing-List: <debian-devel@lists.debian.org> archive/latest/24697

This is a little hack to dpkg-source and controllib.pl to allow for a
Source-Depends field in the general control file section. People have
been asking for it, so here it is if any one wants to write the policy
for using it.

IMO, nothing from the base list should be in the Source-Depends field.
Just non-standard -devs and special binary packages (ie. sgml, tetex,
nasm). There is no versioning of the Source-Depends either since I
didn't think it would be necessary. You may feel differently.

All it does is included the Source-Depends field into the .dsc file.
This can later be used by apt or dbuild/buildd to verify that all
needed packages are installed for building. I also made
'dpkg-source -x' check the list to make sure everything is installed,
it only gives a warning otherwise.

The hack I used for checking whether a package was installed is `dpkg
-l $buildpackage`. There is probably a better way, so feel free to fix
that. Also, I did no error checking on the field content (missing ','
and such)

The only change in controllib.pl was the Source-Depends field needed to
be added to a list of fields that required a second capitol letter.

I'll leave it up to you people as to whether or not it fulfills our needs
and to Ian as to whether or not it makes it into the dpkg source.

--
-----    -- - -------- --------- ----  -------  -----  - - ---   --------
Ben Collins <b.m.collins@larc.nasa.gov>                  Debian GNU/Linux
UnixGroup Admin - Jordan Systems Inc.                 bcollins@debian.org
------ -- ----- - - -------   ------- -- The Choice of the GNU Generation

--- dpkg-1.4.1/debian/changelog
+++ dpkg-1.4.1.1/debian/changelog
@@ -1,3 +1,9 @@
+dpkg (1.4.1.1) unstable; urgency=low
+
+  * Modified dpkg-source to enable using Source-Depends
+
+ -- Ben Collins <bcollins@debian.org>  Sun, 10 Jan 1999 11:36:15 -0500
+
 dpkg (1.4.1) unstable; urgency=low

   * Maintainer release by IWJ.
--- dpkg-1.4.1/scripts/controllib.pl
+++ dpkg-1.4.1.1/scripts/controllib.pl
@@ -1,7 +1,8 @@

 $parsechangelog= 'dpkg-parsechangelog';

-grep($capit{lc $_}=$_, qw(Pre-Depends Standards-Version Installed-Size));
+grep($capit{lc $_}=$_, qw(Pre-Depends Standards-Version Installed-Size
+     Source-Depends));

 $substvar{'Format'}= 1.5;
 $substvar{'Newline'}= "\n";
--- dpkg-1.4.1/scripts/dpkg-source.pl
+++ dpkg-1.4.1.1/scripts/dpkg-source.pl
@@ -1,7 +1,7 @@

 my $dpkglibdir = ".";
-my $version = "1.3.0"; # This line modified by Makefile
+my $version = "1.3.1"; # This line modified by Makefile

 my @filesinarchive;
 my %dirincluded;
@@ -51,7 +51,8 @@

 $i = 100;
 grep ($fieldimps {$_} = $i--,
-      qw (Source Version Binary Maintainer Architecture Standards-Version));
+      qw (Source Version Binary Maintainer Architecture Standards-Version
+	  Source-Depends));

 while (@ARGV && $ARGV[0] =~ m/^-/) {
     $_=shift(@ARGV);
@@ -146,7 +147,7 @@
                 $f{$_}= $v;
             } elsif (m/^(Package|Essential|Pre-Depends|Depends|Provides)$/ ||
                      m/^(Recommends|Suggests|Optional|Conflicts|Replaces)$/ ||
-                     m/^(Description|Section|Priority)$/ ||
+                     m/^(Description|Section|Priority|Source-Depends)$/ ||
                      m/^X[CS]+-/i) {
             } else {
                 &unknown("package's section of control info file");
@@ -155,7 +156,7 @@
             if (m/^Source$/) {
                 &setsourcepackage;
-            } elsif (m/^Version$/) {
+            } elsif (m/^Version$|^Source-Depends$/) {
                 $f{$_}= $v;
             } elsif (s/^X[BS]*C[BS]*-//i) {
                 $f{$_}= $v;
@@ -476,6 +477,15 @@
     $sourcepackage =~ m/^[0-9a-z]./ ||
         &error("source package name is too short or starts with non-alphanum");

+    $sourcedepends = $fi{'S Source-Depends'};
+    if ($sourcedepends ne "") {
+	for $buildpackage (split(',', $sourcedepends)) {
+	    $temp = `dpkg -l $buildpackage`;
+	    if ($temp eq "") {
+		&warn("Source-Depends: $buildpackage is not installed");
+	    }
+	}
+    }
     $version= $fi{'S Version'};
     $version =~ m/[^-+:.0-9a-zA-Z]/ &&
         &error("version number contains illegal character \`$&'");

To receive this newsletter weekly in your mailbox, subscribe to the debian-news mailing list.

Back issues of this newsletter are available.

This issue of Debian Weekly News was edited by Joey Hess.