소스 검색

dpkg-buildpackage: Move checkbuilddeps and target settings out of the options loop

Guillem Jover 12 년 전
부모
커밋
eb0b88adf4
1개의 변경된 파일15개의 추가작업 그리고 12개의 파일을 삭제
  1. 15 12
      scripts/dpkg-buildpackage.pl

+ 15 - 12
scripts/dpkg-buildpackage.pl

@@ -130,7 +130,6 @@ my $noclean;
 my $cleansource;
 my $parallel;
 my $checkbuilddep = 1;
-my @checkbuilddep_opts;
 my @source_opts;
 my $check_command = $ENV{DEB_CHECK_COMMAND};
 my @check_opts;
@@ -268,36 +267,25 @@ while (@ARGV) {
 	    if build_sourceonly;
 	$include = BUILD_BINARY;
 	push @changes_opts, '-b';
-	@checkbuilddep_opts = ();
-	$buildtarget = 'build';
-	$binarytarget = 'binary';
     } elsif (/^-B$/) {
 	usageerr(_g('cannot combine %s and %s'), build_opt(), $_)
 	    if build_sourceonly;
 	$include = BUILD_ARCH_DEP;
 	push @changes_opts, '-B';
-	@checkbuilddep_opts = qw(-B);
-	$buildtarget = 'build-arch';
-	$binarytarget = 'binary-arch';
     } elsif (/^-A$/) {
 	usageerr(_g('cannot combine %s and %s'), build_opt(), $_)
 	    if build_sourceonly;
 	$include = BUILD_ARCH_INDEP;
 	push @changes_opts, '-A';
-	@checkbuilddep_opts = qw(-A);
-	$buildtarget = 'build-indep';
-	$binarytarget = 'binary-indep';
     } elsif (/^-S$/) {
 	usageerr(_g('cannot combine %s and %s'), build_opt(), $_)
 	    if build_binaryonly;
 	$include = BUILD_SOURCE;
 	push @changes_opts, '-S';
-	@checkbuilddep_opts = qw(-A -B);
     } elsif (/^-F$/) {
 	usageerr(_g('cannot combine %s and %s'), build_opt(), $_)
 	    if not build_normal;
 	$include = BUILD_ALL;
-	@checkbuilddep_opts = ();
     } elsif (/^-v(.*)$/) {
 	$since = $1;
     } elsif (/^-m(.*)$/) {
@@ -317,6 +305,17 @@ while (@ARGV) {
     }
 }
 
+if (($include & BUILD_BINARY) == BUILD_BINARY) {
+    $buildtarget = 'build';
+    $binarytarget = 'binary';
+} elsif ($include & BUILD_ARCH_DEP) {
+    $buildtarget = 'build-arch';
+    $binarytarget = 'binary-arch';
+} elsif ($include & BUILD_ARCH_INDEP) {
+    $buildtarget = 'build-indep';
+    $binarytarget = 'binary-indep';
+}
+
 if ($noclean) {
     # -nc without -b/-B/-A/-S/-F implies -b
     $include = BUILD_BINARY if ($include & BUILD_DEFAULT);
@@ -452,6 +451,10 @@ unless ($call_target) {
 }
 
 if ($checkbuilddep) {
+    my @checkbuilddep_opts;
+
+    push @checkbuilddep_opts, '-A' if ($include & BUILD_ARCH_DEP) == 0;
+    push @checkbuilddep_opts, '-B' if ($include & BUILD_ARCH_INDEP) == 0;
     push @checkbuilddep_opts, "--admindir=$admindir" if $admindir;
 
     system('dpkg-checkbuilddeps', @checkbuilddep_opts);