scripts/build.sh
author Lennard de Rijk <ljvderijk@gmail.com>
Fri, 23 Jan 2009 11:34:58 +0000
changeset 915 27c656c01591
parent 910 384e55e48706
child 976 d1a9c7179bbb
permissions -rwxr-xr-x
Added verbose role name to the request model. 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"
570
cbd07fbdc125 Remove polymodel folder from DEFAULT_APP_DIRS variable in make_release script.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 463
diff changeset
    14
DEFAULT_APP_DIRS="soc ghop gsoc feedparser python25src reflistprop jquery"
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
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
    23
cd $APP_FOLDER
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
    24
9ed9bf2814ef Make django.zip in release/, instead of in app/ with a symlink in release/.
Todd Larsen <tlarsen@google.com>
parents: 160
diff changeset
    25
# 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
    26
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
    27
910
384e55e48706 Change build.sh to create a build/ output directory (rather than release/).
Todd Larsen <tlarsen@google.com>
parents: 909
diff changeset
    28
# 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
    29
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
    30
910
384e55e48706 Change build.sh to create a build/ output directory (rather than release/).
Todd Larsen <tlarsen@google.com>
parents: 909
diff changeset
    31
# 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
    32
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
    33
910
384e55e48706 Change build.sh to create a build/ output directory (rather than release/).
Todd Larsen <tlarsen@google.com>
parents: 909
diff changeset
    34
# 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
    35
# 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
    36
# 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
    37
# 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
    38
#
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
    39
# 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
    40
# - .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
    41
# - 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
    42
# - *.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
    43
# - *.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
    44
910
384e55e48706 Change build.sh to create a build/ output directory (rather than release/).
Todd Larsen <tlarsen@google.com>
parents: 909
diff changeset
    45
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
    46
    -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
    47
    -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
    48
    -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
    49
    -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
    50
    -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
    51
    -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
    52
    -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
    53
    -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
    54
    -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
    55
    -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
    56
    -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
    57
    -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
    58
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
    59
# 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
    60
#
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
    61
# 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
    62
# - .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
    63
160
269462f166ef Explain why pushd and popd are needed when making tiny_mce.zip.
Todd Larsen <tlarsen@google.com>
parents: 159
diff changeset
    64
# 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
    65
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
    66
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
    67
    -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
    68
    -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
    69
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
    70
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
    71
# 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
    72
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
    73
do
910
384e55e48706 Change build.sh to create a build/ output directory (rather than release/).
Todd Larsen <tlarsen@google.com>
parents: 909
diff changeset
    74
    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
    75
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
    76
910
384e55e48706 Change build.sh to create a build/ output directory (rather than release/).
Todd Larsen <tlarsen@google.com>
parents: 909
diff changeset
    77
echo "Build results in $APP_BUILD."
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
    78