From patchwork Wed Jun 5 05:52:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Goaziou X-Patchwork-Id: 65176 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 9140D27BBE9; Wed, 5 Jun 2024 06:53:14 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 0284127BBE2 for ; Wed, 5 Jun 2024 06:53:13 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sEjZx-0003mq-Va; Wed, 05 Jun 2024 01:52:57 -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 1sEjZv-0003m9-Vc for guix-patches@gnu.org; Wed, 05 Jun 2024 01:52:55 -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 1sEjZv-0004oh-Mt; Wed, 05 Jun 2024 01:52:55 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sEja2-0002B3-Gs; Wed, 05 Jun 2024 01:53:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71371] [PATCH] gnu: svn-fetch: Make revision field optional. Resent-From: Nicolas Goaziou Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, pelzflorian@pelzflorian.de, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, matt@excalamus.com, maxim.cournoyer@gmail.com, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Wed, 05 Jun 2024 05:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71371 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 71371@debbugs.gnu.org Cc: Nicolas Goaziou , Christopher Baines , Florian Pelz , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Matthew Trzcinski , Maxim Cournoyer , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Christopher Baines , Florian Pelz , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Matthew Trzcinski , Maxim Cournoyer , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by submit@debbugs.gnu.org id=B.17175667718334 (code B ref -1); Wed, 05 Jun 2024 05:53:02 +0000 Received: (at submit) by debbugs.gnu.org; 5 Jun 2024 05:52:51 +0000 Received: from localhost ([127.0.0.1]:58573 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sEjZr-0002AL-AL for submit@debbugs.gnu.org; Wed, 05 Jun 2024 01:52:51 -0400 Received: from lists.gnu.org ([209.51.188.17]:40046) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sEjZn-0002A5-TS for submit@debbugs.gnu.org; Wed, 05 Jun 2024 01:52:49 -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 1sEjZZ-0003ii-LY for guix-patches@gnu.org; Wed, 05 Jun 2024 01:52:33 -0400 Received: from msg-1.mailo.com ([213.182.54.11] helo=mailo.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sEjZX-0004b8-Dv for guix-patches@gnu.org; Wed, 05 Jun 2024 01:52:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=nicolasgoaziou.fr; s=mailo; t=1717566747; bh=KuoJxxBqX1Xvce3JemmKqmMt9FKSVPUDJL5mDew5fSY=; h=X-EA-Auth:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding; b=sYgmN2HBDProExN5HDvK7fg1KOK2pm0A3w634iBoBqgSEziit1+AQ5udAEStRIR+w YuZ6dswcW6XDo0QAQSPaudjHtRM9eKNiaNSHgXnCJmFCGzM7Fh4rSvk+F9zyymI41U UIk2flfhJSKNCJhSS56R0xCMKg5gixqOsHFjnjzU= Received: by b221-1.in.mailobj.net [192.168.90.21] with ESMTP via ip-20.mailobj.net [213.182.54.20] Wed, 5 Jun 2024 07:52:26 +0200 (CEST) X-EA-Auth: 8wT/0CcWeRMyblq3WYYowBh2gcPb+BpY5TAAI6ij2XS5hxYMFp66wFOpDOuywya/8d5ZvS45XtsoPeQ0gbOayZCMgvxydgl2ZEtNrmLT6Go= Date: Wed, 5 Jun 2024 07:52:02 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=213.182.54.11; envelope-from=mail@nicolasgoaziou.fr; helo=mailo.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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Reply-to: Nicolas Goaziou X-ACL-Warn: , Nicolas Goaziou via Guix-patches X-Patchwork-Original-From: Nicolas Goaziou via Guix-patches via From: Nicolas Goaziou Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/svn-download.scm (): Set default value for REVISION field to #F. (svn-fetch): (svn-multi-fetch): Take into consideration the revision can be a number or #F. * guix/build/svn.scm (svn-fetch): Skip "-r" argument when revision is #F. * doc/guix.texi (origin Reference): Document changes about REVISION field. Change-Id: Idb0eeb7ca4121db3caf789a9658ac79b321439d4 --- doc/guix.texi | 5 +++-- guix/build/svn.scm | 6 ++++-- guix/svn-download.scm | 16 ++++++++++------ 3 files changed, 17 insertions(+), 10 deletions(-) base-commit: bf202e8bdd10dbd01da391ef635d1a31197251c1 diff --git a/doc/guix.texi b/doc/guix.texi index 9b60e6c603..5e1173b8c6 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -8263,8 +8263,9 @@ origin Reference @item @code{url} The URL of the Subversion repository to clone. -@item @code{revision} -This string denotes revision to fetch specified as a number. +@item @code{revision} (default: @code{#f}) +This field denotes the revision to fetch, as a number. It can also be +set to @code{#f}, for example when @var{url} contains a tag reference. @item @code{recursive?} (default: @code{#f}) This Boolean indicates whether to recursively fetch Subversion diff --git a/guix/build/svn.scm b/guix/build/svn.scm index 875d3c50ca..3ae6519628 100644 --- a/guix/build/svn.scm +++ b/guix/build/svn.scm @@ -46,8 +46,7 @@ (define* (svn-fetch url revision directory ;; Trust the server certificate. This is OK as we ;; verify the checksum later. This can be removed when ;; ca-certificates package is added. - "--trust-server-cert" "-r" (number->string revision) - + "--trust-server-cert" ;; Disable keyword substitutions (keywords are CVS-like strings ;; like "$Date$", "$Id$", and so on) for two reasons: (1) some ;; expansions depend on the local time zone, and (2) SWH disables @@ -61,6 +60,9 @@ (define* (svn-fetch url revision directory ,@(if recursive? '() (list "--ignore-externals")) + ,@(if revision + (list "-r" (number->string revision)) + '()) ,url ,directory)) #t)) diff --git a/guix/svn-download.scm b/guix/svn-download.scm index bdd9c39eb5..dc9856cfb1 100644 --- a/guix/svn-download.scm +++ b/guix/svn-download.scm @@ -63,7 +63,7 @@ (define-record-type* svn-reference make-svn-reference svn-reference? (url svn-reference-url) ; string - (revision svn-reference-revision) ; number + (revision svn-reference-revision (default #f)) ; number or #f (recursive? svn-reference-recursive? (default #f)) (user-name svn-reference-user-name (default #f)) (password svn-reference-password (default #f))) @@ -120,7 +120,9 @@ (define* (svn-fetch ref hash-algo hash (or (and (download-method-enabled? 'upstream) (svn-fetch (getenv "svn url") - (string->number (getenv "svn revision")) + (match (getenv "svn revision") + ("#f" #f) + (s (string->number s))) #$output #:svn-command #+(file-append svn "/bin/svn") #:recursive? (match (getenv "svn recursive?") @@ -145,7 +147,7 @@ (define* (svn-fetch ref hash-algo hash #:env-vars `(("svn url" . ,(svn-reference-url ref)) ("svn revision" - . ,(number->string (svn-reference-revision ref))) + . ,(object->string (svn-reference-revision ref))) ,@(if (svn-reference-recursive? ref) `(("svn recursive?" . "yes")) '()) @@ -173,7 +175,7 @@ (define-record-type* svn-multi-reference make-svn-multi-reference svn-multi-reference? (url svn-multi-reference-url) ; string - (revision svn-multi-reference-revision) ; number + (revision svn-multi-reference-revision) ; number or #f (locations svn-multi-reference-locations) ; list of strings (recursive? svn-multi-reference-recursive? (default #f)) (user-name svn-multi-reference-user-name (default #f)) @@ -233,7 +235,9 @@ (define* (svn-multi-fetch ref hash-algo hash (mkdir-p (string-append #$output "/" (dirname location)))) (and (download-method-enabled? 'upstream) (svn-fetch (string-append (getenv "svn url") "/" location) - (string->number (getenv "svn revision")) + (match (getenv "svn revision") + ("#f" #f) + (s (string-to-number s))) (if (string-suffix? "/" location) (string-append #$output "/" location) (string-append #$output "/" (dirname location))) @@ -271,7 +275,7 @@ (define* (svn-multi-fetch ref hash-algo hash ("svn locations" . ,(object->string (svn-multi-reference-locations ref))) ("svn revision" - . ,(number->string (svn-multi-reference-revision ref))) + . ,(object->string (svn-multi-reference-revision ref))) ,@(if (svn-multi-reference-recursive? ref) `(("svn recursive?" . "yes")) '())