diff options
author | mattab <matthieu.aubry@gmail.com> | 2014-05-26 09:09:44 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2014-05-26 09:09:44 +0400 |
commit | 5a9d6ba8ab8e877691abe7adc8de7c8265941bdf (patch) | |
tree | 8007360db2b52f44bda8a5b3ebb3d423c18de9d2 /misc/package | |
parent | f5b0ec5fb17e302096287dc444db487fdd8badb0 (diff) |
Remove unused code in build script
Diffstat (limited to 'misc/package')
-rwxr-xr-x | misc/package/build.sh | 236 |
1 files changed, 98 insertions, 138 deletions
diff --git a/misc/package/build.sh b/misc/package/build.sh index 3c4d4b6131..5db46b0c76 100755 --- a/misc/package/build.sh +++ b/misc/package/build.sh @@ -78,7 +78,14 @@ 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 \ +namespace Piwik;\nclass Manifest {\n\tstatic $files=array(\n/; $ s/$/\n\t);\n}/' \ + > piwik/config/manifest.inc.php } @@ -86,149 +93,103 @@ if [ -z "$VERSION" ]; then die "Expected a version number, 'nightly', or 'webtest' as a parameter" fi -case "$VERSION" in - "nightly" ) - if [ ! -e "${WORKSPACE}/trunk" ]; then - die "Piwik trunk not present!" - fi +############################ +echo "Starting build...." +############################ - cleanupWorkspace - rm -f latest.zip +# Setting umask so it works for most users, see http://dev.piwik.org/trac/ticket/3869 +UMASK=`umask` +umask 0022 - cp -R trunk piwik - find piwik -name '.git' -type d -prune -exec rm -rf {} \; +if [ ! -e $DEST_PATH ] ; then + echo "Destination directory does not exist... Creating it!"; + mkdir -p $DEST_PATH; +fi - organizePackage +cd $DEST_PATH +cleanupWorkspace - zip -q -r latest.zip piwik How\ to\ install\ Piwik.html *.xml *.sql > /dev/null 2> /dev/null - ;; - "webtest" ) - if [ ! -e "${WORKSPACE}/build/core/Version.php" ]; then - die "Piwik source files not present!" - fi +if [ ! -e $DEST_PATH/piwik_last_version ] ; then + 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 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 - cleanupWorkspace - rm -rf 1.0 - rm -f latest.zip - - cp -R build piwik - find piwik -name '.git' -type d -prune -exec rm -rf {} \; - - organizePackage - - zip -q -r latest.zip piwik > /dev/null 2> /dev/null - - # Set-up infrastructure proxies for testing - LATESTVERSION=`fgrep VERSION build/core/Version.php | sed -e "s/\tconst VERSION = '//" | sed -e "s/'.*//"` - mkdir 1.0 - mkdir 1.0/getLatestVersion - cat >1.0/getLatestVersion/index.php <<GET_LATEST_VERSION -<?php - echo "${LATESTVERSION}"; -GET_LATEST_VERSION - - mkdir 1.0/subscribeNewsletter - cat >1.0/subscribeNewsletter/index.php <<SUBSCRIBE_NEWSLETTER -<?php - echo "ok"; -SUBSCRIBE_NEWSLETTER - ;; - -# BUILDING RELEASE - * ) - # Setting umask so it works for most users, see http://dev.piwik.org/trac/ticket/3869 - UMASK=`umask` - umask 0022 - - if [ ! -e $DEST_PATH ] ; then - echo "Destination directory does not exist... Creating it!"; - mkdir -p $DEST_PATH; - fi +cd $DEST_PATH/piwik +git checkout tags/$VERSION - cd $DEST_PATH - cleanupWorkspace - - if [ ! -e $DEST_PATH/piwik_last_version ] ; then - 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 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 +echo "preparing release $VERSION" + +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 - cd $DEST_PATH/piwik - git checkout tags/$VERSION +echo "organizing files and generating manifest file..." +organizePackage - echo "preparing release $VERSION" +echo "packaging release..." +zip -r piwik-$VERSION.zip piwik How\ to\ install\ Piwik.html > /dev/null +tar -czf piwik-$VERSION.tar.gz piwik How\ to\ install\ Piwik.html +mv piwik-$VERSION.{zip,tar.gz} $HTTP_PATH - 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 +zip -r piwik-$VERSION-WAG.zip piwik *.xml *.sql > /dev/null 2> /dev/null +mkdir $HTTP_PATH/WebAppGallery 2> /dev/null +mv piwik-$VERSION-WAG.zip $HTTP_PATH/WebAppGallery/piwik-$VERSION.zip + +# setting back umask +umask $UMASK - echo "organizing files and writing manifest file..." - organizePackage - - echo "packaging release..." - zip -r piwik-$VERSION.zip piwik How\ to\ install\ Piwik.html > /dev/null - tar -czf piwik-$VERSION.tar.gz piwik How\ to\ install\ Piwik.html - mv piwik-$VERSION.{zip,tar.gz} $HTTP_PATH - - zip -r piwik-$VERSION-WAG.zip piwik *.xml *.sql > /dev/null 2> /dev/null - mkdir $HTTP_PATH/WebAppGallery 2> /dev/null - mv piwik-$VERSION-WAG.zip $HTTP_PATH/WebAppGallery/piwik-$VERSION.zip - - # setting back umask - umask $UMASK - - if [ `echo $VERSION | grep -E 'rc|b|a|alpha|beta|dev' -i | wc -l` -eq 1 ]; then - if [ `echo $VERSION | grep -E 'rc|b|beta' -i | wc -l` -eq 1 ]; then - echo "Beta or RC release"; - echo $VERSION > $HTTP_PATH/LATEST_BETA - fi - echo "build finished! http://builds.piwik.org/piwik-$VERSION.zip" - else - echo "Stable release"; - - #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 - - CMD="scp $HTTP_PATH/LATEST $API_SCP_LATEST" - echo $CMD - $CMD - - CMD="scp $HTTP_PATH/LATEST LATEST_SIZE $WWW_SCP_LATEST" - echo $CMD - $CMD - - SHA1_WINDOWS="$(sha1sum $HTTP_PATH/WebAppGallery/piwik-$VERSION.zip | cut -d' ' -f1)" - - echo -e "Sending email to Microsoft web team \n\n" - echo -e "Hello, \n\n\ +if [ `echo $VERSION | grep -E 'rc|b|a|alpha|beta|dev' -i | wc -l` -eq 1 ]; then + if [ `echo $VERSION | grep -E 'rc|b|beta' -i | wc -l` -eq 1 ]; then + echo "Beta or RC release"; + echo $VERSION > $HTTP_PATH/LATEST_BETA + fi + echo "build finished! http://builds.piwik.org/piwik-$VERSION.zip" +else + echo "Stable release"; + + #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 + + CMD="scp $HTTP_PATH/LATEST $API_SCP_LATEST" + echo $CMD + $CMD + + CMD="scp $HTTP_PATH/LATEST LATEST_SIZE $WWW_SCP_LATEST" + echo $CMD + $CMD + + SHA1_WINDOWS="$(sha1sum $HTTP_PATH/WebAppGallery/piwik-$VERSION.zip | cut -d' ' -f1)" + + echo -e "Sending email to Microsoft web team \n\n" + echo -e "Hello, \n\n\ We are proud to announce a new release for Piwik! \n\ Piwik $VERSION can be downloaded at: http://builds.piwik.org/WebAppGallery/piwik-$VERSION.zip \n\ SHA1 checksum is: $SHA1_WINDOWS \n\n\ @@ -238,10 +199,9 @@ If you have any question, feel free to ask. \n\n\ Thank you,\n\n\ Piwik team" | mail -s"New Piwik Version $VERSION" "appgal@microsoft.com,hello@piwik.org" - echo "build finished! http://builds.piwik.org/latest.zip" - fi - ;; -esac + echo "build finished! http://builds.piwik.org/latest.zip" +fi + cleanupWorkspace |