From: Ben Woodard <woodard@redhat.com>
To: libabigail@sourceware.org
Cc: vsoch <vsoch@users.noreply.github.com>, Ben Woodard <woodard@redhat.com>
Subject: [PATCH] V2 Add Logic to detect file type by extension
Date: Wed, 4 May 2022 12:51:38 -0700 [thread overview]
Message-ID: <20220504195137.1790994-1-woodard@redhat.com> (raw)
From: vsoch <vsoch@users.noreply.github.com>
Changes since V1
Merge in the correct version of the patch not an early diagnostic
one.
Fedabipkgdiff uses mimetypes to detect what file type it is looking
at. In some minimal versions of the OS, in particular container
images, the package that includes all the mimetypes may not be
installed. This allows fedabipkgdiff to fall back to using the
extension.
* tools/fedabipkgdiff - add logic to detect file type by extension
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
Reviewed-by: Ben Woodard <woodard@redhat.com>
---
tools/fedabipkgdiff | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/fedabipkgdiff b/tools/fedabipkgdiff
index dc80a6ef..c05bd8b1 100755
--- a/tools/fedabipkgdiff
+++ b/tools/fedabipkgdiff
@@ -213,6 +213,10 @@ def is_rpm_file(filename):
mimetype = mimetypes.guess_type(filename)[0] if isfile else None
isrpm = (mimetype == 'application/x-redhat-package-manager'
or mimetype == 'application/x-rpm')
+
+ # Most systems won't have rpm defined as a mimetype
+ if not mimetype and filename.endswith('.rpm'):
+ isrpm = True
logger.debug('is_rpm_file(\'%s\'): isfile=%s, mimetype=\'%s\', isrpm=%s',
filename, isfile, mimetype, isrpm)
return isrpm
--
2.35.1
next reply other threads:[~2022-05-04 19:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-04 19:51 Ben Woodard [this message]
2022-05-12 10:12 ` Dodji Seketeli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220504195137.1790994-1-woodard@redhat.com \
--to=woodard@redhat.com \
--cc=libabigail@sourceware.org \
--cc=vsoch@users.noreply.github.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).