Update prettyprinter update script for incremental GTS diffs

Bump gts_major to 16.  When a previous GTS prettyprinter update exists
in the spec, diff incrementally from the previous GTS revision instead
of from the system revision.  Also fix hardcoded spec filename in the
GitLab URL to use $gts_major.

Related: RHEL-169098

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Siddhesh Poyarekar 2026-07-09 15:25:40 -04:00
parent 6da2d5544e
commit d5165908bb

View File

@ -7,7 +7,7 @@ fi
# Variables to set up for a new GTS update.
# The latest GTS supported on this branch.
gts_major=15
gts_major=16
# Tests that need to be synced in for this change. These are required to sync
# in adjustments to tests due to changes to pretty printer output.
# Occasionally, a test adjustment may be due to an ABI change, in which case
@ -32,9 +32,16 @@ branch=`git branch --show-current`
if ! [[ $branch =~ ^c[0-9]+s$ ]]; then echo "Must be run on a valid centos stream branch, not '$branch'"; exit 1; fi
gtsrev=`curl -s https://gitlab.com/redhat/centos-stream/rpms/gcc-toolset-$gts_major-gcc/-/raw/$(git branch --show-current)/gcc-toolset-15-gcc.spec?ref_type=heads | sed -n 's/^%global gitrev //p'`
gtsrev=`curl -s https://gitlab.com/redhat/centos-stream/rpms/gcc-toolset-$gts_major-gcc/-/raw/$branch/gcc-toolset-$gts_major-gcc.spec?ref_type=heads | sed -n 's/^%global gitrev //p'`
echo "system at $systemrev and GTS at $gtsrev on the vendor branch"
prev_gts_major=$((gts_major - 1))
if grep -q "^Patch.*prettyprinter-update-$prev_gts_major" gcc.spec; then
baserev=`curl -s https://gitlab.com/redhat/centos-stream/rpms/gcc-toolset-$prev_gts_major-gcc/-/raw/$branch/gcc-toolset-$prev_gts_major-gcc.spec?ref_type=heads | sed -n 's/^%global gitrev //p'`
echo "previous GTS $prev_gts_major at $baserev, GTS $gts_major at $gtsrev on the vendor branch"
else
baserev=$systemrev
echo "system at $systemrev and GTS $gts_major at $gtsrev on the vendor branch"
fi
cwd=$PWD
cleanup() {
@ -62,14 +69,14 @@ fi
pp_patchfile=gcc$system_major-libstdc++-prettyprinter-update-$gts_major.patch
tests_patchfile=gcc$system_major-libstdc++-prettyprinter-update-$gts_major-tests.patch
git fetch -q origin $systemrev $gtsrev
git fetch -q origin $baserev $gtsrev
# We limit the update to just the printer, retain the system gcc hook and
# make-foo.
git diff --stat --patch $systemrev..$gtsrev -- libstdc++-v3/python/libstdcxx > ../$pp_patchfile
git diff --stat --patch $baserev..$gtsrev -- libstdc++-v3/python/libstdcxx > ../$pp_patchfile
echo "Updated $pp_patchfile"
testfiles=$(echo "$tests" | awk '/.+/{printf "libstdc++-v3/testsuite/libstdc++-prettyprinters/%s ", $1}')
git diff --stat --patch $systemrev..$gtsrev -- $testfiles > ../$tests_patchfile
git diff --stat --patch $baserev..$gtsrev -- $testfiles > ../$tests_patchfile
echo "Updated $tests_patchfile"
popd