* 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> <Patch compressionType="gz">popt-1.7-uclibc.patch.gz</Patch>
</Patches> </Patches>
<BuildDependencies> <BuildDependencies>
<Dependency> <Dependency versionFrom="1.8"> make </Dependency>
<Name>make</Name>
<VersionFrom>1.8</VersionFrom>
</Dependency>
</BuildDependencies> </BuildDependencies>
<History> <History>
<Update> <Update>
@@ -49,9 +46,7 @@
</Description> </Description>
<Category>devel:library</Category> <Category>devel:library</Category>
<RuntimeDependencies> <RuntimeDependencies>
<Dependency> <Dependency>gettext</Dependency>
<Name>gettext</Name>
</Dependency>
</RuntimeDependencies> </RuntimeDependencies>
<Files> <Files>
<Path fileType="sharedLib">/usr/lib/</Path> <Path fileType="sharedLib">/usr/lib/</Path>
+12 -2
View File
@@ -13,6 +13,11 @@ class PatchInfo:
self.filename = getNodeText(node) self.filename = getNodeText(node)
self.compressionType = getNodeAttribute(node, "compressionType") self.compressionType = getNodeAttribute(node, "compressionType")
class DepInfo:
def __init__(self, node):
self.package = getNodeText(node).strip()
self.versionFrom = getNodeAttribute(node, "versionFrom")
class SpecFile(XmlFile): class SpecFile(XmlFile):
"""A class for reading/writing from/to a PSPEC (PISI SPEC) file.""" """A class for reading/writing from/to a PSPEC (PISI SPEC) file."""
@@ -27,8 +32,13 @@ class SpecFile(XmlFile):
patchElts = self.getChildElts("PSPEC/Source/Patches") patchElts = self.getChildElts("PSPEC/Source/Patches")
patches = [ PatchInfo(p) for p in patchElts ] patches = [ PatchInfo(p) for p in patchElts ]
for x in patches: for x in patches:
print "fn:", x.filename print "patch fn:", x.filename
print "ct:", x.compressionType 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): def verify(self):
"""Verify PSPEC structures, are they what we want of them?""" """Verify PSPEC structures, are they what we want of them?"""
+5 -1
View File
@@ -25,6 +25,10 @@ def getNodeText(node):
else: else:
raise XmlError("getNodeText: Expected text node, got something 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 # xmlfile class that further abstracts a dom object
class XmlFile(object): class XmlFile(object):
@@ -49,7 +53,7 @@ class XmlFile(object):
node = self.getNode(tagpath) node = self.getNode(tagpath)
return filter(lambda x:x.nodeType==type, node.childNodes) 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): def getChildElts(self, tagpath):
""" returns the children of the given path, only with given type """ """ returns the children of the given path, only with given type """
node = self.getNode(tagpath) node = self.getNode(tagpath)