From 9277d012d78190f8f3238cb11dc2f89f572d47cc Mon Sep 17 00:00:00 2001 From: Pavol Zibrita Date: Mon, 18 Apr 2011 10:18:53 +0200 Subject: [PATCH] Latest changes by vics and working ftp upload --- build-scripts/build_branches.sh | 50 ++++++++++++++++++++------------- build-scripts/daily_build.sh | 3 +- build-scripts/sync_git_hg.sh | 0 build-scripts/update_git.sh | 4 +-- build-scripts/upload_ftp.sh | 4 ++- 5 files changed, 36 insertions(+), 25 deletions(-) mode change 100644 => 100755 build-scripts/sync_git_hg.sh mode change 100644 => 100755 build-scripts/update_git.sh mode change 100644 => 100755 build-scripts/upload_ftp.sh diff --git a/build-scripts/build_branches.sh b/build-scripts/build_branches.sh index 1fbfcce8a3..4191678b6d 100755 --- a/build-scripts/build_branches.sh +++ b/build-scripts/build_branches.sh @@ -18,27 +18,37 @@ do ch=$(expr index "$i" ">") if [ $ch = 0 ]; then BRANCH=${i#"$GIT_ORIGIN_NAME/"} - echo "Checkouting branch and create build for $BRANCH" - ## reset all previous changes in working tree - git checkout . - git checkout $BRANCH - sed -e "s/\(APP_DESCRIPTION.*=.*\"\).*\(\".*\)/\1$DATE $BRANCH\2/g" $VERSION_FILE > ${VERSION_FILE}.bak - mv ${VERSION_FILE}.bak ${VERSION_FILE} + + echo "Checking if there are changes : $BRANCH - $GIT_ORIGIN_NAME/$BRANCH" + + git diff --exit-code "$BRANCH" "$GIT_ORIGIN_NAME/$BRANCH" --quiet + RES_DIFF=$? + if [ $RES_DIFF != 0 ]; then + echo "Checkouting branch and create build for $BRANCH" + ## reset all previous changes in working tree + git checkout . + git reset HEAD --hard + git checkout $BRANCH + git merge $GIT_ORIGIN_NAME/$BRANCH + + sed -e "s/\(APP_DESCRIPTION.*=.*\"\).*\(\".*\)/\1$DATE $BRANCH\2/g" $VERSION_FILE > ${VERSION_FILE}.bak + mv ${VERSION_FILE}.bak ${VERSION_FILE} - ## build map creator - cd ./DataExtractionOSM/ - ant clean compile build - mv build.zip "$BUILD_DIR/OsmAndMapCreator-$BRANCH-nb-$DATE.zip" + ## build map creator + cd ./DataExtractionOSM/ + ant clean compile build + mv build.zip "$BUILD_DIR/OsmAndMapCreator-$BRANCH-nb-$DATE.zip" - ## build osmand app - cd ../OsmAnd/ - cp "$DIRECTORY"/local.properties local.properties - rm -r bin - mkdir bin - if [ ! -d assets ]; then - mkdir assets - fi - ant clean debug - mv bin/OsmAnd-debug.apk "$BUILD_DIR/OsmAnd-$BRANCH-nb-$DATE.apk" + ## build osmand app + cd ../OsmAnd/ + cp "$DIRECTORY"/local.properties local.properties + rm -r bin + mkdir bin + if [ ! -d assets ]; then + mkdir assets + fi + ant clean debug + mv bin/OsmAnd-debug.apk "$BUILD_DIR/OsmAnd-$BRANCH-nb-$DATE.apk" + fi fi done diff --git a/build-scripts/daily_build.sh b/build-scripts/daily_build.sh index a9a6a4d2aa..33445c3d0a 100755 --- a/build-scripts/daily_build.sh +++ b/build-scripts/daily_build.sh @@ -23,8 +23,7 @@ touch $LOG_FILE "${DIRECTORY}/build_branches.sh" 2>&1 >>$LOG_FILE # 3. upload to ftp server -# TODO test and uncomment -#"${DIRECTORY}/upload_ftp.sh" 2>&1 >>$LOG_FILE +"${DIRECTORY}/upload_ftp.sh" 2>&1 >>$LOG_FILE # 4. Synchronize github with googlecode mercurial "${DIRECTORY}/sync_git_hg.sh" 2>&1 >>$LOG_FILE diff --git a/build-scripts/sync_git_hg.sh b/build-scripts/sync_git_hg.sh old mode 100644 new mode 100755 diff --git a/build-scripts/update_git.sh b/build-scripts/update_git.sh old mode 100644 new mode 100755 index 0a42e78dfa..d8ec9eaf55 --- a/build-scripts/update_git.sh +++ b/build-scripts/update_git.sh @@ -5,6 +5,7 @@ GIT_DIR="$DIRECTORY"/osmand-git GIT_URL=git://github.com/osmandapp/Osmand.git GIT_ORIGIN_NAME=origin +#rm -rf "${GIT_DIR}" # initialize git if it is not present (clone it) if [ ! -d "$GIT_DIR" ]; then git clone ${GIT_URL} "${GIT_DIR}" @@ -13,5 +14,4 @@ fi cd "${GIT_DIR}" git reset --hard git checkout master -git pull ${GIT_ORIGIN_NAME} - +git fetch ${GIT_ORIGIN_NAME} diff --git a/build-scripts/upload_ftp.sh b/build-scripts/upload_ftp.sh old mode 100644 new mode 100755 index d799383f9f..cc6fcbfc3a --- a/build-scripts/upload_ftp.sh +++ b/build-scripts/upload_ftp.sh @@ -3,13 +3,15 @@ DIRECTORY=$(cd `dirname $0` && pwd) FTP_SITE=download.osmand.net FTP_FOLDER=night-builds +FTP_LATEST=latest-night-build # FTP_USER in local.properties # FTP_PWD= in local.properties BUILD_DIR="$DIRECTORY"/builds +LATEST_DIR="$DIRECTORY"/latests . "$DIRECTORY"/local.properties # 3. upload to ftp server -lftp -c "set net:timeout 45;open -u $FTP_USER,$FTP_PWD $FTP_SITE;ls $FTP_FOLDER;mirror -R $BUILD_DIR $FTP_FOLDER" +lftp -c "set net:timeout 45;open -u $FTP_USER,$FTP_PWD $FTP_SITE;mirror -R $BUILD_DIR $FTP_FOLDER;mirror -R $LATEST_DIR $FTP_LATEST" #ftp -n -v $FTP_SITE <