packages: rpmlint/rpmlint.spec, rpmlint/bug-201.patch (NEW) - fix for linti...

glen glen at pld-linux.org
Sat Feb 19 20:28:50 CET 2011


Author: glen                         Date: Sat Feb 19 19:28:50 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- fix for linting ghost pyc files

---- Files affected:
packages/rpmlint:
   rpmlint.spec (1.38 -> 1.39) , bug-201.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/rpmlint/rpmlint.spec
diff -u packages/rpmlint/rpmlint.spec:1.38 packages/rpmlint/rpmlint.spec:1.39
--- packages/rpmlint/rpmlint.spec:1.38	Mon Feb 14 08:12:18 2011
+++ packages/rpmlint/rpmlint.spec	Sat Feb 19 20:28:45 2011
@@ -6,7 +6,7 @@
 Summary:	Tool for checking common errors in RPM packages
 Name:		rpmlint
 Version:	1.1
-Release:	4
+Release:	5
 License:	GPL v2
 Group:		Development/Building
 Source0:	http://rpmlint.zarb.org/download/%{name}-%{version}.tar.xz
@@ -18,6 +18,7 @@
 Patch2:		%{name}-licenses.patch
 Patch3:		rpm-compat.patch
 Patch4:		postshell.patch
+Patch5:		bug-201.patch
 URL:		http://rpmlint.zarb.org/
 BuildRequires:	python >= 1.5.2
 BuildRequires:	python-modules
@@ -67,6 +68,7 @@
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p2
 
 cp -p config config.example
 cp -p %{SOURCE3} config
@@ -136,6 +138,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.39  2011/02/19 19:28:45  glen
+- fix for linting ghost pyc files
+
 Revision 1.38  2011/02/14 07:12:18  glen
 - add /sbin/postshell as valid shell
 

================================================================
Index: packages/rpmlint/bug-201.patch
diff -u /dev/null packages/rpmlint/bug-201.patch:1.1
--- /dev/null	Sat Feb 19 20:28:50 2011
+++ packages/rpmlint/bug-201.patch	Sat Feb 19 20:28:45 2011
@@ -0,0 +1,76 @@
+Index: /trunk/FilesCheck.py
+===================================================================
+--- /trunk/FilesCheck.py (revision 1832)
++++ /trunk/FilesCheck.py (revision 1837)
+@@ -663,37 +663,38 @@
+                 if source_file:
+                     if source_file in files:
+-                        # Verify that the magic ABI value embedded in the .pyc
+-                        # header is correct
+-                        found_magic = py_demarshal_long(chunk[:4]) & 0xffff
+-                        exp_magic, exp_version = get_expected_pyc_magic(f)
+-                        if exp_magic and found_magic != exp_magic:
+-                            found_version = 'unknown'
+-                            for (pv, pm) in _python_magic_values.items():
+-                                if pm == found_magic:
+-                                    found_version = pv
+-                                    break
+-                            # If expected version was from the file path, issue
+-                            # an error, otherwise a warning.
+-                            msg = (pkg, 'python-bytecode-wrong-magic-value',
+-                                   f, "expected %d (%s), found %d (%s)" %
+-                                   (exp_magic,
+-                                    exp_version or python_default_version,
+-                                    found_magic, found_version))
+-                            if exp_version is not None:
+-                                printError(*msg)
+-                            else:
+-                                printWarning(*msg)
+- 
+-                        # Verify that the timestamp embedded in the .pyc header
+-                        # matches the mtime of the .py file:
+-                        pyc_timestamp = py_demarshal_long(chunk[4:8])
+-                        if pyc_timestamp != files[source_file].mtime:
+-                            cts = datetime.fromtimestamp(
+-                                pyc_timestamp).isoformat()
+-                            sts = datetime.fromtimestamp(
+-                                files[source_file].mtime).isoformat()
+-                            printError(pkg,
+-                                       'python-bytecode-inconsistent-mtime',
+-                                       f, cts, source_file, sts)
++                        if chunk:
++                            # Verify that the magic ABI value embedded in the
++                            # .pyc header is correct
++                            found_magic = py_demarshal_long(chunk[:4]) & 0xffff
++                            exp_magic, exp_version = get_expected_pyc_magic(f)
++                            if exp_magic and found_magic != exp_magic:
++                                found_version = 'unknown'
++                                for (pv, pm) in _python_magic_values.items():
++                                    if pm == found_magic:
++                                        found_version = pv
++                                        break
++                                # If expected version was from the file path,
++                                # issue # an error, otherwise a warning.
++                                msg = (pkg, 'python-bytecode-wrong-magic-value',
++                                       f, "expected %d (%s), found %d (%s)" %
++                                       (exp_magic,
++                                        exp_version or python_default_version,
++                                        found_magic, found_version))
++                                if exp_version is not None:
++                                    printError(*msg)
++                                else:
++                                    printWarning(*msg)
++
++                            # Verify that the timestamp embedded in the .pyc
++                            # header matches the mtime of the .py file:
++                            pyc_timestamp = py_demarshal_long(chunk[4:8])
++                            if pyc_timestamp != files[source_file].mtime:
++                                cts = datetime.fromtimestamp(
++                                    pyc_timestamp).isoformat()
++                                sts = datetime.fromtimestamp(
++                                    files[source_file].mtime).isoformat()
++                                printError(pkg,
++                                           'python-bytecode-inconsistent-mtime',
++                                           f, cts, source_file, sts)
+                     else:
+                         printWarning(pkg, 'python-bytecode-without-source', f)
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/rpmlint/rpmlint.spec?r1=1.38&r2=1.39&f=u



More information about the pld-cvs-commit mailing list