|
|
|
@ -12,33 +12,62 @@ |
|
|
|
|
|
|
|
|
|
SCHROOTNAME="$1" |
|
|
|
|
|
|
|
|
|
sed 's,@[^@]*@, dummytext,g' debian/control.in > debian/control |
|
|
|
|
function install() { |
|
|
|
|
if test -n "${SCHROOTNAME}"; then |
|
|
|
|
if schroot -c "${SCHROOTNAME}" -u root -d / -- apt-get -y install $*; then |
|
|
|
|
return 0 |
|
|
|
|
fi |
|
|
|
|
else |
|
|
|
|
if apt-get -y install $*; then |
|
|
|
|
return 0 |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TO_INSTALL= |
|
|
|
|
|
|
|
|
|
if test -e debian/control.in -a ! -e debian/control; then |
|
|
|
|
for f in $(sed -n 's, *AX_DEB_DEPEND_IFEXISTS(\([^)]*\)).*,\1,p' configure.ac); do |
|
|
|
|
if test -n "$(apt-cache policy -q ${f})" && ! dpkg -l "${f}"; then |
|
|
|
|
TO_INSTALL+=" ${f}" |
|
|
|
|
fi |
|
|
|
|
done |
|
|
|
|
trap "rm debian/control" INT TERM EXIT |
|
|
|
|
sed 's,@DEB_DEPEND_IFEXISTS@,,g' debian/control.in | \ |
|
|
|
|
sed 's,@[^@]*@, dummytext,g' > debian/control |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if test -n "${SCHROOTNAME}"; then |
|
|
|
|
schroot -c "${SCHROOTNAME}" -u root -d / -- apt-get -y install dpkg-dev |
|
|
|
|
DEPS=$(schroot -c "${SCHROOTNAME}" -- dpkg-checkbuilddeps 2>&1 || true) |
|
|
|
|
else |
|
|
|
|
apt-get -y install dpkg-dev |
|
|
|
|
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}') |
|
|
|
|
|
|
|
|
|
for pa in ${DEPS}; do |
|
|
|
|
success=0 |
|
|
|
|
for p in $(echo "${pa}" | sed 's,|, ,g'); do |
|
|
|
|
if test -n "${SCHROOTNAME}"; then |
|
|
|
|
if schroot -c "${SCHROOTNAME}" -u root -d / -- apt-get -y install ${p}; then |
|
|
|
|
success=1 |
|
|
|
|
break; |
|
|
|
|
if test ${pa//|/} = ${pa}; then |
|
|
|
|
TO_INSTALL+=" ${pa}" |
|
|
|
|
continue; |
|
|
|
|
fi |
|
|
|
|
else |
|
|
|
|
if sudo apt-get -y install ${p}; then |
|
|
|
|
success=0 |
|
|
|
|
for p in ${pa//|/ }; do |
|
|
|
|
if install ${TO_INSTALL} ${p}; then |
|
|
|
|
TO_INSTALL+=" ${p}" |
|
|
|
|
success=1 |
|
|
|
|
break; |
|
|
|
|
fi |
|
|
|
|
break |
|
|
|
|
fi |
|
|
|
|
done |
|
|
|
|
if test ${success} -eq 0; then |
|
|
|
|
echo "**** Error: Installation Failed: ${pa}" |
|
|
|
|
exit 1 |
|
|
|
|
fi |
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
if test -n "${TO_INSTALL}" && ! install ${TO_INSTALL}; then |
|
|
|
|
echo "**** Error: Installation Failed: ${TO_INSTALL}" |
|
|
|
|
exit 1 |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
echo "**** Success: All Dependencies Resolved" |
|
|
|
|