Skip to content
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: improve parsing of Package.gz metadata, matching Debian parser logic #43

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion apt/private/package_index.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,17 @@ def _parse_package_index(state, contents, arch, root):
pkg[last_key] += "\n" + line
continue

(key, value) = line.split(": ", 1)
# This allows for (more) graceful parsing of Package metadata (such as X-* attributes)
# which may contain patterns that are non-standard. This logic is intended to closely follow
# the Debian team's parser logic:
# * https://salsa.debian.org/python-debian-team/python-debian/-/blob/master/src/debian/deb822.py?ref_type=heads#L788
split = line.split(": ", 1)
key = split[0]
value = ""

if len(split) == 2:
value = split[1]

if not last_key and len(pkg) == 0 and key != "Package":
fail("do not expect this. fix it.")

Expand Down
Loading