SHA256
8
0
forked from pool/gdb
Files
gdb/import-patches.sh
Tom de Vries 93394c973e - Maintenance script qa.sh:
* Add gdb.base/errno.exp FAILs for PR29244 (SLE-12).
  * Add PR31308 kfail.
- Maintenance script import-patches.sh:
  * Handle filename clash with existing file.
- Patches added:  
  * gdb-record-fix-out-of-bounds-write-in-aarch64_record.patch
  * gdb-block-sigterm-during-fetch_inferior_event.patch
  * gdb-testsuite-fix-another-timeout-in-gdb.base-bg-exe.1.patch
  * gdb-testsuite-fix-regexp-in-gdb.multi-pending-bp-del.patch
  * gdb-testsuite-fix-timeout-in-gdb.threads-main-thread.patch
  * gdb-testsuite-fix-gdb.threads-clone-attach-detach.ex.patch

OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=456
2025-04-17 11:02:26 +00:00

106 lines
1.5 KiB
Bash

#!/bin/sh
# Invoke as:
# $ ./import-patches.sh [ --dry-run ] <n> <dir>/00*.patch
usage ()
{
echo "./import-patches.sh [ --dry-run ] <n> <files>+"
}
dryrun=false
case "$1" in
-dryrun|-dry-run|--dryrun|--dry-run)
dryrun=true
shift
;;
esac
n="$1"
shift
case $n in
"")
echo "Missing <n> argument"
usage
exit 1
;;
[0-9][0-9]*)
;;
*)
echo "Need numeric <n> argument"
usage
exit 1
;;
esac
if [ "$n" = "" ]; then
echo "Missing <n> argument"
usage
exit 1
fi
files="$*"
rm -Rf tmp.patches
mkdir tmp.patches
tmp=
for f in $files; do
dir=$(dirname "$f")
f=$(basename "$f")
orig_f="$f"
# Remove numeric prefix.
f=$(echo "$f" \
| sed 's/^[0-9]*-//')
# To lowercase.
f=$(echo "$f" \
| tr '[:upper:]' '[:lower:]')
# Fix patch.patch.
f=$(echo "$f" \
| sed 's/\.patch\.patch/.patch/')
if [ -f "$f" ]; then
f=$(echo "$f" \
| sed 's/\.patch$/.1.patch/')
fi
# Copy.
cp "$dir"/"$orig_f" tmp.patches/"$f"
# Filter out ChangeLog entries.
filterdiff -x "*/ChangeLog" tmp.patches/"$f" > tmp.patches/tmp."$f"
mv tmp.patches/tmp."$f" tmp.patches/"$f"
tmp="$tmp $f"
done
files="$tmp"
i=$n
for f in $files; do
printf "Patch%-11s%s\n" "$i:" "$f"
i=$((i + 1))
done
i=$n
for f in $files; do
echo "%patch$i -p1"
i=$((i + 1))
done
if $dryrun; then
exit
fi
for f in $files; do
mv tmp.patches/"$f" .
osc add "$f"
done
rmdir tmp.patches