diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2020-12-09 21:50:21 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2020-12-15 17:32:09 +0100 |
| commit | 465d2cb286170933577de045e6e6dad7205bfe10 (patch) | |
| tree | 7dba0ec00536a6fa8483f88e11e3adbe682ccbf4 | |
| parent | 7a2897149d60816c33c63b7b7254ad283f8c3602 (diff) | |
serialization: 'fold-archive' notifies about directory processing completion.
* guix/serialization.scm (fold-archive): Call PROC with a
'directory-complete tag when done with a directory.
(restore-file): Handle it.
* guix/scripts/archive.scm (list-contents): Likewise.
* guix/scripts/challenge.scm (archive-contents): Likewise.
* tests/nar.scm ("write-file-tree + fold-archive"): Adjust accordingly.
| -rw-r--r-- | guix/scripts/archive.scm | 2 | ||||
| -rw-r--r-- | guix/scripts/challenge.scm | 1 | ||||
| -rw-r--r-- | guix/serialization.scm | 5 | ||||
| -rw-r--r-- | tests/nar.scm | 6 |
4 files changed, 11 insertions, 3 deletions
diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm index c04baf9784a..1f73fff711b 100644 --- a/guix/scripts/archive.scm +++ b/guix/scripts/archive.scm | |||
| @@ -347,6 +347,8 @@ output port." | |||
| 347 | (match type | 347 | (match type |
| 348 | ('directory | 348 | ('directory |
| 349 | (format #t "D ~a~%" file)) | 349 | (format #t "D ~a~%" file)) |
| 350 | ('directory-complete | ||
| 351 | #t) | ||
| 350 | ('symlink | 352 | ('symlink |
| 351 | (format #t "S ~a -> ~a~%" file content)) | 353 | (format #t "S ~a -> ~a~%" file content)) |
| 352 | ((or 'regular 'executable) | 354 | ((or 'regular 'executable) |
diff --git a/guix/scripts/challenge.scm b/guix/scripts/challenge.scm index 39bd2c1c0fa..d0a456ac1d7 100644 --- a/guix/scripts/challenge.scm +++ b/guix/scripts/challenge.scm | |||
| @@ -210,6 +210,7 @@ taken since we do not import the archives." | |||
| 210 | (cons `(,file ,type ,(port-sha256* port size)) | 210 | (cons `(,file ,type ,(port-sha256* port size)) |
| 211 | result)))) | 211 | result)))) |
| 212 | ('directory result) | 212 | ('directory result) |
| 213 | ('directory-complete result) | ||
| 213 | ('symlink | 214 | ('symlink |
| 214 | (cons `(,file ,type ,contents) result)))) | 215 | (cons `(,file ,type ,contents) result)))) |
| 215 | '() | 216 | '() |
diff --git a/guix/serialization.scm b/guix/serialization.scm index 836ad06caf9..cc56134ef45 100644 --- a/guix/serialization.scm +++ b/guix/serialization.scm | |||
| @@ -444,7 +444,8 @@ depends on TYPE." | |||
| 444 | (file file) | 444 | (file file) |
| 445 | (token x)))))) | 445 | (token x)))))) |
| 446 | (loop (read-string port) result))))) | 446 | (loop (read-string port) result))))) |
| 447 | (")" result) ;done with DIR | 447 | (")" ;done with DIR |
| 448 | (proc file 'directory-complete #f result)) | ||
| 448 | (x | 449 | (x |
| 449 | (raise | 450 | (raise |
| 450 | (condition | 451 | (condition |
| @@ -463,6 +464,8 @@ Restore it as FILE." | |||
| 463 | (match type | 464 | (match type |
| 464 | ('directory | 465 | ('directory |
| 465 | (mkdir file)) | 466 | (mkdir file)) |
| 467 | ('directory-complete | ||
| 468 | #t) | ||
| 466 | ('symlink | 469 | ('symlink |
| 467 | (symlink content file)) | 470 | (symlink content file)) |
| 468 | ((or 'regular 'executable) | 471 | ((or 'regular 'executable) |
diff --git a/tests/nar.scm b/tests/nar.scm index aeff3d33304..b542ebd47c6 100644 --- a/tests/nar.scm +++ b/tests/nar.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; | 3 | ;;; |
| 4 | ;;; This file is part of GNU Guix. | 4 | ;;; This file is part of GNU Guix. |
| 5 | ;;; | 5 | ;;; |
| @@ -218,8 +218,10 @@ | |||
| 218 | '(("R" directory #f) | 218 | '(("R" directory #f) |
| 219 | ("R/dir" directory #f) | 219 | ("R/dir" directory #f) |
| 220 | ("R/dir/exe" executable "1234") | 220 | ("R/dir/exe" executable "1234") |
| 221 | ("R/dir" directory-complete #f) | ||
| 221 | ("R/foo" regular "abcdefg") | 222 | ("R/foo" regular "abcdefg") |
| 222 | ("R/lnk" symlink "foo")) | 223 | ("R/lnk" symlink "foo") |
| 224 | ("R" directory-complete #f)) | ||
| 223 | 225 | ||
| 224 | (let () | 226 | (let () |
| 225 | (define-values (port get-bytevector) | 227 | (define-values (port get-bytevector) |
