* [bug#71631] [PATCH] swh: Specify 'extid_version' when looking up by external ID.
@ 2024-06-18 14:02 Simon Tournier
2024-06-18 15:07 ` Simon Tournier
2024-06-26 22:02 ` bug#71631: " Ludovic Courtès
0 siblings, 2 replies; 4+ messages in thread
From: Simon Tournier @ 2024-06-18 14:02 UTC (permalink / raw)
To: 71631
Cc: Simon Tournier, Christopher Baines, Josselin Poiret,
Ludovic Courtès, Mathieu Othacehe, Ricardo Wurmus,
Simon Tournier, Tobias Geerinckx-Rice
Reported in <https://gitlab.softwareheritage.org/swh/meta/-/issues/5093>.
* 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
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
+ ;; <https://gitlab.softwareheritage.org/swh/meta/-/issues/5093>
+ ((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 (<https://bugs.gnu.org/40486>).
@@ -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))
base-commit: bc8a41f4a8d9f1f0525d7bc97c67ed3c8aea3111
--
2.41.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [bug#71631] [PATCH] swh: Specify 'extid_version' when looking up by external ID.
2024-06-18 14:02 [bug#71631] [PATCH] swh: Specify 'extid_version' when looking up by external ID Simon Tournier
@ 2024-06-18 15:07 ` Simon Tournier
2024-06-26 22:02 ` bug#71631: " Ludovic Courtès
1 sibling, 0 replies; 4+ messages in thread
From: Simon Tournier @ 2024-06-18 15:07 UTC (permalink / raw)
To: 71631
Cc: Josselin Poiret, Mathieu Othacehe, Ludovic Courtès,
Tobias Geerinckx-Rice, Ricardo Wurmus, Christopher Baines
Re,
> - (if (string-suffix? "/" url)
> - url
> - (string-append url "/")))
> + (cond
> + ((string-suffix? "/" url)
> + url)
> + ;; Special case; don't redirect
> + ;; <https://gitlab.softwareheritage.org/swh/meta/-/issues/5093>
> + ((string-contains url "extid_version")
> + url)
> + (else
> + (string-append url "/"))))
For the interested reader, here the message from SWH:
https://sentry.softwareheritage.org/share/issue/840686e1329b484081ac2b07d27cd4aa/
In short, the redirection is not possible here.
Cheers,
simon
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#71631: [PATCH] swh: Specify 'extid_version' when looking up by external ID.
2024-06-18 14:02 [bug#71631] [PATCH] swh: Specify 'extid_version' when looking up by external ID Simon Tournier
2024-06-18 15:07 ` Simon Tournier
@ 2024-06-26 22:02 ` Ludovic Courtès
2024-07-10 18:53 ` [bug#71631] " Simon Tournier
1 sibling, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2024-06-26 22:02 UTC (permalink / raw)
To: Simon Tournier
Cc: Josselin Poiret, Tobias Geerinckx-Rice, Mathieu Othacehe,
71631-done, Ricardo Wurmus, Christopher Baines
Hi,
Simon Tournier <zimon.toutoune@gmail.com> skribis:
> Reported in <https://gitlab.softwareheritage.org/swh/meta/-/issues/5093>.
>
> * 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"
Woow.
I pushed it as bd908af0c619cb1b74afeeb07839d7af08de9d91 with a small
modification: ‘swh-url’ checks for parameters (the “?param=value” bit)
rather than “extid_version” specifically. I also moved the link to the
issue to ‘lookup-external-id’.
Thank you!
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [bug#71631] [PATCH] swh: Specify 'extid_version' when looking up by external ID.
2024-06-26 22:02 ` bug#71631: " Ludovic Courtès
@ 2024-07-10 18:53 ` Simon Tournier
0 siblings, 0 replies; 4+ messages in thread
From: Simon Tournier @ 2024-07-10 18:53 UTC (permalink / raw)
To: Ludovic Courtès
Cc: Josselin Poiret, 71631-done, Mathieu Othacehe,
Tobias Geerinckx-Rice, Ricardo Wurmus, Christopher Baines
Hi Ludo,
On Thu, 27 Jun 2024 at 00:02, Ludovic Courtès <ludo@gnu.org> wrote:
> I pushed it as bd908af0c619cb1b74afeeb07839d7af08de9d91 with a small
> modification: ‘swh-url’ checks for parameters (the “?param=value” bit)
> rather than “extid_version” specifically. I also moved the link to the
> issue to ‘lookup-external-id’.
Thanks. Indeed your patch is better. :-)
Cheers,
simon
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-07-11 10:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-18 14:02 [bug#71631] [PATCH] swh: Specify 'extid_version' when looking up by external ID Simon Tournier
2024-06-18 15:07 ` Simon Tournier
2024-06-26 22:02 ` bug#71631: " Ludovic Courtès
2024-07-10 18:53 ` [bug#71631] " Simon Tournier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.