Przeglądaj źródła

dpkg-genchanges: Check first for build type to short-circuit boolean expressions

This way we reduce the checks to perform on the architectures. And it
could allow to avoid computing the host architecture when doing source
only builds.
Guillem Jover 10 lat temu
rodzic
commit
52e7aad696
2 zmienionych plików z 7 dodań i 5 usunięć
  1. 2 0
      debian/changelog
  2. 5 5
      scripts/dpkg-genchanges.pl

+ 2 - 0
debian/changelog

@@ -21,6 +21,8 @@ dpkg (1.18.5) UNRELEASED; urgency=medium
   * Clarify where to find the GPL-2 license in debian/copyright.
   * Clarify where to find the GPL-2 license in debian/copyright.
   * Do not enable stack-protector on nios2 in Debian and derivatives (it is
   * Do not enable stack-protector on nios2 in Debian and derivatives (it is
     not supported by gcc yet).
     not supported by gcc yet).
+  * Check first for build type to short-circuit boolean expressions in
+    dpkg-genchanges.
   * Perl modules:
   * Perl modules:
     - Add new CTRL_REPO_RELEASE control block type to Dpkg::Control.
     - Add new CTRL_REPO_RELEASE control block type to Dpkg::Control.
     - Add new CTRL_COPYRIGHT_HEADER, CTRL_COPYRIGHT_FILES and
     - Add new CTRL_COPYRIGHT_HEADER, CTRL_COPYRIGHT_FILES and

+ 5 - 5
scripts/dpkg-genchanges.pl

@@ -330,9 +330,9 @@ foreach my $pkg ($control->get_packages()) {
 
 
     if (not defined($p2f{$p})) {
     if (not defined($p2f{$p})) {
 	# No files for this package... warn if it's unexpected
 	# No files for this package... warn if it's unexpected
-	if (((debarch_eq('all', $a) and build_has(BUILD_ARCH_INDEP)) ||
-	     ((any { debarch_is($host_arch, $_) } split /\s+/, $a)
-	     and build_has(BUILD_ARCH_DEP))) and
+	if (((build_has(BUILD_ARCH_INDEP) and debarch_eq('all', $a)) or
+	     (build_has(BUILD_ARCH_DEP) and
+	      (any { debarch_is($host_arch, $_) } split /\s+/, $a))) and
 	    (@restrictions == 0 or
 	    (@restrictions == 0 or
 	     evaluate_restriction_formula(\@restrictions, \@profiles)))
 	     evaluate_restriction_formula(\@restrictions, \@profiles)))
 	{
 	{
@@ -350,8 +350,8 @@ foreach my $pkg ($control->get_packages()) {
 	} elsif (m/^Priority$/) {
 	} elsif (m/^Priority$/) {
 	    $f2pricf{$_} = $v foreach (@f);
 	    $f2pricf{$_} = $v foreach (@f);
 	} elsif (m/^Architecture$/) {
 	} elsif (m/^Architecture$/) {
-	    if ((any { debarch_is($host_arch, $_) } split /\s+/, $v)
-		and build_has(BUILD_ARCH_DEP)) {
+	    if (build_has(BUILD_ARCH_DEP) and
+	        (any { debarch_is($host_arch, $_) } split /\s+/, $v)) {
 		$v = $host_arch;
 		$v = $host_arch;
 	    } elsif (!debarch_eq('all', $v)) {
 	    } elsif (!debarch_eq('all', $v)) {
 		$v = '';
 		$v = '';