[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Invalid nar signature
From: |
Ludovic Courtès |
Subject: |
Re: Invalid nar signature |
Date: |
Mon, 15 Dec 2014 22:20:15 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
"Thompson, David" <address@hidden> skribis:
> On Mon, Dec 15, 2014 at 12:19 PM, Ludovic Courtès <address@hidden> wrote:
>> I think this is due to a subtly misleading file format variation.
>>
>> If you look at ‘export-paths’, it does:
>>
>> while there are files to write
>> write-long-long 1
>> export-path file
>> write-long-long 0
>>
>> ‘restore-file-set’ does the opposite, which is to read that long-long to
>> determine whether there’s data coming up, and then to call
>> ‘restore-file’.
>
> Thanks. I'm still a little confused, though. I'm not sure what
> change I need to make in order to satisfy the substituter. Do I need
> to write a variant of export-paths that leaves off the initial
> write-long-long call?
For illustration purposes, here’s a normal sequence:
--8<---------------cut here---------------start------------->8---
$ wget -O t.nar.bz2
http://hydra.gnu.org/nar/wy70n5zk8qinxjz0wdk9q2hh1zjfb32j-miscfiles-1.5
$ bunzip2 t.nar.bz2
$ ./pre-inst-env guile -c '(use-modules (guix serialization))
(call-with-input-file "t.nar" (lambda (port) (restore-file port "restored")))'
$ ls restored/
share
--8<---------------cut here---------------end--------------->8---
‘restore-file’ is what ‘guix substitute-binary --substitute’ uses. It
expects a single store item–i.e., the variant /without/ the leading
long-long, as you noticed.
To produce that, use ‘write-file’ from (guix serialization):
--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guile -c '(use-modules (guix serialization)) (write-file
"/gnu/store/wy70n5zk8qinxjz0wdk9q2hh1zjfb32j-miscfiles-1.5"
(current-output-port))' > t.nar
$ ./pre-inst-env guile -c '(use-modules (guix serialization))
(call-with-input-file "t.nar" (lambda (port) (restore-file port "restored")))'
$ ls restored/
share
--8<---------------cut here---------------end--------------->8---
Sorry for the confusion!
Ludo’.