summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorPierre Neidhardt <mail@ambrevar.xyz>2019-10-07 13:49:42 +0200
committerPierre Neidhardt <mail@ambrevar.xyz>2019-10-07 13:49:42 +0200
commitc6dd9cf7ffd968520e78c438f7064935c40e139d (patch)
treec3f39aece2f290dad71d457c3b8c78ee1287085e /gnu
parent003a714e7e1f458b84e60b7480149a59b034312c (diff)
downloadguix-c6dd9cf7ffd968520e78c438f7064935c40e139d.tar.gz
gnu: Add trivial-file-size.
* gnu/packages/lisp.scm (cl-trivial-file-size, ecl-trivial-file-size,
  sbcl-trivial-file-size): New variables.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/lisp.scm38
1 files changed, 38 insertions, 0 deletions
diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index 88261d5f8e..031d172c39 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -7594,3 +7594,41 @@ special variables, especially in the presence of threads.")
 
 (define-public ecl-global-vars
   (sbcl-package->ecl-package sbcl-global-vars))
+
+(define-public sbcl-trivial-file-size
+  (let ((commit "1c1d672a01a446ba0391dbb4ffc40be3b0476f23")
+        (revision "0"))
+    (package
+      (name "sbcl-trivial-file-size")
+      (version (git-version "0.0.0" revision commit))
+      (home-page "https://github.com/ruricolist/trivial-file-size")
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url home-page)
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "17pp86c9zs4y7i1sh7q9gbfw9iqv6655k7fz8qbj9ly1ypgxp4qs"))))
+      (build-system asdf-build-system/sbcl)
+      (native-inputs
+       `(("fiveam" ,sbcl-fiveam)))
+      (synopsis "Size of a file in bytes in Common Lisp")
+      (description
+       "The canonical way to determine the size of a file in bytes, using Common Lisp,
+is to open the file with an element type of (unsigned-byte 8) and then
+calculate the length of the stream.  This is less than ideal.  In most cases
+it is better to get the size of the file from its metadata, using a system
+call.
+
+This library exports a single function, file-size-in-octets.  It returns the
+size of a file in bytes, using system calls when possible.")
+      (license license:expat))))
+
+(define-public cl-trivial-file-size
+  (sbcl-package->cl-source-package sbcl-trivial-file-size))
+
+(define-public ecl-trivial-file-size
+  (sbcl-package->ecl-package sbcl-trivial-file-size))