unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#51441] [PATCH] substitutes: keep base's uri-path for Properly construct URL.
@ 2021-10-27 13:53 Z572 via Guix-patches via
       [not found] ` <87fssmwhcc.fsf@qq.com>
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Z572 via Guix-patches via @ 2021-10-27 13:53 UTC (permalink / raw)
  To: 51441

[-- Attachment #1: Type: text/plain, Size: 286 bytes --]


Hello,

Sorry for my english, and i'm not sure ChangeLog is right.

https://mirror.sjtu.edu.cn/guix use customize script to mirror official
substitutes server, at /guix not in /  . narinfo-request will forget add /guix to url, so i
can't use substitutes from them, this patch fix it.


[-- Attachment #2: 0001-substitutes-keep-base-s-uri-path-for-Properly-constr.patch --]
[-- Type: text/x-patch, Size: 1639 bytes --]

From 7fe17965d5336d55ec8b1b7471cbbb34b12e9a0b Mon Sep 17 00:00:00 2001
From: Z572 <873216071@qq.com>
Date: Wed, 27 Oct 2021 21:28:24 +0800
Subject: [PATCH] substitutes: keep base's uri-path for Properly construct URL.

substitutes (narinfo-request): keep BASE's uri-path for properly construct url.

some substitutes server don't use guix publish, them use customize scripts to
mirror official server, if them look likes https://example.com/guix ,
narinfo-request will lost /guix .
---
 guix/substitutes.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/guix/substitutes.scm b/guix/substitutes.scm
index a5c554acff..bfbd29623e 100644
--- a/guix/substitutes.scm
+++ b/guix/substitutes.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2014 Nikita Karetnikov <nikita@karetnikov.org>
 ;;; Copyright © 2018 Kyle Meyer <kyle@kyleam.com>
 ;;; Copyright © 2020 Christopher Baines <mail@cbaines.net>
+;;; Copyright © 2021 Zheng Junjie <873216071@qq.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -158,7 +159,8 @@ (define (narinfo-request cache-url path)
   "Return an HTTP request for the narinfo of PATH at CACHE-URL."
   (let* ((base (string->uri cache-url))
          (ref (build-relative-ref
-               #:path (string-append (store-path-hash-part path) ".narinfo")))
+               #:path (string-append (uri-path base) "/"
+                                     (store-path-hash-part path) ".narinfo")))
          (url (resolve-uri-reference ref base))
          (headers '((User-Agent . "GNU Guile"))))
     (build-request url #:method 'GET #:headers headers)))
-- 
2.33.1


[-- Attachment #3: Type: text/plain, Size: 10 bytes --]


-- 
over

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#51441] [PATCH] substitutes: keep base's uri-path for Properly construct URL.
       [not found] ` <87fssmwhcc.fsf@qq.com>
@ 2021-10-27 16:37   ` Z572 via Guix-patches via
  2021-10-29  1:48   ` Z572 via Guix-patches via
  1 sibling, 0 replies; 7+ messages in thread
From: Z572 via Guix-patches via @ 2021-10-27 16:37 UTC (permalink / raw)
  To: 51441


it just fix fetch narinfos url, substitute still don't download, later i
will try fix it.

Z572 via Guix-patches via <guix-patches@gnu.org> writes:

> Hello,
>
> Sorry for my english, and i'm not sure ChangeLog is right.
>
> https://mirror.sjtu.edu.cn/guix use customize script to mirror official
> substitutes server, at /guix not in /  . narinfo-request will forget add /guix to url, so i
> can't use substitutes from them, this patch fix it.
>
> From 7fe17965d5336d55ec8b1b7471cbbb34b12e9a0b Mon Sep 17 00:00:00 2001
> From: Z572 <873216071@qq.com>
> Date: Wed, 27 Oct 2021 21:28:24 +0800
> Subject: [PATCH] substitutes: keep base's uri-path for Properly construct URL.
>
> substitutes (narinfo-request): keep BASE's uri-path for properly construct url.
>
> some substitutes server don't use guix publish, them use customize scripts to
> mirror official server, if them look likes https://example.com/guix ,
> narinfo-request will lost /guix .
> ---
>  guix/substitutes.scm | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/guix/substitutes.scm b/guix/substitutes.scm
> index a5c554acff..bfbd29623e 100644
> --- a/guix/substitutes.scm
> +++ b/guix/substitutes.scm
> @@ -3,6 +3,7 @@
>  ;;; Copyright © 2014 Nikita Karetnikov <nikita@karetnikov.org>
>  ;;; Copyright © 2018 Kyle Meyer <kyle@kyleam.com>
>  ;;; Copyright © 2020 Christopher Baines <mail@cbaines.net>
> +;;; Copyright © 2021 Zheng Junjie <873216071@qq.com>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -158,7 +159,8 @@ (define (narinfo-request cache-url path)
>    "Return an HTTP request for the narinfo of PATH at CACHE-URL."
>    (let* ((base (string->uri cache-url))
>           (ref (build-relative-ref
> -               #:path (string-append (store-path-hash-part path) ".narinfo")))
> +               #:path (string-append (uri-path base) "/"
> +                                     (store-path-hash-part path) ".narinfo")))
>           (url (resolve-uri-reference ref base))
>           (headers '((User-Agent . "GNU Guile"))))
>      (build-request url #:method 'GET #:headers headers)))
> -- 
> 2.33.1


-- 
over




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#51441] [PATCH] substitutes: keep base's uri-path for Properly construct URL.
       [not found] ` <87fssmwhcc.fsf@qq.com>
  2021-10-27 16:37   ` Z572 via Guix-patches via
@ 2021-10-29  1:48   ` Z572 via Guix-patches via
  1 sibling, 0 replies; 7+ messages in thread
From: Z572 via Guix-patches via @ 2021-10-29  1:48 UTC (permalink / raw)
  To: Z572; +Cc: 51441


Z572 via Guix-patches via <guix-patches@gnu.org> writes:

> it just fix fetch narinfos url, substitute still don't download, later i
> will try fix it.
>

Because guix-daemon is old , it fork a old `guix substitute`, use old
(guix substitutes) module. so just need update guix-daemon:

1. guix system reconfigure path/to/config
2. herd restart guix-daemon

substitute will download.

It Works On My Machine :)

-- 
over




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#51441] [PATCH] substitutes: keep base's uri-path for Properly construct URL.
  2021-10-27 13:53 [bug#51441] [PATCH] substitutes: keep base's uri-path for Properly construct URL Z572 via Guix-patches via
       [not found] ` <87fssmwhcc.fsf@qq.com>
@ 2021-10-29  4:18 ` Peng Mei Yu
       [not found]   ` <87a6is4ff8.fsf@qq.com>
  2021-12-11 23:34   ` bug#51441: " Ludovic Courtès
  2021-11-10 11:30 ` [bug#51441] " Zhu Zihao
  2 siblings, 2 replies; 7+ messages in thread
From: Peng Mei Yu @ 2021-10-29  4:18 UTC (permalink / raw)
  To: Z572; +Cc: 51441

Hi,

Z572 via Guix-patches via writes:

> @@ -158,7 +159,8 @@ (define (narinfo-request cache-url path)
>    "Return an HTTP request for the narinfo of PATH at CACHE-URL."
>    (let* ((base (string->uri cache-url))
>           (ref (build-relative-ref
> -               #:path (string-append (store-path-hash-part path) ".narinfo")))
> +               #:path (string-append (uri-path base) "/"
> +                                     (store-path-hash-part path) ".narinfo")))
>           (url (resolve-uri-reference ref base))
>           (headers '((User-Agent . "GNU Guile"))))
>      (build-request url #:method 'GET #:headers headers)))
> --

It seems that the root cause for the problem is that cache-url lacks a
trailing slash.  Therefore the last path component is stripped from
`base` when we compute (resolve-uri-reference ref base).  So I think
ensuring cache-url ends with a slash ("/") is a better approach.


--
Peng Mei Yu




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#51441] [PATCH] substitutes: keep base's uri-path for Properly construct URL.
       [not found]   ` <87a6is4ff8.fsf@qq.com>
@ 2021-10-29  4:33     ` Z572 via Guix-patches via
  0 siblings, 0 replies; 7+ messages in thread
From: Z572 via Guix-patches via @ 2021-10-29  4:33 UTC (permalink / raw)
  To: Peng Mei Yu; +Cc: 51441


Peng Mei Yu <pengmeiyu@riseup.net> writes:

> Hi,
>
> Z572 via Guix-patches via writes:
>
>> @@ -158,7 +159,8 @@ (define (narinfo-request cache-url path)
>>    "Return an HTTP request for the narinfo of PATH at CACHE-URL."
>>    (let* ((base (string->uri cache-url))
>>           (ref (build-relative-ref
>> -               #:path (string-append (store-path-hash-part path) ".narinfo")))
>> +               #:path (string-append (uri-path base) "/"
>> +                                     (store-path-hash-part path) ".narinfo")))
>>           (url (resolve-uri-reference ref base))
>>           (headers '((User-Agent . "GNU Guile"))))
>>      (build-request url #:method 'GET #:headers headers)))
>> --
>
> It seems that the root cause for the problem is that cache-url lacks a
> trailing slash.  Therefore the last path component is stripped from
> `base` when we compute (resolve-uri-reference ref base).  So I think
> ensuring cache-url ends with a slash ("/") is a better approach.

Yes, you are right.

-- 
over




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#51441] [PATCH] substitutes: keep base's uri-path for Properly construct URL.
  2021-10-27 13:53 [bug#51441] [PATCH] substitutes: keep base's uri-path for Properly construct URL Z572 via Guix-patches via
       [not found] ` <87fssmwhcc.fsf@qq.com>
  2021-10-29  4:18 ` Peng Mei Yu
@ 2021-11-10 11:30 ` Zhu Zihao
  2 siblings, 0 replies; 7+ messages in thread
From: Zhu Zihao @ 2021-11-10 11:30 UTC (permalink / raw)
  To: 51441; +Cc: Ludovic Courtès

[-- Attachment #1: Type: text/plain, Size: 154 bytes --]

Can someone help review this patch? Thx a lot!.
-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#51441: [PATCH] substitutes: keep base's uri-path for Properly construct URL.
  2021-10-29  4:18 ` Peng Mei Yu
       [not found]   ` <87a6is4ff8.fsf@qq.com>
@ 2021-12-11 23:34   ` Ludovic Courtès
  1 sibling, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2021-12-11 23:34 UTC (permalink / raw)
  To: Peng Mei Yu; +Cc: Z572, 51441-done

Hi,

Peng Mei Yu <pengmeiyu@riseup.net> skribis:

> Z572 via Guix-patches via writes:
>
>> @@ -158,7 +159,8 @@ (define (narinfo-request cache-url path)
>>    "Return an HTTP request for the narinfo of PATH at CACHE-URL."
>>    (let* ((base (string->uri cache-url))
>>           (ref (build-relative-ref
>> -               #:path (string-append (store-path-hash-part path) ".narinfo")))
>> +               #:path (string-append (uri-path base) "/"
>> +                                     (store-path-hash-part path) ".narinfo")))
>>           (url (resolve-uri-reference ref base))
>>           (headers '((User-Agent . "GNU Guile"))))
>>      (build-request url #:method 'GET #:headers headers)))
>> --
>
> It seems that the root cause for the problem is that cache-url lacks a
> trailing slash.  Therefore the last path component is stripped from
> `base` when we compute (resolve-uri-reference ref base).  So I think
> ensuring cache-url ends with a slash ("/") is a better approach.

Indeed.  I’ve implemented your suggestion in
e68466de122d94ac3fa75aae234cd5fd89482a5a, and commit
cba0395c99005f94e4ccd6c058362af7443dab12 makes a related adjustment.

Note that we still need to update the ‘guix’ package so you can benefit
from the bug fix.  In the meantime you have to pass that trailing slash.

Thank you, and sorry for the delay!

Ludo’.




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-12-11 23:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-27 13:53 [bug#51441] [PATCH] substitutes: keep base's uri-path for Properly construct URL Z572 via Guix-patches via
     [not found] ` <87fssmwhcc.fsf@qq.com>
2021-10-27 16:37   ` Z572 via Guix-patches via
2021-10-29  1:48   ` Z572 via Guix-patches via
2021-10-29  4:18 ` Peng Mei Yu
     [not found]   ` <87a6is4ff8.fsf@qq.com>
2021-10-29  4:33     ` Z572 via Guix-patches via
2021-12-11 23:34   ` bug#51441: " Ludovic Courtès
2021-11-10 11:30 ` [bug#51441] " Zhu Zihao

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).