From 0c54658f9eefd204a6d612f36a13789b144b4da2 Mon Sep 17 00:00:00 2001 From: Tom Callaway Date: Sep 06 2012 19:46:51 +0000 Subject: fix handling of ruby RI files as text files (they are binary files) and apply upstream fix for macro regexp --- diff --git a/rpmlint-1.4-ruby-ri-files-are-binary.patch b/rpmlint-1.4-ruby-ri-files-are-binary.patch new file mode 100644 index 0000000..855645f --- /dev/null +++ b/rpmlint-1.4-ruby-ri-files-are-binary.patch @@ -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) diff --git a/rpmlint-1.4-tighten-macro-regexp.patch b/rpmlint-1.4-tighten-macro-regexp.patch new file mode 100644 index 0000000..6c71d42 --- /dev/null +++ b/rpmlint-1.4-tighten-macro-regexp.patch @@ -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): diff --git a/rpmlint.spec b/rpmlint.spec index 4ebf25a..1950820 100644 --- a/rpmlint.spec +++ b/rpmlint.spec @@ -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 - 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 - 1.4-9 - fix build for RHEL: no bash-completion