summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-07-02 22:47:51 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-07-18 02:02:34 -0400
commitaeded14b8342c1e72afd014a1bc121770f8c3a1c (patch)
tree571cee7dff06d9f9af5e1207780dfe3634b13ce8 /tests
parent15b4372b6019fa515c5ef01bd290145a8d507000 (diff)
downloadguix-aeded14b8342c1e72afd014a1bc121770f8c3a1c.tar.gz
pack: Allow embedding custom control files in deb packs.
* guix/scripts/pack.scm (self-contained-tarball/builder)
[extra-options]: New argument.
(self-contained-tarball, squashfs-image, docker-image)
(debian-archive): Likewise.  Remove two TODO comments.  Document
EXTRA-OPTIONS.  Use the custom control files when provided.
(%deb-format-options): New variable.
(show-deb-format-options, show-deb-format-options/detailed): New procedures.
(%options): Register new options.
(show-help): Augment with new usage.
(guix-pack): Validate and propagate new argument values.
* doc/guix.texi (Invoking guix pack)[deb]: Document how to list advanced
options.  Add an example.
* tests/pack.scm (deb archive...): Provide extra-options to the debian-archive
procedure, and validate that the provided files are embedded in the pack.
Diffstat (limited to 'tests')
-rw-r--r--tests/pack.scm27
1 files changed, 22 insertions, 5 deletions
diff --git a/tests/pack.scm b/tests/pack.scm
index 9473d4f384..e9b4c36e0e 100644
--- a/tests/pack.scm
+++ b/tests/pack.scm
@@ -277,17 +277,25 @@
       (built-derivations (list check))))
 
   (unless store (test-skip 1))
-  (test-assertm "deb archive with symlinks" store
+  (test-assertm "deb archive with symlinks and control files" store
     (mlet* %store-monad
         ((guile   (set-guile-for-build (default-guile)))
          (profile (profile-derivation (packages->manifest
                                        (list %bootstrap-guile))
                                       #:hooks '()
                                       #:locales? #f))
-         (deb (debian-archive "deb-pack" profile
-                              #:compressor %gzip-compressor
-                              #:symlinks '(("/opt/gnu/bin" -> "bin"))
-                              #:archiver %tar-bootstrap))
+         (deb (debian-archive
+               "deb-pack" profile
+               #:compressor %gzip-compressor
+               #:symlinks '(("/opt/gnu/bin" -> "bin"))
+               #:archiver %tar-bootstrap
+               #:extra-options
+               (list #:triggers-file
+                     (plain-file "triggers"
+                                 "activate-noawait /usr/share/icons/hicolor\n")
+                     #:postinst-file
+                     (plain-file "postinst"
+                                 "echo running configure script\n"))))
          (check
           (gexp->derivation "check-deb-pack"
             (with-imported-modules '((guix build utils))
@@ -344,6 +352,15 @@
                   (unless (null? hard-links)
                     (error "hard links found in data.tar.gz" hard-links))
 
+                  ;; Verify the presence of the control files.
+                  (invoke "tar" "-xf" "control.tar.gz")
+                  (assert (file-exists? "control"))
+                  (assert (and (file-exists? "postinst")
+                               (= #o111 ;script is executable
+                                  (logand #o111 (stat:perms
+                                                 (stat "postinst"))))))
+                  (assert (file-exists? "triggers"))
+
                   (mkdir #$output))))))
       (built-derivations (list check)))))