From 76c02c4427a6a08fc99d7b8efac7dfdd04e15bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Mon, 2 Nov 2015 00:18:30 +0000 Subject: [PATCH] new author url --- build-resource-file.sh | 31 +++++++++++++++++++++++++++ resolve-debbuilddeps.sh | 47 +++++++++++++++++++++++++++++++++++++++++ resolve-rpmbuilddeps.sh | 34 +++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100755 build-resource-file.sh create mode 100755 resolve-debbuilddeps.sh create mode 100755 resolve-rpmbuilddeps.sh diff --git a/build-resource-file.sh b/build-resource-file.sh new file mode 100755 index 0000000..746b82c --- /dev/null +++ b/build-resource-file.sh @@ -0,0 +1,31 @@ +#! /bin/bash -ex + +## @id $Id$ + +## build resource.qrc file from a resource directory +## +## Argument: $1: resource path (default: resources) +## Result: file named .qrc (default: resources.qrc) +## +## Call: +## +## cd src +## ../build-resource-file.sh + +## 1 2 3 4 5 6 7 8 +## 45678901234567890123456789012345678901234567890123456789012345678901234567890 + +RESOURCES=${1:-resources} +TARGET=${RESOURCES}.qrc + +test -d ${RESOURCES} + +echo "" > ${TARGET} +for d in $(find resources -mindepth 1 -type d); do + echo " " >> ${TARGET} + for f in $(find $d -mindepth 1 -maxdepth 1 -type f); do + echo " $f" >> ${TARGET} + done + echo " " >> ${TARGET} +done +echo "" >> ${TARGET} diff --git a/resolve-debbuilddeps.sh b/resolve-debbuilddeps.sh new file mode 100755 index 0000000..6ceef6b --- /dev/null +++ b/resolve-debbuilddeps.sh @@ -0,0 +1,47 @@ +#! /bin/bash -ex + +## @id $Id$ + +## Resolve Debian Build Dependencies +## Installs all the required packages +## Call: ./resolve-debbuilddeps 'name of build schroot' +## e.g. call: ./resolve-debbuilddeps trusty_amd64 + +## 1 2 3 4 5 6 7 8 +## 45678901234567890123456789012345678901234567890123456789012345678901234567890 + +SCHROOTNAME="$1" + +sed 's,@[^@]*@, dummytext,g' debian/control.in > debian/control + +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 + sudo apt-get install -y dpkg-dev + sudo 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}') + +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; + fi + else + if sudo apt-get -y install ${p}; then + success=1 + break; + fi + fi + done + if test ${success} -eq 0; then + echo "**** Error: Installation Failed: ${pa}" + fi +done + +echo "**** Success: All Dependencies Resolved" diff --git a/resolve-rpmbuilddeps.sh b/resolve-rpmbuilddeps.sh new file mode 100755 index 0000000..f36a875 --- /dev/null +++ b/resolve-rpmbuilddeps.sh @@ -0,0 +1,34 @@ +#! /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) + +if test -n "${SCHROOTNAME}"; then + schroot -c ${SCHROOTNAME} -- ./bootstrap.sh -t dist + 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 + 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 + ./bootstrap.sh -t dist + 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 + yum install -y ${FILES} || \ + zypper install -y ${FILES} || \ + dnf install -y ${FILES} + fi +fi + +echo "**** Success: All Dependencies Resolved"