scripts/make_release.sh
changeset 158 2d5a7c18f9ea
parent 157 8a64fc6b9d0e
child 159 451f39c0e1aa
equal deleted inserted replaced
157:8a64fc6b9d0e 158:2d5a7c18f9ea
     1 #!/bin/sh
     1 #!/bin/bash
     2 
     2 
     3 # Script to create a "release" subdirectory.  This is a subdirectory
     3 # Script to create a "release" subdirectory.  This is a subdirectory
     4 # containing a bunch of symlinks, from which the app can be updated.
     4 # containing a bunch of symlinks, from which the app can be updated.
     5 # The main reason for this is to import Django from a zipfile, which
     5 # The main reason for this is to import Django from a zipfile, which
     6 # saves dramatically in upload time: statting and computing the SHA1
     6 # saves dramatically in upload time: statting and computing the SHA1
     7 # for 1000s of files is slow.  Even if most of those files don't
     7 # for 1000s of files is slow.  Even if most of those files don't
     8 # actually need to be uploaded, they still add to the work done for
     8 # actually need to be uploaded, they still add to the work done for
     9 # each update.
     9 # each update.
    10 
    10 
    11 DJANGO_ZIPFILE=django.zip
    11 DJANGO_ZIPFILE=django.zip
    12 RELEASE=../release
    12 DEFAULT_APP_RELEASE=../release
    13 APP_FOLDER="../app"
    13 DEFAULT_APP_FOLDER="../app"
    14 APP_FILES="app.yaml index.yaml __init__.py main.py settings.py urls.py"
    14 DEFAULT_APP_FILES="app.yaml index.yaml __init__.py main.py settings.py urls.py"
    15 APP_DIRS="soc ghop gsoc feedparser tiny_mce"
    15 DEFAULT_APP_DIRS="soc ghop gsoc feedparser tiny_mce"
       
    16 
       
    17 APP_RELEASE=${APP_RELEASE:-"${DEFAULT_APP_RELEASE}"}
       
    18 APP_FOLDER=${APP_FOLDER:-"${DEFAULT_APP_FOLDER}"}
       
    19 APP_FILES=${APP_FILES:-"${DEFAULT_APP_FILES}"}
       
    20 APP_DIRS=${APP_DIRS:-"${DEFAULT_APP_DIRS}"}
    16 
    21 
    17 cd $APP_FOLDER
    22 cd $APP_FOLDER
    18 # Remove old $ZIPFILE file.
    23 # Remove old $DJANGO_ZIPFILE file.
    19 rm -rf $DJANGO_ZIPFILE
    24 rm -rf $DJANGO_ZIPFILE
    20 
    25 
    21 # Create new $ZIPFILE file.
    26 # Create new $DJANGO_ZIPFILE file.
    22 # We prune:
    27 # We prune:
    23 # - .svn subdirectories for obvious reasons.
    28 # - .svn subdirectories for obvious reasons.
    24 # - contrib/gis/ and related files because it's huge and unneeded.
    29 # - contrib/gis/ and related files because it's huge and unneeded.
    25 # - *.po and *.mo files because they are bulky and unneeded.
    30 # - *.po and *.mo files because they are bulky and unneeded.
    26 # - *.pyc and *.pyo because they aren't used by App Engine anyway.
    31 # - *.pyc and *.pyo because they aren't used by App Engine anyway.
    38     -name postgresql_psycopg2 -prune -o \
    43     -name postgresql_psycopg2 -prune -o \
    39     -name sqlite3 -prune -o \
    44     -name sqlite3 -prune -o \
    40     -name test -prune -o \
    45     -name test -prune -o \
    41     -type f ! -name \*.py[co] ! -name *.[pm]o -print`
    46     -type f ! -name \*.py[co] ! -name *.[pm]o -print`
    42 
    47 
    43 # Remove old $RELEASE directory.
    48 # Remove old $APP_RELEASE directory.
    44 rm -rf $RELEASE
    49 rm -rf $APP_RELEASE
    45 
    50 
    46 # Create new $RELEASE directory.
    51 # Create new $APP_RELEASE directory.
    47 mkdir $RELEASE
    52 mkdir $APP_RELEASE
    48 
    53 
    49 # Create symbolic links.
    54 # Create symbolic links.
    50 for x in $APP_FILES $APP_DIRS $DJANGO_ZIPFILE
    55 for x in $APP_FILES $APP_DIRS $DJANGO_ZIPFILE
    51 do
    56 do
    52     echo $APP_FOLDER/$x $RELEASE/$x
    57     #echo $APP_FOLDER/$x $APP_RELEASE/$x
    53     ln -s $APP_FOLDER/$x $RELEASE/$x
    58     ln -s $APP_FOLDER/$x $APP_RELEASE/$x
    54 done
    59 done
       
    60 
       
    61 echo "Release created in $APP_RELEASE."