From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id gKhlCACSCGVoGgEA9RJhRA:P1 (envelope-from ) for ; Mon, 18 Sep 2023 20:08:00 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id gKhlCACSCGVoGgEA9RJhRA (envelope-from ) for ; Mon, 18 Sep 2023 20:08:00 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E993553191 for ; Mon, 18 Sep 2023 20:07:59 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=N19BfuXc; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1695060480; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=l6ds5f6DEk3FeZ0Lm1KcNpISCKwkAffzc7l5DbjMozE=; b=pdpXUXMdMWCD55/qlRMABydtT0pldaRA3dj/I68FAsN+S7UgtMZqikiTv4pI92LqDUcJDF pmTT0OyczYR5FrsfRZauyHpfLUrgVG+dCJr7gNPRBjAGMvI6rVvyED7Bu18JCN6Lolo3En bBUNpo2ecDIeHLDgAMJyrRHqLUCi4UGCPpZ07ffF8WDVd56zrXh8hoKfv0h+XZ3ceMFOAX lE0GJKVuyC/T4CgKDF9n0ZdIQQ5NthvYgXUUB1KymJjsonhDXixv/T8DibvLSTAGaR+eO7 3vQV7yNAKXvs8KekqADxy31zVdPkB8Fq0M18dlW3jghrRST+4GnDJNJ3ZCcfNQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1695060480; a=rsa-sha256; cv=none; b=G5Lu0PbbQqei4Pt5b9U3jk8lECXhWW87XLfHpGvsR9aJCtF/4fPBNGTdbpImp6zn6cuu39 UW/Vle7NaPs55ANiLqHwVlFtvu9rHBUX0yzCSKZ1pvOMAeTTDp43GEo/Xu4ma0X/2MvGMF xPV6p+4OQZiwfpUpHDDaZfu4+XrmCiWW/Ix7q4O1pTEe/CSy1PvsbIj9uv2si6sGvxYXcM waIsl8hm0TuM2g7p2v2J/brj21uZPN0gSl1WNXFNHjQCKA6BHApQ9zhF3BAQmNywJJ1qg2 c9KtJwLoP3W6fLfwhsDpYXTPzSa/ETfQrCapqjOHmafsikqK3aD8rOA4o9dt6Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=N19BfuXc; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qiIdf-0005W7-Es; Mon, 18 Sep 2023 14:06:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qiIdG-000550-UQ for guix-patches@gnu.org; Mon, 18 Sep 2023 14:06:06 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qiIdG-00044k-JO for guix-patches@gnu.org; Mon, 18 Sep 2023 14:06:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qiIdO-0002Vn-PD for guix-patches@gnu.org; Mon, 18 Sep 2023 14:06:10 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66086] [PATCH v2 17/23] DRAFT import: juliahub: More robust toml regex parser. Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 18 Sep 2023 18:06:10 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 66086 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62202@debbugs.gnu.org Cc: 66086@debbugs.gnu.org, zimon.toutoune@gmail.com X-Debbugs-Original-Cc: Nicolas Graves via Guix-patches via , Simon Tournier Received: via spool by submit@debbugs.gnu.org id=B.16950603289404 (code B ref -1); Mon, 18 Sep 2023 18:06:10 +0000 Received: (at submit) by debbugs.gnu.org; 18 Sep 2023 18:05:28 +0000 Received: from localhost ([127.0.0.1]:54475 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiIch-0002RW-K1 for submit@debbugs.gnu.org; Mon, 18 Sep 2023 14:05:28 -0400 Received: from lists.gnu.org ([2001:470:142::17]:58342) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiIbl-0002KH-Ff for submit@debbugs.gnu.org; Mon, 18 Sep 2023 14:04:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qiIbD-0002Pl-AV for guix-patches@gnu.org; Mon, 18 Sep 2023 14:04:00 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qiIb9-0003QD-UD for guix-patches@gnu.org; Mon, 18 Sep 2023 14:03:54 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-321617ef967so108851f8f.0 for ; Mon, 18 Sep 2023 11:03:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695060228; x=1695665028; darn=gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=l6ds5f6DEk3FeZ0Lm1KcNpISCKwkAffzc7l5DbjMozE=; b=N19BfuXcGAe6EpQqQTm4CM8SZb9dgcjYlS7cTTfa5QwmtjS4wzIYmUaen0/QclB3Jr 0gUBlHBbEXEKSRF+oQ1JaZT5O6yqKPQhbHq2aRSPUBJzZq6LLfRX4Q5dR5/RCFaSJujC 6Ipekl4sEy6DPeIpWnbtsb/ll+ovXrIRT8+Ensy8iBSe5akZ5577208nbe4KfKhjGxNP fL/Cejr0Yfi9E6RODCLuMN0Zcg2gfcOhex9Dv7WQtT0Qi/qVGiizUE8IU8q01u0QD+7G o43CNRT2LjsbyLuUcer6YckB9CY3muulGxezT0PfErMAWlhkRJTHDzTIICbg9kyT3Gxw OoPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695060228; x=1695665028; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l6ds5f6DEk3FeZ0Lm1KcNpISCKwkAffzc7l5DbjMozE=; b=nbJxsAMj0X/aAJKDwtzqKGpU92WzWCMAY0mWvoRsLl6nDT40ogXRgwrJv/SwRyOP1N 4hAOROlU4cZxbQUxT89sNIqZdBJZbmRxdIjprxgwuDyuGenSPqb9Uad+cewSh1wg51hY DJDb4SfkIh6OhFmlfJXijIp9ZTXK17SaaveUfBbbKb39Yfx7WLF+SZty6Ye4gu+A9vnc BSGFInf0J/kDVJZhP52bHzE64AxCA06JrFXEsQsf0hNQWYc0RU+NZsNS5yaxrOlkiTUP 3ya2MpnyoSvDV2jyblWCOOO/5FAzC7qFYZuuC1Q6eojdd36LzbU51kwXKn5muoyacuiz A0iQ== X-Gm-Message-State: AOJu0YxFIoo3EjOR9bdOSEmmBdMB9309naCygU9dDrW54SAYpTdhKlKo JihHfAZoBBOCmO0sXsnC1YRJvxo2+p8= X-Google-Smtp-Source: AGHT+IF4kTuAJoABY54CyrdGUgJ47h498CDUG2y8c4+8rHho08nZ8YgHh4MiLdXUL93PNZTY+3oQ1w== X-Received: by 2002:adf:ef88:0:b0:317:3d36:b2c1 with SMTP id d8-20020adfef88000000b003173d36b2c1mr8050632wro.7.1695060228022; Mon, 18 Sep 2023 11:03:48 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id z2-20020adfd0c2000000b0030ada01ca78sm2210465wrh.10.2023.09.18.11.03.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 11:03:47 -0700 (PDT) From: Simon Tournier Date: Mon, 18 Sep 2023 20:03:24 +0200 Message-Id: <2423ea8dafa29faa49e75da40a480873531e5126.1695060058.git.zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=zimon.toutoune@gmail.com; helo=mail-wr1-x42d.google.com 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: 6.25 X-Spam-Score: 6.25 X-Migadu-Queue-Id: E993553191 X-Migadu-Scanner: mx0.migadu.com X-TUID: AoyhHsnfH5Y6 From: Nicolas Graves via Guix-patches via Signed-off-by: Simon Tournier --- guix/import/juliahub.scm | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/guix/import/juliahub.scm b/guix/import/juliahub.scm index 1c7b02929634..3985d8d0be44 100644 --- a/guix/import/juliahub.scm +++ b/guix/import/juliahub.scm @@ -154,28 +154,15 @@ (define (json->juliahub-dependencies vector) #f))) (vector->list vector)))) -(define (ini-list->test-dependencies lst) - (match lst - (('test '= ooo ...) - `(,(caar ooo) ,@(test-list->test-dependencies (cdar ooo)))) - ((value ooo ...) - (ini-list->test-dependencies ooo)) - ('() - '()))) - -(define (test-list->test-dependencies lst) - (match lst - ((('unquote value) ooo ...) - `(,value ,@(test-list->test-dependencies ooo))) - ('() - '()))) - (define (parse-test-dependencies directory) (let* ((port (open-input-file (string-append directory "/Project.toml"))) - (ini-list (stream->list (port->stream port read)))) + (project.toml (get-string-all port)) + (regex "\ntest = \\[.*\\]") + (deps (match:substring (string-match regex project.toml))) + (pure (string-delete (list->char-set (list #\" #\ )) deps))) (close-port port) (filter (lambda (x) (not (member x %julia-stdlibs))) - (ini-list->test-dependencies ini-list)))) + (string-split (string-drop (string-drop-right pure 1) 7) #\,)))) ;; Julia package. (define-json-mapping make-juliahub-package juliahub-package? @@ -243,9 +230,9 @@ (define* (juliahub->guix-package package-name "Fetch the metadata for PACKAGE-NAME from juliahub.org, and return the `package' s-expression corresponding to that package, or #f on failure. Optionally include a VERSION string to fetch a specific version juliahub." - (let* ((package-toml (ini-fetch (general-url package-name "Package.toml"))) - (subdir (assoc-ref package-toml 'subdir)) - (tag (latest-git-tag (assoc-ref package-toml 'repo))) + (let* ((package.toml (ini-fetch (general-url package-name "Package.toml"))) + (subdir (assoc-ref package.toml 'subdir)) + (tag (latest-git-tag (assoc-ref package.toml 'repo))) (package (if version (juliahub-fetch package-name #:version version) (if tag -- 2.38.1