python3Packages.{pyimg4,smart-meter-texas}: fix against asn1 3.x by adding asn1_2 - #26
Merged
Merged
Conversation
python-asn1 3.0.0 changed Decoder.read() to recursively decode constructed elements into lists instead of returning their raw content octets, Encoder.write() with Types.Constructed to re-encode each item of the value instead of emitting pre-encoded octets verbatim, and Decoder.eof() to be relative to the whole input instead of the entered container. Consumers written against the 2.x raw-octet API cannot be pointed at 3.x unchanged. pyimg4 is the only consumer in tree: it pins asn1<3.0.0 upstream (m1stadev/PyIMG4#59) and has been marked broken since asn1 was updated to 3.x. asn1 itself stays on 3.3.0 as the default. Validation: nix-build -A python3Packages.asn1_2 (upstream tests/test_asn1.py pass on 3.12, 3.13, 3.14).
Marked broken in ef300f4 because asn1 is 3.3.0 and pyimg4 pins asn1<3.0.0. The pin is not stale metadata: with the constraint relaxed, 5 of 7 tests fail with "asn1.core.Error: Expecting bytes or a subclass of io.RawIOBase or BufferedIOBase. Get <class list> instead" and "UnexpectedTagError: Expected tag of type IA5String, got PrintableString", because Decoder.read() no longer returns the raw content octets that parser.py re-parses and re-emits. Upstream declined the port in m1stadev/PyIMG4#59 ("pyimg4 should be refactored around it first") and has not released since v0.8.8, so build against asn1_2 rather than patch. This unblocks ipsw-parser and pymobiledevice3, which fail to evaluate through pyimg4. A port is proposed in m1stadev/PyIMG4#63; once released, this can move back to asn1. Validation: nix-build -A python3Packages.pyimg4 (7 passed, 5 deselected), -A python3Packages.ipsw-parser, -A python3Packages.pymobiledevice3 (56 passed, 1 xfailed); nix-store -qR on the pymobiledevice3 output shows asn1 2.8.0 only, no collision with 3.3.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
python3Packages.pyimg4has been marked broken since ef300f4, which setbroken = lib.versionAtLeast asn1.version "3". nixpkgs shipsasn13.3.0, so the guard always fires and takesipsw-parserandpymobiledevice3down with it:The pin is not stale metadata. With the constraint relaxed and
brokendropped, 5 of 7 tests fail against asn1 3.3.0:python-asn1 3.0 changed
Decoder.read()to recursively decode constructed elements into nested lists instead of returning their raw content octets, which is whatparser.pyre-parses and re-emits throughout. Upstream declined the port in m1stadev/PyIMG4#59 ("Version 3.0.0 is technically much better, but pyimg4 should be refactored around it first to support it") and has not released since v0.8.8 in April 2025.So this adds
asn1_2at 2.8.0, the last 2.x, and buildspyimg4against it, following the existing convention for versioned Python attributes (cython_0,chardet_5,django_5).asn1stays at 3.3.0 as the default;pyimg4is its only in-tree consumer (smart-meter-texasis the other, andldap3usespyasn1, notasn1). NopythonRelaxDepsis needed since 2.8.0 satisfies upstream'sasn1>=2.7.0,<3.0.0directly.I have also proposed the actual port upstream in m1stadev/PyIMG4#63. Once that lands and is released,
pyimg4can move back toasn1andasn1_2can go.Verification
nix-store -qRon thepymobiledevice3output containspython3.14-asn1-2.8.0and no 3.3.0, so there is no module collision in the closure.The affected set is closed and was built in full by hand rather than via
nixpkgs-review:asn1_2is new and onlypyimg4consumes it,pyimg4's only reverse dependency isipsw-parser, whose only reverse dependency ispymobiledevice3, which nothing else in tree depends on. All four are built above.Things done
sandbox = trueset in/etc/nix/nix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)