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>
83 lines
3.1 KiB
Bash
Executable File
83 lines
3.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ "x$1" != "x" ] && ! [ -d "$1" ]; then
|
|
echo "Usage: $0 [git_reference_dir_to_speed_up]"
|
|
exit 1
|
|
fi
|
|
|
|
# Variables to set up for a new GTS update.
|
|
# The latest GTS supported on this branch.
|
|
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
|
|
# the test may fail with the system gcc, since we do not backport ABI changes.
|
|
# This is expected, in which case we adjust back the expected output for the
|
|
# test to match the system libstdc++ ABI in a subsequent, hand-written patch to
|
|
# the tests.
|
|
tests="
|
|
filesystem-ts.cc
|
|
compat.cc
|
|
cxx11.cc
|
|
cxx17.cc
|
|
libfundts.cc
|
|
"
|
|
|
|
system_major=`sed -n 's/^%global gcc_major //p' gcc.spec`
|
|
systemrev=`sed -n 's/^%global gitrev //p' gcc.spec`
|
|
|
|
if [ $gts_major -eq $system_major ]; then echo "GTS same version as system, nothing to do."; exit 1; fi
|
|
if ! [ -f gcc.spec ]; then echo Must be run in the directory with gcc.spec file.; exit 1; fi
|
|
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/$branch/gcc-toolset-$gts_major-gcc.spec?ref_type=heads | sed -n 's/^%global gitrev //p'`
|
|
|
|
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() {
|
|
rm -rf $cwd/gcc-dir.tmp
|
|
}
|
|
|
|
trap cleanup EXIT
|
|
|
|
# Get vendor branch contents from upstream. git-fetch doesn't have the
|
|
# --reference feature, so do a full clone referencing a local upstream repo if
|
|
# present. Otherwise fetch only those specific refs.
|
|
url=https://gcc.gnu.org/git/gcc.git
|
|
echo -n "Getting sources from $url"
|
|
if [ "$#" -eq 1 ]; then
|
|
echo " (using $1 as cache)"
|
|
git clone -q --dissociate --reference $1 $url gcc-dir.tmp
|
|
pushd gcc-dir.tmp
|
|
else
|
|
echo
|
|
mkdir gcc-dir.tmp
|
|
pushd gcc-dir.tmp
|
|
git init -q
|
|
git remote add origin $url
|
|
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 $baserev $gtsrev
|
|
# We limit the update to just the printer, retain the system gcc hook and
|
|
# make-foo.
|
|
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 $baserev..$gtsrev -- $testfiles > ../$tests_patchfile
|
|
echo "Updated $tests_patchfile"
|
|
|
|
popd
|