Move write_heidi to britney_util

Signed-off-by: Niels Thykier <niels@thykier.net>
debian
Niels Thykier 12 years ago
parent bf9362be83
commit 680457cbec

@ -213,7 +213,7 @@ from hints import HintCollection
from britney import buildSystem from britney import buildSystem
from britney_util import (old_libraries_format, same_source, undo_changes, from britney_util import (old_libraries_format, same_source, undo_changes,
register_reverses, compute_reverse_tree, register_reverses, compute_reverse_tree,
read_nuninst, write_nuninst) read_nuninst, write_nuninst, write_heidi)
from consts import (VERSION, SECTION, BINARIES, MAINTAINER, FAKESRC, from consts import (VERSION, SECTION, BINARIES, MAINTAINER, FAKESRC,
SOURCE, SOURCEVER, ARCHITECTURE, DEPENDS, CONFLICTS, SOURCE, SOURCEVER, ARCHITECTURE, DEPENDS, CONFLICTS,
PROVIDES, RDEPENDS, RCONFLICTS) PROVIDES, RDEPENDS, RCONFLICTS)
@ -806,39 +806,6 @@ class Britney(object):
return hints return hints
def write_heidi(self, filename):
"""Write the output HeidiResult
This method write the output for Heidi, which contains all the
binary packages and the source packages in the form:
<pkg-name> <pkg-version> <pkg-architecture> <pkg-section>
<src-name> <src-version> source <src-section>
"""
self.__log("Writing Heidi results to %s" % filename)
f = open(filename, 'w')
# local copies
sources = self.sources['testing']
# write binary packages
for arch in sorted(self.options.architectures):
binaries = self.binaries['testing'][arch][0]
for pkg_name in sorted(binaries):
pkg = binaries[pkg_name]
pkgv = pkg[VERSION]
pkgarch = pkg[ARCHITECTURE] or 'all'
pkgsec = pkg[SECTION] or 'faux'
f.write('%s %s %s %s\n' % (pkg_name, pkgv, pkgarch, pkgsec))
# write sources
for src_name in sorted(sources):
src = sources[src_name]
srcv = src[VERSION]
srcsec = src[SECTION] or 'unknown'
f.write('%s %s source %s\n' % (src_name, srcv, srcsec))
f.close()
def write_controlfiles(self, basedir, suite): def write_controlfiles(self, basedir, suite):
"""Write the control files """Write the control files
@ -2356,7 +2323,9 @@ class Britney(object):
self.write_dates(self.options.testing, self.dates) self.write_dates(self.options.testing, self.dates)
# write HeidiResult # write HeidiResult
self.write_heidi(self.options.heidi_output) self.__log("Writing Heidi results to %s" % self.options.heidi_output)
write_heidi(self.options.heidi_output, self.sources["testing"],
self.binaries["testing"])
self.printuninstchange() self.printuninstchange()
self.__log("Test completed!", type="I") self.__log("Test completed!", type="I")

@ -25,8 +25,8 @@ import re
import time import time
from consts import (BINARIES, PROVIDES, DEPENDS, CONFLICTS, from consts import (VERSION, BINARIES, PROVIDES, DEPENDS, CONFLICTS,
RDEPENDS, RCONFLICTS) RDEPENDS, RCONFLICTS, ARCHITECTURE, SECTION)
binnmu_re = re.compile(r'^(.*)\+b\d+$') binnmu_re = re.compile(r'^(.*)\+b\d+$')
@ -292,3 +292,40 @@ def read_nuninst(filename, architectures):
nuninst[arch] = set(packages.split()) nuninst[arch] = set(packages.split())
return nuninst return nuninst
def write_heidi(filename, sources_t, packages_t,
VERSION=VERSION, SECTION=SECTION,
ARCHITECTURE=ARCHITECTURE, sorted=sorted):
"""Write the output HeidiResult
This method write the output for Heidi, which contains all the
binary packages and the source packages in the form:
<pkg-name> <pkg-version> <pkg-architecture> <pkg-section>
<src-name> <src-version> source <src-section>
The file is written as "filename", it assumes all sources and
packages in "sources_t" and "packages_t" to be the packages in
"testing".
The "X=X" parameters are optimizations to avoid "load global" in
the loops.
"""
with open(filename, 'w') as f:
# write binary packages
for arch in sorted(packages_t):
binaries = packages_t[arch][0]
for pkg_name in sorted(binaries):
pkg = binaries[pkg_name]
pkgv = pkg[VERSION]
pkgarch = pkg[ARCHITECTURE] or 'all'
pkgsec = pkg[SECTION] or 'faux'
f.write('%s %s %s %s\n' % (pkg_name, pkgv, pkgarch, pkgsec))
# write sources
for src_name in sorted(sources_t):
src = sources_t[src_name]
srcv = src[VERSION]
srcsec = src[SECTION] or 'unknown'
f.write('%s %s source %s\n' % (src_name, srcv, srcsec))

Loading…
Cancel
Save