tools/mpp: expand basurl after dep-solving

We create the urls for the packages after dep-solving. During the
big refactoring (802f4010) the code that would expand the base url
during that step got lost. Re-introduce that so that local repos
work correctly again.
Also make sure the path is absolute before calling `as_uri` since
it is not guranteed that the result will be a `file:///` uri.

Reported-by: Stephen Smoogen <smooge@smoogespace.com>
This commit is contained in:
Christian Kellner 2021-07-16 11:27:28 +00:00
parent bd8cd7443a
commit 9e599fca17

View file

@ -248,7 +248,7 @@ class DepSolver:
result = urllib.parse.urlparse(baseurl)
if not result.scheme:
path = basedir.joinpath(baseurl)
return path.as_uri()
return path.resolve().as_uri()
except: # pylint: disable=bare-except
pass
@ -337,6 +337,7 @@ class DepSolver:
path = tsi.pkg.relativepath
reponame = tsi.pkg.reponame
baseurl = self.base.repos[reponame].baseurl[0]
baseurl = self.expand_baseurl(baseurl)
# dep["path"] often starts with a "/", even though it's meant to be
# relative to `baseurl`. Strip any leading slashes, but ensure there's
# exactly one between `baseurl` and the path.