summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2015-04-03 03:49:25 +0200
committerMihai Moldovan <ionic@ionic.de>2015-04-03 03:49:25 +0200
commit21f2262912ad73a48f8325eed32fb8622c05373b (patch)
tree9e9a22f4fb9b0e31b5b0ac3e79d969852b0cbc2b /bin
parent5988968b8c34aee7c4759f506b68623df9e35d2a (diff)
downloadbuildscripts-21f2262912ad73a48f8325eed32fb8622c05373b.tar.gz
buildscripts-21f2262912ad73a48f8325eed32fb8622c05373b.tar.bz2
buildscripts-21f2262912ad73a48f8325eed32fb8622c05373b.zip
bin/build-rpm-package: fix find calls. Use weird read -r -d '' trick to parse 0-delimited pseudo-arrays.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/build-rpm-package31
1 files changed, 24 insertions, 7 deletions
diff --git a/bin/build-rpm-package b/bin/build-rpm-package
index 4b8ccbf..c8158ce 100755
--- a/bin/build-rpm-package
+++ b/bin/build-rpm-package
@@ -704,13 +704,19 @@ build_packages() {
--clean \
"${PKGDIST}/${l_DIST}/${l_CODENAME}/${l_ARCH}/rpmbuild/SOURCES/${PROJECT}.spec"; then
mkdir -p -- "${PKGDIST}/${l_DIST}/${l_CODENAME}/x86_64/"
- find "/var/cache/obs-build/${l_DIST}/${l_CODENAME}/x86_64/${BUILD_RESULT}/RPMS/" -type f | grep -E '.*\.rpm$' | grep -Ev '.*\.src\.rpm$' | while read rpmfile; do
+
+ # -r parameter to read: Backslashes may NOT escape any characters!
+ # -d '': specifies the delimiter to be used - as '' resolves to an empty string followed
+ # by a NUL character, the delimiter is set to this very NUL (\000) character.
+ find "/var/cache/obs-build/${l_DIST}/${l_CODENAME}/x86_64/${BUILD_RESULT}/RPMS/" -type f \( -iname '*.rpm' -and -not -iname '*.src.rpm' \) -print0 | while read -r -d '' rpmfile; do
cp "${rpmfile}" "${PKGDIST}/${l_DIST}/${l_CODENAME}/x86_64/"
done
rpmsign-unattended -D "%_gpg_name debian@x2go.org" --addsign "${PKGDIST}/${l_DIST}/${l_CODENAME}/x86_64/"*.rpm
# also copy and sign source RPM's
- find "/var/cache/obs-build/${l_DIST}/${l_CODENAME}/x86_64/${BUILD_RESULT}/SRPMS/" -type f | grep -E '.*\.rpm$' | while read rpmfile; do
+ # For information on why this weird -print0 | read -r -d '' construction works,
+ # refer to the first instance of this in this script.
+ find "/var/cache/obs-build/${l_DIST}/${l_CODENAME}/x86_64/${BUILD_RESULT}/SRPMS/" -type f -iname '*.rpm' -print0 | while read -r -d '' rpmfile; do
cp "${rpmfile}" "$PKGDIST/${l_DIST}/${l_CODENAME}/SRPM/"
done
rpmsign-unattended -D "%_gpg_name debian@x2go.org" --addsign "${PKGDIST}/${l_DIST}/${l_CODENAME}/SRPM/"*.rpm
@@ -726,7 +732,10 @@ build_packages() {
# Obtain packages from our RPM repository.
get_extra_repository "redhat" "${l_DIST}" "${l_CODENAME}" "${COMPONENT}" "${PROJECT}" "x86_64" "${RPM_WANT_EXTRA_REPOS}"
- find "${PKGDIST}/${l_DIST}/${l_CODENAME}/${l_ARCH}/rpmbuild/SRPMS/${PROJECT}-${UPSTREAM_VERSION}-${PKG_SRCRELEASE}.${IS_RELEASE}.git${DATE}.${GITREV}.${COMPONENT}".*.src.rpm | while read srpm; do
+
+ # For information on why this weird -print0 | read -r -d '' construction works,
+ # refer to the first instance of this in this script.
+ find "${PKGDIST}/${l_DIST}/${l_CODENAME}/${l_ARCH}/rpmbuild/SRPMS/" -type 'f' -iname "${PROJECT}-${UPSTREAM_VERSION}-${PKG_SRCRELEASE}.${IS_RELEASE}.git${DATE}.${GITREV}.${COMPONENT}.*.src.rpm" -print0 | while read -r -d '' srpm; do
if mock ${MOCK_CHROOT_CONFIG} --resultdir="${PKGDIST}/${l_DIST}/${l_CODENAME}/x86_64" "${srpm}"; then
# copy and later sign source RPM
cp "${srpm}" "${PKGDIST}/${l_DIST}/${l_CODENAME}/SRPM/"
@@ -779,15 +788,20 @@ build_packages() {
--clean \
"${PKGDIST}/${l_DIST}/${l_CODENAME}/${l_ARCH}/rpmbuild/SOURCES/${PROJECT}.spec"; then
mkdir -p -- "${PKGDIST}/${l_DIST}/${l_CODENAME}/i386/"
- find "/var/cache/obs-build/${l_DIST}/${l_CODENAME}/i386/${BUILD_RESULT}/RPMS/" -type f | grep -E '.*\.rpm$' | grep -Ev '.*\.src\.rpm$' | while read rpmfile; do
+
+ # For information on why this weird -print0 | read -r -d '' construction works,
+ # refer to the first instance of this in this script.
+ find "/var/cache/obs-build/${l_DIST}/${l_CODENAME}/i386/${BUILD_RESULT}/RPMS/" -type 'f' \( -iname '*.rpm' -and -not -iname '*.src.rpm' \) -print0 | while read -r -d '' rpmfile; do
cp "${rpmfile}" "${PKGDIST}/${l_DIST}/${l_CODENAME}/i386/"
done
rpmsign-unattended -D "%_gpg_name debian@x2go.org" --addsign "${PKGDIST}/${l_DIST}/${l_CODENAME}/i386/"*.rpm
# copy and later sign source RPM's, if needed (that is, not already generated by x86_64/noarch code above)
- SEARCH_SRPM="$(find "${PKGDIST}/${l_DIST}/${l_CODENAME}/SRPM" -type 'f' -name "*.src.rpm" -print)"
+ SEARCH_SRPM="$(find "${PKGDIST}/${l_DIST}/${l_CODENAME}/SRPM" -type 'f' -iname "*.src.rpm" -print)"
if [ -z "${SEARCH_SRPM}" ]; then
- find "/var/cache/obs-build/${l_DIST}/${l_CODENAME}/i386/${BUILD_RESULT}/SRPMS/" -type 'f' | grep -E '.*\.src\.rpm$' | while read rpmfile; do
+ # For information on why this weird -print0 | read -r -d '' construction works,
+ # refer to the first instance of this in this script.
+ find "/var/cache/obs-build/${l_DIST}/${l_CODENAME}/i386/${BUILD_RESULT}/SRPMS/" -type 'f' -iname '*.src.rpm' -print0 | while read -r -d '' rpmfile; do
cp "${rpmfile}" "${PKGDIST}/${l_DIST}/${l_CODENAME}/SRPM/"
done
rpmsign-unattended -D "%_gpg_name debian@x2go.org" --addsign "${PKGDIST}/${l_DIST}/${l_CODENAME}/SRPM/"*.rpm
@@ -804,7 +818,10 @@ build_packages() {
# Obtain packages from our RPM repository.
get_extra_repository "redhat" "${l_DIST}" "${l_CODENAME}" "${COMPONENT}" "${PROJECT}" "i386" "${RPM_WANT_EXTRA_REPOS}"
- find "${PKGDIST}/${l_DIST}/${l_CODENAME}/${l_ARCH}/rpmbuild/SRPMS/${PROJECT}-${UPSTREAM_VERSION}-${PKG_SRCRELEASE}.${IS_RELEASE}.git${DATE}.${GITREV}.${COMPONENT}".*.src.rpm | while read srpm; do
+
+ # For information on why this weird -print0 | read -r -d '' construction works,
+ # refer to the first instance of this in this script.
+ find "${PKGDIST}/${l_DIST}/${l_CODENAME}/${l_ARCH}/rpmbuild/SRPMS/" -type 'f' -iname "${PROJECT}-${UPSTREAM_VERSION}-${PKG_SRCRELEASE}.${IS_RELEASE}.git${DATE}.${GITREV}.${COMPONENT}.*.src.rpm" -print0 | while read -r -d '' srpm; do
if nice mock ${MOCK_CHROOT_CONFIG} --resultdir="${PKGDIST}/${l_DIST}/${l_CODENAME}/i386" "${srpm}"; then
# only copy and sign source RPM if necessary
SIGN_SRPM="0"