Colin Watson has proposed merging 
lp:~cjwatson/launchpad-buildd/better-run-logging into lp:launchpad-buildd.

Commit message:
Improve "RUN:" log messages to be copy-and-pasteable as shell commands,
which is sometimes useful while debugging.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-buildd/better-run-logging/+merge/328625
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of 
lp:~cjwatson/launchpad-buildd/better-run-logging into lp:launchpad-buildd.
=== modified file 'debian/changelog'
--- debian/changelog	2017-08-03 13:13:08 +0000
+++ debian/changelog	2017-08-05 10:06:50 +0000
@@ -15,6 +15,8 @@
   * Rewrite override-sources-list in Python, allowing it to have unit tests.
   * Rewrite add-trusted-keys in Python, allowing it to have unit tests.
   * Configure sbuild to use schroot sessions rather than sudo.
+  * Improve "RUN:" log messages to be copy-and-pasteable as shell commands,
+    which is sometimes useful while debugging.
 
  -- Colin Watson <cjwat...@ubuntu.com>  Tue, 25 Jul 2017 23:07:58 +0100
 

=== modified file 'lpbuildd/slave.py'
--- lpbuildd/slave.py	2017-07-28 13:19:47 +0000
+++ lpbuildd/slave.py	2017-08-05 10:06:50 +0000
@@ -22,6 +22,9 @@
 from twisted.python import log
 from twisted.web import xmlrpc
 
+from lpbuildd.util import shell_escape
+
+
 devnull = open("/dev/null", "r")
 
 
@@ -136,7 +139,8 @@
         if iterate is None:
             iterate = self.iterate
         self._subprocess = RunCapture(self._slave, iterate, stdin=stdin)
-        self._slave.log("RUN: %s %r\n" % (command, args))
+        self._slave.log("RUN: %s %s\n" % (
+            command, " ".join(shell_escape(arg) for arg in args[1:])))
         childfds = {
             0: devnull.fileno() if stdin is None else "w",
             1: "r",

=== modified file 'lpbuildd/tests/buildlog'
--- lpbuildd/tests/buildlog	2017-05-11 11:42:19 +0000
+++ lpbuildd/tests/buildlog	2017-08-05 10:06:50 +0000
@@ -1,10 +1,10 @@
-RUN: /usr/share/launchpad-buildd/slavebin/unpack-chroot ['unpack-chroot', '370614-896976', '/home/buildd/filecache-default/a40e3c410938399b35051833fe5244f9ac6f3774']
+RUN: /usr/share/launchpad-buildd/slavebin/unpack-chroot 370614-896976 /home/buildd/filecache-default/a40e3c410938399b35051833fe5244f9ac6f3774
 Unpacking chroot for build 370614-896976
-RUN: /usr/share/launchpad-buildd/slavebin/mount-chroot ['mount-chroot', '370614-896976']
+RUN: /usr/share/launchpad-buildd/slavebin/mount-chroot 370614-896976
 Mounting chroot for build 370614-896976
-RUN: /usr/share/launchpad-buildd/slavebin/apply-ogre-model ['apply-ogre-model', '370614-896976', 'universe']
+RUN: /usr/share/launchpad-buildd/slavebin/apply-ogre-model 370614-896976 universe
 Attempting OGRE for universe in build-370614-896976
-RUN: /usr/share/launchpad-buildd/slavebin/update-debian-chroot ['update-debian-chroot', '370614-896976']
+RUN: /usr/share/launchpad-buildd/slavebin/update-debian-chroot 370614-896976
 Updating debian chroot for build 370614-896976
 Get:1 http://buildd:secret@ftpmaster.internal gutsy Release.gpg [191B]
 Get:2 http://ftpmaster.internal gutsy Release [65.9kB]

=== modified file 'lpbuildd/tests/buildlog.long'
--- lpbuildd/tests/buildlog.long	2017-05-11 11:42:19 +0000
+++ lpbuildd/tests/buildlog.long	2017-08-05 10:06:50 +0000
@@ -1,10 +1,10 @@
-RUN: /usr/share/launchpad-buildd/slavebin/unpack-chroot ['unpack-chroot', '370614-896976', '/home/buildd/filecache-default/a40e3c410938399b35051833fe5244f9ac6f3774']
+RUN: /usr/share/launchpad-buildd/slavebin/unpack-chroot 370614-896976 /home/buildd/filecache-default/a40e3c410938399b35051833fe5244f9ac6f3774
 Unpacking chroot for build 370614-896976
-RUN: /usr/share/launchpad-buildd/slavebin/mount-chroot ['mount-chroot', '370614-896976']
+RUN: /usr/share/launchpad-buildd/slavebin/mount-chroot 370614-896976
 Mounting chroot for build 370614-896976
-RUN: /usr/share/launchpad-buildd/slavebin/apply-ogre-model ['apply-ogre-model', '370614-896976', 'universe']
+RUN: /usr/share/launchpad-buildd/slavebin/apply-ogre-model 370614-896976 universe
 Attempting OGRE for universe in build-370614-896976
-RUN: /usr/share/launchpad-buildd/slavebin/update-debian-chroot ['update-debian-chroot', '370614-896976']
+RUN: /usr/share/launchpad-buildd/slavebin/update-debian-chroot 370614-896976
 Updating debian chroot for build 370614-896976
 Get:1 http://buildd:secret@ftpmaster.internal gutsy Release.gpg [191B]
 Get:2 http://ftpmaster.internal gutsy Release [65.9kB]
@@ -22,59 +22,59 @@
 After unpacking 94.2kB of additional disk space will be used.
 (Reading database ... 8942 files and directories currently installed.)
 socat STDIO PROXY:snap-proxy.launchpad.dev:github.com:443,proxyport=3128,proxyauth=user:blah
-RUN: /usr/share/launchpad-buildd/slavebin/unpack-chroot ['unpack-chroot', '370614-896976', '/home/buildd/filecache-default/a40e3c410938399b35051833fe5244f9ac6f3774']
-Unpacking chroot for build 370614-896976
-RUN: /usr/share/launchpad-buildd/slavebin/mount-chroot ['mount-chroot', '370614-896976']
-Mounting chroot for build 370614-896976
-RUN: /usr/share/launchpad-buildd/slavebin/apply-ogre-model ['apply-ogre-model', '370614-896976', 'universe']
-Attempting OGRE for universe in build-370614-896976
-RUN: /usr/share/launchpad-buildd/slavebin/update-debian-chroot ['update-debian-chroot', '370614-896976']
-Updating debian chroot for build 370614-896976
-Get:1 http://buildd:secret@ftpmaster.internal gutsy Release.gpg [191B]
-Get:2 http://ftpmaster.internal gutsy Release [65.9kB]
-Get:3 http://user:blah@ftpmaster.internal gutsy/main Packages [1085kB]
-Get:4 http://ftpmaster.internal gutsy/universe Packages [3991kB]
-Fetched 5142kB in 5s (1012kB/s)
-Reading package lists...
-Reading package lists...
-Building dependency tree...
-The following packages will be upgraded:
-  apt bsdutils cpp g++ gcc initscripts libdb4.4 mount pkgbinarymangler sysv-rc
-  sysvutils util-linux
-12 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
-Need to get 0B/2832kB of archives.
-After unpacking 94.2kB of additional disk space will be used.
-(Reading database ... 8942 files and directories currently installed.)
-RUN: /usr/share/launchpad-buildd/slavebin/unpack-chroot ['unpack-chroot', '370614-896976', '/home/buildd/filecache-default/a40e3c410938399b35051833fe5244f9ac6f3774']
-Unpacking chroot for build 370614-896976
-RUN: /usr/share/launchpad-buildd/slavebin/mount-chroot ['mount-chroot', '370614-896976']
-Mounting chroot for build 370614-896976
-RUN: /usr/share/launchpad-buildd/slavebin/apply-ogre-model ['apply-ogre-model', '370614-896976', 'universe']
-Attempting OGRE for universe in build-370614-896976
-RUN: /usr/share/launchpad-buildd/slavebin/update-debian-chroot ['update-debian-chroot', '370614-896976']
-Updating debian chroot for build 370614-896976
-Get:1 http://buildd:secret@ftpmaster.internal gutsy Release.gpg [191B]
-Get:2 http://ftpmaster.internal gutsy Release [65.9kB]
-Get:3 http://user:blah@ftpmaster.internal gutsy/main Packages [1085kB]
-Get:4 http://ftpmaster.internal gutsy/universe Packages [3991kB]
-Fetched 5142kB in 5s (1012kB/s)
-Reading package lists...
-Reading package lists...
-Building dependency tree...
-The following packages will be upgraded:
-  apt bsdutils cpp g++ gcc initscripts libdb4.4 mount pkgbinarymangler sysv-rc
-  sysvutils util-linux
-12 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
-Need to get 0B/2832kB of archives.
-After unpacking 94.2kB of additional disk space will be used.
-(Reading database ... 8942 files and directories currently installed.)
-RUN: /usr/share/launchpad-buildd/slavebin/unpack-chroot ['unpack-chroot', '370614-896976', '/home/buildd/filecache-default/a40e3c410938399b35051833fe5244f9ac6f3774']
-Unpacking chroot for build 370614-896976
-RUN: /usr/share/launchpad-buildd/slavebin/mount-chroot ['mount-chroot', '370614-896976']
-Mounting chroot for build 370614-896976
-RUN: /usr/share/launchpad-buildd/slavebin/apply-ogre-model ['apply-ogre-model', '370614-896976', 'universe']
-Attempting OGRE for universe in build-370614-896976
-RUN: /usr/share/launchpad-buildd/slavebin/update-debian-chroot ['update-debian-chroot', '370614-896976']
+RUN: /usr/share/launchpad-buildd/slavebin/unpack-chroot 370614-896976 /home/buildd/filecache-default/a40e3c410938399b35051833fe5244f9ac6f3774
+Unpacking chroot for build 370614-896976
+RUN: /usr/share/launchpad-buildd/slavebin/mount-chroot 370614-896976
+Mounting chroot for build 370614-896976
+RUN: /usr/share/launchpad-buildd/slavebin/apply-ogre-model 370614-896976 universe
+Attempting OGRE for universe in build-370614-896976
+RUN: /usr/share/launchpad-buildd/slavebin/update-debian-chroot 370614-896976
+Updating debian chroot for build 370614-896976
+Get:1 http://buildd:secret@ftpmaster.internal gutsy Release.gpg [191B]
+Get:2 http://ftpmaster.internal gutsy Release [65.9kB]
+Get:3 http://user:blah@ftpmaster.internal gutsy/main Packages [1085kB]
+Get:4 http://ftpmaster.internal gutsy/universe Packages [3991kB]
+Fetched 5142kB in 5s (1012kB/s)
+Reading package lists...
+Reading package lists...
+Building dependency tree...
+The following packages will be upgraded:
+  apt bsdutils cpp g++ gcc initscripts libdb4.4 mount pkgbinarymangler sysv-rc
+  sysvutils util-linux
+12 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Need to get 0B/2832kB of archives.
+After unpacking 94.2kB of additional disk space will be used.
+(Reading database ... 8942 files and directories currently installed.)
+RUN: /usr/share/launchpad-buildd/slavebin/unpack-chroot 370614-896976 /home/buildd/filecache-default/a40e3c410938399b35051833fe5244f9ac6f3774
+Unpacking chroot for build 370614-896976
+RUN: /usr/share/launchpad-buildd/slavebin/mount-chroot 370614-896976
+Mounting chroot for build 370614-896976
+RUN: /usr/share/launchpad-buildd/slavebin/apply-ogre-model 370614-896976 universe
+Attempting OGRE for universe in build-370614-896976
+RUN: /usr/share/launchpad-buildd/slavebin/update-debian-chroot 370614-896976
+Updating debian chroot for build 370614-896976
+Get:1 http://buildd:secret@ftpmaster.internal gutsy Release.gpg [191B]
+Get:2 http://ftpmaster.internal gutsy Release [65.9kB]
+Get:3 http://user:blah@ftpmaster.internal gutsy/main Packages [1085kB]
+Get:4 http://ftpmaster.internal gutsy/universe Packages [3991kB]
+Fetched 5142kB in 5s (1012kB/s)
+Reading package lists...
+Reading package lists...
+Building dependency tree...
+The following packages will be upgraded:
+  apt bsdutils cpp g++ gcc initscripts libdb4.4 mount pkgbinarymangler sysv-rc
+  sysvutils util-linux
+12 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Need to get 0B/2832kB of archives.
+After unpacking 94.2kB of additional disk space will be used.
+(Reading database ... 8942 files and directories currently installed.)
+RUN: /usr/share/launchpad-buildd/slavebin/unpack-chroot 370614-896976 /home/buildd/filecache-default/a40e3c410938399b35051833fe5244f9ac6f3774
+Unpacking chroot for build 370614-896976
+RUN: /usr/share/launchpad-buildd/slavebin/mount-chroot 370614-896976
+Mounting chroot for build 370614-896976
+RUN: /usr/share/launchpad-buildd/slavebin/apply-ogre-model 370614-896976 universe
+Attempting OGRE for universe in build-370614-896976
+RUN: /usr/share/launchpad-buildd/slavebin/update-debian-chroot 370614-896976
 Updating debian chroot for build 370614-896976
 Get:1 http://buildd:secret@ftpmaster.internal gutsy Release.gpg [191B]
 Get:2 http://must:go@ftpmaster.internal gutsy Release [65.9kB]

=== modified file 'lpbuildd/tests/test_1.diff'
--- lpbuildd/tests/test_1.diff	2017-05-11 11:42:19 +0000
+++ lpbuildd/tests/test_1.diff	2017-08-05 10:06:50 +0000
@@ -5,7 +5,7 @@
 @@ -6,9 +6,9 @@
 
  Attempting OGRE for universe in build-370614-896976
- RUN: /usr/share/launchpad-buildd/slavebin/update-debian-chroot ['update-debian-chroot', '370614-896976']
+ RUN: /usr/share/launchpad-buildd/slavebin/update-debian-chroot 370614-896976
  Updating debian chroot for build 370614-896976
 -Get:1 http://buildd:secret@ftpmaster.internal gutsy Release.gpg [191B]
 +Get:1 http://ftpmaster.internal gutsy Release.gpg [191B]

=== modified file 'lpbuildd/tests/test_2.diff'
--- lpbuildd/tests/test_2.diff	2017-05-11 11:42:19 +0000
+++ lpbuildd/tests/test_2.diff	2017-08-05 10:06:50 +0000
@@ -2,11 +2,13 @@
 
 +++  
 
-@@ -1,10 +1,9 @@
+@@ -1,12 +1,11 @@
 
--l ['apply-ogre-model', '370614-896976', 'universe']
+-are/launchpad-buildd/slavebin/mount-chroot 370614-896976
+ Mounting chroot for build 370614-896976
+ RUN: /usr/share/launchpad-buildd/slavebin/apply-ogre-model 370614-896976 universe
  Attempting OGRE for universe in build-370614-896976
- RUN: /usr/share/launchpad-buildd/slavebin/update-debian-chroot ['update-debian-chroot', '370614-896976']
+ RUN: /usr/share/launchpad-buildd/slavebin/update-debian-chroot 370614-896976
  Updating debian chroot for build 370614-896976
 -Get:1 http://buildd:secret@ftpmaster.internal gutsy Release.gpg [191B]
 +Get:1 http://ftpmaster.internal gutsy Release.gpg [191B]
@@ -16,10 +18,10 @@
  Get:4 http://ftpmaster.internal gutsy/universe Packages [3991kB]
  Fetched 5142kB in 5s (1012kB/s)
  Reading package lists...
-@@ -25,9 +24,9 @@
+@@ -27,9 +26,9 @@
 
  Attempting OGRE for universe in build-370614-896976
- RUN: /usr/share/launchpad-buildd/slavebin/update-debian-chroot ['update-debian-chroot', '370614-896976']
+ RUN: /usr/share/launchpad-buildd/slavebin/update-debian-chroot 370614-896976
  Updating debian chroot for build 370614-896976
 -Get:1 http://buildd:secret@ftpmaster.internal gutsy Release.gpg [191B]
 -Get:2 http://must:go@ftpmaster.internal gutsy Release [65.9kB]

_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to     : launchpad-reviewers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help   : https://help.launchpad.net/ListHelp

Reply via email to