aboutsummaryrefslogtreecommitdiff
path: root/.guix
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-08-16 06:40:18 +0300
committerFrederick Muriuki Muriithi2023-08-16 06:40:18 +0300
commit758090480e567e2cbcad30aa627a1767838b52d5 (patch)
tree648a9e99c378e4b2cd3502046985ef65c82bc9f7 /.guix
parentd7866b6f96fc903f3759ec7d515913f2e25b555d (diff)
downloadgn-auth-758090480e567e2cbcad30aa627a1767838b52d5.tar.gz
Do not find the exact version for Guix package.
Finding the exact version number is a lot of work for a minor cosmetic effect. This change was suggested by Arun. I could not figure out how to download the patch from protonmail directly, so I have to give credit here.
Diffstat (limited to '.guix')
-rw-r--r--.guix/modules/gn-auth.scm58
1 files changed, 1 insertions, 57 deletions
diff --git a/.guix/modules/gn-auth.scm b/.guix/modules/gn-auth.scm
index 0349daf..b860d36 100644
--- a/.guix/modules/gn-auth.scm
+++ b/.guix/modules/gn-auth.scm
@@ -6,13 +6,6 @@
#:use-module (guix build-system python)
#:use-module ((guix licenses) #:prefix license:)
- #:use-module (git oid)
- #:use-module (git tag)
- #:use-module (git bindings)
- #:use-module (git reference)
- #:use-module (git repository)
-
-
;; Packages from guix
#:use-module (gnu packages check)
@@ -30,53 +23,6 @@
(define %source-dir (dirname (dirname (dirname (dirname (dirname (current-filename)))))))
-(define (get-commit)
- "Retrieve the commit if the source directory is a repository."
- (if (git-predicate %source-dir)
- (begin (let ((commit #f))
- (libgit2-init!)
- (set! commit (oid->string
- (reference-target
- (repository-head (repository-open %source-dir)))))
- (libgit2-shutdown!)
- commit))
- "NOTAREPOSITORY"))
-
-(define (list-last lst)
- (let ((len (length lst)))
- (if (> len 0)
- (list-ref lst (- len 1)))))
-
-(define (process-version repo-head tag-vals)
- (let ((version-prefix (list-last (string-split (car tag-vals) #\/)))
- (repo-head-str (oid->string repo-head)))
- (if (zero? (oid-cmp repo-head
- (tag-target-id (cdr tag-vals))))
- version-prefix
- (string-append version-prefix "-" (substring repo-head-str 0 8)))))
-
-(define (get-latest-version)
- "Get latest version tag from repository."
- (if (git-predicate %source-dir)
- (let ((%repo #f)
- (%tags (list))
- (%repo-head #f))
- (begin (libgit2-init!)
- (set! %repo (repository-open %source-dir))
- (set! %repo-head (reference-target (repository-head %repo)))
- (tag-foreach %repo
- (lambda (tname tref)
- (set! %tags (list (cons tname (tag-lookup %repo tref))))
- 0))
- (libgit2-shutdown!)
- (if (zero? (length %tags))
- (string-append "v0.0.0-" (substring (oid->string %repo-head) 0 8))
- (process-version
- %repo-head
- (list-last (sort-list %tags (lambda (item) (error item))))))))
- ;; Figure out a way to get the version in the checkouts when building
- "v0.0.0"))
-
(define vcs-file?
(or (git-predicate %source-dir)
(const #t)))
@@ -84,9 +30,7 @@
(define-public gn-auth
(package
(name "gn-auth")
- (version (string-append (get-latest-version)
- "-git-"
- (substring (get-commit) 0 9)))
+ (version "0.1.0-git")
(source (local-file %source-dir "gn-auth-checkout"
#:recursive? #t
#:select? vcs-file?))