1.9 + unicodefixes

This commit is contained in:
Tom Callaway 2016-07-08 11:05:57 -04:00
parent 36f604e5dd
commit 72bfedf890
4 changed files with 122 additions and 12 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@
/rpmlint-1.6.tar.xz /rpmlint-1.6.tar.xz
/rpmlint-1.7.tar.xz /rpmlint-1.7.tar.xz
/rpmlint-1.8.tar.gz /rpmlint-1.8.tar.gz
/rpmlint-1.9.tar.gz

View File

@ -0,0 +1,102 @@
diff -up rpmlint-rpmlint-1.9/FilesCheck.py.unicodefix rpmlint-rpmlint-1.9/FilesCheck.py
--- rpmlint-rpmlint-1.9/FilesCheck.py.unicodefix 2016-07-08 10:45:32.988796231 -0400
+++ rpmlint-rpmlint-1.9/FilesCheck.py 2016-07-08 10:47:07.520138612 -0400
@@ -572,8 +572,14 @@ class FilesCheck(AbstractCheck.AbstractC
chunk = None
istext = False
- if os.access(pkgfile.path, os.R_OK):
- (chunk, istext) = peek(pkgfile.path, pkg)
+ res = None
+ try:
+ res = os.access(pkgfile.path, os.R_OK)
+ except UnicodeError as e: # e.g. non-ASCII, C locale, python 3
+ printWarning(pkg, 'inaccessible-filename', f, e)
+ else:
+ if res:
+ (chunk, istext) = peek(pkgfile.path, pkg)
(interpreter, interpreter_args) = script_interpreter(chunk)
@@ -1304,6 +1310,11 @@ it in the rpm header indicates that it i
but it actually is not in the filesystem. Because of this, some checks will
be skipped.''',
+'inaccessible-filename',
+'''An error occurred while trying to access this file due to some characters
+in its name. Because of this, some checks will be skipped. Access could work
+with some other locale settings.''',
+
'executable-crontab-file',
'''This crontab file has executable bit set, which is refused by newer version
of cron''',
diff -up rpmlint-rpmlint-1.9/Filter.py.unicodefix rpmlint-rpmlint-1.9/Filter.py
--- rpmlint-rpmlint-1.9/Filter.py.unicodefix 2016-07-08 10:43:35.135616091 -0400
+++ rpmlint-rpmlint-1.9/Filter.py 2016-07-08 10:45:25.885845645 -0400
@@ -9,6 +9,7 @@
from __future__ import print_function
+import codecs
import locale
import sys
import textwrap
@@ -25,17 +26,20 @@ _diagnostic = list()
_badness_score = 0
printed_messages = {"I": 0, "W": 0, "E": 0}
-__stdout = sys.stdout
__preferred_encoding = locale.getpreferredencoding()
if sys.version_info[0] < 3:
- import codecs
__stdout = codecs.getwriter(__preferred_encoding)(sys.stdout, 'replace')
+ def __print(s):
+ if isinstance(s, str):
+ s = s.decode(__preferred_encoding, 'replace')
+ print(s, file=__stdout)
+else:
+ __stdout = codecs.getwriter(__preferred_encoding)(
+ sys.stdout.buffer, 'replace')
-def __print(s):
- if isinstance(s, str) and hasattr(s, 'decode'):
- s = s.decode(__preferred_encoding, 'replace')
- print(s, file=__stdout)
+ def __print(s):
+ print(s, file=__stdout)
def printInfo(pkg, reason, *details):
diff -up rpmlint-rpmlint-1.9/Makefile.unicodefix rpmlint-rpmlint-1.9/Makefile
--- rpmlint-rpmlint-1.9/Makefile.unicodefix 2016-07-08 10:47:23.748025724 -0400
+++ rpmlint-rpmlint-1.9/Makefile 2016-07-08 10:47:38.945919999 -0400
@@ -22,10 +22,6 @@ PYTHON = /usr/bin/python
# update this variable to create a new release
VERSION := 1.9
-# for the [A-Z]* part
-LC_ALL:=C
-export LC_ALL
-
all: __version__.py __isocodes__.py
clean:
diff -up rpmlint-rpmlint-1.9/test.sh.unicodefix rpmlint-rpmlint-1.9/test.sh
--- rpmlint-rpmlint-1.9/test.sh.unicodefix 2016-07-08 10:47:52.116828374 -0400
+++ rpmlint-rpmlint-1.9/test.sh 2016-07-08 10:48:34.045536691 -0400
@@ -18,9 +18,14 @@ for i in $TESTPATH/test.*.py; do
done
echo "Check that rpmlint executes with no unexpected errors"
+echo "...in default locale"
$PYTHON ./rpmlint -C $(pwd) test/*/*.rpm test/spec/*.spec >/dev/null
rc=$?
test $rc -eq 0 -o $rc -eq 64 || exit $rc
+echo "...in the C locale"
+LC_ALL=C $PYTHON ./rpmlint -C $(pwd) test/*/*.rpm test/spec/*.spec >/dev/null
+rc=$?
+test $rc -eq 0 -o $rc -eq 64 || exit $rc
echo "$PYTEST tests"
$PYTEST -v || exit $?

View File

@ -7,14 +7,16 @@
%if %{with python3} %if %{with python3}
%global python %{__python3} %global python %{__python3}
%global pytest %(ls -1 %{_bindir}/py.test-3* | tail -n 1) %global pytest %(ls -1 %{_bindir}/py.test-3* | tail -n 1)
%global flake8 python3-flake8
%else %else
%global python %{__python} %global python %{__python}
%global pytest py.test %global pytest py.test
%global flake8 flake8
%endif %endif
Name: rpmlint Name: rpmlint
Version: 1.8 Version: 1.9
Release: 7%{?dist} Release: 1%{?dist}
Summary: Tool for checking common errors in RPM packages Summary: Tool for checking common errors in RPM packages
Group: Development/Tools Group: Development/Tools
License: GPLv2 License: GPLv2
@ -26,21 +28,25 @@ Source3: %{name}-etc.config
Source4: %{name}.config.el4 Source4: %{name}.config.el4
# EL-5 specific config # EL-5 specific config
Source5: %{name}.config.el5 Source5: %{name}.config.el5
# https://github.com/rpm-software-management/rpmlint/commit/4e8657f47fb15b7a871b88054d15ea1141dd55b3 # Combines all of these upstream changes
Patch0: rpmlint-1.8-epathfix.patch # https://github.com/rpm-software-management/rpmlint/commit/4ddbcccc5e12e4f3777ca0790880afa63e91e2fb
# https://github.com/rpm-software-management/rpmlint/commit/3b0286ba7f2192807b6d1eadf1fe7c46cc364854 # https://github.com/rpm-software-management/rpmlint/commit/d2de79e1f855a6852be9e337314cdf5e0e594993
Patch1: rpmlint-1.8-python35-fix.patch # https://github.com/rpm-software-management/rpmlint/commit/15e4ae11e498530f975574567fca0e65a9a0acb7
# https://github.com/rpm-software-management/rpmlint/commit/d08a7ce333355898dea05b1ed82c5884eccde5ff
Patch0: rpmlint-1.9-unicodefix.patch
BuildArch: noarch BuildArch: noarch
%if %{with python3} %if %{with python3}
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: rpm-python3 >= 4.4.2.2 BuildRequires: rpm-python3 >= 4.4.2.2
BuildRequires: python3-pytest BuildRequires: python3-pytest
BuildRequires: python3-flake8
Requires: python3 Requires: python3
Requires: rpm-python3 >= 4.4.2.2 Requires: rpm-python3 >= 4.4.2.2
%else %else
BuildRequires: python >= 2.6 BuildRequires: python >= 2.6
BuildRequires: rpm-python >= 4.4.2.2 BuildRequires: rpm-python >= 4.4.2.2
BuildRequires: pytest BuildRequires: pytest
BuildRequires: python2-flake8
Requires: python >= 2.6 Requires: python >= 2.6
Requires: rpm-python >= 4.4.2.2 Requires: rpm-python >= 4.4.2.2
%endif %endif
@ -78,8 +84,7 @@ and source packages as well as spec files can be checked.
%prep %prep
%setup -q -n %{name}-%{name}-%{version} %setup -q -n %{name}-%{name}-%{version}
%patch0 -p1 -b .epathfix %patch0 -p1 -b .unicodefix
%patch1 -p1 -b .py35
sed -i -e /MenuCheck/d Config.py sed -i -e /MenuCheck/d Config.py
cp -p config config.example cp -p config config.example
install -pm 644 %{SOURCE3} config install -pm 644 %{SOURCE3} config
@ -107,11 +112,11 @@ rm -rf %{buildroot}%{_sysconfdir}/bash_completion.d/
%check %check
make check PYTHON=%{python} PYTEST=%{pytest} make check PYTHON=%{python} PYTEST=%{pytest} FLAKE8=%{flake8}
%files %files
%doc COPYING README config.example %doc COPYING README.md config.example
%config(noreplace) %{_sysconfdir}/rpmlint/ %config(noreplace) %{_sysconfdir}/rpmlint/
%if 0%{?fedora} %if 0%{?fedora}
%{_datadir}/bash-completion/ %{_datadir}/bash-completion/
@ -124,11 +129,13 @@ make check PYTHON=%{python} PYTEST=%{pytest}
%{_bindir}/el*-rpmlint %{_bindir}/el*-rpmlint
%{_bindir}/rpmlint %{_bindir}/rpmlint
%{_datadir}/rpmlint/ %{_datadir}/rpmlint/
%exclude %{_datadir}/rpmlint/rpmlint.py[co]
%{_mandir}/man1/rpmdiff.1* %{_mandir}/man1/rpmdiff.1*
%{_mandir}/man1/rpmlint.1* %{_mandir}/man1/rpmlint.1*
%changelog %changelog
* Wed Jul 6 2016 Tom Callaway <spot@fedoraproject.org> - 1.9-1
- update to 1.9
* Tue Jun 14 2016 Tom Callaway <spot@fedoraproject.org> - 1.8-7 * Tue Jun 14 2016 Tom Callaway <spot@fedoraproject.org> - 1.8-7
- ignore explicit-lib-dependency on python subpackages with "lib" - ignore explicit-lib-dependency on python subpackages with "lib"
- update license list - update license list

View File

@ -1 +1 @@
f168dc8e190c25dc1f409abb3ef47b86 rpmlint-1.8.tar.gz 810d7fd565d389fec305ff80af53ba40 rpmlint-1.9.tar.gz