[X2Go-Commits] [buildscripts] 01/01: bin/build-rpm-package: fetch OpenSuSE Tumbleweed obs-config from the public OBS instance (actually as a merge of openSUSE:Factory and openSUSE:Tumbleweed project configuration files.)
git-admin at x2go.org
git-admin at x2go.org
Fri Nov 17 01:39:55 CET 2017
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository buildscripts.
commit cce0ab9588ae0d5c565898e18b0d0c2b56776cb4
Author: Mihai Moldovan <ionic at ionic.de>
Date: Fri Nov 17 01:38:43 2017 +0100
bin/build-rpm-package: fetch OpenSuSE Tumbleweed obs-config from the public OBS instance (actually as a merge of openSUSE:Factory and openSUSE:Tumbleweed project configuration files.)
---
bin/build-rpm-package | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/bin/build-rpm-package b/bin/build-rpm-package
index 3da13db..32a4e9d 100755
--- a/bin/build-rpm-package
+++ b/bin/build-rpm-package
@@ -680,6 +680,44 @@ wrap_suse_major_version () {
return "0"
}
+# Creates an obs-build configuration inside the temporary working directory.
+# Takes the temporary working directory and a subdirectory containing the
+# obs-build configuration files.
+# Returns 0 on success or non-0 on failure.
+setup_opensuse_tumbleweed_config() {
+ typeset temp_dir="${1:?"Error: no temporary working directory passed to ${FUNCNAME}()."}"
+ typeset obs_config_dir="${2:?"Error: no obs-build configuration subdirectory passed to ${FUNCNAME}()."}"
+
+ typeset obs_factory_prjconf_url="https://api.opensuse.org/public/source/openSUSE:Factory/_config"
+ typeset obs_tumbleweed_prjconf_url="https://api.opensuse.org/public/source/openSUSE:Tumbleweed/_config"
+ typeset obs_config_tumbleweed_filename="sltumbleweed.conf"
+
+ if [[ ! -d "${temp_dir}" ]]; then
+ echo "Temporary working directory (${temp_dir}) does not exist." >&2
+ return "1"
+ fi
+
+ pushd "${temp_dir}" >/dev/null 2>&1
+ if ! mkdir -- "${obs_config_dir}"; then
+ echo "Unable to create obs-build config (${temp_dir}/${obs_config_dir}) directory." >&2
+ popd
+ return "2"
+ fi
+
+ pushd "${obs_config_dir}"
+ if ! ( curl "${obs_factory_prjconf_url}" "${obs_tumbleweed_prjconf_url}" ) > "${obs_config_tumbleweed_filename}"; then
+ echo "Unable to fetch public OBS OpenSuSE Factory and Tumbleweed configuration files." >&2
+ popd
+ popd
+ return "3"
+ fi
+
+ popd
+ popd
+
+ return "0"
+}
+
prepare_workspace() {
# make sure our local working copy is up to date...
if [ -d "${PROJECT_DIR}/.git" ]; then
@@ -886,6 +924,10 @@ build_packages() {
BUILD_RESULT="/home/abuild/rpmbuild/"
+ # Only used if necessary, currently for OpenSuSE Tumbleweed only.
+ typeset obs_config_dir="obs-config"
+ typeset -a extra_obs_build_args=( )
+
typeset -i tmp_suse_major_version="0"
typeset -i tmp_suse_minor_version="0"
if [[ "${l_CODENAME}" = "tumbleweed" ]]; then
@@ -942,6 +984,13 @@ build_packages() {
else
DOWNLOAD_URL="$(sed -e 's_#LEAP#__' <<< "${DOWNLOAD_URL}")"
fi
+ else
+ if ! setup_opensuse_tumbleweed_config "${TEMP_DIR}" "${obs_config_dir}"; then
+ echo "Unable to fetch and prepare OpenSuSE Tumbleweed obs-build configuration file." >&2
+ exit "1"
+ fi
+
+ extra_obs_build_args+=( "--configdir" "${TEMP_DIR}/${obs_config_dir}" )
fi
elif [ "x${l_DIST}" = "xsle" ]; then
DOWNLOAD_URL="$(sed "s/#VERSION#/${l_CODENAME}/" <<< "${SLE_DOWNLOAD_URL}")"
@@ -1008,6 +1057,7 @@ build_packages() {
--root "/var/cache/obs-build/${l_DIST}/${l_CODENAME}/${base_arch}/" \
--clean \
--stage="-bs" \
+ "${extra_obs_build_args[@]}" \
"${PKGDIST}/${l_DIST}/${l_CODENAME}/${l_ARCH}/rpmbuild/SOURCES/${PROJECT}.spec"; then
# Copy and sign source RPM's.
@@ -1053,6 +1103,7 @@ build_packages() {
--arch "${l_ARCH}" \
--clean \
--stage="-bb" \
+ "${extra_obs_build_args[@]}" \
"${PKGDIST}/${l_DIST}/${l_CODENAME}/SRPM/rpmbuild/SOURCES/${PROJECT}.spec"; then
# For information on why this weird -print0 | read -r -d '' construction works,
# refer to the first instance of this in this script.
--
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