summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvsoch <vsoch@users.noreply.github.com>2022-05-04 12:51:38 -0700
committerDodji Seketeli <dodji@redhat.com>2022-05-12 12:10:15 +0200
commit707e47f4ceaafe35ade74c7d382c4b30eb9c5ea5 (patch)
treeea20293371a788882eb31970b41b8d95aa4fa30f
parentAdd an option ignore SONAME differences in libraries (diff)
downloadlibabigail-707e47f4ceaafe35ade74c7d382c4b30eb9c5ea5.tar.gz
libabigail-707e47f4ceaafe35ade74c7d382c4b30eb9c5ea5.tar.bz2
libabigail-707e47f4ceaafe35ade74c7d382c4b30eb9c5ea5.tar.xz
Add Logic to detect file type by extension
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> Signed-off-by: Dodji Seketeli <dodji@redhat.com>
-rwxr-xr-xtools/fedabipkgdiff4
1 files changed, 4 insertions, 0 deletions
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):
213 mimetype = mimetypes.guess_type(filename)[0] if isfile else None 213 mimetype = mimetypes.guess_type(filename)[0] if isfile else None
214 isrpm = (mimetype == 'application/x-redhat-package-manager' 214 isrpm = (mimetype == 'application/x-redhat-package-manager'
215 or mimetype == 'application/x-rpm') 215 or mimetype == 'application/x-rpm')
216
217 # Most systems won't have rpm defined as a mimetype
218 if not mimetype and filename.endswith('.rpm'):
219 isrpm = True
216 logger.debug('is_rpm_file(\'%s\'): isfile=%s, mimetype=\'%s\', isrpm=%s', 220 logger.debug('is_rpm_file(\'%s\'): isfile=%s, mimetype=\'%s\', isrpm=%s',
217 filename, isfile, mimetype, isrpm) 221 filename, isfile, mimetype, isrpm)
218 return isrpm 222 return isrpm