repoman: canonical path for repo location compare
authorZac Medico <zmedico@gentoo.org>
Tue, 25 Jun 2013 18:50:01 +0000 (11:50 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 25 Jun 2013 18:50:01 +0000 (11:50 -0700)
bin/repoman

index 2a3b4f30f3482b439a87ce7588a0f75986de9e36..60286dbc82dbbc89fc1122dd4c26754894d0f428 100755 (executable)
@@ -582,8 +582,9 @@ if options.mode == 'commit' and not options.pretend and not vcs:
        options.pretend = True
 
 # Ensure that current repository is in the list of enabled repositories.
+repodir = os.path.realpath(portdir_overlay)
 try:
-       repoman_settings.repositories.get_repo_for_location(portdir_overlay)
+       repoman_settings.repositories.get_repo_for_location(repodir)
 except KeyError:
        repo_name = portage.repository.config.RepoConfig._read_valid_repo_name(portdir_overlay)[0]
        layout_conf_data = portage.repository.config.parse_layout_conf(portdir_overlay)[0]
@@ -607,22 +608,14 @@ portdb = trees[root]['porttree'].dbapi
 
 # Constrain dependency resolution to the master(s)
 # that are specified in layout.conf.
-repodir = os.path.realpath(portdir_overlay)
 repo_config = repoman_settings.repositories.get_repo_for_location(repodir)
 portdb.porttrees = list(repo_config.eclass_db.porttrees)
 portdir = portdb.porttrees[0]
 commit_env = os.environ.copy()
 # list() is for iteration on a copy.
 for repo in list(repoman_settings.repositories):
-       found = False
-       for location in [portdir_overlay] + [x.location for x in repo_config.masters]:
-               try:
-                       if os.path.samefile(location, repo.location):
-                               found = True
-                               break
-               except OSError:
-                       pass
-       if not found:
+       # all paths are canonical
+       if repo.location not in [repodir] + [x.location for x in repo_config.masters]:
                del repoman_settings.repositories[repo.name]
 
 if repo_config.allow_provide_virtual: