[X2Go-Commits] [buildscripts] 02/07: bin/build-rpm-package: rewrite the mock part of get_extra_repository() to use create_mock_config().

git-admin at x2go.org git-admin at x2go.org
Wed Apr 1 10:18:07 CEST 2015


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

x2go pushed a commit to branch master
in repository buildscripts.

commit 21d86e0dc83df93a30d132a86428c83787f8ef89
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Wed Apr 1 09:55:52 2015 +0200

    bin/build-rpm-package: rewrite the mock part of get_extra_repository() to use create_mock_config().
---
 bin/build-rpm-package |   58 ++++++++++++++++++++-----------------------------
 1 file changed, 23 insertions(+), 35 deletions(-)

diff --git a/bin/build-rpm-package b/bin/build-rpm-package
index 5c0f8f9..8be91e7 100755
--- a/bin/build-rpm-package
+++ b/bin/build-rpm-package
@@ -424,45 +424,33 @@ get_extra_repository () {
 		"redhat")
 			# Always use -r.
 			ret="-r "
-			if [ -n "${RPM_MOCK_CONFIG_DIR}" ]; then
-				# FIXME: these files should probably be autogenerated to lessen maintenance load.
-
-				# Itsy-bitsy problem here: mock versions prior to 1.2.0 are buggy in the sense that
-				# they *always* prepend /etc/mock/ and append .cfg to any chroot file specified
-				# via -r, even if the argument is an absolute path.
-				# We have to work around that by specifying ../..//PATH/TO/MOCK-CONFIG and leaving
-				# out the ".cfg" part.
-				# Find out if we're using a buggy version.
-				check_mock_version_atleast "1" "2" "0" && typeset MOCK_BUGGY="0" || typeset MOCK_BUGGY="1"
-
-				[ "${MOCK_BUGGY}" -eq "1" ] && ret="${ret}../../"
-
-				# Add config base dir if specified.
-				ret="${ret}${RPM_MOCK_CONFIG_DIR}/"
-
-				# Mock config file names shall follow the format:
-				# distname-distversion-arch[-component-extra_repo_base_name[-extra_repo_full_name]]
-				# ^------ mandatory ------^^---------------------- optional ----------------------^
-				# ^------- default -------^            ^--- for extras ---^^--- for everything ---^
-
-				# Add mandatory, default value.
-				ret="${ret}${DIST}-${CODENAME}-${ARCH}"
-				if [ -n "${RPM_EXTRA_REPO_MOCK_CONFIG_BASE}" ]; then
-					ret="${ret}-${COMPONENT}-${RPM_EXTRA_REPO_MOCK_CONFIG_BASE}"
-
-					if [ -n "${RPM_EXTRA_REPO_MOCK_CONFIG_FULL_NAME}" ] && [ -z "${PACKAGE_WITHOUT_OTHERMIRROR}" ] || \
-					   [ "${PACKAGE_WITHOUT_OTHERMIRROR}" != "${PACKAGE}" ]; then
-						ret="${ret}-${RPM_EXTRA_REPO_MOCK_CONFIG_FULL_NAME}"
-					fi
+
+			# Itsy-bitsy problem here: mock versions prior to 1.2.0 are buggy in the sense that
+			# they *always* prepend /etc/mock/ and append .cfg to any chroot file specified
+			# via -r, even if the argument is an absolute path.
+			# We have to work around that by specifying ../..//PATH/TO/MOCK-CONFIG and leaving
+			# out the ".cfg" part.
+			# Find out if we're using a buggy version.
+			check_mock_version_atleast "1" "2" "0" && typeset MOCK_BUGGY="0" || typeset MOCK_BUGGY="1"
+
+			[ "${MOCK_BUGGY}" -eq "1" ] && ret="${ret}../../"
+
+			if [ "${WANT_EXTRA}" -eq "1" ]; then
+				typeset WANT="base"
+				if [ -z "${PACKAGE_WITHOUT_OTHERMIRROR}" ] || [ "${PACKAGE_WITHOUT_OTHERMIRROR}" != "${PACKAGE}" ]; then
+					WANT="full"
 				fi
 
-				# Add .cfg extension.
-				[ "${MOCK_BUGGY}" -eq "0" ] && ret="${ret}.cfg"
+				typeset GEN_CONFIG="$(create_mock_config "${DIST}-${CODENAME}-${ARCH}" "${COMPONENT}" "${WANT}")"
+
+				# Remove the .cfg extension again... and maybe add it back later.
+				ret="${ret}${GEN_CONFIG%.cfg}"
 			else
-				# As the default directory /etc/mock is non-writable, assume we don't have
-				# special mock configs.
-				ret="${ret}${DIST}-${CODENAME}-${ARCH}"
+				ret="${ret}${RPM_MOCK_CONFIG_DIR}/${DIST}-${CODENAME}-${ARCH}"
 			fi
+
+			# Add .cfg extension.
+			[ "${MOCK_BUGGY}" -eq "0" ] && ret="${ret}.cfg"
 			;;
 		*)
 			echo "Error: unknown type passed to ${FUNCNAME}()" >&2

--
Alioth's /srv/git/code.x2go.org/buildscripts.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/buildscripts.git


More information about the x2go-commits mailing list