← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~bac/lpsetup/setup_x into lp:lpsetup

 

Brad Crittenden has proposed merging lp:~bac/lpsetup/setup_x into lp:lpsetup.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~bac/lpsetup/setup_x/+merge/121427

Our work-around for having the execute bits stripped from lpsetup/bin/launchpad-database-setup.sh requires us to specify the interpreter manually.  In order to be safe, we check to ensure it is what we expect.
-- 
https://code.launchpad.net/~bac/lpsetup/setup_x/+merge/121427
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~bac/lpsetup/setup_x into lp:lpsetup.
=== renamed file 'lpsetup/bin/launchpad-database-setup' => 'lpsetup/bin/launchpad-database-setup.sh' (properties changed: +x to -x)
=== modified file 'lpsetup/subcommands/init_target.py'
--- lpsetup/subcommands/init_target.py	2012-08-24 18:49:30 +0000
+++ lpsetup/subcommands/init_target.py	2012-08-27 14:30:29 +0000
@@ -266,10 +266,16 @@
 def setup_database(user):
     """Setup Launchpad database."""
     with su(user):
-        script_name = 'launchpad-database-setup'
+        script_name = 'launchpad-database-setup.sh'
         here = os.path.dirname(__file__)
         script_path = os.path.join(here, '..', 'bin', script_name)
-        call('/bin/sh', script_path, user)
+        with open(script_path, 'r') as f:
+            line = f.readline()
+            interpreter = '/bin/sh'
+            assert line.startswith('#!' + interpreter), (
+                'Interpreter for {0} is not {1}.'.format(
+                    script_path, interpreter))
+        call(interpreter, script_path, user)
 
 setup_database.description = """Setup database for Launchpad use."""