-
-
Save invisiblek/9acdcff6ee1f3caa740bbcd4d294f33a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ `pwd` == *carbon* ]]; then | |
rom=carbon | |
version=cr-4.0 | |
else | |
rom=cm | |
version=13.0 | |
fi | |
tags='+(linaro|twrp)' | |
shopt -s extglob | |
while [ $# -gt 0 ]; do | |
case $1 in | |
careful) careful="true"; set -e;; | |
$tags) eval $1="true";; | |
11.0|cm-11.0) version=11.0;; | |
12.0|cm-12.0) version=12.0;; | |
12.1|cm-12.1) version=12.1;; | |
13.0|cm-13.0) version=13.0;; | |
cr-4.0) version=cr-4.0;; | |
*) ;; | |
esac | |
shift | |
done | |
source build/envsetup.sh > /dev/null | |
rm -f ~/.bin/repopicks-tmp | |
touch ~/.bin/repopicks-tmp | |
while read line; do | |
if [[ ${line:0:1} == '#' ]] || [ "$line" == "" ]; then | |
echo $line >> ~/.bin/repopicks-tmp | |
continue | |
fi | |
p=`echo $line | awk '{print $1}'` | |
if [ "$p" != "skip" ]; then | |
output=`repopick $p` | |
if [[ "$output" != "${output/'Skipping the cherry pick'}" ]]; then | |
if [[ "$output" != "${output/'Change status is MERGED. Skipping the cherry pick'}" ]]; then | |
echo "removing $p from the script" | |
/home/dp/.bin/email "[email protected]" "[email protected]" "Merged cherry pick removed from auto pick script" "\n\n$line" "invisiblek.org" "[email protected]" | |
continue | |
else | |
repopick -f $p | |
fi | |
fi | |
fi | |
echo $line >> ~/.bin/repopicks-tmp | |
echo "" | |
done < ~/.bin/repopicks-$version | |
# sed -i '/^\s*$/d' ~/.bin/repopicks-tmp | |
cp ~/.bin/repopicks-tmp ~/.bin/repopicks-$version | |
rm -f ~/.bin/repopicks-tmp | |
while read line; do | |
[[ ${line:0:1} == '#' ]] && continue; | |
[ "$line" == "" ] && continue | |
dir=`echo $line | awk '{print $1}'` | |
case $dir in | |
skip) continue;; | |
head) dir=`echo $line | awk '{print $2}'` | |
branch=`echo $line | awk '{print $3}'` | |
cd $dir | |
git fetch blek | |
commit=`git log blek/$branch | head -1 | awk '{print $2}'` | |
cd -;; | |
$tags) if [[ $(eval echo \$$dir) == "true" ]]; then | |
dir=`echo $line | awk '{print $2}'` | |
commit=`echo $line | awk '{print $3}'` | |
else | |
continue; | |
fi;; | |
*) commit=`echo $line | awk '{print $2}'`;; | |
esac | |
cd $dir | |
[ "$careful" == "true" ] && set +e | |
git fetch blek | |
[ "$careful" == "true" ] && set -e | |
git cherry-pick $commit | |
cd - | |
done < ~/.bin/cherrypicks-$version | |
if [ "$twrp" == "true" ]; then | |
if [ "$rom" != "cm" ]; then | |
echo "Currently only cm supported for twrp building" | |
exit 0 | |
fi | |
dirs=( | |
device/htc/dlx \ | |
device/htc/msm8974-common \ | |
device/lge/d850 \ | |
device/lge/d851 \ | |
device/lge/d852 \ | |
device/lge/d855 \ | |
device/lge/f400 \ | |
device/lge/g2-common \ | |
device/lge/g3-common \ | |
device/lge/g4-common \ | |
device/lge/ls990 \ | |
device/lge/v4xx-common \ | |
device/lge/vk810 \ | |
device/lge/vs985 \ | |
device/motorola/victara \ | |
device/samsung/d2-common \ | |
device/samsung/jf-common \ | |
kernel/lge/v4xx \ | |
vendor/extra \ | |
vendor/cm \ | |
) | |
for i in ${dirs[@]}; do | |
cd $i | |
git fetch blek | |
git cherry-pick `git log blek/cm-"$version"_twrp | head -1 | awk '{print $2}'` | |
cd - | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment