From: Thomas Schwinge <thomas@codesourcery.com>
To: libabigail@sourceware.org
Cc: Thomas Schwinge <thomas@codesourcery.com>, Chenxiong Qi <cqi@redhat.com>
Subject: [PATCH] fedabipkgdiff: Also accept MIME type 'application/x-redhat-package-manager' for RPM files
Date: Fri, 17 Dec 2021 23:34:17 +0100 [thread overview]
Message-ID: <20211217223417.2542789-1-thomas@codesourcery.com> (raw)
... 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
next reply other threads:[~2021-12-17 22:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-17 22:34 Thomas Schwinge [this message]
2021-12-21 13:55 ` 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=20211217223417.2542789-1-thomas@codesourcery.com \
--to=thomas@codesourcery.com \
--cc=cqi@redhat.com \
--cc=libabigail@sourceware.org \
/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).