From 0a1d0555820ee68d0ec8ee90a868b3e812d37345 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Wed, 23 Aug 2023 12:50:46 +0200 Subject: [PATCH] Unify packaging scripts --- bump_deb_packaging | 20 +------------------- bump_packaging | 38 ++++++++++++++++++++++++++++++++++++++ bump_rpm_packaging | 24 +----------------------- 3 files changed, 40 insertions(+), 42 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..f9634d2 --- /dev/null +++ b/bump_packaging @@ -0,0 +1,38 @@ +#!/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 +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 4bb49ec..9a38fa2 100755 --- a/bump_rpm_packaging +++ b/bump_rpm_packaging @@ -1,25 +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 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