autobuild: add some system information to the autobuild tarball
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Tue, 30 Jun 2015 22:45:47 +0000 (10:45 +1200)
committerStefan Metzmacher <metze@samba.org>
Wed, 21 Oct 2015 09:27:09 +0000 (11:27 +0200)
When running multiple autobuilds on VMs with various parameters, you
can easily get confused about which was which, and the tarball doesn't
help much. This adds an extra file with information about the system.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
script/autobuild.py

index c91ff2c8237e87644512e782487fd70c378d518c..209ad1f27ccdfba830557c02e32b29b0ebefafa7 100755 (executable)
@@ -362,6 +362,16 @@ class buildlist(object):
         self.kill_kids()
         return (0, None, None, None, "All OK")
 
+    def write_system_info(self):
+        filename = 'system-info.txt'
+        f = open(filename, 'w')
+        for cmd in ['uname -a', 'free', 'cat /proc/cpuinfo']:
+            print >>f, '### %s' % cmd
+            print >>f, run_cmd(cmd, output=True, checkfail=False)
+            print >>f
+        f.close()
+        return filename
+
     def tarlogs(self, fname):
         tar = tarfile.open(fname, "w:gz")
         for b in self.tlist:
@@ -369,6 +379,8 @@ class buildlist(object):
             tar.add(b.stderr_path, arcname="%s.stderr" % b.tag)
         if os.path.exists("autobuild.log"):
             tar.add("autobuild.log")
+        sys_info = self.write_system_info()
+        tar.add(sys_info)
         tar.close()
 
     def remove_logs(self):