diff options
author | mattab <matthieu.aubry@gmail.com> | 2014-05-07 08:49:28 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2014-05-07 08:49:28 +0400 |
commit | 0e555878ff339d771c74ff146c1282a8cdde72d2 (patch) | |
tree | 1ee3654eead3f1b4937228214d40c3cf97da5399 /misc/package | |
parent | 88a77e9234afccd7093c565810fd265ab9953d23 (diff) |
Sync build script
Diffstat (limited to 'misc/package')
-rwxr-xr-x | misc/package/build.sh | 66 |
1 files changed, 39 insertions, 27 deletions
diff --git a/misc/package/build.sh b/misc/package/build.sh index 57facd3a06..b889e68014 100755 --- a/misc/package/build.sh +++ b/misc/package/build.sh @@ -3,14 +3,14 @@ # $ git tag 1.11-b3 # $ git push origin tags/1.11-b3 -# SETUP: -# repo should be in DEST_PATH/piwik_last_version eg. /home/piwik-builds/builds/piwik_last_version -# git clone -- https://github.com/piwik/piwik.git /home/piwik-builds/builds/piwik_last_version || die "Problem checking out the last version tag" +# SETUP: # $ curl -sS https://getcomposer.org/installer | php VERSION="$1" DEST_PATH=/home/piwik-builds/builds URL_REPO=https://github.com/piwik/piwik.git +# git clone -- https://github.com/piwik/piwik.git /home/piwik-builds/builds/piwik_last_version || die "Problem checking out the last version tag" +# repo should be in DEST_PATH/piwik_last_version eg. /home/piwik-builds/builds/piwik_last_version HTTP_PATH=/home/piwik-builds/www/builds.piwik.org API_SCP_LATEST=piwik-api@localhost:/home/piwik-api/www/api.piwik.org/ WWW_SCP_LATEST=piwik@localhost:/home/piwik/www/ @@ -33,15 +33,18 @@ function cleanupWorkspace() { # organize files for packaging function organizePackage() { - cd piwik/ - +# cd piwik/ + #ls -la curl -sS https://getcomposer.org/installer | php +# php composer.phar install #REMOVED php composer.phar install cd ../ - rm -rf piwik/composer.phar rm -rf piwik/vendor/twig/twig/test/ rm -rf piwik/vendor/twig/twig/doc/ + rm -rf piwik/vendor/symfony/console/Symfony/Component/Console/Tests + rm -rf piwik/vendor/symfony/console/Symfony/Component/Console/Resources/bin + rm -rf piwik/vendor/phpunit/ rm -rf piwik/libs/PhpDocumentor-1.3.2/ rm -rf piwik/libs/FirePHPCore/ @@ -52,9 +55,12 @@ function organizePackage() { rm -f piwik/misc/updateLanguageFiles.sh rm -f piwik/misc/others/db-schema* rm -f piwik/misc/others/diagram_general_request* - rm -rf piwik/.git* rm -f piwik/.travis* + # delete submodules empty dirs + for path_to_delete in `cat piwik/.gitmodules | grep "path = " | sed "s/.*path = //"` ; do rmdir piwik/$path_to_delete; done + rm -rf piwik/.git* + cp piwik/tests/README.md . find piwik -name 'tests' -type d -prune -exec rm -rf {} \; mkdir piwik/tests @@ -71,7 +77,7 @@ function organizePackage() { fi fi - find piwik -type f -printf '%s ' -exec md5sum {} \; | grep -v "user/.htaccess" | egrep -v 'manifest.inc.php|autoload.php|autoload_real.php' | sed '1,$ s/\([0-9]*\) \([a-z0-9]*\) *piwik\/\(.*\)/\t\t"\3" => array("\1", "\2"),/;' | sort | sed '1 s/^/<?php\n\/\/ This file is automatically generated during the Piwik build process\nnamespace Piwik;\nclass Manifest {\n\tstatic $files=array(\n/; $ s/$/\n\t);\n}/' > piwik/config/manifest.inc.php + find piwik -type f -printf '%s ' -exec md5sum {} \; | grep -v "user/.htaccess" | egrep -v 'manifest.inc.php|autoload.php|autoload_real.php' | sed '1,$ s/\([0-9]*\) \([a-z0-9]*\) *piwik\/\(.*\)/\t\t"\3" => array("\1", "\2"),/;' | sort | sed '1 s/^/<?php\n\/\/ This file is automatically generated during the Piwik build process\nnamespace Piwik;\nclass Manifest {\n\tstatic $files=array(\n/; $ s/$/\n\t);\n}/' > piwik/config/manifest.inc.php } @@ -142,24 +148,34 @@ SUBSCRIBE_NEWSLETTER cleanupWorkspace if [ ! -e $DEST_PATH/piwik_last_version ] ; then - git clone -- $URL_REPO $DEST_PATH/piwik_last_version - fi + git clone -- $URL_REPO $DEST_PATH/piwik_last_version + fi echo "checkout repository for tag $VERSION..." cd $DEST_PATH/piwik_last_version git pull + git checkout tags/$VERSION echo "copying files to a new directory..." cd .. rm -Rf piwik cp -R piwik_last_version piwik cd piwik - git checkout tags/$VERSION - cd $DEST_PATH + git checkout master + git pull + + if [ `git describe --exact-match --tags HEAD` != "$VERSION" ] + then + echo "=====> could not checkout to the tag for this version, make sure tag exists <======" + exit 1 + fi + + cd $DEST_PATH/piwik + git checkout tags/$VERSION echo "preparing release $VERSION" - echo `grep "'$VERSION'" piwik/core/Version.php` - if [ `grep "'$VERSION'" piwik/core/Version.php | wc -l` -ne 1 ]; then + echo `grep "'$VERSION'" core/Version.php` + if [ `grep "'$VERSION'" core/Version.php | wc -l` -ne 1 ]; then echo "version $VERSION does not match core/Version.php"; exit fi @@ -184,9 +200,6 @@ SUBSCRIBE_NEWSLETTER echo "Beta or RC release"; echo $VERSION > $HTTP_PATH/LATEST_BETA fi - - #softwares reads builds.piwik.org/LATEST_BETA directly - echo "build finished! http://builds.piwik.org/piwik-$VERSION.zip" else echo "Stable release"; @@ -194,23 +207,23 @@ SUBSCRIBE_NEWSLETTER #hard linking piwik.org/latest.zip to the newly created build for i in zip tar.gz; do ln -sf $HTTP_PATH/piwik-$VERSION.$i $HTTP_PATH/latest.$i + ln -sf $HTTP_PATH/piwik-$VERSION.$i $HTTP_PATH/piwik-latest.$i done - + # record filesize in Mb ls -l $HTTP_PATH/piwik-$VERSION.zip | awk '/d|-/{printf("%.3f %s\n",$5/(1024*1024),$9)}' > LATEST_SIZE - + echo $VERSION > $HTTP_PATH/LATEST echo $VERSION > $HTTP_PATH/LATEST_BETA - echo "scp piwik-api@..." - scp $HTTP_PATH/LATEST $API_SCP_LATEST + CMD="scp $HTTP_PATH/LATEST $API_SCP_LATEST" + echo $CMD + $CMD - echo "scp piwik@... (filesize = " && echo LATEST_SIZE && echo ")" - scp $HTTP_PATH/LATEST LATEST_SIZE $WWW_SCP_LATEST + CMD="scp $HTTP_PATH/LATEST LATEST_SIZE $WWW_SCP_LATEST" + echo $CMD + $CMD - echo "In Dec. remove this and restore 301 redirects on piwik.org" - scp $HTTP_PATH/piwik-$VERSION.zip $WWW_SCP_LATEST/piwik.org/latest.zip - rm LATEST_SIZE echo "build finished! http://builds.piwik.org/latest.zip" fi @@ -219,4 +232,3 @@ esac cleanupWorkspace - |