scripts/build.sh
author Lennard de Rijk <ljvderijk@gmail.com>
Sun, 15 Mar 2009 20:27:50 +0000
changeset 1883 ce564c03d90a
parent 1808 f6ec0f486247
child 2227 ffc909238df5
permissions -rwxr-xr-x
The StudentProposal review view now also allow you to subscribe to public/private reviews. Note that message sending is not yet implemented. Also moved the other GET parameter stuff into ReviewGet method. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
158
2d5a7c18f9ea Updated make_release.sh docs and added way for person invoking the script to override script variables such as RELEASE using something like "RELEASE=../testing_release ./make_release.sh".
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 157
diff changeset
     1
#!/bin/bash
144
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     2
910
384e55e48706 Change build.sh to create a build/ output directory (rather than release/).
Todd Larsen <tlarsen@google.com>
parents: 909
diff changeset
     3
# Script to create a "build" subdirectory.  This is a subdirectory
144
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     4
# containing a bunch of symlinks, from which the app can be updated.
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     5
# The main reason for this is to import Django from a zipfile, which
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     6
# saves dramatically in upload time: statting and computing the SHA1
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     7
# for 1000s of files is slow.  Even if most of those files don't
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     8
# actually need to be uploaded, they still add to the work done for
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     9
# each update.
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    10
910
384e55e48706 Change build.sh to create a build/ output directory (rather than release/).
Todd Larsen <tlarsen@google.com>
parents: 909
diff changeset
    11
DEFAULT_APP_BUILD=../build
158
2d5a7c18f9ea Updated make_release.sh docs and added way for person invoking the script to override script variables such as RELEASE using something like "RELEASE=../testing_release ./make_release.sh".
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 157
diff changeset
    12
DEFAULT_APP_FOLDER="../app"
2d5a7c18f9ea Updated make_release.sh docs and added way for person invoking the script to override script variables such as RELEASE using something like "RELEASE=../testing_release ./make_release.sh".
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 157
diff changeset
    13
DEFAULT_APP_FILES="app.yaml index.yaml __init__.py main.py settings.py urls.py"
1731
254375a57d62 Add json2.js to repository under json folder, update build script and app.yaml.template files.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 1675
diff changeset
    14
DEFAULT_APP_DIRS="soc ghop gsoc feedparser python25src reflistprop jquery ranklist json"
175
9ed9bf2814ef Make django.zip in release/, instead of in app/ with a symlink in release/.
Todd Larsen <tlarsen@google.com>
parents: 160
diff changeset
    15
DEFAULT_ZIP_FILES="tiny_mce.zip"
158
2d5a7c18f9ea Updated make_release.sh docs and added way for person invoking the script to override script variables such as RELEASE using something like "RELEASE=../testing_release ./make_release.sh".
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 157
diff changeset
    16
910
384e55e48706 Change build.sh to create a build/ output directory (rather than release/).
Todd Larsen <tlarsen@google.com>
parents: 909
diff changeset
    17
APP_BUILD=${APP_BUILD:-"${DEFAULT_APP_BUILD}"}
158
2d5a7c18f9ea Updated make_release.sh docs and added way for person invoking the script to override script variables such as RELEASE using something like "RELEASE=../testing_release ./make_release.sh".
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 157
diff changeset
    18
APP_FOLDER=${APP_FOLDER:-"${DEFAULT_APP_FOLDER}"}
2d5a7c18f9ea Updated make_release.sh docs and added way for person invoking the script to override script variables such as RELEASE using something like "RELEASE=../testing_release ./make_release.sh".
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 157
diff changeset
    19
APP_FILES=${APP_FILES:-"${DEFAULT_APP_FILES}"}
2d5a7c18f9ea Updated make_release.sh docs and added way for person invoking the script to override script variables such as RELEASE using something like "RELEASE=../testing_release ./make_release.sh".
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 157
diff changeset
    20
APP_DIRS=${APP_DIRS:-"${DEFAULT_APP_DIRS}"}
159
451f39c0e1aa Use zip to compress tiny_mce, and use zipserve to serve it in Google App
Todd Larsen <tlarsen@google.com>
parents: 158
diff changeset
    21
ZIP_FILES=${ZIP_FILES:-"${DEFAULT_ZIP_FILES}"}
144
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    22
1808
f6ec0f486247 build.sh: bail if run in the wrong directory.
Augie Fackler <durin42@gmail.com>
parents: 1731
diff changeset
    23
if [ -e $APP_FOLDER ] ; then
f6ec0f486247 build.sh: bail if run in the wrong directory.
Augie Fackler <durin42@gmail.com>
parents: 1731
diff changeset
    24
    cd $APP_FOLDER
f6ec0f486247 build.sh: bail if run in the wrong directory.
Augie Fackler <durin42@gmail.com>
parents: 1731
diff changeset
    25
else
f6ec0f486247 build.sh: bail if run in the wrong directory.
Augie Fackler <durin42@gmail.com>
parents: 1731
diff changeset
    26
    echo 'This script must be run from within the scripts directory!'
f6ec0f486247 build.sh: bail if run in the wrong directory.
Augie Fackler <durin42@gmail.com>
parents: 1731
diff changeset
    27
    exit 1
f6ec0f486247 build.sh: bail if run in the wrong directory.
Augie Fackler <durin42@gmail.com>
parents: 1731
diff changeset
    28
fi
175
9ed9bf2814ef Make django.zip in release/, instead of in app/ with a symlink in release/.
Todd Larsen <tlarsen@google.com>
parents: 160
diff changeset
    29
9ed9bf2814ef Make django.zip in release/, instead of in app/ with a symlink in release/.
Todd Larsen <tlarsen@google.com>
parents: 160
diff changeset
    30
# Remove old zip files (and django.zip in its old location)
9ed9bf2814ef Make django.zip in release/, instead of in app/ with a symlink in release/.
Todd Larsen <tlarsen@google.com>
parents: 160
diff changeset
    31
rm -rf $ZIP_FILES django.zip
9ed9bf2814ef Make django.zip in release/, instead of in app/ with a symlink in release/.
Todd Larsen <tlarsen@google.com>
parents: 160
diff changeset
    32
910
384e55e48706 Change build.sh to create a build/ output directory (rather than release/).
Todd Larsen <tlarsen@google.com>
parents: 909
diff changeset
    33
# Remove old $APP_BUILD directory.
384e55e48706 Change build.sh to create a build/ output directory (rather than release/).
Todd Larsen <tlarsen@google.com>
parents: 909
diff changeset
    34
rm -rf $APP_BUILD
144
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    35
910
384e55e48706 Change build.sh to create a build/ output directory (rather than release/).
Todd Larsen <tlarsen@google.com>
parents: 909
diff changeset
    36
# Create new $APP_BUILD directory.
384e55e48706 Change build.sh to create a build/ output directory (rather than release/).
Todd Larsen <tlarsen@google.com>
parents: 909
diff changeset
    37
mkdir $APP_BUILD
175
9ed9bf2814ef Make django.zip in release/, instead of in app/ with a symlink in release/.
Todd Larsen <tlarsen@google.com>
parents: 160
diff changeset
    38
910
384e55e48706 Change build.sh to create a build/ output directory (rather than release/).
Todd Larsen <tlarsen@google.com>
parents: 909
diff changeset
    39
# Create new django.zip file, but directly in the $APP_BUILD directory,
384e55e48706 Change build.sh to create a build/ output directory (rather than release/).
Todd Larsen <tlarsen@google.com>
parents: 909
diff changeset
    40
# rather than in $APP_FOLDER and creating a symlink in $APP_BUILD.  This
175
9ed9bf2814ef Make django.zip in release/, instead of in app/ with a symlink in release/.
Todd Larsen <tlarsen@google.com>
parents: 160
diff changeset
    41
# keeps the presence of a django.zip file in the app/ folder from breaking
9ed9bf2814ef Make django.zip in release/, instead of in app/ with a symlink in release/.
Todd Larsen <tlarsen@google.com>
parents: 160
diff changeset
    42
# debugging into app/django.
9ed9bf2814ef Make django.zip in release/, instead of in app/ with a symlink in release/.
Todd Larsen <tlarsen@google.com>
parents: 160
diff changeset
    43
#
144
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    44
# We prune:
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    45
# - .svn subdirectories for obvious reasons.
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    46
# - contrib/gis/ and related files because it's huge and unneeded.
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    47
# - *.po and *.mo files because they are bulky and unneeded.
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    48
# - *.pyc and *.pyo because they aren't used by App Engine anyway.
150
715b07485c48 Changed ZIPFILE variable to DJANGO_ZIPFILE in make_release.sh script and added 'cd $APP_FOLDER' before we zip django.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 144
diff changeset
    49
910
384e55e48706 Change build.sh to create a build/ output directory (rather than release/).
Todd Larsen <tlarsen@google.com>
parents: 909
diff changeset
    50
zip -q "$APP_BUILD/django.zip" `find django \
144
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    51
    -name .svn -prune -o \
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    52
    -name gis -prune -o \
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    53
    -name admin -prune -o \
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    54
    -name localflavor -prune -o \
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    55
    -name mysql -prune -o \
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    56
    -name mysql_old -prune -o \
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    57
    -name oracle -prune -o \
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    58
    -name postgresql-prune -o \
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    59
    -name postgresql_psycopg2 -prune -o \
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    60
    -name sqlite3 -prune -o \
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    61
    -name test -prune -o \
150
715b07485c48 Changed ZIPFILE variable to DJANGO_ZIPFILE in make_release.sh script and added 'cd $APP_FOLDER' before we zip django.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 144
diff changeset
    62
    -type f ! -name \*.py[co] ! -name *.[pm]o -print`
144
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    63
159
451f39c0e1aa Use zip to compress tiny_mce, and use zipserve to serve it in Google App
Todd Larsen <tlarsen@google.com>
parents: 158
diff changeset
    64
# Create new tiny_mce.zip file.
175
9ed9bf2814ef Make django.zip in release/, instead of in app/ with a symlink in release/.
Todd Larsen <tlarsen@google.com>
parents: 160
diff changeset
    65
#
159
451f39c0e1aa Use zip to compress tiny_mce, and use zipserve to serve it in Google App
Todd Larsen <tlarsen@google.com>
parents: 158
diff changeset
    66
# We prune:
451f39c0e1aa Use zip to compress tiny_mce, and use zipserve to serve it in Google App
Todd Larsen <tlarsen@google.com>
parents: 158
diff changeset
    67
# - .svn subdirectories for obvious reasons.
451f39c0e1aa Use zip to compress tiny_mce, and use zipserve to serve it in Google App
Todd Larsen <tlarsen@google.com>
parents: 158
diff changeset
    68
160
269462f166ef Explain why pushd and popd are needed when making tiny_mce.zip.
Todd Larsen <tlarsen@google.com>
parents: 159
diff changeset
    69
# zipserve requires tiny_mce/* to be in root of zip file
159
451f39c0e1aa Use zip to compress tiny_mce, and use zipserve to serve it in Google App
Todd Larsen <tlarsen@google.com>
parents: 158
diff changeset
    70
pushd tiny_mce > /dev/null
451f39c0e1aa Use zip to compress tiny_mce, and use zipserve to serve it in Google App
Todd Larsen <tlarsen@google.com>
parents: 158
diff changeset
    71
zip -q ../tiny_mce.zip `find . \
451f39c0e1aa Use zip to compress tiny_mce, and use zipserve to serve it in Google App
Todd Larsen <tlarsen@google.com>
parents: 158
diff changeset
    72
    -name .svn -prune -o \
451f39c0e1aa Use zip to compress tiny_mce, and use zipserve to serve it in Google App
Todd Larsen <tlarsen@google.com>
parents: 158
diff changeset
    73
    -type f -print`
451f39c0e1aa Use zip to compress tiny_mce, and use zipserve to serve it in Google App
Todd Larsen <tlarsen@google.com>
parents: 158
diff changeset
    74
popd > /dev/null
451f39c0e1aa Use zip to compress tiny_mce, and use zipserve to serve it in Google App
Todd Larsen <tlarsen@google.com>
parents: 158
diff changeset
    75
144
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    76
# Create symbolic links.
159
451f39c0e1aa Use zip to compress tiny_mce, and use zipserve to serve it in Google App
Todd Larsen <tlarsen@google.com>
parents: 158
diff changeset
    77
for x in $APP_FILES $APP_DIRS $ZIP_FILES
144
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    78
do
910
384e55e48706 Change build.sh to create a build/ output directory (rather than release/).
Todd Larsen <tlarsen@google.com>
parents: 909
diff changeset
    79
    ln -s $APP_FOLDER/$x $APP_BUILD/$x
144
53d8b8064019 Release shell script and associated changes. Set svn:ignore property on /app/django.zip file and /release folder.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    80
done
158
2d5a7c18f9ea Updated make_release.sh docs and added way for person invoking the script to override script variables such as RELEASE using something like "RELEASE=../testing_release ./make_release.sh".
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 157
diff changeset
    81
910
384e55e48706 Change build.sh to create a build/ output directory (rather than release/).
Todd Larsen <tlarsen@google.com>
parents: 909
diff changeset
    82
echo "Build results in $APP_BUILD."