tools/mpp-depsolve: ensure canonical urls
Technically, a few extra "/"s don't matter, but in practice, it sometimes does. In particular, rpmrepo returns `500 Internal Server Error` when a path contains additional "/"s.
This commit is contained in:
parent
423e38cf5d
commit
792b2ac5fc
1 changed files with 6 additions and 1 deletions
|
|
@ -49,6 +49,7 @@ import json
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import urllib.parse
|
||||||
|
|
||||||
import dnf
|
import dnf
|
||||||
import hawkey
|
import hawkey
|
||||||
|
|
@ -169,7 +170,11 @@ def _manifest_depsolve(state, stage):
|
||||||
deps = _dnf_resolve(state, options_mpp)
|
deps = _dnf_resolve(state, options_mpp)
|
||||||
for dep in deps:
|
for dep in deps:
|
||||||
options_packages.append(dep["checksum"])
|
options_packages.append(dep["checksum"])
|
||||||
state.manifest_urls[dep["checksum"]] = baseurl + "/" + dep["path"]
|
# 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.
|
||||||
|
url = urllib.parse.urljoin(baseurl + "/", dep["path"].lstrip("/"))
|
||||||
|
state.manifest_urls[dep["checksum"]] = url
|
||||||
|
|
||||||
|
|
||||||
def _main_args(argv):
|
def _main_args(argv):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue