Selaa lähdekoodia

dpkg-genchanges/dpkg-buildpackages: Add new -A option

Logical opposite of -B, will only build arch-indep
packages (dpkg-buildpackage), only include arch-indep
packages in the .changes file (dpkg-genchanges).
Frank Lichtenheld 19 vuotta sitten
vanhempi
commit
0c78affb38
4 muutettua tiedostoa jossa 57 lisäystä ja 21 poistoa
  1. 8 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 10 2
      scripts/dpkg-buildpackage.pl
  4. 37 19
      scripts/dpkg-genchanges.pl

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+2007-12-05  Frank Lichtenheld  <djpig@debian.org>
+
+	* scripts/dpkg-buildpackage.pl: Add new
+	-A option (passed to dpkg-genchanges).
+	* scripts/dpkg-genchanges.pl: Add new -A
+	option that will include only arch-indep
+	packages into the upload.
+
 2007-12-05  Frank Lichtenheld  <djpig@debian.org>
 	    Goswin von Brederlow  <brederlo@informatik.uni-tuebingen.de>
 	    Bastian Blank  <waldi@debian.org>

+ 2 - 0
debian/changelog

@@ -13,6 +13,8 @@ dpkg (1.14.13) UNRELEASED; urgency=low
   * Allow more than one arch and more than one type of a package
     in debian/files. Parts of the patch by Goswin von Brederlow
     and Bastian Blank. Closes: #356299, #377400, #229143
+  * Allow building only architecture independent packages (-A).
+    Closes: #109794, #200454
 
   [ Updated man pages translations ]
   * Swedish (Peter Karlsson)

+ 10 - 2
scripts/dpkg-buildpackage.pl

@@ -48,8 +48,9 @@ Options:
   -us            unsigned source.
   -uc            unsigned changes.
   -a<arch>       Debian architecture we build for (implies -d).
-  -b             binary-only, do not build source. } also passed to
-  -B             binary-only, no arch-indep files. } dpkg-genchanges
+  -b             binary-only, do not build source.   } also passed to
+  -B             binary-only, no arch-indep files.   } dpkg-genchanges
+  -A             binary-only, only arch-indep files. }
   -S             source only, no binary files.     }
   -t<system>     set GNU system type.           } passed to dpkg-architecture
   -v<version>    changes since version <version>.      }
@@ -175,6 +176,13 @@ while (@ARGV) {
 	if ($sourceonly) {
 	    usageerr(_g("cannot combine %s and %s"), '-B', '-S');
 	}
+    } elsif (/^-A$/) {
+	$binaryonly = '-A';
+	@checkbuilddep_args = ();
+	$binarytarget = 'binary-indep';
+	if ($sourceonly) {
+	    usageerr(_g("cannot combine %s and %s"), '-A', '-S');
+	}
     } elsif (/^-S$/) {
 	$sourceonly = '-S';
 	$checkbuilddep = 0;

+ 37 - 19
scripts/dpkg-genchanges.pl

@@ -59,13 +59,24 @@ my %archadded;
 my @archvalues;
 my $dsc;
 my $changesdescription;
-my $sourceonly;
-my $binaryonly;
-my $archspecific;
 my $forcemaint;
 my $forcechangedby;
 my $since;
 
+use constant SOURCE     => 1;
+use constant ARCH_DEP   => 2;
+use constant ARCH_INDEP => 4;
+use constant BIN        => ARCH_DEP | ARCH_INDEP;
+use constant ALL        => BIN | SOURCE;
+my $include = ALL;
+
+sub is_sourceonly() { return $include == SOURCE; }
+sub is_binaryonly() { return !($include & SOURCE); }
+sub binary_opt() { return (($include == BIN) ? '-b' :
+			   (($include == ARCH_DEP) ? '-B' :
+			    (($include == ARCH_INDEP) ? '-A' :
+			     internerr("binary_opt called with include=$include"))));
+}
 
 sub version {
     printf _g("Debian %s version %s.\n"), $progname, $version;
@@ -87,6 +98,7 @@ sub usage {
 Options:
   -b                       binary-only build - no source files.
   -B                       arch-specific - no source or arch-indep files.
+  -A                       only arch-indep - no source or arch-specific files.
   -S                       source-only upload.
   -c<controlfile>          get control info from this file.
   -l<changelogfile>        get per-version info from this file.
@@ -114,16 +126,19 @@ Options:
 while (@ARGV) {
     $_=shift(@ARGV);
     if (m/^-b$/) {
-	$sourceonly && &usageerr(_g("cannot combine -b or -B and -S"));
-        $binaryonly= 1;
+	is_sourceonly && &usageerr(_g("cannot combine %s and -S"), $_);
+	$include = BIN;
     } elsif (m/^-B$/) {
-	$sourceonly && &usageerr(_g("cannot combine -b or -B and -S"));
-	$archspecific=1;
-	$binaryonly= 1;
+	is_sourceonly && &usageerr(_g("cannot combine %s and -S"), $_);
+	$include = ARCH_DEP;
 	printf STDERR _g("%s: arch-specific upload - not including arch-independent packages")."\n", $progname;
+    } elsif (m/^-A$/) {
+	is_sourceonly && &usageerr(_g("cannot combine %s and -S"), $_);
+	$include = ARCH_INDEP;
+	printf STDERR _g("%s: arch-indep upload - not including arch-specific packages")."\n", $progname;
     } elsif (m/^-S$/) {
-	$binaryonly && &usageerr(_g("cannot combine -b or -B and -S"));
-	$sourceonly= 1;
+	is_binaryonly && &usageerr(_g("cannot combine %s and -S"), binary_opt);
+	$include = SOURCE;
     } elsif (m/^-s([iad])$/) {
         $sourcestyle= $1;
     } elsif (m/^-q$/) {
@@ -166,7 +181,7 @@ while (@ARGV) {
 parsechangelog($changelogfile, $changelogformat, $since);
 parsecontrolfile($controlfile);
 
-if (not $sourceonly) {
+if (not is_sourceonly) {
     open(FL,"<",$fileslistfile) || &syserr(_g("cannot read files list file"));
     while(<FL>) {
 	if (m/^(([-+.0-9a-z]+)_([^_]+)_([-\w]+)\.u?deb) (\S+) (\S+)$/) {
@@ -227,9 +242,10 @@ for $_ (keys %fi) {
 	my $a = $fi{"C$i Architecture"};
 	my $host_arch = get_host_arch();
 
-	if (!defined($p2f{$p}) && not $sourceonly) {
-	    if ((debarch_eq('all', $a) && !$archspecific) ||
-		grep(debarch_is($host_arch, $_), split(/\s+/, $a))) {
+	if (!defined($p2f{$p}) && not is_sourceonly) {
+	    if ((debarch_eq('all', $a) and ($include & ARCH_INDEP)) ||
+		(grep(debarch_is($host_arch, $_), split(/\s+/, $a))
+		      and ($include & ARCH_DEP))) {
 		warning(_g("package %s in control file but not in files list"),
 		        $p);
 		next;
@@ -256,8 +272,9 @@ for $_ (keys %fi) {
 	    } elsif (s/^X[BS]*C[BS]*-//i) {
 		$f{$_}= $v;
 	    } elsif (m/^Architecture$/) {
-		if (not $sourceonly) {
-		    if (grep(debarch_is($host_arch, $_), split(/\s+/, $v))) {
+		if (not is_sourceonly) {
+		    if (grep(debarch_is($host_arch, $_), split(/\s+/, $v))
+			and ($include & ARCH_DEP)) {
 			$v = $host_arch;
 		    } elsif (!debarch_eq('all', $v)) {
 			$v= '';
@@ -341,7 +358,7 @@ init_substvar_arch();
 
 my $origsrcmsg;
 
-if (!$binaryonly) {
+if (!is_binaryonly) {
     my $sec = $sourcedefault{'Section'};
     if (!defined($sec)) {
 	$sec = '-';
@@ -402,7 +419,7 @@ if (!defined($f{'Date'})) {
 
 $f{'Binary'}= join(' ',grep(s/C //,keys %p2i));
 
-unshift(@archvalues,'source') unless $binaryonly;
+unshift(@archvalues,'source') unless is_binaryonly;
 $f{'Architecture'}= join(' ',@archvalues);
 
 $f{'Description'}= "\n ".join("\n ",sort @descriptions);
@@ -412,7 +429,8 @@ $f{'Files'}= '';
 my %filedone;
 
 for my $f (@sourcefiles, @fileslistfiles) {
-    next if ($archspecific && debarch_eq('all', $p2arch{$f2p{$f}}));
+    next if ($include == ARCH_DEP and debarch_eq('all', $p2arch{$f2p{$f}}));
+    next if ($include == ARCH_INDEP and not debarch_eq('all', $p2arch{$f2p{$f}}));
     next if $filedone{$f}++;
     my $uf = "$uploadfilesdir/$f";
     open(STDIN, "<", $uf) ||