launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #09920
[Merge] lp:~bac/lpsetup/fix-inithost-install-lxc-deux into lp:lpsetup
Brad Crittenden has proposed merging lp:~bac/lpsetup/fix-inithost-install-lxc-deux into lp:lpsetup.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~bac/lpsetup/fix-inithost-install-lxc-deux/+merge/114896
Changes to the handling of external path and working dir in the update steps.
Minor changes that are carry over from the review of the previous branch.
--
https://code.launchpad.net/~bac/lpsetup/fix-inithost-install-lxc-deux/+merge/114896
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~bac/lpsetup/fix-inithost-install-lxc-deux into lp:lpsetup.
=== modified file 'lpsetup/handlers.py'
--- lpsetup/handlers.py 2012-07-11 15:47:34 +0000
+++ lpsetup/handlers.py 2012-07-13 16:03:18 +0000
@@ -236,6 +236,7 @@
raise ValidationError(err)
directory = directory.replace('~', namespace.home_dir)
+ directory = os.path.abspath(directory)
if not directory.startswith(namespace.home_dir + os.path.sep):
raise ValidationError(
'argument {0} does not reside under the home '
@@ -275,15 +276,6 @@
return os.path.abspath(os.path.expanduser(path))
-def handle_external_path(namespace):
- """Handle path to externals.
-
- The external directory is the one that contains the sourcecode and
- download-cache.
- """
- namespace.external_path = normalize_path(namespace.external_path)
-
-
def handle_working_dir(namespace):
"""Handle path to the working directory."""
namespace.working_dir = normalize_path(namespace.working_dir)
=== modified file 'lpsetup/subcommands/finish_inithost.py'
--- lpsetup/subcommands/finish_inithost.py 2012-07-12 18:23:37 +0000
+++ lpsetup/subcommands/finish_inithost.py 2012-07-13 16:03:18 +0000
@@ -91,6 +91,6 @@
self.add_common_arguments(parser)
parser.add_argument(
'-u', '--user',
- help='The name of the system user to be created or updated. '
+ help='The name of the system user. '
'The current user is used if this script is not run as '
'root and this argument is omitted.')
=== modified file 'lpsetup/subcommands/update.py'
--- lpsetup/subcommands/update.py 2012-07-12 22:12:09 +0000
+++ lpsetup/subcommands/update.py 2012-07-13 16:03:18 +0000
@@ -24,20 +24,22 @@
)
-def initialize_directories(external_path):
+def initialize_directories(working_dir, external_path):
"""Initialize the eggs, yui, and sourcecode directories.
Create them if necessary.
"""
for dir_ in ['eggs', 'yui', 'sourcecode']:
- mkdirs(os.path.join(external_path, dir_))
-
-
-def update_dependencies(external_path, working_dir, use_http):
+ mkdirs(os.path.join(working_dir, external_path, dir_))
+
+
+def update_dependencies(working_dir, external_path, use_http):
"""Update the external dependencies."""
use_http_param = '--use-http' if use_http else None
cmd = os.path.join(working_dir, 'utilities', 'update-sourcecode')
- source_path = os.path.join(external_path, 'sourcecode')
+ abs_external_path = os.path.abspath(
+ os.path.join(working_dir, external_path))
+ source_path = os.path.join(abs_external_path, 'sourcecode')
run(cmd, use_http_param, source_path)
# Update the download cache.
@@ -48,7 +50,7 @@
run('bzr', 'co', '-v', '--lightweight', LP_SOURCE_DEPS, download_cache)
# Link to the external sourcecode.
- if external_path != working_dir:
+ if abs_external_path != working_dir:
cmd = os.path.join(
working_dir, 'utilities', 'link-external-sourcecode')
run(cmd,
@@ -69,14 +71,13 @@
"""
steps = (
- (initialize_directories, 'external_path'),
- (update_dependencies, 'external_path', 'working_dir', 'use_http'),
+ (initialize_directories, 'working_dir', 'external_path'),
+ (update_dependencies, 'working_dir', 'external_path', 'use_http'),
(update_tree, 'working_dir'),
)
help = __doc__
handlers = (
# Normalize paths and default to cwd if none exists.
- handlers.handle_external_path,
handlers.handle_working_dir,
)
@@ -85,7 +86,8 @@
parser.add_argument(
'-e', '--external-path', default='.',
help='Path to directory that contains sourcecode '
- 'and download-cache directories.')
+ 'and download-cache directories, relative to the '
+ 'working-dir. ')
def add_arguments(self, parser):
super(SubCommand, self).add_arguments(parser)
=== modified file 'lpsetup/tests/subcommands/test_update.py'
--- lpsetup/tests/subcommands/test_update.py 2012-07-12 22:12:09 +0000
+++ lpsetup/tests/subcommands/test_update.py 2012-07-13 16:03:18 +0000
@@ -22,9 +22,10 @@
'-W', '~/' + get_random_string(),
)
-init_dir_step = (update.initialize_directories, ['external_path'])
+init_dir_step = (
+ update.initialize_directories, ['working_dir', 'external_path'])
update_dep_step = (
- update.update_dependencies, ['external_path', 'working_dir', 'use_http'])
+ update.update_dependencies, ['working_dir', 'external_path', 'use_http'])
update_tree_step = (update.update_tree, ['working_dir'])
@@ -34,7 +35,6 @@
sub_command_class = update.SubCommand
expected_arguments = get_arguments()
expected_handlers = (
- handlers.handle_external_path,
handlers.handle_working_dir,
)
expected_steps = (