gnu: dstask: Use G-expressions, set version.

* gnu/packages/task-management.scm (dstask): Improve package style by
re-writing to G-expressions and simplify phases.
[arguments] <build-flags>: Set version.
<phases>: Use default 'install and add 'install-shell-completions.
Simplify 'build and relay on go-build-system default.

Change-Id: Ia6e81adddf78c9267e837285075d8ba9b8814762
This commit is contained in:
Sharlatan Hellseher 2025-02-26 20:54:38 +00:00
parent 6a1c669acf
commit 26325888c1
No known key found for this signature in database
GPG key ID: 76D727BFF62CD2B5

View file

@ -340,31 +340,40 @@ time to a logfile.")
(base32 "01vdxm3y5fg4hqhq4k1lk0m7w70kkwlka5jhixv7a9lf1gqldskd")))) (base32 "01vdxm3y5fg4hqhq4k1lk0m7w70kkwlka5jhixv7a9lf1gqldskd"))))
(build-system go-build-system) (build-system go-build-system)
(arguments (arguments
`(#:import-path "github.com/naggie/dstask" (list
#:install-source? #f #:install-source? #f
#:test-subdirs '("pkg/..." ".") #:import-path "github.com/naggie/dstask"
#:phases #:build-flags
(modify-phases %standard-phases #~(list (string-append
(replace 'build "-ldflags=-X github.com/naggie/dstask.VERSION=" #$version
(lambda* (#:key import-path #:allow-other-keys) " -X github.com/naggie/dstask.GIT_COMMIT=" #$version))
(with-directory-excursion (string-append "src/" import-path) #:test-subdirs #~(list "pkg/..." ".")
(invoke "go" "build" "-trimpath" "-o" "dstask" "cmd/dstask/main.go") #:phases
(invoke "go" "build" "-trimpath" "-o" "dstask-import" #~(modify-phases %standard-phases
"cmd/dstask-import/main.go")))) (replace 'build
(replace 'install (lambda arguments
(lambda* (#:key import-path outputs #:allow-other-keys) (let ((path-prefix "github.com/naggie/dstask/cmd/"))
(with-directory-excursion (string-append "src/" import-path) (for-each
(let* ((out (assoc-ref outputs "out")) (lambda (cmd)
(bindir (string-append out "/bin")) (apply (assoc-ref %standard-phases 'build)
(zsh-completion (string-append `(,@arguments #:import-path
out "/share/zsh/site-functions/_dstask")) ,(string-append path-prefix cmd))))
(bash-completion (list "dstask-import" "dstask")))))
(string-append ;; TODO: Completions may be generated on the fly with "dstask
out "/share/bash-completion/completions/_dstask"))) ;; (bash|fish|zsh)-completion" but invocation of "dstask" requires
(install-file "dstask" bindir) ;; creating $HOME/.dstask git repository, find out workaround and
(install-file "dstask-import" bindir) ;; add fish completion as well.
(install-file ".dstask-bash-completions.sh" bash-completion) (add-after 'install 'install-shell-completions
(install-file ".dstask-zsh-completions.sh" zsh-completion)))))))) (lambda* (#:key import-path #:allow-other-keys)
(with-directory-excursion (string-append "src/" import-path)
(let* ((out #$output)
(share (string-append out "/share"))
(zsh-completion
(string-append share "/zsh/site-functions/_dstask"))
(bash-completion
(string-append out "/bash-completion/completions/_dstask")))
(install-file ".dstask-bash-completions.sh" bash-completion)
(install-file ".dstask-zsh-completions.sh" zsh-completion))))))))
(native-inputs (native-inputs
(list go-github-com-burntsushi-toml (list go-github-com-burntsushi-toml
go-github-com-gofrs-uuid go-github-com-gofrs-uuid