Bug 243961 - editors/vim: build fails if PYTHON is OFF
Summary: editors/vim: build fails if PYTHON is OFF
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Adam Weinberger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-07 16:18 UTC by Lorenzo Salvadore
Modified: 2020-02-13 15:57 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (adamw)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lorenzo Salvadore freebsd_committer freebsd_triage 2020-02-07 16:18:11 UTC
Vim build fails if PYTHON is OFF.
Here is the error (there are others, but they do not cause the build to fail):
Error: '/usr/local/bin/python' is an invalid shebang you need USES=shebangfix for 'share/vim/vim82/tools/demoserver.py.bak'
Comment 1 Po-Chuan Hsieh freebsd_committer freebsd_triage 2020-02-07 17:20:32 UTC
It happens when you have DEVELOPER=yes.

r522484 adds a new REINPLACE_CMD check which is enabled when DEVELOPER=yes. It does not respect REINPLACE_ARGS (-i ''), thus runtime/tools/demoserver.py.bak is generated. Vim installs everything in runtime/tools [1] which fails in stage-qa for invalid shebang.

There are at least 2 workaround:
1. Remove the demoserver.py.bak after REINPLACE_CMD.
2. Use USES=python:env [2]. It will replace the shebang with default python (/usr/local/bin/python3.7).

[1] from src/Makefile:
# install the runtime tools
        $(INSTALL_DATA_R) $(TOOLSSOURCE)/* $(DEST_TOOLS)

[2]
Index: Makefile
===================================================================
--- Makefile    (revision 525490)
+++ Makefile    (working copy)
@@ -31,7 +31,6 @@
 PLIST_SUB=     VIM_VER=${VIM_VER}
 PORTDATA?=     ${VIM_VER}
 PORTSCOUT=     ignore:1
-REINPLACE_ARGS=        -i ''
 SHEBANG_FILES= runtime/tools/demoserver.py runtime/tools/efm_perl.pl
 VIM_VER=       ${PORTNAME}${PORTVERSION:R:S|.||g}

@@ -134,6 +133,7 @@
 PERL_USES=             perl5

 PYTHON_USES=           python
+PYTHON_USES_OFF=       python:env

 RUBY_CONFIGURE_ENABLE= rubyinterp
 RUBY_USE=              RUBY=yes
@@ -167,8 +167,6 @@
        ${ECHO_CMD} '#define SYS_GVIMRC_FILE "'${ETCDIR}'/gvimrc"' >> ${WRKSRC}/src/feature.h
        ${REINPLACE_CMD} -e 's|-liconv|${ICONV_LIB}|g; s|/usr/local|${LOCALBASE}|g' \
                ${WRKSRC}/src/auto/configure
-# Work around qa-check shebang error
-       ${REINPLACE_CMD} -e 1d ${WRKSRC}/runtime/tools/demoserver.py

 post-configure:
 # Needed when devel/libsysinfo is installed:
Comment 2 Lorenzo Salvadore freebsd_committer freebsd_triage 2020-02-07 17:30:33 UTC
(In reply to Sunpoet Po-Chuan Hsieh from comment #1)

Thank you very much.
I think it would have been a good idea to warn people of this change in REINPLACE_CMD. If a warning has indeed been sent, I missed it, sorry.
In any case, I see no note about it in UPDATING: it might be a good idea to add one.
Comment 3 Adam Weinberger freebsd_committer freebsd_triage 2020-02-09 13:51:21 UTC
Hi Sunpoet,

I’m on shift and won’t be back until late tonight. Can you (or anyone else interested) please commit this?
Comment 4 commit-hook freebsd_committer freebsd_triage 2020-02-10 18:47:31 UTC
A commit references this bug:

Author: sunpoet
Date: Mon Feb 10 18:47:24 UTC 2020
New revision: 525748
URL: https://svnweb.freebsd.org/changeset/ports/525748

Log:
  Fix stage-qa of shebang with PYTHON option disabled after r522484

  The error message (in poudriere) is as follows:
  ====> Running Q/A tests (stage-qa)
  Error: '/usr/local/bin/python' is an invalid shebang you need USES=shebangfix for 'share/vim/vim82/tools/demoserver.py.bak'

  r522484 adds a new REINPLACE_CMD check which is enabled when DEVELOPER=yes. It
  does not respect REINPLACE_ARGS (-i ''), thus runtime/tools/demoserver.py.bak is
  generated. Vim installs everything in runtime/tools [1] which fails in stage-qa
  for invalid shebang.

  This workaround uses USES=python:env. It will replace the shebang with default
  python (/usr/local/bin/python3.7).

  [1] from src/Makefile:
  # install the runtime tools
  	$(INSTALL_DATA_R) $(TOOLSSOURCE)/* $(DEST_TOOLS)

  PR:		243961
  Reported by:	salvadore
  Submitted by:	sunpoet (myself)
  Approved by:	adamw (maintainer)

Changes:
  head/editors/vim/Makefile
Comment 5 Po-Chuan Hsieh freebsd_committer freebsd_triage 2020-02-10 19:03:16 UTC
(In reply to Lorenzo Salvadore from comment #2)

It also affects other ports with REINPLACE_ARGS. swills@ is cc'd. He might have a better idea.

(In reply to Adam Weinberger from comment #3)

Hi Adam, I've committed the workaround.
Comment 6 Lorenzo Salvadore freebsd_committer freebsd_triage 2020-02-10 19:06:52 UTC
(In reply to Sunpoet Po-Chuan Hsieh from comment #5)

Thanks for the warning and for the commit.
I can confirm that the build now works fine with PYTHON off.
Comment 7 Adam Weinberger freebsd_committer freebsd_triage 2020-02-13 15:57:56 UTC
I’m closing this PR now as I believe the problem is fixed. Please reopen if not.

Sunpoet, thank you so much for doing all the legwork here!