bromite-buildtools/export-single-patch.sh

41 lines
1.4 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
while read line; do
#echo $line
if [[ "$line" == index* ]]; then
next_line=$(grep -A1 "${line}" ~/bromite/build/patches-new/$PATCH_FILE | tail -n 1 )
if [[ "$next_line" != "GIT binary patch" ]]; then
sed -i "/^$line/d" ~/bromite/build/patches-new/$PATCH_FILE
fi
fi
done <~/bromite/build/patches-new/$PATCH_FILE
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
2021-11-09 18:06:06 +05:30
echo "2.20.1" >> ~/bromite/build/patches-new/$PATCH_FILE
2020-11-26 13:23:00 +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 ""