From a1e654c4333f899e288ea19efb34b526f564eaee Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Mon, 19 Nov 2007 06:42:53 +0200 Subject: [PATCH] Add initial udeb support Support new fields fields Package-Type, Subarchitecture, Kernel-Version and Installer-Menu-Item. New '--type' option for dpkg-scanpackages. --- ChangeLog | 18 ++++++++++++++++++ TODO | 4 ---- debian/changelog | 4 ++++ dpkg-deb/build.c | 4 ++++ man/ChangeLog | 4 ++++ man/dpkg-scanpackages.1 | 7 +++++-- scripts/dpkg-genchanges.pl | 7 ++++--- scripts/dpkg-gencontrol.pl | 25 ++++++++++++++++++++----- scripts/dpkg-scanpackages.pl | 25 ++++++++++++++++--------- scripts/dpkg-source.pl | 4 +++- 10 files changed, 78 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9bf88316..5e7ec2eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2007-11-19 Guillem Jover + + * pkg-deb/build.c (arbitrary_fields): Add Package-Type, + Subarchitecture, Kernel-Version and Installer-Menu-Item. + * scripts/dpkg-scanpackages.pl (@fieldpri): Likewise. + (%field_case): Add type argument. + (usage): Document --type argument, and mark --udeb as obsolete. + * scripts/dpkg-gencontrol.pl: Parse Package-Type, Subarchitecture, + Kernel-Version and Installer-Menu-Item from control file binary + stanza. Warn if udeb specific fields are used on non-udeb packages. + Add package with proper extension to the files list file. + (@control_fields): Add Package-Type, Subarchitecture, Kernel-Version + and Installer-Menu-Item. + ($package_type): New variable. + * scripts/dpkg-genchanges.pl: Ignore Package-Type, Subarchitecture, + Kernel-Version and Installer-Menu-Item fields. + * scripts/dpkg-source.pl: Likewise. + 2007-11-15 Guillem Jover * scripts/Dpkg/Arch.pm (read_cputable): Force a sane input record diff --git a/TODO b/TODO index ef838800..8188e1fd 100644 --- a/TODO +++ b/TODO @@ -14,10 +14,6 @@ lenny * Make dpkg bootstrappable. - * Support udeb natively: - - Add field Package-Type and friends. - - Generate proper Packages files. (#383916) - 1.14.y ------ diff --git a/debian/changelog b/debian/changelog index 4dcd0244..2d5efe2f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -56,6 +56,10 @@ dpkg (1.14.8) UNRELEASED; urgency=low * Add support for format strings in Dpkg::ErrorHandling functions. * Move build and host arch detection code from dpkg-architecture to Dpkg::Arch. + * Add initial udeb support: + - Support new fields fields Package-Type, Subarchitecture, Kernel-Version + and Installer-Menu-Item. Closes: #383916 + - New '--type' option for dpkg-scanpackages. [ Updated dselect translations ] * Czech (Miroslav Kure). diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c index 5ee77995..da1dd68e 100644 --- a/dpkg-deb/build.c +++ b/dpkg-deb/build.c @@ -57,6 +57,10 @@ struct _finfo { }; const char *arbitrary_fields[]= { + "Package-Type", + "Subarchitecture", + "Kernel-Version", + "Installer-Menu-Item", "Homepage", "Tag", NULL diff --git a/man/ChangeLog b/man/ChangeLog index c1edbe74..07cfb5c7 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,7 @@ +2007-11-19 Guillem Jover + + * dpkg-scanpackages.1: Document --type, and mark --udeb as obsolete. + 2007-11-04 Robert Luberda * po/pl.po: Update to 1258t10f77u, fix typos diff --git a/man/dpkg-scanpackages.1 b/man/dpkg-scanpackages.1 index 3f0b68b7..b23bce7d 100644 --- a/man/dpkg-scanpackages.1 +++ b/man/dpkg-scanpackages.1 @@ -13,7 +13,7 @@ .\" You should have received a copy of the GNU General Public .\" License along with dpkg; if not, write to the Free Software .\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -.TH dpkg\-scanpackages 1 "2007-09-08" "Debian Project" "dpkg utilities" +.TH dpkg\-scanpackages 1 "2007-11-19" "Debian Project" "dpkg utilities" .SH NAME dpkg\-scanpackages \- create Packages index files . @@ -71,8 +71,11 @@ differ in architecture only the first one found is used. . .SH OPTIONS .TP +.BR \-t ", " \-\-type " \fItype\fP" +Scan for *.\fItype\fP packages, instead of *.deb. +.TP .BR \-u ", " \-\-udeb -Scan for \fI*.udeb\fP, instead of \fI*.deb\fP. +\fBObsolete\fP alias for \fB-tudeb\fP. .TP .BR \-a ", " \-\-arch " \fIarch\fP" Use a pattern consisting of \fI*_all.deb\fP and \fI*_arch.deb\fP instead of diff --git a/scripts/dpkg-genchanges.pl b/scripts/dpkg-genchanges.pl index 5b577aac..5cc61e48 100755 --- a/scripts/dpkg-genchanges.pl +++ b/scripts/dpkg-genchanges.pl @@ -259,9 +259,10 @@ for $_ (keys %fi) { $v = ''; } push(@archvalues,$v) unless !$v || $archadded{$v}++; - } elsif (m/^(Package|Essential|Pre-Depends|Depends|Provides)$/ || - m/^(Recommends|Suggests|Enhances|Conflicts|Breaks|Replaces)$/ || - m/^Tag$/i || + } elsif (m/^(Package|Package-Type|Kernel-Version|Essential)$/ || + m/^(Tag|Installer-Menu-Item|Subarchitecture)$/i || + m/^(Pre-Depends|Depends|Recommends|Suggests|Provides)$/ || + m/^(Enhances|Conflicts|Breaks|Replaces)$/ || m/^X[BS]+-/i) { } else { &unknown(_g("package's section of control info file")); diff --git a/scripts/dpkg-gencontrol.pl b/scripts/dpkg-gencontrol.pl index 1e71b948..7d80264e 100755 --- a/scripts/dpkg-gencontrol.pl +++ b/scripts/dpkg-gencontrol.pl @@ -22,8 +22,10 @@ our $sourcepackage; textdomain("dpkg-dev"); -my @control_fields = (qw(Package Source Version Architecture Essential Origin - Bugs Maintainer Installed-Size), @pkg_dep_fields, +my @control_fields = (qw(Package Package-Type Source Version Kernel-Version + Architecture Subarchitecture Installer-Menu-Item + Essential Origin Bugs Maintainer Installed-Size), + @pkg_dep_fields, qw(Section Priority Homepage Description Tag)); my $controlfile = 'debian/control'; @@ -41,6 +43,7 @@ my %remove; my %override; my (%spvalue, %spdefault); my $oppackage; +my $package_type = 'deb'; sub version { @@ -167,7 +170,8 @@ for $_ (keys %fi) { else { $_ = "C $_"; &unknown(_g('general section of control info file')); } } elsif (s/^C$myindex //) { #print STDERR "P key >$_< value >$v<\n"; - if (m/^(Package|Description|Homepage|Tag|Essential)$/) { + if (m/^(Package|Package-Type|Description|Homepage|Tag|Essential)$/ || + m/^(Subarchitecture|Kernel-Version|Installer-Menu-Item)$/) { $f{$_}= $v; } elsif (exists($pkg_dep_fields{$_})) { # Delay the parsing until later @@ -280,6 +284,15 @@ for my $f (qw(Maintainer Description Architecture)) { } $oppackage= $f{'Package'}; +$package_type = $f{'Package-Type'} if (defined($f{'Package-Type'})); + +if ($package_type ne 'udeb') { + for my $f (qw(Subarchitecture Kernel-Version Installer-Menu-Item)) { + warning(_g("%s package with udeb specific field %s"), $package_type, $f) + if defined($f{$f}); + } +} + my $verdiff = $f{'Version'} ne $substvar{'source:Version'} || $f{'Version'} ne $sourceversion; if ($oppackage ne $sourcepackage || $verdiff) { @@ -327,8 +340,9 @@ if (open(X,"< $fileslistfile")) { binmode(X); while () { chomp; - next if m/^([-+0-9a-z.]+)_[^_]+_([\w-]+)\.deb / + next if m/^([-+0-9a-z.]+)_[^_]+_([\w-]+)\.(a-z+) / && ($1 eq $oppackage) + && ($3 eq $package_type) && (debarch_eq($2, $f{'Architecture'}) || debarch_eq($2, 'all')); print(Y "$_\n") || &syserr(_g("copy old entry to new files list file")); @@ -339,7 +353,8 @@ if (open(X,"< $fileslistfile")) { } my $sversion = $f{'Version'}; $sversion =~ s/^\d+://; -$forcefilename=sprintf("%s_%s_%s.deb", $oppackage,$sversion,$f{'Architecture'}) +$forcefilename = sprintf("%s_%s_%s.%s", $oppackage, $sversion, $f{'Architecture'}, + $package_type) unless ($forcefilename); print(Y &substvars(sprintf("%s %s %s\n", $forcefilename, &spfileslistvalue('Section'), &spfileslistvalue('Priority')))) diff --git a/scripts/dpkg-scanpackages.pl b/scripts/dpkg-scanpackages.pl index 14774b7f..bc4f19b2 100755 --- a/scripts/dpkg-scanpackages.pl +++ b/scripts/dpkg-scanpackages.pl @@ -23,9 +23,11 @@ my %kmap= (optional => 'suggests', package_revision => 'revision', ); -my @fieldpri = (qw(Package Source Version Architecture Essential Origin Bugs - Maintainer Installed-Size), @pkg_dep_fields, qw(Filename - Size MD5sum Section Priority Homepage Description Tag)); +my @fieldpri = (qw(Package Package-Type Source Version Kernel-Version + Architecture Subarchitecture Essential Origin Bugs + Maintainer Installed-Size Installer-Menu-Item), + @pkg_dep_fields, qw(Filename Size MD5sum Section Priority + Homepage Description Tag)); # This maps the fields into the proper case my %field_case; @@ -35,12 +37,15 @@ use Getopt::Long qw(:config bundling); my %options = (help => sub { &usage; exit 0; }, version => \&version, + type => undef, udeb => 0, arch => undef, multiversion => 0, ); -my $result = GetOptions(\%options,'help|h|?','version','udeb|u!','arch|a=s','multiversion|m!'); +my $result = GetOptions(\%options, + 'help|h|?', 'version', 'type|t=s', 'udeb|u!', + 'arch|a=s', 'multiversion|m!'); sub version { printf _g("Debian %s version %s.\n"), $progname, $version; @@ -52,7 +57,8 @@ sub usage { "Usage: %s [