Make the Guix package work without Git.

This commit generates a '.tarball-manifest' file that gets placed in
the distribution tarball and simply lists all the files that are in
the Git tree.  It is used to determine which files should be
considered source files when building the package using Guix.

* guix.scm (make-select): Fall back on reading from
'.tarball-manifest' if a Git repository is not available.
This commit is contained in:
Timothy Sample 2019-05-17 20:38:26 -04:00
parent 511dae3577
commit c61b1d6fef
2 changed files with 22 additions and 9 deletions

View File

@ -356,6 +356,7 @@ endif # HAVE_GENHTML
dist-hook: gen-ChangeLog
echo $(VERSION) > $(distdir)/.tarball-version
git ls-tree -r --name-only HEAD > $(distdir)/.tarball-manifest
.PHONY: gen-ChangeLog
gen-ChangeLog:

View File

@ -25,15 +25,27 @@
version)))
(define (make-select)
(let* ((directory (repository-discover *srcdir*))
(repository (repository-open directory))
(oid (reference-target (repository-head repository)))
(commit (commit-lookup repository oid))
(tree (commit-tree commit))
(paths (tree-list tree)))
(lambda (file stat)
(let ((relative (substring file (1+ (string-length *srcdir*)))))
(member relative paths)))))
(define paths
(or (false-if-exception
(let* ((directory (repository-discover *srcdir*))
(repository (repository-open directory))
(oid (reference-target (repository-head repository)))
(commit (commit-lookup repository oid))
(tree (commit-tree commit)))
(tree-list tree)))
(false-if-exception
(with-directory-excursion *srcdir*
(call-with-input-file ".tarball-manifest"
(lambda (port)
(let loop ((line (get-line port)) (acc '()))
(if (eof-object? line)
acc
(loop (get-line port) (cons line acc))))))))
(error "Cannot make file selector")))
(lambda (file stat)
(let ((relative (substring file (1+ (string-length *srcdir*)))))
(or (eq? (stat:type stat) 'directory)
(member relative paths)))))
(package
(name "gash")