From patchwork Tue Jun 18 14:02:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 65469 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 E4BE227BBEA; Tue, 18 Jun 2024 15:06:26 +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_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,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 29DC827BBE2 for ; Tue, 18 Jun 2024 15:06:26 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJZTP-00067Z-S9; Tue, 18 Jun 2024 10:06:11 -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 1sJZTM-00063S-2R for guix-patches@gnu.org; Tue, 18 Jun 2024 10:06:08 -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 1sJZTL-0003kv-4O; Tue, 18 Jun 2024 10:06:07 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sJZTG-0004Sw-89; Tue, 18 Jun 2024 10:06:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71631] [PATCH] swh: Specify 'extid_version' when looking up by external ID. Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Tue, 18 Jun 2024 14:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71631 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 71631@debbugs.gnu.org Cc: Simon Tournier , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by submit@debbugs.gnu.org id=B.171871953217123 (code B ref -1); Tue, 18 Jun 2024 14:06:02 +0000 Received: (at submit) by debbugs.gnu.org; 18 Jun 2024 14:05:32 +0000 Received: from localhost ([127.0.0.1]:43820 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sJZSm-0004S6-3U for submit@debbugs.gnu.org; Tue, 18 Jun 2024 10:05:32 -0400 Received: from lists.gnu.org ([209.51.188.17]:39326) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sJZSj-0004Ry-UR for submit@debbugs.gnu.org; Tue, 18 Jun 2024 10:05: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 1sJZQX-0004vN-Ge for guix-patches@gnu.org; Tue, 18 Jun 2024 10:03:15 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sJZQV-0003CG-LK for guix-patches@gnu.org; Tue, 18 Jun 2024 10:03:13 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-362468852c8so60346f8f.1 for ; Tue, 18 Jun 2024 07:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718719390; x=1719324190; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=W+DMLqCNt5yw0nTz1obirjiRi/MFHAxcX4IeANpodIk=; b=gL6v+ZwTMg/f8j1wy00+wIAbeaL/NDJ6vUDy/0bQVFz3/JBwF19flk+X+D8GLzwzuU ng0VrGGCQSVHl358cF2b9i9M+dILXz1eO0TSWgtvd0ZC02nT4K8tyavTqzYVU403KzEE wRCXvfZrZJNOhXsCMC+d/6xnCt0B6lMjwt/HWHHMcV4asVfLq7Axbpq6SQoQ3FILnl5z //iTdAlsHYl06VISjZgPqyeLBuJl5vdTZ9Ly62qaw9DbkmP8Z9OYv2t2cf9mLwYfkBzm 43XfrSdKxJEVyDX8DDKSQymN74cYVDya9e0RHqUo9Z98zb/huR9UeiDAIgqu92q5UeIL gsWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718719390; x=1719324190; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=W+DMLqCNt5yw0nTz1obirjiRi/MFHAxcX4IeANpodIk=; b=e/BJcKEpiwT09lnYuzvTelAG8bSimoh3BYFVf9rofqCiOaV5M9FrXNU1coMRKjOjly 1KhJBSCHT2SLTrG3NlgI6bNLEZaKaJplJuIOMINsL72ZLox0rChgKFWCOZ3WmhZCKZ6v NmhEQxYOU3AZSi5xqMrzCppiPv07gAFwGJGmlEBZdrYTtGloOHMxZA/9WK96DIOxIbit NCuMWXAsDYS4c1UWtqAJKPz/HXjF4ifLGLtDqXEqrP9YaVQWJcQsrp6tW0BS9mfxAqaj sAl1IBsLGCCjSlbOvw34hSEy8j3wGbYFsedKWjQaMpr/zlcVxOUobh+QWOYw5+hDlYFT jZmQ== X-Gm-Message-State: AOJu0Yx/uETlgVi+qGyzDrqbpm/zHK/VEhr4O2rkFL6GZGisfbLtQ+AF peEB3M8pM1T2BbTGXSDWv/tzfYyXWHtkXqKdyZOUkEwcvNLShliNYUSZhg== X-Google-Smtp-Source: AGHT+IGsM8CBNwoWdEF1pTHMwLqcH/rrP6WKGVGXcpwufIIMdarJJGwIYMMgjm1JuOaRk9oDUiOmJQ== X-Received: by 2002:a5d:6c69:0:b0:35f:1f7e:892e with SMTP id ffacd0b85a97d-3607a78685amr9385322f8f.7.1718719389427; Tue, 18 Jun 2024 07:03:09 -0700 (PDT) Received: from lili.rennes.inria.fr ([131.254.253.81]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-360750ad2cdsm14224571f8f.61.2024.06.18.07.03.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 07:03:09 -0700 (PDT) From: Simon Tournier Date: Tue, 18 Jun 2024 16:02:51 +0200 Message-ID: <84f97438f7a1e7d88af4ffb01140b09dc7675312.1718718438.git.zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=zimon.toutoune@gmail.com; helo=mail-wr1-x431.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, 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: , 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 Reported in . * guix/swh.scm (swh-url): Don't redirect when URL contains 'extid_version'. (lookup-external-id): Specify 'extid_version' avoiding SWH's bug from past version. Change-Id: Iea2a5256e0612dae95567907bb11edb92a50df73 --- guix/swh.scm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) Hi, Without the patch: $ guix repl scheme@(guix-user)> (use-modules (guix swh) (gnu packages guile-xyz)) scheme@(guix-user)> (lookup-directory-by-nar-hash (content-hash-value (origin-hash (package-source guile-wisp))) 'sha256) $1 = "swh:1:dir:218d95849f10fc0691d7dfa80999ce5061e654ef" This is incorrect. As explained in: https://gitlab.softwareheritage.org/swh/meta/-/issues/5093 The mismatch comes from something unexpected on SWH side. That had been corrected and the way to access to the fix is to update the version; hence the patch. $ ./pre-inst-env guix repl scheme@(guix-user)> (use-modules (guix swh) (gnu packages guile-xyz)) scheme@(guix-user)> (lookup-directory-by-nar-hash (content-hash-value (origin-hash (package-source guile-wisp))) 'sha256) $1 = "swh:1:dir:1f35a460673e2c8ccf948b8c18cb8c18d2ec24fe" WDYT? Cheers, simon base-commit: bc8a41f4a8d9f1f0525d7bc97c67ed3c8aea3111 diff --git a/guix/swh.scm b/guix/swh.scm index f602cd89d1..e5824976d4 100644 --- a/guix/swh.scm +++ b/guix/swh.scm @@ -166,9 +166,15 @@ (define (swh-url path . rest) (string-append root (string-join rest "/" 'prefix))) ;; Ensure there's a trailing slash or we get a redirect. - (if (string-suffix? "/" url) - url - (string-append url "/"))) + (cond + ((string-suffix? "/" url) + url) + ;; Special case; don't redirect + ;; + ((string-contains url "extid_version") + url) + (else + (string-append url "/")))) ;; XXX: Work around a bug in Guile 3.0.2 where #:verify-certificate? would ;; be ignored (). @@ -461,7 +467,9 @@ (define (lookup-external-id type id) (currently one of: \"bzr-nodeid\", \"hg-nodeid\", \"nar-sha256\", \"checksum-sha512\")." (call (swh-url "/api/1/extid" type - (string-append "hex:" (bytevector->base16-string id))) + (string-append "hex:" (bytevector->base16-string id) + "/?extid_version=1" + )) json->external-id)) (define* (lookup-directory-by-nar-hash hash #:optional (algorithm 'sha256))