gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet-scheme] 65/324: download-store: prepare supporting the nar outpu


From: gnunet
Subject: [gnunet-scheme] 65/324: download-store: prepare supporting the nar output format
Date: Tue, 21 Sep 2021 13:21:45 +0200

This is an automated email from the git hooks/post-receive script.

maxime-devos pushed a commit to branch master
in repository gnunet-scheme.

commit c159391c0ad275349421b1fe4f02694552e5486a
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Sat Jan 30 18:28:32 2021 +0100

    download-store: prepare supporting the nar output format
    
    * gnu/gnunet/scripts/download-store.scm
      (%options-specification, %help): new '--nar' option.
      (main, inner-main): move 'call-with-options' call to inner-main
      and allow nar as output format.
      (download:gnunet-nar/0-to-nar): new stub procedure.
      (download-nar, download:gnunet-nar/0-to-fs): rename
      former to latter and add a docstring.
---
 gnu/gnunet/scripts/download-store.scm | 49 ++++++++++++++++++++++-------------
 1 file changed, 31 insertions(+), 18 deletions(-)

diff --git a/gnu/gnunet/scripts/download-store.scm 
b/gnu/gnunet/scripts/download-store.scm
index 4f14242..d3c9e15 100644
--- a/gnu/gnunet/scripts/download-store.scm
+++ b/gnu/gnunet/scripts/download-store.scm
@@ -61,6 +61,7 @@
                 (predicate ,gnunet-fs-uri?))
        (output  (single-char #\o)
                 (value #t))
+       (nar     (value #t))
        ;; GNUnet options
        (config      (single-char #\c)
                     (value #t))
@@ -117,6 +118,7 @@ Download resumption is currently unsupported.
                    'any' by default.
   -i, --input      URI to download
   -o, --output     Directory to save store items in.
+      --nar        Location to write the nar to.
 
 GNUnet options
   -c, --config      GNUnet configuration for publishing
@@ -125,25 +127,29 @@ GNUnet options
                     local peer.")
 
     (define (main arguments)
-      (inner-main arguments)
+      (let ((options (getopt-long arguments %options-specification)))
+       (call-with-options options (cute inner-main options)))
       (exit 0))
 
-    (define (inner-main arguments)
-      (let ((options (getopt-long arguments %options-specification)))
-       (cond ((option-ref options 'version #f)
-              (display %version-string)
-              (newline))
-             ((option-ref options 'help #f)
-              (display %help)
-              (newline))
-             ((member (option-ref options 'format "gnunet-nix-archive-json/0")
-                      '("gnunet-nix-archive-json/0" "any"))
-              (call-with-options options
-                                 (lambda ()
-                                   (download-nar
-                                    (option-ref options 'input #f)
-                                    (option-ref options 'output #f)))))
-             (else ???))))
+    (define (inner-main options)
+      (cond ((option-ref options 'version #f)
+            (display %version-string)
+            (newline))
+           ((option-ref options 'help #f)
+            (display %help)
+            (newline))
+           ((member (option-ref options 'format "gnunet-nix-archive-json/0")
+                    '("gnunet-nix-archive-json/0" "any"))
+            ;; TODO should multiple outputs be allowed?
+            (when (option-ref options 'output #f)
+              (download:gnunet-nar/0-to-fs
+               (option-ref options 'input #f)
+               (option-ref options 'output #f)))
+            (when (option-ref options 'nar #f)
+              (download:gnunet-nar/0-to-nar
+               (option-ref options 'input #f)
+               (option-ref options 'nar #f))))
+           (else ???)))
 
     (define (gnunet-download uri output-filename)
       "Download URI to the file OUTPUT, which is
@@ -178,7 +184,9 @@ instead of writing to a file."
         (gnunet-download uri filename)
         (get-bytevector-all out))))
 
-    (define (download-nar uri output)
+    (define (download:gnunet-nar/0-to-fs uri output)
+      "Download the normalised archive in @var{gnunet-nix-archive-json/0}
+format from @var{uri} to the directory @var{output}."
       (let* ((container/bv (gnunet-download/bytevector uri))
             (container/json (utf8->string container/bv))
             (container/scm (json-string->scm container/json)))
@@ -189,6 +197,11 @@ instead of writing to a file."
          (verify-entries sorted)
          (download-entries! sorted output))))
 
+    (define (download:gnunet-nar/0-to-nar uri output)
+      "Download the normalised archive in @var{gnunet-nix-archive-json/0}
+format from @var{uri} to the file @var{output}."
+      (throw 'todo 'implement-me 'please))
+
     (define (download-entries! entries output)
       (define (prefix name)
        (string-append output "/" name))

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]