[Cdd-commits] r1116 - cdd/trunk/webtools
CDD Subversion Commit
noreply at alioth.debian.org
Thu Oct 2 08:55:33 UTC 2008
Author: tille
Date: Thu Oct 2 08:55:33 2008
New Revision: 1116
Modified:
cdd/trunk/webtools/distasktools.py
Log:
Avoid duplicating source packages
Modified: cdd/trunk/webtools/distasktools.py
==============================================================================
--- cdd/trunk/webtools/distasktools.py (original)
+++ cdd/trunk/webtools/distasktools.py Thu Oct 2 08:55:33 2008
@@ -463,6 +463,28 @@
# This is NOT YET implemented
self.metadepends = None
+ def _AppendDependency2List(self, dep, source):
+ # Append dependency which was found in the tasks file if not Ignore / Avoid and
+ # no dupplication in case of source depencencies
+ if dep == None:
+ return
+ if dep.dep_strength == 'Ignore' or dep.dep_strength == 'Avoid':
+ return
+ if source != 1:
+ # In general we can just add the dependency to the list
+ self.dependencies[self._FindDependencyType(dep)].append(dep)
+ return
+
+ # if we are seeking for ddpo source packages we have to make sure that
+ # no duplication occures
+ hasnot = 1
+ for hasdep in self.dependencies[self._FindDependencyType(dep)]:
+ if hasdep.pkg == dep.pkg:
+ hasnot = 0
+ break
+ if hasnot == 1:
+ self.dependencies[self._FindDependencyType(dep)].append(dep)
+
def GetTaskDependencies(self, source=0):
# First obtain information about Packages
# available in Debian
@@ -472,7 +494,6 @@
# has to be separated to detect the dependency
dep_strength_keys = [ 'Depends', 'Recommends', 'Suggests', 'Ignore', 'Avoid' ]
- print >>stderr, "DEBUG: source = %i" % ( source )
f = file(self.taskfile)
for stanza in deb822.Sources.iter_paragraphs(f):
# Why and Responsible can be valid for more than one dependency
@@ -532,13 +553,7 @@
# If there are more than one dependencies in one line
# just put the current one into the right list of dependencies
# before initiating the next instance
- if dep != None:
- # 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
- pass
+ self._AppendDependency2List(dep, source)
dep = DependantPackage(self.disname, self.task)
# Store the comments in case they might be usefull for later applications
dep.why = why
@@ -570,12 +585,7 @@
dep.filename = self.available.packages[component][dep.pkg].filename
# if we are seeking for source package names for ddpo subscription
-
- if self.available.packages[component][dep.pkg].source:
- print >>stderr, "DEBUG: dep %s has source package %s" % ( dep.pkg, self.available.packages[component][dep.pkg].source )
if source == 1 and self.available.packages[component][dep.pkg].source:
- print >>stderr, "DEBUG: using source package %s instead of binary %s" % ( self.available.packages[component][dep.pkg].source, dep.pkg)
- ## FIXME: some source packages will be mentioned twice!
dep.pkg = self.available.packages[component][dep.pkg].source
break # The same package should be only in one component
@@ -642,12 +652,7 @@
except:
print "Unknown key '%s' with problematic value in file %s." % (key, self.taskfile)
- if dep != None:
- 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
- pass
+ self._AppendDependency2List(dep, source)
f.close()
@@ -772,7 +777,8 @@
deppkg.homepage = '.' # Something else in case unexpected things happen
deppkg.version = stanza['version'].split('-')[0]
if stanza.has_key('source'):
- deppkg.source = stanza['source']
+ # sometimes the source has a version number attached -> crop everything after ' '
+ deppkg.source = re.sub('\s+.*', '', stanza['source'])
deppkg.section = stanza['section']
deppkg.responsible = re.sub('\s*(.+)\s+<(.+ at .+)>\s*', '<a href="mailto:\\2">\\1</a>', \
stanza['maintainer'])
More information about the Cdd-commits
mailing list