-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Flat Repository Format #55
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,19 +9,35 @@ def _fetch_package_index(rctx, url, dist, comp, arch, integrity): | |
r = {"success": False, "integrity": None} | ||
|
||
decompression_successful = False | ||
|
||
for file_type, tool in file_types.items(): | ||
output = "{}/Packages.{}".format(target_triple, file_type) | ||
r = rctx.download( | ||
url = "{}/dists/{}/{}/binary-{}/Packages.{}".format(url, dist, comp, arch, file_type), | ||
output = output, | ||
integrity = integrity, | ||
allow_fail = True, | ||
) | ||
if r.success: | ||
re = rctx.execute(tool + [output]) | ||
if re.return_code == 0: | ||
decompression_successful = True | ||
break | ||
|
||
# Attempt to pull Packages archive from within the `dists` hierarchy first, | ||
# if that fails - assume the repository is of type "flat" | ||
Comment on lines
+15
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not following the Debian repo format spec that you mentioned. In there, they show the two
and one for flat repos:
I think the convention is that IMHO we should use the same in the YAML manifest, something like:
and use the slash to distinguish between "canonical" and flat repos. Also, although the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i agree with your findings there. |
||
try_urls = [ | ||
"{}/dists/{}/{}/binary-{}/Packages.{}".format(url, dist, comp, arch, file_type), | ||
"{}/Packages.{}".format(url, file_type), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does flat repositories play with different architectures? in the manifest format we support specifying architectures matrix which i don't see being applied here. I believe we should disallow flat repositories to be combined with non flat repositories to prevent confusion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think disallowing flat repos mixed with "classic" repos is really needed. You can have flat repos with multiple architectures (e.g. https://cloud.r-project.org/bin/linux/debian/bullseye-cran40/ has Personally, as I mentioned in #64 (comment) if there are specific packages in specific architectures I'd just separate them and use another manifest. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, that makes this even more confusing. How does flat repos interact with arches? for instance if you want to install I don't see how this PR allows discovery of arches in flat repositories as of today. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @thesayyn ah, maybe you are right and there's more fixes needed. I'll try to test the PR and see where it breaks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @thesayyn OK, I think I got it, the main issue that I found so far (and it's been a very quick look so maybe there's more issues / corner cases) is that in This is actually happening in this PR and the proof is in the lock and, easier to see, in the test itself :D Check my comment in
Now, the fix that I would propose here is the following: diff --git a/apt/private/package_index.bzl b/apt/private/package_index.bzl
index 34f8202..8d6f922 100644
--- a/apt/private/package_index.bzl
+++ b/apt/private/package_index.bzl
@@ -77,7 +77,8 @@ def _parse_package_index(state, contents, arch, root):
if len(pkg.keys()) != 0:
pkg["Root"] = root
- util.set_dict(state.packages, value = pkg, keys = (arch, pkg["Package"], pkg["Version"]))
+ arch_ = arch if pkg["Architecture"] == "all" else pkg["Architecture"]
+ util.set_dict(state.packages, value = pkg, keys = (arch_, pkg["Package"], pkg["Version"]))
last_key = ""
pkg = {} IMHO this "is not great" because it's duping the packages that are valid across all architectures N times (as many as architectures we have in the manifest). It's not too bad, it's just some storage space wasted and "some mismatch" between the repo structure that is on disk (the per-arch folders) VS the actual contents of the tar files (this can be seen in the dpk-status in the test, e.g. |
||
] | ||
|
||
for try_url in try_urls: | ||
r = rctx.download( | ||
url = try_url, | ||
output = output, | ||
integrity = integrity, | ||
allow_fail = True, | ||
) | ||
if r.success: | ||
re = rctx.execute(tool + [output]) | ||
if re.return_code == 0: | ||
decompression_successful = True | ||
break | ||
|
||
# If we've set `decompression_successful` to true at any point in the iteration loop, | ||
# break out of the loop as we have found and extracted the Package archive and have what is | ||
# needed to continue. | ||
if decompression_successful: | ||
break | ||
|
||
if not r.success: | ||
fail("unable to download package index") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we not add a dependency here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thesayyn what about moving it to the bottom of the file and marking it as a
dev_dependency
? Would that work?