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

Add per-file MIME information to v6 packages #3318

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

pmatilai
Copy link
Member

@pmatilai pmatilai commented Sep 20, 2024

Besides some pre-requisite refactoring, the gist of this is that v6 packages get per-file MIME types and libmagic strings are dropped, v4 packages continue to get the libmagic string classification. It's an awful lot of near-duplication but we can't very well reuse the tag. Details in commit messages.

Fixes: #1096

We just want a const reference to the string here really. Small miracle
this compiled, much less worked.
To pun or not to pun, that's up to the reader.
libmagic strings are useful for humans but less so for computers,
in particular when you start having things like

     PNG image data, 16 x 16, 8-bit/color RGBA, non-interlaced

All very fascinating but that level of image detail does not need to be
in package metadata. The libmagic strings also make the exact output
quite dependent on the exact libmagic version. They obviously want to
improve their output but for rpm's purposes, this is unwanted
instability. MIME types are far more predictable and also machine
processable in a whole different level, and that is what we'll use
for v6 packages.

We need to still produce fully compatible v4 packages though, and there are
external tools that look at the file class data in that tag, so we can't
just reuse the tag for MIME in v6 either. Which means we need to
duplicate all this goo, annoyingly. We get to drop some of it in v7,
one day...

Besides the concrete dictionary + per-file index header tags, add a
header extension to fill in gaps of data where possible and build into
a consumable format and add --filemime query alias for it, all very
very similar to --fileclass.

Add/adjust tests to match and show the difference between v4 and v6:
v4 packages have fileclass but only extension-populated mime types,
and v6 is the exact opposite.

Fixes: rpm-software-management#1096
@pmatilai pmatilai requested review from a team and ffesti and removed request for a team September 20, 2024 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFE: Add MIME classification of all files to packages
1 participant