public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] fedabipkgdiff: Also accept MIME type 'application/x-redhat-package-manager' for RPM files
@ 2021-12-17 22:34 Thomas Schwinge
  2021-12-21 13:55 ` Dodji Seketeli
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Schwinge @ 2021-12-17 22:34 UTC (permalink / raw)
  To: libabigail; +Cc: Thomas Schwinge, Chenxiong Qi

... as that's what a few Debian and Ubuntu systems are using, that I just
sampled:

    $ awk '$2 ~ /rpm/' < /etc/mime.types
    application/x-redhat-package-manager            rpm
    $ dpkg -S /etc/mime.types
    media-types: /etc/mime.types
    $ apt policy media-types
    media-types:
      Installed: 4.0.0
      Candidate: 4.0.0
      Version table:
     *** 4.0.0 900
            900 http://ftp.de.debian.org/debian testing/main amd64 Packages
            900 http://ftp.de.debian.org/debian testing/main i386 Packages
            800 http://ftp.de.debian.org/debian unstable/main amd64 Packages
            800 http://ftp.de.debian.org/debian unstable/main i386 Packages
            100 /var/lib/dpkg/status

    $ awk '$2 ~ /rpm/' < /etc/mime.types
    application/x-redhat-package-manager            rpm
    $ dpkg -S /etc/mime.types
    mime-support: /etc/mime.types
    $ apt policy mime-support
    mime-support:
      Installed: 3.64ubuntu1
      Candidate: 3.64ubuntu1
      Version table:
     *** 3.64ubuntu1 500
            500 http://de.archive.ubuntu.com/ubuntu focal/main amd64 Packages
            500 http://de.archive.ubuntu.com/ubuntu focal/main i386 Packages
            100 /var/lib/dpkg/status

    $ awk '$2 ~ /rpm/' < /etc/mime.types
    application/x-redhat-package-manager		rpm
    $ dpkg -S /etc/mime.types
    mime-support: /etc/mime.types
    $ apt-cache policy mime-support
    mime-support:
      Installed: 3.54ubuntu1.1
      Candidate: 3.54ubuntu1.1
      Version table:
     *** 3.54ubuntu1.1 0
            500 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
            500 http://us.archive.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
            100 /var/lib/dpkg/status
         3.54ubuntu1 0
            500 http://us.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

Otherwise, 'is_rpm_file' fails, resulting in a few test cases failing with an
unhelpful 'Unknown arguments. Please refer to --help.' message (similar to what
had been observed in PR22077 "runtestfedabipkgdiff.py fails on centos-x86_64").

	* tools/fedabipkgdiff (is_rpm_file): Also accept MIME type
	'application/x-redhat-package-manager' for RPM files.

CC: Chenxiong Qi <cqi@redhat.com>
Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
---
 tools/fedabipkgdiff | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/fedabipkgdiff b/tools/fedabipkgdiff
index be4182b2..dc80a6ef 100755
--- a/tools/fedabipkgdiff
+++ b/tools/fedabipkgdiff
@@ -209,8 +209,13 @@ def match_nvra(s):
 
 def is_rpm_file(filename):
     """Return if a file is a RPM"""
-    return os.path.isfile(filename) and \
-        mimetypes.guess_type(filename)[0] == 'application/x-rpm'
+    isfile = os.path.isfile(filename)
+    mimetype = mimetypes.guess_type(filename)[0] if isfile else None
+    isrpm = (mimetype == 'application/x-redhat-package-manager'
+             or mimetype == 'application/x-rpm')
+    logger.debug('is_rpm_file(\'%s\'): isfile=%s, mimetype=\'%s\', isrpm=%s',
+                 filename, isfile, mimetype, isrpm)
+    return isrpm
 
 
 def cmp_nvr(left, right):
-- 
2.25.1


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

* Re: [PATCH] fedabipkgdiff: Also accept MIME type 'application/x-redhat-package-manager' for RPM files
  2021-12-17 22:34 [PATCH] fedabipkgdiff: Also accept MIME type 'application/x-redhat-package-manager' for RPM files Thomas Schwinge
@ 2021-12-21 13:55 ` Dodji Seketeli
  0 siblings, 0 replies; 2+ messages in thread
From: Dodji Seketeli @ 2021-12-21 13:55 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: libabigail

Thomas Schwinge <thomas@codesourcery.com> a écrit:

[...]

> Otherwise, 'is_rpm_file' fails, resulting in a few test cases failing with an
> unhelpful 'Unknown arguments. Please refer to --help.' message (similar to what
> had been observed in PR22077 "runtestfedabipkgdiff.py fails on centos-x86_64").
>
> 	* tools/fedabipkgdiff (is_rpm_file): Also accept MIME type
> 	'application/x-redhat-package-manager' for RPM files.
>
> CC: Chenxiong Qi <cqi@redhat.com>
> Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>

Applied to master, thanks!

[...]

Cheers,

-- 
		Dodji

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

end of thread, other threads:[~2021-12-21 13:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 22:34 [PATCH] fedabipkgdiff: Also accept MIME type 'application/x-redhat-package-manager' for RPM files Thomas Schwinge
2021-12-21 13:55 ` 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).