[med-svn] r1675 - trunk/community/infrastructure/scripts
tille at alioth.debian.org
tille at alioth.debian.org
Mon Mar 31 15:17:41 UTC 2008
Author: tille
Date: 2008-03-31 15:17:41 +0000 (Mon, 31 Mar 2008)
New Revision: 1675
Modified:
trunk/community/infrastructure/scripts/cddtasktools.py
trunk/community/infrastructure/scripts/update-tasks
Log:
Do not query SVN more than necessary; Handle 'Ignore' / 'Avoids' keys of Debian-Edu reasonably; Handle non-RFC822 conform '\'-ending lines correctly
Modified: trunk/community/infrastructure/scripts/cddtasktools.py
===================================================================
--- trunk/community/infrastructure/scripts/cddtasktools.py 2008-03-31 12:01:58 UTC (rev 1674)
+++ trunk/community/infrastructure/scripts/cddtasktools.py 2008-03-31 15:17:41 UTC (rev 1675)
@@ -32,7 +32,7 @@
'debian-science' : SVNHOST+"/svn/cdd/projects/science/trunk/debian-science/tasks/",
}
HTMLBASE = "/var/lib/gforge/chroot/home/groups"
-KEYSTOIGNORE = ( 'Architecture', 'Avoid', 'Ignore', 'Leaf', 'NeedConfig', 'Note', 'Section' )
+KEYSTOIGNORE = ( 'Architecture', 'Leaf', 'NeedConfig', 'Note', 'Section' )
GLOBALCACHE = "/var/cache/cdd/"
DDTPURL = "http://ddtp.debian.net/debian/dists/"
DDTPDIR = "/i18n/Translation-"
@@ -104,7 +104,7 @@
self.cddname = cddname # CDD that includes the package in dependency list
self.taskname = taskname # Task which includes the Dependency
self.pkg = None # Name of dependant package
- self.dependencytype = None # Values: 'Depends', 'Recommends', 'Suggests'
+ self.dep_strength = None # Values: 'Depends', 'Recommends', 'Suggests', 'Ignore', 'Avoid'
self.dists = [] # Values: 'stable', 'testing', 'unstable', etc.
self.component = {} # Values: 'main', 'contrib', 'non-free', 'experimental'
@@ -169,7 +169,7 @@
if self.tasknames == []:
self.GetTasknames()
for task in self.tasknames:
- td = TaskDependencies(self.cddname, task)
+ td = TaskDependencies(self.cddname, task=task, tasksdir=self.tasksdir)
td.GetTaskDependencies()
self.tasks[task] = td
@@ -265,7 +265,7 @@
if languages == ():
return
- # Make sure that cache directory fpr DDTP translations exists and is writable
+ # Make sure that cache directory for DDTP translations exists and is writable
cachedir = GLOBALCACHE
if not os.access(cachedir, os.W_OK):
try:
@@ -305,13 +305,16 @@
class TaskDependencies:
# List of depencencies defined in one Metapackage
- def __init__(self, cddname, task):
+ def __init__(self, cddname, task, tasksdir=None):
if cddname not in REPOS.keys():
print >>stderr, "Unknown CDD."
return None
self.cddname = cddname
- self.tasksdir = InitTasksFiles(self.cddname)
+ if tasksdir != None:
+ self.tasksdir = tasksdir
+ else:
+ self.tasksdir = InitTasksFiles(self.cddname)
self.taskfile = self.tasksdir+'/'+task
if os.path.isfile(self.taskfile):
self.task = task
@@ -340,7 +343,7 @@
# These keys might contain more than one item that
# has to be separated to detect the dependency
- dependency_keys = [ "Depends", "Recommends", "Suggests" ]
+ dep_strength_keys = [ 'Depends', 'Recommends', 'Suggests', 'Ignore', 'Avoid' ]
f = file(self.taskfile)
for stanza in deb822.Sources.iter_paragraphs(f):
@@ -366,10 +369,15 @@
dep.responsible = responsible
continue
- if key in dependency_keys:
+ if key in dep_strength_keys:
+ # Hack: Debian Edu tasks files are using '\' at EOL which is broken
+ # in RFC 822 files, but cdd-gen-control from cdd-dev 0.5.0 relies
+ # on this. So remove this stuff here for the Moment
+ dependencies = re.sub('\\\\\n\s+', '', stanza[key])
+
# turn alternatives ('|') into real depends for this purpose
# because we are finally interested in all alternatives
- dependencies = stanza[key].replace('|',',').split(',')
+ dependencies = dependencies.replace('|',',').split(',')
# Collect all dependencies in one line first,
# create an object for each later
deps_in_one_line = []
@@ -381,12 +389,16 @@
# just put the current one into the right list of dependencies
# before initiating the next instance
if dep != None:
- self.dependencies[self._FindDependencyType(dep)].append(dep)
+ # In case we should ignore the package do not add it to Dependencies
+ if dep.dep_strength != 'Ignore' and dep.dep_strength != 'Avoid':
+ self.dependencies[self._FindDependencyType(dep)].append(dep)
+ else:
+ print "Package %s actively ignored / avoided." % dep.pkg
dep = DependantPackage(self.cddname, self.task)
# Store the comments in case they might be usefull for later applications
dep.why = why
dep.responsible = responsible
- dep.dependencytype = key
+ dep.dep_strength = key
dep.pkg = dep_in_line
dep.dists.append(self.available.dist)
# Find the component the Dependency might be in
@@ -461,7 +473,10 @@
if not re.compile("^X[A-Z]*-").search(key):
print "Unknown key '%s': %s" % (key, stanza[key])
if dep != None:
- self.dependencies[self._FindDependencyType(dep)].append(dep)
+ if dep.dep_strength != 'Ignore' and dep.dep_strength != 'Avoid':
+ self.dependencies[self._FindDependencyType(dep)].append(dep)
+ else:
+ print "Package %s actively ignored / avoided." % dep.pkg
f.close()
Modified: trunk/community/infrastructure/scripts/update-tasks
===================================================================
--- trunk/community/infrastructure/scripts/update-tasks 2008-03-31 12:01:58 UTC (rev 1674)
+++ trunk/community/infrastructure/scripts/update-tasks 2008-03-31 15:17:41 UTC (rev 1675)
@@ -15,7 +15,7 @@
import HTMLTemplate
import re
from sys import argv, exit, stderr
-from os import chmod
+import os
from stat import S_IWGRP, S_IRUSR, S_IRGRP, S_IWUSR, S_IROTH
import time
from datetime import datetime
@@ -26,7 +26,7 @@
CDD='debian-med'
OUTPUTDIR = { 'debian-med' : HTMLBASE+"/debian-med/static/tasks/",
- 'debian-edu' : HTMLBASE+"/cdd/htdocs/science/tasks/",
+ 'debian-edu' : HTMLBASE+"/cdd/htdocs/edu/tasks/",
'debian-gis' : HTMLBASE+"/cdd/htdocs/gis/tasks/",
'debian-science' : HTMLBASE+"/cdd/htdocs/science/tasks/",
}
@@ -225,6 +225,14 @@
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])
+ except:
+ print >> stderr, "Unable to create output directory", OUTPUTDIR[CDD]
+
outputfile = OUTPUTDIR[CDD] + "index.php"
f = open(outputfile, "w")
@@ -235,7 +243,7 @@
f.write(tmpl.render(tasks))
f.close()
try:
- chmod(outputfile,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH)
+ os.chmod(outputfile,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH)
except:
# chmod is not allowed to other peoples files
pass
More information about the debian-med-commit
mailing list