first initial commit

This commit is contained in:
Carmelo Messina 2020-11-26 08:53:00 +01:00
commit b34479fe9a
5 changed files with 181 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
################################################################################
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
################################################################################
/.vs

40
apply-all-patch.sh Normal file
View File

@ -0,0 +1,40 @@
#!/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'
#cp ~/bromite/build/bromite_patches_list.txt ~/bromite/build/bromite_patches_list_new.txt
echo "Phase 1: check clean"
for current_file in $(cat ~/bromite/build/bromite_patches_list_new.txt); do
if [[ $current_file =~ ^#.* ]]; then
echo "Executing $current_file"
eval "${current_file:1}"
echo $current_file >>$DESTINATION
else
bash /home/cab/apply-single-patch.sh $PATCH_OLD_PATH/$current_file $PATCH_NEW_PATH
echo $PATCH_FILE
echo ""
LAST_COMMIT=$(git rev-parse HEAD)
echo "Last Commit " $LAST_COMMIT
bash /home/cab/export-single-patch.sh $LAST_COMMIT
fi
done

75
apply-single-patch.sh Normal file
View File

@ -0,0 +1,75 @@
#!/bin/bash
PATCH=$1
if [ -z "$2" ]
then
PATCH_NEW_PATH="/home/cab/bromite/build/patches-new"
else
PATCH_NEW_PATH=$2
fi
dos2unix $PATCH
echo ""
echo "Applying patch $PATCH"
git apply --reject --whitespace=fix $PATCH
for file in $(find . -name *.rej); do
echo " -> Check $file";
wiggle --replace ${file::-4} $file && rm $file && rm ${file::-4}.porig && echo " OK";
done
OK=1
for file in $(find . -name *.rej); do
echo "---Found: $file";
OK=0
done
if [[ OK -eq 0 ]]; then
echo "Patch not apply cleanly. Please fix..."
echo "Press return"
read -n 1
else
echo "Patch apply cleanly."
fi
echo " Deleting rej"
find . -type f -name '*.rej' -delete
find . -type f -name '*.porig' -delete
#echo "Read to add. Press return"
#read -n 1
echo " Creating new patch"
git add .
HEAD=$(sed -n '1,/---/ p' $PATCH | sed '/^---/d')
CONTENT=$(git -C ~/chromium/src/ diff --cached --binary)
PATCH_FILE=$PATCH_NEW_PATH/$(basename $PATCH)
rm $PATCH_FILE
echo "$HEAD" >$PATCH_FILE
NEWLINE=$(tail -n 1 "$PATCH_FILE")
echo $NEWLINE
if [[ "$NEWLINE" == Subject:* ]]; then
echo "" >>$PATCH_FILE
else
NEWLINE=$(tail -n 2 "$PATCH_FILE" | head -n 1)
if [[ "$NEWLINE" == Subject:* ]]; then
echo "" >>$PATCH_FILE
fi
fi
echo "FILE:$(basename $PATCH)" >>$PATCH_FILE
echo "---" >>$PATCH_FILE
echo "$CONTENT" >>$PATCH_FILE
git reset --hard
git clean -f -d
echo " Applying new patch"
git am $PATCH_FILE

26
export-all-patch.sh Normal file
View File

@ -0,0 +1,26 @@
#!/bin/bash
VERSION=$(cat ~/bromite/build/RELEASE)
CURRENT_RELEASE=$(git -C ~/chromium/src/ rev-parse --verify refs/tags/$VERSION)
ALLPATCHS=$(git -C ~/chromium/src/ rev-list HEAD...$CURRENT_RELEASE)
mkdir ~/bromite/build/patches-new
NO_NAME=1
for patch in $ALLPATCHS; do
PATCH_FILE=$(git -C ~/chromium/src/ show -s $patch | grep FILE: | sed 's/FILE://g' | sed 's/^[ \t]*//;s/[ \t]*$//')
if [ -z "$PATCH_FILE" ]
then
PATCH_FILE=$NO_NAME.patch
NO_NAME=$NO_NAME.1
echo No Name ${NO_NAME}, press return
read -n 1
fi
bash ~/export-single-patch.sh $patch $PATCH_FILE
done

35
export-single-patch.sh Normal file
View File

@ -0,0 +1,35 @@
#!/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