add apply patch script

This commit is contained in:
Ziyang Zhou
2023-10-05 22:20:33 +08:00
parent 398d8ddde5
commit 9c881a3f1a

34
apply-patch.sh Executable file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/env bash
usage() {
script=`basename $0`
echo "USAGE: $script AOSP-SRC [TAG]"
exit 1
}
[[ "$#" -lt 1 ]] && usage
src=$1
tag=$2
if [ -z "$tag" ]; then
echo "detect AOSP tag from manifest"
tag=`grep revision $src/.repo/manifests/default.xml | cut -d\" -f 2 | cut -d/ -f 3`
fi
echo "===== AOSP SRC: $src"
echo "===== AOSP TAG: $tag"
patch_dir=$(dirname $(realpath $0))/$tag
if [ ! -d $patch_dir ];then
echo "patches for $tag not exist"
exit 1
fi
cd $patch_dir
for p in `find * -links 2`
do
echo
echo "process project: $p"
git -C $src/$p am --reject $patch_dir/$p/* || echo "*****[ERROR]***** apply failed: $p"
done