Просмотр исходного кода

Add initial udeb support

Support new fields fields Package-Type, Subarchitecture, Kernel-Version
and Installer-Menu-Item.
New '--type' option for dpkg-scanpackages.
Guillem Jover лет назад: 18
Родитель
Сommit
a1e654c433

+ 18 - 0
ChangeLog

@@ -1,3 +1,21 @@
+2007-11-19  Guillem Jover  <guillem@debian.org>
+
+	* 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  <guillem@debian.org>
 
 	* scripts/Dpkg/Arch.pm (read_cputable): Force a sane input record

+ 0 - 4
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
 ------
 

+ 4 - 0
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).

+ 4 - 0
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

+ 4 - 0
man/ChangeLog

@@ -1,3 +1,7 @@
+2007-11-19  Guillem Jover  <guillem@debian.org>
+
+	* dpkg-scanpackages.1: Document --type, and mark --udeb as obsolete.
+
 2007-11-04  Robert Luberda  <robert@debian.org>
 
 	* po/pl.po: Update to 1258t10f77u, fix typos

+ 5 - 2
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

+ 4 - 3
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"));

+ 20 - 5
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 (<X>) {
         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'))))

+ 16 - 9
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 [<option> ...] <binarypath> [<overridefile> [<pathprefix>]] > Packages
 
 Options:
-  -u, --udeb               scan for udebs.
+  -t, --type <type>        scan for <type> packages (default is 'deb').
+  -u, --udeb               scan for udebs (obsolete alias for -tudeb).
   -a, --arch <arch>        architecture to scan for.
   -m, --multiversion       allow multiple versions of a single package.
   -h, --help               show this help message.
@@ -111,16 +117,17 @@ if (not @ARGV >= 1 && @ARGV <= 3) {
     exit 1;
 }
 
-my $udeb = $options{udeb};
+my $type = defined($options{type}) ? $options{type} :
+				     $options{udeb} ? 'udeb' : 'deb';
 my $arch = $options{arch};
 
-my $ext = $options{udeb} ? 'udeb' : 'deb';
 my @find_args;
 if ($options{arch}) {
-     @find_args = ('(','-name',"*_all.$ext",'-o','-name',"*_${arch}.$ext",')',);
+     @find_args = ('(', '-name', "*_all.$type", '-o',
+			'-name', "*_${arch}.$type", ')');
 }
 else {
-     @find_args = ('-name',"*.$ext");
+     @find_args = ('-name', "*.$type");
 }
 push @find_args, '-follow';
 

+ 3 - 1
scripts/dpkg-source.pl

@@ -368,7 +368,9 @@ if ($opmode eq 'build') {
                 $f{'Architecture'}= join(' ',@sourcearch);
             } elsif (s/^X[BC]*S[BC]*-//i) {
                 $f{$_}= $v;
-            } elsif (m/^(Package|Essential|Pre-Depends|Depends|Provides)$/i ||
+            } elsif (m/^(Package|Package-Type|Essential|Kernel-Version)$/ ||
+                     m/^(Subarchitecture|Installer-Menu-Item)$/i ||
+                     m/^(Pre-Depends|Depends|Provides)$/i ||
                      m/^(Recommends|Suggests|Conflicts|Replaces)$/i ||
                      m/^(Breaks|Enhances|Description|Tag|Section|Priority)$/i ||
                      m/^X[BC]+-/i) {