summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2015-04-01 10:37:37 +0200
committerMihai Moldovan <ionic@ionic.de>2015-04-01 10:37:37 +0200
commitfc13f5f4362b523102df6ebd2f24786b56a09bee (patch)
tree5729c0d130d4d98d2d199899f06fc2747741ad91
parent60c5f4b41441ebcfe69bfb4b4864f46011eec5a7 (diff)
downloadbuildscripts-fc13f5f4362b523102df6ebd2f24786b56a09bee.tar.gz
buildscripts-fc13f5f4362b523102df6ebd2f24786b56a09bee.tar.bz2
buildscripts-fc13f5f4362b523102df6ebd2f24786b56a09bee.zip
bin/build-rpm-package: append .cfg extension to MOCK_BASE if necessary.
Remove it inline and non-destructively when building temporary mock config file name.
-rwxr-xr-xbin/build-rpm-package11
1 files changed, 9 insertions, 2 deletions
diff --git a/bin/build-rpm-package b/bin/build-rpm-package
index 7c886d0..fd3b401 100755
--- a/bin/build-rpm-package
+++ b/bin/build-rpm-package
@@ -257,8 +257,15 @@ create_mock_config () { # MOCK_BASE CUSTOM_REPO COMPONENT TARGET
# Check argument sanity.
typeset DISTRO=""
+
+ # Append .cfg is not already specified.
+ typeset TMP_REGEX='^.*\.cfg$'
+ if [[ ! "${MOCK_BASE}" =~ ${TMP_REGEX} ]]; then
+ MOCK_BASE="${MOCK_BASE}.cfg"
+ fi
+
# distribution - version - arch
- typeset TMP_REGEX='^([[:alpha:]]+)-[[:alnum:]_]+-[[:alnum]_]+\.cfg$'
+ TMP_REGEX='^([[:alpha:]]+)-[[:alnum:]_]+-[[:alnum]_]+\.cfg$'
if [[ ! "${MOCK_BASE}" =~ ${TMP_REGEX} ]]; then
echo "Error: MOCK_BASE parameter not well formed. Must be: 'distro-version-arch.cfg'." >&2
exit -1
@@ -306,7 +313,7 @@ create_mock_config () { # MOCK_BASE CUSTOM_REPO COMPONENT TARGET
exit -1
fi
- TMP_MOCK_CFG_FILE="$(mktemp --tmpdir="${TEMP_BASE}" "$(basename "${TMP_MOCK_CFG_DIR}")/${MOCK_BASE}-${RPM_EXTRA_REPO_MOCK_CONFIG_BASE}-${COMPONENT}-${TARGET}.$(repeat_str "X" "24").cfg")"
+ TMP_MOCK_CFG_FILE="$(mktemp --tmpdir="${TEMP_BASE}" "$(basename "${TMP_MOCK_CFG_DIR}")/${MOCK_BASE%.cfg}-${RPM_EXTRA_REPO_MOCK_CONFIG_BASE}-${COMPONENT}-${TARGET}.$(repeat_str "X" "24").cfg")"
if [ "$?" -ne "0" ]; then
echo "Error: creating mock temporary config file failed. Aborting." >&2
exit -1