-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathapply-all-patch.sh
85 lines (57 loc) · 2.32 KB
/
apply-all-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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
git am --abort
PATCH_OLD_PATH=~/bromite/build/patches
PATCH_NEW_PATH=~/bromite/build/patches-new
DESTINATION=~/bromite/build/bromite_patches_list_ok.txt
DESTINATION_FAILED=~/bromite/build/bromite_patches_list_failed.txt
rm $DESTINATION
rm $DESTINATION_FAILED
mkdir $PATCH_NEW_PATH
IFS=$'\n'
PATCH_LIST=~/bromite/build/bromite_patches_list_new.txt
if [ ! -f $PATCH_LIST ]; then
cp ~/bromite/build/bromite_patches_list.txt $PATCH_LIST
fi
echo "Phase 1: check clean"
for current_file in $(cat $PATCH_LIST); do
if [[ $current_file =~ ^#.* ]]; then
echo "Executing $current_file"
eval "${current_file:1}"
echo $current_file >>$DESTINATION
elif [[ $current_file =~ ^-.* ]]; then
echo "Skipping $current_file"
elif [[ $current_file =~ ^=.* ]]; then
echo "Adding $current_file"
echo "Executing bash ~/create-from-patch.sh $PATCH_OLD_PATH/${current_file:1} $PATCH_NEW_PATH"
bash ~/bromite-buildtools/create-from-patch.sh $PATCH_OLD_PATH/${current_file:1} $PATCH_NEW_PATH
#echo "Press return"
#read -n 1
elif [[ $current_file =~ ^1.* ]]; then
echo "Using new path $current_file"
bash ~/bromite-buildtools/apply-single-patch.sh $PATCH_NEW_PATH/${current_file:1} $PATCH_NEW_PATH
echo ""
LAST_COMMIT=$(git rev-parse HEAD)
echo "Last Commit " $LAST_COMMIT
bash ~/bromite-buildtools/export-single-patch.sh $LAST_COMMIT
else
if [ -n "$SKIPAUTOGENERATED" ]; then
if [[ "$current_file" == *"Automated-domain-substitution"* ]]; then
echo ""
echo -e ${RED} " -> Excluding $current_file" ${NC}
continue
fi
fi
bash ~/bromite-buildtools/apply-single-patch.sh $PATCH_OLD_PATH/$current_file $PATCH_NEW_PATH || exit 1
if [ -z "$SILENT" ]; then
echo $current_file >>$DESTINATION
echo $PATCH_FILE
echo ""
LAST_COMMIT=$(git rev-parse HEAD)
echo "Last Commit " $LAST_COMMIT
bash ~/bromite-buildtools/export-single-patch.sh $LAST_COMMIT || exit 1
#cp -r ~/bromite/build/patches-new/* ~/br2/bromite/build/patches/
#git -C ~/br2/bromite/ add .
#git -C ~/br2/bromite/ commit -m "$current_file"
fi
fi
done