You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.9 KiB
46 lines
1.9 KiB
8 years ago
|
#! /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
|
||
|
|
||
|
SCHROOTNAME="$1"
|
||
|
PACKAGE_NAME=$(sed -n 's/^ *m4_define(x_package_name, \(.*\)).*/\1/p' configure.ac)
|
||
|
PKGCONFIGS="${2:-epel-release}" # packages to configure yum
|
||
|
|
||
|
if test -n "${SCHROOTNAME}"; then
|
||
|
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')
|
||
|
if test -n "${FILES}"; then
|
||
|
FIRST=$(echo "${FILES}" | egrep -o "${PKGCONFIGS// /|}")
|
||
|
if test -n "${FIRST}"; then
|
||
|
schroot -c ${SCHROOTNAME} -u root -- yum install -y ${FIRST} || \
|
||
|
schroot -c ${SCHROOTNAME} -u root -- zypper install -y ${FIRST} || \
|
||
|
schroot -c ${SCHROOTNAME} -u root -- dnf install -y ${FIRST}
|
||
|
fi
|
||
|
schroot -c ${SCHROOTNAME} -u root -- yum install -y ${FILES} || \
|
||
|
schroot -c ${SCHROOTNAME} -u root -- zypper install -y ${FILES} || \
|
||
|
schroot -c ${SCHROOTNAME} -u root -- dnf install -y ${FILES}
|
||
|
fi
|
||
|
else
|
||
|
FILES=$(LANG= rpmbuild -bb --clean --nobuild --define "_topdir ." --define "_sourcedir ." ${PACKAGE_NAME}.spec 2>&1 | sed -n 's, is needed by.*,,p')
|
||
|
if test -n "${FILES}"; then
|
||
|
FIRST=$(echo "${FILES}" | egrep -o "${PKGCONFIGS// /|}")
|
||
|
if test -n "${FIRST}"; then
|
||
|
yum install -y ${FIRST} || \
|
||
|
zypper install -y ${FIRST} || \
|
||
|
dnf install -y ${FIRST}
|
||
|
fi
|
||
|
yum install -y ${FILES} || \
|
||
|
zypper install -y ${FILES} || \
|
||
|
dnf install -y ${FILES}
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
echo "**** Success: All Dependencies Resolved"
|