public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] V2 Add Logic to detect file type by extension
@ 2022-05-04 19:51 Ben Woodard
  2022-05-12 10:12 ` Dodji Seketeli
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Woodard @ 2022-05-04 19:51 UTC (permalink / raw)
  To: libabigail; +Cc: vsoch, Ben Woodard

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] V2 Add Logic to detect file type by extension
  2022-05-04 19:51 [PATCH] V2 Add Logic to detect file type by extension Ben Woodard
@ 2022-05-12 10:12 ` Dodji Seketeli
  0 siblings, 0 replies; 2+ messages in thread
From: Dodji Seketeli @ 2022-05-12 10:12 UTC (permalink / raw)
  To: Ben Woodard via Libabigail; +Cc: Ben Woodard, vsoch

Ben Woodard via Libabigail <libabigail@sourceware.org> a écrit:

> 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>


Applied to master, thanks!

Cheers,

-- 
		Dodji

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-16 14:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-04 19:51 [PATCH] V2 Add Logic to detect file type by extension Ben Woodard
2022-05-12 10:12 ` Dodji Seketeli

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).