From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id GHgDA/lmtWC5PAAAgWs5BA (envelope-from ) for ; Tue, 01 Jun 2021 00:45:13 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 4GX9OfhmtWCEewAAB5/wlQ (envelope-from ) for ; Mon, 31 May 2021 22:45:12 +0000 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 6FBA52795C for ; Tue, 1 Jun 2021 00:45:12 +0200 (CEST) Received: from localhost ([::1]:50318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnqel-0006DY-Ei for larch@yhetil.org; Mon, 31 May 2021 18:45:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnqec-0006D8-SW for guix-patches@gnu.org; Mon, 31 May 2021 18:45:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51862) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lnqec-0007Sa-LA for guix-patches@gnu.org; Mon, 31 May 2021 18:45:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lnqec-00040E-Jm for guix-patches@gnu.org; Mon, 31 May 2021 18:45:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48766] [PATCH 02/14] guix: maven: Simplify finding version and group information. Resent-From: Julien Lepiller Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 31 May 2021 22:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48766 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48766@debbugs.gnu.org Received: via spool by 48766-submit@debbugs.gnu.org id=B48766.162250108715304 (code B ref 48766); Mon, 31 May 2021 22:45:02 +0000 Received: (at 48766) by debbugs.gnu.org; 31 May 2021 22:44:47 +0000 Received: from localhost ([127.0.0.1]:35164 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnqeM-0003ye-Ci for submit@debbugs.gnu.org; Mon, 31 May 2021 18:44:47 -0400 Received: from lepiller.eu ([89.234.186.109]:38956) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnqeG-0003xU-5F for 48766@debbugs.gnu.org; Mon, 31 May 2021 18:44:40 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id 1dc37eba for <48766@debbugs.gnu.org>; Mon, 31 May 2021 22:44:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=from:to :subject:date:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; s=dkim; bh=ryCiWPE+SjFA 7IrWGVB6IxXqOinM+4dWvJxi8ehIRSM=; b=VCV+xWmuHz9oEprbANAlFRTnCGXV BnG4bz7P04QuefL7FSzACA2jigC3WehCDI1rMO0gMm37xo3OvD5cAxnPLJenJsLR ieAFN33dfGi0ifRxW9GaXBYutSHtZzcoWXYCoQuWrTxncVH9ZvrwYVN/gdyO/z+k ZHfboWMO92dCz/k4MwDxm8PJi6IX3vLcKwuYAxuNnae71EfHM+ouUvX18EVWNg9y l6HfjF3+oXkjQfUvb4XwY15YDl4DLd5+9SQUAnhNVhx46wHv1uRSOivR+nJfaZxX Ve23AhYrw02++2rcNsS6Q1/HbNNrLpIK0c23NGKeYJ7A2v2Ld201K96aRw== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 193a8294 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for <48766@debbugs.gnu.org>; Mon, 31 May 2021 22:44:36 +0000 (UTC) From: Julien Lepiller Date: Tue, 1 Jun 2021 00:44:15 +0200 Message-Id: <20210531224427.13300-2-julien@lepiller.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531224427.13300-1-julien@lepiller.eu> References: <20210601004100.69baa2d0@tachikoma.lepiller.eu> <20210531224427.13300-1-julien@lepiller.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1622501112; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: 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=G5TK4aLRXsVzeRZoh2Tot0WWtcK20uuqW2iuSm2LtE4=; b=GOb9ryNnz/2zgHq6ZlLiETwZBuQbJobvhc6bw9O2eUKkV/9XB7nMZyH+UQX8iD4qV3malz LWzKFDm8GI6cBV+kofNUcr3n2paVjquIUwGtImhA9jQCju+cm3KT/dWt4JwxcPlujnwnbF apXSTg/ncrjE7uJUoLsVNqGrQmdSaTJMwbVjldpn22r6fvg1O9HJCqhfNT+jaIfTbzh/Zm zoFL6YQvXGnDW1qOwgx99wzwtkr1aWL01Ur8PLJgHTfhQsE4riQXzxBtfqjC/2bk7Q84Bc UDpPJOaYRC+tAk6Ed80tSFvupdnfhNoTTTXFDk8SCIX2oLXd4BV6j5JVk4iXgw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622501112; a=rsa-sha256; cv=none; b=oGmxgQObbIZP568UD/sWC/hSfH7pL3erRY84Viih4ozcwrLnA5vPA0JB9bCgva5rD+r4Ff Rm6c8bLsh38iPQGKJJLK2bp1GWSpUyL68Op/jnPlLGhowkeW38HUAXvZy/Uyc43fj5Wcgh cijQvyjBrAd3VXXpMNUKOcR0wkTsaPmpc1BzVsCv5F3Bah6isgIjvirzxabWj8MFG2PCb/ nroH4WTtEksy3l/YJnGx5RPmOkzNRt+PU9jAV1SmnkKCPUqrakHD7N3jN9Q3m/mtxf4clk W7PhVQkcAZvOJBjOrKt1H+ZIw+cyy0u0QdlvnPJTW45ELPewMWNMMdzXz/Ifag== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lepiller.eu header.s=dkim header.b=VCV+xWmu; dmarc=fail reason="SPF not aligned (relaxed)" header.from=lepiller.eu (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -0.33 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lepiller.eu header.s=dkim header.b=VCV+xWmu; dmarc=fail reason="SPF not aligned (relaxed)" header.from=lepiller.eu (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 6FBA52795C X-Spam-Score: -0.33 X-Migadu-Scanner: scn0.migadu.com X-TUID: 2hJLux0FCpZ2 * guix/build/maven/pom.scm (pom-version, pom-groupid): Do not use inputs and local packages information anymore. Adapt file to new arguments. * guix/build/maven-build-system.scm: Adapt to new arguments. * guix/build/java-utils.scm: Adapt to new arguments. --- guix/build/java-utils.scm | 18 +++++++++--------- guix/build/maven-build-system.scm | 6 +++--- guix/build/maven/pom.scm | 26 ++++++++++++-------------- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/guix/build/java-utils.scm b/guix/build/java-utils.scm index 6abd97e118..5a54a14c1b 100644 --- a/guix/build/java-utils.scm +++ b/guix/build/java-utils.scm @@ -2,7 +2,7 @@ ;;; Copyright © 2016 Hartmut Goebel ;;; Copyright © 2016 Ricardo Wurmus ;;; Copyright © 2018 Alex Vong -;;; Copyright © 2020 Julien Lepiller +;;; Copyright © 2020, 2021 Julien Lepiller ;;; ;;; This file is part of GNU Guix. ;;; @@ -69,9 +69,9 @@ fetched." (let* ((out (assoc-ref outputs "out")) (java-inputs (append (map cdr inputs) (map cdr outputs))) (pom-content (get-pom pom-file)) - (version (pom-version pom-content java-inputs)) + (version (pom-version pom-content)) (artifact (pom-artifactid pom-content)) - (group (group->dir (pom-groupid pom-content java-inputs))) + (group (group->dir (pom-groupid pom-content))) (repository (string-append out "/lib/m2/" group "/" artifact "/" version "/")) (pom-name (string-append repository artifact "-" version ".pom"))) @@ -87,8 +87,8 @@ to ensure that maven can find dependencies." (manifest (string-append dir "/META-INF/MANIFEST.MF")) (pom (get-pom pom-file)) (artifact (pom-artifactid pom)) - (group (pom-groupid pom inputs)) - (version (pom-version pom inputs)) + (group (pom-groupid pom)) + (version (pom-version pom)) (pom-dir (string-append "META-INF/maven/" group "/" artifact))) (mkdir-p (string-append dir "/" pom-dir)) (copy-file pom-file (string-append dir "/" pom-dir "/pom.xml")) @@ -113,9 +113,9 @@ the phase fails." (let* ((out (assoc-ref outputs "out")) (java-inputs (append (map cdr inputs) (map cdr outputs))) (pom-content (get-pom pom-file)) - (version (pom-version pom-content java-inputs)) + (version (pom-version pom-content)) (artifact (pom-artifactid pom-content)) - (group (group->dir (pom-groupid pom-content java-inputs))) + (group (group->dir (pom-groupid pom-content))) (repository (string-append out "/lib/m2/" group "/" artifact "/" version "/")) ;; We try to find the file that was built. If it was built from our @@ -180,9 +180,9 @@ recognize the package as a plugin, and find the entry points in the plugin." (name (pom-name pom-content)) (description (pom-description pom-content)) (dependencies (pom-dependencies pom-content)) - (version (pom-version pom-content java-inputs)) + (version (pom-version pom-content)) (artifact (pom-artifactid pom-content)) - (groupid (pom-groupid pom-content java-inputs)) + (groupid (pom-groupid pom-content)) (mojos `(mojos ,@(with-directory-excursion directory diff --git a/guix/build/maven-build-system.scm b/guix/build/maven-build-system.scm index 534b4ebcee..0456bfdf61 100644 --- a/guix/build/maven-build-system.scm +++ b/guix/build/maven-build-system.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2020 Julien Lepiller +;;; Copyright © 2020, 2021 Julien Lepiller ;;; ;;; This file is part of GNU Guix. ;;; @@ -82,8 +82,8 @@ (let* ((pom (get-pom pom-file)) (java-inputs (map cdr inputs)) (artifact (pom-artifactid pom)) - (group (pom-groupid pom java-inputs local-packages)) - (version (pom-version pom java-inputs local-packages))) + (group (pom-groupid pom)) + (version (pom-version pom))) (let loop ((modules (pom-ref pom "modules")) (local-packages (add-local-package local-packages group artifact version))) diff --git a/guix/build/maven/pom.scm b/guix/build/maven/pom.scm index c92d409d2b..327d5f75e8 100644 --- a/guix/build/maven/pom.scm +++ b/guix/build/maven/pom.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2019, 2020 Julien Lepiller +;;; Copyright © 2019-2021 Julien Lepiller ;;; ;;; This file is part of GNU Guix. ;;; @@ -93,13 +93,12 @@ If no result is found, the result is @code{#f}." (get-pom (car java-inputs)))) #f))) -(define* (pom-groupid content inputs #:optional local-packages) +(define* (pom-groupid content) "Find the groupID of a pom file, potentially looking at its parent pom file. See @code{find-parent} for the meaning of the arguments." (if content (let ((res (or (pom-ref content "groupId") - (pom-groupid (find-parent content inputs local-packages) - inputs)))) + (pom-ref (pom-ref content "parent") "groupId")))) (cond ((string? res) res) ((null? res) #f) @@ -114,13 +113,12 @@ See @code{find-parent} for the meaning of the arguments." (car res) #f))) -(define* (pom-version content inputs #:optional local-packages) +(define* (pom-version content) "Find the version of a pom file, potentially looking at its parent pom file. See @code{find-parent} for the meaning of the arguments." (if content (let ((res (or (pom-ref content "version") - (pom-version (find-parent content inputs local-packages) - inputs)))) + (pom-ref (pom-ref content "parent") "version")))) (cond ((string? res) res) ((null? res) #f) @@ -344,7 +342,7 @@ Returns nothing, but overrides the @var{pom-file} as a side-effect." ((tag rest ...) (match tag (('http://maven.apache.org/POM/4.0.0:plugin plugin ...) - (let ((group (or (pom-groupid plugin inputs) "org.apache.maven.plugins")) + (let ((group (or (pom-groupid plugin) "org.apache.maven.plugins")) (artifact (pom-artifactid plugin))) (if (member artifact (or (assoc-ref excludes group) '())) (fix-plugins rest optional?) @@ -355,11 +353,11 @@ Returns nothing, but overrides the @var{pom-file} as a side-effect." (define* (fix-plugin plugin #:optional optional?) (let* ((artifact (pom-artifactid plugin)) - (group (or (pom-groupid plugin inputs) "org.apache.maven.plugins")) + (group (or (pom-groupid plugin) "org.apache.maven.plugins")) (version (or (assoc-ref (assoc-ref local-packages group) artifact) (find-version inputs group artifact optional?) - (pom-version plugin inputs)))) - (if (pom-version plugin inputs) + (pom-version plugin)))) + (if (pom-version plugin) (map (lambda (tag) (match tag @@ -373,7 +371,7 @@ Returns nothing, but overrides the @var{pom-file} as a side-effect." (define* (fix-dep dep #:optional optional?) (let* ((artifact (pom-artifactid dep)) - (group (or (pom-groupid dep inputs) (pom-groupid pom inputs))) + (group (or (pom-groupid dep) (pom-groupid pom))) (scope (pom-ref dep "scope")) (is-optional? (equal? (pom-ref dep "optional") '("true")))) (format (current-error-port) "maven: ~a:~a :: ~a (optional: ~a)~%" @@ -382,8 +380,8 @@ Returns nothing, but overrides the @var{pom-file} as a side-effect." with-build-dependencies?) (let ((version (or (assoc-ref (assoc-ref local-packages group) artifact) (find-version inputs group artifact optional?) - (pom-version dep inputs)))) - (if (pom-version dep inputs) + (pom-version dep)))) + (if (pom-version dep) (map (lambda (tag) (match tag -- 2.31.1