Update prettyprinter update script for incremental GTS diffs

Fix the hardcoded gcc-toolset-15-gcc.spec filename to use $gts_major,
add logic to compute incremental diffs when a previous GTS prettyprinter
update exists in the spec, record base and target commit hashes in the
generated patch files, and bump gts_major to 16.

Related: RHEL-169099
This commit is contained in:
Siddhesh Poyarekar 2026-07-15 13:34:32 -04:00
parent d91e1b7643
commit c26e3da843

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,20 @@ 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
header="# Generated by update-libstdcxx-prettyprinter.sh
# Base: $baserev
# Target: $gtsrev
"
echo "$header" > ../$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
echo "$header" > ../$tests_patchfile
git diff --stat --patch $baserev..$gtsrev -- $testfiles >> ../$tests_patchfile
echo "Updated $tests_patchfile"
popd