GNU bug report logs -
#78210
[PATCH] guix: include store parent dirs in docker layer
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Tue, 03 Jun 2025 10:39:07 +0200
with message-id <87o6v5md78.fsf <at> gnu.org>
and subject line Re: [bug#78210] [PATCH] guix: include store parent dirs in docker layer
has caused the debbugs.gnu.org bug report #78210,
regarding [PATCH] guix: include store parent dirs in docker layer
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
78210: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78210
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
This patch adds the /gnu and /gnu/store directories to the Docker layer
created by `guix pack -f docker ...` which enables the Docker image to be
used to create an AWS Lambda function. Without the patch, creating the AWS
Lambda function fails with this error:
"MissingParentDirectory: Parent directory does not exist for file:
gnu/store/zic27jikg36d6wjj4cz8hyriyfl3ygiz-info-dir/"
My first attempt to fix this was just to add the /gnu and /gnu/store
directories
to `directives` but the Docker image failed in AWS Lambda with the same
error. These
directories need to appear in the tarball for the layer *before* the
packages,
so the change to the order of the tar arguments is also needed.
* guix/scripts/pack.scm: add /gnu and /gnu/store directories to the
docker layer.
* guix/docker.scm: change order of arguments to tar so parent
directories are added before their contents.
Change-Id: I2b103c59981e828c965564ccc5d2415b00a7e52e
---
guix/docker.scm | 4 ++--
guix/scripts/pack.scm | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/guix/docker.scm b/guix/docker.scm
index 60ce13cbde..9911bb84bb 100644
--- a/guix/docker.scm
+++ b/guix/docker.scm
@@ -365,10 +365,10 @@ (define* (build-docker-image image paths prefix
(apply invoke "tar" "-cf" "../layer.tar"
`(,@transformation-options
,@(tar-base-options)
- ,@(if max-layers '() paths)
,@(scandir "."
(lambda (file)
- (not (member file '("." ".."))))))))
+ (not (member file '("." "..")))))
+ ,@(if max-layers '() paths))))
(delete-file-recursively "extra")))
;; It is possible for "/" to show up in the archive, especially
when
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 7ab2c0d447..5cb9cd0b48 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -580,9 +580,11 @@ (define* (docker-image name profile
(,source -> ,target))))))
(define directives
- ;; Create a /tmp directory, as some programs expect it, and
- ;; create SYMLINKS.
+ ;; Create /tmp, /gnu, and /gnu/store directories, as some
+ ;; programs expect them, and create SYMLINKS.
`((directory "/tmp" ,(getuid) ,(getgid) #o1777)
+ (directory "/gnu" ,(getuid) ,(getgid) #o755)
+ (directory "/gnu/store" ,(getuid) ,(getgid) #o755)
,@(append-map symlink->directives '#$symlinks)))
(define (form-entry-point prefix entry-point
entry-point-argument)
base-commit: 4fe4cf9fdd959126d3c53c3df4504d851e7b736a
--
2.47.1
[OpenPGP_0x043F786C4CD681B8.asc (application/pgp-keys, attachment)]
[OpenPGP_signature.asc (application/pgp-signature, attachment)]
[Message part 6 (message/rfc822, inline)]
[Message part 7 (text/plain, inline)]
Hi Ray,
Ray Miller <ray <at> 1729.org.uk> writes:
> * guix/scripts/pack.scm: add store directory to the docker
> layer.
> * guix/docker.scm: change order of arguments to tar so parent
> directories are added before their contents.
>
> Fixes <https://issues.guix.gnu.org/78210>
>
> Change-Id: I2b103c59981e828c965564ccc5d2415b00a7e52e
I tweaked the commit log and applied it with the changes below.
Thanks!
Ludo’.
[Message part 8 (text/x-patch, inline)]
diff --git a/guix/docker.scm b/guix/docker.scm
index 9911bb84bb5..bb6d896a635 100644
--- a/guix/docker.scm
+++ b/guix/docker.scm
@@ -365,6 +365,7 @@ (define* (build-docker-image image paths prefix
(apply invoke "tar" "-cf" "../layer.tar"
`(,@transformation-options
,@(tar-base-options)
+ ;; Add parent directories before their contents.
,@(scandir "."
(lambda (file)
(not (member file '("." "..")))))
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index e69316089d8..857cb46af37 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -580,7 +580,7 @@ (define* (docker-image name profile
(,source -> ,target))))))
(define directives
- ;; Create /tmp and %store-prefix directories, as some
+ ;; Create the /tmp and %store-prefix directories, as some
;; programs expect them, and create SYMLINKS.
`((directory "/tmp" ,(getuid) ,(getgid) #o1777)
(directory #$(%store-prefix) ,(getuid) ,(getgid) #o755)
This bug report was last modified 14 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.