diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-05-19 22:57:23 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-05-19 22:57:23 +0000 |
commit | 354a199f48d247fdabfcf49f2edf4183be770001 (patch) | |
tree | 37b77100cfead96b0359e89e67f8494a81676306 /bin | |
parent | For bug #178378, make the default src_compile() check for configure in ${ECON... (diff) | |
download | portage-idfetch-354a199f48d247fdabfcf49f2edf4183be770001.tar.gz portage-idfetch-354a199f48d247fdabfcf49f2edf4183be770001.tar.bz2 portage-idfetch-354a199f48d247fdabfcf49f2edf4183be770001.zip |
Use device number and i-node number (like os.path.samefile does) to check if the current directory is inside a given overlay. This solves issues with path comparison and symlinks.
svn path=/main/trunk/; revision=6559
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/repoman | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/bin/repoman b/bin/repoman index b87180cc..8ec4af83 100755 --- a/bin/repoman +++ b/bin/repoman @@ -421,13 +421,28 @@ if "PWD" in os.environ and os.environ["PWD"] != mydir and \ # the current working directory (from the shell). mydir = os.environ["PWD"] mydir = normalize_path(mydir) +path_ids = set() +p = mydir +s = None +while True: + s = os.stat(p) + path_ids.add((s.st_dev, s.st_ino)) + if p == "/": + break + p = os.path.dirname(p) if mydir[-1] != "/": mydir += "/" for overlay in repoman_settings["PORTDIR_OVERLAY"].split(): + overlay = os.path.realpath(overlay) + try: + s = os.stat(overlay) + except OSError: + continue + overlay_id = (s.st_dev, s.st_ino) if overlay[-1] != "/": overlay += "/" - if mydir.startswith(overlay): + if overlay_id in path_ids: portdir_overlay = overlay subdir = mydir[len(overlay):] if subdir and subdir[-1] != "/": @@ -436,6 +451,8 @@ for overlay in repoman_settings["PORTDIR_OVERLAY"].split(): portdir = portdir_overlay break +del p, s, path_ids + if not portdir_overlay: if (repoman_settings["PORTDIR"] + os.path.sep).startswith(mydir): portdir_overlay = repoman_settings["PORTDIR"] |