From ff580957971880b6d5ad04251ef659a6efed20eb Mon Sep 17 00:00:00 2001 From: Puck Meerburg Date: Fri, 27 Jun 2025 18:08:06 +0000 Subject: [PATCH] (zilch file): fix unneccessary double-serialization in zfile Change-Id: I6a6a69640707ff155f425f05aa857f03bad2650d --- core/src/file.sld | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/core/src/file.sld b/core/src/file.sld index 80bd0f4..7eafbc0 100644 --- a/core/src/file.sld +++ b/core/src/file.sld @@ -197,29 +197,15 @@ ((z-symlink? val) (z-symlink-cache val)))) (unless cached (set! cached - (let* - ((bvport (open-output-bytevector)) - (serialized (zexp-with-context (lambda () (parameterize ((current-output-port bvport)) (serialize-as-tar val "-"))))) - (bv (get-output-bytevector bvport)) - (intermediate #f) - (drv #f)) - (close-port bvport) - ;(set! intermediate - ; (zexp-with-injected-context - ; (zexp - ; (zexp-unquote (store-path-for-text "file" bv))) - ; (cadr serialized) - ; (car (cddr serialized)))) - (set! drv - (store-path-for-ca-drv* "zilchfile" "builtin" - (zexp ("builtin:unpack-channel")) - (zexp (("src" . ".attr-1s42g1c76fxb77skzq0b4wdhcrg8jmzb54czmxvh1qm7psgsbcni") - ("contents" . (zexp-unquote (call-with-port (open-output-bytevector) (lambda (port) (parameterize ((current-output-port port)) (serialize-as-tar val "-")) (get-output-bytevector port))))) - ("passAsFile" . "contents") - ("allowSubstitutes" . "") - ("channelName" . "-"))) - '("out"))) - (cdar drv)))) + (cdar + (store-path-for-ca-drv* "zilchfile" "builtin" + (zexp ("builtin:unpack-channel")) + (zexp (("src" . ".attr-1s42g1c76fxb77skzq0b4wdhcrg8jmzb54czmxvh1qm7psgsbcni") + ("contents" . (zexp-unquote (call-with-port (open-output-bytevector) (lambda (port) (parameterize ((current-output-port port)) (serialize-as-tar val "-")) (get-output-bytevector port))))) + ("passAsFile" . "contents") + ("allowSubstitutes" . "") + ("channelName" . "-"))) + '("out"))))) (cond ((z-file? val) (z-file-set-cache val cached)) ((z-directory? val) (z-directory-set-cache val cached))