diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 6ee652a..c59fc55 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -301,11 +301,13 @@ VCS="" VCSDEPENDS="" if test -d .svn; then VCS="svn" - VCSDEPENDS="svn2cl, subversion, subversion-tools," + VCSDEPENDS_DEB="svn2cl, subversion, subversion-tools," + VCSDEPENDS_RPM="subversion, subversion-tools," echo -e " \e[32msuccess\e[0m detected ${VCS}" elif test -d .git; then VCS="git" - VCSDEPENDS="git2cl, git," + VCSDEPENDS_DEB="git2cl, git," + VCSDEPENDS_RPM="git," echo -e " \e[32msuccess\e[0m detected ${VCS}" else echo -e " \e[33mignored\e[0m" @@ -1463,7 +1465,7 @@ if testtag AX_USE_DEBIAN_PACKAGING; then -- @PACKAGER@ @BUILD_DATE@ EOF - BUILD_DEPENDS="debhelper, fakeroot, ${VCSDEPENDS} pkg-config, automake, libtool, autotools-dev, pandoc, lsb-release, fakeroot, $(if testtag AX_USE_DOXYGEN; then echo -n ", doxygen, graphviz, mscgen, default-jre-headless|default-jre"; fi; if testtag AX_USE_PERLDOC; then echo -n ", libpod-tree-perl"; fi; if testtag AX_USE_CPPUNIT; then echo -n ", libcppunit-dev"; fi; if testtag AX_CXX_QT || testtag AX_CHECK_QT AX_REQUIRE_QT; then echo -n ", qt5-default | libqt4-core | libqtcore4, qt5-qmake | qt4-qmake, qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools"; fi)" + BUILD_DEPENDS="debhelper, fakeroot, ${VCSDEPENDS_DEB} pkg-config, automake, libtool, autotools-dev, pandoc, lsb-release, fakeroot, $(if testtag AX_USE_DOXYGEN; then echo -n ", doxygen, graphviz, mscgen, default-jre-headless|default-jre"; fi; if testtag AX_USE_PERLDOC; then echo -n ", libpod-tree-perl"; fi; if testtag AX_USE_CPPUNIT; then echo -n ", libcppunit-dev"; fi; if testtag AX_CXX_QT || testtag AX_CHECK_QT AX_REQUIRE_QT; then echo -n ", qt5-default | libqt4-core | libqtcore4, qt5-qmake | qt4-qmake, qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools"; fi)" to debian/control.in < 6 || 0%{?rhl} > 6 || 0%{?centos} > 6 || 0%{?fedora} || 0%{?mageia} +BuildRequires: rpm-sign +%endif %if 0%{?mageia} -BuildRequires: lsb-release$( +BuildRequires: gnupg, lsb-release$( if testtag AX_USE_LIBTOOL; then echo -n ", libltdl-devel" fi diff --git a/scripts/build-in-docker.sh b/scripts/build-in-docker.sh index db5d561..e373f49 100755 --- a/scripts/build-in-docker.sh +++ b/scripts/build-in-docker.sh @@ -15,7 +15,7 @@ dirs=("-v $(pwd):/workdir" "-v ${HOME}/.gnupg:/home/$(id -un)/.gnupg") packages=() targets="all check distcheck" commands=() -arch=$(dpkg --print-architecture) +arch=$((which dpkg > /dev/null 2> /dev/null && dpkg --print-architecture) || echo amd64) wait=0 if test -e ./build-in-docker.conf; then # you can preconfigure the variables in file build-in-docker.conf @@ -186,14 +186,14 @@ function ifthenelse() { os="${arg%%:::*}" thenpart="${arg#*:::}" if test "${thenpart/:::/}" = "${thenpart}"; then - docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)-$(dpkg --print-architecture)" =~ ${os} ]]; then '"${cmd//ARG/${thenpart}}"'; fi' + docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)-$((which dpkg > /dev/null 2> /dev/null && dpkg --print-architecture) || echo amd64)" =~ ${os} ]]; then '"${cmd//ARG/${thenpart}}"'; fi' else elsepart="${thenpart##*:::}" thenpart="${thenpart%:::*}" if test -n "${thenpart}"; then - docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)-$(dpkg --print-architecture)" =~ ${os} ]]; then '"${cmd//ARG/${thenpart}}"'; else '"${cmd//ARG/${elsepart}}"'; fi' + docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)-$((which dpkg > /dev/null 2> /dev/null && dpkg --print-architecture) || echo amd64)" =~ ${os} ]]; then '"${cmd//ARG/${thenpart}}"'; else '"${cmd//ARG/${elsepart}}"'; fi' else - docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)-$(dpkg --print-architecture)" =~ ${os} ]]; then true; else '"${cmd//ARG/${elsepart}}"'; fi' + docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)-$((which dpkg > /dev/null 2> /dev/null && dpkg --print-architecture) || echo amd64)" =~ ${os} ]]; then true; else '"${cmd//ARG/${elsepart}}"'; fi' fi fi fi @@ -216,8 +216,10 @@ if ! docker exec ${DOCKER_ID} getent passwd $(id -u) > /dev/null 2>&1; then fi case $mode in (deb|apt) - docker exec ${DOCKER_ID} locale-gen ${LANG} - docker exec ${DOCKER_ID} update-locale LANG=${LANG} + if [[ "${img}" =~ "ubuntu" ]]; then + docker exec ${DOCKER_ID} locale-gen ${LANG} + docker exec ${DOCKER_ID} update-locale LANG=${LANG} + fi OPTIONS='-o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew -y --force-yes --no-install-suggests --no-install-recommends' for f in 'libpam-systemd:amd64' 'policykit*' 'colord'; do docker exec ${DOCKER_ID} bash -c "echo 'Package: $f' >> /etc/apt/preferences" @@ -259,16 +261,18 @@ gpgcheck=0 EOF fi INSTALL_TOOL=$((docker exec ${DOCKER_ID} test -x /usr/bin/zypper && echo zypper install -y) || (docker exec ${DOCKER_ID} test -x /usr/bin/dnf && echo dnf install -y) || (docker exec ${DOCKER_ID} test -x /usr/bin/yum && echo yum install -y) || (docker exec ${DOCKER_ID} test -x /usr/sbin/urpmi && echo urpmi --auto)) - docker exec ${DOCKER_ID} ${INSTALL_TOOL} rpm-build automake libtool subversion gcc-c++ pkgconfig wget - #i=0 - #for repo in "${repos[@]}"; do - # INSTALL_REPO=$((docker exec ${DOCKER_ID} test -x /usr/bin/zypper && echo zypper ar) || (docker exec ${DOCKER_ID} test -x /usr/bin/dnf && echo dnf config-manager --add-repo) || (docker exec ${DOCKER_ID} test -x /usr/bin/yum && echo wget -O/etc/yum.repos.d/additional$i.repo) || (docker exec ${DOCKER_ID} test -x /usr/sbin/urpmi && echo true)) - # ifthenelse "${repo}" "${INSTALL_REPO} ARG" - # ((++i)) - #done - docker exec -u $(id -u):$(id -g) ${DOCKER_ID} ./bootstrap.sh -c - TGZFILE=$(grep PACKAGE_STRING= configure | sed "s, ,-,g;s,PACKAGE_STRING=',,g;s,',.tar.gz,g") - touch $TGZFILE + docker exec ${DOCKER_ID} ${INSTALL_TOOL} rpm-build automake libtool subversion gcc-c++ pkgconfig wget /usr/bin/lsb_release + i=0 + for key in "${keys[@]}"; do + wget -Orpm-key "$key" + docker exec -i ${DOCKER_ID} rpm --import rpm-key + rm rpm-key + done + for repo in "${repos[@]}"; do + INSTALL_REPO=$((docker exec ${DOCKER_ID} test -x /usr/bin/zypper && echo zypper ar) || (docker exec ${DOCKER_ID} test -x /usr/bin/dnf && echo dnf config-manager --add-repo) || (docker exec ${DOCKER_ID} test -x /usr/bin/yum && echo wget -O/etc/yum.repos.d/additional$i.repo) || (docker exec ${DOCKER_ID} test -x /usr/sbin/urpmi && echo true)) + ifthenelse "${repo}" "${INSTALL_REPO} ARG" + ((++i)) + done docker exec ${DOCKER_ID} ./resolve-rpmbuilddeps.sh ;; esac diff --git a/scripts/resolve-rpmbuilddeps.sh b/scripts/resolve-rpmbuilddeps.sh index 5c1e968..1ed2408 100755 --- a/scripts/resolve-rpmbuilddeps.sh +++ b/scripts/resolve-rpmbuilddeps.sh @@ -14,6 +14,21 @@ INSTALL_TOOL=${INSTALL_TOOL:-$((test -x /usr/bin/zypper && echo zypper install - SCHROOTNAME="$1" PACKAGE_NAME=$(sed -n 's/^ *m4_define(x_package_name, \(.*\)).*/\1/p' configure.ac) +TRAP_CMD= +if test -e ${PACKAGE_NAME}.spec.in -a ! -e ${PACKAGE_NAME}.spec; then + TRAP_CMD+="rm ${PACKAGE_NAME}.spec;" + trap "${TRAP_CMD}" INT TERM EXIT + sed 's,@RPM_DEPEND_IFEXISTS@,,g' ${PACKAGE_NAME}.spec.in | \ + sed 's,@[^@]*@, dummytext,g' > ${PACKAGE_NAME}.spec +fi + +TGZFILE=$(sed -n '/^Name: */{s///;h};/^Version: */{s///;H;x;s/\n/-/;s/$/.tar.gz/;p}' ${PACKAGE_NAME}.spec) +if ! test -e $TGZFILE; then + TRAP_CMD+="rm ${TGZFILE};" + trap "${TRAP_CMD}" INT TERM EXIT + touch $TGZFILE +fi + 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