From nobody Fri Jan 13 12:00:50 2023 X-Original-To: ports@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Ntg3z6mzmz2pG9R for ; Fri, 13 Jan 2023 12:01:03 +0000 (UTC) (envelope-from hiroo.ono@gmail.com) Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ntg3z3YkWz3xwc for ; Fri, 13 Jan 2023 12:01:03 +0000 (UTC) (envelope-from hiroo.ono@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-pj1-x1031.google.com with SMTP id o13so18723159pjg.2 for ; Fri, 13 Jan 2023 04:01:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=eq6BDyAA6utoQoLhCdDJZiF0NmWo/ghn5WDhRSU1VBM=; b=dGxD7Jo4Qn2sDRLnbokyE3SZ0LgIhRRG3CecjEd2VYtV0lkQdGq/wxpGbEWWRYAkC/ CuBrKNmqxqLYFBS4MKj/HXBNztsgUUPNS4BUzG5GpwR2/jvnYDjT+0tr11ZHDbLs56To /vXKLtz7gc0IcWLdovqQXtO400XduwULiQF+CsiwDJIpsKLW1/iqy5pi8v5yPFX3Hoc/ 9YKRb5PHFFs4A4/mrn9Qyyowro4D7S4ZBXcKTVnVyxCxsiwAfRkm/VPV6TjhH5jUngy4 ImHScyOh5THqTY9JLhEMPSola9dL8glthsmWGvRRsV3vbOjt22cLDPJ1RPzjsCiJg0T8 FpoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=eq6BDyAA6utoQoLhCdDJZiF0NmWo/ghn5WDhRSU1VBM=; b=OOIZ9EnRQ0nrEJJGotbHV3o4/66lxD8rAHh93HcNUqbwIi5r+RZ8VqnFVZ0Vypfkt/ nCfI/xvmG9GT0f4SG/24xcO5UyRjHyA5HxevJYlZvyTqLEdOM0Jp+ITI+DudJh19kWSk aMRdV26Yl/GGYDbHOtkrIG8ZuQAqi0eNeCvsedXLgWEcU1sFjc05Sf23bxXqExM209bd RoJX8Hvs03tF+d3nCUuHH5tp3pk3vN/H8lVAlVGLzA6U2JXzEzX7JKgWFDBlLLiW9U5T udOpvTiU9+AwXPKICxbc/0v8At62YW84HYs0otTtNiFs9f3mxhXXvfPU7m9fqqFKtqIc FLtw== X-Gm-Message-State: AFqh2kqswuztBZDudtnMbu/Wd87QMZZ3HzbUNVv6a1RK846aHKseWI+f QpzGfJs+FhicuoHqGyc2SVU6k4518x0fsbRTA40kfqHXYJo= X-Google-Smtp-Source: AMrXdXvNL6ChaQ5q/ZYUsoS2N8UusR4NcgF8Mx4uTATZdrAkUC/I2sSzRc35u3CbviEg15zpx3k8P/H2jRhXeRpys5E= X-Received: by 2002:a17:902:6a81:b0:189:e687:b36c with SMTP id n1-20020a1709026a8100b00189e687b36cmr7275538plk.3.1673611261784; Fri, 13 Jan 2023 04:01:01 -0800 (PST) List-Id: Porting software to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-ports List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-ports@freebsd.org X-BeenThere: freebsd-ports@freebsd.org MIME-Version: 1.0 References: <20230113181413.d38e665bfe1f9e8f155a7006@dec.sakura.ne.jp> In-Reply-To: <20230113181413.d38e665bfe1f9e8f155a7006@dec.sakura.ne.jp> Reply-To: hiroo.ono+freebsd@gmail.com From: =?UTF-8?B?SGlyb28gT25vICjlsI/ph47lr5vnlJ8p?= Date: Fri, 13 Jan 2023 21:00:50 +0900 Message-ID: Subject: Re: npm install, ports and poudriere To: Tomoaki AOKI Cc: ports@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4Ntg3z3YkWz3xwc X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[freebsd]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N Thank you. 2023=E5=B9=B41=E6=9C=8813=E6=97=A5(=E9=87=91) 18:14 Tomoaki AOKI : > > On Fri, 13 Jan 2023 11:30:09 +0900 > Hiroo Ono (=E5=B0=8F=E9=87=8E=E5=AF=9B=E7=94=9F) wrote: > > > Hello, > > > > I made a port of MongoDB Compass https://www.mongodb.com/docs/compass/c= urrent/ . > > As it is an electron app, I need to use "npm install" to build it. > > > > npm install does not work without network connection, while poudriere > > allow network connection only at fetch time. > > As a result, I need to do bunch of things in fetch mode, and the > > Makefile became as attached. Is this acceptable as a port? > > If not, I need to rework the Makefile to do npm install at build time, > > but that makes the port not officially buildable I think. (though to > > each of us, there is ALLOW_NETWORKING_PACKAGES option in > > poudriere.conf) > > Can editors/vscode be any hint? It's electron app, too. > > https://cgit.freebsd.org/ports/tree/editors/vscode editors/vscode helped me very much when I wrote the Makefile, but it uses yarn which has the cache mechanism. The problem is that "npm install" always try to connect to network even if the package's tgz file is cached. cf. https://github.com/npm/npm/issues/7341 So I have to eliminate all the "npm install" after fetch target. What I am doing is similar to what Emanuel Haupt suggested to me. Doing "npm install" at post-fetch time, and backup node_modules directories= , and extract them at post-extract target. (Else, WRKDIR is wiped away at the beginning of extract target.) Every npm package is run "npm run install" with "npm install" and some pack= ages require cc, perl, python, rust, go and other things. Thus, FETCH_DEPENDS became like this: FETCH_DEPENDS=3D git:devel/git \ npm-node${NODE_VER_MAJOR}>0:www/npm-node${NODE_VER_MAJOR} \ cmake:devel/cmake-core \ pkg-config:devel/pkgconf \ ${PYTHON_VERSION}:lang/python${PYTHON_SUFFIX} \ cargo:lang/rust \ # yarn:www/yarn-node${NODE_VER_MAJOR} \ ${PREFIX}/lib/libmongocrypt.so:databases/libmongocrypt \ ${PREFIX}/lib/libsecret-1.so:security/libsecret . if !empty(PORT_OPTIONS:MGSSAPI_MIT) FETCH_DEPENDS+=3D ${_MITKRB5_DEPENDS} . else FETCH_DEPENDS+=3D ${_HEIMDAL_DEPENDS} . endif It requires not only npm, but also cmake, pkgconf, git, python, rust to build and some libraries to be linked in "npm run install". (The dependency to yarn is just a residue of the trial to use yarn's cache feature.) Is it ok or running cc and rust should be avoided at fetch time? is what I wanted to ask. It can be avoided with "npm install --ignore-scripts", but I have to run "npm run install" with each npm package myself solving whole the dependency tree. There are still things to do in do-build target. Not all the build things are done in post-fetch. So, I want to do "npm install" without "--ignore-scripts" in post-fetch target. If I have to do "npm run installs" in pre-build or do-build, in the order I have to determine digging all the package.json's. > I'm not at all familiar with electron nor Node.js, but is there any > cache mechanism for npm that can store required files into before > install (at `make fetch` phase)? Does below be of any help? > > https://docs.npmjs.com/cli/v7/commands/npm-cache > > > -- > Tomoaki AOKI >