fix(packaging): temp dir removed on failure, module cache in srcdir, one package in dist
- commit
- 70424d47407281690e093fb877c7c2b310f4efe6
- author
- brice · · 2026-09-26 06:21 UTC
- parent
- 9cbbe26
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
4 files · +10 -8
M Makefile +6 -6
| @@ -52,12 +52,12 @@ check: vet test arch fakes-check | |||
| 52 | 52 | pkg: SHELL := bash | |
| 53 | 53 | pkg: .SHELLFLAGS := -eo pipefail -c | |
| 54 | 54 | pkg: | |
| 55 | - | @git diff --quiet HEAD || echo "warning: uncommitted changes are not packaged" >&2 | |
| 55 | + | @test -z "$$(git status --porcelain)" || echo "warning: uncommitted changes are not packaged" >&2 | |
| 56 | 56 | v=$$(t=$$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//; s/-/_/g'); \ | |
| 57 | 57 | echo "$${t:-0.0.0}.r$$(git rev-list --count HEAD).g$$(git rev-parse --short HEAD)"); \ | |
| 58 | - | d=$$(mktemp -d /tmp/nefertty-pkg.XXXXXX); \ | |
| 59 | - | git archive --prefix=nefertty-$$v/ -o $$d/nefertty-$$v.tar.gz HEAD; \ | |
| 60 | - | cp packaging/arch/PKGBUILD $$d/; \ | |
| 61 | - | cd $$d && sed -i "s/^pkgver=.*/pkgver=$$v/; s/^sha256sums=.*/sha256sums=('$$(sha256sum *.tar.gz | cut -d' ' -f1)')/" PKGBUILD; \ | |
| 62 | - | makepkg -f --noconfirm; mkdir -p $(CURDIR)/dist; mv *.pkg.tar.zst $(CURDIR)/dist/; cd /; rm -rf $$d | |
| 58 | + | d=$$(mktemp -d /tmp/nefertty-pkg.XXXXXX); trap 'rm -rf "$$d"' EXIT; \ | |
| 59 | + | git archive --prefix=nefertty-$$v/ -o "$$d/nefertty-$$v.tar.gz" HEAD; \ | |
| 60 | + | cp packaging/arch/PKGBUILD "$$d/"; \ | |
| 61 | + | cd "$$d" && sed -i "s/^pkgver=.*/pkgver=$$v/; s/^sha256sums=.*/sha256sums=('$$(sha256sum *.tar.gz | cut -d' ' -f1)')/" PKGBUILD; \ | |
| 62 | + | makepkg -f --noconfirm; mkdir -p $(CURDIR)/dist; rm -f $(CURDIR)/dist/nefertty-*.pkg.tar.zst; mv *.pkg.tar.zst $(CURDIR)/dist/ | |
| 63 | 63 | @ls dist/*.pkg.tar.zst | |
| @@ -52,12 +52,12 @@ check: vet test arch fakes-check | |||||
| 52 | pkg: SHELL := bash | 52 | pkg: SHELL := bash | ||
| 53 | pkg: .SHELLFLAGS := -eo pipefail -c | 53 | pkg: .SHELLFLAGS := -eo pipefail -c | ||
| 54 | pkg: | 54 | pkg: | ||
| 55 | - | @git diff --quiet HEAD || echo "warning: uncommitted changes are not packaged" >&2 | 55 | + | @test -z "$$(git status --porcelain)" || echo "warning: uncommitted changes are not packaged" >&2 |
| 56 | v=$$(t=$$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//; s/-/_/g'); \ | 56 | v=$$(t=$$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//; s/-/_/g'); \ | ||
| 57 | echo "$${t:-0.0.0}.r$$(git rev-list --count HEAD).g$$(git rev-parse --short HEAD)"); \ | 57 | echo "$${t:-0.0.0}.r$$(git rev-list --count HEAD).g$$(git rev-parse --short HEAD)"); \ | ||
| 58 | - | d=$$(mktemp -d /tmp/nefertty-pkg.XXXXXX); \ | 58 | + | d=$$(mktemp -d /tmp/nefertty-pkg.XXXXXX); trap 'rm -rf "$$d"' EXIT; \ |
| 59 | - | git archive --prefix=nefertty-$$v/ -o $$d/nefertty-$$v.tar.gz HEAD; \ | 59 | + | git archive --prefix=nefertty-$$v/ -o "$$d/nefertty-$$v.tar.gz" HEAD; \ |
| 60 | - | cp packaging/arch/PKGBUILD $$d/; \ | 60 | + | cp packaging/arch/PKGBUILD "$$d/"; \ |
| 61 | - | cd $$d && sed -i "s/^pkgver=.*/pkgver=$$v/; s/^sha256sums=.*/sha256sums=('$$(sha256sum *.tar.gz | cut -d' ' -f1)')/" PKGBUILD; \ | 61 | + | cd "$$d" && sed -i "s/^pkgver=.*/pkgver=$$v/; s/^sha256sums=.*/sha256sums=('$$(sha256sum *.tar.gz | cut -d' ' -f1)')/" PKGBUILD; \ |
| 62 | - | makepkg -f --noconfirm; mkdir -p $(CURDIR)/dist; mv *.pkg.tar.zst $(CURDIR)/dist/; cd /; rm -rf $$d | 62 | + | makepkg -f --noconfirm; mkdir -p $(CURDIR)/dist; rm -f $(CURDIR)/dist/nefertty-*.pkg.tar.zst; mv *.pkg.tar.zst $(CURDIR)/dist/ |
| 63 | @ls dist/*.pkg.tar.zst | 63 | @ls dist/*.pkg.tar.zst | ||
M README.md +2 -0
| @@ -31,6 +31,8 @@ NeferTTY depends on tagged releases of [purego-libwayland](https://github.com/bn | |||
| 31 | 31 | go work init . ../purego-libwayland ../purego-vulkan | |
| 32 | 32 | ``` | |
| 33 | 33 | ||
| 34 | + | `make pkg` ignores the workspace and builds the versions in `go.mod`: tag a binding change and update `go.mod` before packaging it. | |
| 35 | + | ||
| 34 | 36 | ## Configuration | |
| 35 | 37 | ||
| 36 | 38 | Configuration lives at `$XDG_CONFIG_HOME/nefertty/config` (or `~/.config/nefertty/config`). Use `nefertty --config path` to select another file; `nefertty validate-config [path]` checks it without starting the compositor. | |
| @@ -31,6 +31,8 @@ NeferTTY depends on tagged releases of [purego-libwayland](https://github.com/bn | |||||
| 31 | go work init . ../purego-libwayland ../purego-vulkan | 31 | go work init . ../purego-libwayland ../purego-vulkan | ||
| 32 | ``` | 32 | ``` | ||
| 33 | 33 | ||||
| 34 | + | `make pkg` ignores the workspace and builds the versions in `go.mod`: tag a binding change and update `go.mod` before packaging it. | |||
| 35 | + | ||||
| 34 | ## Configuration | 36 | ## Configuration | ||
| 35 | 37 | ||||
| 36 | Configuration lives at `$XDG_CONFIG_HOME/nefertty/config` (or `~/.config/nefertty/config`). Use `nefertty --config path` to select another file; `nefertty validate-config [path]` checks it without starting the compositor. | 38 | Configuration lives at `$XDG_CONFIG_HOME/nefertty/config` (or `~/.config/nefertty/config`). Use `nefertty --config path` to select another file; `nefertty validate-config [path]` checks it without starting the compositor. | ||
M cmd/nefertty/main.go +1 -1
| @@ -104,7 +104,7 @@ func run() error { | |||
| 104 | 104 | } | |
| 105 | 105 | v := info.Main.Version | |
| 106 | 106 | if version != "" { | |
| 107 | - | v = version // set by release builds (make dist) | |
| 107 | + | v = version // set by packaged builds (PKGBUILD -X main.version) | |
| 108 | 108 | } else if v == "" { | |
| 109 | 109 | v = "(devel)" | |
| 110 | 110 | } | |
| @@ -104,7 +104,7 @@ func run() error { | |||||
| 104 | } | 104 | } | ||
| 105 | v := info.Main.Version | 105 | v := info.Main.Version | ||
| 106 | if version != "" { | 106 | if version != "" { | ||
| 107 | - | v = version // set by release builds (make dist) | 107 | + | v = version // set by packaged builds (PKGBUILD -X main.version) |
| 108 | } else if v == "" { | 108 | } else if v == "" { | ||
| 109 | v = "(devel)" | 109 | v = "(devel)" | ||
| 110 | } | 110 | } | ||
M packaging/arch/PKGBUILD +1 -1
| @@ -19,7 +19,7 @@ sha256sums=('SKIP') | |||
| 19 | 19 | ||
| 20 | 20 | prepare() { | |
| 21 | 21 | cd "$pkgname-$pkgver" | |
| 22 | - | export GOFLAGS='-mod=mod' GOWORK=off GOTOOLCHAIN=local | |
| 22 | + | export GOPATH="$srcdir/gopath" GOFLAGS='-mod=readonly -modcacherw' GOWORK=off GOTOOLCHAIN=local | |
| 23 | 23 | go mod download | |
| 24 | 24 | go mod vendor | |
| 25 | 25 | } | |
| @@ -19,7 +19,7 @@ sha256sums=('SKIP') | |||||
| 19 | 19 | ||||
| 20 | prepare() { | 20 | prepare() { | ||
| 21 | cd "$pkgname-$pkgver" | 21 | cd "$pkgname-$pkgver" | ||
| 22 | - | export GOFLAGS='-mod=mod' GOWORK=off GOTOOLCHAIN=local | 22 | + | export GOPATH="$srcdir/gopath" GOFLAGS='-mod=readonly -modcacherw' GOWORK=off GOTOOLCHAIN=local |
| 23 | go mod download | 23 | go mod download | ||
| 24 | go mod vendor | 24 | go mod vendor | ||
| 25 | } | 25 | } | ||