From 63c7baae2514af554faac833d7b30bd839916c0f Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Wed, 23 Aug 2023 12:55:34 +0200 Subject: [PATCH 1/3] Convert RPM_PACKAGES to an array This correctly handles spaces, even though package names should never have spaces. --- bump_rpm_packaging | 4 ++-- releases/foreman/1.19/settings | 2 +- releases/foreman/settings | 2 +- releases/katello/settings | 2 +- settings | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bump_rpm_packaging b/bump_rpm_packaging index a63de19..61c1f36 100755 --- a/bump_rpm_packaging +++ b/bump_rpm_packaging @@ -11,9 +11,9 @@ git checkout -b rpm/release-$PROJECT-$FULLVERSION $PACKAGING_GIT_REMOTE/$REMOTE_ if [[ $FULLVERSION == *-rc* ]]; then PRERELEASE=${FULLVERSION##*-} - obal update --commit --version ${FULLVERSION%%-rc*} --prerelease ${PRERELEASE} --release keep $RPM_PACKAGES + obal update --commit --version ${FULLVERSION%%-rc*} --prerelease ${PRERELEASE} --release keep "${RPM_PACKAGES[@]}" else - obal update --commit --version $FULLVERSION $RPM_PACKAGES + obal update --commit --version $FULLVERSION "${RPM_PACKAGES[@]}" fi if [[ $PACKAGING_PR == true ]] ; then diff --git a/releases/foreman/1.19/settings b/releases/foreman/1.19/settings index fda3bbb..091b478 100644 --- a/releases/foreman/1.19/settings +++ b/releases/foreman/1.19/settings @@ -1,4 +1,4 @@ FULLGPGKEY="CE3159AAC3EC09E51614775446020A10694FA479" FULLVERSION="1.19.1" -RPM_PACKAGES=foreman foreman-installer foreman-proxy foreman-selinux +RPM_PACKAGES=(foreman foreman-installer foreman-proxy foreman-selinux) OSES="rhel7" diff --git a/releases/foreman/settings b/releases/foreman/settings index f4f46be..19c377f 100644 --- a/releases/foreman/settings +++ b/releases/foreman/settings @@ -1,5 +1,5 @@ TAR_PROJECTS="foreman foreman-proxy foreman-installer foreman-selinux" -RPM_PACKAGES="foreman foreman-installer foreman-proxy foreman-release foreman-selinux" +RPM_PACKAGES=(foreman foreman-installer foreman-proxy foreman-release foreman-selinux) KOJI_TAGS="foreman-@VERSION@-@OS@" PACKAGING_SUBDIR="packages/foreman" OSES="el8" diff --git a/releases/katello/settings b/releases/katello/settings index 16db4db..9f8a3db 100644 --- a/releases/katello/settings +++ b/releases/katello/settings @@ -1,4 +1,4 @@ -RPM_PACKAGES="katello katello-repos rubygem-katello" +RPM_PACKAGES=(katello katello-repos rubygem-katello) KOJI_TAGS="katello-@VERSION@-@OS@ katello-@VERSION@-thirdparty-candlepin-@OS@" PACKAGING_SUBDIR="packages/katello" diff --git a/settings b/settings index 45fb25b..514b0d7 100644 --- a/settings +++ b/settings @@ -62,7 +62,7 @@ GITHUB_NAMESPACE=theforeman PACKAGING_DIR="$GIT_DIR/foreman-packaging" PACKAGING_GIT_REMOTE=origin TAR_PROJECTS="" -RPM_PACKAGES="" +RPM_PACKAGES=() KOJI_CMD="${KOJI_CMD:-koji}" KOJI_TAGS="" KOJI_SSH_TARGET="root@koji.katello.org" From cd9fcb0bbfb5ceb48cc01b86fbe1f28abea49072 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Wed, 23 Aug 2023 12:59:10 +0200 Subject: [PATCH 2/3] Use bump_rpm_packaging to do git operations Obal uses a complex branch name and an obscure commit message. This simplifies the whole workflow and brings it more in line with the Debian side. --- bump_rpm_packaging | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bump_rpm_packaging b/bump_rpm_packaging index 61c1f36..f33dde3 100755 --- a/bump_rpm_packaging +++ b/bump_rpm_packaging @@ -11,11 +11,15 @@ git checkout -b rpm/release-$PROJECT-$FULLVERSION $PACKAGING_GIT_REMOTE/$REMOTE_ if [[ $FULLVERSION == *-rc* ]]; then PRERELEASE=${FULLVERSION##*-} - obal update --commit --version ${FULLVERSION%%-rc*} --prerelease ${PRERELEASE} --release keep "${RPM_PACKAGES[@]}" + obal update --version ${FULLVERSION%%-rc*} --prerelease ${PRERELEASE} --release keep "${RPM_PACKAGES[@]}" else - obal update --commit --version $FULLVERSION "${RPM_PACKAGES[@]}" + obal update --version $FULLVERSION "${RPM_PACKAGES[@]}" fi +git add "${RPM_PACKAGES[@]/#/packages\/${PROJECT}/}" + +git commit -m "Release $FULLVERSION" + if [[ $PACKAGING_PR == true ]] ; then git phr -m "Release $FULLVERSION" -b "$REMOTE_BRANCH" else From 6aa5d7b718cc86747ff8e6613172ac6ab3f5b338 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Wed, 23 Aug 2023 12:50:46 +0200 Subject: [PATCH 3/3] Unify packaging scripts --- bump_deb_packaging | 20 +------------------- bump_packaging | 40 ++++++++++++++++++++++++++++++++++++++++ bump_rpm_packaging | 26 +------------------------- 3 files changed, 42 insertions(+), 44 deletions(-) create mode 100755 bump_packaging diff --git a/bump_deb_packaging b/bump_deb_packaging index 5a2d8cf..4d46803 100755 --- a/bump_deb_packaging +++ b/bump_deb_packaging @@ -1,21 +1,3 @@ #!/bin/bash -e -. settings - -REMOTE_BRANCH=deb/${FOREMAN_VERSION} - -cd "$PACKAGING_DIR" - -git fetch $PACKAGING_GIT_REMOTE -git checkout -b deb/release-$PROJECT-$FULLVERSION $PACKAGING_GIT_REMOTE/$REMOTE_BRANCH - -scripts/changelog.rb -v ${FULLVERSION/-rc/~rc}-1 -m "$FULLVERSION released" debian/*/*/changelog -git add debian/*/*/changelog - -git commit -m "Release $FULLVERSION" - -if [[ $PACKAGING_PR == true ]] ; then - git phr -m "Release $FULLVERSION" -b "$REMOTE_BRANCH" -else - git push $PACKAGING_GIT_REMOTE HEAD:$REMOTE_BRANCH -fi +./bump_packaging deb diff --git a/bump_packaging b/bump_packaging new file mode 100755 index 0000000..52f20b1 --- /dev/null +++ b/bump_packaging @@ -0,0 +1,40 @@ +#!/bin/bash -e + +. settings + +FLAVOR=$1 + +if [[ $FLAVOR != deb ]] && [[ $FLAVOR != rpm ]] ; then + echo "Usage: $0 [deb|rpm]" >&2 + exit 1 +fi + +REMOTE_BRANCH="${FLAVOR}/${FOREMAN_VERSION}" +FULL_REMOTE_BRANCH="$PACKAGING_GIT_REMOTE/$REMOTE_BRANCH" + +cd "$PACKAGING_DIR" + +git fetch $PACKAGING_GIT_REMOTE +git checkout -b "${FLAVOR}/release-$PROJECT-$FULLVERSION" "${FULL_REMOTE_BRANCH}" + +if [[ $FLAVOR == deb ]] ; then + scripts/changelog.rb -v "${FULLVERSION/-rc/~rc}-1" -m "$FULLVERSION released" debian/*/*/changelog + git add debian/*/*/changelog +else + if [[ $FULLVERSION == *-rc* ]]; then + PRERELEASE=${FULLVERSION##*-} + obal update --version "${FULLVERSION%%-rc*}" --prerelease "${PRERELEASE}" --release keep "${RPM_PACKAGES[@]}" + else + obal update --version "${FULLVERSION}" "${RPM_PACKAGES[@]}" + fi + + git add "${RPM_PACKAGES[@]/#/packages\/${PROJECT}/}" +fi + +git commit -m "Release $FULLVERSION" + +if [[ $PACKAGING_PR == true ]] ; then + git phr -m "Release $FULLVERSION" -b "$REMOTE_BRANCH" +else + git push "$PACKAGING_GIT_REMOTE" "HEAD:$REMOTE_BRANCH" +fi diff --git a/bump_rpm_packaging b/bump_rpm_packaging index f33dde3..9a38fa2 100755 --- a/bump_rpm_packaging +++ b/bump_rpm_packaging @@ -1,27 +1,3 @@ #!/bin/bash -e -. settings - -REMOTE_BRANCH=rpm/${FOREMAN_VERSION} - -cd "$PACKAGING_DIR" - -git fetch $PACKAGING_GIT_REMOTE -git checkout -b rpm/release-$PROJECT-$FULLVERSION $PACKAGING_GIT_REMOTE/$REMOTE_BRANCH - -if [[ $FULLVERSION == *-rc* ]]; then - PRERELEASE=${FULLVERSION##*-} - obal update --version ${FULLVERSION%%-rc*} --prerelease ${PRERELEASE} --release keep "${RPM_PACKAGES[@]}" -else - obal update --version $FULLVERSION "${RPM_PACKAGES[@]}" -fi - -git add "${RPM_PACKAGES[@]/#/packages\/${PROJECT}/}" - -git commit -m "Release $FULLVERSION" - -if [[ $PACKAGING_PR == true ]] ; then - git phr -m "Release $FULLVERSION" -b "$REMOTE_BRANCH" -else - git push $PACKAGING_GIT_REMOTE HEAD:$REMOTE_BRANCH -fi +./bump_packaging rpm