-
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
Fix issues with deb_index and Nvidia's apt repository #67
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 |
---|---|---|
|
@@ -16,11 +16,14 @@ def _add_package(lock, package, arch): | |
k = _package_key(package, arch) | ||
if k in lock.fast_package_lookup: | ||
return | ||
filename = package["Filename"] | ||
if filename.startswith("./"): | ||
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. When 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. FYI, this is not what the spec says, check https://wiki.debian.org/DebianRepository/Format#Filename:
I've checked the R-Project flat repos and this doesn't happen / is not needed. However, this is something that happens in the NVIDIA CUDA flat repos . Thus, I think that this is a quirk of some specific flat repos that don't conform with the Debian repo spec. 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. Super interesting. I was looking for documentation on the manifest format for a debian repository and was having a hard time finding anything authoritative. Thanks for sharing the link. |
||
filename = filename[2:] | ||
lock.packages.append({ | ||
"key": k, | ||
"name": package["Package"], | ||
"version": package["Version"], | ||
"url": "%s/%s" % (package["Root"], package["Filename"]), | ||
"url": "%s/%s" % (package["Root"], filename), | ||
"sha256": package["SHA256"], | ||
"arch": arch, | ||
"dependencies": [], | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,25 +3,36 @@ | |
load(":util.bzl", "util") | ||
|
||
def _fetch_package_index(rctx, url, dist, comp, arch, integrity): | ||
target_triple = "{dist}/{comp}/{arch}".format(dist = dist, comp = comp, arch = arch) | ||
# Split the URL by the '://' delimiter | ||
protocol, rest = url.split("://") | ||
|
||
# Split the rest of the URL by the '/' delimiter and take the first part | ||
domain = rest.split("/")[0] | ||
|
||
target_triple = "{domain}/{dist}/{comp}/{arch}".format(domain = domain, dist = dist, comp = comp, arch = arch) | ||
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. We needed to add
|
||
|
||
file_types = {"xz": ["xz", "--decompress"], "gz": ["gzip", "-d"]} | ||
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 | ||
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. This line adds support for Nvidia's |
||
] | ||
for package_index_url in urls: | ||
r = rctx.download( | ||
url = package_index_url, | ||
output = output, | ||
integrity = integrity, | ||
allow_fail = True, | ||
) | ||
if r.success: | ||
re = rctx.execute(tool + [output]) | ||
if re.return_code == 0: | ||
decompression_successful = True | ||
return ("{}/Packages".format(target_triple), r.integrity) | ||
|
||
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.
We had packages that shared duplicate transitive dependencies. The duplicate deps were a blocking issue, so I used a depset to dedupe packages.
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.
Do you have an example the package(s) that broke? Were they packages in the NVIDIA CUDA repos?
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.
@jjmaestro I had this in my sources:
And this in my packages:
I think those would replicate the issue.
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.
@benmccown I'm checking the
Packages
index and there's nocuda-11-8
package, onlycudnn9-cuda-11-8
:-/ I'll try to test with the latter and with other packages to see if I can repro it as well.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.
@benmccown OK, I looked more carefully and I was using the wrong
Packages
index / arch but that's also the problem for the repro, I can't get both of those packages for bothamd64
andarm64
(they are only available foramd64
IIRC).Have a look at jjmaestro/rules_distroless/tree/testing-cuda-packages, I have one commit there so far: jjmaestro@f216178, this is a test running on top of #97.
I've gotten it to work with just the
cuda-11-8
package inarm64
, and since that's the largest package by far, I think it's probably working but I'll change the example I'm working on to onlyamd64
and see if something breaks when adding both packages.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.
I've found yet-another-issue when testing with
amd64
... the failure I'm getting is because there's a Debian package that's already compressed as atar.gz
, see #98. I'll see if I can work around that issue and test things further but so far, I haven't seen duplicate transitive dependencies.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.
Alright, @benmccown please check jjmaestro/rules_distroless/tree/testing-cuda-packages.
I didn't get any errors / issues with duplicate transitive dependencies. I have it all working after porting #99 and also making sure I flatten the layers to avoid
max depth exceeded
(#36) and also, usingpkg_tar
to flatten, to avoidduplicates of file paths not supported
Docker errors (e.g. bazelbuild/rules_docker#246).Can you check that branch and confirm if that works for you?
Thanks!