summaryrefslogtreecommitdiff
path: root/guix/import/minetest.scm
diff options
context:
space:
mode:
authorSarah Morgensen <iskarian@mgsn.dev>2022-01-05 14:07:48 +0000
committerLudovic Courtès <ludo@gnu.org>2022-01-06 16:27:30 +0100
commitb4c677c2ed42c7462d2651bac2dc2936b90b670f (patch)
tree5ab638bae808bf258c2bb9fbc08d5a107c887b50 /guix/import/minetest.scm
parent064c367716f88b7662b6b8e0d9dbd5eab941c25f (diff)
downloadguix-patches-b4c677c2ed42c7462d2651bac2dc2936b90b670f.tar
guix-patches-b4c677c2ed42c7462d2651bac2dc2936b90b670f.tar.gz
import: Factorize file hashing.
* guix/import/cran.scm (vcs-file?, file-hash): Remove procedures. (description->package): Use 'file-hash*' instead. * guix/import/elpa.scm (vcs-file?, file-hash): Remove procedures. (git-repository->origin, elpa-package->sexp): Use 'file-hash* instead'. * guix/import/go.scm (vcs-file?, file-hash): Remove procedures. (git-checkout-hash): Use 'file-hash*' instead. * guix/import/minetest.scm (file-hash): Remove procedure. (make-minetest-sexp): Use 'file-hash*' instead. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'guix/import/minetest.scm')
-rw-r--r--guix/import/minetest.scm19
1 files changed, 8 insertions, 11 deletions
diff --git a/guix/import/minetest.scm b/guix/import/minetest.scm
index abddd885ee..a7bdbfebca 100644
--- a/guix/import/minetest.scm
+++ b/guix/import/minetest.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2021, 2022 Maxime Devos <maximedevos@telenet.be>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -39,6 +39,7 @@
#:use-module (guix base32)
#:use-module (guix git)
#:use-module ((guix git-download) #:prefix download:)
+ #:use-module (guix hash)
#:use-module (guix store)
#:export (%default-sort-key
%contentdb-api
@@ -286,14 +287,6 @@ results. The return value is a list of <package-keys> records."
(with-store store
(latest-repository-commit store url #:ref ref)))
-;; XXX adapted from (guix scripts hash)
-(define (file-hash file)
- "Compute the hash of FILE."
- (let-values (((port get-hash) (open-sha256-port)))
- (write-file file port)
- (force-output port)
- (get-hash)))
-
(define (make-minetest-sexp author/name version repository commit
inputs home-page synopsis
description media-license license)
@@ -314,9 +307,13 @@ MEDIA-LICENSE and LICENSE."
;; The git commit is not always available.
,(and commit
(bytevector->nix-base32-string
- (file-hash
+ (file-hash*
(download-git-repository repository
- `(commit . ,commit)))))))
+ `(commit . ,commit))
+ ;; 'download-git-repository' already filtered out the '.git'
+ ;; directory.
+ #:select? (const #true)
+ #:recursive? #true)))))
(file-name (git-file-name name version))))
(build-system minetest-mod-build-system)
,@(maybe-propagated-inputs (map contentdb->package-name inputs))