2 # Create a patch which backports the support/ subdirectory.
3 # Copyright (C) 2017-2023 Free Software Foundation, Inc.
4 # This file is part of the GNU C Library.
6 # The GNU C Library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
11 # The GNU C Library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with the GNU C Library; if not, see
18 # <https://www.gnu.org/licenses/>.
20 # This script does not backport the Makefile tweaks outside the
21 # support/ directory (which need to be backported separately), or the
22 # changes to test-skeleton.c (which should not be backported).
27 export GIT_CONFIG
=/dev
/null
28 export GTT_CONFIG_NOSYSTEM
=0
33 usage: $0 {patch|commit}
38 if test $# -ne 1 ; then
52 # The upstream branch to work on.
55 # The commit which added the support/ directory.
56 initial_commit
=c23de0aacbeaa7a091609b35764bed931475a16d
58 # We backport the support directory and this script. Directories need
60 patch_targets
="support/ scripts/backport-support.sh"
62 latest_commit
="$(git log --max-count=1 --pretty=format:%H "$branch" -- \
65 # Simplify the branch name somewhat for reporting.
66 branch_name
="$(echo "$branch" | sed s,^origin/,,)"
70 This patch creates the contents of the support/ directory up to this
71 upstream commit on the $branch_name branch:
74 git log
--max-count=1 "$latest_commit"
76 git
diff "$initial_commit"^..
"$latest_commit" $patch_targets
77 echo "# Before applying the patch, run this command:" >&2
78 echo "# rm -rf $patch_targets" >&2
82 git status
--porcelain |
while read line
; do
83 echo "error: working copy is not clean, cannot commit" >&2
86 for path
in $patch_targets; do
87 echo "# Processing $path" >&2
91 git
rm --cached --ignore-unmatch -r "$path"
93 git read-tree
--prefix="$path" "$latest_commit":"$path"
98 git show
"$latest_commit":"$path" > "$path"
102 git commit
-m "Synchronize support/ infrastructure with $branch_name
104 This commit updates the support/ subdirectory to
105 commit $latest_commit
106 on the $branch_name branch.