elf: remove dependency on magic
Metadata
Current evaluation
Merged. Replaced python-magic dependency with readelf for ELF parsing, including general code cleanup. Validated across i386, armhf, and arm64 architectures. Approved by reviewer and passed CI checks.
Suggested action: —
No scores available.
Issue body
Migrate to using readelf which we already use and do a general cleanup.
LP: #1742504
- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)?
- [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)?
- [x] Have you successfully run `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged. Replaced python-magic dependency with readelf for ELF parsing, including general code cleanup. Validated across i386, armhf, and arm64 architectures. Approved by reviewer and passed CI checks. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged replacing python-magic with readelf for ELF parsing. Verified across i386, armhf, and arm64, this update aligns with existing tooling, improves cross-architecture reliability, and avoids pyelfutils maintenance overhead. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged removal of the magic library dependency for ELF parsing. Code now uses readelf for improved cross-architecture support and easier maintenance. Successfully tested and approved across i386, armhf, and arm64. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1899 elf: readelf dependency | snapcraft | closed | Merged. The change ensures the readelf dependency is properly added and utilized based on the execution environment. Approved by one reviewer with passing checks. | |
| #2000 elf: remove dead code | snapcraft | merged | Merged removal of dead code in the ELF module. The unused magic string was eliminated after the logic migrated to the ElfFile class. Approved by a reviewer and passed CI checks. |