Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New package: hut-0.1.0 #36716

Merged
merged 1 commit into from Jul 1, 2022
Merged

New package: hut-0.1.0 #36716

merged 1 commit into from Jul 1, 2022

Conversation

kotajacob
Copy link
Contributor

This is the official command line client for https://sourcehut.org/

It's basically the sourcehut equivalent to Github's hub or gh tools.
It's been in development for a while now, but they've put out their
first release earlier this month. I've been using it happily for a while
before this release.

Testing the changes

  • I tested the changes in this PR: YES

New package

Local build testing

  • I built this PR locally for my native architecture, x86_64-glibc

@the-maldridge
Copy link
Member

Supercedes #36715

srcpkgs/hut/template Outdated Show resolved Hide resolved
@kotajacob
Copy link
Contributor Author

The thing causing the build to fail on arm is generating shell completions. The hut package doesn't ship with completion scripts; you're meant to run hut completion bash > hut.bash to generate the script. There are two issues with this:

  1. It seems like you need to set build_helper=qemu and run hut with vtargetrun in the post install stage rather than trying to run hut itself normally. Otherwise I don't think crosscompiles will work.
  2. On arm (or maybe just crossbuilds in general) it seems like the binary for hut is not located in $GOPATH/bin/hut after compiling, but instead in $GOPATH/bin/linux_arm64/hut.

Number 1 seems to work fine with vtargetrun, but for number 2 I'm not sure the best way to handle this. I was thinking I could do something like hutbin=$(find $GOPATH/bin -type f) to get the hut binary path, but that throws a weird error message:

=> hut-0.1.0_1: running pre-install hook: 98-fixup-gir-path ...
ln: /destdir/aarch64-linux-gnu/hut-0.1.0/usr/aarch64-linux-gnu/usr/..: cannot overwrite directory
=> ERROR: hut-0.1.0_1: pre-install_98-fixup-gir-path: 'ln -sf ".." "${PKGDESTDIR}/usr/${XBPS_CROSS_TRIPLET}/usr"' exited with 1
=> ERROR:   in hook() at common/hooks/pre-install/98-fixup-gir-path.sh:9
=> ERROR:   in run_func() at common/xbps-src/shutils/common.sh:21
=> ERROR:   in run_pkg_hooks() at common/xbps-src/shutils/common.sh:245
=> ERROR:   in run_step() at common/xbps-src/shutils/common.sh:43
=> ERROR:   in main() at common/xbps-src/libexec/xbps-src-doinstall.sh:37

Another option would be a switch statement for the arm architectures, but both of these seem hacky and not ideal. Maybe there's a simple environment variable that points to the binary you just installed or something? Will look into this further when I get some more time. Just wanted to update with the current progress.

@classabbyamp
Copy link
Member

I was able to get it to work with hut=$(find $GOPATH/bin -name hut) and vtargetrun

diff --git a/srcpkgs/hut/template b/srcpkgs/hut/template
index 25f1d9bdd2..f1448fcf1f 100644
--- a/srcpkgs/hut/template
+++ b/srcpkgs/hut/template
@@ -4,6 +4,7 @@ version=0.1.0
 revision=1
 wrksrc="${pkgname}-v${version}"
 build_style=go
+build_helper=qemu
 go_import_path="git.sr.ht/~emersion/hut"
 hostmakedepends="scdoc"
 short_desc="CLI tool for sr.ht"
@@ -15,13 +16,11 @@ distfiles="https://git.sr.ht/~emersion/hut/archive/v${version}.tar.gz"
 checksum=5af8f1111f9ec1da9a818978eb1f013dfd50ad4311c79d95b0e62ad428ac1c59
 
 post_install() {
-	$GOPATH/bin/hut completion bash >hut.bash
-	$GOPATH/bin/hut completion zsh >hut.zsh
-	$GOPATH/bin/hut completion fish >hut.fish
-
-	vcompletion hut.bash bash
-	vcompletion hut.zsh zsh
-	vcompletion hut.fish fish
+	hut=$(find $GOPATH/bin -name hut)
+	for sh in bash fish zsh; do
+		vtargetrun $hut completion $sh > hut.$sh
+		vcompletion hut.$sh $sh
+	done
 
 	vlicense LICENSE

This is the official command line client for https://sourcehut.org/

It's basically the sourcehut equivalent to Github's hub or gh tools.
It's been in development for a while now, but they've put out their
first release earlier this month. I've been using it happily for a while
before this release.
@kotajacob
Copy link
Contributor Author

I was able to get it to work with hut=$(find $GOPATH/bin -name hut) and vtargetrun

Huh perhaps I made a typo when I tried earlier. Just made that change and force pushed. Seems to be working now!

@paper42 paper42 added the new-package This PR adds a new package label Jun 3, 2022
@classabbyamp classabbyamp merged commit 5e4457a into void-linux:master Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-package This PR adds a new package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants