Closed heraldb closed 4 years ago
I have this fixed in my PR. This issue was that Redhat based distro's use .8.gz as man files where Debian derivatives use .8. I added a check into the setup script to check if rpm is being built and to append .gz to the file if it is. Once I did that, I was able to successfully build the rpm.
@heraldb Can you test the python build process for the rpm again, so we can close this issue out? A fix was applied to the latest repo version
Hi! I just tried and the error about the man page is gone. But unfortunately, it breaks on "ambiguous shebang":
$ python setup.py bdist_rpm
[....]
Bytecompiling .py files below /home/herald/git/denyhosts/build/bdist.linux-x86_64/rpm/BUILDROOT/DenyHosts-3.1-1.x86_64/usr/lib/python2.7 using /usr/bin/python2.7
+ /usr/lib/rpm/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-mangle-shebangs
*** ERROR: ambiguous python shebang in /usr/bin/daemon-control-dist: #!/usr/bin/python. Change it to python3 (or python2) explicitly.
*** ERROR: ambiguous python shebang in /usr/bin/denyhosts.py: #!/usr/bin/python. Change it to python3 (or python2) explicitly.
error: Bad exit status from /var/tmp/rpm-tmp.oMmXT0 (%install)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.oMmXT0 (%install)
error: command 'rpmbuild' failed with exit status 1
On my system, python2 is still default:
$ ls -l /usr/bin/python /usr/bin/python2 /usr/bin/python3
lrwxrwxrwx 1 root root 7 Apr 30 17:55 /usr/bin/python -> python2
lrwxrwxrwx 1 root root 9 Apr 30 17:55 /usr/bin/python2 -> python2.7
lrwxrwxrwx 1 root root 9 Jul 9 18:36 /usr/bin/python3 -> python3.7
I tried to replace "#!/usr/bin/env python"
by "#!/usr/bin/env python2"
in daemon-control-dist
, setup.py
and denyhosts.py
. But that does not make a difference.
Do you have any suggestions?
What distro/version are you using? I would like to test it on a local VM. The test build I did was on a stock Debian Buster with RPM installed.
I am using Fedora 30...
I'm seeing the issue occur on Fedora 30. Seems to be a deprecation method they're using to deprecate python 2.x usage.
The initial error message led me to this change that was made in Fedora 28 which was a warning. Now in Fedora 30 it's an error that prevents the build from finishing. https://fedoraproject.org/wiki/Changes/Make_ambiguous_python_shebangs_error
I'm looking into their documentation for packaging python packages in Fedora 30/31 using Python 3 https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#Multiple_Python_Runtimes
If I change all /usr/bin/env python
to python3 and package with python3 I get errors about missing ipaddr even though my pip3 freeze shows ipaddr being installed. If I use /usr/bin/python2
, instead of env python, then we end up with the same error we're currently seeing.
For the moment a workaround I found is to change all env python
references to use bin/python3
. Then you can compile using python3 setup.py bdist_rpm
.
The issues I had with ipaddr I was able to work around using a try-except to see if I could import ipaddr
or ip_address
for the utils module. The conversion script replaces ip_addr
in the requirements
file with ipaddress
for python3. I have the changes committed into my repo, and I'll submit a PR and ping the maintainers, so they can pull the changes in. Make sure to install the ipaddress module for python3 before compiling.
Thanks a lot!
You're welcome. Let me know if you run into anymore issues.
Hi! I tried to build an rpm from the source code (v3.1, v3.0 and v2.1):
$ python setup.py bdist_rpm
which ends with an error:
File not found: /tmp/denyhosts-3.0/build/bdist.linux-x86_64/rpm/BUILDROOT/DenyHosts-3.0-1.x86_64/usr/share/man/man8/denyhosts.8
I tried again with python3, but same error...