← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~james-w/launchpad/fix-buildrecipe into lp:launchpad/devel

 

James Westby has proposed merging lp:~james-w/launchpad/fix-buildrecipe into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


Fixes for buildrecipe:

  - Work on maverick by working around a bzr bug by setting BZR_EMAIL.
    - This was tried before, but sudo filtered the environment, so it didn't work.
  - Work on jaunty by calling sudo -i -u instead of sudo -iu.
  - Flush the output before calling a subcommand, so that the build log
    is correctly interleaved.

Thanks,

James

-- 
https://code.launchpad.net/~james-w/launchpad/fix-buildrecipe/+merge/33240
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~james-w/launchpad/fix-buildrecipe into lp:launchpad/devel.
=== modified file 'lib/canonical/buildd/buildrecipe'
--- lib/canonical/buildd/buildrecipe	2010-08-12 21:58:18 +0000
+++ lib/canonical/buildd/buildrecipe	2010-08-20 17:31:10 +0000
@@ -8,7 +8,6 @@
 
 
 import os
-import os.path
 import pwd
 import socket
 from subprocess import call
@@ -76,11 +75,17 @@
             recipe = recipe_file.read()
         finally:
             recipe_file.close()
+        # As of bzr 2.2, a defined identity is needed.  In this case, we're using
+        # buildd@<hostname>.
+        hostname = socket.gethostname()
+        bzr_email = 'buildd@%s' % hostname
+
         print 'Building recipe:'
         print recipe
         retcode = self.chroot([
-            'sudo', '-iu', self.username, 'DEBEMAIL=%s' % self.author_email,
-            'DEBFULLNAME=%s' % self.author_name.encode('utf-8'), 'bzr',
+            'sudo', '-i', '-u', self.username, 'DEBEMAIL=%s' % self.author_email,
+            'DEBFULLNAME=%s' % self.author_name.encode('utf-8'),
+            'BZR_EMAIL=%s' % bzr_email, 'bzr',
             'dailydeb', '--no-build', recipe_path_relative,
             self.tree_path_relative, '--manifest', manifest_path_relative,
             '--append-version', '~%s1' % self.distroseries_name],
@@ -127,6 +132,7 @@
         if echo:
             print "Running in chroot: %s" % ' '.join(
                 "'%s'" % arg for arg in args)
+            sys.stdout.flush()
         return call([
             '/usr/bin/sudo', '/usr/sbin/chroot', self.chroot_path] + args)
 
@@ -156,11 +162,6 @@
         os.environ["HOME"], "build-" + build_id, *extra)
 
 if __name__ == '__main__':
-    # As of bzr 2.2, a defined identity is needed.  In this case, we're using
-    # buildd@<hostname>.
-    hostname = socket.gethostname()
-    os.environ['BZR_EMAIL'] = 'buildd@%s' % hostname
-
     builder = RecipeBuilder(*sys.argv[1:])
     if builder.install() != 0:
         sys.exit(RETCODE_FAILURE_INSTALL)

=== modified file 'lib/canonical/buildd/debian/changelog'
--- lib/canonical/buildd/debian/changelog	2010-08-16 19:29:00 +0000
+++ lib/canonical/buildd/debian/changelog	2010-08-20 17:31:10 +0000
@@ -1,3 +1,15 @@
+launchpad-buildd (69) hardy-cat; urgency=low
+
+  [ James Westby ]
+  * buildrecipe: Specify BZR_EMAIL via sudo so that the called command
+    sees the environment variable.
+  * buildrecipe: call sudo -i -u instead of sudo -iu so that it works with
+    older versions of sudo.
+  * buildrecipe: flush stdout before calling another command so that
+    the build log has the output correctly interleaved.
+
+ -- James Westby <james.westby@xxxxxxxxxx>  Fri, 20 Aug 2010 13:20:15 -0400
+
 launchpad-buildd (68) hardy-cat; urgency=low
 
   [ William Grant ]