summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2015-04-01 08:59:46 +0200
committerMihai Moldovan <ionic@ionic.de>2015-04-01 08:59:46 +0200
commitb815f457196ca5c3ca0c1d8bf4af9d39a82271c9 (patch)
tree7f71abdf749b1e8681ee546b94c42422008b31ed
parentc35447b875f6bd1a0edaa6838a3a09c854d56b28 (diff)
downloadbuildscripts-b815f457196ca5c3ca0c1d8bf4af9d39a82271c9.tar.gz
buildscripts-b815f457196ca5c3ca0c1d8bf4af9d39a82271c9.tar.bz2
buildscripts-b815f457196ca5c3ca0c1d8bf4af9d39a82271c9.zip
bin/build-rpm-package: lose parameter CUSTOM_REPO to create_mock_config(). It is implicit.
Change RPM_MOCK_CONFIG_DIR to /etc/mock and use in create_mock_config().
-rwxr-xr-xbin/build-rpm-package41
-rw-r--r--home/.buildscripts/x2go.conf2
2 files changed, 22 insertions, 21 deletions
diff --git a/bin/build-rpm-package b/bin/build-rpm-package
index 47b5f25..4902186 100755
--- a/bin/build-rpm-package
+++ b/bin/build-rpm-package
@@ -235,35 +235,18 @@ repeat_str () { # INPUT COUNT
}
# Creates a custom mock config file given a base config (taken from
-# /etc/mock/), a custom repository file (also taken from /etc/mock/),
-# the build component and the target specification ("full" or "base").
+# /etc/mock/), the build component and the target specification ("full" or "base").
# Base refers to adding x2go-extras only, while full means also
# adding the full X2Go upstream repository with all published files.
# The created config file path is returned.
create_mock_config () { # MOCK_BASE CUSTOM_REPO COMPONENT TARGET
typeset MOCK_BASE="${1:?"Error: no mock base config passed to ${FUNCNAME}()."}"
- typeset CUSTOM_REPO="${2:?"Error: no mock custom repository file passed to ${FUNCNAME}()."}"
- typeset COMPONENT="${3:?"Error: no component (X2Go release group) passed to ${FUNCNAME}()."}"
- typeset TARGET="${4:?"Error: no target (full or base) passed to ${FUNCNAME}()."}"
+ typeset COMPONENT="${2:?"Error: no component (X2Go release group) passed to ${FUNCNAME}()."}"
+ typeset TARGET="${3:?"Error: no target (full or base) passed to ${FUNCNAME}()."}"
typeset ret=""
# Check argument sanity.
- typeset i=""
- for i in MOCK_BASE CUSTOM_REPO; do
- # Must be plain file.
- grep -q -s "/" <<< "${!i}" && {
- echo "Error: ${i} parameter must not be a path but a simple file name." >&2
- exit -1
- }
-
- # Must exist and be readable.
- if [ ! -f "/etc/mock/${!i}" ] || [ ! -r "/etc/mock/${!i}" ]; then
- echo "Error: ${i} parameter must exist, be a regular file and readable." >&2
- exit -1
- fi
- done
-
typeset DISTRO=""
typeset TMP_REGEX='^([[:alpha:]]+)-[[:alnum:]]+-[[:alnum:]].cfg$'
# distribution - version - arch
@@ -274,6 +257,24 @@ create_mock_config () { # MOCK_BASE CUSTOM_REPO COMPONENT TARGET
DISTRO="${BASH_REMATCH[1]}"
fi
+ typeset CUSTOM_REPO="${RPM_EXTRA_REPO_MOCK_CONFIG_BASE}-${DISTRO}.repo"
+
+ typeset CFG_FILE=""
+ TMP_REGEX='/'
+ for CFG_FILE in MOCK_BASE CUSTOM_REPO; do
+ # Must be plain file.
+ if [[ "${!CFG_FILE}" =~ ${TMP_REGEX} ]]; then
+ echo "Error: (implicit) ${CFG_FILE} parameter must not be a path but a simple file name." >&2
+ exit -1
+ fi
+
+ # Must exist and be readable.
+ if [ ! -f "${RPM_MOCK_CONFIG_DIR}/${!CFG_FILE}" ] || [ ! -r "${RPM_MOCK_CONFIG_DIR}/${!CFG_FILE}" ]; then
+ echo "Error: ${CFG_FILE} parameter must exist, be a regular file and readable." >&2
+ exit -1
+ fi
+ done
+
# Rename "main" to "release" and "heuler" to "nightly".
if [ "${COMPONENT}" = "main" ]; then
COMPONENT="release"
diff --git a/home/.buildscripts/x2go.conf b/home/.buildscripts/x2go.conf
index 57fa75b..0e7dd39 100644
--- a/home/.buildscripts/x2go.conf
+++ b/home/.buildscripts/x2go.conf
@@ -16,7 +16,7 @@ GPG_KEY="F4A7678C9C6B0B2B"
RPM_DISTS_SUPPORTED="fedora epel opensuse sle"
RPM_BUILD_FOR=${RPM_BUILD_FOR:-"fedora:18,19,20,21,rawhide epel:6 opensuse:12.2,12.3,13.1,13.2 sle:11.2,11.3,12.0"}
RPM_REPOS_BASE=/srv/sites/x2go.org/packages/
-RPM_MOCK_CONFIG_DIR="${HOME}/mock-config"
+RPM_MOCK_CONFIG_DIR="/etc/mock/"
RPM_EXTRA_REPO_MOCK_CONFIG_BASE="x2go"
RPM_EXTRA_REPO_MOCK_CONFIG_FULL_NAME="full"