[X2Go-Commits] [buildscripts] 03/04: bin/build-rpm-package: when uploading packages also clean out architectures that are supposed to be skipped.
git-admin at x2go.org
git-admin at x2go.org
Thu Sep 5 01:07:22 CEST 2019
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository buildscripts.
commit 076765937252bf9285d8f72a3dfbd934466213fa
Author: Mihai Moldovan <ionic at ionic.de>
Date: Thu Sep 5 01:04:43 2019 +0200
bin/build-rpm-package: when uploading packages also clean out architectures that are supposed to be skipped.
We need this if dropping an architecture after it was previously built.
---
bin/build-rpm-package | 73 ++++++++++++++++++++++++++++++++-------------------
1 file changed, 46 insertions(+), 27 deletions(-)
diff --git a/bin/build-rpm-package b/bin/build-rpm-package
index 8d264be..01267d1 100755
--- a/bin/build-rpm-package
+++ b/bin/build-rpm-package
@@ -1272,44 +1272,63 @@ upload_packages() {
esac
for l_ARCH in "${arches[@]}"; do
- if [ "x${SKIP_ARCH}" != "x${l_ARCH}" ]; then
- if [ "${l_DIST}" = "opensuse" ] || [ "${l_DIST}" = "sle" ]; then
- # Rename the i386 arch to i586 for OpenSuSE and SLE{S,D}.
- [[ "${l_ARCH}" = "i386" ]] && l_ARCH="i586"
-
- # create remote directories in archive
- 0</dev/null ssh -- "${REPOS_SERVER}" "mkdir -p -- '${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/${PROJECT}'"
+ if [ "${l_DIST}" = "opensuse" ] || [ "${l_DIST}" = "sle" ]; then
+ # Rename the i386 arch to i586 for OpenSuSE and SLE{S,D}.
+ typeset real_arch="${l_ARCH}"
+ [[ "${real_arch}" = "i386" ]] && real_arch="i586"
- # 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"
+ if [ "x${SKIP_ARCH}" != "x${l_ARCH}" ]; then
+ # Create remote directories in archive.
+ 0</dev/null ssh -- "${REPOS_SERVER}" "mkdir -p -- '${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${real_arch}/${PROJECT}'"
+ fi
- # 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
+ # Remove rpm packages of the same name (pattern).
+ # Also remove old packages if we decide to suddenly drop an architecture.
+ 0</dev/null ssh -- "${REPOS_SERVER}" "rm -f -- '${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${real_arch}/${PROJECT}/'*.rpm"
- else
- # create remote directories in archive
+ if [ "x${SKIP_ARCH}" != "x${l_ARCH}" ]; then
+ # Copy (s)rpms into repo.
+ cd "${PKGDIST}/${l_DIST}/${l_CODENAME}/${real_arch}"
+ scp *.rpm "${REPOS_SERVER}:'${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${real_arch}/${PROJECT}/'" || true
+ fi
+ else
+ if [ "x${SKIP_ARCH}" != "x${l_ARCH}" ]; then
+ # 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'"
+ fi
- # 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).
+ # Also remove old packages if we decide to suddenly drop an architecture.
+ 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
+ # Copy (s)rpms into repo.
+ if [ "x${SKIP_ARCH}" != "x${l_ARCH}" ]; then
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
+ fi
- 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}'"
+ 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
+ # Make sure that these operations don't fail if the architecture directory doesn't exist.
+ # Rationale: we don't want to skip architectures completely, but rather clean up old
+ # packages if they exist.
+ # To this effect, we only try to create the architecture directory (and copy generated
+ # binary packages into the arch's "rpm" sub-directory) iff skipping the architecture was
+ # not requested, but always delete old packages (with failures to do so being
+ # non-critical.)
+ # After package deletion, we have to make sure to update the repository metadata.
+ # Observant readers might have noticed that doing so unconditionally would be fine if the
+ # architecture existed before, but would fail badly if the architecture never existed
+ # in the first place.
+ 0</dev/null ssh -- "${REPOS_SERVER}" "if cd '${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/'; then createrepo ${createrepo_opts} '.' ; else : ; fi"
+
+ 0</dev/null ssh -- "${REPOS_SERVER}" "if cd '${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/repodata'; then rm -f -- 'repomd.xml.asc' && gpg -a -u '${gpg_sign_with}' --detach-sign 'repomd.xml' ; else : ; fi" 1>/dev/null 2>/dev/null
+ 0</dev/null ssh -- "${REPOS_SERVER}" "if cd '${RPM_REPOS_BASE}/${l_DIST}/${l_CODENAME}/${COMPONENT}/${l_ARCH}/repodata'; then test -e 'repomd.xml.key' || gpg -a --output 'repomd.xml.key' --export '${gpg_sign_with}' ; else : ; fi"
fi
done
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/buildscripts.git
More information about the x2go-commits
mailing list