Message ID | 20211217223417.2542789-1-thomas@codesourcery.com |
---|---|
State | Committed |
Headers | show |
Series | fedabipkgdiff: Also accept MIME type 'application/x-redhat-package-manager' for RPM files | expand |
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,
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):
... 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(-)