Bug 710180

Summary: Uses python2.6 code but only depends on >= 2.4
Product: [Fedora] Fedora Reporter: Stephen Quinney <squinney>
Component: mockAssignee: Clark Williams <williams>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 15CC: mebrown, williams
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-06-02 16:51:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Stephen Quinney 2011-06-02 15:35:39 UTC
Description of problem:

I am trying to run mock version 1.1.10 on a RHEL5 machine which only has python 2.4 available. Previously version 1.1.8 worked without problems. I now get the following error:

 mock.py version 1.1.10 starting...
State Changed: init plugins
ERROR: invalid syntax (selinux.py, line 59)
Traceback (most recent call last):
  File "/usr/sbin/mock", line 858, in ?
    main(retParams)
  File "/usr/sbin/mock", line 678, in main
    chroot = mock.backend.Root(config_opts, uidManager)
  File "<peak.util.decorators.rewrap wrapping mock.backend.__init__ at 0x07B0F488>", line 3, in __init__
    def __init__(self, config, uidManager): return __decorated(self, config, uidManager)
  File "/usr/lib/python2.4/site-packages/mock/trace_decorator.py", line 70, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.4/site-packages/mock/backend.py", line 109, in __init__
    self._initPlugins()
  File "<peak.util.decorators.rewrap wrapping mock.backend._initPlugins at 0x07B15E60>", line 3, in _initPlugins
    def _initPlugins(self): return __decorated(self)
  File "/usr/lib/python2.4/site-packages/mock/trace_decorator.py", line 70, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.4/site-packages/mock/backend.py", line 679, in _initPlugins
    module = imp.load_module(modname, fp, pathname, description)
  File "/usr/lib/python2.4/site-packages/mock/plugins/selinux.py", line 59
     with open("/proc/filesystems") as host:
             ^
 SyntaxError: invalid syntax

My local python expert tells me that this is python 2.6 code which clearly isn't going to work with my version 2.4 python interpreter. 

Either the code should be changed or the dependency should be updated to require a minimum of version 2.6.

Version-Release number of selected component (if applicable):

1.1.10

How reproducible:

Always

Steps to Reproduce:
1. Login to an el5 machine
2. Install mock 1.1.10
3. mock --root el5-x86_64 foo-1-2.src.rpm
  
Actual results:

Crash due to syntax error.

Expected results:

Packages should be built.

Additional info:

Comment 1 Clark Williams 2011-06-02 16:51:06 UTC
You need to use the 1.0.17 version in the epel-5 repository. That's the entire reason for it's existance.

Comment 2 Stephen Quinney 2011-06-02 19:36:21 UTC
(In reply to comment #1)
> You need to use the 1.0.17 version in the epel-5 repository. That's the entire
> reason for it's existance.

I'm more than happy to use the old version on el5, that's not what this bug report is actually about. I was happy that it worked at all for previous versions in the 1.1 series and I will go back to what I had working before.

What I am asking for is that if you use python 2.6 syntax in your code that you have the sense to actually put that dependency into the specfile. Putting a dependency on >= 2.4 is *wrong* when you actually require a minimum of 2.6.


Stephen Quinney

Comment 3 Clark Williams 2011-06-02 19:48:46 UTC
mock-1.0.17 is not an "old" version. It's the version maintained purely for compatibility with RHEL5's python. We backport bugfixes (and some features) from the 1.1.x branch back to 1.0.x. 

I'll update the specfile in the 1.1.x branch to make sure we have a proper python dependency.