* parse build deps

* change dep spec so that it uses attributes like archive does
  - change popt example to reflect that
  - if you don't like it we'll revert :)
This commit is contained in:
Eray Özkural
2005-06-10 17:51:23 +00:00
parent 930998374c
commit c6104f2edf
3 changed files with 20 additions and 11 deletions
+2 -7
View File
@@ -20,10 +20,7 @@
<Patch compressionType="gz">popt-1.7-uclibc.patch.gz</Patch>
</Patches>
<BuildDependencies>
<Dependency>
<Name>make</Name>
<VersionFrom>1.8</VersionFrom>
</Dependency>
<Dependency versionFrom="1.8"> make </Dependency>
</BuildDependencies>
<History>
<Update>
@@ -49,9 +46,7 @@
</Description>
<Category>devel:library</Category>
<RuntimeDependencies>
<Dependency>
<Name>gettext</Name>
</Dependency>
<Dependency>gettext</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="sharedLib">/usr/lib/</Path>
+13 -3
View File
@@ -13,6 +13,11 @@ class PatchInfo:
self.filename = getNodeText(node)
self.compressionType = getNodeAttribute(node, "compressionType")
class DepInfo:
def __init__(self, node):
self.package = getNodeText(node).strip()
self.versionFrom = getNodeAttribute(node, "versionFrom")
class SpecFile(XmlFile):
"""A class for reading/writing from/to a PSPEC (PISI SPEC) file."""
@@ -27,9 +32,14 @@ class SpecFile(XmlFile):
patchElts = self.getChildElts("PSPEC/Source/Patches")
patches = [ PatchInfo(p) for p in patchElts ]
for x in patches:
print "fn:", x.filename
print "ct:", x.compressionType
print "patch fn:", x.filename
print "patch ct:", x.compressionType
buildDepElts = self.getChildElts("PSPEC/Source/BuildDependencies")
buildDeps = [DepInfo(d) for d in buildDepElts]
for x in buildDeps:
print "patch nm:", x.package
print "patch vf:", x.versionFrom
def verify(self):
"""Verify PSPEC structures, are they what we want of them?"""
return True
+5 -1
View File
@@ -25,6 +25,10 @@ def getNodeText(node):
else:
raise XmlError("getNodeText: Expected text node, got something else!")
# get only child elements
def getChildElts(node):
return filter(lambda x:x.nodeType==x.ELEMENT_NODE, node.childNodes)
# xmlfile class that further abstracts a dom object
class XmlFile(object):
@@ -49,7 +53,7 @@ class XmlFile(object):
node = self.getNode(tagpath)
return filter(lambda x:x.nodeType==type, node.childNodes)
# get only child elements, slightly better than Serdar's sol'n :> -- exa
# get only child elements
def getChildElts(self, tagpath):
""" returns the children of the given path, only with given type """
node = self.getNode(tagpath)