[med-svn] r1290 - trunk/community/infrastructure/test
tille at alioth.debian.org
tille at alioth.debian.org
Tue Feb 5 21:39:22 UTC 2008
Author: tille
Date: 2008-02-05 21:39:21 +0000 (Tue, 05 Feb 2008)
New Revision: 1290
Modified:
trunk/community/infrastructure/test/cddtasktools.py
trunk/community/infrastructure/test/test_read_tasks_file
trunk/community/infrastructure/test/update-tasks_using_python-debian
Log:
Bugfixes and many documentation enhancements
Modified: trunk/community/infrastructure/test/cddtasktools.py
===================================================================
--- trunk/community/infrastructure/test/cddtasktools.py 2008-02-05 16:15:41 UTC (rev 1289)
+++ trunk/community/infrastructure/test/cddtasktools.py 2008-02-05 21:39:21 UTC (rev 1290)
@@ -1,23 +1,18 @@
#!/usr/bin/python
+# Copyright 2008: Andreas Tille <tille at debian.org>
+# License: GPL
-# Meta packages are listing a set of Dependencies
+# CDD Meta packages are listing a set of Dependencies
# These might be fullfilled by the Debian package
-# set or not
+# set or not.
#
-# This interface provides a class DependantPackage
-# which contains all available information about
-# this Dependency , like whether it is an official
-# package or not, in which distribution it is contained
+# This interface provides some classes that contains
+# all available information about this Dependency ,
+# like whether it is an official package or not,
+# in which distribution it is contained
# or if it is not contained it obtains information
# from tasks file about home page, license, WNPP etc.
-# This is just a test how we should read tasks files
-# using python-debian to make sure everything is
-# processed nicely
-#
-# You should give the path to a tasks file at command
-# line for this simple test
-
import sys
import os
import urllib
@@ -34,7 +29,12 @@
HTMLBASE = "/var/lib/gforge/chroot/home/groups"
def InitTasksFiles(cddname):
- # Obtain tasks files from SVN
+ # Obtain tasks files from SVN of a CDD
+ # cddname can be: debian-med, debian-edu, debian-science
+ # In case you know another CDD that uses the meta package
+ # technology make sure to include the location in the
+ # REPOS dictionary
+ #
tasksdir = "%s/%s/data/tasks" % (HTMLBASE, cddname)
# Checkout/Update tasks from SVN
if os.path.isdir(tasksdir+'/.svn'):
@@ -57,6 +57,7 @@
class Task:
# This class just stores name and description of a task package
+ # FIXME: This is probably not used anymore and can be deleted
def __init__(self, cddname=None, taskname=None, shortDesc=None, longDesc=None):
self.cddname = cddname
@@ -66,14 +67,15 @@
class DependantPackage:
# Hold information about a program that is in dependency list
+ # The
def __init__(self, cddname=None, taskname=None):
- self.cddname = cddname
- self.taskname = taskname
+ 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.dists = [] # Values: 'stable', 'testing', 'unstable', etc.
- self.component = {} # Values: 'main', 'contrib', 'non-free', 'experimental'
+ self.component = {} # Values: 'main', 'contrib', 'non-free', 'experimental'
self.why = None # basically used as comment
@@ -89,7 +91,7 @@
# WNPP bug and finally can be used for packaging
self.pkgURL = None # URL of inofficial package
- # sort this objects according to the package name
+ # sort these objects according to the package name
def __cmp__(self, other):
# Comparing with None object has to return something reasonable
if other == None:
@@ -99,9 +101,17 @@
class CddDependencies:
# Provide a list of depencencies defined in Metapackages
+ # This class concerns _all_ tasks of a CDD and is the most
+ # complete source of information. If only a single task
+ # should be handled by a tool that uses cddtasktools
+ # probably the class TaskDependencies (see below) is
+ # your friend
def __init__(self, cddname):
+ # This Instance of the Available class contains all
+ # information about packages that are avialable in Debian
+ # See below for more information about Available class
global available
if cddname not in REPOS.keys():
@@ -128,6 +138,37 @@
td.GetTaskDependencies()
self.tasks[task] = td
+ def GetNamesOnlyDict(self):
+ # David Paleino needs for his web tools a dictionary
+ # { taskname : [list of dependencies]}
+ # This will be prepared here from the main
+ # datastructure
+ ret = {}
+ for task in self.tasknames:
+ tdeps = self.tasks[task]
+ list = []
+ for tdep in tdeps.dependencies['official']:
+ list.append(tdep.pkg)
+ ret[task] = list
+ return ret
+
+ def GetTaskDescDict(self):
+ # David Paleino needs for his web tools a dictionary
+ # { taskname : { 'Task' : task
+ # 'ShortDesc' : shortdesc
+ # 'LongDesc' : longdesc }
+ # This will be prepared here from the main
+ # datastructure
+ ret = {}
+ for task in self.tasknames:
+ tdeps = self.tasks[task]
+ tdict = {}
+ tdict['Task'] = tdeps.taskPrintedName
+ tdict['ShortDesc'] = tdeps.taskShortDesc
+ tdict['LongDesc'] = tdeps.taskLongDesc
+ ret[task] = tdict
+ return ret
+
class TaskDependencies:
# List of depencencies defined in one Metapackage
def __init__(self, cddname, task):
@@ -281,7 +322,20 @@
class Available:
# Information about available packages
+ #
+ # Usage example:
+ # available = Available( # Initialize instance
+ dist='testing', # (default='unstable')
+ components=('main'), # Regard only main, default: main, contrib, non-free
+ source=1 # Use source package names, default: use binaries
+ arch='sparc' # (default='i386')
+ # )
+ #
+ # available.GetPackageNames() # Actually parse the Packages files to obtain needed information
+ # # This has to be done at least once. It is verified that the effort
+ # # to obtain package information is not done twice per run
+
def __init__(self, dist=None, components=(), source=None, arch=None):
self.source = 'Packages.gz'
if source != None:
Modified: trunk/community/infrastructure/test/test_read_tasks_file
===================================================================
--- trunk/community/infrastructure/test/test_read_tasks_file 2008-02-05 16:15:41 UTC (rev 1289)
+++ trunk/community/infrastructure/test/test_read_tasks_file 2008-02-05 21:39:21 UTC (rev 1290)
@@ -13,7 +13,7 @@
# comments in the tasks file for the moment
ignore_keys = [ "Why", "Responsible" ]
-# Theyse keys might contain more than one item that
+# These keys might contain more than one item that
# has to be separated to detect the dependency
dependency_keys = [ "Depends", "Recommends", "Suggests" ]
Modified: trunk/community/infrastructure/test/update-tasks_using_python-debian
===================================================================
--- trunk/community/infrastructure/test/update-tasks_using_python-debian 2008-02-05 16:15:41 UTC (rev 1289)
+++ trunk/community/infrastructure/test/update-tasks_using_python-debian 2008-02-05 21:39:21 UTC (rev 1290)
@@ -17,9 +17,8 @@
#BASEURL='http://ftp.debian.de/debian/dists/'
#DIST='unstable'
-from cddtasktools import Available, CddDependencies, Task, TaskDependencies
+from cddtasktools import Available, CddDependencies, Task, TaskDependencies, HTMLBASE
-
cdeps=CddDependencies('debian-med')
cdeps.GetAllDependencies()
More information about the debian-med-commit
mailing list