Przeglądaj źródła

dpkg-genchanges: Merge fallback Section and Priority value assignments

This makes the code more clear, and will make sure to emit a warning
also when the fields have an explicit '-' value.
Guillem Jover 12 lat temu
rodzic
commit
7625c1359d
2 zmienionych plików z 10 dodań i 18 usunięć
  1. 2 0
      debian/changelog
  2. 8 18
      scripts/dpkg-genchanges.pl

+ 2 - 0
debian/changelog

@@ -17,6 +17,8 @@ dpkg (1.17.14) UNRELEASED; urgency=low
     - Clarify that -a, -t, -e and -i work with the host system.
   * Place 'Commands:' before 'Options:' sections on --help output in
     dpkg-architecture and dpkg-vendor.
+  * Always warn in dpkg-genchanges on missing Section or Priority value,
+    either empty or '-'.
 
   [ Raphaël Hertzog ]
   * Explain better in deb-triggers(5) why interest/activate-noawait should be

+ 8 - 18
scripts/dpkg-genchanges.pl

@@ -366,10 +366,8 @@ for my $p (keys %p2f) {
     foreach my $f (@f) {
 	my $file = $dist->get_file($f);
 
-	my $sec = $f2seccf{$f};
-	$sec ||= $sourcedefault{'Section'};
-	if (!defined($sec)) {
-	    $sec = '-';
+	my $sec = $f2seccf{$f} || $sourcedefault{'Section'} // '-';
+	if ($sec eq '-') {
 	    warning(_g("missing Section for binary package %s; using '-'"), $p);
 	}
 	if ($sec ne $file->{section}) {
@@ -377,10 +375,8 @@ for my $p (keys %p2f) {
 	             'files list'), $p, $sec, $file->{section});
 	}
 
-	my $pri = $f2pricf{$f};
-	$pri ||= $sourcedefault{'Priority'};
-	if (!defined($pri)) {
-	    $pri = '-';
+	my $pri = $f2pricf{$f} || $sourcedefault{'Priority'} // '-';
+	if ($pri eq '-') {
 	    warning(_g("missing Priority for binary package %s; using '-'"), $p);
 	}
 	if ($pri ne $file->{priority}) {
@@ -393,16 +389,10 @@ for my $p (keys %p2f) {
 my $origsrcmsg;
 
 if ($include & BUILD_SOURCE) {
-    my $sec = $sourcedefault{'Section'};
-    if (!defined($sec)) {
-	$sec = '-';
-	warning(_g('missing Section for source files'));
-    }
-    my $pri = $sourcedefault{'Priority'};
-    if (!defined($pri)) {
-	$pri = '-';
-	warning(_g('missing Priority for source files'));
-    }
+    my $sec = $sourcedefault{'Section'} // '-';
+    my $pri = $sourcedefault{'Priority'} // '-';
+    warning(_g('missing Section for source files')) if $sec eq '-';
+    warning(_g('missing Priority for source files')) if $pri eq '-';
 
     my $spackage = get_source_package();
     (my $sversion = $substvars->get('source:Version')) =~ s/^\d+://;