[opensuse-packaging] Python scripts and rpmlint
The current version of rpmlint in devel:languages:python [1] contains a patch relative to the one in openSUSE:Factory. This patch adds additional warnings and errors regarding shebangs in scripts. Specifically, executable scripts with "/usr/bin/env" cause an error and "/usr/bin/python" cause a warning. However, the submission to openSUSE:Factory [2] was rejected 4 months ago over doubts regarding whether there should be an error and whether the checks are really necessary. Since then, devel:languages:python has had this different rpmlint behavior than openSUSE:Factory. I hope we can get this issue resolved so we can bring the two versions back into agreement. 1: https://build.opensuse.org/package/show/devel:languages:python/rpmlint 2: https://build.opensuse.org/request/show/508168 -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
Todd Rme writes:
executable scripts with "/usr/bin/env" cause an error
This is a rather surprising proposition considering that #! /usr/bin/env python3 is the only portable choice for calling "python3". Not everything is installed in /usr/bin, and even if there is a /usr/bin/python, then it's not necessarily the interpreter the users wants to be used. If such a system-path is hard-coded into the script, then it's a lot more difficult to re-use it in other contexts. Relying on whatever is in $PATH, however, gives users control over what is going on, so I very much prefer that as a default choice. Best regards, Peter -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Tue, 2017-10-17 at 21:01 +0200, Peter Simons wrote:
Todd Rme writes:
executable scripts with "/usr/bin/env" cause an error
This is a rather surprising proposition considering that
#! /usr/bin/env python3
is the only portable choice for calling "python3". Not everything is installed in /usr/bin, and even if there is a /usr/bin/python, then it's not necessarily the interpreter the users wants to be used. If such a system-path is hard-coded into the script, then it's a lot more difficult to re-use it in other contexts. Relying on whatever is in $PATH, however, gives users control over what is going on, so I very much prefer that as a default choice.
/usr/bin/python3 is the right thing for our package - which are built and tested against that python interpreter. There is no reason to allow a different interpreter on packaged stuff. It is not the right thing (possibly) for things the user installs by hand and not by means of the package manager. Cheers Dominique
Hi, I wish to have some easy way to fix these issues, so * either the shebangs are fixed on the fly during the build process (preferred). * Or provide a very easy to use script/macro to fix them, plus a copy-pasteable example in the rpmlint output. That macro could be part of the python-rpm-macros or (better) some macros which are always installed (as not all python packages use the singlespec-approach). Fixing a problem as easy as possible is equally important as to check/report it. Sebastian On 10/17/2017 08:49 PM, Todd Rme wrote:
The current version of rpmlint in devel:languages:python [1] contains a patch relative to the one in openSUSE:Factory. This patch adds additional warnings and errors regarding shebangs in scripts. Specifically, executable scripts with "/usr/bin/env" cause an error and "/usr/bin/python" cause a warning.
However, the submission to openSUSE:Factory [2] was rejected 4 months ago over doubts regarding whether there should be an error and whether the checks are really necessary.
Since then, devel:languages:python has had this different rpmlint behavior than openSUSE:Factory. I hope we can get this issue resolved so we can bring the two versions back into agreement.
1: https://build.opensuse.org/package/show/devel:languages:python/rpmlint 2: https://build.opensuse.org/request/show/508168
-- python programming - mail server - photo - video - https://sebix.at cryptographic key at https://sebix.at/DC9B463B.asc and on public keyservers
On 17.10.2017 21:40, Sebastian wrote:
Hi,
I wish to have some easy way to fix these issues, so * either the shebangs are fixed on the fly during the build process (preferred).
I'm not sure this can be done. We could catch the env shebangs, but an automated process can't decide whether the shebang belongs or not, whether it should be python2 or python3 when it says "python" (yes, PEP 394 says that it should be python2, but that is no longer appropriate for many of our packages), etc.
* Or provide a very easy to use script/macro to fix them, plus a copy-pasteable example in the rpmlint output. That macro could be part of the python-rpm-macros or (better) some macros which are always installed (as not all python packages use the singlespec-approach).
This is unfortunately difficult to do right. I intend to create a package "shebang-macros" and make it a requirement of both python-rpm-macros and rpmbuild itself, somehow. It would be nice to get the macros into suse_macros, or even better, upstream, but that would make for some incompatible spec file mess. I'm open to suggestions as to get the macro to "everyone". Writing the macro itself is simple. m.
Fixing a problem as easy as possible is equally important as to check/report it.
Sebastian
On 10/17/2017 08:49 PM, Todd Rme wrote:
The current version of rpmlint in devel:languages:python [1] contains a patch relative to the one in openSUSE:Factory. This patch adds additional warnings and errors regarding shebangs in scripts. Specifically, executable scripts with "/usr/bin/env" cause an error and "/usr/bin/python" cause a warning.
However, the submission to openSUSE:Factory [2] was rejected 4 months ago over doubts regarding whether there should be an error and whether the checks are really necessary.
Since then, devel:languages:python has had this different rpmlint behavior than openSUSE:Factory. I hope we can get this issue resolved so we can bring the two versions back into agreement.
1: https://build.opensuse.org/package/show/devel:languages:python/rpmlint 2: https://build.opensuse.org/request/show/508168
I have dropped the custom rpmlint from d:l:py now that the Factory one detects the /usr/bin/env problem. This should resolve the issue you are pointing out :) On 17.10.2017 20:49, Todd Rme wrote:
The current version of rpmlint in devel:languages:python [1] contains a patch relative to the one in openSUSE:Factory. This patch adds additional warnings and errors regarding shebangs in scripts. Specifically, executable scripts with "/usr/bin/env" cause an error and "/usr/bin/python" cause a warning.
However, the submission to openSUSE:Factory [2] was rejected 4 months ago over doubts regarding whether there should be an error and whether the checks are really necessary.
Since then, devel:languages:python has had this different rpmlint behavior than openSUSE:Factory. I hope we can get this issue resolved so we can bring the two versions back into agreement.
1: https://build.opensuse.org/package/show/devel:languages:python/rpmlint 2: https://build.opensuse.org/request/show/508168
participants (5)
-
Dominique Leuenberger / DimStar
-
jan matejek
-
Peter Simons
-
Sebastian
-
Todd Rme