# HG changeset patch # User Bjoern Ricks # Date 1278583659 0 # Node ID c1f3be727f9d0c721671a8eaf946ac25b1006a7f # Parent ffa86312ee81dd2a55fc0f1488ad7f51896153bc renamed new status dir to info because of a naming conflict with status.py let the user specify a treepkg name in the config the name is propagated to PackagerGroup [treepkg] name: becomes: pg = PackagerGroup(...) pg.name diff -r ffa86312ee81 -r c1f3be727f9d test/test_readconfig.py --- a/test/test_readconfig.py Wed Jul 07 15:40:48 2010 +0000 +++ b/test/test_readconfig.py Thu Jul 08 10:07:39 2010 +0000 @@ -34,6 +34,7 @@ [treepkg] instructions_file: %(treepkg_dir)s/instructions check_interval: 3600 +name: testtreepkg [pkg_simple] pkg_basename: simple1 @@ -82,7 +83,7 @@ treepkg_opts, packager_opts = read_config(config_file) self.assertEquals(treepkg_opts, dict(instructions_file="/home/builder/mill/instructions", - check_interval=3600)) + check_interval=3600, name="testtreepkg")) self.assertEquals(sorted(packager_opts, key=operator.itemgetter("name")), [ @@ -134,3 +135,9 @@ git_url="", git_branch="", builder_cls="PBuilder")]) + +def main(): + unittest.main() + +if __name__ == "__main__": + main() diff -r ffa86312ee81 -r c1f3be727f9d treepkg/info/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/treepkg/info/__init__.py Thu Jul 08 10:07:39 2010 +0000 @@ -0,0 +1,6 @@ +# Copyright (C) 2007 by Intevation GmbH +# Authors: +# Bernhard Herzog +# +# This program is free software under the GPL (>=v2) +# Read the file COPYING coming with the software for details. diff -r ffa86312ee81 -r c1f3be727f9d treepkg/info/status.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/treepkg/info/status.py Thu Jul 08 10:07:39 2010 +0000 @@ -0,0 +1,198 @@ +# Copyright (C) 2010 by Intevation GmbH +# Authors: +# Bjoern Ricks +# +# This program is free software under the GPL (>=v2) +# Read the file COPYING coming with the software for details. + +"""Build treepkg status information""" + +import xml.dom.minidom + +TREEPKG_NAMESPACE_URI = "http://wald.intevation.org/projects/treepkg/" +TREEPKG_NAMESPACE_PREFIX = "tpkg" + +def createTpkgElement(doc, name): + return doc.createElementNS(TREEPKG_NAMESPACE_URI, name) + +def createTpkgRoot(name): + domimpl = xml.dom.minidom.getDOMImplementation() + doc = domimpl.createDocument(TREEPKG_NAMESPACE_URI, name, None) + root = doc.documentElement + return (doc, root) + +class TreepkgStatus: + + def __init__(self, name, treepkgpath=None, millpath=None, version=None): + self.name = name + self.treepkgpath = treepkgpath + self.millpath = millpath + self.version = version + + def toxml(self): + (doc, root) = createTpkgRoot("status") + # add + nameele = createTpkgElement(doc, "name") + text = doc.createTextNode(self.name) + nameele.appendChild(text) + root.appendChild(nameele) + # add + if self.treepkgpath: + treepkgpathele = createTpkgElement(doc, "treepkgpath") + text = doc.createTextNode(self.treepkgpath) + treepkgpathele.appendChild(text) + root.appendChild(treepkgpathele) + # add + if self.millpath: + millpathele = createTpkgElement(doc, "millpath") + text = doc.createTextNode(self.millpath) + millpathele.appendChild(text) + root.appendChild(millpathele) + # add + if self.version: + versionele = createTpkgElement(doc, "version") + text = doc.createTextNode(self.version) + versionele.appendChild(text) + root.appendChild(version) + return root + +class TreepkgTrack: + + def __init__(self, name): + self.name = name + self.revisions = [] + + def add_revision(self, revision): + self.revisions.append(revision) + + def toxml(self): + (doc, root) = createTpkgRoot("track") + nameele = createTpkgElement(doc, "name") + text = doc.createTextNode(self.name) + nameele.appendChild(text) + root.appendChild(nameele) + for rev in self.revision: + root.appendChild(rev.toxml()) + return root + +class TreepkgTrackRevision: + + def __init__(self, number, rules, status, platform): + self.number = number + self.rules = rules + self.status = status + self.platform = platform + + def toxml(self): + (doc, root) = createTpkgRoot("revision") + # add + numberele = createTpkgElement(doc, "number") + text = doc.createTextNode(self.number) + numbverele.appendChild(text) + root.appendChild(numberele) + # add + rulesele = createTpkgElement(doc, "rules") + text = doc.createTextNode(self.rules) + rulesele.appendChild(text) + root.appendChild(rulesele) + # add + statusele = createTpkgElement(doc, "status") + messageele = createTpkgElement(doc, "message") + text = doc.createTextNode(self.status) + messageele.appendChild(text) + statusele.appendChild(messageele) + root.appendChild(statusele) + # add + root.appendChild(platform.toxml()) + return root + +class TreepkgPlatform: + + def __init__(self, os, arch): + self.os = os + self.arch = arch + self.packages = [] + self.logs = [] + + def add_package(self, package): + self.packages.append(package) + + def add_log(self, log): + self.logs.append(log) + + def toxml(self): + (doc, root) = createTpkgRoot("platform") + # add + osele = createTpkgElement(doc, "os") + text = doc.createTextNode(self.os) + osele.appendChild(text) + root.appendChild(osele) + # add + archele = createTpkgElement(doc, "arch") + text = doc.createTextNode(sef.arch) + archele.appendChild(text) + root.appendChild(archele) + # add + packagesele = createTpkgElement(doc, "packages") + for package in self.packages: + packagesele.appendChild(package.toxml()) + root.appendChild(packagesele) + # add + logsele = createTpkgElement(doc, "logs") + for log in self.logs: + losele.appendChild(log) + root.appendChild(logsele) + return root + +class TreepkgLog: + + def __init__(self, name, path): + self.name = name + self.path = path + + def toxml(self) + (doc, root) = createTpkgRoot("log") + # add + nameele = createTpkgElement(doc, "name") + text = doc.createTextNode(self.name) + nameele.appendChild(text) + root.appendChild(nameele) + # add path + pathele = createTpkgElement(doc, "path") + text = doc.createTextNode(self.path) + pathele.appendChild(text) + root.appendChild(pathele) + return root + +class TreepkgPackage: + + def __init__(self, name, path, type, checksum = None): + self.name = name + self.path = path + self.type = type + self.checksum = checksum + + def toxml(self): + (doc, root) = createTpkgRoot("package") + # add + nameele = createTpkgElement(doc, "name") + text = doc.createTextNode(self.name) + nameele.appendChild(text) + root.appendChild(nameele) + # add + pathele = createTpkgElement("path") + text = doc.createTextNode(self.path) + pathele.appendChild(text) + root.appendChild(pathele) + # add + if self.checksum: + checksumele = createTpkgElement(doc, "checksum") + text = doc.createTextNode(self.checksum) + checksumele.appendChild(text) + root.appendChild(checksumele) + # add + typeele = createTpkgElement(doc, "type") + text = doc.createTextNode(self.type) + typeele.appendChild(text) + root.appendChild(typeele) + diff -r ffa86312ee81 -r c1f3be727f9d treepkg/info/status.xsd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/treepkg/info/status.xsd Thu Jul 08 10:07:39 2010 +0000 @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r ffa86312ee81 -r c1f3be727f9d treepkg/packager.py --- a/treepkg/packager.py Wed Jul 07 15:40:48 2010 +0000 +++ b/treepkg/packager.py Thu Jul 08 10:07:39 2010 +0000 @@ -641,7 +641,7 @@ def __init__(self, package_tracks, check_interval, revision=None, instructions_file=None, do_svn_update=True, - stop_on_error=False): + stop_on_error=False, name=""): self.package_tracks = package_tracks self.check_interval = check_interval self.revision = revision @@ -649,6 +649,7 @@ self.stop_on_error = stop_on_error self.instructions_file = instructions_file self.instructions_file_removed = False + self.name = name self.sort_tracks() def sort_tracks(self): diff -r ffa86312ee81 -r c1f3be727f9d treepkg/readconfig.py --- a/treepkg/readconfig.py Wed Jul 07 15:40:48 2010 +0000 +++ b/treepkg/readconfig.py Thu Jul 08 10:07:39 2010 +0000 @@ -84,6 +84,7 @@ treepkg_desc = [ ("check_interval", int), "instructions_file", + ("name", str, "") ] diff -r ffa86312ee81 -r c1f3be727f9d treepkg/status/__init__.py --- a/treepkg/status/__init__.py Wed Jul 07 15:40:48 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -# Copyright (C) 2007 by Intevation GmbH -# Authors: -# Bernhard Herzog -# -# This program is free software under the GPL (>=v2) -# Read the file COPYING coming with the software for details. diff -r ffa86312ee81 -r c1f3be727f9d treepkg/status/status.py --- a/treepkg/status/status.py Wed Jul 07 15:40:48 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,198 +0,0 @@ -# Copyright (C) 2010 by Intevation GmbH -# Authors: -# Bjoern Ricks -# -# This program is free software under the GPL (>=v2) -# Read the file COPYING coming with the software for details. - -"""Build treepkg status information""" - -import xml.dom.minidom - -TREEPKG_NAMESPACE_URI = "http://wald.intevation.org/projects/treepkg/" -TREEPKG_NAMESPACE_PREFIX = "tpkg" - -def createTpkgElement(doc, name): - return doc.createElementNS(TREEPKG_NAMESPACE_URI, name) - -def createTpkgRoot(name): - domimpl = xml.dom.minidom.getDOMImplementation() - doc = domimpl.createDocument(TREEPKG_NAMESPACE_URI, name, None) - root = doc.documentElement - return (doc, root) - -class TreepkgStatus: - - def __init__(self, name, treepkgpath=None, millpath=None, version=None): - self.name = name - self.treepkgpath = treepkgpath - self.millpath = millpath - self.version = version - - def toxml(self): - (doc, root) = createTpkgRoot("status") - # add - nameele = createTpkgElement(doc, "name") - text = doc.createTextNode(self.name) - nameele.appendChild(text) - root.appendChild(nameele) - # add - if self.treepkgpath: - treepkgpathele = createTpkgElement(doc, "treepkgpath") - text = doc.createTextNode(self.treepkgpath) - treepkgpathele.appendChild(text) - root.appendChild(treepkgpathele) - # add - if self.millpath: - millpathele = createTpkgElement(doc, "millpath") - text = doc.createTextNode(self.millpath) - millpathele.appendChild(text) - root.appendChild(millpathele) - # add - if self.version: - versionele = createTpkgElement(doc, "version") - text = doc.createTextNode(self.version) - versionele.appendChild(text) - root.appendChild(version) - return root - -class TreepkgTrack: - - def __init__(self, name): - self.name = name - self.revisions = [] - - def add_revision(self, revision): - self.revisions.append(revision) - - def toxml(self): - (doc, root) = createTpkgRoot("track") - nameele = createTpkgElement(doc, "name") - text = doc.createTextNode(self.name) - nameele.appendChild(text) - root.appendChild(nameele) - for rev in self.revision: - root.appendChild(rev.toxml()) - return root - -class TreepkgTrackRevision: - - def __init__(self, number, rules, status, platform): - self.number = number - self.rules = rules - self.status = status - self.platform = platform - - def toxml(self): - (doc, root) = createTpkgRoot("revision") - # add - numberele = createTpkgElement(doc, "number") - text = doc.createTextNode(self.number) - numbverele.appendChild(text) - root.appendChild(numberele) - # add - rulesele = createTpkgElement(doc, "rules") - text = doc.createTextNode(self.rules) - rulesele.appendChild(text) - root.appendChild(rulesele) - # add - statusele = createTpkgElement(doc, "status") - messageele = createTpkgElement(doc, "message") - text = doc.createTextNode(self.status) - messageele.appendChild(text) - statusele.appendChild(messageele) - root.appendChild(statusele) - # add - root.appendChild(platform.toxml()) - return root - -class TreepkgPlatform: - - def __init__(self, os, arch): - self.os = os - self.arch = arch - self.packages = [] - self.logs = [] - - def add_package(self, package): - self.packages.append(package) - - def add_log(self, log): - self.logs.append(log) - - def toxml(self): - (doc, root) = createTpkgRoot("platform") - # add - osele = createTpkgElement(doc, "os") - text = doc.createTextNode(self.os) - osele.appendChild(text) - root.appendChild(osele) - # add - archele = createTpkgElement(doc, "arch") - text = doc.createTextNode(sef.arch) - archele.appendChild(text) - root.appendChild(archele) - # add - packagesele = createTpkgElement(doc, "packages") - for package in self.packages: - packagesele.appendChild(package.toxml()) - root.appendChild(packagesele) - # add - logsele = createTpkgElement(doc, "logs") - for log in self.logs: - losele.appendChild(log) - root.appendChild(logsele) - return root - -class TreepkgLog: - - def __init__(self, name, path): - self.name = name - self.path = path - - def toxml(self) - (doc, root) = createTpkgRoot("log") - # add - nameele = createTpkgElement(doc, "name") - text = doc.createTextNode(self.name) - nameele.appendChild(text) - root.appendChild(nameele) - # add path - pathele = createTpkgElement(doc, "path") - text = doc.createTextNode(self.path) - pathele.appendChild(text) - root.appendChild(pathele) - return root - -class TreepkgPackage: - - def __init__(self, name, path, type, checksum = None): - self.name = name - self.path = path - self.type = type - self.checksum = checksum - - def toxml(self): - (doc, root) = createTpkgRoot("package") - # add - nameele = createTpkgElement(doc, "name") - text = doc.createTextNode(self.name) - nameele.appendChild(text) - root.appendChild(nameele) - # add - pathele = createTpkgElement("path") - text = doc.createTextNode(self.path) - pathele.appendChild(text) - root.appendChild(pathele) - # add - if self.checksum: - checksumele = createTpkgElement(doc, "checksum") - text = doc.createTextNode(self.checksum) - checksumele.appendChild(text) - root.appendChild(checksumele) - # add - typeele = createTpkgElement(doc, "type") - text = doc.createTextNode(self.type) - typeele.appendChild(text) - root.appendChild(typeele) - diff -r ffa86312ee81 -r c1f3be727f9d treepkg/status/status.xsd --- a/treepkg/status/status.xsd Wed Jul 07 15:40:48 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -