Author: tille Date: 2008-11-11 12:55:27 +0000 (Tue, 11 Nov 2008) New Revision: 2650
Removed: trunk/community/infrastructure/scripts/update-tasks Modified: trunk/community/infrastructure/scripts/cronfile trunk/community/infrastructure/scripts/update-website Log: Make sure bugs and tasks directory are not overidden by post-commit hook Modified: trunk/community/infrastructure/scripts/cronfile =================================================================== --- trunk/community/infrastructure/scripts/cronfile 2008-11-11 06:39:40 UTC (rev 2649) +++ trunk/community/infrastructure/scripts/cronfile 2008-11-11 12:55:27 UTC (rev 2650) @@ -5,13 +5,13 @@ BASE=/home/groups/debian-med/ -00 00 * * * $BASE/scripts/update-bugs -00 06 * * * $BASE/scripts/update-bugs -00 12 * * * $BASE/scripts/update-bugs -00 18 * * * $BASE/scripts/update-bugs +#00 00 * * * $BASE/scripts/update-bugs +#00 06 * * * $BASE/scripts/update-bugs +#00 12 * * * $BASE/scripts/update-bugs +#00 18 * * * $BASE/scripts/update-bugs 00 00 * * * $BASE/scripts/update-ddtp-wrapper -00 00 * * * $BASE/scripts/update-tasks-wrapper -00 12 * * * $BASE/scripts/update-tasks-wrapper +#00 00 * * * $BASE/scripts/update-tasks-wrapper +#00 12 * * * $BASE/scripts/update-tasks-wrapper * * * * * $BASE/scripts/check-static 00 * * * * PERL5LIB=$BASE/scripts/qa $BASE/scripts/qa/fetchdata -c $BASE/.debianqa/qa.conf Deleted: trunk/community/infrastructure/scripts/update-tasks =================================================================== --- trunk/community/infrastructure/scripts/update-tasks 2008-11-11 06:39:40 UTC (rev 2649) +++ trunk/community/infrastructure/scripts/update-tasks 2008-11-11 12:55:27 UTC (rev 2650) @@ -1,307 +0,0 @@ -#!/usr/bin/python -W ignore - -# -# This Python script is: -# (C) 2007, David Paleino <[EMAIL PROTECTED]>, -# 2008, David Paleino <[EMAIL PROTECTED]>, Andreas Tille <[EMAIL PROTECTED]> -# -# It is licensed under the terms of GNU General Public License (GPL) -# v3, or any later revision. -# - -from sys import argv, exit, stderr -print "There is a new mechanism to update the tasks pages of all CDDs" -print "Please deactivate your cron job." -print "Just have a look at" -print " http://wiki.debian.org/DebianEdu/Extremadura2008/WebSentinelHowto" -exit(-1) - -import apt -import apt_pkg -import apt_inst -import HTMLTemplate -import re -import os -from stat import S_IWGRP, S_IRUSR, S_IRGRP, S_IWUSR, S_IROTH -import time -from datetime import datetime -from email.Utils import formatdate - -from cddtasktools import CddDependencies, HTMLBASE, REPOS - -CDD='debian-med' - -OUTPUTDIR = { 'debian-med' : HTMLBASE+"/debian-med/static/tasks/", - 'debian-edu' : HTMLBASE+"/cdd/htdocs/edu/tasks/", - 'debian-gis' : HTMLBASE+"/cdd/htdocs/gis/tasks/", - 'debian-junior' : HTMLBASE+"/cdd/htdocs/junior/tasks/", - 'debian-science' : HTMLBASE+"/cdd/htdocs/science/tasks/", - } - -PRINTEDNAME={ 'debian-med' : "Debian Med", - 'debian-edu' : "Debian Edu", - 'debian-gis' : "Debian GIS", - 'debian-junior' : "Debian Junior", - 'debian-science' : "Debian Science", - } - -EMAILLIST = { 'debian-med' : "[EMAIL PROTECTED]", - 'debian-edu' : "[EMAIL PROTECTED]", - 'debian-gis' : "[EMAIL PROTECTED]", - 'debian-junior' : "[EMAIL PROTECTED]", - 'debian-science' : "[EMAIL PROTECTED]", - } - -TEMPLATEDIR = "/var/lib/gforge/chroot/home/groups/debian-med/htdocs/" - -### -# Template handlers -### - -# Do not Encode our strings - we do it ourself and want to take over responsiblity -# for Links etc. -def myEncoder(txt): - # Used to HTML-encode value in 'node.content = value'. - return txt - -# Do not Decode our strings - we do it ourself and want to take over responsiblity -# for Links etc. -def myDecoder(txt): - # Used to HTML-encode value in 'node.content = value'. - return txt - - -def renderIndex(node, tasks): - node.tasks.repeat(renderTaskList, tasks) - t = datetime.now() - node.date.content = formatdate(time.mktime(t.timetuple())) - node.CDD.raw = '<?php $CDD = "%s" ?>' % PRINTEDNAME[CDD] - -def renderTaskList(node, task): - node.task.raw = """<a href="%s.php" name="%s" id="%s">%s</a>""" % (task, task, task, task.capitalize()) - -def renderTasks(node, task, packages, details): - global cdeps - -# node.CDD.content = PRINTEDNAME[CDD] -# node.CDDmail.content = '<a href="mailto:%s">%s mailing list</a>' % (EMAILLIST[CDD], PRINTEDNAME[CDD]) - node.CDD.raw = '<?php $CDD = "%s"; $CDDmail = "%s" ?>' % (PRINTEDNAME[CDD], EMAILLIST[CDD]) - node.task.content = details['Task'] - node.shortdesc.content = details['ShortDesc'] - node.heading.content = details['ShortDesc'] - node.longdesc.content = details['LongDesc'] - - t = datetime.now() - node.date.content = formatdate(time.mktime(t.timetuple())) - - official = cdeps.GetNamesOnlyDict(('official',)) - # for deppkg in cdeps.tasks[task].dependencies['official']: - node.official_head.raw = """<h2> -<a id="official-debs" name="official-debs"></a> - Official Debian packages -</h2>""" - # HTML_Template wants a list as argument so we provide a list of indizes to address - # the list of DependantPackage instances inside renderOfficial - list_of_dependencies = cdeps.GetListOfDepsForTask(task, dependencytypes=('official',)) - node.official.repeat(renderOfficial, - range(len(list_of_dependencies))) - -# if task in todo: -# error = True -# else: -# error = False - - unofficial = cdeps.GetNamesOnlyDict(('unofficial',)) - list_of_dependencies = cdeps.GetListOfDepsForTask(task, dependencytypes=('unofficial',)) - if len(list_of_dependencies) > 0: - node.unofficial_head.raw = """<h2> -<a id="unofficial-debs" name="unofficial-debs"></a> - Experimental or unofficial Debian packages, projects with packaging stuff in SVN -</h2>""" - node.unofficial.repeat(renderUnofficial, range(len(list_of_dependencies))) - # error = False - - prospective = cdeps.GetNamesOnlyDict(('prospective',)) - list_of_dependencies = cdeps.GetListOfDepsForTask(task, dependencytypes=('prospective',)) - if len(list_of_dependencies) > 0: - node.unavailable_head.raw = """<h2> -<a id="debs-not-available" name="debs-not-available"></a> - Debian packages not available -</h2>""" - node.unavailable.repeat(renderProspective, range(len(list_of_dependencies))) - # error = False - -# if error: - # The package probably needs a proper prospective entry in the - # task files. Write it to stdout. -# print "Error: problems with %s" % task - -def renderOfficial(node, package_no): - # Here we parse just official packages - deppkg = cdeps.tasks[task].dependencies['official'][package_no] - - node.shortdesc.content = deppkg.pkgShortDesc - node.project.raw = "<table class=\"project\" summary=\"%s\">" % deppkg.pkg - node.anchor.atts['name'] = deppkg.pkg - node.anchor.atts['id'] = deppkg.pkg - node.name.content = deppkg.pkg.capitalize() - node.url.atts['href'] = deppkg.homepage - if deppkg.homepage == "#": - node.url.content = "Homepage not available" - else: - node.url.content = deppkg.homepage - - node.longdesc.raw = deppkg.pkgLongDesc - node.version.content = "Version: %s" % deppkg.version - if deppkg.license != None: - node.license.content = "License: %s" % deppkg.license - # In case some '&' made it up to this place - node.pkgurl.atts['href'] = deppkg.pkgURL ## .replace("&", "%26") - node.pkgurl.content = "Official Debian package" - node.deburl.atts['href'] = deppkg.filename - #~ node.deburl.content = "X" ### TODO: add a nice icon here to download the .deb package - node.deburl.raw = "<img src=\"/img/deb-icon.png\" />" - if deppkg.responsible: - node.responsible.content = deppkg.responsible - else: - node.responsible.raw = "no one" - - -def renderUnofficial(node, package_no): - # Here we parse just unofficial packages - deppkg = cdeps.tasks[task].dependencies['unofficial'][package_no] - - node.shortdesc.content = deppkg.pkgShortDesc - node.longdesc.raw = deppkg.pkgLongDesc - node.project.raw = "<table class=\"project\" summary=\"%s\">" % deppkg.pkg - node.anchor.atts['name'] = deppkg.pkg - node.anchor.atts['id'] = deppkg.pkg - node.name.content = deppkg.pkg.capitalize() - node.url.atts['href'] = deppkg.homepage - node.url.content = deppkg.homepage - node.license.content = "License: %s" % deppkg.license - # In case some '&' made it up to this place - node.pkgurl.atts['href'] = deppkg.pkgURL ## .replace("&", "%26") - node.pkgurl.content = "Unofficial Debian package" - if deppkg.responsible: - node.responsible.content = deppkg.responsible - else: - node.responsible.raw = "no one" - if deppkg.wnpp: - node.wnpp.raw = " — <a href=\"http://bugs.debian.org/%s\">wnpp</a>" % deppkg.wnpp - - # Let's try to get the version from the package name - # (following Debian standards: <name>_<ver>_<arch>.deb) - regex = ".*/%s_(?P<version>.*)_.*\.deb$" % deppkg.pkg - p = re.compile(regex) - m = p.search(deppkg.pkgURL) - if m: - node.version.content = "Version: %s" % m.group("version") - else: - node.version.content = "Version: N/A" - - -def renderProspective(node, package_no): - # Parsing unavailable packages :( - # PACKAGE THEM! :) - deppkg = cdeps.tasks[task].dependencies['prospective'][package_no] - - if deppkg.pkgShortDesc: - node.shortdesc.content = deppkg.pkgShortDesc - else: - node.shortdesc.content = "N/A" - if deppkg.pkgLongDesc: - node.longdesc.content = deppkg.pkgLongDesc - else: - node.longdesc.content = "N/A" - node.longdesc.raw = deppkg.pkgLongDesc - node.project.raw = "<table class=\"project\" summary=\"%s\">" % deppkg.pkg - if deppkg.responsible: - node.responsible.content = deppkg.responsible - else: - node.responsible.raw = "no one" - if deppkg.wnpp: - node.wnpp.raw = " — <a href=\"http://bugs.debian.org/%s\">wnpp</a>" % deppkg.wnpp - node.anchor.atts['name'] = deppkg.pkg - node.anchor.atts['id'] = deppkg.pkg - node.name.content = deppkg.pkg.capitalize() - if deppkg.homepage: - node.url.atts['href'] = deppkg.homepage - node.url.content = deppkg.homepage - else: - node.url.atts['href'] = "#" - node.url.content = "N/A" - if deppkg.license: - node.license.raw = "<?=_('License')?>: %s" % deppkg.license - else: - node.license.raw = "<?=_('License')?>: N/A" - -if len(argv) <= 1 : - print >>stderr, "Warning: No CDD name given as command line argument. Using %s." % CDD -else: - if argv[1] not in REPOS.keys(): - print >>stderr, "Unknown CDD name: %s. Don't know what to do." % CDD - exit(-1) - CDD = argv[1] - -cdeps=CddDependencies(CDD) -cdeps.GetAllDependencies() - -# Let's render the Tasks Page index, first -f = open(TEMPLATEDIR + "tasks_idx.tmpl") -tmpl = HTMLTemplate.Template(renderIndex, f.read(), codecs=(None,None)) ##myEncoder, myDecoder)) -f.close() - -# Make sure OUTPUTDIR exists -if not os.access(OUTPUTDIR[CDD], os.W_OK): - try: - os.makedirs(OUTPUTDIR[CDD]) - print "Created output dir " + OUTPUTDIR[CDD] - except: - print >> stderr, "Unable to create output directory", OUTPUTDIR[CDD] - -outputfile = OUTPUTDIR[CDD] + "index.php" -# Remove the file first, to enable other users to change permissions easily -try: - os.unlink(outputfile) -except: - # don't fail if there is nothing to remove (if a new CDD get's added) - pass - -f = open(outputfile, "w") - -tasks = cdeps.tasknames -packages = cdeps.GetNamesOnlyDict() -task_details = cdeps.GetTaskDescDict() - -f.write(tmpl.render(tasks)) -f.close() -try: - os.chmod(outputfile,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH) -except: - # chmod is not allowed to other peoples files - pass - -# Let's render single pages now. -f = open(TEMPLATEDIR + "tasks.tmpl") -tmpl = HTMLTemplate.Template(renderTasks, f.read()) -f.close() - -for task in tasks: - outputfile = OUTPUTDIR[CDD] + task + '.php' - try: - os.unlink(outputfile) - except: # simply continue if file does not exist - pass - f = open(outputfile, "w") - - # This is to avoid useless <br>eaks before closing the cell - source = tmpl.render(task, packages[task], task_details[task]) - f.write(re.sub(r"<br /><br />[ ]*</td>", "</td>", source)) - - f.close() - try: - chmod(outputfile,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH) - except: - # chmod is not allowed to other peoples files - pass Modified: trunk/community/infrastructure/scripts/update-website =================================================================== --- trunk/community/infrastructure/scripts/update-website 2008-11-11 06:39:40 UTC (rev 2649) +++ trunk/community/infrastructure/scripts/update-website 2008-11-11 12:55:27 UTC (rev 2650) @@ -8,7 +8,16 @@ BASE=/var/lib/gforge/chroot/home/groups/debian-med echo "Updating website... rev. $REV" -mv $BASE/htdocs/* $BASE/htdocs-backup/ && rm -rf $BASE/htdocs/* +for tomove in `find $BASE/htdocs -maxdepth 1 -mindepth 1` ; do + case "`basename $tomove`" in + "bugs"|"tasks") + echo "Do not move bugs or tasks" + ;; + *) + mv "$tomove" $BASE/htdocs-backup/ + ;; + esac +done svn --force export $URL_REPOS $BASE/htdocs/ [ "x$?" == "x0" ] && rm -rf $BASE/htdocs-backup/* _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/debian-med-commit
