bromite-buildtools/export-single-patch.sh

54 lines
1.5 KiB
Bash
Raw Normal View History

2020-11-26 13:23:00 +05:30
#!/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]*$//')
2021-04-28 16:32:53 +05:30
if [ -z "$output" ]
2020-11-26 13:23:00 +05:30
then
2021-04-28 16:32:53 +05:30
PATCH_FILE=$(git -C ~/chromium/src/ show -s $patch | tail -n 1 | xargs)
2020-11-26 13:23:00 +05:30
echo Exporting $patch ~/bromite/build/patches-new/$PATCH_FILE
else
PATCH_FILE=$output
echo Exporting new $patch ~/bromite/build/patches-new/$PATCH_FILE
fi
git -C ~/chromium/src/ format-patch -1 --keep-subject --stdout --full-index --zero-commit --no-signature $patch >~/bromite/build/patches-new/$PATCH_FILE
2021-04-28 16:32:53 +05:30
echo " exported"
2020-11-26 13:23:00 +05:30
2022-09-07 14:41:24 +05:30
CHANGE_REF=""
2020-11-26 13:23:00 +05:30
while read line; do
2022-09-07 14:41:24 +05:30
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
2020-11-26 13:23:00 +05:30
fi
2022-09-07 14:41:24 +05:30
done
2020-11-26 13:23:00 +05:30
done <~/bromite/build/patches-new/$PATCH_FILE
2022-09-07 14:41:24 +05:30
if [ "$CHANGE_REF" ]
then
sed -i "$CHANGE_REF" ~/bromite/build/patches-new/$PATCH_FILE
fi
2020-11-26 13:23:00 +05:30
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
2022-02-22 20:11:54 +05:30
echo "--" >> ~/bromite/build/patches-new/$PATCH_FILE
2022-02-14 13:14:14 +05:30
echo "2.25.1" >> ~/bromite/build/patches-new/$PATCH_FILE
2022-02-22 20:12:20 +05:30
#echo "" >> ~/bromite/build/patches-new/$PATCH_FILE
2021-04-28 16:32:53 +05:30
echo " done."
2021-11-09 18:06:06 +05:30
echo ""