[Treepkg-commits] r355 - branches/treepkg-status/treepkg/info
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri Jul 9 15:15:17 CEST 2010
Author: bricks
Date: 2010-07-09 15:15:15 +0200 (Fri, 09 Jul 2010)
New Revision: 355
Modified:
branches/treepkg-status/treepkg/info/status.py
branches/treepkg-status/treepkg/info/status.xsd
Log:
implemented nearly all info
only arch and os info are missing
Modified: branches/treepkg-status/treepkg/info/status.py
===================================================================
--- branches/treepkg-status/treepkg/info/status.py 2010-07-09 12:42:42 UTC (rev 354)
+++ branches/treepkg-status/treepkg/info/status.py 2010-07-09 13:15:15 UTC (rev 355)
@@ -7,6 +7,7 @@
"""Build treepkg status information"""
+import os.path
import xml.dom.minidom
from treepkg.report import get_packager_group
@@ -35,11 +36,48 @@
for track in tracks:
trackinfo = TreepkgTrackInfo(track.name)
self.tpkgroot.add_track(trackinfo)
+ self.add_revisions(track, trackinfo)
def toxml(self):
return self.tpkgroot.toxml()
+ def add_revisions(self, track, trackinfo):
+ revisions = track.get_revisions()
+ for rev in revisions:
+ revision = rev.revision
+ rules_revision = rev.rules_revision
+ status = rev.status.status # extend status
+ platforminfo = self.get_platform(rev)
+ revinfo = TreepkgTrackRevisionInfo(revision, rules_revision,
+ status, platforminfo)
+ trackinfo.add_revision(revinfo)
+ def get_platform(self, revision):
+ # FIXME
+ os = "abc os"
+ arch = "def arch"
+ platforminfo = TreepkgPlatformInfo(os, arch)
+ logs = revision.get_log_files()
+ for (title, file) in logs:
+ loginfo = TreepkgLogInfo(title, file)
+ platforminfo.add_log(loginfo)
+ sources = revision.list_source_files()
+ for source in sources:
+ self.add_package(source, "source", platforminfo)
+ binaries = revision.list_binary_files()
+ for binary in binaries:
+ self.add_package(binary, "binary", platforminfo)
+ return platforminfo
+
+ def add_package(self, file, type, platform):
+ name = os.path.basename(file)
+ path = source
+ checksum = md5sum(file)
+ checksuminfo = TreepkgChecksumInfo(checksum, "md5")
+ pkginfo = TreepkgPackageInfo(name, path, type)
+ pkginfo.add_checksum(checksuminfo)
+ platform.add_package(pkginfo)
+
class TreepkgRootInfo:
def __init__(self, name, treepkgpath=None, trackspath=None, version=None):
@@ -194,33 +232,44 @@
class TreepkgPackageInfo:
- def __init__(self, name, path, type, checksum = None):
- self.name = name
- self.path = path
- self.type = type
- self.checksum = checksum
+ def __init__(self, name, path, type):
+ self.name = name
+ self.path = path
+ self.type = type
+ self.checksums = []
- def toxml(self):
- (doc, root) = createTpkgRoot("package")
- # add <name>
- nameele = createTpkgElement(doc, "name")
- text = doc.createTextNode(self.name)
- nameele.appendChild(text)
- root.appendChild(nameele)
- # add <path>
- pathele = createTpkgElement("path")
- text = doc.createTextNode(self.path)
- pathele.appendChild(text)
- root.appendChild(pathele)
- # add <checksum>
- if self.checksum:
- checksumele = createTpkgElement(doc, "checksum")
- text = doc.createTextNode(self.checksum)
- checksumele.appendChild(text)
- root.appendChild(checksumele)
- # add <type>
- typeele = createTpkgElement(doc, "type")
- text = doc.createTextNode(self.type)
- typeele.appendChild(text)
- root.appendChild(typeele)
+ def toxml(self):
+ (doc, root) = createTpkgRoot("package")
+ # add <name>
+ nameele = createTpkgElement(doc, "name")
+ text = doc.createTextNode(self.name)
+ nameele.appendChild(text)
+ root.appendChild(nameele)
+ # add <path>
+ pathele = createTpkgElement("path")
+ text = doc.createTextNode(self.path)
+ pathele.appendChild(text)
+ root.appendChild(pathele)
+ # add <checksum>
+ for checksum in self.checksums:
+ root.appendChild(checksum.toxml())
+ # add <type>
+ typeele = createTpkgElement(doc, "type")
+ text = doc.createTextNode(self.type)
+ typeele.appendChild(text)
+ root.appendChild(typeele)
+ return root
+class TreepkgChecksumInfo:
+
+ def __inif__(self, checksum, type="md5"):
+ self.checksum = checksum
+ self.type = type
+
+ def toxml(self):
+ (doc, root) = createTpkgRoot("checksum")
+ text = doc.createTextNode(self.checksum)
+ root.appendChild(text)
+ # add attribute type
+ root.setAttributeNS(TREEPKG_NAMESPACE_URI, "type", self.type)
+ return root
Modified: branches/treepkg-status/treepkg/info/status.xsd
===================================================================
--- branches/treepkg-status/treepkg/info/status.xsd 2010-07-09 12:42:42 UTC (rev 354)
+++ branches/treepkg-status/treepkg/info/status.xsd 2010-07-09 13:15:15 UTC (rev 355)
@@ -86,11 +86,19 @@
<xsd:sequence>
<xsd:element name="name" type="xsd:string" minOccurs="1"/>
<xsd:element name="path" type="xsd:string" minOccurs="1">
- <xsd:element name="checksum" type="xsd:string"/>
+ <xsd:element name="checksum" type="tpkg:checksum"
+ maxOccurs="unbounded" default="md5"/>
<xsd:element name="type" type="tpkg:pkgtype" minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
+ <xsd:complexType name="checksum">
+ <xsd:sequence>
+ <xsd:element name="checksum" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute name="type" type="xsd:string"/>
+ </xsd:complexType>
+
<xsd:simpleType name="pkgtype">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="binary"/>
More information about the Treepkg-commits
mailing list