From 64e14701ca0c40cf9c21aa03daa9357903da2395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Mon, 22 Sep 2025 18:05:40 +0200 Subject: [PATCH 01/16] Rely on Fedora branches rather then versions This allows to remove the hardcoded Rawhide version in code as well as keep the `rawhide` branch stay permanently. It also simplifies the code a bit, because there do not need to be added the `f` prefixes on various places. --- README.md | 20 ++++++++++---------- railsbuild | 14 +++++++------- railsbuild-build | 26 +++++++++++++++++--------- railsbuild-common | 3 --- railsbuild-fetch-tests | 10 +++++----- railsbuild-prepare | 12 ++++++------ railsbuild-update-bootstrapped | 8 ++++---- railsbuild-update-pkgs | 16 ++++++---------- 8 files changed, 55 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index 4579d44..41f6498 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Scripts to ease the update of Ruby on Rails core packages for Fedora Project. ## Usage ``` -./railsbuild FEDORA_VERSION OLD_RAILS_VERSION NEW_RAILS_VERSION +./railsbuild FEDORA_BRANCH OLD_RAILS_VERSION NEW_RAILS_VERSION ``` To update Rails from 4.1.4 to 4.1.5 for rawhide: @@ -29,41 +29,41 @@ build, but just let railsbuild to prepare the update. ### railsbuild-prepare ``` -./railsbuild-prepare FEDORA_VERSION +./railsbuild-prepare FEDORA_BRANCH ``` Prepares directories for the railsbuild scripts including fetching Fedora and upstream repositories at ~/.railsbuild/upstream/rails and -~/.railsbuild/f$FEDORA_VERSION/rubygem-$gem. +~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem. ### railsbuild-fetch-tests ``` -railsbuild-fetch-tests FEDORA_VERSION RAILS_VERSION +railsbuild-fetch-tests FEDORA_BRANCH RAILS_VERSION ``` Gets the upstream tests from the repository at ~/.railsbuild/upstream/rails and move the gzipped test suites to Fedora git repositories at -~/.railsbuild/f$FEDORA_VERSION/rubygem-$gem. +~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem. ### railsbuild-update-pkgs ``` -./railsbuild-update-pkgs FEDORA_VERSION OLD_RAILS_VERSION NEW_RAILS_VERSION +./railsbuild-update-pkgs FEDORA_BRANCH OLD_RAILS_VERSION NEW_RAILS_VERSION ``` Prepares the update of all Rails gems at once in Fedora git repositories at: -~/.railsbuild/f$FEDORA_VERSION/rubygem-$gem. +~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem. ### railsbuild-update-bootstrapped ``` -./railsbuild-update-bootstrapped FEDORA_VERSION OLD_RAILS_VERSION NEW_RAILS_VERSION +./railsbuild-update-bootstrapped FEDORA_BRANCH OLD_RAILS_VERSION NEW_RAILS_VERSION ``` Prepare the update of previously bootstrapped Rails gems at once in Fedora git -repositories at: ~/.railsbuild/f$FEDORA_VERSION/rubygem-$gem. +repositories at: ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem. ### railsbuild-build ``` -./railsbuild-build FEDORA_VERSION RAILS_VERSION +./railsbuild-build FEDORA_BRANCH RAILS_VERSION ``` Does the builds of gems. It always tries to do a scratch-build first and if that goes fine, does a final build. Afterwards it waits for the build diff --git a/railsbuild b/railsbuild index c01ea03..73cd816 100755 --- a/railsbuild +++ b/railsbuild @@ -6,7 +6,7 @@ # Automatic builds of Ruby on Rails core packages for Fedora Project # # Usage: -# ./railsbuild [-n] FEDORA_VERSION OLD_RAILS_VERSION NEW_RAILS_VERSION +# ./railsbuild [-n] FEDORA_BRANCH OLD_RAILS_VERSION NEW_RAILS_VERSION # # -n Do not run builds. Useful for major version upgrades. # @@ -14,7 +14,7 @@ # railsbuild-common print_help () { - echo "Usage: ./railsbuild [-n] FEDORA_VERSION OLD_RAILS_VERSION NEW_RAILS_VERSION" + echo "Usage: ./railsbuild [-n] FEDORA_BRANCH OLD_RAILS_VERSION NEW_RAILS_VERSION" } if [ "$1" = "--help" ]; then @@ -34,20 +34,20 @@ if [ "$3" = "" ] || [ "$2" = "" ] || [ "$1" = "" ]; then exit 1 fi -FEDORA_VERSION=$1 +FEDORA_BRANCH=$1 OLD_RAILS_VERSION=$2 NEW_RAILS_VERSION=$3 # Create directory structure and get the upstream repositories -$(dirname $(readlink -f "$0"))/railsbuild-prepare $FEDORA_VERSION +$(dirname $(readlink -f "$0"))/railsbuild-prepare $FEDORA_BRANCH # Get the test suites -$(dirname $(readlink -f "$0"))/railsbuild-fetch-tests $FEDORA_VERSION $NEW_RAILS_VERSION +$(dirname $(readlink -f "$0"))/railsbuild-fetch-tests $FEDORA_BRANCH $NEW_RAILS_VERSION # Update specs -$(dirname $(readlink -f "$0"))/railsbuild-update-pkgs $FEDORA_VERSION $OLD_RAILS_VERSION $NEW_RAILS_VERSION +$(dirname $(readlink -f "$0"))/railsbuild-update-pkgs $FEDORA_BRANCH $OLD_RAILS_VERSION $NEW_RAILS_VERSION # Run the build if not opted-out [[ "$NO_BUILD" ]] || { - $(dirname $(readlink -f "$0"))/railsbuild-build $FEDORA_VERSION $NEW_RAILS_VERSION + $(dirname $(readlink -f "$0"))/railsbuild-build $FEDORA_BRANCH $NEW_RAILS_VERSION } diff --git a/railsbuild-build b/railsbuild-build index 252335f..dcaffbf 100755 --- a/railsbuild-build +++ b/railsbuild-build @@ -6,16 +6,16 @@ # this script after it failed will pick up the work from the last run. # # Usage: -# ./railsbuild-build FEDORA_VERSION VERSION +# ./railsbuild-build FEDORA_BRANCH VERSION . $(dirname $(readlink -f "$0"))/railsbuild-common -FEDORA_VERSION=$1 +FEDORA_BRANCH=$1 VERSION=$2 for gem in "${GEMS[@]}" do - pushd ~/.railsbuild/f$FEDORA_VERSION/rubygem-$gem + pushd ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem # Skip already done builds if [ -f .built ]; then echo "$gem: build for $gem already done" @@ -52,13 +52,17 @@ do git commit -am "Update to $gem $VERSION" git push + + PACKAGE_NVR=$(fedpkg verrel) + FEDORA_TAG=$(echo $PACKAGE_NVR | sed -r -n 's/.*\.fc([[:digit:]]{2})$/f\1-build/ p') + fedpkg build if [ "$?" = "0" ]; then echo "= SUCCESS ======" echo "$gem: build of rubygem-$gem succeeded" echo "$gem: waiting until the build becomes available..." - koji wait-repo f$FEDORA_VERSION-build --build=rubygem-$gem-$VERSION-1.fc$FEDORA_VERSION + koji wait-repo $FEDORA_TAG --build=$PACKAGE_NVR touch .built else echo "= FAIL ======" @@ -75,12 +79,12 @@ do done # Update bootsrapped gems -$(dirname $(readlink -f "$0"))/railsbuild-update-bootstrapped $FEDORA_VERSION $VERSION +$(dirname $(readlink -f "$0"))/railsbuild-update-bootstrapped $FEDORA_BRANCH $VERSION # Build bootsrapped gems again for gem in "${BOOTSTRAPPED_GEMS[@]}" do - pushd ~/.railsbuild/f$FEDORA_VERSION/rubygem-$gem + pushd ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem # Skip already done builds if [ ! -f .bootstrapped ]; then echo "$gem: final build for bootsrapped $gem already done" @@ -105,13 +109,17 @@ do git commit -am "Enable tests" git push + + PACKAGE_NVR=$(fedpkg verrel) + FEDORA_TAG=$(echo $PACKAGE_NVR | sed -r -n 's/.*\.fc([[:digit:]]{2})$/f\1-build/ p') + fedpkg build if [ "$?" = "0" ]; then echo "= SUCCESS ======" echo "$gem: build of rubygem-$gem succeeded" echo "$gem: waiting until the build becomes available..." - koji wait-repo f$FEDORA_VERSION-build --build=rubygem-$gem-$VERSION-1.fc$FEDORA_VERSION + koji wait-repo $FEDORA_TAG --build=$PACKAGE_NVR rm .bootsrapped else echo "= FAIL ======" @@ -130,7 +138,7 @@ done echo echo echo "= SUCCESSFULLY DONE =====" -echo "Build of Ruby on Rails $VERSION for Fedora release $FEDORA_VERSION done." +echo "Build of Ruby on Rails $VERSION for Fedora release $FEDORA_BRANCH done." echo echo "Run the following to delete the build metadata:" -echo " rm ~/.railsbuild/f$FEDORA_VERSION/rubygem-*/.*built" +echo " rm ~/.railsbuild/$FEDORA_BRANCH/rubygem-*/.*built" diff --git a/railsbuild-common b/railsbuild-common index 83fde80..b2fe42d 100644 --- a/railsbuild-common +++ b/railsbuild-common @@ -3,9 +3,6 @@ RAILSBUILD_VERSION=0.4 -# Fedora master branch -FEDORA_RAWHIDE=24 - # Ruby on Rails gems GEMS=(activesupport activejob diff --git a/railsbuild-fetch-tests b/railsbuild-fetch-tests index 3ad0daf..053021f 100755 --- a/railsbuild-fetch-tests +++ b/railsbuild-fetch-tests @@ -1,13 +1,13 @@ #!/bin/bash # Get the test suites for Rails gems from ~/.railsbuild/upstream/rails (upstream git repo) -# and place them in ~/.railsbuild/f$FEDORA_VERSION/rubygem-$gem +# and place them in ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem # # Usage: -# ./railsbuild-fetch-tests FEDORA_VERSION VERSION +# ./railsbuild-fetch-tests FEDORA_BRANCH VERSION . $(dirname $(readlink -f "$0"))/railsbuild-common -FEDORA_VERSION=$1 +FEDORA_BRANCH=$1 VERSION=$2 cd ~/.railsbuild/upstream/rails @@ -18,7 +18,7 @@ for gem in "${GEMS[@]}" do echo "Getting test suite for $gem..." - UPDATED=`ls ~/.railsbuild/f$FEDORA_VERSION/rubygem-$gem/ | grep "$gem-$VERSION-tests.tgz"` + UPDATED=`ls ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/ | grep "$gem-$VERSION-tests.tgz"` # Are files already in place? if [ "$UPDATED" == "$gem-$VERSION-tests.tgz" ]; then @@ -27,6 +27,6 @@ do cd ~/.railsbuild/upstream/rails/$gem tar czvf $gem-$VERSION-tests.tgz test/ - cp $gem-$VERSION-tests.tgz ~/.railsbuild/f$FEDORA_VERSION/rubygem-$gem/. + cp $gem-$VERSION-tests.tgz ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/. done diff --git a/railsbuild-prepare b/railsbuild-prepare index 79db3ac..0cea146 100755 --- a/railsbuild-prepare +++ b/railsbuild-prepare @@ -2,24 +2,24 @@ # Prepare directories for the railsbuild scripts including fetching Fedora # and upstream repositories at: # ~/.railsbuild/upstream/rails -# ~/.railsbuild/f$FEDORA_VERSION/rubygem-$gem +# ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem # # Usage: -# ./railsbuild-prepare FEDORA_VERSION +# ./railsbuild-prepare FEDORA_BRANCH . $(dirname $(readlink -f "$0"))/railsbuild-common -FEDORA_VERSION=$1 +FEDORA_BRANCH=$1 for gem in "${GEMS[@]}" do - dir=~/.railsbuild/f$FEDORA_VERSION/rubygem-$gem + dir=~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem if [ -d $dir ]; then echo "$dir exists" else echo "Creating $dir" - mkdir -p ~/.railsbuild/f$FEDORA_VERSION/ - pushd ~/.railsbuild/f$FEDORA_VERSION/ + mkdir -p ~/.railsbuild/$FEDORA_BRANCH/ + pushd ~/.railsbuild/$FEDORA_BRANCH/ fedpkg co rubygem-$gem popd fi diff --git a/railsbuild-update-bootstrapped b/railsbuild-update-bootstrapped index 69bbf52..2eff02d 100755 --- a/railsbuild-update-bootstrapped +++ b/railsbuild-update-bootstrapped @@ -1,20 +1,20 @@ #!/bin/bash # Prepare the update of previously bootstrapped Rails gems at once in Fedora git # repositories at: -# ~/.railsbuild/f$FEDORA_VERSION/rubygem-$gem +# ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem # # Usage: -# ./railsbuild-update-boostrapped FEDORA_VERSION NEW_VERSION +# ./railsbuild-update-boostrapped FEDORA_BRANCH NEW_VERSION . $(dirname $(readlink -f "$0"))/railsbuild-common -FEDORA_VERSION=$1 +FEDORA_BRANCH=$1 NEW_VERSION=$2 for gem in "${BOOTSTRAPPED_GEMS[@]}" do echo "Building previously bootstrapped $gem:" - pushd ~/.railsbuild/f$FEDORA_VERSION/rubygem-$gem/ + pushd ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/ EPOCH=`cat ./rubygem-$gem.spec | grep -E "Epoch:(.*)" | sed 's/Epoch: //'` if [ "$EPOCH" ]; then diff --git a/railsbuild-update-pkgs b/railsbuild-update-pkgs index a158d2f..5ce3488 100755 --- a/railsbuild-update-pkgs +++ b/railsbuild-update-pkgs @@ -1,28 +1,24 @@ #!/bin/bash # Prepare the update of all Rails gems at once in Fedora git # repositories at: -# ~/.railsbuild/f$FEDORA_VERSION/rubygem-$gem +# ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem # # Usage: -# ./railsbuild-update-pkgs FEDORA_VERSION OLD_VERSION NEW_VERSION +# ./railsbuild-update-pkgs FEDORA_BRANCH OLD_VERSION NEW_VERSION . $(dirname $(readlink -f "$0"))/railsbuild-common -FEDORA_VERSION=$1 +FEDORA_BRANCH=$1 OLD_VERSION=$2 NEW_VERSION=$3 for gem in "${GEMS[@]}" do echo "Updating $gem:" - pushd ~/.railsbuild/f$FEDORA_VERSION/rubygem-$gem/ + pushd ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/ git pull - if [ "$FEDORA_VERSION" = "$FEDORA_RAWHIDE" ]; then - git checkout master - else - git checkout f$FEDORA_VERSION - fi + git checkout $FEDORA_BRANCH gem fetch $gem --version $NEW_VERSION UPDATED=`cat ./rubygem-$gem.spec | grep "Version: $NEW_VERSION"` @@ -61,7 +57,7 @@ done # Mark bootsrapping for gem in "${BOOTSTRAPPED_GEMS[@]}" do - pushd ~/.railsbuild/f$FEDORA_VERSION/rubygem-$gem/ + pushd ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/ # Enable bootstrapping if necessary sed -i -e "s/%global bootstrap 0/%global bootstrap 1/" rubygem-$gem.spec touch .bootstrapped From dcc29fad3c2edbe37cff7bbe9f53487c44471b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 23 Sep 2025 10:14:44 +0200 Subject: [PATCH 02/16] Use `.tar.gz` extension instead of `.tgz` This is in preparation to reaplace `tar` by `git archive` command, which does not correctly understadn `.tgz` extension and produces plain unarchived tarballs. --- railsbuild-fetch-tests | 8 ++++---- railsbuild-update-pkgs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/railsbuild-fetch-tests b/railsbuild-fetch-tests index 053021f..67d3697 100755 --- a/railsbuild-fetch-tests +++ b/railsbuild-fetch-tests @@ -18,15 +18,15 @@ for gem in "${GEMS[@]}" do echo "Getting test suite for $gem..." - UPDATED=`ls ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/ | grep "$gem-$VERSION-tests.tgz"` + UPDATED=`ls ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/ | grep "$gem-$VERSION-tests.tar.gz"` # Are files already in place? - if [ "$UPDATED" == "$gem-$VERSION-tests.tgz" ]; then + if [ "$UPDATED" == "$gem-$VERSION-tests.tar.gz" ]; then continue fi cd ~/.railsbuild/upstream/rails/$gem - tar czvf $gem-$VERSION-tests.tgz test/ - cp $gem-$VERSION-tests.tgz ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/. + tar czvf $gem-$VERSION-tests.tar.gz test/ + cp $gem-$VERSION-tests.tar.gz ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/. done diff --git a/railsbuild-update-pkgs b/railsbuild-update-pkgs index 5ce3488..7041ce4 100755 --- a/railsbuild-update-pkgs +++ b/railsbuild-update-pkgs @@ -35,7 +35,7 @@ do fi sed -i -e "s/git checkout v$OLD_VERSION/git checkout v$NEW_VERSION/" rubygem-$gem.spec - sed -i -e "s/$OLD_VERSION-tests.tgz/$NEW_VERSION-tests.tgz/" rubygem-$gem.spec + sed -i -e "s/$OLD_VERSION-tests.tar.gz/$NEW_VERSION-tests.tar.gz/" rubygem-$gem.spec sed -i -e "s/Version:.*$OLD_VERSION/Version: $NEW_VERSION/g" rubygem-$gem.spec sed -i -e "s/Release:.*/Release: 1%{?dist}/g" rubygem-$gem.spec From fd03dda67c75e133949836e1c690e4c0c3513c2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 23 Sep 2025 10:20:34 +0200 Subject: [PATCH 03/16] Update test creation process to use `git archive` Switched from creating a tarball by `tar` to utilizing Git's `archive` command for better reproducibility and robustness. --- railsbuild-fetch-tests | 2 +- railsbuild-update-pkgs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/railsbuild-fetch-tests b/railsbuild-fetch-tests index 67d3697..092e7d4 100755 --- a/railsbuild-fetch-tests +++ b/railsbuild-fetch-tests @@ -26,7 +26,7 @@ do fi cd ~/.railsbuild/upstream/rails/$gem - tar czvf $gem-$VERSION-tests.tar.gz test/ + git archive -v -o $gem-$VERSION-tests.tar.gz v$VERSION test/ cp $gem-$VERSION-tests.tar.gz ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/. done diff --git a/railsbuild-update-pkgs b/railsbuild-update-pkgs index 7041ce4..aa76e02 100755 --- a/railsbuild-update-pkgs +++ b/railsbuild-update-pkgs @@ -34,7 +34,7 @@ do epoch_prefix="" fi - sed -i -e "s/git checkout v$OLD_VERSION/git checkout v$NEW_VERSION/" rubygem-$gem.spec + sed -i -e "/git archive/ s/$OLD_VERSION/$NEW_VERSION/g" rubygem-$gem.spec sed -i -e "s/$OLD_VERSION-tests.tar.gz/$NEW_VERSION-tests.tar.gz/" rubygem-$gem.spec sed -i -e "s/Version:.*$OLD_VERSION/Version: $NEW_VERSION/g" rubygem-$gem.spec sed -i -e "s/Release:.*/Release: 1%{?dist}/g" rubygem-$gem.spec From f37fff485848c8525032a75e7e8c6451c857e483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 23 Sep 2025 10:27:14 +0200 Subject: [PATCH 04/16] Remove unneeded `git checkout` This is not needed anymore, because the version is specified for `git archive` command. --- railsbuild-fetch-tests | 1 - 1 file changed, 1 deletion(-) diff --git a/railsbuild-fetch-tests b/railsbuild-fetch-tests index 092e7d4..17a6520 100755 --- a/railsbuild-fetch-tests +++ b/railsbuild-fetch-tests @@ -12,7 +12,6 @@ VERSION=$2 cd ~/.railsbuild/upstream/rails git pull -git checkout v$VERSION for gem in "${GEMS[@]}" do From c023d18a7fca3d7ee8c21fefcf2187dad3da7047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 23 Sep 2025 10:37:10 +0200 Subject: [PATCH 05/16] Check for test suite availability before trying to pack it. Added a conditional check to verify the test suite availability before entering the files. This prevents creating test suite archives from wrong sources. --- railsbuild-fetch-tests | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/railsbuild-fetch-tests b/railsbuild-fetch-tests index 17a6520..64af11b 100755 --- a/railsbuild-fetch-tests +++ b/railsbuild-fetch-tests @@ -24,8 +24,12 @@ do continue fi - cd ~/.railsbuild/upstream/rails/$gem - git archive -v -o $gem-$VERSION-tests.tar.gz v$VERSION test/ - cp $gem-$VERSION-tests.tar.gz ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/. + if [[ -e ~/.railsbuild/upstream/rails/$gem ]]; then + cd ~/.railsbuild/upstream/rails/$gem + git archive -v -o $gem-$VERSION-tests.tar.gz v$VERSION test/ + cp $gem-$VERSION-tests.tar.gz ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/. + else + echo " ⚠ test suite not available" + fi done From 23408951886c56f9986d2c8b48a6cf2d4dbb05e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 23 Sep 2025 10:53:50 +0200 Subject: [PATCH 06/16] Make sure the directory is not changing This prevents possible side effect, such as creating test tarball from wrong sources. --- railsbuild-fetch-tests | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/railsbuild-fetch-tests b/railsbuild-fetch-tests index 64af11b..2fd4a9e 100755 --- a/railsbuild-fetch-tests +++ b/railsbuild-fetch-tests @@ -25,9 +25,11 @@ do fi if [[ -e ~/.railsbuild/upstream/rails/$gem ]]; then - cd ~/.railsbuild/upstream/rails/$gem - git archive -v -o $gem-$VERSION-tests.tar.gz v$VERSION test/ - cp $gem-$VERSION-tests.tar.gz ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/. + ( + cd ~/.railsbuild/upstream/rails/$gem + git archive -v -o $gem-$VERSION-tests.tar.gz v$VERSION test/ + cp $gem-$VERSION-tests.tar.gz ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/. + ) else echo " ⚠ test suite not available" fi From 6281c1408783a32e86179a5804b65fecb4bdc67b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 23 Sep 2025 13:12:23 +0200 Subject: [PATCH 07/16] Update Rails component list This reflects components as of Rails 8.0 --- railsbuild-common | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/railsbuild-common b/railsbuild-common index b2fe42d..85dd776 100644 --- a/railsbuild-common +++ b/railsbuild-common @@ -7,13 +7,19 @@ RAILSBUILD_VERSION=0.4 GEMS=(activesupport activejob activemodel - activerecord - actionview actionpack + actionview + activerecord actionmailer + actioncable railties + activestorage + actionmailbox + actiontext rails) # Gems that needs to be rebuild without bootstrapping -BOOTSTRAPPED_GEMS=(actionview - actionpack) +BOOTSTRAPPED_GEMS=(activemodel + actionpack + actionview + railties) From 677535b2fb3f49c1f1f761ab03290cbe24ed5ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 23 Sep 2025 13:42:45 +0200 Subject: [PATCH 08/16] Use `rpmdev-bumpspec` to update .spec file Better to use this official tool whenever possible then hand crafted `sed` commands. --- railsbuild-update-pkgs | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/railsbuild-update-pkgs b/railsbuild-update-pkgs index aa76e02..0a9bfe7 100755 --- a/railsbuild-update-pkgs +++ b/railsbuild-update-pkgs @@ -27,29 +27,13 @@ do continue fi - EPOCH=`cat ./rubygem-$gem.spec | grep -E "Epoch:(.*)" | sed 's/Epoch: //'` - if [ "$EPOCH" ]; then - epoch_prefix="$EPOCH:" - else - epoch_prefix="" - fi + CHANGELOG="- Update to $gem $NEW_VERSION" + + rpmdev-bumpspec -n "$NEW_VERSION" -c "$CHANGELOG" rubygem-$gem.spec sed -i -e "/git archive/ s/$OLD_VERSION/$NEW_VERSION/g" rubygem-$gem.spec sed -i -e "s/$OLD_VERSION-tests.tar.gz/$NEW_VERSION-tests.tar.gz/" rubygem-$gem.spec - sed -i -e "s/Version:.*$OLD_VERSION/Version: $NEW_VERSION/g" rubygem-$gem.spec - sed -i -e "s/Release:.*/Release: 1%{?dist}/g" rubygem-$gem.spec - - # Set to default locale for the changelog date format - export LC_ALL=C - - CHANGELOG='* ' - CHANGELOG+=`date +'%a %b %d %Y'` - CHANGELOG+=" " - CHANGELOG+=`rpmdev-packager` - CHANGELOG+=" - $epoch_prefix$NEW_VERSION-1\n" - CHANGELOG+="- Update to $gem $NEW_VERSION" - sed -i -e "s/%changelog/%changelog\n$CHANGELOG\n/g" rubygem-$gem.spec echo "$gem: rubygem-$gem.spec updated" popd done From 78f7faa80784bc115e81dd6127518c504365c3d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 23 Sep 2025 14:05:35 +0200 Subject: [PATCH 09/16] Try to recycle changelog entries. Ensure that existing changelog entries are recycled if they match an old version number, maintaining the proper component naming. --- railsbuild-update-pkgs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/railsbuild-update-pkgs b/railsbuild-update-pkgs index 0a9bfe7..bd8cf66 100755 --- a/railsbuild-update-pkgs +++ b/railsbuild-update-pkgs @@ -27,7 +27,13 @@ do continue fi - CHANGELOG="- Update to $gem $NEW_VERSION" + # Try to recycle old changelog entry to keep the formatting. + CHANGELOG=$(grep "^- .* $OLD_VERSION" rubygem-$gem.spec) + if [[ -z $CHANGELOG ]]; then + CHANGELOG="- Update to $gem $NEW_VERSION" + else + CHANGELOG=$(echo $CHANGELOG | sed "s/$OLD_VERSION/$NEW_VERSION/") + fi rpmdev-bumpspec -n "$NEW_VERSION" -c "$CHANGELOG" rubygem-$gem.spec From 5000762872054051505e1a494e5fb3f257ae3b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Wed, 24 Sep 2025 15:17:25 +0200 Subject: [PATCH 10/16] Fetch all `git archive` sources, not just tests Analyze content of the .spec file to get not just `-test` tarballs, but also all other sources. This assumes that: 1. the line above `Source` tag contains information about call to `git archive` command 2. the line contains relevant version information --- README.md | 16 +++++++------- railsbuild | 6 ++--- railsbuild-fetch-sources | 47 ++++++++++++++++++++++++++++++++++++++++ railsbuild-fetch-tests | 37 ------------------------------- 4 files changed, 58 insertions(+), 48 deletions(-) create mode 100755 railsbuild-fetch-sources delete mode 100755 railsbuild-fetch-tests diff --git a/README.md b/README.md index 41f6498..2a30fe9 100644 --- a/README.md +++ b/README.md @@ -35,22 +35,22 @@ Prepares directories for the railsbuild scripts including fetching Fedora and upstream repositories at ~/.railsbuild/upstream/rails and ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem. -### railsbuild-fetch-tests +### railsbuild-update-pkgs ``` -railsbuild-fetch-tests FEDORA_BRANCH RAILS_VERSION +./railsbuild-update-pkgs FEDORA_BRANCH OLD_RAILS_VERSION NEW_RAILS_VERSION ``` -Gets the upstream tests from the repository at ~/.railsbuild/upstream/rails -and move the gzipped test suites to Fedora git repositories at +Prepares the update of all Rails gems at once in Fedora git repositories at: ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem. -### railsbuild-update-pkgs +### railsbuild-fetch-sources ``` -./railsbuild-update-pkgs FEDORA_BRANCH OLD_RAILS_VERSION NEW_RAILS_VERSION +railsbuild-fetch-sources FEDORA_BRANCH ``` -Prepares the update of all Rails gems at once in Fedora git repositories at: -~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem. +Get the information about sources (test suites, js, ...) for Rails gems from +their spec files, prepare the `git archive` tarballs to Fedora git repositories +at ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem ### railsbuild-update-bootstrapped diff --git a/railsbuild b/railsbuild index 73cd816..2485d5f 100755 --- a/railsbuild +++ b/railsbuild @@ -41,12 +41,12 @@ NEW_RAILS_VERSION=$3 # Create directory structure and get the upstream repositories $(dirname $(readlink -f "$0"))/railsbuild-prepare $FEDORA_BRANCH -# Get the test suites -$(dirname $(readlink -f "$0"))/railsbuild-fetch-tests $FEDORA_BRANCH $NEW_RAILS_VERSION - # Update specs $(dirname $(readlink -f "$0"))/railsbuild-update-pkgs $FEDORA_BRANCH $OLD_RAILS_VERSION $NEW_RAILS_VERSION +# Fetch sources +$(dirname $(readlink -f "$0"))/railsbuild-fetch-sources $FEDORA_BRANCH $OLD_RAILS_VERSION $NEW_RAILS_VERSION + # Run the build if not opted-out [[ "$NO_BUILD" ]] || { $(dirname $(readlink -f "$0"))/railsbuild-build $FEDORA_BRANCH $NEW_RAILS_VERSION diff --git a/railsbuild-fetch-sources b/railsbuild-fetch-sources new file mode 100755 index 0000000..a640985 --- /dev/null +++ b/railsbuild-fetch-sources @@ -0,0 +1,47 @@ +#!/bin/bash +# Get the information about sources (test suites, js, ...) for Rails gems from +# their spec files, prepare the `git archive` tarballs from +# ~/.railsbuild/upstream/rails (upstream git repo) and place them in +# ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem +# +# Usage: +# ./railsbuild-fetch-tests FEDORA_BRANCH + +. $(dirname $(readlink -f "$0"))/railsbuild-common + +FEDORA_BRANCH=$1 + +cd ~/.railsbuild/upstream/rails +git pull + +for gem in "${GEMS[@]}" +do + echo "Getting sources for $gem..." + + GIT_ARCHIVE_CMDS=`grep -R -B1 '^Source[[:digit:]]*: ' ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/rubygem-$gem.spec | \ + sed -nr "/^#/ s/.*(git archive.*$gem.*\.tar\.gz.*)/\1/ p"` + + if [[ -z "$GIT_ARCHIVE_CMDS" ]]; then + echo " ⚠ No additional source identified" + continue + fi + + echo "$GIT_ARCHIVE_CMDS" | while read GIT_ARCHIVE_CMD; do + TARBALL=`echo $GIT_ARCHIVE_CMD | sed -r "s/.*($gem.*\.tar.\gz).*/\1/"` + + # Is source already in place? + if [[ -f ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/$TARBALL ]]; then + echo " ✔ $TARBALL already exists" + continue + fi + + cd ~/.railsbuild/upstream/rails/$gem + + `$GIT_ARCHIVE_CMD` + + mv $TARBALL ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/. + + echo " $TARBALL created" + done +done + diff --git a/railsbuild-fetch-tests b/railsbuild-fetch-tests deleted file mode 100755 index 2fd4a9e..0000000 --- a/railsbuild-fetch-tests +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# Get the test suites for Rails gems from ~/.railsbuild/upstream/rails (upstream git repo) -# and place them in ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem -# -# Usage: -# ./railsbuild-fetch-tests FEDORA_BRANCH VERSION - -. $(dirname $(readlink -f "$0"))/railsbuild-common - -FEDORA_BRANCH=$1 -VERSION=$2 - -cd ~/.railsbuild/upstream/rails -git pull - -for gem in "${GEMS[@]}" -do - echo "Getting test suite for $gem..." - - UPDATED=`ls ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/ | grep "$gem-$VERSION-tests.tar.gz"` - - # Are files already in place? - if [ "$UPDATED" == "$gem-$VERSION-tests.tar.gz" ]; then - continue - fi - - if [[ -e ~/.railsbuild/upstream/rails/$gem ]]; then - ( - cd ~/.railsbuild/upstream/rails/$gem - git archive -v -o $gem-$VERSION-tests.tar.gz v$VERSION test/ - cp $gem-$VERSION-tests.tar.gz ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/. - ) - else - echo " ⚠ test suite not available" - fi -done - From f50bf6ed9ee5f0f44a7638581a8073935d8bf51b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Wed, 24 Sep 2025 15:48:35 +0200 Subject: [PATCH 11/16] Fetch gems together with other sources Better to fetch gems together with outher sources instead of fetching them as part of updating .spec file. --- railsbuild-fetch-sources | 12 ++++++++++++ railsbuild-update-pkgs | 1 - 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/railsbuild-fetch-sources b/railsbuild-fetch-sources index a640985..e6269e9 100755 --- a/railsbuild-fetch-sources +++ b/railsbuild-fetch-sources @@ -18,6 +18,18 @@ for gem in "${GEMS[@]}" do echo "Getting sources for $gem..." + VERSION=`cat ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/rubygem-$gem.spec | sed -rn "/^Version: / s/^Version: (.*)$/\1/ p"` + GEM_FILE="$gem-$VERSION.gem" + + # Is .gem already in place? + if [[ -f ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/$GEM_FILE ]]; then + echo " ✔ $GEM_FILE already exists" + else + pushd ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/ >> /dev/null + gem fetch $gem --version $VERSION + popd >> /dev/null + fi + GIT_ARCHIVE_CMDS=`grep -R -B1 '^Source[[:digit:]]*: ' ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/rubygem-$gem.spec | \ sed -nr "/^#/ s/.*(git archive.*$gem.*\.tar\.gz.*)/\1/ p"` diff --git a/railsbuild-update-pkgs b/railsbuild-update-pkgs index bd8cf66..7120df7 100755 --- a/railsbuild-update-pkgs +++ b/railsbuild-update-pkgs @@ -19,7 +19,6 @@ do git pull git checkout $FEDORA_BRANCH - gem fetch $gem --version $NEW_VERSION UPDATED=`cat ./rubygem-$gem.spec | grep "Version: $NEW_VERSION"` if [ "$UPDATED" == "Version: $NEW_VERSION" ]; then From d7caee66f89cffb31df9195882a59553c41fa35f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Thu, 25 Sep 2025 15:36:29 +0200 Subject: [PATCH 12/16] Correctly handle epoch in changelog Previously, the epoch was not correctly detected and therefore possible duplicates could slip through. --- railsbuild-build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railsbuild-build b/railsbuild-build index dcaffbf..237c6b9 100755 --- a/railsbuild-build +++ b/railsbuild-build @@ -25,7 +25,7 @@ do # Check changelog in spec file for same EVR if [ -n "$( sed -n '/^%changelog/,$p' rubygem-$gem.spec \ - | grep -E " [0-9]+\:[0-9]+\.[0-9]+\.[0-9]+\-[0-9]+$" \ + | grep -E " ([0-9]+:)?[0-9]+\.[0-9]+\.[0-9]+-[0-9]+$" \ | head -n 2 | rev | cut -d' ' -f1 \ | sort | uniq -c | grep -vE "^[ ]*1 " )" ]; then From 98cf734b4254bb7b7f68afcd0bfb093fd7771ad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Thu, 25 Sep 2025 17:21:41 +0200 Subject: [PATCH 13/16] Keep the directory stack clean Exit the directory when shortcutting the loop. --- railsbuild-update-pkgs | 1 + 1 file changed, 1 insertion(+) diff --git a/railsbuild-update-pkgs b/railsbuild-update-pkgs index 7120df7..ea9801b 100755 --- a/railsbuild-update-pkgs +++ b/railsbuild-update-pkgs @@ -23,6 +23,7 @@ do UPDATED=`cat ./rubygem-$gem.spec | grep "Version: $NEW_VERSION"` if [ "$UPDATED" == "Version: $NEW_VERSION" ]; then echo "$gem: already updated" + popd continue fi From 42bcc4745f39711eb98390d8f7c2a12c203ac811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Mon, 29 Sep 2025 14:12:02 +0200 Subject: [PATCH 14/16] Add BZ ticket number into changelog. Try to fetch BZ ticket number for rubygem-railties, created by the-new-hotness, and append it into changelog(s). --- railsbuild-update-pkgs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/railsbuild-update-pkgs b/railsbuild-update-pkgs index ea9801b..d601e4f 100755 --- a/railsbuild-update-pkgs +++ b/railsbuild-update-pkgs @@ -12,6 +12,13 @@ FEDORA_BRANCH=$1 OLD_VERSION=$2 NEW_VERSION=$3 +# Fetch BZ ticket number created by the-new-hotness. +RAILS_RHBZ=$(curl -s "https://bugzilla.redhat.com/rest/bug?product=Fedora&component=rubygem-rails&bug_status=__open__&creator=upstream-release-monitoring%40fedoraproject.org&order=bug_id%20desc&include_fields=id" \ + | sed -r -e 's/.*\[(.*)\].*/\1/' -e 's/},/}\n/g' \ + | sed -r 's/.*:([[:digit:]]+).*/\1/' \ + | head -1 +) + for gem in "${GEMS[@]}" do echo "Updating $gem:" @@ -35,6 +42,16 @@ do CHANGELOG=$(echo $CHANGELOG | sed "s/$OLD_VERSION/$NEW_VERSION/") fi + # Include reference to BZ created by the-new-hotness. + if [[ -n $RAILS_RHBZ ]]; then + CHANGELOG+=$'\n' + if [[ $gem = "rails" ]]; then + CHANGELOG+=" Resolves: rhzb#$RAILS_RHBZ" + else + CHANGELOG+=" Related: rhzb#$RAILS_RHBZ" + fi + fi + rpmdev-bumpspec -n "$NEW_VERSION" -c "$CHANGELOG" rubygem-$gem.spec sed -i -e "/git archive/ s/$OLD_VERSION/$NEW_VERSION/g" rubygem-$gem.spec From 9732ad4104f51b3d82bb39f54800cc3bac09817c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 7 Oct 2025 14:03:18 +0200 Subject: [PATCH 15/16] Fix typo `bootsrapped` => `bootstrapped` --- railsbuild-build | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/railsbuild-build b/railsbuild-build index 237c6b9..bbaa0aa 100755 --- a/railsbuild-build +++ b/railsbuild-build @@ -78,16 +78,16 @@ do popd done -# Update bootsrapped gems +# Update bootstrapped gems $(dirname $(readlink -f "$0"))/railsbuild-update-bootstrapped $FEDORA_BRANCH $VERSION -# Build bootsrapped gems again +# Build bootstrapped gems again for gem in "${BOOTSTRAPPED_GEMS[@]}" do pushd ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem # Skip already done builds if [ ! -f .bootstrapped ]; then - echo "$gem: final build for bootsrapped $gem already done" + echo "$gem: final build for bootstrapped $gem already done" continue fi rm .scratch-built @@ -120,7 +120,7 @@ do echo "$gem: build of rubygem-$gem succeeded" echo "$gem: waiting until the build becomes available..." koji wait-repo $FEDORA_TAG --build=$PACKAGE_NVR - rm .bootsrapped + rm .bootstrapped else echo "= FAIL ======" echo "$gem: build of rubygem-$gem failed" From 5a3902ec257984d24891e4608116333c8e28d4dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Thu, 9 Oct 2025 15:58:02 +0200 Subject: [PATCH 16/16] Use side-tag with `bootstrap` macro Side-tags are currently encouraged for multi package updates. This helps to reduce breakage in Rawhide due to broken dependencies. It also allows to set [1] `bootstrap` macro [2] for buildroot and therefore no additional commits are needed for bootstrapping. [1]: https://docs.fedoraproject.org/en-US/package-maintainers/Package_Update_Guide/#_using_macros_in_a_side_tag [2]: https://docs.fedoraproject.org/en-US/packaging-guidelines/#bootstrapping --- README.md | 8 ---- railsbuild-build | 85 +++++++++++++++++++++------------- railsbuild-update-bootstrapped | 44 ------------------ railsbuild-update-pkgs | 4 +- 4 files changed, 54 insertions(+), 87 deletions(-) delete mode 100755 railsbuild-update-bootstrapped diff --git a/README.md b/README.md index 2a30fe9..431ff6f 100644 --- a/README.md +++ b/README.md @@ -52,14 +52,6 @@ Get the information about sources (test suites, js, ...) for Rails gems from their spec files, prepare the `git archive` tarballs to Fedora git repositories at ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem -### railsbuild-update-bootstrapped - -``` -./railsbuild-update-bootstrapped FEDORA_BRANCH OLD_RAILS_VERSION NEW_RAILS_VERSION -``` -Prepare the update of previously bootstrapped Rails gems at once in Fedora git -repositories at: ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem. - ### railsbuild-build ``` diff --git a/railsbuild-build b/railsbuild-build index bbaa0aa..52ec9e3 100755 --- a/railsbuild-build +++ b/railsbuild-build @@ -13,16 +13,10 @@ FEDORA_BRANCH=$1 VERSION=$2 +# Check changelog in spec file for same EVR for gem in "${GEMS[@]}" do pushd ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem - # Skip already done builds - if [ -f .built ]; then - echo "$gem: build for $gem already done" - continue - fi - - # Check changelog in spec file for same EVR if [ -n "$( sed -n '/^%changelog/,$p' rubygem-$gem.spec \ | grep -E " ([0-9]+:)?[0-9]+\.[0-9]+\.[0-9]+-[0-9]+$" \ @@ -33,15 +27,48 @@ do echo "$gem: same EVR in changelog already exists" exit 1 fi + popd +done + + +# Create side tag +if [[ -f ~/.railsbuild/$FEDORA_BRANCH/.side-tag ]]; then + echo -n "Reusing side tag: " +else + echo -n "Requesting new side tag: " + # Run this under the dist-gi repo to let fedpkg to figure the right base + # tag. + fedpkg --release $FEDORA_BRANCH request-side-tag \ + | sed -nr "/Side tag/ s/.*'(f[[:digit:]]+-build-side-[[:digit:]]+)'.*/\1/ p" > ~/.railsbuild/$FEDORA_BRANCH/.side-tag +fi +SIDE_TAG=`cat ~/.railsbuild/$FEDORA_BRANCH/.side-tag` +echo $SIDE_TAG + + +koji edit-sidetag --rpm-macro _with_bootstrap=1 $SIDE_TAG + + +# Build all gems in first round +for gem in "${GEMS[@]}" +do + pushd ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem + # Skip already done builds + if [ -f .built ]; then + echo "$gem: build for $gem already done" + popd + continue + fi + rm .scratch-built rm *.src.rpm - fedpkg scratch-build --srpm + fedpkg scratch-build --target=$SIDE_TAG --srpm if [ "$?" = "0" ]; then touch .scratch-built - git stash echo "= SUCCESS ======" echo "$gem: scratch build of rubygem-$gem succeeded" + + git stash fedpkg import rubygem-$gem-*.src.rpm > /dev/null if [ ! "$?" = "0" ]; then @@ -50,19 +77,21 @@ do exit 1 fi - git commit -am "Update to $gem $VERSION" + fedpkg clog + sed -i 's/^\s*//' clog + + git commit -F clog git push - PACKAGE_NVR=$(fedpkg verrel) - FEDORA_TAG=$(echo $PACKAGE_NVR | sed -r -n 's/.*\.fc([[:digit:]]{2})$/f\1-build/ p') + PACKAGE_NVR=$(fedpkg verrel)$(test -f .bootstrapped && cat .bootstrapped) - fedpkg build + fedpkg build --target=$SIDE_TAG if [ "$?" = "0" ]; then echo "= SUCCESS ======" echo "$gem: build of rubygem-$gem succeeded" echo "$gem: waiting until the build becomes available..." - koji wait-repo $FEDORA_TAG --build=$PACKAGE_NVR + koji wait-repo $SIDE_TAG --request --build=$PACKAGE_NVR touch .built else echo "= FAIL ======" @@ -78,8 +107,9 @@ do popd done -# Update bootstrapped gems -$(dirname $(readlink -f "$0"))/railsbuild-update-bootstrapped $FEDORA_BRANCH $VERSION + +koji edit-sidetag --remove-rpm-macro _with_bootstrap $SIDE_TAG + # Build bootstrapped gems again for gem in "${BOOTSTRAPPED_GEMS[@]}" @@ -88,39 +118,28 @@ do # Skip already done builds if [ ! -f .bootstrapped ]; then echo "$gem: final build for bootstrapped $gem already done" + popd continue fi + rm .scratch-built rm *.src.rpm - fedpkg scratch-build --srpm + fedpkg scratch-build --target=$SIDE_TAG --srpm if [ "$?" = "0" ]; then touch .scratch-built - git stash echo "= SUCCESS ======" echo "$gem: scratch build of rubygem-$gem succeeded" - fedpkg import rubygem-$gem-*.src.rpm > /dev/null - - if [ ! "$?" = "0" ]; then - echo "= FAIL ======" - echo "$gem: fedpkg import failed" - exit 1 - fi - - git commit -am "Enable tests" - git push PACKAGE_NVR=$(fedpkg verrel) - FEDORA_TAG=$(echo $PACKAGE_NVR | sed -r -n 's/.*\.fc([[:digit:]]{2})$/f\1-build/ p') - fedpkg build + fedpkg build --target=$SIDE_TAG if [ "$?" = "0" ]; then echo "= SUCCESS ======" echo "$gem: build of rubygem-$gem succeeded" echo "$gem: waiting until the build becomes available..." - koji wait-repo $FEDORA_TAG --build=$PACKAGE_NVR - rm .bootstrapped + koji wait-repo $SIDE_TAG --request --build=$PACKAGE_NVR else echo "= FAIL ======" echo "$gem: build of rubygem-$gem failed" @@ -140,5 +159,7 @@ echo echo "= SUCCESSFULLY DONE =====" echo "Build of Ruby on Rails $VERSION for Fedora release $FEDORA_BRANCH done." echo +echo "Please submit for $SIDE_TAG via Bodhi." +echo echo "Run the following to delete the build metadata:" echo " rm ~/.railsbuild/$FEDORA_BRANCH/rubygem-*/.*built" diff --git a/railsbuild-update-bootstrapped b/railsbuild-update-bootstrapped deleted file mode 100755 index 2eff02d..0000000 --- a/railsbuild-update-bootstrapped +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# Prepare the update of previously bootstrapped Rails gems at once in Fedora git -# repositories at: -# ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem -# -# Usage: -# ./railsbuild-update-boostrapped FEDORA_BRANCH NEW_VERSION - -. $(dirname $(readlink -f "$0"))/railsbuild-common - -FEDORA_BRANCH=$1 -NEW_VERSION=$2 - -for gem in "${BOOTSTRAPPED_GEMS[@]}" -do - echo "Building previously bootstrapped $gem:" - pushd ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/ - - EPOCH=`cat ./rubygem-$gem.spec | grep -E "Epoch:(.*)" | sed 's/Epoch: //'` - if [ "$EPOCH" ]; then - epoch_prefix="$EPOCH:" - else - epoch_prefix="" - fi - - # Disable bootstrapping - sed -i -e "s/%global bootstrap 1/%global bootstrap 0/" rubygem-$gem.spec - sed -i -e "s/Release:.*/Release: 2%{?dist}/g" rubygem-$gem.spec - - # Set to default locale for the changelog date format - export LC_ALL=C - - CHANGELOG='* ' - CHANGELOG+=`date +'%a %b %d %Y'` - CHANGELOG+=" " - CHANGELOG+=`rpmdev-packager` - CHANGELOG+=" - $epoch_prefix$NEW_VERSION-2\n" - CHANGELOG+="- Enable tests" - - sed -i -e "s/%changelog/%changelog\n$CHANGELOG\n/g" rubygem-$gem.spec - - echo "$gem: rubygem-$gem.spec updated" - popd -done diff --git a/railsbuild-update-pkgs b/railsbuild-update-pkgs index d601e4f..f0a5b89 100755 --- a/railsbuild-update-pkgs +++ b/railsbuild-update-pkgs @@ -65,8 +65,6 @@ done for gem in "${BOOTSTRAPPED_GEMS[@]}" do pushd ~/.railsbuild/$FEDORA_BRANCH/rubygem-$gem/ - # Enable bootstrapping if necessary - sed -i -e "s/%global bootstrap 0/%global bootstrap 1/" rubygem-$gem.spec - touch .bootstrapped + echo "~bootstrap" > .bootstrapped popd done