5 version="1.13.17"; # This line modified by Makefile
7 progname="`basename \"$0\"`"
10 Debian dpkg-buildpackage $version.
11 Copyright (C) 1996 Ian Jackson.
12 Copyright (C) 2000 Wichert Akkerman
13 This is free software; see the GNU General Public Licence version 2
14 or later for copying conditions. There is NO warranty.
16 Usage: dpkg-buildpackage [options]
17 Options: -r<gain-root-command>
19 -d do not check build dependencies and conflicts
20 -D check build dependencies and conflicts
21 -k<keyid> the key to use for signing
22 -sgpg the sign-command is called like GPG
23 -spgp the sign-command is called like PGP
26 -a<arch> Debian architecture we build for (implies -d)
27 -b binary-only, do not build source } also passed to
28 -B binary-only, no arch-indep files } dpkg-genchanges
29 -S source only, no binary files }
30 -t<system> set GNU system type } passed to dpkg-architecture
31 -v<version> changes since version <version> }
32 -m<maint> maintainer for package is <maint> }
33 -e<maint> maintainer for release is <maint> } only passed
34 -C<descfile> changes are described in <descfile> } to dpkg-
35 -si (default) src includes orig for rev. 0 or 1 } genchanges
36 -sa uploaded src always includes orig }
37 -sd uploaded src is diff and .dsc only }
38 -nc do not clean source tree (implies -b)
39 -tc clean source tree when finished
40 -ap add pause before starting signature process
42 -W Turn certain errors into warnings. } passed to
43 -E When -W is turned on, -E turned it off. } dpkg-source
44 -i[<regex>] ignore diffs of files matching regex } only passed
45 -I<filename> filter out files when building tarballs } to dpkg-source
51 if (( [ -n "$GNUPGHOME" ] && [ -e "$GNUPGHOME" ] ) || [ -e "$HOME/.gnupg" ] ) && \
52 command -v gpg > /dev/null 2>&1; then
54 elif command -v pgp > /dev/null 2>&1 ; then
58 signsource='withecho signfile'
59 signchanges='withecho signfile'
76 value="`echo x\"$1\" | sed -e 's/^x-.//'`"
78 -h) usageversion; exit 0 ;;
79 -r*) rootcommand="$value" ;;
80 -p*) signcommand="$value" ;;
81 -k*) signkey="$value" ;;
82 -d) checkbuilddep=false ;;
83 -D) checkbuilddep=true ;;
84 -sgpg) forcesigninterface=gpg ;;
85 -spgp) forcesigninterface=pgp ;;
88 -ap) usepause="true";;
89 -a*) targetarch="$value"; checkbuilddep=false ;;
90 -si) sourcestyle=-si ;;
91 -sa) sourcestyle=-sa ;;
92 -sd) sourcestyle=-sd ;;
94 -I*) tarignore="$tarignore $1";;
95 -tc) cleansource=true ;;
96 -t*) targetgnusystem="$value" ;; # Order DOES matter!
97 -nc) noclean=true; if [ -z "$binaryonly" ]; then binaryonly=-b; fi ;;
98 -b) binaryonly=-b; [ "$sourceonly" ] && \
99 { echo >&2 "$progname: cannot combine $1 and -S" ; exit 2 ; } ;;
100 -B) binaryonly=-B; checkbuilddep_args=-B; binarytarget=binary-arch; [ "$sourceonly" ] && \
101 { echo >&2 "$progname: cannot combine $1 and -S" ; exit 2 ; } ;;
102 -S) sourceonly=-S; checkbuilddep=false; [ "$binaryonly" ] && \
103 { echo >&2 "$progname: cannot combine $binaryonly and $1" ; exit 2 ; } ;;
104 -v*) since="$value" ;;
105 -m*) maint="$value" ;;
106 -e*) changedby="$value" ;;
107 -C*) desc="$value" ;;
108 -W) warnable_error=1; passopts="$passopts -W";;
109 -E) warnable_error=0; passopts="$passopts -E";;
110 *) echo >&2 "$progname: unknown option or argument $1"
111 usageversion; exit 2 ;;
116 if [ -z "$signcommand" ] ; then
121 if test -n "$forcesigninterface" ; then
122 signinterface=$forcesigninterface
123 if [ "$signinterface" != "gpg" ] && [ "$signinterface" != "pgp" ] ; then
124 echo >&2 "$progname: invalid sign interface specified"
128 signinterface=$signcommand
133 if [ "x$2" = x ]; then
134 echo >&2 "$progname: unable to determine $3" ; \
137 echo "$progname: $3 $2" ; \
143 dirn="`basename \"$curd\"`"
144 mustsetvar package "`dpkg-parsechangelog | sed -n 's/^Source: //p'`" "source package is"
145 mustsetvar version "`dpkg-parsechangelog | sed -n 's/^Version: //p'`" "source version is"
146 if [ -n "$changedby" ]; then maintainer="$changedby";
147 elif [ -n "$maint" ]; then maintainer="$maint";
148 else mustsetvar maintainer "`dpkg-parsechangelog | sed -n 's/^Maintainer: //p'`" "source changed by"; fi
149 eval `dpkg-architecture -a${targetarch} -t${targetgnusystem} -s -f`
151 if [ x$sourceonly = x ]; then
152 mustsetvar arch "`dpkg-architecture -a${targetarch} -t${targetgnusystem} -qDEB_HOST_ARCH`" "host architecture"
156 sversion=`echo "$version" | perl -pe 's/^\d+://'`
157 pv="${package}_${sversion}"
158 pva="${package}_${sversion}_${arch}"
161 if test "$signinterface" = "gpg" ; then
162 (cat "../$1" ; echo "") | \
163 $signcommand --local-user "${signkey:-$maintainer}" --clearsign --armor \
164 --textmode > "../$1.asc"
166 $signcommand -u "${signkey:-$maintainer}" +clearsig=on -fast <"../$1" \
170 if [ $status -eq 0 ]; then
171 mv -- "../$1.asc" "../$1"
173 /bin/rm -f "../$1.asc"
184 if [ "$checkbuilddep" = "true" ]; then
185 if ! dpkg-checkbuilddeps $checkbuilddep_args; then
186 echo >&2 "$progname: Build dependencies/conflicts unsatisfied; aborting."
187 echo >&2 "$progname: (Use -d flag to override.)"
192 set -- $binaryonly $sourceonly $sourcestyle
193 if [ -n "$maint" ]; then set -- "$@" "-m$maint" ; fi
194 if [ -n "$changedby" ]; then set -- "$@" "-e$changedby" ; fi
195 if [ -n "$since" ]; then set -- "$@" "-v$since" ; fi
196 if [ -n "$desc" ]; then set -- "$@" "-C$desc" ; fi
198 if [ x$noclean != xtrue ]; then
199 withecho $rootcommand debian/rules clean
201 if [ x$binaryonly = x ]; then
202 cd ..; withecho dpkg-source $passopts $diffignore $tarignore -b "$dirn"; cd "$dirn"
204 if [ x$sourceonly = x ]; then
205 withecho debian/rules build
206 withecho $rootcommand debian/rules $binarytarget
208 if [ "$usepause" = "true" ] && \
209 ( [ "$signchanges" != ":" ] || ( [ -z "$binaryonly" ] && [ "$signsource" != ":" ] ) ) ; then
210 echo Press the return key to start signing process
215 if [ x$binaryonly = x ]; then
216 if ! $signsource "$pv.dsc"; then
217 signerrors="(WARNING: Failed to sign .dsc and .changes file)"
221 chg=../"$pva.changes"
222 withecho dpkg-genchanges "$@" >"$chg"
226 test -z "`sed -n '/^Files:/,/^[^ ]/ s/'$1'$//p' <$chg`"
233 if fileomitted '\.deb'; then
235 if fileomitted '\.diff\.gz'; then
236 srcmsg='source only upload: Debian-native package'
237 elif fileomitted '\.orig\.tar\.gz'; then
238 srcmsg='source only, diff-only upload (original source NOT included)'
240 srcmsg='source only upload (original source is included)'
243 srcmsg='full upload (original source is included)'
244 if fileomitted '\.dsc'; then
245 srcmsg='binary only upload (no source included)'
246 elif fileomitted '\.diff\.gz'; then
247 srcmsg='full upload; Debian-native package (full source is included)'
248 elif fileomitted '\.orig\.tar\.gz'; then
249 srcmsg='binary and diff upload (original source NOT included)'
251 srcmsg='full upload (original source is included)'
255 if ! $signchanges "$pva.changes"; then
256 signerrors="(WARNING: Failed to sign .changes file)"
259 if $cleansource; then
260 withecho $rootcommand debian/rules clean
263 echo "dpkg-buildpackage: $srcmsg"
264 if [ -n "$signerrors" ]; then