Przeglądaj źródła

Dpkg::Deps::parse(): handle empty fields properly instead of returning undef

And revert previous changes made to dpkg-gencontrol to skip empty fields.
Raphael Hertzog 18 lat temu
rodzic
commit
8959140e24
4 zmienionych plików z 10 dodań i 9 usunięć
  1. 2 1
      ChangeLog
  2. 2 2
      debian/changelog
  3. 0 1
      scripts/Dpkg/Deps.pm
  4. 6 5
      scripts/dpkg-gencontrol.pl

+ 2 - 1
ChangeLog

@@ -7,7 +7,8 @@
 	problem (when a RPATH contains $ORIGIN and when the value of
 	problem (when a RPATH contains $ORIGIN and when the value of
 	this variable can't be determined because we don't know what
 	this variable can't be determined because we don't know what
 	is the root directory of the temporary tree).
 	is the root directory of the temporary tree).
-	* scripts/dpkg-gencontrol.pl: Don't try to parse empty fields.
+	* scripts/Dpkg/Deps.pm: Fix parse() to handle empty fields instead
+	of returning undef.
 
 
 2007-11-19  Guillem Jover  <guillem@debian.org>
 2007-11-19  Guillem Jover  <guillem@debian.org>
 
 

+ 2 - 2
debian/changelog

@@ -2,8 +2,8 @@ dpkg (1.14.9) UNRELEASED; urgency=low
 
 
   [ Raphael Hertzog ]
   [ Raphael Hertzog ]
   * Fix bad behaviour of Dpkg::Path::get_pkg_root_dir() and adjust
   * Fix bad behaviour of Dpkg::Path::get_pkg_root_dir() and adjust
-    dpkg-shlibdeps accordingly.
-  * Fix dpkg-gencontrol to not try to parse and simplify empty fields.
+    dpkg-shlibdeps accordingly. Closes: #452012
+  * Fix Dpkg::Deps to accept empty fields. Closes: #452013
 
 
   [ Updated man pages translations ]
   [ Updated man pages translations ]
     * German (Helge Kreutzmann).
     * German (Helge Kreutzmann).

+ 0 - 1
scripts/Dpkg/Deps.pm

@@ -321,7 +321,6 @@ sub parse {
 	    push @dep_list, $dep_or;
 	    push @dep_list, $dep_or;
 	}
 	}
     }
     }
-    return undef if not @dep_list;
     my $dep_and;
     my $dep_and;
     if ($options{union}) {
     if ($options{union}) {
 	$dep_and = Dpkg::Deps::Union->new();
 	$dep_and = Dpkg::Deps::Union->new();

+ 6 - 5
scripts/dpkg-gencontrol.pl

@@ -249,19 +249,20 @@ if (exists $fi{"C$myindex Provides"}) {
 my (@seen_deps);
 my (@seen_deps);
 foreach my $field (@pkg_dep_fields) {
 foreach my $field (@pkg_dep_fields) {
     my $key = "C$myindex $field";
     my $key = "C$myindex $field";
-    if (exists $fi{$key} and $fi{$key}) {
+    if (exists $fi{$key}) {
 	my $dep;
 	my $dep;
+	my $field_value = substvars($fi{$key});
 	if ($dep_field_type{$field} eq 'normal') {
 	if ($dep_field_type{$field} eq 'normal') {
-	    $dep = Dpkg::Deps::parse(substvars($fi{$key}), use_arch => 1,
+	    $dep = Dpkg::Deps::parse($field_value, use_arch => 1,
                                      reduce_arch => 1);
                                      reduce_arch => 1);
-	    error(_g("error occurred while parsing %s"), $_) unless defined $dep;
+	    error(_g("error occurred while parsing %s"), $field_value) unless defined $dep;
 	    $dep->simplify_deps($facts, @seen_deps);
 	    $dep->simplify_deps($facts, @seen_deps);
 	    # Remember normal deps to simplify even further weaker deps
 	    # Remember normal deps to simplify even further weaker deps
 	    push @seen_deps, $dep if $dep_field_type{$field} eq 'normal';
 	    push @seen_deps, $dep if $dep_field_type{$field} eq 'normal';
 	} else {
 	} else {
-	    $dep = Dpkg::Deps::parse(substvars($fi{$key}), use_arch => 1,
+	    $dep = Dpkg::Deps::parse($field_value, use_arch => 1,
                                      reduce_arch => 1, union => 1);
                                      reduce_arch => 1, union => 1);
-	    error(_g("error occurred while parsing %s"), $_) unless defined $dep;
+	    error(_g("error occurred while parsing %s"), $field_value) unless defined $dep;
 	    $dep->simplify_deps($facts);
 	    $dep->simplify_deps($facts);
 	}
 	}
 	$dep->sort();
 	$dep->sort();