faster resolve-bebuilddeps.sh

This commit is contained in:
Marc Wäckerlin
2015-11-03 09:29:22 +00:00
parent 3b70d80fa8
commit 226021ea5a
4 changed files with 215 additions and 21 deletions

View File

@@ -12,21 +12,26 @@
SCHROOTNAME="$1"
sed 's,@[^@]*@, dummytext,g' debian/control.in > debian/control
if test -e debian/control.in -a ! -e debian/control; then
sed 's,@[^@]*@, dummytext,g' debian/control.in > debian/control
trap "rm debian/control" INT TERM EXIT
fi
if test -n "${SCHROOTNAME}"; then
schroot -c "${SCHROOTNAME}" -u root -d / -- apt-get install -y dpkg-dev
DEPS=$(schroot -c "${SCHROOTNAME}" -- dpkg-checkbuilddeps 2>&1 || true)
else
apt-get install -y dpkg-dev
apt-get update
DEPS=$(dpkg-checkbuilddeps 2>&1 || true)
fi
DEPS=$(echo "$DEPS" | sed -n '/Unmet build dependencies/ { s,.*Unmet build dependencies: ,,g; s, ([^)]*),,g; s, *| *,|,g; p}')
TO_INSTALL=
for pa in ${DEPS}; do
if test ${pa//|/} = ${pa}; then
TO_INSTALL+=" ${pa}"
continue;
fi
success=0
for p in $(echo "${pa}" | sed 's,|, ,g'); do
for p in ${pa//|/ }; do
if test -n "${SCHROOTNAME}"; then
if schroot -c "${SCHROOTNAME}" -u root -d / -- apt-get -y install ${p}; then
success=1
@@ -41,7 +46,23 @@ for pa in ${DEPS}; do
done
if test ${success} -eq 0; then
echo "**** Error: Installation Failed: ${pa}"
exit 1
fi
done
success=0
if test -n "${SCHROOTNAME}"; then
if schroot -c "${SCHROOTNAME}" -u root -d / -- apt-get -y install ${TO_INSTALL}; then
success=1
fi
else
if apt-get -y install ${TO_INSTALL}; then
success=1
fi
fi
if test ${success} -eq 0; then
echo "**** Error: Installation Failed: ${pa}"
exit 1
fi
echo "**** Success: All Dependencies Resolved"