From patchwork Mon May 31 22:44:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Lepiller X-Patchwork-Id: 29716 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9C4EA27BC83; Mon, 31 May 2021 23:45:51 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 494AD27BC78 for ; Mon, 31 May 2021 23:45:51 +0100 (BST) Received: from localhost ([::1]:51498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnqfO-000734-C9 for patchwork@mira.cbaines.net; Mon, 31 May 2021 18:45:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnqee-0006DZ-Fy for guix-patches@gnu.org; Mon, 31 May 2021 18:45:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51873) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lnqee-0007U7-8A for guix-patches@gnu.org; Mon, 31 May 2021 18:45:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lnqee-00040s-5k for guix-patches@gnu.org; Mon, 31 May 2021 18:45:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48766] [PATCH 05/14] guix: maven: Support fixing modules. Resent-From: Julien Lepiller Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 31 May 2021 22:45:04 +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.162250108815337 (code B ref 48766); Mon, 31 May 2021 22:45:04 +0000 Received: (at 48766) by debbugs.gnu.org; 31 May 2021 22:44:48 +0000 Received: from localhost ([127.0.0.1]:35172 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnqeO-0003zD-8J for submit@debbugs.gnu.org; Mon, 31 May 2021 18:44:48 -0400 Received: from lepiller.eu ([89.234.186.109]:38956) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnqeI-0003xU-7g for 48766@debbugs.gnu.org; Mon, 31 May 2021 18:44:42 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id 8a3cc6ef for <48766@debbugs.gnu.org>; Mon, 31 May 2021 22:44:38 +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-transfer-encoding; s=dkim; bh=Apj/7mxqi0l88qNpqPTNLXM75 2wPyC5+tF3uIPw6J1c=; b=Ye6TCoTcS07Oecqj4KlU1Un79M4HlgStNuQ+hVa+9 e9W5Z1Lt0eFoToc/qrErOlCGnWuf49oWbUxRqsLEfCpGj1SAUl/HSHCTkMTP1Ndv ZasqnX/yI1d5seTKj2x+uCcEQjHDywkH/wuXgr7hFxPCQxbsrHml/IqZ8KnfLdLg mA6SiCSGr3LFf3zeygSzJiEGsnD4aR4GiSqhmGka+3Jx5DE/JjY32xmA2zu2kIGt ArJ0XVr9N0QSjmI20pDw0c38mI7NAj84PuhgjYhZ2SoRkT+Rhw1s2H84A+83+JH8 Pcywt1c70tfuLibtSANeDVWZycozqAd5q8/mDpTfNteBA== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id ea965aa7 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for <48766@debbugs.gnu.org>; Mon, 31 May 2021 22:44:38 +0000 (UTC) From: Julien Lepiller Date: Tue, 1 Jun 2021 00:44:18 +0200 Message-Id: <20210531224427.13300-5-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 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/build/maven/pom.scm (fix-pom-dependencies): Support fixing modules that do not exist. * guix/build/maven-build-system.scm (fix-pom): Fix modules. --- guix/build/maven-build-system.scm | 1 + guix/build/maven/pom.scm | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/guix/build/maven-build-system.scm b/guix/build/maven-build-system.scm index 374fa2fdb8..b3d97c81ea 100644 --- a/guix/build/maven-build-system.scm +++ b/guix/build/maven-build-system.scm @@ -65,6 +65,7 @@ (format #t "fixing ~a~%" pom-file) (fix-pom-dependencies pom-file (map cdr inputs) #:with-plugins? #t #:with-build-dependencies? #t + #:with-modules? #t #:local-packages local-packages #:excludes excludes)) diff --git a/guix/build/maven/pom.scm b/guix/build/maven/pom.scm index 3a4ad7a216..ffb4515179 100644 --- a/guix/build/maven/pom.scm +++ b/guix/build/maven/pom.scm @@ -291,7 +291,8 @@ this repository contains." (define* (fix-pom-dependencies pom-file inputs #:key with-plugins? with-build-dependencies? - (excludes '()) (local-packages '())) + with-modules? (excludes '()) + (local-packages '())) "Open @var{pom-file}, and override its content, rewritting its dependencies to set their version to the latest version available in the @var{inputs}. @@ -339,8 +340,24 @@ Returns nothing, but overrides the @var{pom-file} as a side-effect." `((http://maven.apache.org/POM/4.0.0:build ,(fix-build build)) ,@(fix-pom rest)) (cons tag (fix-pom rest)))) + (('http://maven.apache.org/POM/4.0.0:modules modules ...) + (if with-modules? + `((http://maven.apache.org/POM/4.0.0:modules ,(fix-modules modules)) + ,@(fix-pom rest)) + (cons tag (fix-pom rest)))) (tag (cons tag (fix-pom rest))))))) + (define fix-modules + (match-lambda + ('() '()) + ((tag rest ...) + (match tag + (('http://maven.apache.org/POM/4.0.0:module module) + (if (file-exists? (string-append (dirname pom-file) "/" module "/pom.xml")) + `((http://maven.apache.org/POM/4.0.0:module ,module) ,@(fix-modules rest)) + (fix-modules rest))) + (tag (cons tag (fix-modules rest))))))) + (define fix-dep-management (match-lambda ('() '())