scripts/cros_sdk: Avoid multiple leading dots in chroot lock file.
This ensures that the lock file name ('.<chroot_name>_lock') does start
with more than one dot, in the case where the chroot directory name
itself starts with one.
BUG=brillo:608
TEST=Workspace chroot lock file starts with a single dot.
Change-Id: I83e4c9b333cc9b6b0eb125a23210be1661350f75
Reviewed-on: https://chromium-review.googlesource.com/260967
Trybot-Ready: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: David Pursell <dpursell@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/scripts/cros_sdk.py b/scripts/cros_sdk.py
index 4168081..681d5a0 100644
--- a/scripts/cros_sdk.py
+++ b/scripts/cros_sdk.py
@@ -577,8 +577,8 @@
urls = GetArchStageTarballs(sdk_version)
lock_path = os.path.dirname(options.chroot)
- lock_path = os.path.join(lock_path,
- '.%s_lock' % os.path.basename(options.chroot))
+ lock_path = os.path.join(
+ lock_path, '.%s_lock' % os.path.basename(options.chroot).lstrip('.'))
with cgroups.SimpleContainChildren('cros_sdk', pid=first_pid):
with locking.FileLock(lock_path, 'chroot lock') as lock: