Przeglądaj źródła

Implement support for Homepage field.

Guillem Jover 19 lat temu
rodzic
commit
db992d8325

+ 14 - 0
ChangeLog

@@ -1,3 +1,17 @@
+2007-08-20  Guillem Jover  <guillem@debian.org>
+
+	* dpkg-deb/build.c (arbitrary_fields): New variable.
+	(known_arbitrary_field): New function.
+	(do_build): Call known_arbitrary_field to not warn on known arbitrary
+	fields.
+	* scripts/dpkg-genchanges.pl: Ignore Homepage field.
+	* scripts/dpkg-gencontrol.pl: Parse Homepage from source package
+	stanza.
+	(@control_fields): Add Homepage.
+	* scripts/dpkg-scanpackages.pl (@fieldpri): Add Homepage.
+	* scripts/dpkg-source.pl: Parse Homepage from source package stanza.
+	(@dsc_fields): Add Homepage.
+
 2007-08-18  Guillem Jover  <guillem@debian.org>
 
 	* scripts/dpkg-divert.pl (infol): Check if parameters are defined

+ 1 - 0
debian/changelog

@@ -37,6 +37,7 @@ dpkg (1.14.6) UNRELEASED; urgency=low
     Thanks to Ian Jackson.
   * Fix perl warnings:
     - When removing a non diverted file with dpkg-divert. Closes: #438416
+  * Implement support for Homepage field. Closes: #142324
 
   [ Updated scripts translations ]
   * French (Frédéric Bothamy, Christian Perrier).

+ 18 - 0
dpkg-deb/build.c

@@ -56,6 +56,21 @@ struct _finfo {
   struct _finfo* next;
 };
 
+const char *arbitrary_fields[]= {
+  "Homepage",
+  NULL
+};
+
+static int known_arbitrary_field(const struct arbitraryfield *field) {
+  const char **known;
+
+  for (known= arbitrary_fields; *known; known++)
+    if (strcasecmp(field->name, *known) == 0)
+      return 1;
+
+  return 0;
+}
+
 /* Do a quick check if vstring is a valid versionnumber. Valid in this case
  * means it contains at least one digit. If an error is found increment
  * *errs.
@@ -223,6 +238,9 @@ void do_build(const char *const *argv) {
       warns++;
     }
     for (field= checkedinfo->available.arbs; field; field= field->next) {
+      if (known_arbitrary_field(field))
+        continue;
+
       fprintf(stderr, _("warning, `%s' contains user-defined field `%s'\n"),
               controlfile, field->name);
       warns++;

+ 5 - 0
man/ChangeLog

@@ -1,3 +1,8 @@
+2007-08-20  Guillem Jover  <guillem@debian.org>
+
+	* deb-control.5: Document Homepage field.
+	* dpkg-query.1: Document Homepage as a recognized field.
+
 2007-08-18  Guillem Jover  <guillem@debian.org>
 
 	* po/dpkg-man.pot: Regenerated.

+ 3 - 0
man/deb-control.5

@@ -85,6 +85,9 @@ etc. Note that the
 option is meant for packages that are architecture independent. Some examples
 of this are shell and Perl scripts, and documentation.
 .TP
+.BR Homepage: " <url>"
+The upstream project home page URL.
+.TP
 .BR Source: " <source name>"
 The name of the source package that this binary package came from, if
 different than the name of the package itself.

+ 1 - 0
man/dpkg-query.1

@@ -109,6 +109,7 @@ alignment will be used. The following \fIfield\fRs are recognised:
     \fBEnhances\fP
     \fBEssential\fP
     \fBFilename\fP
+    \fBHomepage\fP
     \fBInstalled\-Size\fP
     \fBMD5sum\fP
     \fBMSDOS\-Filename\fP

+ 1 - 1
scripts/dpkg-genchanges.pl

@@ -208,7 +208,7 @@ for $_ (keys %fi) {
 	elsif (m/^Section$|^Priority$/i) { $sourcedefault{$_}= $v; }
 	elsif (m/^Maintainer$/i) { $f{$_}= $v; }
 	elsif (s/^X[BS]*C[BS]*-//i) { $f{$_}= $v; }
-	elsif (m/|^X[BS]+-|^Standards-Version$/i) { }
+	elsif (m/|^X[BS]+-|^Standards-Version$|^Homepage$/i) { }
 	else { &unknown(_g('general section of control info file')); }
     } elsif (s/^C(\d+) //) {
 	my $i = $1;

+ 2 - 2
scripts/dpkg-gencontrol.pl

@@ -23,7 +23,7 @@ textdomain("dpkg-dev");
 
 my @control_fields = (qw(Package Source Version Architecture Essential Origin
                          Bugs Maintainer Installed-Size), @pkg_dep_fields,
-                      qw(Section Priority Description));
+                      qw(Section Priority Homepage Description));
 
 my $controlfile = 'debian/control';
 my $changelogfile = 'debian/changelog';
@@ -146,7 +146,7 @@ for $_ (keys %fi) {
 
     if (s/^C //) {
 #print STDERR "G key >$_< value >$v<\n";
-	if (m/^(Origin|Bugs|Maintainer)$/) {
+	if (m/^(Origin|Bugs|Maintainer|Homepage)$/) {
 	    $f{$_} = $v;
 	} elsif (m/^Source$/) {
 	    setsourcepackage($v);

+ 1 - 1
scripts/dpkg-scanpackages.pl

@@ -26,7 +26,7 @@ my %kmap= (optional         => 'suggests',
 
 my @fieldpri = (qw(Package Source Version Architecture Essential Origin Bugs
                    Maintainer Installed-Size), @pkg_dep_fields, qw(Filename
-                   Size MD5sum Section Priority Description));
+                   Size MD5sum Section Priority Homepage Description));
 
 # This maps the fields into the proper case
 my %field_case;

+ 4 - 2
scripts/dpkg-source.pl

@@ -76,7 +76,8 @@ our @src_dep_fields;
 textdomain("dpkg-dev");
 
 my @dsc_fields = (qw(Format Source Binary Architecture Version Origin
-                     Maintainer Uploaders Standards-Version), @src_dep_fields);
+                     Maintainer Uploaders Homepage Standards-Version),
+                  @src_dep_fields);
 
 
 # Make sure patch doesn't get any funny ideas
@@ -238,8 +239,9 @@ if ($opmode eq 'build') {
         if (s/^C //) {
 	    if (m/^Source$/i) {
 		setsourcepackage($v);
+	    } elsif (m/^(Standards-Version|Origin|Maintainer|Homepage)$/i) {
+		$f{$_}= $v;
 	    }
-            elsif (m/^(Standards-Version|Origin|Maintainer)$/i) { $f{$_}= $v; }
 	    elsif (m/^Uploaders$/i) { ($f{$_}= $v) =~ s/[\r\n]//g; }
 	    elsif (m/^Build-(Depends|Conflicts)(-Indep)?$/i) {
 		my $dep = parsedep(substvars($v),1);