fix handling of ruby RI files as text files (they are binary files) and apply upstream fix for macro regexp

This commit is contained in:
Tom Callaway 2012-09-06 15:46:51 -04:00
parent d2202269e5
commit 0c54658f9e
3 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,14 @@
diff -up rpmlint-1.4/FilesCheck.py.ruby-ri-files rpmlint-1.4/FilesCheck.py
--- rpmlint-1.4/FilesCheck.py.ruby-ri-files 2012-09-06 15:39:40.348664465 -0400
+++ rpmlint-1.4/FilesCheck.py 2012-09-06 15:40:16.231664959 -0400
@@ -273,6 +273,10 @@ def peek(filename, pkg, length=1024):
if not chunk: # Empty files are considered text
return (chunk, True)
+ # RI files generated by RDoc are always binary
+ if re.search(r'.*\/ri\/.*\.ri$', filename.lower()):
+ return (chunk, False)
+
# PDF's are binary but often detected as text by the algorithm below
if filename.lower().endswith('.pdf') and chunk.startswith('%PDF-'):
return (chunk, False)

View File

@ -0,0 +1,12 @@
diff -up rpmlint-1.4/AbstractCheck.py.tighten-regexp rpmlint-1.4/AbstractCheck.py
--- rpmlint-1.4/AbstractCheck.py.tighten-regexp 2012-09-06 15:38:03.122662962 -0400
+++ rpmlint-1.4/AbstractCheck.py 2012-09-06 15:38:10.939663091 -0400
@@ -16,7 +16,7 @@ from Filter import addDetails, printInfo
import Config
# Note: do not add any capturing parentheses here
-macro_regex = re.compile('%+[{(]?\w+[)}]?')
+macro_regex = re.compile('%+[{(]?[a-zA-Z_]\w{2,}[)}]?')
class _HeadRequest(urllib2.Request):
def get_method(self):

View File

@ -1,6 +1,6 @@
Name: rpmlint
Version: 1.4
Release: 9%{?dist}
Release: 10%{?dist}
Summary: Tool for checking common errors in RPM packages
Group: Development/Tools
@ -17,6 +17,12 @@ Source5: %{name}.config.el5
Patch0: rpmlint-1.4-encoding.patch
# http://sourceforge.net/p/rpmlint/code/ci/671bf6d21c6e878e6ee551ee4e2871df8947ac52/
Patch1: rpmlint-1.4-py3-magic-number-fix.patch
# Tighten macro regexp to min 3 chars, starting with a letter or underscore.
# http://sourceforge.net/p/rpmlint/code/ci/ae8a019e53784a45c59f23a7b09ad47ea7584795/
Patch2: rpmlint-1.4-tighten-macro-regexp.patch
# Fix handling of Ruby RI files as text files, they're always binary files.
# http://rpmlint.zarb.org/cgi-bin/trac.cgi/ticket/569
Patch3: rpmlint-1.4-ruby-ri-files-are-binary.patch
BuildArch: noarch
BuildRequires: python >= 2.4
BuildRequires: rpm-python >= 4.4
@ -50,6 +56,8 @@ and source packages as well as spec files can be checked.
%setup -q
%patch0 -p1 -b .enc
%patch1 -p1 -b .py3
%patch2 -p1 -b .tighten-regexp
%patch3 -p1 -b .ruby-ri-files
sed -i -e /MenuCheck/d Config.py
cp -p config config.example
install -pm 644 %{SOURCE2} CHANGES.package.old
@ -100,6 +108,10 @@ make check
%changelog
* Thu Sep 6 2012 Tom Callaway <spot@fedoraproject.org> - 1.4-10
- fix handling of ruby RI files as text files (they are binary files)
- apply upstream fix for macro regexp
* Tue Sep 4 2012 Thomas Woerner <twoerner@redhat.com> - 1.4-9
- fix build for RHEL: no bash-completion