bromite-buildtools/export-single-patch.sh

36 lines
1.3 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]*$//')
if [ -z "$output" ]
then
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
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
echo "2.17.1" >> ~/bromite/build/patches-new/$PATCH_FILE
echo "" >> ~/bromite/build/patches-new/$PATCH_FILE