diff options
Diffstat (limited to 'lib/path_util.py')
-rw-r--r-- | lib/path_util.py | 57 |
1 files changed, 8 insertions, 49 deletions
diff --git a/lib/path_util.py b/lib/path_util.py index 099023816..bf4e0b66e 100644 --- a/lib/path_util.py +++ b/lib/path_util.py @@ -11,7 +11,6 @@ import os import tempfile from chromite.cbuildbot import constants -from chromite.lib import bootstrap_lib from chromite.lib import cros_build_lib from chromite.lib import git from chromite.lib import osutils @@ -23,7 +22,6 @@ CHROME_CACHE_DIR = '.cros_cache' CHECKOUT_TYPE_UNKNOWN = 'unknown' CHECKOUT_TYPE_GCLIENT = 'gclient' CHECKOUT_TYPE_REPO = 'repo' -CHECKOUT_TYPE_SDK_BOOTSTRAP = 'bootstrap' CheckoutInfo = collections.namedtuple( 'CheckoutInfo', ['type', 'root', 'chrome_src_dir']) @@ -234,28 +232,6 @@ class ChrootPathResolver(object): return self._ConvertPath(path, self._GetHostPath) -def _IsSdkBootstrapCheckout(path): - """Return True if |path| is an SDK bootstrap. - - A bootstrap is a lone git checkout of chromite. It cannot be managed by repo. - Underneath this bootstrap chromite, there are several SDK checkouts, each - managed by repo. - """ - submodule_git = os.path.join(path, '.git') - if not git.IsSubmoduleCheckoutRoot(submodule_git, 'origin', - constants.CHROMITE_URL): - # Not a git checkout of chromite. - return False - - # This could be an SDK under sdk_checkouts or the parent bootstrap. - # It'll be an SDK checkout if it has a parent ".repo". - if git.FindRepoDir(path): - # It is managed by repo, therefore it is a child SDK checkout. - return False - - return True - - def DetermineCheckout(cwd): """Gather information on the checkout we are in. @@ -263,11 +239,6 @@ def DetermineCheckout(cwd): This function determines what checkout type |cwd| is in, for example, if |cwd| belongs to a `repo` checkout. - There is a special case when |cwd| is a child SDK checkout of a bootstrap - chromite (e.g. something under chromite/sdk_checkouts/xxx.yyy.zzz/). This - case should report that |cwd| belongs to a bootstrap checkout instead of the - `repo` checkout of the "xxx.yyy.zzz" child SDK. - Returns: A CheckoutInfo object with these attributes: type: The type of checkout. Valid values are CHECKOUT_TYPE_*. @@ -278,24 +249,15 @@ def DetermineCheckout(cwd): checkout_type = CHECKOUT_TYPE_UNKNOWN root, path = None, None - # Check for SDK bootstrap first because it goes top to bottom. - # If we do it bottom to top, we'll hit chromite/sdk_checkouts/*/.repo first - # and will wrongly conclude that this is a repo checkout. So we go top down - # to visit chromite/ first. - for path in osutils.IteratePaths(cwd): - if _IsSdkBootstrapCheckout(path): - checkout_type = CHECKOUT_TYPE_SDK_BOOTSTRAP + for path in osutils.IteratePathParents(cwd): + gclient_file = os.path.join(path, '.gclient') + if os.path.exists(gclient_file): + checkout_type = CHECKOUT_TYPE_GCLIENT + break + repo_dir = os.path.join(path, '.repo') + if os.path.isdir(repo_dir): + checkout_type = CHECKOUT_TYPE_REPO break - else: - for path in osutils.IteratePathParents(cwd): - gclient_file = os.path.join(path, '.gclient') - if os.path.exists(gclient_file): - checkout_type = CHECKOUT_TYPE_GCLIENT - break - repo_dir = os.path.join(path, '.repo') - if os.path.isdir(repo_dir): - checkout_type = CHECKOUT_TYPE_REPO - break if checkout_type != CHECKOUT_TYPE_UNKNOWN: root = path @@ -315,9 +277,6 @@ def FindCacheDir(): path = None if checkout.type == CHECKOUT_TYPE_REPO: path = os.path.join(checkout.root, GENERAL_CACHE_DIR) - elif checkout.type == CHECKOUT_TYPE_SDK_BOOTSTRAP: - path = os.path.join(checkout.root, bootstrap_lib.SDK_CHECKOUTS, - GENERAL_CACHE_DIR) elif checkout.type == CHECKOUT_TYPE_GCLIENT: path = os.path.join(checkout.root, CHROME_CACHE_DIR) elif checkout.type == CHECKOUT_TYPE_UNKNOWN: |