← Back to team overview

yellow team mailing list archive

[Merge] lp:~frankban/lpsetup/minor-fixes into lp:lpsetup

 

Francesco Banconi has proposed merging lp:~frankban/lpsetup/minor-fixes into lp:lpsetup.

Requested reviews:
  Yellow Squad (yellow)

For more details, see:
https://code.launchpad.net/~frankban/lpsetup/minor-fixes/+merge/117699

== Changes ==

Inverted the order of *su* and *cd* context managers to avoid permission denied errors, e.g.::

    being in /root as root, before: 
        su user
            cd /home/user
                [real stuff]
            cd /root --> premission denied
    and now:
        cd /home/user
            su user
                [real stuff]
            su root
        cd /root
        
        
 s/run/call in update sub command to give the user some feedback on what's happening.
-- 
https://code.launchpad.net/~frankban/lpsetup/minor-fixes/+merge/117699
Your team Yellow Squad is requested to review the proposed merge of lp:~frankban/lpsetup/minor-fixes into lp:lpsetup.
=== modified file 'lpsetup/subcommands/finish_inithost.py'
--- lpsetup/subcommands/finish_inithost.py	2012-07-30 10:05:19 +0000
+++ lpsetup/subcommands/finish_inithost.py	2012-08-01 15:09:42 +0000
@@ -40,7 +40,7 @@
 
     # Launchpad database setup.
     # nested is required for use by python 2.6.
-    with nested(su(user), cd(target_dir)):
+    with nested(cd(target_dir), su(user)):
         call('utilities/launchpad-database-setup', user)
 
     # Make and install launchpad.

=== modified file 'lpsetup/subcommands/update.py'
--- lpsetup/subcommands/update.py	2012-07-30 10:05:19 +0000
+++ lpsetup/subcommands/update.py	2012-08-01 15:09:42 +0000
@@ -10,15 +10,16 @@
     ]
 
 import os.path
+
 from shelltoolbox import (
     cd,
     mkdirs,
-    run,
     )
 
 from lpsetup import argparser
 from lpsetup import handlers
 from lpsetup.settings import LP_SOURCE_DEPS
+from lpsetup.utils import call
 
 
 def initialize_directories(target_dir, external_path):
@@ -41,20 +42,20 @@
     abs_external_path = os.path.abspath(
         os.path.join(target_dir, external_path))
     source_path = os.path.join(abs_external_path, 'sourcecode')
-    run(cmd, use_http_param, source_path)
+    call(cmd, use_http_param, source_path)
 
     # Update the download cache.
     download_cache = os.path.join(target_dir, 'download-cache')
     if os.path.exists(download_cache):
-        run('bzr', 'up', download_cache)
+        call('bzr', 'up', download_cache)
     else:
-        run('bzr', 'co', '-v', '--lightweight', LP_SOURCE_DEPS, download_cache)
+        call('bzr', 'co', '-v', '--lightweight', LP_SOURCE_DEPS, download_cache)
 
     # Link to the external sourcecode.
     if abs_external_path != target_dir:
         cmd = os.path.join(
             target_dir, 'utilities', 'link-external-sourcecode')
-        run(cmd,
+        call(cmd,
             '--target', target_dir,
             '--parent', external_path)
 
@@ -66,7 +67,7 @@
 def update_tree(target_dir):
     """Update the tree at target_dir with the latest LP code."""
     with cd(target_dir):
-        run('bzr', 'pull')
+        call('bzr', 'pull')
 
 update_tree.description = """Update the tree at $target_dir with the \
     latest LP code.