2012-02-23 20:03:09 -05:00
|
|
|
#!/bin/bash
|
|
|
|
##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
|
|
|
|
##### Author: Travis Cross <tc@traviscross.com>
|
|
|
|
|
2012-05-05 16:59:50 -04:00
|
|
|
pwd="$(pwd)"
|
|
|
|
ddir="debian"
|
|
|
|
[ "${pwd##*/}" = "debian" ] && ddir="."
|
|
|
|
|
2012-05-05 16:59:09 -04:00
|
|
|
err () {
|
|
|
|
echo "$0 error: $1" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
xread () {
|
|
|
|
local xIFS="$IFS"
|
|
|
|
IFS=''
|
|
|
|
read $@
|
|
|
|
local ret=$?
|
|
|
|
IFS="$xIFS"
|
|
|
|
return $ret
|
|
|
|
}
|
|
|
|
|
2012-02-23 20:03:09 -05:00
|
|
|
create_dbg_pkgs () {
|
2012-05-05 16:59:50 -04:00
|
|
|
for x in $ddir/*; do
|
2012-02-23 20:03:09 -05:00
|
|
|
test ! -d $x && continue
|
|
|
|
test "$x" = "tmp" -o "$x" = "source" && continue
|
|
|
|
test ! "$x" = "${x%-dbg}" && continue
|
|
|
|
test ! -d $x/usr/lib/debug && continue
|
|
|
|
mkdir -p $x-dbg/usr/lib
|
|
|
|
mv $x/usr/lib/debug $x-dbg/usr/lib/
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2012-05-05 16:59:09 -04:00
|
|
|
list_build_depends () {
|
2012-05-05 16:59:50 -04:00
|
|
|
test -f $ddir/.stamp-bootstrap || (cd $ddir && ./bootstrap.sh)
|
2012-05-05 16:59:09 -04:00
|
|
|
local deps="" found=false
|
|
|
|
while xread l; do
|
|
|
|
if [ "${l%%:*}" = "Build-Depends" ]; then
|
|
|
|
deps="${l#*:}"
|
|
|
|
found=true
|
|
|
|
continue
|
|
|
|
elif $found; then
|
|
|
|
if [ -z "$l" ]; then
|
|
|
|
# is newline
|
|
|
|
break
|
|
|
|
elif [ -z "${l##\#*}" ]; then
|
|
|
|
# is comment
|
|
|
|
continue
|
|
|
|
elif [ -z "${l## *}" ]; then
|
|
|
|
# is continuation line
|
|
|
|
deps="$deps $(echo "$l" | sed -e 's/^ *//' -e 's/ *([^)]*)//g' -e 's/,//g')"
|
|
|
|
else
|
|
|
|
# is a new header
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
fi
|
2012-05-05 16:59:50 -04:00
|
|
|
done < $ddir/control
|
2012-05-05 16:59:09 -04:00
|
|
|
echo "${deps# }"
|
|
|
|
}
|
|
|
|
|
2012-05-05 16:23:53 -04:00
|
|
|
cmd="$1"
|
|
|
|
shift
|
|
|
|
case "$cmd" in
|
|
|
|
create-dbg-pkgs) create_dbg_pkgs ;;
|
2012-05-05 16:59:09 -04:00
|
|
|
list-build-depends) list_build_depends ;;
|
2012-05-05 16:23:53 -04:00
|
|
|
esac
|
2012-02-23 20:03:09 -05:00
|
|
|
|