[Treepkg-commits] r365 - branches/treepkg-status/treepkg/info
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Jul 13 16:26:12 CEST 2010
Author: bricks
Date: 2010-07-13 16:26:11 +0200 (Tue, 13 Jul 2010)
New Revision: 365
Modified:
branches/treepkg-status/treepkg/info/status.py
branches/treepkg-status/treepkg/info/status.xsd
Log:
moved arch info to each package info
Modified: branches/treepkg-status/treepkg/info/status.py
===================================================================
--- branches/treepkg-status/treepkg/info/status.py 2010-07-13 12:24:14 UTC (rev 364)
+++ branches/treepkg-status/treepkg/info/status.py 2010-07-13 14:26:11 UTC (rev 365)
@@ -43,6 +43,10 @@
def toxml(self):
return self.tpkgroot.toxml()
+ @staticmethod
+ def fromxml(xml):
+ pass
+
def add_revisions(self, track, trackinfo):
revisions = track.get_revisions()
revisions = sorted(revisions, key=lambda r: r.status.start,
@@ -50,7 +54,6 @@
if self.numnewestrev > 0:
revisions = revisions[:self.numnewestrev]
- os = track.os
arch = None
for rev in revisions:
@@ -60,30 +63,27 @@
sources = rev.list_source_files()
binaries = rev.list_binary_files()
- for binary in binaries: # get arch
- binpackage = BinaryPackage(binary)
- arch = binpackage.get_architecture()
- if not arch is None:
- break;
- platforminfo = TreepkgPlatformInfo(os, arch)
+
revinfo = TreepkgTrackRevisionInfo(revision, rules_revision,
- status, platforminfo)
+ status)
logs = rev.get_log_files()
for (title, filename) in logs:
loginfo = TreepkgLogInfo(title, filename)
revinfo.add_log(loginfo)
for source in sources:
- self.add_package(source, "source", revinfo)
+ self.add_package(revinfo, source, "source")
for binary in binaries:
- self.add_package(binary, "binary", revinfo)
-
+ binpackage = BinaryPackage(binary)
+ arch = binpackage.get_architecture()
+ self.add_package(revinfo, binary, "binary", arch)
+
trackinfo.add_revision(revinfo)
- def add_package(self, file, type, revision):
+ def add_package(self, revision, file, type, arch=None):
name = os.path.basename(file)
checksum = md5sum(file)
checksuminfo = TreepkgChecksumInfo(checksum, "md5")
- pkginfo = TreepkgPackageInfo(name, file, type)
+ pkginfo = TreepkgPackageInfo(name, file, type, arch)
pkginfo.add_checksum(checksuminfo)
revision.add_package(pkginfo)
@@ -133,8 +133,9 @@
class TreepkgTrackInfo:
- def __init__(self, name):
+ def __init__(self, name, os=None):
self.name = name
+ self.os = os
self.revisions = []
def add_revision(self, revision):
@@ -148,15 +149,19 @@
root.appendChild(nameele)
for rev in self.revisions:
root.appendChild(rev.toxml())
+ if not self.os is None:
+ osele = createTpkgElement(doc, "os")
+ text = doc.createTextNode(self.os)
+ osele.appendChild(text)
+ root.appendChild(osele)
return root
class TreepkgTrackRevisionInfo:
- def __init__(self, number, rules, status, platform):
+ def __init__(self, number, rules, status):
self.number = number
self.rules = rules
self.status = status
- self.platform = platform
self.packages = []
self.logs = []
@@ -185,8 +190,6 @@
messageele.appendChild(text)
statusele.appendChild(messageele)
root.appendChild(statusele)
- # add <platform>
- root.appendChild(self.platform.toxml())
# add <packages>
packagesele = createTpkgElement(doc, "packages")
for package in self.packages:
@@ -199,28 +202,6 @@
root.appendChild(logsele)
return root
-class TreepkgPlatformInfo:
-
- def __init__(self, os, arch):
- self.os = os
- self.arch = arch
- if self.arch is None:
- self.arch = "unkown"
-
- def toxml(self):
- (doc, root) = createTpkgRoot("platform")
- # add <os>
- osele = createTpkgElement(doc, "os")
- text = doc.createTextNode(self.os)
- osele.appendChild(text)
- root.appendChild(osele)
- # add <arch>
- archele = createTpkgElement(doc, "arch")
- text = doc.createTextNode(self.arch)
- archele.appendChild(text)
- root.appendChild(archele)
- return root
-
class TreepkgLogInfo:
def __init__(self, name, path):
@@ -243,10 +224,11 @@
class TreepkgPackageInfo:
- def __init__(self, name, path, type):
+ def __init__(self, name, path, type, arch):
self.name = name
self.path = path
self.type = type
+ self.arch = arch
self.checksums = []
def toxml(self):
@@ -265,10 +247,9 @@
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)
+ root.setAttributeNS(TREEPKG_NAMESPACE_URI, "type", self.type)
+ if not self.arch is None:
+ root.setAttributeNS(TREEPKG_NAMESPACE_URI, "arch", self.arch)
return root
def add_checksum(self, checksum):
Modified: branches/treepkg-status/treepkg/info/status.xsd
===================================================================
--- branches/treepkg-status/treepkg/info/status.xsd 2010-07-13 12:24:14 UTC (rev 364)
+++ branches/treepkg-status/treepkg/info/status.xsd 2010-07-13 14:26:11 UTC (rev 365)
@@ -35,6 +35,7 @@
<xsd:element name="name" type="xsd:string" minOccurs="1"/>
<xsd:element name="revision" type="tpkg:revision"
maxOccurs="unbounded"/>
+ <xsd:element name="os" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
@@ -43,7 +44,6 @@
<xsd:element name="number" type="xsd:string" minOccurs="1"/>
<xsd:element name="rules" type="xsd:string" minOccurs="1"/>
<xsd:element name="status" type="tpkg:revisionstatus" minOccurs="1"/>
- <xsd:element name="platform" type="tpkg:platform" minOccurs="1"/>
<xsd:element name="packages" type="tpkg:packages"/>
<xsd:element name="logs" type="tpkg:logs"/>
</xsd:sequence>
@@ -55,13 +55,6 @@
</xsd:sequence>
</xsd:complexType>
- <xsd:complexType name="platform">
- <xsd:sequence>
- <xsd:element name="os" type="xsd:string"/>
- <xsd:element name="arch" type="xsd:string"/>
- </xsd:sequence>
- </xsd:complexType>
-
<xsd:complexType name="logs">
<xsd:sequence>
<xsd:element name="log" type="tpkg:log"/>
@@ -88,8 +81,9 @@
<xsd:element name="path" type="xsd:string" minOccurs="1">
<xsd:element name="checksum" type="tpkg:checksum"
maxOccurs="unbounded" default="md5"/>
- <xsd:element name="type" type="tpkg:pkgtype" minOccurs="1"/>
</xsd:sequence>
+ <xsd:attribute name="type" type="tpkg:pkgtype" minOccurs="1"/>
+ <xsd:attribute name="arch" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="checksum">
More information about the Treepkg-commits
mailing list