Bug 238243 - www/npm: install byte-compiled python files for node-gyp pylib
Summary: www/npm: install byte-compiled python files for node-gyp pylib
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-30 13:20 UTC by Hiroki Tagato
Modified: 2019-07-01 07:04 UTC (History)
2 users (show)

See Also:
koobs: maintainer-feedback+
koobs: merge-quarterly+


Attachments
Patch (7.41 KB, patch)
2019-05-30 13:20 UTC, Hiroki Tagato
no flags Details | Diff
Updated patch (7.17 KB, patch)
2019-05-31 10:32 UTC, Hiroki Tagato
tagattie: maintainer-approval? (sunpoet)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hiroki Tagato freebsd_committer freebsd_triage 2019-05-30 13:20:29 UTC
Created attachment 204719 [details]
Patch

I'm now making a port which uses www/npm's node-gyp module.

When node-gyp is called by a root user (via poudriere) for the first time, it generates byte-compiled python files under the directory "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp".

That leads to a filesystem violation error by poudriere like the following:

=>> Checking for filesystem violations... done
=>> Error: Filesystem touched during build:
extra: usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.pyc
extra: usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.pyc
extra: usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.pyc
extra: usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common.pyc
extra: usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.pyc
extra: usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.pyc
extra: usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.pyc

The attached patch fixes this problem by installing byte-compiled files on package installation.

---

Port changes:
- Install byte-compiled files for node-gyp python module
- Bump port revision

QA:
poudriere testport OK (releng/12.0 amd64)
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2019-05-31 06:16:45 UTC
@Hiroki Is the quarterly version of the port affected? Is the build-time dependency on python necessary if the compile takes place at post-install ?
Comment 2 Hiroki Tagato freebsd_committer freebsd_triage 2019-05-31 10:31:23 UTC
(In reply to Kubilay Kocak from comment #1)

> Is the quarterly version of the port affected?

My comment was misleading. I'm "developing a port" not "building artifacts using a port". Sorry for the confusion.

The port under development is here FYI:
https://github.com/tagattie/FreeBSD-VSCode

> Is the build-time dependency on python necessary if the compile takes place at post-install ?

Thanks for pointing this out. Runtime dependency is sufficient. I will submit an updated version of the patch.
Comment 3 Hiroki Tagato freebsd_committer freebsd_triage 2019-05-31 10:32:44 UTC
Created attachment 204735 [details]
Updated patch
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2019-06-01 03:09:17 UTC
(In reply to Hiroki Tagato from comment #2)

Apologies, I should have been clearer. Does the quarterly version of www/npm also create/build compiled python files at first run (by any user), files which are not packaged in the ports pkg-plist?

If so, this bugfix should be merged to the quarterly branch
Comment 5 Hiroki Tagato freebsd_committer freebsd_triage 2019-06-01 12:36:34 UTC
(In reply to Kubilay Kocak from comment #4)

Thanks for the clarification. Now I understand.

I tried with the 2019Q2 branch of the ports tree and got exactly the same filesystem violation error. So the quarterly version of www/npm port also create .pyc files at first run (and should be fixed).
Comment 6 commit-hook freebsd_committer freebsd_triage 2019-06-09 16:54:40 UTC
A commit references this bug:

Author: sunpoet
Date: Sun Jun  9 16:53:09 UTC 2019
New revision: 503843
URL: https://svnweb.freebsd.org/changeset/ports/503843

Log:
  Compile and install .pyc files for node-gyp

  - Bump PORTREVISION for package change

  PR:		238243
  Submitted by:	Hiroki Tagato <tagattie@yandex.com>

Changes:
  head/www/npm/Makefile
  head/www/npm/pkg-plist
Comment 7 Po-Chuan Hsieh freebsd_committer freebsd_triage 2019-06-30 15:49:53 UTC
Committed. Thanks!
Comment 8 commit-hook freebsd_committer freebsd_triage 2019-07-01 07:03:22 UTC
A commit references this bug:

Author: koobs
Date: Mon Jul  1 07:02:27 UTC 2019
New revision: 505545
URL: https://svnweb.freebsd.org/changeset/ports/505545

Log:
  MFH: r502940 r503843

  www/npm: Fix the python executable name

  PR:		238204
  Reported by:	run failure
  Approved by:	portmgr (blanket: ports/framework (python) compliance)

  Compile and install .pyc files for node-gyp

  - Bump PORTREVISION for package change

  PR:		238243
  Submitted by:	Hiroki Tagato <tagattie@yandex.com>

  Approved by:	ports-secteam (blanket(s): run/packaging fix, ports (python) compliance)

Changes:
_U  branches/2019Q2/
  branches/2019Q2/www/npm/Makefile
  branches/2019Q2/www/npm/files/patch-lib_node__modules_npm_node__modules_node-gyp_lib_configure.js
  branches/2019Q2/www/npm/pkg-plist
Comment 9 Kubilay Kocak freebsd_committer freebsd_triage 2019-07-01 07:04:20 UTC
Merged to 2019Q2 (quarterly), where the port was also affected by this issue