[med-svn] r1615 - trunk/community/infrastructure/scripts
tille at alioth.debian.org
tille at alioth.debian.org
Mon Mar 17 19:04:43 UTC 2008
Author: tille
Date: 2008-03-17 19:04:42 +0000 (Mon, 17 Mar 2008)
New Revision: 1615
Modified:
trunk/community/infrastructure/scripts/cddtasktools.py
Log:
List only packages from main at DDTP page because non-free and contrib
do not have translations anyway.
Modified: trunk/community/infrastructure/scripts/cddtasktools.py
===================================================================
--- trunk/community/infrastructure/scripts/cddtasktools.py 2008-03-17 15:50:50 UTC (rev 1614)
+++ trunk/community/infrastructure/scripts/cddtasktools.py 2008-03-17 19:04:42 UTC (rev 1615)
@@ -34,7 +34,9 @@
HTMLBASE = "/var/lib/gforge/chroot/home/groups"
KEYSTOIGNORE = ( 'Architecture', 'Avoid', 'Ignore', 'Leaf', 'NeedConfig', 'Note', 'Section' )
GLOBALCACHE = "/var/cache/cdd/"
-DDTPURL = "http://ddtp.debian.net/debian/dists/sid/main/i18n/Translation-"
+DDTPURL = "http://ddtp.debian.net/debian/dists/"
+DDTPDIR = "/i18n/Translation-"
+DDTPLISTS = ('etch', 'lenny', 'sid')
COMPRESSIONEXTENSION='bz2'
@@ -228,6 +230,9 @@
def GetAllDependantPackagesOfCDD(self, dependencytypes=()):
# David Paleino needs for his DDTP web tool a list of
# all available Dependencies.
+ # Here only those packages are returned that are in
+ # Debian main, because there are no DDTP translations
+ # for contrib and non-free available
ret = []
if dependencytypes == ():
# official: A package with this name is found in the Debian repository
@@ -245,10 +250,50 @@
tdeps = self.tasks[task]
for dep in dependencytypes:
for tdep in tdeps.dependencies[dep]:
- ret.append(tdep.pkg)
+ # add only packages in main, because others do not have DDTP translations
+ if tdep.component == 'main':
+ ret.append(tdep.pkg)
ret.sort()
return ret
+ def GetTranslations(self, languages=()):
+ # Get DDTP translations for the package dependencies in a CDD
+
+ if languages == ():
+ return
+
+ # Make sure that cache directory fpr DDTP translations exists and is writable
+ cachedir = GLOBALCACHE
+ if not os.access(cachedir, os.W_OK):
+ try:
+ os.mkdir(cachedir)
+ except:
+ # If we have no access to global cache create a local one
+ cachedir = "cache"
+ if not os.access(cachedir, os.W_OK):
+ os.mkdir(cachedir)
+ # Use sid as main source of DDTP information
+ dist = 'sid'
+ # Only main has DDTP translations
+ component = 'main'
+
+ for lang in languages:
+ # f = urllib.urlopen(DDTPURL+dist+'/'+component+DDTPDIR+'/'+lang)
+ cachefile = cachedir+'/'+dist+'_'+component+'_'+lang
+ print "DEBUG:", cachefile
+ (file,info) = urllib.urlretrieve(DDTPURL+dist+'/'+component+DDTPDIR+lang,cachefile)
+ if COMPRESSIONEXTENSION == 'gz':
+ g = gzip.GzipFile(file)
+ elif COMPRESSIONEXTENSION == 'bz2':
+ g = bz2.BZ2File(file)
+ else:
+ print >>stderr, "Unknown compression extension " + COMPRESSIONEXTENSION
+ return exit(-1)
+
+ # for stanza in deb822.Sources.iter_paragraphs(g, shared_storage=False):
+
+
+
class TaskDependencies:
# List of depencencies defined in one Metapackage
def __init__(self, cddname, task):
@@ -282,11 +327,6 @@
def GetTaskDependencies(self):
# First obtain information about Packages
# available in Debian
- # This might take some time.
- # Caching comes to mind, but the script is supposed
- # to be run not more frequently than mirror pushes
- # and thus only testing the script might profit from
- # caching
self.available.GetPackageNames()
# These keys might contain more than one item that
@@ -417,7 +457,6 @@
for dependency in self.dependencies.keys():
self.dependencies[dependency].sort()
-
def _FindDependencyType(self, dep):
# Return the name of the Dependencytype to append the Dependency to the right list
if dep.component != {}:
More information about the debian-med-commit
mailing list