debian: force build output to stderr

Because we're capturing the string return value of these functions, we
can't see any output that goes to stdout.
This commit is contained in:
Travis Cross 2012-05-28 17:03:23 +00:00
parent 496b9a9c78
commit d3cb703697

186
debian/util.sh vendored
View File

@ -133,62 +133,66 @@ check_repo_clean () {
} }
create_orig () { create_orig () {
local OPTIND OPTARG {
local uver="" bundle_deps=false zl=9e local OPTIND OPTARG
while getopts 'bnv:z:' o "$@"; do local uver="" bundle_deps=false zl=9e
case "$o" in while getopts 'bnv:z:' o "$@"; do
b) bundle_deps=true;; case "$o" in
n) uver="nightly";; b) bundle_deps=true;;
v) uver="$OPTARG";; n) uver="nightly";;
z) zl="$OPTARG";; v) uver="$OPTARG";;
esac z) zl="$OPTARG";;
done esac
shift $(($OPTIND-1)) done
[ -z "$uver" ] || [ "$uver" = "nightly" ] \ shift $(($OPTIND-1))
&& uver="$(cat build/next-release.txt)-n$(date +%Y%m%dT%H%M%SZ)" [ -z "$uver" ] || [ "$uver" = "nightly" ] \
local treeish="$1" dver="$(mk_dver "$uver")" && uver="$(cat build/next-release.txt)-n$(date +%Y%m%dT%H%M%SZ)"
local orig="../freeswitch_$dver.orig.tar.xz" local treeish="$1" dver="$(mk_dver "$uver")"
[ -n "$treeish" ] || treeish="HEAD" local orig="../freeswitch_$dver.orig.tar.xz"
check_repo_clean [ -n "$treeish" ] || treeish="HEAD"
git reset --hard "$treeish" check_repo_clean
mv .gitattributes .gitattributes.orig git reset --hard "$treeish"
grep .gitattributes.orig \ mv .gitattributes .gitattributes.orig
-e '\bdebian-ignore\b' \ grep .gitattributes.orig \
-e '\bdfsg-nonfree\b' \ -e '\bdebian-ignore\b' \
| while xread l; do -e '\bdfsg-nonfree\b' \
echo "$l export-ignore" >> .gitattributes | while xread l; do
done echo "$l export-ignore" >> .gitattributes
if $bundle_deps; then done
(cd libs && getlibs) if $bundle_deps; then
git add -f libs (cd libs && getlibs)
fi git add -f libs
./build/set-fs-version.sh "$uver" && git add configure.in fi
git commit --allow-empty -m "nightly v$uver" ./build/set-fs-version.sh "$uver" && git add configure.in
git archive -v \ git commit --allow-empty -m "nightly v$uver"
--worktree-attributes \ git archive -v \
--format=tar \ --worktree-attributes \
--prefix=freeswitch-$uver/ \ --format=tar \
HEAD \ --prefix=freeswitch-$uver/ \
| xz -c -${zl}v > $orig HEAD \
mv .gitattributes.orig .gitattributes | xz -c -${zl}v > $orig
git reset --hard HEAD^ && git clean -fdx mv .gitattributes.orig .gitattributes
git reset --hard HEAD^ && git clean -fdx
} 1>&2
echo $orig echo $orig
} }
create_dsc () { create_dsc () {
local distro="$(find_distro $1)" orig="$2" {
local suite="$(find_suite $distro)" local distro="$(find_distro $1)" orig="$2"
local orig_ver="$(echo "$orig" | sed -e 's/^.*_//' -e 's/\.orig\.tar.*$//')" local suite="$(find_suite $distro)"
local dver="${orig_ver}-1~${distro}+1" local orig_ver="$(echo "$orig" | sed -e 's/^.*_//' -e 's/\.orig\.tar.*$//')"
[ -x "$(which dch)" ] \ local dver="${orig_ver}-1~${distro}+1"
|| err "package devscripts isn't installed" [ -x "$(which dch)" ] \
(cd debian && ./bootstrap.sh -c $distro) || err "package devscripts isn't installed"
dch -b -m -v "$dver" --force-distribution -D "$suite" "Nightly build." (cd debian && ./bootstrap.sh -c $distro)
git add debian/changelog && git commit -m "nightly v$orig_ver" dch -b -m -v "$dver" --force-distribution -D "$suite" "Nightly build."
dpkg-source -i.* -Zxz -z9 -b . git add debian/changelog && git commit -m "nightly v$orig_ver"
dpkg-genchanges -S > ../$(dsc_base)_source.changes dpkg-source -i.* -Zxz -z9 -b .
local dsc="../$(dsc_base).dsc" dpkg-genchanges -S > ../$(dsc_base)_source.changes
git reset --hard HEAD^ && git clean -fdx local dsc="../$(dsc_base).dsc"
git reset --hard HEAD^ && git clean -fdx
} 1>&2
echo $dsc echo $dsc
} }
@ -202,45 +206,47 @@ EOF
} }
build_debs () { build_debs () {
local OPTIND OPTARG debug_hook=false hookdir="" {
while getopts 'd' o "$@"; do local OPTIND OPTARG debug_hook=false hookdir=""
case "$o" in while getopts 'd' o "$@"; do
d) debug_hook=true;; case "$o" in
esac d) debug_hook=true;;
done esac
shift $(($OPTIND-1)) done
local distro="$(find_distro $1)" dsc="$2" arch="$3" shift $(($OPTIND-1))
if [ -z "$distro" ] || [ "$distro" = "auto" ]; then local distro="$(find_distro $1)" dsc="$2" arch="$3"
if ! (echo "$dsc" | grep -e '-[0-9]*~[a-z]*+[0-9]*'); then if [ -z "$distro" ] || [ "$distro" = "auto" ]; then
err "no distro specified or found" if ! (echo "$dsc" | grep -e '-[0-9]*~[a-z]*+[0-9]*'); then
err "no distro specified or found"
fi
local x="$(echo $dsc | sed -e 's/^[^-]*-[0-9]*~//' -e 's/+[^+]*$//')"
distro="$(find_distro $x)"
fi fi
local x="$(echo $dsc | sed -e 's/^[^-]*-[0-9]*~//' -e 's/+[^+]*$//')" [ -n "$arch" ] || arch="$(dpkg-architecture | grep '^DEB_BUILD_ARCH=' | cut -d'=' -f2)"
distro="$(find_distro $x)" [ -x "$(which cowbuilder)" ] \
fi || err "package cowbuilder isn't installed"
[ -n "$arch" ] || arch="$(dpkg-architecture | grep '^DEB_BUILD_ARCH=' | cut -d'=' -f2)" local cow_img=/var/cache/pbuilder/base-$distro-$arch.cow
[ -x "$(which cowbuilder)" ] \ cow () {
|| err "package cowbuilder isn't installed" cowbuilder "$@" \
local cow_img=/var/cache/pbuilder/base-$distro-$arch.cow --distribution $distro \
cow () { --architecture $arch \
cowbuilder "$@" \ --basepath $cow_img
--distribution $distro \ }
--architecture $arch \ if ! [ -d $cow_img ]; then
--basepath $cow_img announce "Creating base $distro-$arch image..."
} cow --create
if ! [ -d $cow_img ]; then fi
announce "Creating base $distro-$arch image..." announce "Updating base $distro-$arch image..."
cow --create cow --update
fi announce "Building $distro-$arch DEBs from $dsc..."
announce "Updating base $distro-$arch image..." if $debug_hook; then
cow --update mkdir -p .hooks
announce "Building $distro-$arch DEBs from $dsc..." fmt_debug_hook > .hooks/C10shell
if $debug_hook; then chmod +x .hooks/C10shell
mkdir -p .hooks hookdir=$(pwd)/.hooks
fmt_debug_hook > .hooks/C10shell fi
chmod +x .hooks/C10shell cow --build $dsc --hookdir "$hookdir"
hookdir=$(pwd)/.hooks } 1>&2
fi
cow --build $dsc --hookdir "$hookdir"
echo ${dsc}_${arch}.changes echo ${dsc}_${arch}.changes
} }