-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathexport-single-patch.sh
60 lines (52 loc) · 1.64 KB
/
export-single-patch.sh
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
patch=$1
output=$2
PATCH_FILE=$(git -C ~/chromium/src/ show -s $patch | grep FILE: | sed 's/FILE://g' | sed 's/^[ \t]*//;s/[ \t]*$//')
if [ -z "$output" ]
then
PATCH_FILE=$(git -C ~/chromium/src/ show -s $patch | tail -n 1 | xargs)
echo Exporting $patch ~/bromite/build/patches-new/$PATCH_FILE
else
PATCH_FILE=$output
echo Exporting new $patch ~/bromite/build/patches-new/$PATCH_FILE
fi
PATCH_MESSAGE=$(git -C ~/chromium/src/ show -s $patch)
if [[ $PATCH_MESSAGE == *NOEXPORT:* ]] ;
then
echo Request NO export
exit 0
fi
git -C ~/chromium/src/ format-patch -1 --keep-subject --stdout --full-index --zero-commit --no-signature $patch >~/bromite/build/patches-new/$PATCH_FILE
echo " exported"
CHANGE_REF=""
while read line; do
for i in {1..5}
do
if [[ "$line" == index* ]]; then
read next_line
if [[ "$next_line" != "GIT binary patch" ]]; then
CHANGE_REF=${CHANGE_REF}"/^${line}/d;"
break
else
line=$next_line
continue
fi
else
break
fi
done
done <~/bromite/build/patches-new/$PATCH_FILE
if [ "$CHANGE_REF" ]
then
sed -i "$CHANGE_REF" ~/bromite/build/patches-new/$PATCH_FILE
fi
sed -i '/^From 0000000000000000000000000000000000000000/d' ~/bromite/build/patches-new/$PATCH_FILE
sed -i '/^FILE:/d' ~/bromite/build/patches-new/$PATCH_FILE
sed -i '/^ mode change/d' ~/bromite/build/patches-new/$PATCH_FILE
sed -i '/^old mode /d' ~/bromite/build/patches-new/$PATCH_FILE
sed -i '/^new mode /d' ~/bromite/build/patches-new/$PATCH_FILE
echo "--" >> ~/bromite/build/patches-new/$PATCH_FILE
echo "2.25.1" >> ~/bromite/build/patches-new/$PATCH_FILE
#echo "" >> ~/bromite/build/patches-new/$PATCH_FILE
echo " done."
echo ""