last version used

This commit is contained in:
Carmelo Messina 2021-04-28 13:02:53 +02:00
parent b34479fe9a
commit f94608b50c
7 changed files with 335 additions and 86 deletions

View File

@ -2,8 +2,9 @@
git am --abort git am --abort
PATCH_OLD_PATH=../../bromite/build/patches PATCH_OLD_PATH=~/bromite/build/patches
PATCH_NEW_PATH=../../bromite/build/patches-new PATCH_NEW_PATH=~/bromite/build/patches-new
DESTINATION=~/bromite/build/bromite_patches_list_ok.txt DESTINATION=~/bromite/build/bromite_patches_list_ok.txt
DESTINATION_FAILED=~/bromite/build/bromite_patches_list_failed.txt DESTINATION_FAILED=~/bromite/build/bromite_patches_list_failed.txt
@ -13,28 +14,62 @@ mkdir $PATCH_NEW_PATH
IFS=$'\n' IFS=$'\n'
#cp ~/bromite/build/bromite_patches_list.txt ~/bromite/build/bromite_patches_list_new.txt 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" echo "Phase 1: check clean"
for current_file in $(cat ~/bromite/build/bromite_patches_list_new.txt); do for current_file in $(cat $PATCH_LIST); do
if [[ $current_file =~ ^#.* ]]; then if [[ $current_file =~ ^#.* ]]; then
echo "Executing $current_file" echo "Executing $current_file"
eval "${current_file:1}" eval "${current_file:1}"
echo $current_file >>$DESTINATION echo $current_file >>$DESTINATION
else elif [[ $current_file =~ ^-.* ]]; then
bash /home/cab/apply-single-patch.sh $PATCH_OLD_PATH/$current_file $PATCH_NEW_PATH echo "Skipping $current_file"
echo $PATCH_FILE elif [[ $current_file =~ ^=.* ]]; then
echo "" echo "Adding $current_file"
LAST_COMMIT=$(git rev-parse HEAD) echo "Executing bash ~/create-from-patch.sh $PATCH_OLD_PATH/${current_file:1} $PATCH_NEW_PATH"
echo "Last Commit " $LAST_COMMIT
bash /home/cab/export-single-patch.sh $LAST_COMMIT
fi bash ~/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 ~/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 ~/buildtools/export-single-patch.sh $LAST_COMMIT
else
bash ~/buildtools/apply-single-patch.sh $PATCH_OLD_PATH/$current_file $PATCH_NEW_PATH
echo $current_file >>$DESTINATION
echo $PATCH_FILE
echo ""
LAST_COMMIT=$(git rev-parse HEAD)
echo "Last Commit " $LAST_COMMIT
bash ~/buildtools/export-single-patch.sh $LAST_COMMIT
#cp -r ~/bromite/build/patches-new/* ~/br2/bromite/build/patches/
#git -C ~/br2/bromite/ add .
#git -C ~/br2/bromite/ commit -m "$current_file"
fi
done done

67
apply-failed-patch.sh Normal file
View File

@ -0,0 +1,67 @@
#!/bin/bash
git am --abort
PATCH_OLD_PATH=../../bromite/build/patches
PATCH_NEW_PATH=../../bromite/build/patches-new
DESTINATION_FAILED=~/bromite/build/bromite_patches_list_failed.txt
mkdir $PATCH_NEW_PATH
IFS=$'\n'
for file in $(cat $DESTINATION_FAILED | sed -e 's/\r//g'); do
if [[ $file =~ ^#.* ]]; then
echo "Executing $file"
eval "${file:1}"
else
PATCH=$PATCH_OLD_PATH/$file
echo "Applying patch $PATCH"
git apply --reject "$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
for file in $(find . -name *.rej); do
echo "---Found: $file";
done
read -p "--- ERROR: Press enter to continue"
find . -type f -name '*.rej' -delete
find . -type f -name '*.porig' -delete
git add .
HEAD=$(sed -n '1,/---/ p' $PATCH | sed '/^---/d')
CONTENT=$(git -C ~/chromium/src/ diff --cached)
PATCH_FILE=$PATCH_NEW_PATH/$(basename $PATCH)
rm $PATCH_FILE
echo "$HEAD" >$PATCH_FILE
echo "" >>$PATCH_FILE
echo "FILE:$(basename $PATCH)" >>$PATCH_FILE
echo "---" >>$PATCH_FILE
echo "$CONTENT" >>$PATCH_FILE
sed -i '/^index/d' $PATCH_FILE
sed -i '/^ mode change/d' $PATCH_FILE
sed -i '/^old mode /d' $PATCH_FILE
sed -i '/^new mode /d' $PATCH_FILE
sed -i '/^create mode /d' $PATCH_FILE
git reset --hard
git am $PATCH_FILE
fi
#read -p "Press enter to continue"
done

View File

@ -1,75 +1,68 @@
#!/bin/bash #!/bin/bash
PATCH=$1 PATCH=$1
LOG_FILE=~/build.log
if [ -z "$2" ]
then
PATCH_NEW_PATH="/home/cab/bromite/build/patches-new"
else
PATCH_NEW_PATH=$2
fi
dos2unix $PATCH dos2unix $PATCH
echo "" OK=0
echo "Applying patch $PATCH" DOBUILD=1
git apply --reject --whitespace=fix $PATCH DOEXPORT=1
for file in $(find . -name *.rej); do echo "" | tee -a ${LOG_FILE}
echo " -> Check $file"; echo "Applying patch $PATCH" | tee -a ${LOG_FILE}
wiggle --replace ${file::-4} $file && rm $file && rm ${file::-4}.porig && echo " OK"; git apply --reject --whitespace=fix $PATCH && OK=1
done
OK=1
for file in $(find . -name *.rej); do
echo "---Found: $file";
OK=0
done
if [[ OK -eq 0 ]]; then if [[ OK -eq 0 ]]; then
echo "Patch not apply cleanly. Please fix..." for file in $(find . -name *.rej); do
echo "Press return" echo " -> Check $file" | tee -a ${LOG_FILE};
wiggle --no-ignore --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" | tee -a ${LOG_FILE};
git add ${file::-4}
OK=0
done
if [[ OK -eq 0 ]]; then
DOBUILD=1
echo "Current patch $PATCH" | tee -a ${LOG_FILE}
echo "Patch not apply cleanly. Please fix... (next phase: build)" | tee -a ${LOG_FILE}
echo "Press return"
read -n 1
else
echo "Patch not apply cleanly. Wiggle done!" | tee -a ${LOG_FILE}
fi
echo " Deleting rej"
find . -type f -name '*.rej' -delete
find . -type f -name '*.porig' -delete
else
echo "Patch apply cleanly." | tee -a ${LOG_FILE}
DOBUILD=0
fi
if [[ DOBUILD -eq 1 ]]; then
OK=0
echo "Building ${PATCH}: chrome_public_apk" | tee -a ${LOG_FILE}
date "+%Y%m%d %H.%M.%S" | tee -a ${LOG_FILE}
autoninja -C out/arm64 chrome_public_apk && OK=1
date "+%Y%m%d %H.%M.%S" | tee -a ${LOG_FILE}
DOEXPORT=1
fi
if [[ OK -eq 0 ]]; then
echo "Read to add $PATCH. Press return"
read -n 1 read -n 1
else DOEXPORT=1
echo "Patch apply cleanly."
fi fi
echo " Deleting rej" if [[ DOEXPORT -eq 1 ]]; then
find . -type f -name '*.rej' -delete bash ~/buildtools/create-from-patch.sh $PATCH $2
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 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

95
build-from-repos.sh Normal file
View File

@ -0,0 +1,95 @@
#!/bin/bash
# this script assumes that in
# ~/bromite ---> there is the bromite repo
# ~/chromium ---> there is the chromium repo
RED='\033[0;31m'
NC='\033[0m' # No Color
cd ~
echo -e ${RED} -------- download bromite repo ${NC}
mkdir ~/bromite
cd ~/bromite
git fetch
git pull
VERSION=$( cat ~/bromite/build/RELEASE )
echo -e ${RED} -------- lastest version is: $VERSION ${NC}
echo -e ${RED} -------- download chromium repo ${NC}
mkdir ~/chromium
cd ~/chromium
#fetch --nohooks --no-history android
gclient config https://chromium.googlesource.com/chromium/src.git
echo "target_os=['android']" >>.gclient
cd src
# cleanup repo!
#git reset
#git reset --hard HEAD
#git clean -fdx
git fetch --depth 2 https://chromium.googlesource.com/chromium/src.git +refs/tags/$VERSION:chromium_$VERSION
#git tag
#git checkout .
#git clean -fdx
#git am --abort && git reset 95a0064cd30fa82247881080e7f70d9904c79864^ && git reset --hard && git clean -f -d
git checkout $VERSION
echo -e ${RED} -------- git current status ${NC}
git status
git log
echo -e ${RED} -------- sync other chromium repos ${NC}
gclient sync -D --no-history
# remove origin for chromium
git remote remove origin
echo -e ${RED} ------- apply patchs ${NC}
for file in $(cat ~/bromite/build/bromite_patches_list.txt) ; do
echo -e ${RED} " -> Apply $file" ${NC}
REPL="0,/^---/s//FILE:"$file"\n---/"
cat ~/bromite/build/patches/$file | sed $REPL | git am
if [ $? -ne 0 ]
then
echo -e "Error on ~/bromite/build/patches/${file} press return"
read -n 1
fi
echo " "
done
file="Add-a-flag-to-always-view-desktop-site-for-all-websites.patch"
REPL="0,/^---/s//FILE:"$file"\n---/"
cat ~/bromite/build/patches/$file | sed $REPL | git am
# install builds deps
sudo build/install-build-deps-android.sh
gclient runhooks
# generate ninja files and autogenerated files
gn gen --args="$(cat ~/bromite/build/GN_ARGS) target_cpu=\"arm64\" " out/arm64
# build time!
set NINJA_SUMMARIZE_BUILD=1
date && autoninja -C out/arm64 chrome_public_apk && date && adb install out/arm64/apks/ChromePublic.apk
PATH=/root/chromium/src/third_party/llvm-build/Release+Asserts/bin:/root/depot_tools/:$PATH
ccache --max-size=10G
export CCACHE_CPP2=yes
export CCACHE_SLOPPINESS=time_macros
gn gen --args="$(cat ~/bromite/build/GN_ARGS) target_cpu=\"arm64\" cc_wrapper=\"ccache\" " out/arm64

50
create-from-patch.sh Normal file
View File

@ -0,0 +1,50 @@
#!/bin/bash
PATCH=$1
PLEASEWAIT=0
if [[ $PATCH =~ ^+.* ]]; then
PLEASEWAIT=1
PATCH=${PATCH:1}
fi
if [ -z "$2" ]
then
PATCH_NEW_PATH="~/bromite/build/patches-new"
else
PATCH_NEW_PATH=$2
fi
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
#echo press return
#read -n 1
git reset --hard
git clean -f -d
echo " Applying new patch"
git am $PATCH_FILE

View File

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

View File

@ -6,6 +6,7 @@ output=$2
PATCH_FILE=$(git -C ~/chromium/src/ show -s $patch | grep FILE: | sed 's/FILE://g' | sed 's/^[ \t]*//;s/[ \t]*$//') PATCH_FILE=$(git -C ~/chromium/src/ show -s $patch | grep FILE: | sed 's/FILE://g' | sed 's/^[ \t]*//;s/[ \t]*$//')
if [ -z "$output" ] if [ -z "$output" ]
then then
PATCH_FILE=$(git -C ~/chromium/src/ show -s $patch | tail -n 1 | xargs)
echo Exporting $patch ~/bromite/build/patches-new/$PATCH_FILE echo Exporting $patch ~/bromite/build/patches-new/$PATCH_FILE
else else
PATCH_FILE=$output PATCH_FILE=$output
@ -13,6 +14,7 @@ else
fi fi
git -C ~/chromium/src/ format-patch -1 --keep-subject --stdout --full-index --zero-commit --no-signature $patch >~/bromite/build/patches-new/$PATCH_FILE git -C ~/chromium/src/ format-patch -1 --keep-subject --stdout --full-index --zero-commit --no-signature $patch >~/bromite/build/patches-new/$PATCH_FILE
echo " exported"
while read line; do while read line; do
#echo $line #echo $line
@ -33,3 +35,6 @@ sed -i '/^new mode /d' ~/bromite/build/patches-new/$PATCH_FILE
echo "-- " >> ~/bromite/build/patches-new/$PATCH_FILE echo "-- " >> ~/bromite/build/patches-new/$PATCH_FILE
echo "2.17.1" >> ~/bromite/build/patches-new/$PATCH_FILE echo "2.17.1" >> ~/bromite/build/patches-new/$PATCH_FILE
echo "" >> ~/bromite/build/patches-new/$PATCH_FILE echo "" >> ~/bromite/build/patches-new/$PATCH_FILE
echo " done."
echo ""