scripts/make_release.sh
changeset 909 2ea33b2bd056
parent 908 8f7e89cacd2e
child 910 384e55e48706
equal deleted inserted replaced
908:8f7e89cacd2e 909:2ea33b2bd056
     1 #!/bin/bash
       
     2 
       
     3 # Script to create a "release" subdirectory.  This is a subdirectory
       
     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
       
     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
       
     8 # actually need to be uploaded, they still add to the work done for
       
     9 # each update.
       
    10 
       
    11 DEFAULT_APP_RELEASE=../release
       
    12 DEFAULT_APP_FOLDER="../app"
       
    13 DEFAULT_APP_FILES="app.yaml index.yaml __init__.py main.py settings.py urls.py"
       
    14 DEFAULT_APP_DIRS="soc ghop gsoc feedparser python25src reflistprop jquery"
       
    15 DEFAULT_ZIP_FILES="tiny_mce.zip"
       
    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}"}
       
    21 ZIP_FILES=${ZIP_FILES:-"${DEFAULT_ZIP_FILES}"}
       
    22 
       
    23 cd $APP_FOLDER
       
    24 
       
    25 # Remove old zip files (and django.zip in its old location)
       
    26 rm -rf $ZIP_FILES django.zip
       
    27 
       
    28 # Remove old $APP_RELEASE directory.
       
    29 rm -rf $APP_RELEASE
       
    30 
       
    31 # Create new $APP_RELEASE directory.
       
    32 mkdir $APP_RELEASE
       
    33 
       
    34 # Create new django.zip file, but directly in the $APP_RELEASE directory,
       
    35 # rather than in $APP_FOLDER and creating a symlink in $APP_RELEASE.  This
       
    36 # keeps the presence of a django.zip file in the app/ folder from breaking
       
    37 # debugging into app/django.
       
    38 #
       
    39 # We prune:
       
    40 # - .svn subdirectories for obvious reasons.
       
    41 # - contrib/gis/ and related files because it's huge and unneeded.
       
    42 # - *.po and *.mo files because they are bulky and unneeded.
       
    43 # - *.pyc and *.pyo because they aren't used by App Engine anyway.
       
    44 
       
    45 zip -q "$APP_RELEASE/django.zip" `find django \
       
    46     -name .svn -prune -o \
       
    47     -name gis -prune -o \
       
    48     -name admin -prune -o \
       
    49     -name localflavor -prune -o \
       
    50     -name mysql -prune -o \
       
    51     -name mysql_old -prune -o \
       
    52     -name oracle -prune -o \
       
    53     -name postgresql-prune -o \
       
    54     -name postgresql_psycopg2 -prune -o \
       
    55     -name sqlite3 -prune -o \
       
    56     -name test -prune -o \
       
    57     -type f ! -name \*.py[co] ! -name *.[pm]o -print`
       
    58 
       
    59 # Create new tiny_mce.zip file.
       
    60 #
       
    61 # We prune:
       
    62 # - .svn subdirectories for obvious reasons.
       
    63 
       
    64 # zipserve requires tiny_mce/* to be in root of zip file
       
    65 pushd tiny_mce > /dev/null
       
    66 zip -q ../tiny_mce.zip `find . \
       
    67     -name .svn -prune -o \
       
    68     -type f -print`
       
    69 popd > /dev/null
       
    70 
       
    71 # Create symbolic links.
       
    72 for x in $APP_FILES $APP_DIRS $ZIP_FILES
       
    73 do
       
    74     ln -s $APP_FOLDER/$x $APP_RELEASE/$x
       
    75 done
       
    76 
       
    77 echo "Release created in $APP_RELEASE."
       
    78