Feature #9979

Support python3 for in-gate tools

Added by Andy Fiddaman 3 months ago. Updated 10 days ago.

Status:ClosedStart date:2019-02-06
Priority:NormalDue date:
Assignee:Andy Fiddaman% Done:

100%

Category:tools - gate/build tools
Target version:-
Difficulty:Medium Tags:

Description

A number of tools in gate are written in python. With the approaching end-of-support for python2 and as distributions move towards python3, these should be updated so that they can run under either version.
There should also be a mechanism for selection of which major version of python is used to run these tools during gate builds.


Subtasks

Bug #10347: git-pbchk requires more python3 fixesClosedAndy Fiddaman


Related issues

Related to illumos gate - Bug #10225: wsdiff broken after 9979 Closed 2019-01-12

History

#1 Updated by Igor Kozhukhov 3 months ago

please use shebang like /usr/bin/python3
distributions can do symbolic links to it with correct local version

#2 Updated by Andy Fiddaman 3 months ago

Except that IPS pkg dependency resolution can fail if the explicit version is not in the shebang.
I'm providing `TOOLS_PYTHON` which distributions can set in their .env file if they want to override the shebang.

#3 Updated by Andy Fiddaman 3 months ago

  • % Done changed from 50 to 90

#4 Updated by Andy Fiddaman 2 months ago

By default (if nothing is changed in the .env file) the developer/build/onbld package will gain python3 versions of the onbld modules alongside python2 versions. The tools themselves will continue to have a python2 shebang line. In the future, if a distribution wishes to switch to python3 for the tools, they can set TOOLS_PYTHON=/usr/bin/python3.5 or similar and if they want to stop building and shipping the python2 modules then BUILDPY2TOOLS='#' will achieve that. OmniOS bloody no longer uses python2 for the onbld components.

Testing Notes

Tested all modified onbld tools from proto with both python3 and python2, for example:

% python3 proto/root_i386-nd/opt/onbld/bin/git-pbchk -p master
Comments:
These bug synopses don't match the database entries:
Synopsis of 9979 is wrong:
  should be: 'Support python3 for in-gate tools'
         is: 'Support python3 for in-gate tools-FRED'

% python2 proto/root_i386-nd/opt/onbld/bin/git-pbchk -p master
Comments:
These bug synopses don't match the database entries:
Synopsis of 9979 is wrong:
  should be: 'Support python3 for in-gate tools'
         is: 'Support python3 for in-gate tools-FRED'

Did three test builds with BUILDPY2TOOLS='#', BUILDPY3TOOLS='#' and neither set. Inspected developer/build/onbld package contents each time and ran the range of tools against some sample files.

#5 Updated by Electric Monk about 1 month ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

git commit ca13eaa51ee900abba73dfb6624e492f7e48863e

commit  ca13eaa51ee900abba73dfb6624e492f7e48863e
Author: Andy Fiddaman <omnios@citrus-it.co.uk>
Date:   2019-01-10T16:09:52.000Z

    9979 Support python3 for in-gate tools
    Reviewed by: Toomas Soome <tsoome@me.com>
    Reviewed by: Peter Tribble <peter.tribble@gmail.com>
    Reviewed by: Alexander Pyhalov <apyhalov@gmail.com>
    Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

#6 Updated by Andy Fiddaman about 1 month ago

  • Related to Bug #10225: wsdiff broken after 9979 added

Also available in: Atom