Files
mrw-cxx/resolve-rpmbuilddeps.sh

30 lines
1.3 KiB
Bash
Raw Normal View History

2015-09-11 10:42:51 +00:00
#! /bin/bash -ex
## @id $Id$
## Resolve RPM Build Dependencies
## Installs all the required packages
## Call: ./resolve-rpmbuilddeps 'name of build schroot'
## e.g. call: ./resolve-rpmbuilddeps opensuse-13.2_x86_64
## 1 2 3 4 5 6 7 8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
2016-12-07 20:21:54 +00:00
INSTALL_TOOL=${INSTALL_TOOL:-$((test -x /usr/bin/zypper && echo zypper install -y) || (test -x /usr/bin/dnf && echo dnf install -y) || (test -x /usr/bin/yum && echo yum install -y) || (test -x /usr/sbin/urpmi && echo urpmi --auto))}
2015-09-11 10:42:51 +00:00
SCHROOTNAME="$1"
PACKAGE_NAME=$(sed -n 's/^ *m4_define(x_package_name, \(.*\)).*/\1/p' configure.ac)
if test -n "${SCHROOTNAME}"; then
2015-10-20 12:54:04 +00:00
FILES=$(LANG= schroot -c ${SCHROOTNAME} -- rpmbuild -bb --clean --nobuild --define "_topdir ." --define "_sourcedir ." ${PACKAGE_NAME}.spec 2>&1 | sed -n 's, is needed by.*,,p')
2015-09-11 10:42:51 +00:00
if test -n "${FILES}"; then
2016-12-07 20:21:54 +00:00
schroot -c ${SCHROOTNAME} -u root -- ${INSTALL_TOOL} ${FILES}
2015-09-11 10:42:51 +00:00
fi
else
2015-10-20 12:54:04 +00:00
FILES=$(LANG= rpmbuild -bb --clean --nobuild --define "_topdir ." --define "_sourcedir ." ${PACKAGE_NAME}.spec 2>&1 | sed -n 's, is needed by.*,,p')
2015-09-11 10:42:51 +00:00
if test -n "${FILES}"; then
2016-12-07 20:21:54 +00:00
${INSTALL_TOOL} ${FILES}
2015-09-11 10:42:51 +00:00
fi
fi
echo "**** Success: All Dependencies Resolved"