Some of the URLs don't have a schema (ex: http) and it blocks the loader from downloading the corresponding repos.
This diff should fix the issue.
Related T3294
Differential D6138
package/utils: Handle downloads for urls with missing schema KShivendu on Aug 26 2021, 6:21 AM. Authored by
Details
Diff Detail
Event TimelineComment Actions Build has FAILED Patch application report for D6138 (id=22211)Rebasing onto 63a8a61cbc... Current branch diff-target is up to date. Changes applied before testcommit c0873e9a435a0cdc523cf71e048f4dafed2fb556 Author: KShivendu <shivendu@iitbhilai.ac.in> Date: Thu Aug 26 09:46:48 2021 +0530 package/utils: Handle downloads for urls with missing schema Summary: Some of the URLs don't have a schema (ex: http) and it blocks the loader from downloading the corresponding repos. This diff should fix the issue. Related T3294 Test Plan: Reviewers: Subscribers: Link to build: https://jenkins.softwareheritage.org/job/DLDBASE/job/tests-on-diff/508/ Comment Actions Build is green Patch application report for D6138 (id=22211)Rebasing onto 50b062adc7... First, rewinding head to replay your work on top of it... Applying: package/utils: Handle downloads for urls with missing schema Changes applied before testcommit 3ef8c5213311f658d288cff4f9e39020429b9bdb Author: KShivendu <shivendu@iitbhilai.ac.in> Date: Thu Aug 26 09:46:48 2021 +0530 package/utils: Handle downloads for urls with missing schema Summary: Some of the URLs don't have a schema (ex: http) and it blocks the loader from downloading the corresponding repos. This diff should fix the issue. Related T3294 Test Plan: Reviewers: Subscribers: See https://jenkins.softwareheritage.org/job/DLDBASE/job/tests-on-diff/523/ for more details.
Comment Actions I don't think this is something that we should do by default, because the semantics of a URI with no scheme are ambiguous in general. If the semantics of the nix sources.json is that download URIs with no protocol have an implicit http scheme added, then such url mangling should be implemented in the nix loader directly. Comment Actions
Good point. The function is indeed used by all package loaders. As the issue is only So, that probably means you want to override the main loader implementation which calls def download_package( self, p_info: TPackageInfo, tmpdir: str ) -> List[Tuple[str, Mapping]]: if not urlparse(p_info.url).scheme: p_info = attr.evolve(p_info, url=f"http://{url}") # or https... ;) return super().download_package(p_info, tmpdir) Comment Actions You could either override download_package to try https, then fall back to http if that fails, or change the NixGuixPackageInfo to add http:// to urls missing a scheme (https://forge.softwareheritage.org/source/swh-loader-core/browse/master/swh/loader/package/nixguix/loader.py$52). Changing NixGuixPackageInfo feels cleaner/more explicit, but overriding the download method (to get the https -> http fallback) may be more flexible. Comment Actions
I agree as well. I liked your cleaner approach indeed. Note that we have some future improvments regarding ftp [1] which is unsupported as well (not for that diff). oh there is even a task for it ;) [1] https://sentry.softwareheritage.org/share/issue/7dc92745d96442d482a493c64b6eae91/ [2] T2687 Comment Actions
Comment Actions Build is green Patch application report for D6138 (id=22413)Rebasing onto 50b062adc7... First, rewinding head to replay your work on top of it... Applying: nixguix: Handle downloads for urls with missing schema Changes applied before testcommit 87211e3a078590a1a6b8e7d38df6e39ff848d2ac Author: KShivendu <shivendu@iitbhilai.ac.in> Date: Thu Aug 26 09:46:48 2021 +0530 nixguix: Handle downloads for urls with missing schema Some of the URLs don't have a schema (ex: http) and it blocks the loader from downloading the corresponding repos. This diff should fix the issue. Related T3294 See https://jenkins.softwareheritage.org/job/DLDBASE/job/tests-on-diff/533/ for more details. Comment Actions @ardumont @olasd can we do this:
Comment Actions Thanks for this change! If we're to generalize this change for other loaders, then I think the default should be "no fallback" (i.e. the fallback behavior should be opt-in).
|