Просмотр исходного кода

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
Родитель
Сommit
52e7aad696
2 измененных файлов с 7 добавлено и 5 удалено
  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.
   * Do not enable stack-protector on nios2 in Debian and derivatives (it is
     not supported by gcc yet).
+  * Check first for build type to short-circuit boolean expressions in
+    dpkg-genchanges.
   * Perl modules:
     - Add new CTRL_REPO_RELEASE control block type to Dpkg::Control.
     - 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})) {
 	# 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
 	     evaluate_restriction_formula(\@restrictions, \@profiles)))
 	{
@@ -350,8 +350,8 @@ foreach my $pkg ($control->get_packages()) {
 	} elsif (m/^Priority$/) {
 	    $f2pricf{$_} = $v foreach (@f);
 	} 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;
 	    } elsif (!debarch_eq('all', $v)) {
 		$v = '';