Przeglądaj źródła

dpkg-source: support unpacking old source packages lacking the Format field

.dsc files haven't always had a Format field. It was introduced in dpkg
1.6.13, in May 2000. This means that it's still not entirely
implausible to run across source packages without Format, for example
when importing the history of a source package into revision control.

Thus, dpkg-source should treat a missing Format field as 1.0, for
compatibility with these old packages.
Colin Watson 16 lat temu
rodzic
commit
3d2e2cbed0
2 zmienionych plików z 9 dodań i 1 usunięć
  1. 6 0
      debian/changelog
  2. 3 1
      scripts/Dpkg/Source/Package.pm

+ 6 - 0
debian/changelog

@@ -1,11 +1,17 @@
 dpkg (1.15.6.1) UNRELEASED; urgency=low
 dpkg (1.15.6.1) UNRELEASED; urgency=low
 
 
+  [ Guillem Jover ]
   * Fix two memory leaks introduced in 1.15.6.
   * Fix two memory leaks introduced in 1.15.6.
   * Always use C99 variadic macros, as the build requires them anyway, we
   * Always use C99 variadic macros, as the build requires them anyway, we
     avoid exposing the configure variable HAVE_C99 on installed headers.
     avoid exposing the configure variable HAVE_C99 on installed headers.
   * Use __attribute__ keyword depending on compiler support, we avoid
   * Use __attribute__ keyword depending on compiler support, we avoid
     exposing the configure variable HAVE_C_ATTRIBUTE on installed headers.
     exposing the configure variable HAVE_C_ATTRIBUTE on installed headers.
 
 
+  [ Raphaël Hertzog ]
+  * Accept source packages without "Format" field for compatibility with very
+    old source packages. Thanks to Colin Watson for the report and the patch.
+    Closes: #574097
+
   [ Updated dpkg translations ]
   [ Updated dpkg translations ]
   * Swedish (Peter Krefting).
   * Swedish (Peter Krefting).
 
 

+ 3 - 1
scripts/Dpkg/Source/Package.pm

@@ -144,7 +144,7 @@ sub initialize {
     $fields->load($filename);
     $fields->load($filename);
     $self->{'fields'} = $fields;
     $self->{'fields'} = $fields;
 
 
-    foreach my $f (qw(Source Format Version Files)) {
+    foreach my $f (qw(Source Version Files)) {
         unless (defined($fields->{$f})) {
         unless (defined($fields->{$f})) {
             error(_g("missing critical source control field %s"), $f);
             error(_g("missing critical source control field %s"), $f);
         }
         }
@@ -158,6 +158,8 @@ sub initialize {
 sub upgrade_object_type {
 sub upgrade_object_type {
     my ($self, $update_format) = @_;
     my ($self, $update_format) = @_;
     $update_format = 1 unless defined $update_format;
     $update_format = 1 unless defined $update_format;
+    $self->{'fields'}{'Format'} = '1.0'
+        unless exists $self->{'fields'}{'Format'};
     my $format = $self->{'fields'}{'Format'};
     my $format = $self->{'fields'}{'Format'};
 
 
     if ($format =~ /^([\d\.]+)(?:\s+\((.*)\))?$/) {
     if ($format =~ /^([\d\.]+)(?:\s+\((.*)\))?$/) {