From 758090480e567e2cbcad30aa627a1767838b52d5 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Wed, 16 Aug 2023 06:40:18 +0300 Subject: 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. --- .guix/modules/gn-auth.scm | 58 +---------------------------------------------- 1 file changed, 1 insertion(+), 57 deletions(-) (limited to '.guix/modules/gn-auth.scm') 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?)) -- cgit v1.2.3