softwarefactory-project / rdopkg

power to the packagers
Apache License 2.0
28 stars 21 forks source link

error: Cannot use %python if %__python wasn't redefined to something other than /usr/bin/python. #185

Closed lyarwood closed 4 years ago

lyarwood commented 4 years ago

I'm not sure if this is a genuine rdopkg issue or a side effect of something RPM related that has changed in F31 but I'm now getting the above error when attempting to patch dist-git repos that previously worked fine in F30.

$ cat /etc/redhat-release 
Fedora release 31 (Thirty One)
$ pip freeze --user | grep rdopkg
rdopkg==1.1.1

$ rdopkg patch -l -P rhos-16.0-trunk-patches
[..]
error: Cannot use %python if %__python wasn't redefined to something other than /usr/bin/python.
error: lua script failed: [string "<lua>"]:4: error expanding macro
error: openstack-nova.spec: line 13: Macro %pyver_sitelib failed to expand
Traceback (most recent call last):
  File "/home/lyarwood/.local/lib/python3.7/site-packages/rdopkg/utils/specfile.py", line 231, in load_rpmspec
    self._rpmspec = rpm.spec(self.fn)
ValueError: can't parse specfile

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/rdopkg", line 10, in <module>
    sys.exit(main())
  File "/home/lyarwood/.local/lib/python3.7/site-packages/rdopkg/cli.py", line 49, in main
    sys.exit(rdopkg(*cargs))
  File "/home/lyarwood/.local/lib/python3.7/site-packages/rdopkg/cli.py", line 41, in rdopkg
    version=__version__)
  File "/home/lyarwood/.local/lib/python3.7/site-packages/rdopkg/shell.py", line 87, in run
    action_runner.engage()
  File "/home/lyarwood/.local/lib/python3.7/site-packages/rdopkg/core.py", line 212, in engage
    new_args = self.action_manager.run_action(step, self.args)
  File "/home/lyarwood/.local/lib/python3.7/site-packages/rdopkg/action.py", line 252, in run_action
    return action_fun(*fun_args)
  File "/home/lyarwood/.local/lib/python3.7/site-packages/rdopkg/actions/distgit/actions.py", line 712, in update_spec
    changes=changes)
  File "/home/lyarwood/.local/lib/python3.7/site-packages/rdopkg/utils/specfile.py", line 647, in new_changelog_entry
    vr = self.get_vr()
  File "/home/lyarwood/.local/lib/python3.7/site-packages/rdopkg/utils/specfile.py", line 632, in get_vr
    release = self.expand_macro(release)
  File "/home/lyarwood/.local/lib/python3.7/site-packages/rdopkg/utils/specfile.py", line 244, in expand_macro
    self.load_rpmspec()
  File "/home/lyarwood/.local/lib/python3.7/site-packages/rdopkg/utils/specfile.py", line 234, in load_rpmspec
    error=e.args[0])
rdopkg.exception.SpecFileParseError: Error parsing .spec file 'openstack-nova.spec': can't parse specfile

Is this something specific to F31 or py37 that I can workaround?

lyarwood commented 4 years ago

$ echo "%__python /usr/bin/python3" >> ~/.rpmmacros