Created
January 5, 2017 02:08
-
-
Save invisiblek/5d26ee6281952ebeb7addd0a99f112b9 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 | |
export oldtag=android-7.1.1_r6 | |
export newtag=android-7.1.1_r9 | |
export cmversion=14.1 | |
# CAF | |
#export remotebase=https://source.codeaurora.org/quic/la/platform | |
# AOSP | |
export remotebase=https://android.googlesource.com/platform | |
cd android | |
repo sync -j16 -q -d --force-sync . | |
cd - | |
export currenttag=`sed -e '1,/name="aosp"/d' android/default.xml | tail -n +3 | head -1 | sed 's| revision="refs/tags/||g' | sed 's|" />||g'` | |
if [[ $currenttag == $newtag ]]; then | |
echo "It appears you're already at $newtag" | |
echo "Have you updated the variables in this script?" | |
echo "Exiting..." | |
exit 1 | |
fi | |
if [[ $currenttag != $oldtag ]]; then | |
echo "You're not sitting at $oldtag, you're at $currenttag" | |
echo "Have you updated the variables in this script?" | |
echo "Exiting..." | |
exit 1 | |
fi | |
rm -rf ~/merged_repos | |
rm -rf ~/upstream_updated_repos | |
repo forall -j16 -c ' | |
echo $REPO_PROJECT | |
repo sync -j16 -q -d . 2> /dev/null | |
git for-each-ref --format "%(refname:short)" refs/heads | grep -v master | xargs git branch -D 2> /dev/null | |
if [[ $REPO_REMOTE == "github" ]]; then | |
git remote rm upstream 2> /dev/null | |
p=$(echo $REPO_PROJECT | sed 's#LineageOS\/android_##g' | sed 's#LineageOS\/##g' | sed 's#_#/#g') | |
# we can safely ignore device,kernel and vendor repos. along with anything *-caf | |
if [[ ! $p == device* ]] && [[ ! $p == kernel* ]] && [[ ! $p == vendor* ]] && [[ ! $p == hudson ]] && [[ ! $REPO_PATH == *-caf* ]] && [[ ! $REPO_PATH == *cmsdk* ]] && [[ ! $REPO_PATH == *cyanogen* ]]; then | |
remote=$remotebase/$p | |
git remote add upstream $remote 2> /dev/null | |
response=`curl -o /dev/null --silent --head --write-out '%{http_code}' $remote` | |
if [[ $response == 200 ]]; then | |
git fetch upstream 2> /dev/null | |
if (git tag | grep -q $newtag); then | |
git reset 2> /dev/null | |
git checkout . 2> /dev/null | |
git clean -df 2> /dev/null | |
git branch -D $newtag 2> /dev/null | |
repo sync -j16 -q -d --force-sync . 2> /dev/null | |
repo start $cmversion . 2> /dev/null | |
result=`git merge --no-edit $newtag 2>&1` | |
if [[ $result != "Already up-to-date." ]]; then | |
if [[ $result != *"Cannot merge"* ]]; then | |
echo "$REPO_PATH" >> ~/merged_repos | |
else | |
echo "--!-- $REPO_PATH" >> ~/merged_repos | |
fi | |
fi | |
fi | |
fi | |
fi | |
elif [[ $REPO_REMOTE == "aosp" ]]; then | |
if [[ `git diff $oldtag $newtag` != "" ]]; then | |
echo $REPO_PATH >> ~/upstream_updated_repos | |
fi | |
fi | |
' | |
echo -e "=================================================================================================" | |
echo -e "" | |
echo -e "\e[31mDon't forget to update the manifest!! This is left to do manually!\e[0m" | |
echo -e "" | |
echo -e "List of merged cm remotes at: \e[31m~/merged_repos\e[0m (those marked with --!-- will need to be looked at)" | |
echo -e "List of upstream-tracked repos that have changes at: \e[31m~/upstream_updated_repos\e[0m" | |
echo -e "" | |
echo -e "Tip after uploading manifest to init that particular manifest:" | |
echo -e " repo init -u https://review.lineageos.org/LineageOS/android -b refs/changes/95/176795/1" | |
echo -e "" | |
echo -e "=================================================================================================" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment