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

dpkg-buildpackage: Convert from Shell to Perl

This will make it easier to add more features in the
future and easier to give a consistent user experience
(e.g. regarding l10n and output formatting).

Currently this should just be a 1:1 conversion without
any huge changes.
Frank Lichtenheld лет назад: 19
Родитель
Сommit
87c0599e3d
6 измененных файлов с 433 добавлено и 299 удалено
  1. 6 0
      ChangeLog
  2. 2 1
      debian/changelog
  3. 1 1
      scripts/Makefile.am
  4. 423 0
      scripts/dpkg-buildpackage.pl
  5. 0 297
      scripts/dpkg-buildpackage.sh
  6. 1 0
      scripts/po/POTFILES.in

+ 6 - 0
ChangeLog

@@ -13,6 +13,12 @@
 
 	* scripts/Dpkg.pm: Make the regex for determining
 	$progname more robust.
+	
+	* scripts/dpkg-buildpackage.sh: Move to...
+	* scripts/dpkg-buildpackage.pl: Convert from
+	Shell to Perl.
+	* scripts/Makefile.am: Adapt to move.
+	* scripts/po/POTFILES.in: Add dpkg-buildpackage.pl.
 
 2007-09-18  Guillem Jover  <guillem@debian.org>
 

+ 2 - 1
debian/changelog

@@ -18,6 +18,7 @@ dpkg (1.14.7) UNRELEASED; urgency=low
 
   [ Frank Lichtenheld ]
   * Add _MTN to dpkg-source -i default regex. Suggested by Jari Aalto.
+  * Convert dpkg-buildpackage to a Perl script.
 
   [ Updated dpkg translations ]
   * Basque (Piarres Beobide). Closes: #440859
@@ -35,7 +36,7 @@ dpkg (1.14.7) UNRELEASED; urgency=low
   * Swedish (Peter Karlsson).
   * Korean (Sunjae Park). Closes: #443191
 
- -- Frank Lichtenheld <djpig@debian.org>  Sun, 23 Sep 2007 01:22:24 +0200
+ -- Frank Lichtenheld <djpig@debian.org>  Sun, 23 Sep 2007 02:40:20 +0200
 
 dpkg (1.14.6) unstable; urgency=low
 

+ 1 - 1
scripts/Makefile.am

@@ -31,7 +31,7 @@ EXTRA_DIST = \
 	README.alternatives \
 	822-date.pl \
 	dpkg-architecture.pl \
-	dpkg-buildpackage.sh \
+	dpkg-buildpackage.pl \
 	dpkg-checkbuilddeps.pl \
 	dpkg-distaddfile.pl \
 	dpkg-genchanges.pl \

+ 423 - 0
scripts/dpkg-buildpackage.pl

@@ -0,0 +1,423 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Cwd;
+use File::Basename;
+
+use Dpkg;
+use Dpkg::Gettext;
+
+push (@INC, $dpkglibdir);
+require 'controllib.pl';
+
+textdomain("dpkg-dev");
+
+sub showversion {
+    printf _g("Debian %s version %s.\n"), $progname, $version;
+
+    print _g("
+Copyright (C) 1996 Ian Jackson.
+Copyright (C) 2000 Wichert Akkerman
+Copyright (C) 2007 Frank Lichtenheld");
+
+    print _g("
+This is free software; see the GNU General Public Licence version 2 or
+later for copying conditions. There is NO warranty.
+");
+}
+
+sub usage {
+	printf _g("
+Usage: %s [<options> ...]
+
+Options:
+  -r<gain-root-command>
+                 command to gain root privileges (default is fakeroot if it
+                 exists).
+  -p<sign-command>
+  -d             do not check build dependencies and conflicts.
+  -D             check build dependencies and conflicts.
+  -k<keyid>      the key to use for signing.
+  -sgpg          the sign-command is called like GPG.
+  -spgp          the sign-command is called like PGP.
+  -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
+  -S             source only, no binary files.     }
+  -t<system>     set GNU system type.           } passed to dpkg-architecture
+  -v<version>    changes since version <version>.      }
+  -m<maint>      maintainer for package is <maint>.    }
+  -e<maint>      maintainer for release is <maint>.    } only passed
+  -C<descfile>   changes are described in <descfile>.  } to dpkg-genchangs
+  -si (default)  src includes orig for rev. 0 or 1.    }
+  -sa            uploaded src always includes orig.    }
+  -sd            uploaded src is diff and .dsc only.   }
+  -sn            force Debian native source format.      } only passed
+  -s[sAkurKUR]   see dpkg-source for explanation.        } to dpkg-source
+  -nc            do not clean source tree (implies -b).
+  -tc            clean source tree when finished.
+  -ap            add pause before starting signature process.
+  -W             turn certain errors into warnings.       } passed to
+  -E             when -W is turned on, -E turns it off.   } dpkg-source
+  -i[<regex>]    ignore diffs of files matching regex.    } only passed
+  -I<filename>   filter out files when building tarballs. } to dpkg-source
+  --admindir=<directory>
+                 change the administrative directory.
+  -h, --help     show this help message.
+      --version  show the version.
+"), $progname;
+}
+
+sub testcommand {
+    my ($cmd) = @_;
+
+    return -x "/usr/bin/$cmd";
+}
+
+my $rootcommand = '';
+if (testcommand('fakeroot')) {
+    $rootcommand = 'fakeroot';
+}
+
+my $signcommand = '';
+if ( ( ($ENV{GNUPGHOME} && -e $ENV{GNUPGHOME})
+       || ($ENV{HOME} && -e "$ENV{HOME}/.gnupg") )
+     && testcommand('gpg')) {
+	 $signcommand = 'gpg';
+} elsif (testcommand('pgp')) {
+	$signcommand = 'pgp'
+}
+
+my ($admindir, $signkey, $forcesigninterface, $usepause, $noclean,
+    $warnable_errors, $sourcestyle, $cleansource,
+    $binaryonly, $sourceonly, $since, $maint,
+    $changedby, $desc);
+my (@checkbuilddep_args, @passopts, @tarignore);
+my $checkbuilddep = 1;
+my $signsource = 1;
+my $signchanges = 1;
+my $diffignore = '';
+my $binarytarget = 'binary';
+my $targetarch = my $targetgnusystem = '';
+
+while (@ARGV) {
+    $_ = shift @ARGV;
+
+    if (/^(--help|-h)$/) {
+	usage;
+	exit 0;
+    } elsif (/^--version$/) {
+	showversion;
+	exit 0;
+    } elsif (/^--admindir=(.*)$/) {
+	$admindir = $1;
+    } elsif (/^-r(.*)$/) {
+	$rootcommand = $1;
+    } elsif (/^-p(.*)$/) {
+	$signcommand = $1;
+    } elsif (/^-k(.*)$/) {
+	$signkey = $1;
+    } elsif (/^-([dD])$/) {
+	$checkbuilddep = ($1 eq 'D');
+    } elsif (/^-s(gpg|pgp)$/) {
+	$forcesigninterface = $1;
+    } elsif (/^-us$/) {
+	$signsource = 0;
+    } elsif (/^-uc$/) {
+	$signchanges = 0;
+    } elsif (/^-ap$/) {
+	$usepause = 1;
+    } elsif (/^-a(.*)$/) {
+	$targetarch = $1;
+	$checkbuilddep = 0;
+    } elsif (/^-s[iad]$/) {
+	$sourcestyle = $_;
+    } elsif (/^-s[nsAkurKUR]$/) {
+	push @passopts, $_; # passed to dpkg-source
+    } elsif (/^-i.*$/) {
+	$diffignore = $_;
+    } elsif (/^-I.*$/) {
+	push @tarignore, $_;
+    } elsif (/^-tc$/) {
+	$cleansource = 1;
+    } elsif (/^-t(.*)$/) {
+	$targetgnusystem = $1; # Order DOES matter!
+    } elsif (/^-nc$/) {
+	$noclean = 1;
+	if ($sourceonly) {
+	    usageerr(sprintf(_g("cannot combine %s and %s"), '-nc', '-S'));
+	}
+	unless ($binaryonly) {
+	    $binaryonly = '-b';
+	}
+    } elsif (/^-b$/) {
+	$binaryonly = '-b';
+	@checkbuilddep_args = ();
+	$binarytarget = 'binary';
+	if ($sourceonly) {
+	    usageerr(sprintf(_g("cannot combine %s and %s"), '-b', '-S'));
+	}
+    } elsif (/^-B$/) {
+	$binaryonly = '-B';
+	@checkbuilddep_args = ('-B');
+	$binarytarget = 'binary-arch';
+	if ($sourceonly) {
+	    usageerr(sprintf(_g("cannot combine %s and %s"), '-B', '-S'));
+	}
+    } elsif (/^-S$/) {
+	$sourceonly = '-S';
+	$checkbuilddep = 0;
+	if ($binaryonly) {
+	    usageerr(sprintf(_g("cannot combine %s and %s"), $binaryonly, '-S'));
+	}
+    } elsif (/^-v(.*)$/) {
+	$since = $1;
+    } elsif (/^-m(.*)$/) {
+	$maint = $1;
+    } elsif (/^-e(.*)$/) {
+	$changedby = $1;
+    } elsif (/^-C(.*)$/) {
+	$desc = $1;
+    } elsif (/^-W$/) {
+	$warnable_errors = 1;
+	push @passopts, '-W';
+    } elsif (/^-E$/) {
+	$warnable_errors = 0;
+	push @passopts, '-E';
+    } else {
+	usageerr(sprintf(_g("unknown option or argument %s"), $_));
+    }
+}
+
+unless ($signcommand) {
+    $signsource = 0;
+    $signchanges = 0;
+}
+
+my $signinterface;
+if ($forcesigninterface) {
+    $signinterface = $forcesigninterface;
+} else {
+    $signinterface = $signcommand;
+}
+
+if ($signcommand && ($signinterface !~ /^(gpg|pgp)$/)) {
+    warning(_g("unknown sign command, assuming pgp style interface"));
+}
+
+my $cwd = cwd();
+my $dir = basename($cwd);
+
+my %changes;
+open CHANGELOG, '-|', 'dpkg-parsechangelog' or subprocerr('dpkg-parsechangelog');
+# until we have a better parsecdata function this
+# should suffice
+while ($_ = <CHANGELOG>) {
+    chomp;
+    /^(\S+):\s*(.*)$/ && do {
+	$changes{lc $1} = $2;
+    };
+}
+close CHANGELOG or subprocerr('dpkg-parsechangelog');
+
+sub mustsetvar {
+    my ($var, $text) = @_;
+
+    error(sprintf(_g("unable to determine %s", $text)))
+	unless defined($var);
+
+    print "$progname: $text $var\n";
+    return $var;
+}
+
+my $pkg = mustsetvar($changes{source}, _g('source package'));
+my $version = mustsetvar($changes{version}, _g('source version'));
+
+my $maintainer;
+if ($changedby) {
+    $maintainer = $changedby;
+} elsif ($maint) {
+    $maintainer = $maint;
+} else {
+    $maintainer = mustsetvar($changes{maintainer}, _g('source changed by'));
+}
+
+open my $arch_env, '-|', 'dpkg-architecture', "-a$targetarch",
+    "-t$targetgnusystem", '-s', '-f' or subprocerr('dpkg-architecture');
+while ($_ = <$arch_env>) {
+    chomp;
+    my @cmds = split /\s*;\s*/;
+    foreach (@cmds) {
+	/^\s*(\w+)=([\w-]*)\s*$/ && do {
+	    $ENV{$1} = $2;
+	};
+    }
+}
+close $arch_env or subprocerr('dpkg-architecture');
+
+my $arch;
+unless ($sourceonly) {
+    $arch = mustsetvar($ENV{'DEB_HOST_ARCH'}, _g('host architecture'));
+} else {
+    $arch = 'source';
+}
+
+(my $sversion = $version) =~ s/^\d+://;
+
+my $pv = "${pkg}_$sversion";
+my $pva = "${pkg}_${sversion}_$arch";
+
+sub signfile {
+    my ($file) = @_;
+    print STDERR " signfile $file\n";
+    my $qfile = quotemeta($file);
+
+    if ($signinterface eq 'gpg') {
+	system("(cat ../$qfile ; echo '') | ".
+	       "$signcommand --local-user ".quotemeta($signkey||$maintainer).
+	       " --clearsign --armor --textmode  > ../$qfile.asc");
+    } else {
+	system("$signcommand -u ".quotemeta($signkey||$maintainer).
+	       " +clearsig=on -fast <../$qfile >../$qfile.asc");
+    }
+    my $status = $?;
+    unless ($status) {
+	system('mv', '--', "../$file.asc", "../$file")
+	    and subprocerr('mv');
+    } else {
+	system('/bin/rm', '-f', "../$file.asc")
+	    and subprocerr('rm -f');
+    }
+    print "\n";
+    return $status
+}
+
+
+sub withecho {
+    print STDERR " @_\n";
+    system(@_)
+	and subprocerr("@_");
+}
+
+if ($checkbuilddep) {
+    if ($admindir) {
+	push @checkbuilddep_args, "--admindir=$admindir";
+    }
+
+    if (system('dpkg-checkbuilddeps', @checkbuilddep_args)) {
+	warning(_g("Build dependencies/conflicts unsatisfied; aborting.\n"));
+	warning(_g("(Use -d flag to override.)"));
+	exit 3;
+    }
+}
+
+unless ($noclean) {
+    withecho($rootcommand, 'debian/rules', 'clean');
+}
+unless ($binaryonly) {
+    chdir('..') or failure('chdir ..');
+    my @opts = @passopts;
+    if ($diffignore) { push @opts, $diffignore }
+    push @opts, @tarignore;
+    withecho('dpkg-source', @opts, '-b', $dir);
+    chdir($dir) or failure("chdir $dir");
+}
+unless ($sourceonly) {
+    withecho('debian/rules', 'build');
+    withecho($rootcommand, 'debian/rules', $binarytarget);
+}
+if ($usepause &&
+    ($signchanges || ( !$binaryonly && $signsource )) ) {
+    print _g("Press the return key to start signing process\n");
+    getc();
+}
+
+my $signerrors;
+unless ($binaryonly) {
+    if ($signsource && signfile("$pv.dsc")) {
+	$signerrors = _g("Failed to sign .dsc and .changes file");
+	$signchanges = 0;
+    }
+}
+
+my @change_opts;
+
+if ($binaryonly) { push @change_opts, $binaryonly }
+if ($sourceonly) { push @change_opts, $sourceonly }
+if ($sourcestyle) { push @change_opts, $sourcestyle }
+
+if ($maint) { push @change_opts, "-m$maint" }
+if ($changedby) { push @change_opts, "-e$changedby" }
+if ($since) { push @change_opts, "-v$since" }
+if ($desc) { push @change_opts, "-C$desc" }
+
+my $chg = "../$pva.changes";
+print STDERR " dpkg-genchanges @change_opts >$chg\n";
+open CHANGES, '-|', 'dpkg-genchanges', @change_opts
+    or subprocerr('dpkg-genchanges');
+
+open OUT, '>', $chg or syserr(_g('write changes file'));
+
+my $infiles = my $files = '';
+while ($_ = <CHANGES>) {
+    print OUT $_ or syserr(_g('write changes file'));
+    chomp;
+
+    if (/^Files:/i) {
+	$infiles = 1;
+    } elsif ($infiles && /^\s+(.*)$/) {
+	$files .= " $1 ";
+    } elsif ($infiles && /^\S/) {
+	$infiles = 0;
+    }
+}
+
+close CHANGES or subprocerr(_g('dpkg-genchanges'));
+close OUT or syserr(_g('write changes file'));
+
+sub fileomitted {
+    my ($regex) = @_;
+
+    return $files !~ /$regex/;
+}
+
+my $srcmsg;
+if (fileomitted '\.deb') {
+    # source only upload
+    if (fileomitted '\.diff\.gz') {
+	$srcmsg = _g('source only upload: Debian-native package');
+    } elsif (fileomitted '\.orig\.tar\.gz') {
+	$srcmsg = _g('source only, diff-only upload (original source NOT included)');
+    } else {
+	$srcmsg = _g('source only upload (original source is included)');
+    }
+} else {
+    $srcmsg = _g('full upload (original source is included)');
+    if (fileomitted '\.dsc') {
+	$srcmsg = _g('binary only upload (no source included)');
+    } elsif (fileomitted '\.diff\.gz') {
+	$srcmsg = _g('full upload; Debian-native package (full source is included)');
+    } elsif (fileomitted '\.orig\.tar\.gz') {
+	$srcmsg = _g('binary and diff upload (original source NOT included)');
+    } else {
+	$srcmsg = _g('full upload (original source is included)');
+    }
+}
+
+if ($signchanges && signfile("$pva.changes")) {
+    $signerrors = _g("Failed to sign .changes file");
+}
+
+if ($cleansource) {
+    withecho($rootcommand, 'debian/rules', 'clean');
+}
+
+print "$progname: $srcmsg\n";
+if ($signerrors) {
+    warning($signerrors);
+    exit 1;
+}

+ 0 - 297
scripts/dpkg-buildpackage.sh

@@ -1,297 +0,0 @@
-#!/bin/sh
-
-set -e
-
-version="1.10.10"; # This line modified by Makefile
-
-progname="$(basename "$0")"
-
-showversion () {
-	echo "Debian $progname version $version."
-
-	echo "
-Copyright (C) 1996 Ian Jackson.
-Copyright (C) 2000 Wichert Akkerman
-This is free software; see the GNU General Public Licence version 2 or
-later for copying conditions. There is NO warranty."
-}
-
-usage () {
-	cat <<END
-Usage: $progname [<options> ...]
-
-Options:
-  -r<gain-root-command>
-                 command to gain root privileges (default is fakeroot if it
-                 exists).
-  -p<sign-command>
-  -d             do not check build dependencies and conflicts.
-  -D             check build dependencies and conflicts.
-  -k<keyid>      the key to use for signing.
-  -sgpg          the sign-command is called like GPG.
-  -spgp          the sign-command is called like PGP.
-  -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
-  -S             source only, no binary files.     }
-  -t<system>     set GNU system type.           } passed to dpkg-architecture
-  -v<version>    changes since version <version>.      }
-  -m<maint>      maintainer for package is <maint>.    }
-  -e<maint>      maintainer for release is <maint>.    } only passed
-  -C<descfile>   changes are described in <descfile>.  } to dpkg-genchanges
-  -si (default)  src includes orig for rev. 0 or 1.    }
-  -sa            uploaded src always includes orig.    }
-  -sd            uploaded src is diff and .dsc only.   }
-  -sn            force Debian native source format.      } only passed
-  -s[sAkurKUR]   see dpkg-source for explanation.        } to dpkg-source
-  -nc            do not clean source tree (implies -b).
-  -tc            clean source tree when finished.
-  -ap            add pause before starting signature process.
-  -W             turn certain errors into warnings.       } passed to
-  -E             when -W is turned on, -E turned it off.  } dpkg-source
-  -i[<regex>]    ignore diffs of files matching regex.    } only passed
-  -I<filename>   filter out files when building tarballs. } to dpkg-source
-  --admindir=<directory>
-                 change the administrative directory.
-  -h, --help     show this help message.
-      --version  show the version.
-END
-}
-
-rootcommand=''
-if command -v fakeroot >/dev/null 2>&1; then
-	rootcommand=fakeroot
-fi
-
-signcommand=""
-if [ -e "$GNUPGHOME" ] || [ -e "$HOME/.gnupg" ] && \
-		command -v gpg > /dev/null 2>&1; then
-	signcommand=gpg
-elif command -v pgp > /dev/null 2>&1 ; then
-	signcommand=pgp
-fi
-
-signsource='withecho signfile'
-signchanges='withecho signfile'
-cleansource=false
-checkbuilddep=true
-checkbuilddep_args=''
-binarytarget=binary
-sourcestyle=''
-changesversion=''
-since=''
-maint=''
-desc=''
-noclean=false
-usepause=false
-warnable_error=0
-passopts=''
-admindir=''
-
-while [ $# != 0 ]
-do
-	value="$(echo x"$1" | sed -e 's/x--.*=//;s/^x-.//')"
-	case "$1" in
-	-h|--help)
-		usage; exit 0 ;;
-	--version)
-		showversion; exit 0 ;;
-	--admindir=*)
-		admindir="$value" ;;
-	-r*)	rootcommand="$value" ;;
-	-p*)	signcommand="$value" ;;
-	-k*)	signkey="$value" ;;
-	-d)	checkbuilddep=false ;;
-	-D)	checkbuilddep=true ;;
-	-sgpg)  forcesigninterface=gpg ;;
-	-spgp)  forcesigninterface=pgp ;;
-	-us)	signsource=: ;;
-	-uc)	signchanges=: ;;
-	-ap)	usepause="true";;
-	-a*)    targetarch="$value"; checkbuilddep=false ;;
-	-si)	sourcestyle=-si ;;
-	-sa)	sourcestyle=-sa ;;
-	-sd)	sourcestyle=-sd ;;
-	-s[nsAkurKUR])    passopts="$passopts $1";; # passed to dpkg-source
-        -i*)    diffignore=$1;;
-	-I*)	tarignore="$tarignore $1";;
-	-tc)	cleansource=true ;;
-	-t*)    targetgnusystem="$value" ;;          # Order DOES matter!
-	-nc)	noclean=true; if [ -z "$binaryonly" ]; then binaryonly=-b; fi ;;
-	-b)	binaryonly=-b;
-		checkbuilddep_args='';
-		binarytarget=binary;
-		[ "$sourceonly" ] && \
-			{ echo >&2 "$progname: cannot combine $1 and -S" ; exit 2 ; } ;;
-	-B)	binaryonly=-B; checkbuilddep_args=-B; binarytarget=binary-arch; [ "$sourceonly" ] && \
-			{ echo >&2 "$progname: cannot combine $1 and -S" ; exit 2 ; } ;;
-	-S)	sourceonly=-S; checkbuilddep=false; [ "$binaryonly" ] && \
-			{ echo >&2 "$progname: cannot combine $binaryonly and $1" ; exit 2 ; } ;;
-	-v*)	since="$value" ;;
-	-m*)	maint="$value" ;;
-	-e*)	changedby="$value" ;;
-	-C*)	desc="$value" ;;
-	-W)	warnable_error=1; passopts="$passopts -W";;
-	-E)	warnable_error=0; passopts="$passopts -E";;
-	*)	echo >&2 "$progname: unknown option or argument $1"
-		usage; exit 2 ;;
-	esac
-	shift
-done
-
-if [ -z "$signcommand"  ] ; then
-	signsource=:
-	signchanges=:
-fi
-
-if test -n "$forcesigninterface" ; then
-  signinterface=$forcesigninterface
-else
-  signinterface=$signcommand
-fi
-if [ -n "$signcommand" ] && [ "$signinterface" != "gpg" ] && [ "$signinterface" != "pgp" ] ; then
-    echo >&2 "$progname: unknown sign command, assuming pgp style interface"
-fi
-
-mustsetvar () {
-	if [ "x$2" = x ]; then
-		echo >&2 "$progname: unable to determine $3" ; \
-		exit 1
-	else
-		echo "$progname: $3 $2" ; \
-		eval "$1=\"\$2\""
-	fi
-}
-
-curd="`pwd`"
-dirn="$(basename "$curd")"
-mustsetvar package "`dpkg-parsechangelog | sed -n 's/^Source: //p'`" "source package is"
-mustsetvar changesversion "`dpkg-parsechangelog | sed -n 's/^Version: //p'`" "source version is"
-if [ -n "$changedby" ]; then maintainer="$changedby";
-elif [ -n "$maint" ]; then maintainer="$maint";
-else mustsetvar maintainer "`dpkg-parsechangelog | sed -n 's/^Maintainer: //p'`" "source changed by"; fi
-eval `dpkg-architecture -a${targetarch} -t${targetgnusystem} -s -f`
-
-if [ x$sourceonly = x ]; then
-	mustsetvar arch "`dpkg-architecture -a${targetarch} -t${targetgnusystem} -qDEB_HOST_ARCH`" "host architecture"
-else
-	arch=source
-fi
-mustsetvar sversion "$(echo "$changesversion" | perl -pe 's/^\d+://')" "source version without epoch"
-pv="${package}_${sversion}"
-pva="${package}_${sversion}_${arch}"
-
-signfile () {
-	if test "$signinterface" = "gpg" ; then
-		(cat "../$1" ; echo "") | \
-		$signcommand --local-user "${signkey:-$maintainer}" --clearsign --armor \
-			--textmode  > "../$1.asc" 
-	else
-		$signcommand -u "${signkey:-$maintainer}" +clearsig=on -fast <"../$1" \
-			>"../$1.asc"
-	fi
-	status=$?
-	if [ $status -eq 0 ]; then
-		mv -- "../$1.asc" "../$1"
-	else
-		/bin/rm -f "../$1.asc"
-	fi
-	echo
-	return $status
-}
-
-withecho () {
-        echo " $@" >&2
-	"$@"
-}
-
-if [ "$checkbuilddep" = "true" ]; then
-	if [ -n "$admindir" ]; then
-		checkbuilddep_args="$checkbuilddep_args --admindir=$admindir"
-	fi
-
-	if ! dpkg-checkbuilddeps $checkbuilddep_args; then
-		echo >&2 "$progname: Build dependencies/conflicts unsatisfied; aborting."
-		echo >&2 "$progname: (Use -d flag to override.)"
-		exit 3
-	fi
-fi
-
-set -- $binaryonly $sourceonly $sourcestyle
-if [ -n "$maint"	]; then set -- "$@" "-m$maint"		; fi
-if [ -n "$changedby"	]; then set -- "$@" "-e$changedby"	; fi
-if [ -n "$since"	]; then set -- "$@" "-v$since"		; fi
-if [ -n "$desc"		]; then set -- "$@" "-C$desc"		; fi
-
-if [ x$noclean != xtrue ]; then
-	withecho $rootcommand debian/rules clean
-fi
-if [ x$binaryonly = x ]; then
-	cd ..; withecho dpkg-source $passopts $diffignore $tarignore -b "$dirn"; cd "$dirn"
-fi
-if [ x$sourceonly = x ]; then
-	withecho debian/rules build 
-	withecho $rootcommand debian/rules $binarytarget
-fi
-if [ "$usepause" = "true" ] && \
-   ( [ "$signchanges" != ":" ] || ( [ -z "$binaryonly" ] && [ "$signsource" != ":" ] ) ) ; then
-    echo Press the return key to start signing process
-    read dummy_stuff
-fi
-
-signerrors=
-if [ x$binaryonly = x ]; then
-	if ! $signsource "$pv.dsc"; then
-		signerrors="(WARNING: Failed to sign .dsc and .changes file)"
-		signchanges=:
-	fi
-fi
-chg=../"$pva.changes"
-withecho dpkg-genchanges "$@" >"$chg"
-
-fileomitted () {
-	set +e
-	test -z "`sed -n '/^Files:/,/^[^ ]/ s/'$1'$//p' <$chg`"
-	fir=$?
-	set -e
-	return $fir
-}	
-
-
-if fileomitted '\.deb'; then
-	# source only upload
-	if fileomitted '\.diff\.gz'; then
-		srcmsg='source only upload: Debian-native package'
-	elif fileomitted '\.orig\.tar\.gz'; then
-		srcmsg='source only, diff-only upload (original source NOT included)'
-	else
-		srcmsg='source only upload (original source is included)'
-	fi
-else
-	srcmsg='full upload (original source is included)'
-	if fileomitted '\.dsc'; then
-		srcmsg='binary only upload (no source included)'
-	elif fileomitted '\.diff\.gz'; then
-		srcmsg='full upload; Debian-native package (full source is included)'
-	elif fileomitted '\.orig\.tar\.gz'; then
-		srcmsg='binary and diff upload (original source NOT included)'
-	else
-		srcmsg='full upload (original source is included)'
-	fi
-fi
-
-if ! $signchanges "$pva.changes"; then
-	signerrors="(WARNING: Failed to sign .changes file)"
-fi
-
-if $cleansource; then
-	withecho $rootcommand debian/rules clean
-fi
-
-echo "dpkg-buildpackage: $srcmsg"
-if [ -n "$signerrors" ]; then
-	echo >&2 $signerrors
-	exit 1
-fi

+ 1 - 0
scripts/po/POTFILES.in

@@ -3,6 +3,7 @@
 scripts/822-date.pl
 scripts/controllib.pl
 scripts/dpkg-architecture.pl
+scripts/dpkg-buildpackage.pl
 scripts/dpkg-checkbuilddeps.pl
 scripts/dpkg-distaddfile.pl
 scripts/dpkg-genchanges.pl