From debbugs-submit-bounces@debbugs.gnu.org Tue May 12 17:26:41 2020 Received: (at submit) by debbugs.gnu.org; 12 May 2020 21:26:41 +0000 Received: from localhost ([127.0.0.1]:56688 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYcQD-0008KZ-IU for submit@debbugs.gnu.org; Tue, 12 May 2020 17:26:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:43516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYcQB-0008KR-Py for submit@debbugs.gnu.org; Tue, 12 May 2020 17:26:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35382) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYcQB-0005nX-K0 for guix-patches@gnu.org; Tue, 12 May 2020 17:26:39 -0400 Received: from confino.investici.org ([212.103.72.250]:51501) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYcQ9-0007u0-SB for guix-patches@gnu.org; Tue, 12 May 2020 17:26:39 -0400 Received: from 1.mail-backend.investici.org (unknown [10.0.0.11]) by confino.investici.org (Postfix) with ESMTP id 7FE3420F9F for ; Tue, 12 May 2020 21:26:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1589318782; bh=1XC2nQgzwEqHSrwwqLHWS0nyvP4PeC2NGmAg6K3CjV8=; h=Date:From:To:Subject:From; b=eLidAU8k//mG6oqpR2iFF7Iy+hRKiocKDIdjcLZyLKCCjOWuAHHEeu4N/6++tvt/C KpOlUZRN/cVYXTWrKIRs6H5eUZCbSF9ihL7NTHXL1duZJuXWIbYy4Q6hHXi9/ngVEr NgybGONDt14ZLipEyHhN+T9K+bULMbbnrwPmA5PM= Received: from 1.webmail.investici.org (localhost [127.0.0.1]) (Authenticated sender: goodoldpaul@autistici.org) by 1.mail-backend.investici.org (Postfix) with ESMTPA id 52B8BBEE39 for ; Tue, 12 May 2020 21:26:22 +0000 (UTC) MIME-Version: 1.0 Date: Tue, 12 May 2020 21:26:22 +0000 From: goodoldpaul@autistici.org To: guix-patches@gnu.org Subject: Enforce "files" directive in node build system User-Agent: Roundcube Webmail Message-ID: <5ec7ac973bb248a3cca0197836d35459@autistici.org> X-Sender: goodoldpaul@autistici.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=212.103.72.250; envelope-from=goodoldpaul@autistici.org; helo=confino.investici.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/12 17:12:46 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) Hi, I'm sending a couple of patches to fix https://issues.guix.gnu.org/40710, I tried to base my implementation on [0]. The first patch adds "globstar" support to (guix glob), namely the ability of recursively matching subdirectories in a glob pattern (i.e. "foo/**/bar.scm" matches both "foo/bar.scm" and "foo/baz/bar.scm"). The second patch adds (guix glob) to the imported modules of node-build-system and uses that to parse glob patterns in the "files" array of a package.json and then install all the matching files. I tested the patches by verifying that ./pre-inst-env guix build -K node-semver node-util-deprecate node-statsd-parser node-stack-trace node-oop node-mersenne node-long-stack-traces node-far node-env-variable node-color-name runs without error and and by running make check TESTS="tests/glob.scm" . From debbugs-submit-bounces@debbugs.gnu.org Tue May 12 17:30:52 2020 Received: (at 41219) by debbugs.gnu.org; 12 May 2020 21:30:52 +0000 Received: from localhost ([127.0.0.1]:56698 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYcUG-0000pK-AU for submit@debbugs.gnu.org; Tue, 12 May 2020 17:30:52 -0400 Received: from confino.investici.org ([212.103.72.250]:31591) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYcUE-0000md-S3 for 41219@debbugs.gnu.org; Tue, 12 May 2020 17:30:51 -0400 Received: from 1.mail-backend.investici.org (unknown [10.0.0.11]) by confino.investici.org (Postfix) with ESMTP id 1458A20FA4 for <41219@debbugs.gnu.org>; Tue, 12 May 2020 21:30:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1589319049; bh=nSN96N9jkGv/Lx3SWKy/Suag5cJdjxQCXxvuh94W7Is=; h=Date:From:To:Subject:In-Reply-To:References:From; b=Oy3OSGCCQDOhyarBNSDVejWZq1k2Iv+bdh++0r5HL+Lkd8R57DeBS68TF6g3FrH+G PQvWXHUmMVh5sKrj/22lVYFRYzgk6o0/t8MUapxborlcsHypfO/c92Pk3ePC5Ij3dh yPont96/SrG56tFUFIZBtYqFdIIdmu7HlCj2qKYk= Received: from 1.webmail.investici.org (localhost [127.0.0.1]) (Authenticated sender: goodoldpaul@autistici.org) by 1.mail-backend.investici.org (Postfix) with ESMTPA id E0BA7BEE39 for <41219@debbugs.gnu.org>; Tue, 12 May 2020 21:30:48 +0000 (UTC) MIME-Version: 1.0 Date: Tue, 12 May 2020 21:30:48 +0000 From: goodoldpaul@autistici.org To: 41219@debbugs.gnu.org Subject: Re: [bug#41219] Enforce "files" directive in node build system In-Reply-To: <5ec7ac973bb248a3cca0197836d35459@autistici.org> References: <5ec7ac973bb248a3cca0197836d35459@autistici.org> User-Agent: Roundcube Webmail Message-ID: X-Sender: goodoldpaul@autistici.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 41219 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2020-05-12 21:26, goodoldpaul@autistici.org wrote: > Hi, > > I'm sending a couple of patches to fix > https://issues.guix.gnu.org/40710, I tried to base my implementation > on [0]. > > The first patch adds "globstar" support to (guix glob), namely the > ability of recursively matching subdirectories in a glob pattern (i.e. > "foo/**/bar.scm" matches both "foo/bar.scm" and "foo/baz/bar.scm"). > > The second patch adds (guix glob) to the imported modules of > node-build-system and uses that to parse glob patterns in the "files" > array of a package.json and then install all the matching files. > > I tested the patches by verifying that > > ./pre-inst-env guix build -K node-semver node-util-deprecate > node-statsd-parser node-stack-trace node-oop node-mersenne > node-long-stack-traces node-far node-env-variable node-color-name > > runs without error and and by running make check > TESTS="tests/glob.scm" . I apologize I sent by error without finishing. Anyway I verified that the installed files match the "files" directive when present, otherwise we fall back to the original behavior of installing everything. I'm not really sure i added enough test cases in "tests/glob.scm", please do tell me if you believe I should add more. Thank for your patience in reviewing this. Giacomo From debbugs-submit-bounces@debbugs.gnu.org Tue May 12 17:31:52 2020 Received: (at 41219) by debbugs.gnu.org; 12 May 2020 21:31:52 +0000 Received: from localhost ([127.0.0.1]:56703 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYcVD-0001dv-L1 for submit@debbugs.gnu.org; Tue, 12 May 2020 17:31:51 -0400 Received: from latitanza.investici.org ([82.94.249.234]:62765) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYcVC-0001c0-3S for 41219@debbugs.gnu.org; Tue, 12 May 2020 17:31:50 -0400 Received: from mx3.investici.org (unknown [127.0.0.1]) by latitanza.investici.org (Postfix) with ESMTP id B46F7120184; Tue, 12 May 2020 21:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1589319108; bh=VumB0vjbeUS19YPIePpDLetCbxqDRy5iSc5eeZMLqgw=; h=From:To:Cc:Subject:Date:From; b=kJKq/HVDTOpx82dmXk3Uc3wn9rB8GU0D7zZh+igxJ1NszIj1c2Prqs5lm19J0hLLV GoZtsEav2yqEl69P3dBOc2VBlxIUjiPe/iLBGLAT4PQUfCVWGOPY2X+DvK58a+mbw4 xR6+DzWKZpn944SNCXSLDNP352L1YQM1ENCjh2Sk= Received: from [82.94.249.234] (mx3.investici.org [82.94.249.234]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 823D812016F; Tue, 12 May 2020 21:31:48 +0000 (UTC) From: Giacomo Leidi To: 41219@debbugs.gnu.org Subject: [PATCH 1/2] guix: Add globstar support. Date: Tue, 12 May 2020 23:31:30 +0200 Message-Id: <20200512213131.28873-1-goodoldpaul@autistici.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 41219 Cc: Giacomo Leidi X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix/glob.scm (string->sglob) (glob-match?): Add globstar support. * tests/glob.scm: Update accordingly. --- guix/glob.scm | 15 +++++++++++++++ tests/glob.scm | 8 ++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/guix/glob.scm b/guix/glob.scm index a9fc744802..d73783cd30 100644 --- a/guix/glob.scm +++ b/guix/glob.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018 Ludovic Courtès +;;; Copyright © 2020 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -61,6 +62,11 @@ STR, a glob pattern such as \"foo*\" or \"foo??bar\"." (flatten (reverse (if (null? pending) result (cons-string pending result))))) + ((#\* #\* #\/ . rest) + (if (zero? brackets) + (loop rest '() 0 + (cons* '**/ (cons-string pending result))) + (loop rest (cons '**/ pending) brackets result))) (((and chr (or #\? #\*)) . rest) (let ((wildcard (match chr (#\? '?) @@ -121,6 +127,15 @@ STR, a glob pattern such as \"foo*\" or \"foo??bar\"." (string-null? str)) (('*) #t) + (('**/) + #t) + (('**/ suffix . rest) + (let ((rest (if (eq? '* suffix) (cdr rest) rest)) + (suffix (if (eq? '* suffix) (car rest) suffix))) + (match (string-contains str suffix) + (#f #f) + (index (loop rest (string-drop str + (+ index (string-length suffix)))))))) (('* suffix . rest) (match (string-contains str suffix) (#f #f) diff --git a/tests/glob.scm b/tests/glob.scm index 3134069789..2a5a40c3c6 100644 --- a/tests/glob.scm +++ b/tests/glob.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018 Ludovic Courtès +;;; Copyright © 2020 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -53,7 +54,8 @@ "foo[abc]bar" => '("foo" (set #\a #\b #\c) "bar") "foo[a[b]c]bar" => '("foo" (set #\a #\[ #\b #\] #\c) "bar") "[123]x" => '((set #\1 #\2 #\3) "x") - "[a-z]" => '((range #\a #\z))) + "[a-z]" => '((range #\a #\z)) + "**/*.scm" => '(**/ * ".scm")) (test-glob-match ("foo" matches "foo" (and not "foobar" "barfoo")) @@ -64,6 +66,8 @@ ("ab[0-9]c" matches "ab0c" "ab7c" "ab9c" (and not "ab-c" "ab00c" "ab3")) ("ab[cdefg]" matches "abc" "abd" "abg" - (and not "abh" "abcd" "ab["))) + (and not "abh" "abcd" "ab[")) + ("foo/**/*.scm" matches "foo/bar/baz.scm" "foo/bar.scm" "foo/bar/baz/zab.scm" + (and not "foo/bar/baz.java" "foo/bar.smc"))) (test-end "glob") -- 2.26.2 From debbugs-submit-bounces@debbugs.gnu.org Tue May 12 17:31:55 2020 Received: (at 41219) by debbugs.gnu.org; 12 May 2020 21:31:55 +0000 Received: from localhost ([127.0.0.1]:56705 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYcVG-0001hE-Vt for submit@debbugs.gnu.org; Tue, 12 May 2020 17:31:55 -0400 Received: from latitanza.investici.org ([82.94.249.234]:23603) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jYcVC-0001c8-2r for 41219@debbugs.gnu.org; Tue, 12 May 2020 17:31:51 -0400 Received: from mx3.investici.org (unknown [127.0.0.1]) by latitanza.investici.org (Postfix) with ESMTP id 0AE471201B0; Tue, 12 May 2020 21:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1589319109; bh=UgCtPwH+n1lUBmpaMidDDXgeqikVfNBOw4zW+dCZnr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gFAzov8y05KEndP43PytNhexY+uQ4t/aWiAatwAhy+AAi6JuvquZ7nzY94k4bJJrj 8scYp/Z/PILqWPKiLGg7F9/ZoQfcZ1GA4xCNMo0wUQI9od5NqcP4tddhlqI5tGAOFs 7wmXjsEHv/cPujKtVbnVoOIrWWBoe6gBWXUEGOZU= Received: from [82.94.249.234] (mx3.investici.org [82.94.249.234]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id CEA6012016F; Tue, 12 May 2020 21:31:48 +0000 (UTC) From: Giacomo Leidi To: 41219@debbugs.gnu.org Subject: [PATCH 2/2] guix: Enforce package.json "files" directive. Date: Tue, 12 May 2020 23:31:31 +0200 Message-Id: <20200512213131.28873-2-goodoldpaul@autistici.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200512213131.28873-1-goodoldpaul@autistici.org> References: <20200512213131.28873-1-goodoldpaul@autistici.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 41219 Cc: Giacomo Leidi X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This fixes https://issues.guix.gnu.org/40710 by implementing support for the "files" directive from https://docs.npmjs.com/files/package.json#files . * guix/build/node-build-system.scm (install): Enforce package.json "files" directive. * guix/build-system/node.scm (%node-build-system-modules) (node-build)[modules]: Add (guix glob). --- guix/build-system/node.scm | 4 +- guix/build/node-build-system.scm | 68 ++++++++++++++++++++++++++------ 2 files changed, 58 insertions(+), 14 deletions(-) diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm index 05c24c47d5..05bc9f2087 100644 --- a/guix/build-system/node.scm +++ b/guix/build-system/node.scm @@ -42,6 +42,7 @@ registry." `((guix build node-build-system) (guix build json) (guix build union) + (guix glob) ,@%gnu-build-system-modules)) ;; TODO: Might be not needed (define (default-node) @@ -90,7 +91,8 @@ registry." (modules '((guix build node-build-system) (guix build json) (guix build union) - (guix build utils)))) + (guix build utils) + (guix glob)))) "Build SOURCE using NODE and INPUTS." (define builder `(begin diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm index 7799f03595..befcbbeb75 100644 --- a/guix/build/node-build-system.scm +++ b/guix/build/node-build-system.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 David Thompson ;;; Copyright © 2016 Jelle Licht +;;; Copyright © 2020 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,6 +23,7 @@ #:use-module (guix build json) #:use-module (guix build union) #:use-module (guix build utils) + #:use-module (guix glob) #:use-module (ice-9 match) #:use-module (ice-9 popen) #:use-module (ice-9 regex) @@ -110,18 +112,60 @@ the @file{bin} directory." (#f #f))) (dependencies (match (assoc-ref data "dependencies") (('@ deps ...) deps) - (#f #f)))) + (#f #f))) + (patterns (match (assoc-ref data "files") + (() #f) + ((? list? patrn-list) patrn-list) + (#f #f))) + (main (match (assoc-ref data "main") + ("" #f) + ((? string? main-module) main-module) + (#f #f))) + (install-dir (string-append target "/node_modules/" modulename)) + (install-files (lambda (files directory) + (for-each (lambda (file) + (install-file + file + (string-append directory "/" + (dirname file)))) + files)))) (mkdir-p target) - (copy-recursively "." (string-append target "/node_modules/" modulename)) - ;; Remove references to dependencies - (delete-file-recursively - (string-append target "/node_modules/" modulename "/node_modules")) + (if patterns + (install-files + (filter (lambda (file) + (any (lambda (pattern) + (glob-match? + (string->compiled-sglob pattern) + file)) + (append + patterns + '("package.json" + ;; These files get installed no + ;; matter the case or extension. + "[rR][eE][aA][dD][mM][eE]*" + "[cC][hH][aA][nN][gG][eE][sS]*" + "[cC][hH][aA][nN][gG][eE][lL][oO][gG]*" + "[hH][iI][sS][tT][oO][rR][yY]*" + "[nN][oO][tT][iI][cC][eE]*")))) + (map (lambda (path) + (string-drop path 2)) + (find-files "."))) + install-dir) + (begin + (copy-recursively "." install-dir) + ;; Remove references to dependencies + (delete-file-recursively + (string-append install-dir "/node_modules")))) + (if (and main + (not (file-exists? + (string-append + install-dir "/" (dirname main))))) + (install-files (list main) install-dir)) (cond ((string? binary-configuration) (begin (mkdir-p binaries) - (symlink (string-append target "/node_modules/" modulename "/" - binary-configuration) + (symlink (string-append install-dir "/" binary-configuration) (string-append binaries "/" modulename)))) ((list? binary-configuration) (for-each @@ -130,21 +174,19 @@ the @file{bin} directory." ((key . value) (begin (mkdir-p (dirname (string-append binaries "/" key))) - (symlink (string-append target "/node_modules/" modulename "/" - value) + (symlink (string-append install-dir "/" value) (string-append binaries "/" key)))))) - binary-configuration))) + binary-configuration))) (when dependencies (mkdir-p - (string-append target "/node_modules/" modulename "/node_modules")) + (string-append install-dir "/node_modules")) (for-each (lambda (dependency) (let ((dependency (car dependency))) (symlink (string-append (assoc-ref inputs (string-append "node-" dependency)) "/lib/node_modules/" dependency) - (string-append target "/node_modules/" modulename - "/node_modules/" dependency)))) + (string-append install-dir "/node_modules/" dependency)))) dependencies)) #t)) -- 2.26.2 From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 05 19:09:58 2020 Received: (at 41219) by debbugs.gnu.org; 5 Jun 2020 23:09:58 +0000 Received: from localhost ([127.0.0.1]:50249 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jhLTK-0001Ih-No for submit@debbugs.gnu.org; Fri, 05 Jun 2020 19:09:58 -0400 Received: from confino.investici.org ([212.103.72.250]:21679) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jhLTJ-0001IY-1C for 41219@debbugs.gnu.org; Fri, 05 Jun 2020 19:09:57 -0400 Received: from 1.mail-backend.investici.org (unknown [10.0.0.11]) by confino.investici.org (Postfix) with ESMTP id 603CA20FB1 for <41219@debbugs.gnu.org>; Fri, 5 Jun 2020 23:09:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1591398595; bh=FNljbPkp4kTbJTScVQdv6GcKfRGbgBb7jXPwGqCdB24=; h=Date:From:To:Subject:In-Reply-To:References:From; b=fRufH9ELEMBOU95nFE6ekwjFcSmKj3hKxXYVXGqZtkxiMLDC8/lzx7UT7CmIko1vt RwKY50d6G5C3aW+dE0uMbPcFdCNBXf6slM478y2FHN/c0etv4RhUZR20EM/G6wu+wc QOrIYdtrHRgCB9oTyad0mgkzVGEjBBBfn45DLbk4= Received: from 1.webmail.investici.org (localhost [127.0.0.1]) (Authenticated sender: goodoldpaul@autistici.org) by 1.mail-backend.investici.org (Postfix) with ESMTPA id 2B832BEE54 for <41219@debbugs.gnu.org>; Fri, 5 Jun 2020 23:09:55 +0000 (UTC) MIME-Version: 1.0 Date: Fri, 05 Jun 2020 23:09:55 +0000 From: goodoldpaul@autistici.org To: 41219@debbugs.gnu.org Subject: Re: [PATCH 2/2] guix: Enforce package.json "files" directive. In-Reply-To: <20200512213131.28873-2-goodoldpaul@autistici.org> References: <20200512213131.28873-1-goodoldpaul@autistici.org> <20200512213131.28873-2-goodoldpaul@autistici.org> User-Agent: Roundcube Webmail Message-ID: <8ec1a9c5adbeee9d91185794074c3a9a@autistici.org> X-Sender: goodoldpaul@autistici.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 41219 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Guixers! Did someone managed to have a look at these patches? No rush, just to have feedback :) . Thanks, Giacomo From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 19 11:15:10 2020 Received: (at 41219) by debbugs.gnu.org; 19 Sep 2020 15:15:10 +0000 Received: from localhost ([127.0.0.1]:47799 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJeZy-0000Mu-Ce for submit@debbugs.gnu.org; Sat, 19 Sep 2020 11:15:10 -0400 Received: from latitanza.investici.org ([82.94.249.234]:21603) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJeZt-0000Mh-Sj for 41219@debbugs.gnu.org; Sat, 19 Sep 2020 11:15:09 -0400 Received: from mx3.investici.org (unknown [127.0.0.1]) by latitanza.investici.org (Postfix) with ESMTP id 4BtvQJ4D5vz8sfC for <41219@debbugs.gnu.org>; Sat, 19 Sep 2020 15:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1600528504; bh=Iz5v1NBQMTdvzf/8GSx6C7W4q9orHxvssh8Hw9Io4JU=; h=Subject:From:To:References:Date:In-Reply-To:From; b=VdMVx8491sSgQGky5dDNNmxxS/fwMEkNeSZZJp6u6ZGWLwpd5aHMdBCBkMBYpZI/X n8ypu8jr+XDTbq5DEu54KAFMUqneUasXW+zJpgUFxzQk3uvzUvzzyaHs5wfVZBJxFh Jb74jJm5yMkQ1hLWOX5DXtvjf4aSOAqTfKCDSQT4= Received: from [82.94.249.234] (mx3.investici.org [82.94.249.234]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4BtvQJ31Nbz8sf9 for <41219@debbugs.gnu.org>; Sat, 19 Sep 2020 15:15:03 +0000 (UTC) Subject: [PATCH 2/2] guix: Enforce package.json "files" directive. From: paul To: 41219@debbugs.gnu.org References: <20200512213131.28873-1-goodoldpaul@autistici.org> <20200512213131.28873-2-goodoldpaul@autistici.org> <8ec1a9c5adbeee9d91185794074c3a9a@autistici.org> Message-ID: <017659fd-ee56-d082-1b56-0ada2e72c19c@autistici.org> Date: Sat, 19 Sep 2020 17:15:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Icedove/68.12.0 MIME-Version: 1.0 In-Reply-To: <8ec1a9c5adbeee9d91185794074c3a9a@autistici.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 41219 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Guix, have you managed to go through these patches? Thank you, Giacomo From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 20 15:51:24 2020 Received: (at 41219) by debbugs.gnu.org; 20 Sep 2020 19:51:24 +0000 Received: from localhost ([127.0.0.1]:52737 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kK5Mq-000263-C9 for submit@debbugs.gnu.org; Sun, 20 Sep 2020 15:51:24 -0400 Received: from mail1.fsfe.org ([217.69.89.151]:32974) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kK5Mo-00025u-1G for 41219@debbugs.gnu.org; Sun, 20 Sep 2020 15:51:23 -0400 From: Jelle Licht To: Giacomo Leidi , 41219@debbugs.gnu.org Subject: Re: [bug#41219] [PATCH 2/2] guix: Enforce package.json "files" directive. In-Reply-To: <20200512213131.28873-2-goodoldpaul@autistici.org> References: <20200512213131.28873-1-goodoldpaul@autistici.org> <20200512213131.28873-2-goodoldpaul@autistici.org> Date: Sun, 20 Sep 2020 21:51:18 +0200 Message-ID: <875z88jkg9.fsf@jlicht.xyz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 41219 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) Hey Giacomo,=20 Apologies for the delay! Better late than never, a review just for you. The other patch seems fine to me, but I'm not a 'guix glob' expert. Giacomo Leidi writes: > [snip] > --- a/guix/build/node-build-system.scm > +++ b/guix/build/node-build-system.scm > @@ -1,6 +1,7 @@ > ;;; GNU Guix --- Functional package management for GNU > ;;; Copyright =C2=A9 2015 David Thompson > ;;; Copyright =C2=A9 2016 Jelle Licht > +;;; Copyright =C2=A9 2020 Giacomo Leidi > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -22,6 +23,7 @@ > #:use-module (guix build json) > #:use-module (guix build union) > #:use-module (guix build utils) > + #:use-module (guix glob) > #:use-module (ice-9 match) > #:use-module (ice-9 popen) > #:use-module (ice-9 regex) > @@ -110,18 +112,60 @@ the @file{bin} directory." > (#f #f))) > (dependencies (match (assoc-ref data "dependencies") > (('@ deps ...) deps) > - (#f #f)))) > + (#f #f))) > + (patterns (match (assoc-ref data "files") > + (() #f) > + ((? list? patrn-list) patrn-list) ^ Perhaps 'pattern-list'? I keep reading this as patron-list. We could also build the patterns here. Mapping over the pattern-list + 'default patterns' here might also be a wee bit faster. > + (#f #f))) > + (main (match (assoc-ref data "main") > + ("" #f) > + ((? string? main-module) main-module) > + (#f #f))) > + (install-dir (string-append target "/node_modules/" modulename)) > + (install-files (lambda (files directory) ^ You only use install-dir here: you could hard-code it in the lambda. > + (for-each (lambda (file) > + (install-file > + file > + (string-append directory "/" > + (dirname file)))) > + files)))) > (mkdir-p target) > - (copy-recursively "." (string-append target "/node_modules/" modulen= ame)) > - ;; Remove references to dependencies > - (delete-file-recursively > - (string-append target "/node_modules/" modulename "/node_modules")) > + (if patterns > + (install-files > + (filter (lambda (file) > + (any (lambda (pattern) > + (glob-match? > + (string->compiled-sglob pattern) > + file)) > + (append > + patterns > + '("package.json" > + ;; These files get installed no > + ;; matter the case or extension. > + "[rR][eE][aA][dD][mM][eE]*" > + "[cC][hH][aA][nN][gG][eE][sS]*" > + "[cC][hH][aA][nN][gG][eE][lL][oO][gG]*" > + "[hH][iI][sS][tT][oO][rR][yY]*" > + "[nN][oO][tT][iI][cC][eE]*")))) > + (map (lambda (path) > + (string-drop path 2)) ^ If this is meant to drop the "./" prefix, you should be able to leave it out. > + (find-files "."))) `find-files' accepts an optional second argument called PRED, so you can do that instead of the earlier 'filter'. > + install-dir) > + (begin > + (copy-recursively "." install-dir) > + ;; Remove references to dependencies > + (delete-file-recursively > + (string-append install-dir "/node_modules")))) > + (if (and main > + (not (file-exists? > + (string-append > + install-dir "/" (dirname main))))) > + (install-files (list main) install-dir)) ^ This should not be needed if we use the 'old' (=3Dnon-files) approach of installing. Do you think it makes sense to pull it into the previous block that only runs on using the 'files' directive? Thanks for you patience, and thanks again for working on this. HTH, - Jelle From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 21 16:33:49 2020 Received: (at 41219) by debbugs.gnu.org; 21 Sep 2020 20:33:49 +0000 Received: from localhost ([127.0.0.1]:56466 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kKSVQ-000838-K2 for submit@debbugs.gnu.org; Mon, 21 Sep 2020 16:33:49 -0400 Received: from confino.investici.org ([212.103.72.250]:64213) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kKSVO-00082y-Ev for 41219@debbugs.gnu.org; Mon, 21 Sep 2020 16:33:48 -0400 Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4BwGP43nwRz10wD; Mon, 21 Sep 2020 20:33:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1600720424; bh=I36Zmvg5sArX0WdmjkzqbsKQRI0jnrjPlz0nY4059Ug=; h=Subject:To:References:From:Date:In-Reply-To:From; b=PejP3+OYnPJmSL7IEv2BNimkQYDIzxuLDteuc5gVKTSSxKTUlyG1ExkT9N9Ac4Mpo VUwm3gC1hQ3rXMcuUNipYVeL8OB49JBnhaO6I+8r3/m6+N7uwXzKUb99p4jTqq4XGL ArvMAzmwCmagbOyMlkL7l7wxjSZ7hFKngdBa8NxE= Received: from [212.103.72.250] (mx1.investici.org [212.103.72.250]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4BwGP42zb0z10w6; Mon, 21 Sep 2020 20:33:44 +0000 (UTC) Subject: Re: [bug#41219] [PATCH 2/2] guix: Enforce package.json "files" directive. To: Jelle Licht , 41219@debbugs.gnu.org References: <20200512213131.28873-1-goodoldpaul@autistici.org> <20200512213131.28873-2-goodoldpaul@autistici.org> <875z88jkg9.fsf@jlicht.xyz> From: paul Message-ID: <7bea951c-c8c8-cca9-4bfe-8d8f5c83e2ab@autistici.org> Date: Mon, 21 Sep 2020 22:33:43 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Icedove/68.12.0 MIME-Version: 1.0 In-Reply-To: <875z88jkg9.fsf@jlicht.xyz> Content-Type: multipart/mixed; boundary="------------7147A6E4CD22177BBBD8A6D8" Content-Language: en-US X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 41219 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------7147A6E4CD22177BBBD8A6D8 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi Jelle, On 9/20/20 9:51 PM, Jelle Licht wrote: > Hey Giacomo, > > Apologies for the delay! Better late than never, a review just for you. No problem really, I spent some time AFK this summer and didn't ping soon enough. > Perhaps 'pattern-list'? I keep reading this as patron-list. We could > also build the patterns here. Mapping over the pattern-list + 'default > patterns' here might also be a wee bit faster. Yeah I actually don't know why I avoided to type two more letters in the first place. I didn't build the patterns here because that would have required storing the match result in a separate variable binding and requiring to check twice if the binding was false (which is the way I went in the new patch. The only slight downside in the new patch is that if the match result is #f then patterns is # but is also provably never accessed. If you can think of a better way to solve this, please do tell me), but mapping first is still more efficient, so I changed it. > >> + (#f #f))) >> + (main (match (assoc-ref data "main") >> + ("" #f) >> + ((? string? main-module) main-module) >> + (#f #f))) >> + (install-dir (string-append target "/node_modules/" modulename)) >> + (install-files (lambda (files directory) > ^ > You only use install-dir here: you could hard-code it in the lambda. Definitely, I just fixed that. > >> + (for-each (lambda (file) >> + (install-file >> + file >> + (string-append directory "/" >> + (dirname file)))) >> + files)))) >> (mkdir-p target) >> - (copy-recursively "." (string-append target "/node_modules/" modulename)) >> - ;; Remove references to dependencies >> - (delete-file-recursively >> - (string-append target "/node_modules/" modulename "/node_modules")) >> + (if patterns >> + (install-files >> + (filter (lambda (file) >> + (any (lambda (pattern) >> + (glob-match? >> + (string->compiled-sglob pattern) >> + file)) >> + (append >> + patterns >> + '("package.json" >> + ;; These files get installed no >> + ;; matter the case or extension. >> + "[rR][eE][aA][dD][mM][eE]*" >> + "[cC][hH][aA][nN][gG][eE][sS]*" >> + "[cC][hH][aA][nN][gG][eE][lL][oO][gG]*" >> + "[hH][iI][sS][tT][oO][rR][yY]*" >> + "[nN][oO][tT][iI][cC][eE]*")))) >> + (map (lambda (path) >> + (string-drop path 2)) > ^ > If this is meant to drop the "./" prefix, you > should be able to leave it out. > >> + (find-files "."))) > `find-files' accepts an optional second argument called PRED, so you can > do that instead of the earlier 'filter'. Thanks, I didn't know. Fixed :). > >> + install-dir) >> + (begin >> + (copy-recursively "." install-dir) >> + ;; Remove references to dependencies >> + (delete-file-recursively >> + (string-append install-dir "/node_modules")))) >> + (if (and main >> + (not (file-exists? >> + (string-append >> + install-dir "/" (dirname main))))) >> + (install-files (list main) install-dir)) > ^ > > This should not be needed if we use the 'old' (=non-files) approach of > installing. Do you think it makes sense to pull it into the previous > block that only runs on using the 'files' directive? I put this because also the "main" field from package.json is also guaranteed to be installed by NPM, according to https://docs.npmjs.com/files/package.json#main . Thus if a developer populates the "files" field without including the main file in that list, but they do insert it in the "main" field the file should be installed. Does it make sense? > Thanks for you patience, and thanks again for working on this. > > HTH, > > - Jelle Thank you for your patience in reviewing this patch. I'm attaching an updated version of the second patch. Cheers, Giacomo --------------7147A6E4CD22177BBBD8A6D8 Content-Type: text/x-patch; charset=UTF-8; name="0002-guix-Enforce-package.json-files-directive.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0002-guix-Enforce-package.json-files-directive.patch" >From 329ad1227ee537a630b3823e8d37db4862e023d5 Mon Sep 17 00:00:00 2001 From: Giacomo Leidi Date: Mon, 21 Sep 2020 22:18:19 +0200 Subject: [PATCH 2/2] guix: Enforce package.json "files" directive. This fixes https://issues.guix.gnu.org/40710 by implementing support for the "files" directive from https://docs.npmjs.com/files/package.json#files . * guix/build/node-build-system.scm (install): Enforce package.json "files" directive. * guix/build-system/node.scm (%node-build-system-modules) (node-build)[modules]: Add (guix glob). --- guix/build-system/node.scm | 4 +- guix/build/node-build-system.scm | 67 +++++++++++++++++++++++++------- 2 files changed, 57 insertions(+), 14 deletions(-) diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm index 05c24c47d5..05bc9f2087 100644 --- a/guix/build-system/node.scm +++ b/guix/build-system/node.scm @@ -42,6 +42,7 @@ registry." `((guix build node-build-system) (guix build json) (guix build union) + (guix glob) ,@%gnu-build-system-modules)) ;; TODO: Might be not needed (define (default-node) @@ -90,7 +91,8 @@ registry." (modules '((guix build node-build-system) (guix build json) (guix build union) - (guix build utils)))) + (guix build utils) + (guix glob)))) "Build SOURCE using NODE and INPUTS." (define builder `(begin diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm index 7799f03595..6e11d1c142 100644 --- a/guix/build/node-build-system.scm +++ b/guix/build/node-build-system.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 David Thompson ;;; Copyright © 2016 Jelle Licht +;;; Copyright © 2020 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,6 +23,7 @@ #:use-module (guix build json) #:use-module (guix build union) #:use-module (guix build utils) + #:use-module (guix glob) #:use-module (ice-9 match) #:use-module (ice-9 popen) #:use-module (ice-9 regex) @@ -110,18 +112,59 @@ the @file{bin} directory." (#f #f))) (dependencies (match (assoc-ref data "dependencies") (('@ deps ...) deps) - (#f #f)))) + (#f #f))) + (file-list (match (assoc-ref data "files") + (() #f) + ((? list? pattern-list) pattern-list) + (#f #f))) + (patterns + (when file-list + (map (lambda (pattern) + (string->compiled-sglob pattern)) + (append file-list + '("package.json" + ;; These files get installed no + ;; matter the case or extension. + "[rR][eE][aA][dD][mM][eE]*" + "[cC][hH][aA][nN][gG][eE][sS]*" + "[cC][hH][aA][nN][gG][eE][lL][oO][gG]*" + "[hH][iI][sS][tT][oO][rR][yY]*" + "[nN][oO][tT][iI][cC][eE]*"))))) + (main (match (assoc-ref data "main") + ("" #f) + ((? string? main-module) main-module) + (#f #f))) + (install-dir (string-append target "/node_modules/" modulename)) + (install-files (lambda (files) + (for-each (lambda (file) + (install-file + file + (string-append install-dir "/" + (dirname file)))) + files)))) (mkdir-p target) - (copy-recursively "." (string-append target "/node_modules/" modulename)) - ;; Remove references to dependencies - (delete-file-recursively - (string-append target "/node_modules/" modulename "/node_modules")) + (if file-list + (install-files + (find-files "." (lambda (file stat) + (any (lambda (pattern) + (glob-match? pattern + (string-drop file 2))) + patterns)))) + (begin + (copy-recursively "." install-dir) + ;; Remove references to dependencies + (delete-file-recursively + (string-append install-dir "/node_modules")))) + (if (and main + (not (file-exists? + (string-append + install-dir "/" (dirname main))))) + (install-files (list main))) (cond ((string? binary-configuration) (begin (mkdir-p binaries) - (symlink (string-append target "/node_modules/" modulename "/" - binary-configuration) + (symlink (string-append install-dir "/" binary-configuration) (string-append binaries "/" modulename)))) ((list? binary-configuration) (for-each @@ -130,21 +173,19 @@ the @file{bin} directory." ((key . value) (begin (mkdir-p (dirname (string-append binaries "/" key))) - (symlink (string-append target "/node_modules/" modulename "/" - value) + (symlink (string-append install-dir "/" value) (string-append binaries "/" key)))))) - binary-configuration))) + binary-configuration))) (when dependencies (mkdir-p - (string-append target "/node_modules/" modulename "/node_modules")) + (string-append install-dir "/node_modules")) (for-each (lambda (dependency) (let ((dependency (car dependency))) (symlink (string-append (assoc-ref inputs (string-append "node-" dependency)) "/lib/node_modules/" dependency) - (string-append target "/node_modules/" modulename - "/node_modules/" dependency)))) + (string-append install-dir "/node_modules/" dependency)))) dependencies)) #t)) -- 2.28.0 --------------7147A6E4CD22177BBBD8A6D8-- From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 22 11:47:29 2020 Received: (at 41219) by debbugs.gnu.org; 22 Sep 2020 15:47:29 +0000 Received: from localhost ([127.0.0.1]:33004 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kKkVt-000235-0m for submit@debbugs.gnu.org; Tue, 22 Sep 2020 11:47:29 -0400 Received: from confino.investici.org ([212.103.72.250]:35763) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kKkVq-00020F-7I for 41219@debbugs.gnu.org; Tue, 22 Sep 2020 11:47:28 -0400 Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4Bwm0D2nVCz10ws; Tue, 22 Sep 2020 15:47:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1600789644; bh=D3u/G1NAaVnjO22hp1L6nUdaIkaV6L4DzQj/ZVKxorM=; h=Subject:From:To:References:Date:In-Reply-To:From; b=IpRtsFYkKUghxyu+Dt3iLH8F/SpGRODpxj0jVbYk0HW5ltCJ4o7Le080WpCcIHwal YtxXyC9zLHTwWz7yiZxw+cWjseBSt70ITd9mw3PXRfLh2fE35AttJcIEoBcox/gdeB NI4FwF/uIClRZoskuk+JsNIQhAi1h2eHJ1zWhSrE= Received: from [212.103.72.250] (mx1.investici.org [212.103.72.250]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4Bwm0D26DFz10wR; Tue, 22 Sep 2020 15:47:24 +0000 (UTC) Subject: Re: [bug#41219] [PATCH 2/2] guix: Enforce package.json "files" directive. From: paul To: Jelle Licht , 41219@debbugs.gnu.org References: <20200512213131.28873-1-goodoldpaul@autistici.org> <20200512213131.28873-2-goodoldpaul@autistici.org> <875z88jkg9.fsf@jlicht.xyz> <7bea951c-c8c8-cca9-4bfe-8d8f5c83e2ab@autistici.org> Message-ID: <6730d1d5-38c7-22ee-ab4e-56430cd1b134@autistici.org> Date: Tue, 22 Sep 2020 17:47:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Icedove/68.12.0 MIME-Version: 1.0 In-Reply-To: <7bea951c-c8c8-cca9-4bfe-8d8f5c83e2ab@autistici.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 41219 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Jelle, just a quick follow up that I forgot yesterday. >>> +                 (map (lambda (path) >>> +                        (string-drop path 2)) >>                             ^ >>                           If this is meant to drop the "./" prefix, you >>                           should be able to leave it out. >> This seems to be necessary because given the way glob-match? is implemented a string matches a pattern iif either they start with the same character or the pattern starts with a wildcard. So for example: scheme@(guix-user)> ,use (guix glob) scheme@(guix-user)> (string->compiled-sglob "*.json") $1 = (* ".json") scheme@(guix-user)> (string->compiled-sglob "package.json") $2 = "package.json" scheme@(guix-user)> (glob-match? $1 "./package.json") $3 = #t scheme@(guix-user)> (glob-match? $2 "./package.json") $4 = #f Thank you again for your help, Cheers Giacomo From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 22 14:09:26 2020 Received: (at 41219) by debbugs.gnu.org; 22 Sep 2020 18:09:26 +0000 Received: from localhost ([127.0.0.1]:33295 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kKmjG-0001YJ-GO for submit@debbugs.gnu.org; Tue, 22 Sep 2020 14:09:26 -0400 Received: from mail1.fsfe.org ([217.69.89.151]:49438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kKmjC-0001Y8-KP for 41219@debbugs.gnu.org; Tue, 22 Sep 2020 14:09:25 -0400 From: Jelle Licht To: paul , 41219@debbugs.gnu.org Subject: Re: [bug#41219] [PATCH 2/2] guix: Enforce package.json "files" directive. In-Reply-To: <7bea951c-c8c8-cca9-4bfe-8d8f5c83e2ab@autistici.org> References: <20200512213131.28873-1-goodoldpaul@autistici.org> <20200512213131.28873-2-goodoldpaul@autistici.org> <875z88jkg9.fsf@jlicht.xyz> <7bea951c-c8c8-cca9-4bfe-8d8f5c83e2ab@autistici.org> Date: Tue, 22 Sep 2020 20:09:19 +0200 Message-ID: <87a6xhel9s.fsf@jlicht.xyz> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 41219 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) Hey Giacomo, paul writes: >>> + install-dir) >>> + (begin >>> + (copy-recursively "." install-dir) >>> + ;; Remove references to dependencies >>> + (delete-file-recursively >>> + (string-append install-dir "/node_modules")))) >>> + (if (and main >>> + (not (file-exists? >>> + (string-append >>> + install-dir "/" (dirname main))))) ^ {New,Forgotten} nitpick; this only checks for the `dirname': why not just `(string-append install-dir "/" main)'? Because if e.g. "lib/utils.js" is in "files", and main is "lib/main.js", it seems that main would not be installed with this snippet. Does that make sense? Thanks in advance, - Jelle From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 18 19:32:55 2020 Received: (at 41219) by debbugs.gnu.org; 18 Oct 2020 23:32:55 +0000 Received: from localhost ([127.0.0.1]:39363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUIAY-0002FR-Vt for submit@debbugs.gnu.org; Sun, 18 Oct 2020 19:32:55 -0400 Received: from latitanza.investici.org ([82.94.249.234]:57951) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUIAX-0002FI-9b for 41219@debbugs.gnu.org; Sun, 18 Oct 2020 19:32:54 -0400 Received: from mx3.investici.org (unknown [127.0.0.1]) by latitanza.investici.org (Postfix) with ESMTP id 4CDx5H5lCTz8sgs; Sun, 18 Oct 2020 23:32:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1603063971; bh=NJ86GEcA71tvlIWEVXS/D/tZCKoOIa79w3Emwy4UItM=; h=Subject:To:References:From:Date:In-Reply-To:From; b=p8RYCLhpQD6W/8DvmWNPpE+DToxWF7I2JZqctZxreEXAszsPrcXxw6RaznJ8HxkdI dQkYXJ2RQfzpUbyBbvsJXYdBYNtWItMB6u8J5dutLRhfDX3eoPTfQ4Znud1kVrMREC YRvDaZMvBM1Y2RwODUrd6A2ckrJua/cYp4wRjM/M= Received: from [82.94.249.234] (mx3.investici.org [82.94.249.234]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4CDx5H3V2Jz8sgf; Sun, 18 Oct 2020 23:32:51 +0000 (UTC) Subject: Re: [bug#41219] [PATCH 2/2] guix: Enforce package.json "files" directive. To: Jelle Licht , 41219@debbugs.gnu.org References: <20200512213131.28873-1-goodoldpaul@autistici.org> <20200512213131.28873-2-goodoldpaul@autistici.org> <875z88jkg9.fsf@jlicht.xyz> <7bea951c-c8c8-cca9-4bfe-8d8f5c83e2ab@autistici.org> <87a6xhel9s.fsf@jlicht.xyz> From: paul Message-ID: Date: Mon, 19 Oct 2020 01:32:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Icedove/78.3.2 MIME-Version: 1.0 In-Reply-To: <87a6xhel9s.fsf@jlicht.xyz> Content-Type: multipart/mixed; boundary="------------2DA8515CEAED3511EC542140" Content-Language: en-US X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 41219 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------2DA8515CEAED3511EC542140 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Dear Jelle, On 9/22/20 8:09 PM, Jelle Licht wrote: > Hey Giacomo, > > paul writes: >>>> + install-dir) >>>> + (begin >>>> + (copy-recursively "." install-dir) >>>> + ;; Remove references to dependencies >>>> + (delete-file-recursively >>>> + (string-append install-dir "/node_modules")))) >>>> + (if (and main >>>> + (not (file-exists? >>>> + (string-append >>>> + install-dir "/" (dirname main))))) > ^ > > {New,Forgotten} nitpick; this only checks for the `dirname': why not > just `(string-append install-dir "/" main)'? Because if > e.g. "lib/utils.js" is in "files", and main is "lib/main.js", it seems > that main would not be installed with this snippet. Does that make > sense? Yes it definitely does. I believe I fixed this in the attached patch. Thank you for your review, Giacomo --------------2DA8515CEAED3511EC542140 Content-Type: text/x-patch; charset=UTF-8; name="0002-guix-Enforce-package.json-files-directive.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0002-guix-Enforce-package.json-files-directive.patch" >From 3cc2a309f611ea1cd7cf1e0274ef81668819e058 Mon Sep 17 00:00:00 2001 From: Giacomo Leidi Date: Mon, 21 Sep 2020 22:18:19 +0200 Subject: [PATCH 2/2] guix: Enforce package.json "files" directive. This fixes https://issues.guix.gnu.org/40710 by implementing support for the "files" directive from https://docs.npmjs.com/files/package.json#files . * guix/build/node-build-system.scm (install): Enforce package.json "files" directive. * guix/build-system/node.scm (%node-build-system-modules) (node-build)[modules]: Add (guix glob). --- guix/build-system/node.scm | 4 +- guix/build/node-build-system.scm | 68 ++++++++++++++++++++++++++------ 2 files changed, 58 insertions(+), 14 deletions(-) diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm index 05c24c47d5..05bc9f2087 100644 --- a/guix/build-system/node.scm +++ b/guix/build-system/node.scm @@ -42,6 +42,7 @@ registry." `((guix build node-build-system) (guix build json) (guix build union) + (guix glob) ,@%gnu-build-system-modules)) ;; TODO: Might be not needed (define (default-node) @@ -90,7 +91,8 @@ registry." (modules '((guix build node-build-system) (guix build json) (guix build union) - (guix build utils)))) + (guix build utils) + (guix glob)))) "Build SOURCE using NODE and INPUTS." (define builder `(begin diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm index 7799f03595..3c15e7931b 100644 --- a/guix/build/node-build-system.scm +++ b/guix/build/node-build-system.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 David Thompson ;;; Copyright © 2016 Jelle Licht +;;; Copyright © 2020 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,6 +23,7 @@ #:use-module (guix build json) #:use-module (guix build union) #:use-module (guix build utils) + #:use-module (guix glob) #:use-module (ice-9 match) #:use-module (ice-9 popen) #:use-module (ice-9 regex) @@ -110,18 +112,60 @@ the @file{bin} directory." (#f #f))) (dependencies (match (assoc-ref data "dependencies") (('@ deps ...) deps) - (#f #f)))) + (#f #f))) + (file-list (match (assoc-ref data "files") + (() #f) + ((? list? pattern-list) pattern-list) + (#f #f))) + (patterns + (when file-list + (map (lambda (pattern) + (string->compiled-sglob pattern)) + (append file-list + '("package.json" + ;; These files get installed no + ;; matter the case or extension. + "[rR][eE][aA][dD][mM][eE]*" + "[cC][hH][aA][nN][gG][eE][sS]*" + "[cC][hH][aA][nN][gG][eE][lL][oO][gG]*" + "[hH][iI][sS][tT][oO][rR][yY]*" + "[nN][oO][tT][iI][cC][eE]*"))))) + (main (match (assoc-ref data "main") + ("" #f) + ((? string? main-module) main-module) + (#f #f))) + (install-dir (string-append target "/node_modules/" modulename)) + (install-files (lambda (files) + (for-each (lambda (file) + (install-file + file + (string-append install-dir "/" + (dirname file)))) + files)))) (mkdir-p target) - (copy-recursively "." (string-append target "/node_modules/" modulename)) - ;; Remove references to dependencies - (delete-file-recursively - (string-append target "/node_modules/" modulename "/node_modules")) + (if file-list + (install-files + (find-files "." (lambda (file stat) + (any (lambda (pattern) + (glob-match? pattern + (string-drop file 2))) + patterns)))) + (begin + (copy-recursively "." install-dir) + ;; Remove references to dependencies + (delete-file-recursively + (string-append install-dir "/node_modules")))) + (when main + (let ((main.js (if (string-contains (basename main) ".js") + main + (string-append main ".js")))) + (unless (file-exists? main.js) + (install-files (list main.js))))) (cond ((string? binary-configuration) (begin (mkdir-p binaries) - (symlink (string-append target "/node_modules/" modulename "/" - binary-configuration) + (symlink (string-append install-dir "/" binary-configuration) (string-append binaries "/" modulename)))) ((list? binary-configuration) (for-each @@ -130,21 +174,19 @@ the @file{bin} directory." ((key . value) (begin (mkdir-p (dirname (string-append binaries "/" key))) - (symlink (string-append target "/node_modules/" modulename "/" - value) + (symlink (string-append install-dir "/" value) (string-append binaries "/" key)))))) - binary-configuration))) + binary-configuration))) (when dependencies (mkdir-p - (string-append target "/node_modules/" modulename "/node_modules")) + (string-append install-dir "/node_modules")) (for-each (lambda (dependency) (let ((dependency (car dependency))) (symlink (string-append (assoc-ref inputs (string-append "node-" dependency)) "/lib/node_modules/" dependency) - (string-append target "/node_modules/" modulename - "/node_modules/" dependency)))) + (string-append install-dir "/node_modules/" dependency)))) dependencies)) #t)) -- 2.28.0 --------------2DA8515CEAED3511EC542140-- From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 19 09:44:39 2020 Received: (at 41219) by debbugs.gnu.org; 19 Oct 2020 13:44:39 +0000 Received: from localhost ([127.0.0.1]:40298 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUVSp-0005wv-AW for submit@debbugs.gnu.org; Mon, 19 Oct 2020 09:44:39 -0400 Received: from latitanza.investici.org ([82.94.249.234]:62871) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUVSm-0005wl-78 for 41219@debbugs.gnu.org; Mon, 19 Oct 2020 09:44:37 -0400 Received: from mx3.investici.org (unknown [127.0.0.1]) by latitanza.investici.org (Postfix) with ESMTP id 4CFJ024Hvnz8sfr; Mon, 19 Oct 2020 13:44:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1603115074; bh=dDqA17ckSGdvtZJ1eRNzcVVpdxEzEWWTGKoUCKFOczI=; h=Subject:To:References:From:Date:In-Reply-To:From; b=bX0b7NxNoYEYUMYXIMY+kb8GTHCu9W2mZ8aciKbjeUFGUeRPiyjkNZX93DBUrEGqG 3sEH0W6WCrWtgNxkzVJ2STOlzruEKD5cxHrj0LJ4jfBazNPN2QmbPEE2XfbV/TlGo7 4R+SuyaSR+bcPg19G4lI1/iVLLRtU0fWEgatmMW8= Received: from [82.94.249.234] (mx3.investici.org [82.94.249.234]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4CFJ022QdJz8sfK; Mon, 19 Oct 2020 13:44:34 +0000 (UTC) Subject: Re: [bug#41219] [PATCH 2/2] guix: Enforce package.json "files" directive. To: Jelle Licht , 41219@debbugs.gnu.org References: <20200512213131.28873-1-goodoldpaul@autistici.org> <20200512213131.28873-2-goodoldpaul@autistici.org> <875z88jkg9.fsf@jlicht.xyz> <7bea951c-c8c8-cca9-4bfe-8d8f5c83e2ab@autistici.org> <87a6xhel9s.fsf@jlicht.xyz> From: paul Message-ID: Date: Mon, 19 Oct 2020 15:44:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Icedove/78.3.2 MIME-Version: 1.0 In-Reply-To: <87a6xhel9s.fsf@jlicht.xyz> Content-Type: multipart/mixed; boundary="------------07B399EEDB6F6ACD3202AB40" Content-Language: en-US X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 41219 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------07B399EEDB6F6ACD3202AB40 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi Jelle, I messed up again :( this new patch actually checks the right path for the existence of the "main" file. I hope I didn't mess up anything else. Thank you for your patience, Giacomo --------------07B399EEDB6F6ACD3202AB40 Content-Type: text/x-patch; charset=UTF-8; name="0002-guix-Enforce-package.json-files-directive.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0002-guix-Enforce-package.json-files-directive.patch" >From 7dc7764da6a3463fdfed5667b02458d541518cbc Mon Sep 17 00:00:00 2001 From: Giacomo Leidi Date: Mon, 21 Sep 2020 22:18:19 +0200 Subject: [PATCH 2/2] guix: Enforce package.json "files" directive. This fixes https://issues.guix.gnu.org/40710 by implementing support for the "files" directive from https://docs.npmjs.com/files/package.json#files . * guix/build/node-build-system.scm (install): Enforce package.json "files" directive. * guix/build-system/node.scm (%node-build-system-modules) (node-build)[modules]: Add (guix glob). --- guix/build-system/node.scm | 4 +- guix/build/node-build-system.scm | 68 ++++++++++++++++++++++++++------ 2 files changed, 58 insertions(+), 14 deletions(-) diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm index 05c24c47d5..05bc9f2087 100644 --- a/guix/build-system/node.scm +++ b/guix/build-system/node.scm @@ -42,6 +42,7 @@ registry." `((guix build node-build-system) (guix build json) (guix build union) + (guix glob) ,@%gnu-build-system-modules)) ;; TODO: Might be not needed (define (default-node) @@ -90,7 +91,8 @@ registry." (modules '((guix build node-build-system) (guix build json) (guix build union) - (guix build utils)))) + (guix build utils) + (guix glob)))) "Build SOURCE using NODE and INPUTS." (define builder `(begin diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm index 7799f03595..831a8b7328 100644 --- a/guix/build/node-build-system.scm +++ b/guix/build/node-build-system.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 David Thompson ;;; Copyright © 2016 Jelle Licht +;;; Copyright © 2020 Giacomo Leidi ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,6 +23,7 @@ #:use-module (guix build json) #:use-module (guix build union) #:use-module (guix build utils) + #:use-module (guix glob) #:use-module (ice-9 match) #:use-module (ice-9 popen) #:use-module (ice-9 regex) @@ -110,18 +112,60 @@ the @file{bin} directory." (#f #f))) (dependencies (match (assoc-ref data "dependencies") (('@ deps ...) deps) - (#f #f)))) + (#f #f))) + (file-list (match (assoc-ref data "files") + (() #f) + ((? list? pattern-list) pattern-list) + (#f #f))) + (patterns + (when file-list + (map (lambda (pattern) + (string->compiled-sglob pattern)) + (append file-list + '("package.json" + ;; These files get installed no + ;; matter the case or extension. + "[rR][eE][aA][dD][mM][eE]*" + "[cC][hH][aA][nN][gG][eE][sS]*" + "[cC][hH][aA][nN][gG][eE][lL][oO][gG]*" + "[hH][iI][sS][tT][oO][rR][yY]*" + "[nN][oO][tT][iI][cC][eE]*"))))) + (main (match (assoc-ref data "main") + ("" #f) + ((? string? main-module) main-module) + (#f #f))) + (install-dir (string-append target "/node_modules/" modulename)) + (install-files (lambda (files) + (for-each (lambda (file) + (install-file + file + (string-append install-dir "/" + (dirname file)))) + files)))) (mkdir-p target) - (copy-recursively "." (string-append target "/node_modules/" modulename)) - ;; Remove references to dependencies - (delete-file-recursively - (string-append target "/node_modules/" modulename "/node_modules")) + (if file-list + (install-files + (find-files "." (lambda (file stat) + (any (lambda (pattern) + (glob-match? pattern + (string-drop file 2))) + patterns)))) + (begin + (copy-recursively "." install-dir) + ;; Remove references to dependencies + (delete-file-recursively + (string-append install-dir "/node_modules")))) + (when main + (let ((main.js (if (string-contains (basename main) ".js") + main + (string-append main ".js")))) + (unless (file-exists? (string-append install-dir "/" main.js)) + (install-files (list main.js))))) (cond ((string? binary-configuration) (begin (mkdir-p binaries) - (symlink (string-append target "/node_modules/" modulename "/" - binary-configuration) + (symlink (string-append install-dir "/" binary-configuration) (string-append binaries "/" modulename)))) ((list? binary-configuration) (for-each @@ -130,21 +174,19 @@ the @file{bin} directory." ((key . value) (begin (mkdir-p (dirname (string-append binaries "/" key))) - (symlink (string-append target "/node_modules/" modulename "/" - value) + (symlink (string-append install-dir "/" value) (string-append binaries "/" key)))))) - binary-configuration))) + binary-configuration))) (when dependencies (mkdir-p - (string-append target "/node_modules/" modulename "/node_modules")) + (string-append install-dir "/node_modules")) (for-each (lambda (dependency) (let ((dependency (car dependency))) (symlink (string-append (assoc-ref inputs (string-append "node-" dependency)) "/lib/node_modules/" dependency) - (string-append target "/node_modules/" modulename - "/node_modules/" dependency)))) + (string-append install-dir "/node_modules/" dependency)))) dependencies)) #t)) -- 2.28.0 --------------07B399EEDB6F6ACD3202AB40-- From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 24 09:23:38 2020 Received: (at 41219) by debbugs.gnu.org; 24 Oct 2020 13:23:38 +0000 Received: from localhost ([127.0.0.1]:32957 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kWJWE-0007Df-ET for submit@debbugs.gnu.org; Sat, 24 Oct 2020 09:23:38 -0400 Received: from mail1.fsfe.org ([217.69.89.151]:55916) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kWJWA-0007DV-GA for 41219@debbugs.gnu.org; Sat, 24 Oct 2020 09:23:36 -0400 From: Jelle Licht To: paul , 41219@debbugs.gnu.org Subject: Re: [bug#41219] [PATCH 2/2] guix: Enforce package.json "files" directive. In-Reply-To: References: <20200512213131.28873-1-goodoldpaul@autistici.org> <20200512213131.28873-2-goodoldpaul@autistici.org> <875z88jkg9.fsf@jlicht.xyz> <7bea951c-c8c8-cca9-4bfe-8d8f5c83e2ab@autistici.org> <87a6xhel9s.fsf@jlicht.xyz> Date: Sat, 24 Oct 2020 15:23:31 +0200 Message-ID: <86zh4bwyek.fsf@fsfe.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 41219 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) Hey Giacomo, paul writes: > Hi Jelle, > > I messed up again :( this new patch actually checks the right path for > the existence of the "main" file. I hope I didn't mess up anything else. I've been working on an alternative implementation to achieve what this patch is trying to do; See [1] for what I tried. Do you think that addresses your use-case as well? If so, perhaps we can still have a look at the glob code you contributed, as it seems useful outside of an npm context. Thanks! - Jelle [1]: https://lists.gnu.org/archive/html/guix-devel/2020-10/msg00403.html From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 24 13:07:31 2020 Received: (at 41219) by debbugs.gnu.org; 24 Oct 2020 17:07:31 +0000 Received: from localhost ([127.0.0.1]:35054 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kWN0t-0004pS-I1 for submit@debbugs.gnu.org; Sat, 24 Oct 2020 13:07:31 -0400 Received: from latitanza.investici.org ([82.94.249.234]:61555) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kWN0q-0004pG-CG for 41219@debbugs.gnu.org; Sat, 24 Oct 2020 13:07:29 -0400 Received: from mx3.investici.org (unknown [127.0.0.1]) by latitanza.investici.org (Postfix) with ESMTP id 4CJSFq1BB9z8sgh; Sat, 24 Oct 2020 17:07:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1603559247; bh=wuZq+FvQECeZT9W3bia1awCinbmd+dSzHIgSLr48uDQ=; h=Subject:To:References:From:Date:In-Reply-To:From; b=HAwLV19BtS29cYuhdBdzaWO+WZgFROvan18w6OwABDx0AaNqQ66SfmtTQdiXt1VdS hN+JcNBqHLGR0W1LxeJ0mGBNgw+axxrXiY1Ld7HIGrMFr8ftqnb+YZy2t37MDgADZ5 CW4HlNNYMRdWoMby5acjgnb1bEA2P6yN5IPwwkco= Received: from [82.94.249.234] (mx3.investici.org [82.94.249.234]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4CJSFp6bS4z8sgM; Sat, 24 Oct 2020 17:07:26 +0000 (UTC) Subject: Re: [bug#41219] [PATCH 2/2] guix: Enforce package.json "files" directive. To: Jelle Licht , 41219@debbugs.gnu.org References: <20200512213131.28873-1-goodoldpaul@autistici.org> <20200512213131.28873-2-goodoldpaul@autistici.org> <875z88jkg9.fsf@jlicht.xyz> <7bea951c-c8c8-cca9-4bfe-8d8f5c83e2ab@autistici.org> <87a6xhel9s.fsf@jlicht.xyz> <86zh4bwyek.fsf@fsfe.org> From: paul Message-ID: Date: Sat, 24 Oct 2020 19:07:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Icedove/78.3.2 MIME-Version: 1.0 In-Reply-To: <86zh4bwyek.fsf@fsfe.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: 41219 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.1 (-) Hi Jelle, > I've been working on an alternative implementation to achieve what this > patch is trying to do; See [1] for what I tried. Do you think that > addresses your use-case as well? If so, perhaps we can still have a look > at the glob code you contributed, as it seems useful outside of an npm > context. I think it definitely does, thank you for your work :D I agree that my patch to the node-build-system is not useful anymore, so if deem the other patch worth of being merged I'd go that way. Thank you for your review, Giacomo From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 30 18:30:59 2020 Received: (at 41219) by debbugs.gnu.org; 30 Nov 2020 23:30:59 +0000 Received: from localhost ([127.0.0.1]:57069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kjsdH-0002Kl-BB for submit@debbugs.gnu.org; Mon, 30 Nov 2020 18:30:59 -0500 Received: from confino.investici.org ([212.103.72.250]:42641) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kjsdF-0002Kc-BC for 41219@debbugs.gnu.org; Mon, 30 Nov 2020 18:30:57 -0500 Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4ClM1D5rkkz115b; Mon, 30 Nov 2020 23:30:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1606779056; bh=TWqaaf7yes9Wiaq/u/0/OHoTotX5Gn1Bs0wQQToppQI=; h=Subject:To:References:From:Date:In-Reply-To:From; b=ZyTVNZtXG2ogPF4SJW6uD996r7AkH0Fo9pg4m2EUPgNxFSENk6kPF2K05aD6/HzyC BgpopSgByhG/7no/gb5oJ/Se/NLq8OKG/mLC+fpea0knJZR0m2qCDSHSRhFXm+SvgT ZXFm4MJmc/zaK6RRb0gdF4/33LIzYZbWaaJwuyHc= Received: from [212.103.72.250] (mx1.investici.org [212.103.72.250]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4ClM1D52p2z115Z; Mon, 30 Nov 2020 23:30:56 +0000 (UTC) Subject: Re: [bug#41219] [PATCH 2/2] guix: Enforce package.json "files" directive. To: Jelle Licht , 41219@debbugs.gnu.org References: <20200512213131.28873-1-goodoldpaul@autistici.org> <20200512213131.28873-2-goodoldpaul@autistici.org> <875z88jkg9.fsf@jlicht.xyz> <7bea951c-c8c8-cca9-4bfe-8d8f5c83e2ab@autistici.org> <87a6xhel9s.fsf@jlicht.xyz> <86zh4bwyek.fsf@fsfe.org> From: paul Message-ID: <281725b0-9a8f-5bf0-6620-3730bf4b74e6@autistici.org> Date: Tue, 1 Dec 2020 00:30:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Icedove/78.4.0 MIME-Version: 1.0 In-Reply-To: <86zh4bwyek.fsf@fsfe.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 41219 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Dear Jelle, do you believe that you can merge the globstar patch? Otherwise I would just close this issue if you agree with it. Thank you for your time, Giacomo From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 09 16:45:48 2020 Received: (at 41219-done) by debbugs.gnu.org; 9 Dec 2020 21:45:48 +0000 Received: from localhost ([127.0.0.1]:36384 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kn7HQ-0003dD-Le for submit@debbugs.gnu.org; Wed, 09 Dec 2020 16:45:48 -0500 Received: from mail1.fsfe.org ([217.69.89.151]:56476) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kn7HL-0003d0-Ou for 41219-done@debbugs.gnu.org; Wed, 09 Dec 2020 16:45:47 -0500 From: Jelle Licht To: paul , 41219-done@debbugs.gnu.org Subject: Re: [bug#41219] [PATCH 2/2] guix: Enforce package.json "files" directive. In-Reply-To: <281725b0-9a8f-5bf0-6620-3730bf4b74e6@autistici.org> References: <20200512213131.28873-1-goodoldpaul@autistici.org> <20200512213131.28873-2-goodoldpaul@autistici.org> <875z88jkg9.fsf@jlicht.xyz> <7bea951c-c8c8-cca9-4bfe-8d8f5c83e2ab@autistici.org> <87a6xhel9s.fsf@jlicht.xyz> <86zh4bwyek.fsf@fsfe.org> <281725b0-9a8f-5bf0-6620-3730bf4b74e6@autistici.org> Date: Wed, 09 Dec 2020 22:45:40 +0100 Message-ID: <86eejy64cb.fsf@fsfe.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 41219-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) Dear Giacomo, paul writes: > Dear Jelle, > > do you believe that you can merge the globstar patch? Otherwise I would > just close this issue if you agree with it. I finally pushed your globstar patch to master in 371ba7b4b. > Thank you for your time, Thank you for your patience! - Jelle From unknown Sat Jun 21 03:26:00 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 07 Jan 2021 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator