Suppress locale error in order to work in default mock (#1668400)

This commit is contained in:
Miro Hrončok 2019-03-10 12:19:03 +01:00
parent 79d42bd312
commit 39f2f25c6a
2 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,38 @@
From 30290f021b58d381ce2baaa393a4902fb69e624a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Sun, 10 Mar 2019 11:54:59 +0100
Subject: [PATCH] Suppress errors when setting LC_COLLATE, the problem is not
fatal
Fixes https://github.com/rpm-software-management/rpmlint/issues/198
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1668400
---
rpmlint | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/rpmlint b/rpmlint
index dd835ba..cc8f327 100755
--- a/rpmlint
+++ b/rpmlint
@@ -9,6 +9,7 @@
# the checks.
#############################################################################
+import contextlib
import getopt
import glob
import locale
@@ -89,7 +90,9 @@ def loadCheck(name):
#############################################################################
def main():
- locale.setlocale(locale.LC_COLLATE, '')
+ # we'll try to sort with locale settings, but we don't fail if not possible
+ with contextlib.suppress(locale.Error):
+ locale.setlocale(locale.LC_COLLATE, '')
# Add check dirs to the front of load path
sys.path[0:0] = Config.checkDirs()
--
2.20.1

View File

@ -23,7 +23,7 @@
Name: rpmlint
Version: 1.10
Release: 21%{?dist}
Release: 22%{?dist}
Summary: Tool for checking common errors in RPM packages
License: GPLv2
URL: https://github.com/rpm-software-management/rpmlint
@ -52,6 +52,7 @@ BuildRequires: python3-pytest
Requires: python3
Requires: rpm-python3 >= 4.4.2.2
Patch5: rpmlint-1.10-force-python3.patch
Patch6: rpmlint-1.10-suppress-locale-error.patch
%else
BuildRequires: python >= 2.6
BuildRequires: rpm-python >= 4.4.2.2
@ -101,6 +102,7 @@ and source packages as well as spec files can be checked.
%patch4 -p1 -b .py37magic
%if %{with python3}
%patch5 -p1
%patch6 -p1
%endif
sed -i -e /MenuCheck/d Config.py
cp -p config config.example
@ -144,6 +146,9 @@ make check PYTHON=%{python} PYTEST=%{pytest} FLAKE8=%{flake8}
%{_mandir}/man1/rpmlint.1*
%changelog
* Sun Mar 10 2019 Miro Hrončok <mhroncok@redhat.com> - 1.10-22
- Suppress locale error in order to work in default mock (#1668400)
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.10-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild