Bug 242695

Summary: devel/bazel devel/bazel029: Remove run-time python dependency
Product: Ports & Packages Reporter: Yuri Victorovich <yuri>
Component: Individual Port(s)Assignee: Yuri Victorovich <yuri>
Status: Closed FIXED    
Severity: Affects Some People CC: aehlig
Priority: --- Keywords: easy, needs-patch, needs-qa
Version: LatestFlags: koobs: merge-quarterly?
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch none

Description Yuri Victorovich freebsd_committer 2019-12-18 04:50:47 UTC
Created attachment 210023 [details]
patch

bazel shouldn't depend on python at run-time.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2019-12-18 04:55:33 UTC
@Yuri The "build," argument should be a suffix after the <version-spec>, not a prefix (though it may work?) per Mk/Uses/python.mk:

  Usage:        USES=python[:version-spec][,arg,...]

^Triage: Reporter is committer, assign accordingly
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2019-12-18 04:56:31 UTC
This change proposal (after updating the patch per comment 1) is also:

Approved by: portmgr (blanket: incorrect dependencies)
MFH: 2019Q4 (blanket: bugfix)
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2019-12-18 04:57:50 UTC
devel/bazel029 appears to also need this change
Comment 4 Yuri Victorovich freebsd_committer 2019-12-18 05:11:39 UTC
Committed.
Comment 5 commit-hook freebsd_committer 2019-12-18 05:11:39 UTC
A commit references this bug:

Author: yuri
Date: Wed Dec 18 05:11:19 UTC 2019
New revision: 520361
URL: https://svnweb.freebsd.org/changeset/ports/520361

Log:
  devel/bazel, devel/bazel029: Remove python run-time dependency

  PR:		242695
  Approved by:	portmgr (blanket: incorrect dependencies)

Changes:
  head/devel/bazel/Makefile
  head/devel/bazel029/Makefile
Comment 6 Klaus Aehlig 2019-12-18 10:12:46 UTC
A bit of background on bazel's runtime dependency on python.

As any build tool, bazel has to launch programs (compiler, etc)
in a controlled way (setting up environment variables, redirecting
stdout/stderr, etc). Historically, bazel used to do this set up
in wrapper scripts written in Python (hence the runtime dependency).
This is mostly cleaned up now, but a few exceptions remain.

- All handling of Python uses a wrapper script written in Python,
  determining the version of python to be used, doing some set up,
  etc. That script itself is defensively written and should work with
  basically any Python interpreter. However it is launched from the
  java process directly. To do so, bazel embeds the the path of a
  Python interpreter it can rely on to be present at run time.

- Some built-in functionality, like creating an archive[1] is implemented
  via built-in python Scripts that need to be launched by the described
  functionality.

[1] https://github.com/bazelbuild/bazel/blob/db0e32ca6296e56e5314993fe9939bc7331768ec/tools/build_defs/pkg/build_tar.py
Comment 7 Klaus Aehlig 2019-12-23 10:52:16 UTC
As mentioned, technically, there is still a run-time dependency on python, but it is probably not that important for most users. So, while I'm not happy with that removal, I can live with it. As it is committed already, we can just leave it as is, so I don't see anything further actionable from my side.
Comment 8 commit-hook freebsd_committer 2019-12-24 03:50:09 UTC
A commit references this bug:

Author: yuri
Date: Tue Dec 24 03:50:03 UTC 2019
New revision: 520771
URL: https://svnweb.freebsd.org/changeset/ports/520771

Log:
  devel/bazel and devel/bazel029: Add back python at run-time

  Maintainer requested to add it back because bazel needs python at run-time.

  PR:		242695
  Requested by:	aehlig@linta.de (maintainer)

Changes:
  head/devel/bazel/Makefile
  head/devel/bazel029/Makefile