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

dpkg-buildpackage: allow options -nc and -S together

This combination is generally not recommended as you want to ensure
that a source package contains only source and not any intermediary files
left-over by the previous build. Nevertheless it can be useful from time
to time and instead of bluntly refusing, we now simply warn the user
and let the build proceed.

-nc still implies -b if nothing else has been specified as it's routinely
used to test if a fix is working by restarting a previously interrupted
build where it failed.
Raphael Hertzog лет назад: 17
Родитель
Сommit
18dacea0fa
3 измененных файлов с 12 добавлено и 7 удалено
  1. 2 0
      debian/changelog
  2. 2 1
      man/dpkg-buildpackage.1
  3. 8 6
      scripts/dpkg-buildpackage.pl

+ 2 - 0
debian/changelog

@@ -79,6 +79,8 @@ dpkg (1.15.1) UNRELEASED; urgency=low
     time. Closes: #525835
   * Let dpkg-buildpackage add the missing execute right on debian/rules if
     needed. Display a warning when it happens. Closes: #499088
+  * Allow to combine -nc and -S in dpkg-buildpackage but display a warning
+    saying that it's not advised. Closes: #304404
 
   [ Guillem Jover ]
   * Fix typo in dpkg output (‘unexecpted’ → ‘unexpected’). Closes: #519082

+ 2 - 1
man/dpkg-buildpackage.1

@@ -132,7 +132,8 @@ default behavior.
 Do not check build dependencies and conflicts.
 .TP
 .B \-nc
-Do not clean the source tree (implies \fB\-b\fP).
+Do not clean the source tree (implies \fB\-b\fP if nothing else has been
+selected among \fB-B\fP, \fB-A\fP or \fB-S\fP).
 .TP
 .B \-tc
 Clean the source tree (using

+ 8 - 6
scripts/dpkg-buildpackage.pl

@@ -163,12 +163,6 @@ while (@ARGV) {
         $call_target_as_root = 1;
     } elsif (/^-nc$/) {
 	$noclean = 1;
-	if ($sourceonly) {
-	    usageerr(_g("cannot combine %s and %s"), '-nc', '-S');
-	}
-	unless ($binaryonly) {
-	    $binaryonly = '-b';
-	}
     } elsif (/^-b$/) {
 	$binaryonly = '-b';
 	@checkbuilddep_args = ();
@@ -217,6 +211,11 @@ while (@ARGV) {
     }
 }
 
+if ($noclean) {
+    # -nc without -b/-B/-A/-S implies -b
+    $binaryonly = '-b' unless ($binaryonly or $sourceonly);
+}
+
 if ($< == 0) {
     warning(_g("using a gain-root-command while being root")) if (@rootcommand);
 } else {
@@ -390,6 +389,9 @@ unless ($noclean) {
     withecho(@rootcommand, @debian_rules, 'clean');
 }
 unless ($binaryonly) {
+    warning(_g("it is a bad idea to generate a source package " .
+               "without cleaning up first, it might contain undesired " .
+               "files.")) if $noclean;
     chdir('..') or syserr('chdir ..');
     my @opts = @passopts;
     if ($diffignore) { push @opts, $diffignore }