File apply-patches of Package gtk3
#!/bin/sh
#
# Given a series.conf file and a directory with patches, applies them to the
# current directory.
# Used by kernel-source.spec.in and kernel-binary.spec.in
USAGE="$0 [--vanilla] <series.conf> <patchdir> [symbol ...]"
set -x
set -e
set -o pipefail
vanilla=false
if test $# -lt 2; then
echo "$USAGE" >&2
exit 1
fi
DIR="${0%/*}"
SERIES_CONF=$1
PATCH_DIR=$2
shift 2
trap 'rm -f "$series"' EXIT
series=$(mktemp)
# support for patches in patches.addon/series
cp "$SERIES_CONF" "$series"
(
echo "trap 'echo \"*** patch \$_ failed ***\"' ERR"
echo "set -ex"
# "$DIR"/guards "$@" <"$series" | \
cat <"$series" |\
sed \
-E -e "s/#.*//g" \
-e '/^$/d' \
-e "s|^|patch -s -F0 -E -p1 --no-backup-if-mismatch -i $PATCH_DIR/|"
) | sh