Merge branch 'master' of git://git.pcp.io/mgoodwin/pcp into mgoodwin-merge
[pcp.git] / Makepkgs
blobeb91dfb197e5c6f40e2530b935aa6fcf64f43c02
1 #!/bin/sh
3 # Make whichever packages the system supports
5 # Copyright (c) 2012-2017 Red Hat.
6 # Copyright (c) 2004 Silicon Graphics, Inc. All Rights Reserved.
7 #
8 # This program is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by the
10 # Free Software Foundation; either version 2 of the License, or (at your
11 # option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 # for more details.
19 topdir=`pwd`
20 signed=false
21 verbose=false
22 srconly=false
23 dorpm=unknown
24 dodeb=unknown
25 parfait=false
26 vector=false
27 webjs=false
28 docker=false
30 if [ ! -d .git ]
31 then
32 echo "Error: can only be run from within the PCP git repository"
33 exit 1
36 if [ ! -f VERSION.pcp ]
37 then
38 echo "Error: can only be run from within the PCP source tree"
39 exit 1
42 tmp=`mktemp -d /tmp/pcp.XXXXXXXXX` || exit 1
43 trap "rm -rf $tmp $tmp.help" 0 1 2 3 15
44 target=`uname -s | tr 'A-Z' 'a-z'`
46 # Find where a GNU tool is hiding, look for this line in the
47 # $gnutool --help output ...
48 # "Report bugs to <bug-$gnutool@gnu.org>"
49 # or lines like this:
50 # FreeBSD $gnutool
51 # NetBSD $gnutool
52 # OpenBSD $gnutool
53 # Apple $gnutool
54 # or these lines:
55 # *This* tar defaults to:
56 # --format=gnu ...
58 gnu_tool()
60 prefix="$1"
61 shift
62 envvar="$1"
63 shift
64 oldcmd="$1"
65 shift
67 # Not in the environment, go search for it in the known locations.
69 if [ -z "$envvar" ]
70 then
71 for command in $oldcmd $@
73 exec=`which $command 2>/dev/null`
74 if [ -n "$exec" ]
75 then
76 $command --help >$tmp.help 2>&1
77 if egrep "(bug-$oldcmd@gnu.org)|(FreeBSD $command)|(NetBSD $command)|(OpenBSD $command)|(Apple $command)" $tmp.help >/dev/null
78 then
79 echo $exec
80 return 0
82 awk <$tmp.help >$tmp.check '
83 BEGIN { want = 0 }
84 /This\** tar defaults to:/ { want=1; next }
85 want == 1 { print; exit }'
86 if grep '[-][-]format=gnu' <$tmp.check >/dev/null
87 then
88 echo $exec
89 return 0
91 # special cases
93 if [ "$target" = openbsd -a $command = gzip ]
94 then
95 echo $exec
96 return 0
99 done
100 echo >&2 "$prefix: can't find GNU $oldcmd in the commands $oldcmd or $@"
101 [ $prefix = Error ] && exit 1
102 return 1
105 # Use the environment request and ensure it is a full path (do not
106 # change this behaviour, it is required for backward-compatibility
107 # - QA failures will result if you choose to ignore this warning).
109 command=`which $envvar 2>/dev/null`
110 if [ -z "$command" ]
111 then
112 echo >&2 "$prefix: $oldcmd (from the environment) does not exist!"
113 [ $prefix = Error ] && exit 1
114 return 1
116 echo $command
117 return 0
120 export MAKE=`gnu_tool Error "$MAKE" make gmake`
121 export TAR=`gnu_tool Warning "$TAR" tar gtar gnutar`
122 export ZIP=`gnu_tool Error "$ZIP" gzip gnuzip`
124 # check if tar supports --transform else we must use git-archive later on (e.g. RHEL5)
125 [ -n "$TAR" ] && $TAR --help | 2>&1 grep -q transform || USE_GIT_ARCHIVE=1
126 #debug# echo TAR=$TAR USE_GIT_ARCHIVE=$USE_GIT_ARCHIVE
128 configure=./configure
129 cmdline_configopts=''
131 for opt in $*
133 case "$opt" in
134 -clean|--clean)
135 # we always clean nowadays, so silently ignore
136 shift
138 -verbose|--verbose)
139 verbose=true
140 shift
142 --nonrpm)
143 dorpm=false
144 shift
146 --nondeb)
147 dodeb=false
148 shift
150 --signed)
151 signed=true
152 shift
154 --source)
155 srconly=true
156 shift
158 --target)
159 shift
160 target=$1
161 shift
163 --with-parfait)
164 cmdline_configopts="$cmdline_configopts $opt"
165 parfait=true
166 shift
168 --with-vector)
169 cmdline_configopts="$cmdline_configopts $opt"
170 vector=true
171 shift
173 --with-webjs)
174 cmdline_configopts="$cmdline_configopts $opt"
175 webjs=true
176 shift
178 --with-docker)
179 docker=true
180 shift
182 --with-make)
183 MAKE=$1
184 shift
186 --with-tar)
187 TAR=$1
188 shift
190 --with-zip)
191 ZIP=$1
192 shift
195 # Add remaining options to the ./configure command line
196 cmdline_configopts="$cmdline_configopts $opt"
197 shift
199 esac
200 done
202 if [ $dorpm = unknown ]
203 then
204 dorpm=false
205 if which slackpkg >/dev/null 2>&1
206 then
207 # Slackware has rpm(1) and rpmbuild(1), but don't build RPMs
210 else
211 [ -x /usr/bin/rpmbuild ] && dorpm=true
214 if [ $dodeb = unknown ]
215 then
216 dodeb=false
217 [ -x /usr/bin/dpkg-buildpackage ] && dodeb=true
220 # Hmm ...
222 if $dodeb && $dorpm
223 then
224 echo >&2 "Do not know how to build RPM and Debian packages at the same time!"
225 echo >&2 "Suggest --nonrpm or --nondeb on the command line."
226 exit 1
229 if $dodeb
230 then
231 # On Debian-based platforms, the debian/rules file already captures
232 # most of the required configure settings in $(configure_paths)
234 configopts=''
235 elif $dorpm
236 then
237 # On RPM-based platforms, rpm macros provide an excellent set of defaults.
238 # This set is based on Fedora 22 %configure macro from /usr/lib/rpm/macros,
239 # and is known to work as far back as RHEL5.
240 configopts="`rpmbuild --eval '--prefix=%{_prefix} --exec-prefix=%{_exec_prefix} --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir}' 2>/dev/null`"
241 # rpmbuild clears the environment, so force these settings into the
242 # rpm build configure
244 configopts="$configopts --with-make=$MAKE --with-tar=$TAR --with-zip=$ZIP"
245 elif [ $target = darwin ]
246 then
247 # On Mac OS X platforms, we install away from /usr/bin, /usr/lib
248 # and so on because of security requirements in recent versions.
250 configopts="--prefix=/usr/local --sysconfdir=/etc --localstatedir=/var"
251 elif [ $target = netbsd ]
252 then
253 # Try to mimic where pkgsrc/pkgin place things
255 configopts="--prefix=/usr/pkg --exec-prefix=/usr/pkg --mandir=/usr/pkg/man --with-rcdir=/etc/rc.d --localstatedir=/usr/pkg --with-rundir=/var/run --with-tmpdir=/var/tmp --with-logdir=/var/log/pcp"
256 elif [ $target = freebsd ]
257 then
258 # Python build does not work on FreeBSD 9.3, so skip it
260 case `uname -r`
262 9.3*)
263 # Bog-standard, just without python
265 configopts="--prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-python=no --with-python3=no"
268 # Bog-standard, as below ...
270 configopts="--prefix=/usr --sysconfdir=/etc --localstatedir=/var"
272 esac
273 else
274 # Bog-standard options suitable for a package on any platform.
275 # Command line can be used to extend this set, and any unusual
276 # platform-specific requirements are also appended later on.
277 configopts="--prefix=/usr --sysconfdir=/etc --localstatedir=/var"
280 # Platform-specific variants ...
282 case "$target"
284 mingw|mingw64|windows)
285 target=mingw
286 dorpm=false
287 configopts="$configopts --disable-ssp"
288 export configure="/usr/bin/mingw64-configure"
289 export MAKE="/usr/bin/mingw64-make"
290 export QMAKE="/usr/bin/mingw64-qmake-qt4"
291 export PKG_CONFIG="/usr/bin/mingw64-pkg-config"
293 linux)
294 ARCH=`uname -m`
295 [ -f /etc/slackware-version -a "$ARCH" = x86_64 ] && configopts="$configopts --libdir=/usr/lib64"
297 sunos|SunOS)
298 ARCH=`isainfo -k`
299 [ "$ARCH" = amd64 -o "$ARCH" = sparcv9 ] && configopts="$configopts --libdir=/usr/lib/64"
300 export YACC=bison
301 export LEX=flex
303 esac
305 # now some specific QA/development hosts with special needs ...
307 case `hostname`
309 vm04|vm04.localdomain|vm11|vm11.localdomain)
310 # gcc -O2 is broken here (for the linux PMDA)
312 configopts="$configopts --with-optimization=no"
313 # over-ride the settings from dpkg-buildflags
315 export DEB_CFLAGS_SET=''
316 export DEB_CXXFLAGS_SET=''
318 esac
320 # and finally add in any from the command line
322 [ -n "$cmdline_configopts" ] && configopts="$configopts $cmdline_configopts"
324 . ./VERSION.pcp
325 VERSION=${PACKAGE_MAJOR}.${PACKAGE_MINOR}.${PACKAGE_REVISION}
327 LOGDIR=$topdir/Logs
328 rm -rf "$LOGDIR"
329 mkdir -p "$LOGDIR"
331 source=pcp-${VERSION}
332 SRCDIR="$topdir/$source"
333 SRCTREE="$topdir/$source"
334 SRCTAR=$topdir/build/tar/$source.src.tar.gz
335 SRCWEBJS=$topdir/build/tar/webjs.tar.gz
336 SRCVECTOR=$topdir/build/tar/vector.tar.gz
337 SRCPARFAIT=$topdir/build/tar/parfait.tar.gz
339 build_failure()
341 # only print in non-verbose mode, otherwise we see double
342 if ! $verbose ; then
343 echo $@ failed, see log in $LOGDIR/pcp
344 tail $LOGDIR/pcp
346 exit 1
349 clean_packaging()
351 echo
352 echo "== Cleaning build tree for packaging build"
353 rm -rf "$SRCDIR" "$SRCTAR" .gitcensus
356 fix_version()
358 if [ -f "$1" -a -f "$2" ]
359 then
360 # as expected, both present
361 if diff "$1" "$2" >/dev/null 2>&1
362 then
364 else
365 # must be using git-archive(1) and VERSION.pcp has been
366 # modified, e.g. by pcp-daily script ... use the modified
367 # one to bump the build number in the packages
369 cp "$1" "$2"
371 else
372 echo "Arrgh ... expect both these to exist ..."
373 ls -l "$1" "$2"
374 exit 1
378 # Download sources from external repositories that we might want
379 # to include with the PCP packages.
381 third_parties()
383 if $parfait
384 then
385 if [ ! -f "$SRCPARFAIT" ]
386 then
387 echo "== Downloading Parfait package"
388 url=https://github.com/performancecopilot/parfait/archive/master.zip
389 wget -H -q -O $tmp/java.zip "$url"
390 [ $? -eq 0 ] && ./scripts/zip2tar $tmp/java.zip "$SRCPARFAIT"
392 if [ -f "$SRCPARFAIT" ]
393 then
394 DESTPARFAIT="$SRCTREE/build/tar/"`basename "$SRCPARFAIT"`
395 cp "$SRCPARFAIT" "$DESTPARFAIT"
399 if $vector
400 then
401 DESTVECTOR="$SRCTREE/build/tar/"`basename "$SRCVECTOR"`
402 if [ ! -f "$SRCVECTOR" ]
403 then
404 echo "== Downloading Vector webapp"
405 url=https://bintray.com/artifact/download/netflixoss/downloads/vector.tar.gz
406 wget -H -q -O "$SRCVECTOR" "$url"
407 [ $? -eq 0 ] && echo "Wrote: $SRCVECTOR"
408 mkdir $tmp/vector && pushd $tmp/vector && $TAR -zxf "$SRCVECTOR"
409 $topdir/scripts/build-vector
410 [ $? -eq 0] || exit 1
411 cd dist && $TAR -czf "$DESTVECTOR" *
412 popd
413 else
414 cp "$SRCVECTOR" "$DESTVECTOR"
418 if $webjs
419 then
420 if [ ! -f "$SRCWEBJS" ]
421 then
422 echo "== Downloading webjs webapps"
423 url=https://github.com/performancecopilot/pcp-webjs/archive/master.zip
424 wget -H -q -O $tmp/js.zip "$url"
425 [ $? -eq 0 ] && ./scripts/zip2tar $tmp/js.zip "$SRCWEBJS"
427 if [ -f "$SRCWEBJS" ]
428 then
429 DESTWEBJS="$SRCTREE/build/tar/"`basename "$SRCWEBJS"`
430 cp "$SRCWEBJS" "$DESTWEBJS"
435 # Generate a list of all the files git knows about, create the
436 # source tarball and then unpack it. We'll then do the package
437 # build in a guaranteed pristine environment.
439 src_tar_build()
441 if [ -z "$TAR" -o ! -z "$USE_GIT_ARCHIVE" ]
442 then
443 # no suitable GNU tar is available, use git-archive(1) - no local changes
444 if git status -s src man | grep '^.M'
445 then
446 echo "Arrgh, modified src files and either no tar ($TAR) or no --transform"
447 echo "support in tar, so local changes would not be included in the build."
448 exit 1
450 git archive --format=tar --prefix=$source/ HEAD | $ZIP > $SRCTAR
451 else
452 # build git file list and make tarball by hand to pick up any changes
454 git ls-files > .gitcensus
456 # but first ensure a "build everything" debian/control has been
457 # recreated
459 cd debian
460 if ./pre-build
461 then
463 else
464 echo "Error: debian/pre-build failed when creating debian/control"
465 exit 1
467 cd ..
468 echo "debian/control" >> .gitcensus
470 $TAR -cz --transform="s,^,$source/," --files-from=.gitcensus \
471 --file=$SRCTAR
472 rm .gitcensus
474 echo "Wrote: $SRCTAR"
477 # On sanity checks :- this is sick, but I'm really tired of QA failing
478 # because of bad binaries being built from the Debian/Ubuntu toolchain
479 # for # i?86 platforms
480 # - Ken McDonell Apr 2010
482 sanity_check_settings()
484 OPT=false
485 ARCH=`uname -m | sed -e 's/i.86/ia32/'`
486 if [ "$ARCH" != "ia32" ]
487 then
488 OPT=true # no workarounds needed for non-i?86 platforms
489 elif [ -f /etc/lsb-release ]
490 then
491 if grep -q 'DISTRIB_ID=Ubuntu' /etc/lsb-release
492 then
493 eval `grep DISTRIB_RELEASE= /etc/lsb-release`
494 XDISTRIB_RELEASE=`echo $DISTRIB_RELEASE | sed -e 's/[^0-9]//g'`
495 [ -z "$XDISTRIB_RELEASE" ] && XDISTRIB_RELEASE=0000
496 if [ $XDISTRIB_RELEASE -gt 1110 ]
497 then
498 # Hope the problem is fixed after Ubuntu 11.10
499 OPT=true
502 $OPT || echo "Building without optimization for Ubuntu $DISTRIB_RELEASE"
503 elif [ -f /etc/debian_version ]
504 then
505 DISTRIB_RELEASE=`cat /etc/debian_version`
506 XDISTRIB_RELEASE=`echo $DISTRIB_RELEASE | sed -e 's/[^0-9]//g'`
507 [ -z "$XDISTRIB_RELEASE" ] && XDISTRIB_RELEASE=0000
508 if [ $XDISTRIB_RELEASE -ge 700 ]
509 then
510 # Hope the problem is fixed in Debian 7.0.0
511 OPT=true
513 $OPT || echo "Building without optimization for Debian $DISTRIB_RELEASE"
516 if ! $OPT
517 then
518 ok=true
519 if grep -q '^my $default_flags .*O2' /usr/bin/dpkg-buildpackage
520 then
521 echo 'dpkg-buildpackage: need to remove O2 from $default_flags'
522 ok=false
524 if grep -q '^[ ]*LDFLAGS.*-Bsymbolic-functions' /usr/bin/dpkg-buildpackage
525 then
526 echo 'dpkg-buildpackage: need to remove -Bsymbolic-function from LDFLAGS'
527 ok=false
529 if ! $ok
530 then
531 echo "Refer to Debian/Ubuntu notes in PCP's ./INSTALL"
532 exit 1
534 # as of Debian 6.0.1 and Ubuntu 10.10, build flags are hidden and
535 # extracted using dpkg-buildflags which fortunately honours some
536 # environment variable settings
538 export DEB_CFLAGS_SET=''
539 export DEB_CXXFLAGS_SET=''
540 export DEB_LDFLAGS_SET=''
544 # Build Debian packages using the dpkg-buildpackage utility which runs
545 # the complete build, from configure through to final deb preparation.
547 debian_buildpackage()
549 echo
550 echo "== Building deb packages using dpkg-buildpackage"
552 SUDO=${SUDO:-fakeroot}
553 # don't sign by default
554 sign='-us -uc'
555 # sign if --signed and $DEB_SIGN_KEYID set in the environment
556 # (always for an upload to Debian servers so its source only)
557 $signed && [ -n "$DEB_SIGN_KEYID" ] && sign='-S'
558 rm -f $tmp/failed
559 if $verbose ; then
560 (dpkg-buildpackage $sign -r$SUDO || touch $tmp/failed) 2>&1 | tee -a $LOGDIR/pcp
561 else
562 (dpkg-buildpackage $sign -r$SUDO || touch $tmp/failed) >>$LOGDIR/pcp 2>&1
564 [ -f $tmp/failed ] && build_failure debian buildpackage
567 prepare_debian_sources()
569 # shortcut for dpkg-buildpackage which does everything itself from here
570 rm -rf "$SRCDIR"
571 mkdir -p "$SRCDIR" 2>/dev/null
573 cd "$SRCDIR" || exit 1
574 $TAR -zxf "$SRCTAR" || exit 1
576 cd "$SRCTREE" || exit 1
577 third_parties
579 fix_version ${topdir}/VERSION.pcp VERSION.pcp
582 prepare_debian_control()
584 echo
585 echo "== Preparing source tree for dpkg-buildpackage"
586 rm -f $tmp/failed debian/control
587 if $verbose ; then
588 ($MAKE -C debian control 2>&1 || touch $tmp/failed) 2>&1 | tee -a $LOGDIR/pcp
589 else
590 ($MAKE -C debian control 2>&1 || touch $tmp/failed) >>$LOGDIR/pcp 2>&1
592 [ -f $tmp/failed ] && build_failure debian control
595 debian_build()
597 SRCDIR="${topdir}/build/deb"
598 SRCTREE="${topdir}/build/deb/$source"
599 prepare_debian_sources
601 # Note: we need to run configure here to get things like builddefs
602 # created, but configure will be run _again_ from
603 # debian_buildpackage, but we need to make sure the same
604 # configure options are used in both places
606 export configure_opts="$configopts"
607 if [ ! -f debian/rules ]
608 then
609 echo "Botch: cannot find debian/rules"
610 exit 1
612 debian_opts=`sed -n <debian/rules -e '/^configure_paths/s/^[^=]*= *//p'`
613 if [ -z "$debian_opts" ]
614 then
615 echo "Botch: cannot get config options from configure_paths in debian/rules"
616 exit 1
618 configopts="$debian_opts $configopts"
619 configure_pcp
620 prepare_debian_control
621 sanity_check_settings
622 debian_buildpackage
624 # success!
625 if ! $verbose ; then
626 grep ^dpkg-deb $LOGDIR/pcp | \
627 sed -e 's,\.$,,g' -e "s,',,g" -e "s,\.\.,$topdir/build/deb,g" | \
628 awk '{ print "Wrote:", $NF }'
630 exit 0
633 prepare_build()
635 echo
636 echo "== Preparing fresh build tree for packaging build"
638 if [ ! -d "$SRCDIR" ]; then
639 # extract gzipped tar archive
640 $TAR -xz --file="$SRCTAR" || exit 1
641 fix_version VERSION.pcp $SRCDIR/VERSION.pcp
645 configure_pcp()
647 echo
648 echo "== Configuring pcp, log is in $LOGDIR/pcp ($configopts)"
650 rm -f $tmp/failed
651 if $verbose
652 then
653 ($configure $configopts 2>&1 || touch $tmp/failed) 2>&1 | tee -a $LOGDIR/pcp
654 else
655 ($configure $configopts 2>&1 || touch $tmp/failed) >>$LOGDIR/pcp 2>&1
657 [ -f $tmp/failed ] && build_failure Configure
660 default_build()
662 echo
663 echo "== Building pcp, log is in $LOGDIR/pcp"
665 rm -f $tmp/failed
666 if $verbose ; then
667 ($MAKE default_pcp 2>&1 || touch $tmp/failed) 2>&1 | tee -a $LOGDIR/pcp
668 else
669 ($MAKE default_pcp 2>&1 || touch $tmp/failed) >>$LOGDIR/pcp 2>&1
671 [ -f $tmp/failed ] && build_failure Make default_pcp
674 packaging_pcp()
676 echo
677 echo "== Packaging pcp, log is in $LOGDIR/pcp" | tee -a $LOGDIR/pcp
679 rm -f $tmp/failed
680 if $verbose ; then
681 ($MAKE -C build pack_pcp 2>&1 || touch $tmp/failed) 2>&1 | tee -a $LOGDIR/pcp
682 else
683 ($MAKE -C build pack_pcp 2>&1 || touch $tmp/failed) >>$LOGDIR/pcp 2>&1
685 [ -f $tmp/failed ] && build_failure Packaging via pack_pcp
688 packaging_rpm()
690 echo
691 echo "== Building rpm packages, log is in $LOGDIR/pcp" | tee -a $LOGDIR/pcp
693 rm -f $tmp/failed
694 export DIST_ROOT=${topdir}/build/rpm/${source}
695 # sign if --signed and $RPM_SIGN_KEYID set in the environment
696 $signed && [ -z "$RPM_SIGN_KEYID" ] && unset RPM_SIGN_KEYID
697 if $verbose ; then
698 ($MAKE -C build/rpm pack_pcp 2>&1 || touch $tmp/failed) 2>&1 | tee -a $LOGDIR/pcp
699 else
700 ($MAKE -C build/rpm pack_pcp 2>&1 || touch $tmp/failed) >>$LOGDIR/pcp 2>&1
702 [ -f $tmp/failed ] && build_failure Packaging RPMs via pack_pcp
705 packaging_docker()
707 echo
708 echo "== Building docker container images, log is in $LOGDIR/pcp" | tee -a $LOGDIR/pcp
709 rm -f $tmp/failed
711 if docker version >/dev/null 2>&1; then
712 v=`docker version | sed -e 's/\./ /g' | \
713 awk '/^Server/ {s=1; if($2 == "version:") {print 10*$3+$4; exit}}
714 /Version:/ {if (s) {print 10*$2+$3; exit}}'`
715 if [ -z "$v" -o "$v" -lt 14 ]; then
716 echo 'Error: docker version too old. Containers build skipped.'
717 touch $tmp/failed
719 else
720 echo 'Error: docker not enabled or not properly configured for non-root access.'
721 echo 'Check the docker service is enabled and running. You can allow non-root access'
722 echo 'as follows: edit /etc/sysconfig/docker and add OPTIONS="-G gid" where gid is a'
723 echo 'group name that you are a member of. Then restart the docker service.'
724 touch $tmp/failed
727 [ -f $tmp/failed ] && build_failure Packaging docker images, docker configuration
729 if $verbose ; then
730 ($MAKE -C build/containers pack_pcp 2>&1 || touch $tmp/failed) 2>&1 | tee -a $LOGDIR/pcp
731 else
732 ($MAKE -C build/containers pack_pcp 2>&1 || touch $tmp/failed) >>$LOGDIR/pcp 2>&1
735 [ -f $tmp/failed ] && build_failure Packaging docker containers via pack_pcp
738 # real build starts here
739 clean_packaging
740 src_tar_build
741 $srconly && exit 0
743 # short-circuit for performing builds with dpkg-buildpackage
744 $dodeb && debian_build
746 prepare_build
748 # download any requested third party sources we're packaging
749 third_parties
751 # shift into the clean packaging build tree from here onward
752 cd "$SRCDIR"
754 configure_pcp
756 # short-circuit for performing rpm-only builds with rpmbuild
757 # (skips over the default_build stage as rpmbuild does that).
758 if $dorpm
759 then
760 packaging_rpm
761 else
762 default_build # perform a complete build in-situ
763 packaging_pcp # create all known package formats
767 # --with-docker, currently only for RPM platforms with docker
768 if $docker
769 then
770 packaging_docker
773 # success!
774 if ! $verbose ; then
775 grep '^Wrote:' $LOGDIR/pcp | sed -e 's/\.\.\/\.\.\///'
777 exit 0