From db992d8325dd60f99e6df8f9621496f36e33caec Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Mon, 20 Aug 2007 00:10:08 +0300 Subject: [PATCH] Implement support for Homepage field. --- ChangeLog | 14 ++++++++++++++ debian/changelog | 1 + dpkg-deb/build.c | 18 ++++++++++++++++++ man/ChangeLog | 5 +++++ man/deb-control.5 | 3 +++ man/dpkg-query.1 | 1 + scripts/dpkg-genchanges.pl | 2 +- scripts/dpkg-gencontrol.pl | 4 ++-- scripts/dpkg-scanpackages.pl | 2 +- scripts/dpkg-source.pl | 6 ++++-- 10 files changed, 50 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 929cf303..dee1fdae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2007-08-20 Guillem Jover + + * 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 * scripts/dpkg-divert.pl (infol): Check if parameters are defined diff --git a/debian/changelog b/debian/changelog index 2a6c25c2..89c28331 100644 --- a/debian/changelog +++ b/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). diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c index 0177a743..be851efe 100644 --- a/dpkg-deb/build.c +++ b/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++; diff --git a/man/ChangeLog b/man/ChangeLog index 8a3ca542..46b078e4 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,8 @@ +2007-08-20 Guillem Jover + + * deb-control.5: Document Homepage field. + * dpkg-query.1: Document Homepage as a recognized field. + 2007-08-18 Guillem Jover * po/dpkg-man.pot: Regenerated. diff --git a/man/deb-control.5 b/man/deb-control.5 index 3cde45c7..c01c5b72 100644 --- a/man/deb-control.5 +++ b/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: " " +The upstream project home page URL. +.TP .BR Source: " " The name of the source package that this binary package came from, if different than the name of the package itself. diff --git a/man/dpkg-query.1 b/man/dpkg-query.1 index 9f03411e..4f5bad79 100644 --- a/man/dpkg-query.1 +++ b/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 diff --git a/scripts/dpkg-genchanges.pl b/scripts/dpkg-genchanges.pl index 967eede4..ba50119e 100755 --- a/scripts/dpkg-genchanges.pl +++ b/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; diff --git a/scripts/dpkg-gencontrol.pl b/scripts/dpkg-gencontrol.pl index bdaaa00f..98fb7c47 100755 --- a/scripts/dpkg-gencontrol.pl +++ b/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); diff --git a/scripts/dpkg-scanpackages.pl b/scripts/dpkg-scanpackages.pl index fd4c1ce2..e1b35b50 100755 --- a/scripts/dpkg-scanpackages.pl +++ b/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; diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl index 9706f23c..e2229fa7 100755 --- a/scripts/dpkg-source.pl +++ b/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); -- 2.39.5