From patchwork Wed Feb 10 18:01:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiril Maler X-Patchwork-Id: 1439178 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=pnT9Jrqa; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DbSHx2GJLz9rx8 for ; Thu, 11 Feb 2021 05:01:33 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8C00286B68; Wed, 10 Feb 2021 18:01:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y-ttLXuNeqH2; Wed, 10 Feb 2021 18:01:28 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 851D986B5B; Wed, 10 Feb 2021 18:01:28 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 5127E1BF860 for ; Wed, 10 Feb 2021 18:01:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 4DD0986E9F for ; Wed, 10 Feb 2021 18:01:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id g7K1tqKgTdvU for ; Wed, 10 Feb 2021 18:01:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) by whitealder.osuosl.org (Postfix) with ESMTPS id 5F19686E8A for ; Wed, 10 Feb 2021 18:01:26 +0000 (UTC) Received: by mail-ej1-f52.google.com with SMTP id y9so5713633ejp.10 for ; Wed, 10 Feb 2021 10:01:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=JHZ+oQzFSOu8t1m2qM0ZiPJnuUlBMTbm1goTQdpH5PQ=; b=pnT9Jrqavp3qnzIcpNtzHjAVVcJ7l1jN996PwVKMdMj3P5xqPu53LsvNGsYSjB4Gew KgaXgNhbYzjTmbHH0+XFSYl0CuGHIrQztcKSVP0CUAhiWaa0pV8rcHOdzXNqM9fyHJr8 Xf9FW9re2DisJIoEwVw518iTrB+jfNg0q8eb32ZXP0M/8kPeh5VWJ9xEuOWwxWwh6hxQ nsw95DcjNLFcsyyTfdRjQkQnF2fr3KnFnHgqyiv+7U82o9HDWN/7ZwycfSOkMOtHTxuy gXfYBzcWT+MutZFcNkgdUEeqsTy/elxP1a98Hiv3k8JNAVNZRuZ3HzYc/M5xNc+vafyG NHvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=JHZ+oQzFSOu8t1m2qM0ZiPJnuUlBMTbm1goTQdpH5PQ=; b=ppy7H7BN5XVlnXeW6WtHQgbch6ZZEXfcqzlNOOaZrEXHmh2yHLGkcT1JIG8fMcw0cJ 3Pd2YALzR6JvHbspGmbU/B2XFCmfbEI0Tf9kIGCf7EssdRfj48L1CoE2KblzSNYTcEi1 gxZwhNxazd2FSF0pjL4eqQtYsklenKy/tuCAd3qi+eO33PYPArMMlv7TKI99wdd6WENv 5nygri8mQhpg52OKeO4KhwgNL6AlxsKOiHFffre2VzR894dZRqW6fIJTt6ROWR/iWHgC Kcws4CtD/Rl5rp19wDon7oLNGwfT3wYewsdeEY/dGagDWofaD9a+9kJz4jL/CUYHl+0P KHqg== X-Gm-Message-State: AOAM530Mx7f0hETiVIH9jtltar2XZ4uGNHw8RwYL9Qc1Lj4mJ7bei8ph YUlDXbkywGRJ1Riwp3VmmDdYyynNXpta83ZW5+JSf3y7xq4x8g== X-Google-Smtp-Source: ABdhPJy/UZyj1o+Zmdy8wJhxauNajE96l4Y8SZ4Kbcq16vEIEyIgvTDbxg+Aw5g2kPRA9ANTiJyKPFqKbDh50g/mYjo= X-Received: by 2002:a17:906:1796:: with SMTP id t22mr4036103eje.372.1612980084841; Wed, 10 Feb 2021 10:01:24 -0800 (PST) MIME-Version: 1.0 From: Kiril Maler Date: Wed, 10 Feb 2021 19:01:13 +0100 Message-ID: To: buildroot@busybox.net Subject: [Buildroot] PATCH package/nodejs: do not write in $HOME dir X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" host-nodejs will write a config file in $HOME/.config dir. When BR2_PACKAGE_NODEJS_NPM_HOSTCONFIG_IN_BASEDIR is selected, the config file will be written in $HOST_DIR/config Signed-off-by: line. Also, I have a number of comments on the patch, so # The package nodejs provides tool $(HOST_DIR)/bin/npm # During host install, nodejs will write a json config file # to $XDG_CONFIG_HOME, which is normally $HOME/.config of $USER # # Add a default enabled option, that the json file is written # in $HOST_DIR/config --- a/package/Config.in.host +++ b/package/Config.in.host @@ -52,6 +52,7 @@ menu "Host utilities" source "package/mtd/Config.in.host" source "package/mtools/Config.in.host" source "package/mxsldr/Config.in.host" + source "package/nodejs/Config.in.host" source "package/odb/Config.in.host" source "package/omap-u-boot-utils/Config.in.host" source "package/openocd/Config.in.host" --- a/package/nodejs/Config.in +++ b/package/nodejs/Config.in @@ -77,5 +77,15 @@ config BR2_PACKAGE_NODEJS_MODULES_ADDITI specify 'libcurl' here, to ensure that buildroot builds the libcurl package, and does so before building your node modules. +endif +if BR2_PACKAGE_NODEJS || BR2_PACKAGE_HOST_NODEJS +config BR2_PACKAGE_NODEJS_NPM_HOSTCONFIG_IN_BASEDIR + bool "npm host config in HOST_DIR" + default y + help + The host NPM config is stored in a JSON file located in + $XDG_CONFIG_HOME or $HOME/.config. + When selected, the XDG_CONFIG_HOME is set to HOST_DIR/config + in BASE_DIR endif --- /dev/null +++ b/package/nodejs/Config.in.host @@ -0,0 +1,3 @@ +config BR2_PACKAGE_HOST_NODEJS + bool + --- a/package/nodejs/nodejs.mk +++ b/package/nodejs/nodejs.mk @@ -44,6 +44,10 @@ ifneq ($(BR2_PACKAGE_NODEJS_NPM),y) NODEJS_CONF_OPTS += --without-npm endif +ifeq ($(BR2_PACKAGE_NODEJS_NPM_HOSTCONFIG_IN_BASEDIR),y) +HOST_MAKE_ENV += XDG_CONFIG_HOME="$(HOST_DIR)/config" +endif + # nodejs build system is based on python, but only support python-2.6 or # python-2.7. So, we have to enforce PYTHON interpreter to be python2. define HOST_NODEJS_CONFIGURE_CMDS