diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-11-11 18:20:10 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-11-11 18:20:10 +0000 |
commit | 0306e76205c764fe2e81ac9325b6fdf5bc9a5cf7 (patch) | |
tree | 219169907087d7065b38b24e4c96123ff8bea2d8 | |
parent | e3f47e08bc36b751125b3252c1ea46c3ea0e970d (diff) | |
download | portage-0306e76205c764fe2e81ac9325b6fdf5bc9a5cf7.tar.gz portage-0306e76205c764fe2e81ac9325b6fdf5bc9a5cf7.tar.bz2 portage-0306e76205c764fe2e81ac9325b6fdf5bc9a5cf7.zip |
Make FindPortdir() fall back to have_profile_dir() checks if it can't match
the current location with anything from PORTDIR_OVERLAY. Assume that an
overlay will contain at least a "repo_name" file while a master repo (portdir)
will contain at least a "profiles.desc" file.
svn path=/main/trunk/; revision=11855
-rw-r--r-- | pym/repoman/utilities.py | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py index 807ff1ba9..cee52186e 100644 --- a/pym/repoman/utilities.py +++ b/pym/repoman/utilities.py @@ -95,11 +95,13 @@ def detect_vcs_conflicts(options, vcs): sys.exit(retval) -def have_profile_dir(path, maxdepth=3): - """ Try to figure out if 'path' has a /profiles dir in it by checking for a package.mask file +def have_profile_dir(path, maxdepth=3, filename="profiles.desc"): + """ + Try to figure out if 'path' has a profiles/ + dir in it by checking for the given filename. """ while path != "/" and maxdepth: - if os.path.exists(os.path.join(path, "profiles", "profiles.desc")): + if os.path.exists(os.path.join(path, "profiles", filename)): return normalize_path(path) path = normalize_path(path + "/..") maxdepth -= 1 @@ -379,9 +381,21 @@ def FindPortdir(settings): if have_profile_dir(location, subdir.count("/")): portdir = portdir_overlay break - - del p, s, path_ids - + + # Couldn't match location with anything from PORTDIR_OVERLAY, + # so fall back to have_profile_dir() checks alone. Assume that + # an overlay will contain at least a "repo_name" file while a + # master repo (portdir) will contain at least a "profiles.desc" + # file. + if not portdir_overlay: + portdir_overlay = have_profile_dir(location, filename="repo_name") + if portdir_overlay: + subdir = location[len(portdir_overlay):] + if subdir and subdir[-1] != os.sep: + subdir += os.sep + if have_profile_dir(location, subdir.count(os.sep)): + portdir = portdir_overlay + if not portdir_overlay: if (settings["PORTDIR"] + os.path.sep).startswith(location): portdir_overlay = settings["PORTDIR"] |