[X2Go-Commits] [buildscripts] 01/03: bin/build-rpm-package: handle *SUSE repositories differently than the other ones.

git-admin at x2go.org git-admin at x2go.org
Thu Nov 24 08:42:07 CET 2016


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

x2go pushed a commit to branch master
in repository buildscripts.

commit f0e7d4d537684e87f3650b1abc716c42705ed9cf
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Thu Nov 24 08:05:09 2016 +0100

    bin/build-rpm-package: handle *SUSE repositories differently than the other ones.
    
    With this commit, the data layout for *SUSE repositories will change and
    the createsusetagsrepo script will be used instead of createrepo, thus
    creating/updating SUSE-tags based repositories instead of rpm-md-based
    repositories.
---
 bin/build-rpm-package |   88 +++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 70 insertions(+), 18 deletions(-)

diff --git a/bin/build-rpm-package b/bin/build-rpm-package
index c6735f4..58f92dc 100755
--- a/bin/build-rpm-package
+++ b/bin/build-rpm-package
@@ -958,29 +958,81 @@ upload_packages() {
 						if [ "${l_ARCH}" = "i386" ]; then
 							l_ARCH="i586"
 						fi
-					fi
 
-					# create remote directories in archive
-					0</dev/null ssh "${REPOS_SERVER}" "mkdir -p -- ${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/rpms/${PROJECT}"
-					0</dev/null ssh "${REPOS_SERVER}" "mkdir -p -- ${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/repodata"
+						# create remote directories in archive
+						0</dev/null ssh "${REPOS_SERVER}" "mkdir -p -- '${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/${PROJECT}'"
 
-					# remove rpm packages of the same name (pattern)
-					0</dev/null ssh "${REPOS_SERVER}" "rm -f -- ${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/rpms/${PROJECT}/*.rpm"
+						# remove rpm packages of the same name (pattern)
+						0</dev/null ssh "${REPOS_SERVER}" "rm -f -- '${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/${PROJECT}/'*.rpm"
 
-					# copy (s)rpms into repo
-					cd "${PKGDIST}/${l_DIST}/${l_CODENAME}/${l_ARCH}"
-					scp *.rpm "${REPOS_SERVER}:${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/rpms/${PROJECT}/" || true
+						# copy (s)rpms into repo
+						cd "${PKGDIST}/${l_DIST}/${l_CODENAME}/${l_ARCH}"
+						scp *.rpm "${REPOS_SERVER}:'${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/${PROJECT}/'" || true
 
-					CREATEREPO_OPTS=""
-					typeset gpg_sign_with="${GPG_KEY}"
-					if [ "${l_DIST}" = "epel" ] && [ "${l_CODENAME}" = "5" ]; then
-						CREATEREPO_OPTS="-s sha"
-						gpg_sign_with="${GPG_KEY_EPEL5}"
-					fi
-					0</dev/null ssh "${REPOS_SERVER}" "cd ${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/ && createrepo ${CREATEREPO_OPTS} ."
+						typeset distro_string=""
+						if [ "${l_DIST}" = "opensuse" ]; then
+							distro_string="OpenSuSE:"
+							[ "${l_CODENAME}" -gt "13" ] && distro_string="${distro_string}Leap:"
+							distro_string="${distro_string}${l_CODENAME}"
+						else
+							distro_string="SLE:"
+
+							# Split up version in major version and service pack.
+							typeset -i major="0"
+							typeset -i sp="0"
+							typeset -i i="0"
+							typeset other=""
+							typeset -a read_arr
+							while IFS='.' read -ra read_arr; do
+								for i in "${read_arr[@]}"; do
+									if [ "${i}" = "0" ]; then
+										major="${read_arr[${i}]}"
+
+										[ "${major}" != "${read_arr[${i}]}" ] && {
+											echo "Major SUSE version is not a valid integer, aborting." >&2
+											exit 1
+										}
+									elif [ "${i}" = "1" ]; then
+										sp="${read_arr[${i}]}"
+
+										[ "${sp}" != "${read_arr[${i}]}" ] && {
+											echo "SUSE service pack version is not a valid integer, aborting." >&2
+											exit 1
+										}
+									else
+										other="${other}.${read_arr[${i}]}"
+									fi
+								done
+							done <<< "${l_CODENAME}"
 
-					0</dev/null ssh "${REPOS_SERVER}" "cd ${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/repodata &&  rm -f -- repomd.xml.asc && gpg -a -u ${gpg_sign_with} --detach-sign repomd.xml" 1>/dev/null 2>/dev/null
-					0</dev/null ssh "${REPOS_SERVER}" "cd ${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/repodata && test -e repomd.xml.key || gpg -a --output repomd.xml.key --export ${gpg_sign_with}"
+							distro_string="${distro_string}${major}"
+							[ "${sp}" -gt "0" ] && distro_string="${distro_string}:SP${sp}"
+							[ -n "${other}" ] && distro_string="${distro_string}${other}"
+						fi
+						0</dev/null ssh "${REPOS_SERVER}" "cd '${RPM_REPOS_BASE}/${l_DIST}/{$l_CODENAME}/${COMPONENT}/' && createsusetagsrepo . '${distro_string}' '${l_CODENAME}'"
+					else
+						# create remote directories in archive
+						0</dev/null ssh "${REPOS_SERVER}" "mkdir -p -- ${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/rpms/${PROJECT}"
+						0</dev/null ssh "${REPOS_SERVER}" "mkdir -p -- ${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/repodata"
+
+						# remove rpm packages of the same name (pattern)
+						0</dev/null ssh "${REPOS_SERVER}" "rm -f -- ${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/rpms/${PROJECT}/*.rpm"
+
+						# copy (s)rpms into repo
+						cd "${PKGDIST}/${l_DIST}/${l_CODENAME}/${l_ARCH}"
+						scp *.rpm "${REPOS_SERVER}:${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/rpms/${PROJECT}/" || true
+
+						typeset createrepo_opts=""
+						typeset gpg_sign_with="${GPG_KEY}"
+						if [ "${l_DIST}" = "epel" ] && [ "${l_CODENAME}" = "5" ]; then
+							createrepo_opts="-s sha"
+							gpg_sign_with="${GPG_KEY_EPEL5}"
+						fi
+						0</dev/null ssh "${REPOS_SERVER}" "cd ${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/ && createrepo ${createrepo_opts} ."
+
+						0</dev/null ssh "${REPOS_SERVER}" "cd ${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/repodata &&  rm -f -- repomd.xml.asc && gpg -a -u ${gpg_sign_with} --detach-sign repomd.xml" 1>/dev/null 2>/dev/null
+						0</dev/null ssh "${REPOS_SERVER}" "cd ${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/repodata && test -e repomd.xml.key || gpg -a --output repomd.xml.key --export ${gpg_sign_with}"
+					fi
 				fi
 			done
 		done

--
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