~emersion/hut-dev

hut: README: scdoc is not an optional dependency v1 PROPOSED

~gsish: 5
 README: scdoc is not an optional dependency
 README: discuss DESTDIR and PREFIX to raise awareness
 Makefile: accept external PREFIX spec (shell env var)
 doc: add --stdin to 'hut graphql' command example
 Makefile: reduce redundancy in build rules ($@ and $^ references)

 5 files changed, 17 insertions(+), 8 deletions(-)
#1128285 running .build.yml
hut/patches/.build.yml: TIMEOUT in 5h0m0s

[README: scdoc is not an optional dependency][0] from [~gsish][1]

[0]: https://lists.sr.ht/~emersion/hut-dev/patches/48343
[1]: mailto:Gerhard.Sittig@gmx.net

✗ #1128285 TIMEOUT hut/patches/.build.yml https://builds.sr.ht/~emersion/job/1128285
I'd rather not unnecessarily generalize the Makefile rules. I'd also
prefer not to resort to cat to invoke scdoc.



          
          
          
        
      

      
      
      
      

      

      
      
      
      
      
      

      

      
      
      
      

      

      
      
      
      
      
      
      
      
    
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/hut-dev/patches/48343/mbox | git am -3
Learn more about email & git

[PATCH hut 1/5] README: scdoc is not an optional dependency Export this patch

From: Gerhard Sittig <gerhard.sittig@gmx.net>

The scdoc(1) utility is not an optional dependency. It's unconditionally
referenced by build rules, the creation of the manpage is not optional
either. There is the theoretical option to force SCDOC=true in the build
command's invocation, which results in the installation of an unusable
man page and is not desirable either.

Issue tracker item https://todo.sr.ht/~emersion/hut/28 suggests that
it's non-trivial to portably make scdoc optional. Which means that the
scdoc dependency can be expected to remain mandatory for the future.

An earlier "problem" of learning where to get the scdoc(1) tool became
less of an issue when distributions started shipping packages. Still
users would have to guess or work around when they don't have easy
access to binaries.

Update the README to no longer claim that scdoc(1) would be optional.
Keep the comment which communicates its use to create the man page.
Link to the scdoc source repo as long as the tool is not universally
available.
---
 README.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 7d01863..b1dce5b 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,8 @@ Run `hut init` to get started. Read the man page to learn about all commands.
Dependencies:

- Go
- scdoc (optional, for man pages)
- scdoc (for man pages), see https://git.sr.ht/~sircmpwn/scdoc
  if your distribution does not provide binaries already

For end users, a `Makefile` is provided:

-- 
2.38.5
scdoc is optional in the sense that hut is perfectly usable without
scdoc. In other words, one can `go build` and then use hut without
scdoc.

The Makefile wouldn't exist if it wasn't for scdoc.

[PATCH hut 2/5] README: discuss DESTDIR and PREFIX to raise awareness Export this patch

From: Gerhard Sittig <gerhard.sittig@gmx.net>

The Makefile open codes the (unusual?) /usr/local location, and only
accepts overrides in the form of make(1) variables. Users may not be
aware that external specs are supported and how to phrase them.

Provide example invocations for system wide installation to /usr, as
well as users' local installation under $HOME. Also provide a DESTDIR
using example for completeness.
---
 README.md | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/README.md b/README.md
index b1dce5b..9480232 100644
--- a/README.md
+++ b/README.md
@@ -21,6 +21,14 @@ For end users, a `Makefile` is provided:
    make
    sudo make install

Build rules accept an optional DESTDIR specification and support
PREFIX overrides when desired:

    sudo make PREFIX=/usr install
    make PREFIX=$HOME install

    env DESTDIR=`pwd`/__inst make install

## Contributing

Send patches to the [mailing list], report bugs on the [issue tracker].
-- 
2.38.5

[PATCH hut 3/5] Makefile: accept external PREFIX spec (shell env var) Export this patch

From: Gerhard Sittig <gerhard.sittig@gmx.net>

The Makefile used to assign to PREFIX and only support overrides in the
form of make(1) variables. Rephrase such that external env vars are
accepted as well, as was the case for DESTDIR.

  $ env PREFIX=$HOME make -n install
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 90ddaef..198da43 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ RM = rm
INSTALL = install
SCDOC = scdoc
GOFLAGS =
PREFIX = /usr/local
PREFIX ?= /usr/local
BINDIR = bin
MANDIR = share/man
BASHCOMPDIR = $(PREFIX)/share/bash-completion/completions
-- 
2.38.5

[PATCH hut 4/5] doc: add --stdin to 'hut graphql' command example Export this patch

From: Gerhard Sittig <gerhard.sittig@gmx.net>

Interactive execution of the man page's graphql example fails when an
editor gets invoked which receives the query document while hut doesn't.
Do specify the --stdin option in the 'hut graphql` example command which
provides the query document in a shell's here document. This change
serves self documentation, unbreaks execution in interactive shells (and
scripts that execute in terminals), and keeps working in non-interactive
environments.
---
 doc/hut.1.scd | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/hut.1.scd b/doc/hut.1.scd
index 80a49a9..a034caa 100644
--- a/doc/hut.1.scd
+++ b/doc/hut.1.scd
@@ -52,7 +52,7 @@ Additionally, mailing lists can be referred to by their email address.
	data. Example:

	```
	hut graphql meta <<EOF | jq '.me'
	hut graphql --stdin meta <<EOF | jq '.me'
	query {
		me { canonicalName }
	}
@@ -71,7 +71,7 @@ Additionally, mailing lists can be referred to by their email address.
		Set a raw variable. Example:

		```
		hut graphql meta -v username=emersion <<'EOF'
		hut graphql --stdin meta -v username=emersion <<'EOF'
		query($username: String!) {
			userByName(username: $username) {
				bio
-- 
2.38.5

[PATCH hut 5/5] Makefile: reduce redundancy in build rules ($@ and $^ references) Export this patch

From: Gerhard Sittig <gerhard.sittig@gmx.net>

Don't repeat input or output filenames in build commands. Use available
dependency information which triggered the execution of the command.
Reference inputs by means of $^, use $@ for outputs.

This rephrases the scdoc invocation such that the input could be kept in
several files. Which is not essential for now, but transparently keeps
working during future maintenance.
---
 Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 198da43..6ee5f4c 100644
--- a/Makefile
+++ b/Makefile
@@ -21,16 +21,16 @@ hut:
completions: hut.bash hut.zsh hut.fish

hut.bash: hut
	./hut completion bash >hut.bash
	./hut completion bash > $@

hut.zsh: hut
	./hut completion zsh >hut.zsh
	./hut completion zsh > $@

hut.fish: hut
	./hut completion fish >hut.fish
	./hut completion fish > $@

doc/hut.1: doc/hut.1.scd
	$(SCDOC) <doc/hut.1.scd >doc/hut.1
	cat $^ | $(SCDOC) > $@

clean:
	$(RM) -f hut doc/hut.1 hut.bash hut.zsh hut.fish
-- 
2.38.5
hut/patches/.build.yml: TIMEOUT in 5h0m0s

[README: scdoc is not an optional dependency][0] from [~gsish][1]

[0]: https://lists.sr.ht/~emersion/hut-dev/patches/48343
[1]: mailto:Gerhard.Sittig@gmx.net

✗ #1128285 TIMEOUT hut/patches/.build.yml https://builds.sr.ht/~emersion/job/1128285
I'd rather not unnecessarily generalize the Makefile rules. I'd also
prefer not to resort to cat to invoke scdoc.