diff options
author | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2009-02-17 22:36:25 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2009-02-17 22:44:37 +0530 |
commit | 003d4780cfe5c84107d4ee7d94c3b3fba24c57c1 (patch) | |
tree | 184a1a6fcc57b5aaf86863317d0b4e0147562525 | |
parent | Update autotua-slave with ~amd64 KEYWORD (diff) | |
download | autotua-003d4780cfe5c84107d4ee7d94c3b3fba24c57c1.tar.gz autotua-003d4780cfe5c84107d4ee7d94c3b3fba24c57c1.tar.bz2 autotua-003d4780cfe5c84107d4ee7d94c3b3fba24c57c1.zip |
Use `make` for autotua-master
* The main reason for this build-system is the absence of librsvg on most
servers where autotua-master will be built. Hence, `make dist` will generate
.pngs for the tarball
* You need to specify the versions only in Makefile/setup.py now
* Tarball creation support => we can have an ebuild for autotua-master based on
the webapp eclass
* New build systems -> 96x96 images are now suffixed with "-large"
- Fix master/master/templates/frontpage.html for new images
* `make dist` ftw!
- Update scripts/do-release.sh for changes
- Also fix a few bugs
- And remove "scp" support (manual > automatic)
-rw-r--r-- | master/.gitignore | 2 | ||||
-rw-r--r-- | master/Makefile | 31 | ||||
-rw-r--r-- | master/icons/Makefile | 25 | ||||
-rw-r--r-- | master/master/templates/frontpage.html | 8 | ||||
-rwxr-xr-x | master/setup-master.py | 43 | ||||
-rwxr-xr-x | scripts/do-release.sh | 42 |
6 files changed, 102 insertions, 49 deletions
diff --git a/master/.gitignore b/master/.gitignore new file mode 100644 index 0000000..9ddbdf9 --- /dev/null +++ b/master/.gitignore @@ -0,0 +1,2 @@ +.dist/ +build/ diff --git a/master/Makefile b/master/Makefile new file mode 100644 index 0000000..df95c24 --- /dev/null +++ b/master/Makefile @@ -0,0 +1,31 @@ +# Copyright: 2008-09 Gentoo Foundation +# Author(s): Nirbheek Chauhan <nirbheek.chauhan@gmail.com> +# License: AGPL-3 +# + +INSTALL := install +DISTDIR := .dist/ +BLDDIR := build/ +PN := autotua-master +PV := 0.0.2 +P := $(PN)-$(PV) +SUBDIRS := icons +MAKE := make + +all: + for dir in $(SUBDIRS) ; do ( cd $$dir ; $(MAKE) all ) ; done + +dist: + mkdir -p $(DISTDIR) + git archive --format=tar --prefix=$(P)/ HEAD | tar x -C $(DISTDIR) + cp icons/*.png $(DISTDIR)/$(P)/icons/ + tar -C $(DISTDIR) -cjf $(P).tar.bz2 $(P)/ + rm -rf $(DISTDIR) + +clean: + rm -rf $(BLDDIR) $(DISTDIR) + for dir in $(SUBDIRS) ; do ( cd $$dir ; $(MAKE) clean ) ; done + +install: all + test -n "$(DESTDIR)" || ( echo "Please define DESTDIR" ; exit 1 ) + ./setup-master.py install --final $(DESTDIR) diff --git a/master/icons/Makefile b/master/icons/Makefile index 736d2f5..04df378 100644 --- a/master/icons/Makefile +++ b/master/icons/Makefile @@ -3,19 +3,24 @@ # License: AGPL-3 # -INSTALL=install -CONVERT=rsvg-convert --height=96 -CONVERT_MEDIUM=rsvg-convert --height=48 -IMGS=jobs.png master.png slaves.png users.png -IMGS_MEDIUM=autotua.png home.png login.png logout.png password.png -IMGMODE=644 +INSTALL := install +CONVERT := rsvg-convert +SIMGS := autotua.svg home.svg login.svg logout.svg password.svg +SIMGS_L := jobs.svg master.svg slaves.svg users.svg +IMGS := $(SIMGS:.svg=.png) +IMGS_L := $(SIMGS_L:.svg=-large.png) +IMGMODE := 644 -all: - for img in ${IMGS}; do ${CONVERT} -o $$img $${img%.png}.svg; done - for img in ${IMGS_MEDIUM}; do ${CONVERT_MEDIUM} -o $$img $${img%.png}.svg; done +%.png: %.svg + $(CONVERT) --height=48 -o $@ $< + +%-large.png: %.svg + $(CONVERT) --height=96 -o $@ $< + +all: $(IMGS) $(IMGS_L) clean: - rm -f ${IMGS} ${IMGS_MEDIUM} + rm -f *.png install: all test -n "${DESTDIR}" || ( echo "Please define DESTDIR" ; exit 1 ) diff --git a/master/master/templates/frontpage.html b/master/master/templates/frontpage.html index dd951ad..9bdef2c 100644 --- a/master/master/templates/frontpage.html +++ b/master/master/templates/frontpage.html @@ -11,9 +11,9 @@ {% endblock %} {% block content %} <div id="pieces"> - <a href=""><img src="{{ media_prefix }}images/master.png" title="Status of the master server"/></a> - <a href=""><img src="{{ media_prefix }}images/slaves.png" title="Status of slaves"/></a> - <a href="jobs/"><img src="{{ media_prefix }}images/jobs.png" title="Status of jobs"/></a> - <a href=""><img src="{{ media_prefix }}images/users.png" title="Search for users"/></a> + <a href=""><img src="{{ media_prefix }}images/master-large.png" title="Status of the master server"/></a> + <a href=""><img src="{{ media_prefix }}images/slaves-large.png" title="Status of slaves"/></a> + <a href="jobs/"><img src="{{ media_prefix }}images/jobs-large.png" title="Status of jobs"/></a> + <a href=""><img src="{{ media_prefix }}images/users-large.png" title="Search for users"/></a> </div> {% endblock %} diff --git a/master/setup-master.py b/master/setup-master.py index e74931e..78e73e7 100755 --- a/master/setup-master.py +++ b/master/setup-master.py @@ -6,6 +6,7 @@ # # Immortal lh! # +# FIXME: This is so fucking ugly. import sys, os, shutil try: @@ -22,6 +23,7 @@ if os.environ.has_key('PYTHONPATH'): DESTDIR = 'autotua_master' SYMLINKS = True +srcdir = None def print_help(): print \ @@ -150,34 +152,47 @@ def setup_sample_job(): job.slaves.add(Slave.objects.get(name=sample_job['slave'])) job.save() +def setup_dirs(dir): + """This must be called before doing anything else.""" + # cd to setup-master.py location + os.chdir(os.path.dirname(sys.argv[0])) + # Store the current directory + # We cd and store to work around relative invocations + global srcdir + srcdir = os.getcwd() + + if not os.path.isdir(dir): + os.makedirs(dir) + os.chdir(dir) + sys.path.append(os.getcwd()) + + # Add cwd+/custom + sys.path.append(srcdir+'/custom') + ### Start Work ### if len(sys.argv) < 3: print_help() sys.exit(1) -# cd to setup-master.py location -os.chdir(os.path.dirname(sys.argv[0])) -# Store the current directory -# We cd and store to work around relative invocations -srcdir = os.getcwd() -if not os.path.isdir(sys.argv[2]): - os.makedirs(sys.argv[2]) -os.chdir(sys.argv[2]) - if management.get_version() < '0.99': print "You need django-1.0 to use this." sys.exit(1) -sys.path.append(os.getcwd()) -# Add cwd+/custom -sys.path.append(srcdir+'/custom') - if sys.argv[1] == 'install': + if sys.argv[2] == '--final': + where = os.path.dirname(sys.argv[3].rstrip('/')) + DESTDIR = os.path.basename(sys.argv[3].rstrip('/')) + elif sys.argv[1] == 'install': + where = os.path.dirname(sys.argv[2].rstrip('/')) + setup_dirs(where) install_master() print """Setup done. Now you need to edit the database settings in %(dest)s/settings.py -and run `./setup-master.py syncdb %(dest)s`""" % { 'dest': os.path.join(sys.argv[2], DESTDIR) } +and run `./setup-master.py syncdb %(dest)s`""" % { 'dest': os.path.join(where, DESTDIR) } elif sys.argv[1] == 'syncdb': + # Setup the relevant directories + where = os.path.dirname(sys.argv[2].rstrip('/')) + setup_dirs(where) # Import stuff import settings from django.core.management import setup_environ diff --git a/scripts/do-release.sh b/scripts/do-release.sh index 21ee0db..e98acf3 100755 --- a/scripts/do-release.sh +++ b/scripts/do-release.sh @@ -1,21 +1,19 @@ #!/bin/bash +# vim: set sw=4 sts=4 et : set -e -V="${1}" -W="${2}" +W="${1}" RDIR='/home/nirbheek/projects/AutotuA/releases' REPO='/home/nirbheek/projects/AutotuA/autotua.git' TMPDIR='/tmp/autotua-release' -DESTDIR="${RDIR}/${V}" -REMOTE="bheekling@dev.gentooexperimental.org:~/public_html/files/autotua/" +DESTDIR="${RDIR}/" -test -z ${V} && echo "Specify version plz, kthx." && exit 1 test -z ${W} && echo "Specify what to release" && exit 1 rm -rf "${TMPDIR}" -mkdir "${TMPDIR}" -test -d "${DESTDIR}" || mkdir "${DESTDIR}" +mkdir -p "${TMPDIR}" +mkdir -p "${DESTDIR}" confirm_overwrite() { if test -e "${DESTDIR}/${FILE}"; then @@ -29,37 +27,40 @@ confirm_overwrite() { } release_master() { - P="autotua-master-${V}" - FILE="${P}.tar.gz" - confirm_overwrite cd "${REPO}/master" - git archive --prefix=${P}/ HEAD * | gzip -9 > "${DESTDIR}/${FILE}" + V="$(grep '^PV[[:space:]]*\:=' Makefile)" + V=${V##*:= } + P="autotua-master-${V}" + FILE="${P}.tar.bz2" + mkdir -p "${DESTDIR}/${V}" + make dist + mv "${FILE}" "${DESTDIR}/${V}" } release_slave() { + cd "${REPO}/slave" + V=$(grep '^[[:space:]]*version=' setup.py) + V=${V##*version=\'} + V=${V%%\',*} P="autotua-slave-${V}" FILE="${P}.tar.gz" + mkdir -p "${DESTDIR}/${V}" confirm_overwrite - cd "${REPO}/slave" git archive --prefix=${P}/ HEAD * | tar x -C "${TMPDIR}" cd "${TMPDIR}/${P}" ./setup.py --quiet sdist - cp "dist/${FILE}" "${DESTDIR}" + cp "dist/${FILE}" "${DESTDIR}/${V}" rm -rf "${TMPDIR}/${P}" } -upload_archives() { - scp -r "${DESTDIR}" "${REMOTE}" -} - bumb_ebuild() { CATEG='dev-util' PN='autotua-slave' P="${PN}-${V}" cd "${REPO}/overlay/${CATEG}/${PN}" - test -f ${P}.ebuild || mv $(echo ${PN}-*.ebuild | line ) ${P}.ebuild - sed -i -e "/${P}.tar.gz/d" Manifest - rm -f "/usr/portage/distfiles/${P}.tar.gz" + test -f ${P}.ebuild || cp $(echo ${PN}-*.ebuild | tr ' ' '\n' | line ) ${P}.ebuild + sed -i -e "/${P}/d" Manifest + rm -f "/usr/portage/distfiles/${P}.tar.bz2" ebuild ${P}.ebuild digest } @@ -76,4 +77,3 @@ else echo "Please specify which to release (slave|master|both)" exit 1 fi -upload_archives |