Skip to content

Instantly share code, notes, and snippets.

@busches
Created June 22, 2015 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save busches/22e9341f9094f6bf04a1 to your computer and use it in GitHub Desktop.
Save busches/22e9341f9094f6bf04a1 to your computer and use it in GitHub Desktop.
Changelog for CM builds
#export WORKSPACE=/var/lib/jenkins/jobs/Build_CM12/workspace/builds
#export WORKSPACE=~/Downloads
export WORKSPACE=~/Dropbox/CM
export CHANGESPATH=$WORKSPACE/CHANGES-$(date -u +%Y%m%d).txt
rm $CHANGESPATH 2>/dev/null
# export CM_NIGHTLY
# get the name of the file we just built
lastBuild=$(ls -lt $WORKSPACE/cm*.zip | sed -e "s/ / /" | cut -d ' ' -f9 | head -1)
echo $lastBuild
# get the name of the file we built prior to that
prevBuild=$(ls -lt $WORKSPACE/cm*.zip | sed -e "s/ / /" | cut -d ' ' -f9 | sed -n -e '2{p;q}')
echo $prevBuild
# get timestamps of files
ts=$(stat $lastBuild | grep 'Change: ' | cut -d ' ' -f2,3,4)
if [ -z "$prevBuild" ]; then
prevts=
else
prevts=$(stat $prevBuild | grep 'Change: ' | cut -d ' ' -f2,3,4)
fi
if [[ "$prevts" == "$ts" ]]; then
echo "Only one build found"
prevts=
fi
if [ -z "$ANDROID_BUILD_TOP" ]; then
export ANDROID_BUILD_TOP=/media/scott/Backup/cm-12.1
fi
# we must navigate to where the repo is
cd $ANDROID_BUILD_TOP
# bypass the comparision just to see what's new in the repo
if [[ -n "$1" ]]; then
source build/envsetup.sh
reposync
prevts=$ts
ts="2016-05-09 01:00:24.069817774 -0500"
fi
echo $ts
echo $prevts
export ts
export prevts
(echo "==================================="
echo -n "Since ";date -d "$ts"
echo "==================================="
if [ -z "$prevts" ]; then
echo "This is the first CyanogenMod build of this type for device $CM_BUILD" >> $CHANGESPATH
else
repo forall -c 'L=$(git log --oneline --since "$prevts" --until "$ts" -n 1); if [ "n$L" != "n" ]; then echo; echo " * $REPO_PATH"; git log --oneline --since "$prevts" --until "$ts"; fi'
# repo forall -c 'echo git log --oneline --since "$prevts" --until "$ts" -n 1';
fi
echo) >> $CHANGESPATH
echo "All done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment