[Piuparts-commits] rev 122 - / trunk trunk/debian
Lars Wirzenius
lars at alioth.debian.org
Mon Jan 21 18:33:40 UTC 2008
Author: lars
Date: 2008-01-21 18:33:27 +0000 (Mon, 21 Jan 2008)
New Revision: 122
Modified:
/
trunk/debian/changelog
trunk/piuparts-master.py
Log:
Updated piuparts-master to write summary files of pacakge states, for Debian BTS and Ubuntu developer weather report changes.
Property changes on:
___________________________________________________________________
Name: bzr:revision-info
- timestamp: 2007-12-07 21:51:01.331000090 +0200
committer: Lars Wirzenius <liw at iki.fi>
properties:
branch-nick: piuparts.upstream
+ timestamp: 2008-01-21 20:33:10.405999899 +0200
committer: Lars Wirzenius <liw at iki.fi>
properties:
branch-nick: piuparts.upstream
Name: bzr:ancestry:v3-none
- liw at iki.fi-20071105201927-x9hsrn0rzn1ojjwd
liw at iki.fi-20071105212614-utwqgghd1c996gg6
liw at iki.fi-20071108201837-pwscbj9iiwm8h41o
liw at iki.fi-20071108205138-rg1xn3b9hz36u1f8
+ liw at iki.fi-20071105201927-x9hsrn0rzn1ojjwd
liw at iki.fi-20071105212614-utwqgghd1c996gg6
liw at iki.fi-20071108201837-pwscbj9iiwm8h41o
liw at iki.fi-20071108205138-rg1xn3b9hz36u1f8
liw at iki.fi-20080121135526-l4u4qrkzirown9xj
Name: bzr:revision-id:v3-none
- 104 liw at iki.fi-20071105202024-ahct8ts13awaqfku
105 liw at iki.fi-20071105212653-ttr3062izcfvnyj7
106 liw at iki.fi-20071105212929-y8o8937i99hqouad
107 liw at iki.fi-20071108202016-kb4x591yu6kxbt03
108 liw at iki.fi-20071108203319-yn2spqgvngjw0ydc
109 liw at iki.fi-20071108205411-ztzieylautujrbet
110 liw at iki.fi-20071129200714-xtqnfccm1rjof5e7
111 liw at iki.fi-20071207174615-4wey2v30mft1p9ak
112 liw at iki.fi-20071207195101-sray98kgdx0vnip5
+ 104 liw at iki.fi-20071105202024-ahct8ts13awaqfku
105 liw at iki.fi-20071105212653-ttr3062izcfvnyj7
106 liw at iki.fi-20071105212929-y8o8937i99hqouad
107 liw at iki.fi-20071108202016-kb4x591yu6kxbt03
108 liw at iki.fi-20071108203319-yn2spqgvngjw0ydc
109 liw at iki.fi-20071108205411-ztzieylautujrbet
110 liw at iki.fi-20071129200714-xtqnfccm1rjof5e7
111 liw at iki.fi-20071207174615-4wey2v30mft1p9ak
112 liw at iki.fi-20071207195101-sray98kgdx0vnip5
123 liw at iki.fi-20080121183310-39shlqe4z4ge2iyp
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2008-01-05 09:56:16 UTC (rev 121)
+++ trunk/debian/changelog 2008-01-21 18:33:27 UTC (rev 122)
@@ -17,6 +17,10 @@
saying "True".
* piuparts.py: Use lsb-release to guess the Debian flavor.
* debian/control: Added dependency on lsb-release.
+ * piuparts-master.py: Make the master write summary of total pass/fail
+ packages, plus status per binary package. This is for having the
+ Debian PTS and the Ubuntu developer weather report show summaries
+ of piuparts results.
[ Holger Levsen ]
* Added myself to uploaders.
@@ -38,7 +42,7 @@
symlinks (used for logging) were being read from files on the real root
filesystem, rather than in the chroot.
- -- John Wright <jsw at debian.org> Sat, 05 Jan 2008 02:30:15 -0700
+ -- Lars Wirzenius <liw at iki.fi> Mon, 21 Jan 2008 15:53:48 +0200
piuparts (0.28) unstable; urgency=low
Modified: trunk/piuparts-master.py
===================================================================
--- trunk/piuparts-master.py 2008-01-05 09:56:16 UTC (rev 121)
+++ trunk/piuparts-master.py 2008-01-21 18:33:27 UTC (rev 122)
@@ -27,12 +27,15 @@
import logging
import urllib
import ConfigParser
+import os
+import tempfile
import piupartslib
CONFIG_FILE = "piuparts-master.conf"
+CONFIG_FILE = "/etc/piuparts/piuparts-master.conf"
def setup_logging(log_level, log_file_name):
@@ -104,6 +107,14 @@
class Master(Protocol):
+ _failed_states = (
+ "failed-testing",
+ "fix-not-yet-tested",
+ )
+ _passed_states = (
+ "successfully-tested",
+ )
+
def __init__(self, input, output, packages_file, section=None):
Protocol.__init__(self, input, output)
self._commands = {
@@ -168,7 +179,62 @@
self._db.make_package_untestable(args[0], args[1], log)
self._short_response("ok")
+ def count_packages_in_states(self, states):
+ count = 0
+ for state in states:
+ count += len(self._db.get_packages_in_state(state))
+ return count
+ def rename_if_newer_else_delete(self, orig, new):
+ ok = True
+ if os.path.exists(orig):
+ st_orig = os.stat(orig)
+ st_new = os.stat(new)
+ ok = st_orig.st_mtime < st_new.st_mtime
+ if ok:
+ os.rename(new, orig)
+ else:
+ os.remove(new)
+
+ def write_counts_summary(self):
+ fd, name = tempfile.mkstemp(prefix="counts.txt.", dir=".")
+ os.close(fd)
+
+ failed = self.count_packages_in_states(self._failed_states)
+ passed = self.count_packages_in_states(self._passed_states)
+
+ f = file(name, "w")
+ f.write("Fail: %d\n" % failed)
+ f.write("Pass: %d\n" % passed)
+ f.close()
+ self.rename_if_newer_else_delete("counts.txt", name)
+
+ def find_log(self, package):
+ n = self._db._logdb._log_name(package["Package"], package["Version"])
+ for dirname in self._db._all:
+ nn = os.path.join(dirname, n)
+ if os.path.exists(nn):
+ return nn
+ return None
+
+ def write_packages_summary(self):
+ fd, name = tempfile.mkstemp(prefix="packages.txt.", dir=".")
+ os.close(fd)
+
+ f = file(name, "w")
+ for pkgname in self._db._packages:
+ state = self._db.state_by_name(pkgname)
+ logname = self.find_log(self._db._packages[pkgname]) or ""
+ f.write("%s %s %s\n" % (pkgname, state, logname))
+ f.close()
+
+ self.rename_if_newer_else_delete("packages.txt", name)
+
+ def write_summaries(self):
+ self.write_counts_summary()
+ self.write_packages_summary()
+
+
def main():
# For supporting multiple architectures and suites, we take a command-line
# argument referring to a section in the master configuration file. For
@@ -188,8 +254,9 @@
packages_file = piupartslib.open_packages_url(config["packages-url"])
m = Master(sys.stdin, sys.stdout, packages_file, section=section)
packages_file.close()
- while m.do_transaction():
- pass
+# while m.do_transaction():
+# pass
+ m.write_summaries()
if __name__ == "__main__":
More information about the Piuparts-commits
mailing list