[X2Go-Commits] [buildscripts] 01/01: bin/build-rpm-package: fetch source package name and use it.

git-admin at x2go.org git-admin at x2go.org
Wed Nov 14 07:02:03 CET 2018


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository buildscripts.

commit f7685eea835ae2bbadf1cebb8cc02b4f68585680
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Wed Nov 14 07:00:02 2018 +0100

    bin/build-rpm-package: fetch source package name and use it.
---
 bin/build-rpm-package | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/bin/build-rpm-package b/bin/build-rpm-package
index faeb63b..66fffe9 100755
--- a/bin/build-rpm-package
+++ b/bin/build-rpm-package
@@ -139,6 +139,7 @@ set_vars() {
 	PROJECT_PATH="${1}"
 	PROJECT_PATH="${PROJECT_PATH/%.git/}"
 	PROJECT="$(basename "${PROJECT_PATH}")"
+	RPMSRCPKG="${PROJECT}"
 
 	# grab repository component area from command line (2nd argv) or guess it
 	ARGV2_COMPONENT="$(cut -d"/" -f1 <<< "${2}/")"
@@ -788,6 +789,11 @@ prepare_workspace() {
 	GIT_OBJECT_ID="$(git rev-parse --verify HEAD)"
 	cd "${PROJECT_DIR}"
 
+	# extract RPM source package name from ${PROJECT}.spec
+	if [ -e "${PROJECT}.spec" ]; then
+		RPMSRCPKG="$(grep -E '^Name:' "${PROJECT}.spec" | sed -e 's/^Name:[ 	]*//g' -e 's/[ 	]*$//')"
+	fi
+
 	return 0
 }
 
@@ -841,7 +847,7 @@ clear_pkgdist() {
 					if [ "x${SKIP_ARCH}" != "x${l_ARCH}" ]; then
 						mkdir -p -- "${PKGDIST}/${l_DIST}/${l_CODENAME}/${l_ARCH}"
 						rm -f -- "${PKGDIST}/${l_DIST}/${l_CODENAME}/${l_ARCH}/rpmbuild/SOURCES/"*
-						rm -f -- "${PKGDIST}/${l_DIST}/${l_CODENAME}/${l_ARCH}/rpmbuild/SRPMS/${PROJECT}-"*.src.rpm
+						rm -f -- "${PKGDIST}/${l_DIST}/${l_CODENAME}/${l_ARCH}/rpmbuild/SRPMS/${RPMSRCPKG}-"*.src.rpm
 						rm -f -- "${PKGDIST}/${l_DIST}/${l_CODENAME}/${l_ARCH}/"*.rpm
 					fi
 				done
@@ -1204,7 +1210,7 @@ build_packages() {
 
 								# 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}/SRPM/" -type 'f' -iname "${PROJECT}-${UPSTREAM_VERSION}-${PKG_SRCRELEASE}.${IS_RELEASE}.git${DATE}.${GITREV}.${COMPONENT}.*.src.rpm" -print0 | while read -r -d '' srpm; do
+								find "${PKGDIST}/${l_DIST}/${l_CODENAME}/SRPM/" -type 'f' -iname "${RPMSRCPKG}-${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}/${l_ARCH}" "${srpm}"; then
 										# Clean up source RPM files. We build them separately.
 										find "${PKGDIST}/${l_DIST}/${l_CODENAME}/${l_ARCH}" -type 'f' -iname '*.src.rpm' -exec rm -f -- '{}' \;

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/buildscripts.git


More information about the x2go-commits mailing list