-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapply.sh
More file actions
33 lines (28 loc) · 713 Bytes
/
apply.sh
File metadata and controls
33 lines (28 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
set -e
patches="$(readlink -f -- $1)"
for project in $(cd $patches/patches; echo *);do
p="$(tr _ / <<<$project |sed -e 's;platform/;;g')"
[ "$p" == build ] && p=build/make
repo sync -l --force-sync $p || continue
pushd $p
git clean -fdx; git reset --hard
for patch in $patches/patches/$project/*.patch;do
#Check if patch is already applied
if patch -f -p1 --dry-run -R < $patch > /dev/null;then
continue
fi
if git apply --check $patch;then
git am $patch
elif patch -f -p1 --dry-run < $patch > /dev/null;then
#This will fail
git am $patch || true
patch -f -p1 < $patch
git add -u
git am --continue
else
echo "Failed applying $patch"
fi
done
popd
done