Преглед на файлове

dpkg-source: Use %dep_field_type for the union option to Dpkg::Deps::parse

Use capit() to normalize the field names, instead of hardcoding them.
Guillem Jover преди 18 години
родител
ревизия
f079a3331b
променени са 2 файла, в които са добавени 8 реда и са изтрити 9 реда
  1. 6 0
      ChangeLog
  2. 2 9
      scripts/dpkg-source.pl

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+2007-11-19  Guillem Jover  <guillem@debian.org>
+
+	* scripts/dpkg-source.pl: Use %dep_field_type for the union option
+	to Dpkg::Deps::parse, and use capit() to normalize the field names,
+	instead of hardcoding them.
+
 2007-11-19  Guillem Jover  <guillem@debian.org>
 
 	* pkg-deb/build.c (arbitrary_fields): Add Package-Type,

+ 2 - 9
scripts/dpkg-source.pl

@@ -318,15 +318,8 @@ if ($opmode eq 'build') {
 	    elsif (m/^Uploaders$/i) { ($f{$_}= $v) =~ s/[\r\n]//g; }
 	    elsif (m/^Build-(Depends|Conflicts)(-Indep)?$/i) {
 		my $dep;
-		# XXX: Should use %dep_field_type to decide if we parse
-		# as union or not but since case-insensitive matching is
-		# used, I can't rely on $_ to have the very same
-		# capitalization...
-		if (lc($1) eq "depends") {
-		    $dep = Dpkg::Deps::parse($v);
-		} else {
-		    $dep = Dpkg::Deps::parse($v, union => 1);
-		}
+		my $type = $dep_field_type{capit($_)};
+		$dep = Dpkg::Deps::parse($v, union =>  $type eq 'union');
 		error(_g("error occurred while parsing %s"), $_) unless defined $dep;
 		my $facts = Dpkg::Deps::KnownFacts->new();
 		$dep->simplify_deps($facts);