From dc869529cddba50a4edda1f8eb7fac044d7b1a8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Mon, 20 Mar 2017 12:06:50 +0000 Subject: [PATCH] allow package definitions for all (deb and rpm),or deb or rpm; fixed rpmsign for fedora --- scripts/ax_init_standard_project.m4 | 284 +++++++++++++++++++++++++++- scripts/bootstrap.sh | 39 ++-- scripts/build-in-docker.sh | 26 +-- scripts/resolve-debbuilddeps.sh | 14 +- scripts/resolve-rpmbuilddeps.sh | 29 ++- scripts/rpmsign.exp | 14 ++ 6 files changed, 372 insertions(+), 34 deletions(-) create mode 100755 scripts/rpmsign.exp diff --git a/scripts/ax_init_standard_project.m4 b/scripts/ax_init_standard_project.m4 index 7f97e5f..a260e0c 100644 --- a/scripts/ax_init_standard_project.m4 +++ b/scripts/ax_init_standard_project.m4 @@ -570,7 +570,7 @@ AC_DEFUN([AX_USE_RPM_PACKAGING], [ EXTRA_DIST += \${PACKAGE_NAME}.spec.in rpm: dist rpmbuild -ba --define "_topdir \$\$(pwd)" --define "_sourcedir \$\$(pwd)" \${PACKAGE_NAME}.spec - rpmsign --define "_gpg_name \${PACKAGER}" --addsign RPMS/*/*.rpm SRPMS/*.rpm + ./rpmsign.exp "\${PACKAGER}" "\{PASSWORD}" RPMS/*/*.rpm SRPMS/*.rpm clean-rpm-targets: -rm -rf BUILD BUILDROOT RPMS SPECS SRPMS distclean-rpm-targets: @@ -802,6 +802,120 @@ AC_DEFUN([AX_PKG_REQUIRE], [ AC_MSG_ERROR([Feature $1 not found please install module $secondpar]) fi fi + AX_DEB_DEPEND([${$1_found}]) + AX_RPM_DEPEND([${$1_found}]) + [$1]_CPPFLAGS="${$1_CFLAGS}" + [$1]_CXXFLAGS="${$1_CFLAGS}" + AC_SUBST([$1]_CPPFLAGS) + AC_SUBST([$1]_CXXFLAGS) + if test "${optional_flags/manualflags/}" = "${optional_flags}"; then + CPPFLAGS+=" ${$1_CPPFLAGS}" + CXXFLAGS+=" ${$1_CXXFLAGS}" + LIBS+=" ${$1_LIBS}" + AC_MSG_NOTICE([Adding flags for $1]) + else + AC_MSG_NOTICE([To enable $1, add $1_CPPFLAGS, $1_CXXFLAGS and $1_LIBS]) + fi +]) + +# require a specific development package, with fallback: test for a header +# - parameter: +# $1 = unique id (no special characters) +# $2 = module name (optional, if different from id) +# $3 = a header file to find (optional) +# $4 = alternative module names (space separated, optional) +# $5 = optional flags: +# manualflags if CXXFLAGS, CPPFLAGS, LIBS should remain unchanged +# +# uses PKG_CHECK_MODULES to test for a module +# then, if given, looks for the header file +# if header file is not found, searches in alternative modules +# sets all flags, so that the module can be used everywhere +# fails if not found +AC_DEFUN([AX_PKG_REQUIRE_DEV], [ + PKG_PROG_PKG_CONFIG + optional_flags="$5" + $1_found=no + secondpar="m4_default([$2], [$1])" + PKG_CHECK_MODULES([$1], [m4_default([$2], [$1])], [ + $1_found=$secondpar + PKG_REQUIREMENTS+=" $secondpar" + ], [ + if test -n "$4"; then + AC_MSG_WARN([Recommended package $secondpar for feature $1 not installed, trying $4]) + for pkg in $4; do + PKG_CHECK_MODULES([$1], [$pkg], [ + PKG_REQUIREMENTS+=" $pkg" + $1_found=$pkg + break; + ], [ + AC_MSG_WARN([Recommended package $pkg for feature $1 not installed]) + ]) + done + fi + ]) + AC_SUBST(CPPFLAGS) + AC_SUBST(CXXFLAGS) + AC_SUBST(PKG_REQUIREMENTS) + if test -n "$3"; then + if test "${$1_found}" = "no"; then + tmp_package="yes" + else + tmp_package=${$1_found} + fi + $1_found=no + old_CPPFLAGS=${CPPFLAGS} + CPPFLAGS=" ${$1_CFLAGS} ${CPPFLAGS}" + AC_CHECK_HEADER([$3], [ + $1_found=${tmp_package} + ], [ + for x in ${$1_CFLAGS}; do + AC_MSG_NOTICE([search for $3 in ${x[#]-I}]) + for f in $(find ${x[#]-I} -name "$3" 2> /dev/null); do + if test -f "$f"; then + $1_found=${tmp_package} + $1_CFLAGS+=" -I${f%/*}" + AC_MSG_NOTICE([added path ${f%/*}]) + break; + fi + done + if test "${$1_found}" != "no"; then + break; + fi + done + if test "${$1_found}" = "no"; then + tmp_includedir=$(${PKG_CONFIG} --variable=includedir $tmp_package) + for x in ${tmp_includedir}; do + AC_MSG_NOTICE([search for $3 in $x]) + for f in $(find ${x} -name "$3" 2> /dev/null); do + if test -f "$f"; then + $1_found=${tmp_package} + $1_CFLAGS+=" -I${f%/*}" + AC_MSG_NOTICE([added path ${f%/*}]) + break; + fi + done + if test "${$1_found}" != "no"; then + break; + fi + done + fi + ]) + CPPFLAGS=${old_CPPFLAGS} + fi + if test "${$1_found}" = "no"; then + if test -n "$3"; then + if test -n "$4"; then + AC_MSG_ERROR([Feature $1 not found, need header $3 in modules $secondpar or $4]) + else + AC_MSG_ERROR([Feature $1 not found, need header $3 in module $secondpar]) + fi + else + AC_MSG_ERROR([Feature $1 not found please install module $secondpar]) + fi + fi + AX_DEB_BUILD_DEPEND([${$1_found}-dev]) + AX_RPM_BUILD_DEPEND([${$1_found}-devel]) [$1]_CPPFLAGS="${$1_CFLAGS}" [$1]_CXXFLAGS="${$1_CFLAGS}" AC_SUBST([$1]_CPPFLAGS) @@ -851,6 +965,52 @@ AC_DEFUN([AX_PKG_CHECK], [ ], [ HAVE_$1=0 ]) + AX_DEB_BUILD_DEPEND(m4_default([$2], [$1])) + AX_RPM_BUILD_DEPEND(m4_default([$2], [$1])) + AM_CONDITIONAL(HAVE_$1, test $HAVE_[$1] -eq 1) + AC_SUBST(HAVE_$1) + AC_SUBST(CPPFLAGS) + AC_SUBST(CXXFLAGS) + AC_SUBST(PKG_REQUIREMENTS) +]) + +# check if a specific development package exists +# - parameter: +# $1 = unique id (no special characters) +# $2 = module name (optional, if different from id) +# $3 = optional flags: +# manualflags if CXXFLAGS, CPPFLAGS, LIBS should remain unchanged +# +# uses PKG_CHECK_MODULES to test for a module +# sets automake conditional HAVE_$1 to 0 (not found) or 1 (found) +# sets all flags, so that the module can be used everywhere +AC_DEFUN([AX_PKG_CHECK_DEV], [ + optional_flags="$3" + PKG_PROG_PKG_CONFIG + PKG_CHECK_MODULES([$1], [m4_default([$2], [$1])], [ + HAVE_$1=1 + [$1]_CPPFLAGS="${$1_CFLAGS}" + [$1]_CXXFLAGS="${$1_CFLAGS}" + AC_SUBST([$1]_CPPFLAGS) + AC_SUBST([$1]_CXXFLAGS) + if test "${optional_flags/manualflags/}" = "${optional_flags}"; then + CPPFLAGS+=" ${$1_CPPFLAGS}" + CXXFLAGS+=" ${$1_CXXFLAGS}" + LIBS+=" ${$1_LIBS}" + AC_MSG_NOTICE([Adding flags for $1]) + else + AC_MSG_NOTICE([To enable $1, add $1_CPPFLAGS, $1_CXXFLAGS and $1_LIBS]) + fi + if test -z "$PKG_REQUIREMENTS"; then + PKG_REQUIREMENTS="m4_default([$2], [$1])" + else + PKG_REQUIREMENTS="${PKG_REQUIREMENTS}, m4_default([$2], [$1])" + fi + ], [ + HAVE_$1=0 + ]) + AX_DEB_BUILD_DEPEND(m4_default([$2], [$1])-dev) + AX_RPM_BUILD_DEPEND(m4_default([$2], [$1])-devel) AM_CONDITIONAL(HAVE_$1, test $HAVE_[$1] -eq 1) AC_SUBST(HAVE_$1) AC_SUBST(CPPFLAGS) @@ -1018,3 +1178,125 @@ AC_DEFUN([AX_DEB_RESOLVE], [ AC_SUBST(DEB_SECTION) AC_SUBST(DEB_DEPEND_IFEXISTS) ]) + +# Check if a package exists in the current distribution, if yes, require it +# in .spec.in append @RPM_DEPEND_IFEXISTS@ to Build-Depends +# - parameter: +# $1 = package name +AC_DEFUN([AX_RPM_DEPEND_IFEXISTS], [ + pkg="$1" + + if (test -x /usr/bin/zypper && zypper search -x "$pkg" 1>&2 > /dev/null) || \ + (test -x /usr/bin/dnf && dnf list -q "$pkg" 1>&2 > /dev/null) || \ + (test -x /usr/bin/yum && yum list -q "$pkg" 1>&2 > /dev/null) || \ + (test -x /usr/sbin/urpmq && urpmq "$pkg" 1>&2 > /dev/null); then + RPM_DEPEND_IFEXISTS="${RPM_DEPEND_IFEXISTS}, ${pkg}" + fi +]) + +# require package in .spec.in append @RPM_BUILD_DEPEND@ to Build-Depends +# - parameter: +# $1 = package name +AC_DEFUN([AX_RPM_BUILD_DEPEND], [ + pkg="$1" + RPM_BUILD_DEPEND="${RPM_BUILD_DEPEND}, ${pkg}" +]) + +# require package in .spec.in append @RPM_DEPEND@ to Depends +# - parameter: +# $1 = package name +AC_DEFUN([AX_RPM_DEPEND], [ + pkg="$1" + if test -z "${RPM_DEPEND}"; then + RPM_DEPEND="${pkg}" + else + RPM_DEPEND="${RPM_DEPEND}, ${pkg}" + fi +]) + +# require package in debian/control.in append @DEB_DEPEND@ to Depends +# - parameter: +# $1 = package name +AC_DEFUN([AX_RPM_GROUP], [ + pkg="$1" + RPM_GROUP="${pkg}" +]) + +# call after setting rpmian dependencies +AC_DEFUN([AX_RPM_RESOLVE], [ + AC_SUBST(RPM_BUILD_DEPEND) + AC_SUBST(RPM_DEPEND) + AC_SUBST(RPM_GROUP) + AC_SUBST(RPM_DEPEND_IFEXISTS) +]) + +# Check if a package exists in the current distribution, if yes, require it +# in .spec.in append @ALL_DEPEND_IFEXISTS@ to Build-Depends +# - parameter: +# $1 = package name +AC_DEFUN([AX_ALL_DEPEND_IFEXISTS], [ + pkg="$1" + if test -n "$(apt-cache policy -q ${pkg} 2> /dev/null)"; then + DEB_DEPEND_IFEXISTS="${DEB_DEPEND_IFEXISTS}, ${pkg}" + fi + if (test -x /usr/bin/zypper && zypper search -x "$pkg" 1>&2 > /dev/null) || \ + (test -x /usr/bin/dnf && dnf list -q "$pkg" 1>&2 > /dev/null) || \ + (test -x /usr/bin/yum && yum list -q "$pkg" 1>&2 > /dev/null) || \ + (test -x /usr/sbin/urpmq && urpmq "$pkg" 1>&2 > /dev/null); then + RPM_DEPEND_IFEXISTS="${RPM_DEPEND_IFEXISTS}, ${pkg}" + fi +]) + +# Check if a package exists in the current distribution, if yes, require it +# in .spec.in append @ALL_DEPEND_IFEXISTS@ to Build-Depends +# - parameter: +# $1 = package name +AC_DEFUN([AX_ALL_DEPEND_IFEXISTS_DEV], [ + pkg="$1" + if test -n "$(apt-cache policy -q ${pkg}-dev 2> /dev/null)"; then + DEB_DEPEND_IFEXISTS="${DEB_DEPEND_IFEXISTS}, ${pkg}-dev" + fi + if (test -x /usr/bin/zypper && zypper search -x "$pkg"-devel 1>&2 > /dev/null) || \ + (test -x /usr/bin/dnf && dnf list -q "$pkg"-devel 1>&2 > /dev/null) || \ + (test -x /usr/bin/yum && yum list -q "$pkg"-devel 1>&2 > /dev/null) || \ + (test -x /usr/sbin/urpmq && urpmq "$pkg"-devel 1>&2 > /dev/null); then + RPM_DEPEND_IFEXISTS="${RPM_DEPEND_IFEXISTS}, ${pkg}-devel" + fi +]) + +# require package in .spec.in append @ALL_BUILD_DEPEND@ to Build-Depends +# - parameter: +# $1 = package name +AC_DEFUN([AX_ALL_BUILD_DEPEND], [ + pkg="$1" + DEB_BUILD_DEPEND="${DEB_BUILD_DEPEND}, ${pkg}" + RPM_BUILD_DEPEND="${RPM_BUILD_DEPEND}, ${pkg}" +]) + +# require package in .spec.in append @ALL_BUILD_DEPEND@ to Build-Depends +# - parameter: +# $1 = package name +AC_DEFUN([AX_ALL_BUILD_DEPEND_DEV], [ + pkg="$1" + DEB_BUILD_DEPEND="${DEB_BUILD_DEPEND}, ${pkg}-dev" + RPM_BUILD_DEPEND="${RPM_BUILD_DEPEND}, ${pkg}-devel" +]) + +# require package in .spec.in append @ALL_DEPEND@ to Depends +# - parameter: +# $1 = package name +AC_DEFUN([AX_ALL_DEPEND], [ + pkg="$1" + DEB_DEPEND="${DEB_DEPEND}, ${pkg}" + if test -z "${RPM_DEPEND}"; then + RPM_DEPEND="${pkg}" + else + RPM_DEPEND="${RPM_DEPEND}, ${pkg}" + fi +]) + +AC_DEFUN([AX_OUTPUT], [ + AX_DEB_RESOLVE + AX_RPM_RESOLVE + AC_OUTPUT +]) diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 639f218..e30ad57 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -134,6 +134,7 @@ GENERATED FILES * resolve-rpmbuilddeps.sh - script to install RPM package dependencies * build-in-docker.sh - script to build the project encapsulated in a docker container * build-in-docker.conf - additional configuration for build-in-docker.sh + * rpmsign.exp - script for signing rpms unattended * build-resource-file.sh - build resource.qrc file from a resource directory * sql-to-dot.sed - script to convert SQL schema files to graphviz dot in doxygen * mac-create-app-bundle.sh - script to create apple mac os-x app-bundle @@ -375,7 +376,7 @@ run() { testtag() { local IFS="|" - egrep -q '^ *'"($*)" configure.ac + egrep -q '^ *'"($*)"' *(\(.*)? *$' configure.ac } contains() { @@ -539,6 +540,7 @@ copy makefile_test.inc.am copy resolve-debbuilddeps.sh copy resolve-rpmbuilddeps.sh copy build-in-docker.sh +copy rpmsign.exp copy build-resource-file.sh copy sql-to-dot.sed copy mac-create-app-bundle.sh @@ -592,7 +594,7 @@ AX_INIT_STANDARD_PROJECT #AX_QT_NO_KEYWORDS # create output -AC_OUTPUT +AX_OUTPUT EOF PACKAGE_NAME=$(sed -n 's/.*m4_define *( *x_package_name *, *\([^ ]*\) *).*/\1/p' configure.ac) @@ -1552,7 +1554,7 @@ $( if testtag AX_USE_LIBTOOL; then Package: @PACKAGE_NAME@-dev Section: libdevel Architecture: any -Depends: @PACKAGE_NAME@ (= \${binary:Version}), ${BUILD_DEPENDS}${RUN_DEPENDS} @DEB_DEPEND@ @DEB_BUILD_DEPEND@ @DEB_DEPEND_IFEXISTS@ +Depends: @PACKAGE_NAME@ (= \${binary:Version}), ${BUILD_DEPENDS}${RUN_DEPENDS} @DEB_BUILD_DEPEND@ @DEB_DEPEND_IFEXISTS@ Description: @DESCRIPTION@ - Development Package @README_DEB@ EOF2 @@ -1600,11 +1602,12 @@ License: LGPL Group: $(if testtag AX_USE_LIBTOOL; then echo Development/Libraries/C++; else - echo Applications/...; + echo @RPM_GROUP@; fi) +$(if testtag AX_RPM_DEPEND; then echo "Requires: @RPM_DEPEND@"; fi) Source0: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root -BuildRequires: gnupg, ${VCSDEPENDS_RPM} make, automake, autoconf, rpm-build$( +BuildRequires: gnupg, expect, ${VCSDEPENDS_RPM} make, automake, autoconf, rpm-build$( if testtag AX_USE_CXX; then echo -n ", binutils-devel, gcc-c++" fi @@ -1617,7 +1620,7 @@ BuildRequires: gnupg, ${VCSDEPENDS_RPM} make, automake, autoconf, rpm-build$( if testtag AX_USE_PERLDOC; then echo -n ", libpod-tree-perl"; fi -) +) @RPM_BUILD_DEPEND@ @RPM_DEPEND_IFEXISTS@ %if 0%{?fedora} != 20 $(if testtag AX_USE_DOXYGEN; then echo -n "BuildRequires: graphviz"; fi) %endif @@ -1690,12 +1693,14 @@ rm -rf \$RPM_BUILD_ROOT %files %defattr(-,root,root,-) $(if testtag AX_USE_LIBTOOL; then -echo '/usr/%_lib/@PACKAGE_NAME@.so.*' +echo '/usr/%_lib/*.so.*' else echo '/usr/bin/*' echo '/usr/share/applications/*' fi) -/usr/share/@PACKAGE_NAME@ +$(if testtag AX_USE_NODEJS AX_BUILD_HTML AX_BUILD_HTML_NPM; then +echo '/usr/share/@PACKAGE_NAME@' +fi) %doc $(if testtag AX_USE_LIBTOOL; then cat <&2 @@ -235,7 +236,7 @@ if ! docker exec ${DOCKER_ID} getent passwd $(id -u) > /dev/null 2>&1; then fi docker exec ${DOCKER_ID} chown $(id -u):$(id -g) "${HOME}" case $mode in - (deb|apt) + (deb|apt|win) if [[ "${img}" =~ "ubuntu" ]]; then docker exec ${DOCKER_ID} locale-gen ${LANG} docker exec ${DOCKER_ID} update-locale LANG=${LANG} @@ -281,7 +282,12 @@ 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 /usr/bin/lsb_release + if test "$INSTALL_TOOL" = "urpmi --auto"; then + LSB_RELEASE=lsb-release + else + LSB_RELEASE=/usr/bin/lsb_release + fi + docker exec ${DOCKER_ID} ${INSTALL_TOOL} rpm-build automake libtool subversion gcc-c++ pkgconfig wget $LSB_RELEASE i=0 for key in "${keys[@]}"; do wget -Orpm-key "$key" @@ -295,14 +301,10 @@ EOF done docker exec ${DOCKER_ID} ./resolve-rpmbuilddeps.sh ;; - (win) - if [[ "${img}" =~ "ubuntu" ]]; then - docker exec ${DOCKER_ID} locale-gen ${LANG} - docker exec ${DOCKER_ID} update-locale LANG=${LANG} - fi - docker exec ${DOCKER_ID} apt-get update ${OPTIONS} - docker exec ${DOCKER_ID} apt-get install -y mingw-w64 - docker exec ${DOCKER_ID} ./resolve-debbuilddeps.sh - ;; esac -docker exec -u $(id -u):$(id -g) ${DOCKER_ID} ./bootstrap.sh -t "${targets}" ${host} ${flags[@]} +FLAGS=() +for f in "${flags[@]}"; do + FLAGS+=($(ifthenelse "$f" "echo 'ARG'")) +done + +docker exec -u $(id -u):$(id -g) ${DOCKER_ID} ./bootstrap.sh -t "${targets}" ${host} "${FLAGS[@]}" diff --git a/scripts/resolve-debbuilddeps.sh b/scripts/resolve-debbuilddeps.sh index 30b0a5d..4358e29 100755 --- a/scripts/resolve-debbuilddeps.sh +++ b/scripts/resolve-debbuilddeps.sh @@ -35,16 +35,24 @@ TO_INSTALL= DEPS= 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 + for f in $(sed -n 's, *AX_\(DEB\|ALL\)_DEPEND_IFEXISTS(\([^)]*\)).*,\2,p' configure.ac); do if test -n "$(${DO} apt-cache policy -q ${f})" && ((! $(${DO} apt-cache policy ${f} 2>&1 | grep -q 'N: Unable to locate package')) && (! ${DO} dpkg -l "${f}")); then DEPS+=" ${f}" fi done - for f in $(sed -n 's, *AX_DEB_BUILD_DEPEND(\([^)]*\)).*,\1,p' configure.ac); do + for f in $(sed -n 's, *AX_\(DEB\|ALL\)_DEPEND_IFEXISTS_DEV(\([^)]*\)).*,\2,p' configure.ac); do + if test -n "$(${DO} apt-cache policy -q ${f}-dev)" && ((! $(${DO} apt-cache policy ${f}-dev 2>&1 | grep -q 'N: Unable to locate package')) && (! ${DO} dpkg -l "${f}-dev")); then + DEPS+=" ${f}-dev" + fi + done + for f in $(sed -n 's, *AX_\(DEB\|ALL\)\(_BUILD\)\?_DEPEND(\([^)]*\)).*,\3,p' configure.ac); do DEPS+=" ${f}" done + for f in $(sed -n 's, *AX_\(DEB\|ALL\)\(_BUILD\)\?_DEPEND_DEV(\([^)]*\)).*,\3,p' configure.ac); do + DEPS+=" ${f}-dev" + done trap "rm debian/control" INT TERM EXIT - sed 's,@\(DEB_DEPEND_IFEXISTS\|DEB_BUILD_DEPEND\|DEB_DEPEND\)@,,g' debian/control.in | \ + sed 's,@\(\(ALL\|DEB\)_DEPEND_IFEXISTS\|\(ALL\|DEB\)_BUILD_DEPEND\|\(ALL\|DEB\)_DEPEND\)@,,g' debian/control.in | \ sed 's,@[^@]*@, dummytext,g' > debian/control fi diff --git a/scripts/resolve-rpmbuilddeps.sh b/scripts/resolve-rpmbuilddeps.sh index 1ed2408..6ba833e 100755 --- a/scripts/resolve-rpmbuilddeps.sh +++ b/scripts/resolve-rpmbuilddeps.sh @@ -15,10 +15,33 @@ SCHROOTNAME="$1" PACKAGE_NAME=$(sed -n 's/^ *m4_define(x_package_name, \(.*\)).*/\1/p' configure.ac) TRAP_CMD= +DEPS= if test -e ${PACKAGE_NAME}.spec.in -a ! -e ${PACKAGE_NAME}.spec; then + for f in $(sed -n 's, *AX_\(RPM\|ALL\)_DEPEND_IFEXISTS(\([^)]*\)).*,\2,p' configure.ac); do + if (test -x /usr/bin/zypper && zypper search -x "$f" 1>&2 > /dev/null) || \ + (test -x /usr/bin/dnf && dnf list -q "$f" 1>&2 > /dev/null) || \ + (test -x /usr/bin/yum && yum list -q "$f" 1>&2 > /dev/null) || \ + (test -x /usr/sbin/urpmq && urpmq "$f" 1>&2 > /dev/null); then + DEPS+=" ${f}" + fi + done + for f in $(sed -n 's, *AX_\(RPM\|ALL\)_DEPEND_IFEXISTS_DEV(\([^)]*\)).*,\2,p' configure.ac); do + if (test -x /usr/bin/zypper && zypper search -x "$f"-devel 1>&2 > /dev/null) || \ + (test -x /usr/bin/dnf && dnf list -q "$f"-devel 1>&2 > /dev/null) || \ + (test -x /usr/bin/yum && yum list -q "$f"-devel 1>&2 > /dev/null) || \ + (test -x /usr/sbin/urpmq && urpmq "$f"-devel 1>&2 > /dev/null); then + DEPS+=" ${f}-devel" + fi + done + for f in $(sed -n 's, *AX_\(RPM\|ALL\)\(_BUILD\)\?_DEPEND(\([^)]*\)).*,\3,p' configure.ac); do + DEPS+=" ${f}" + done + for f in $(sed -n 's, *AX_\(RPM\|ALL\)\(_BUILD\)\?_DEPEND_DEV(\([^)]*\)).*,\3,p' configure.ac); do + DEPS+=" ${f}-devel" + done TRAP_CMD+="rm ${PACKAGE_NAME}.spec;" trap "${TRAP_CMD}" INT TERM EXIT - sed 's,@RPM_DEPEND_IFEXISTS@,,g' ${PACKAGE_NAME}.spec.in | \ + sed 's,@\(\(ALL\|RPM\)_DEPEND_IFEXISTS\|\(ALL\|RPM\)_BUILD_DEPEND\|\(ALL\|RPM\)_DEPEND\)@,,g' ${PACKAGE_NAME}.spec.in | \ sed 's,@[^@]*@, dummytext,g' > ${PACKAGE_NAME}.spec fi @@ -32,12 +55,12 @@ 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 - schroot -c ${SCHROOTNAME} -u root -- ${INSTALL_TOOL} ${FILES} + schroot -c ${SCHROOTNAME} -u root -- ${INSTALL_TOOL} ${FILES} ${DEPS} 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 - ${INSTALL_TOOL} ${FILES} + ${INSTALL_TOOL} ${FILES} ${DEPS} fi fi diff --git a/scripts/rpmsign.exp b/scripts/rpmsign.exp new file mode 100755 index 0000000..dc29d94 --- /dev/null +++ b/scripts/rpmsign.exp @@ -0,0 +1,14 @@ +#!/usr/bin/expect -f + +set key [lindex $argv 0] +set password [lindex $argv 1] +set files [lrange $argv 2 end] + +### rpm-sign.exp -- Sign RPMs by sending the passphrase. +spawn rpmsign --define "_gpg_name $key" --addsign {*}$files +expect { + "Enter pass phrase: " { + send -- "$password\r" + exp_continue + } eof +}