76 lines
2.6 KiB
Bash
Executable File
76 lines
2.6 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=15
|
|
# 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/$(git branch --show-current)/gcc-toolset-15-gcc.spec?ref_type=heads | sed -n 's/^%global gitrev //p'`
|
|
|
|
echo "system at $systemrev and GTS at $gtsrev on the vendor branch"
|
|
|
|
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 $systemrev $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
|
|
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 "Updated $tests_patchfile"
|
|
|
|
popd
|