From 6ff09ab0e841840dfc547cadf632de00cb3125b04c753d1b9ce9d7a2fb002643 Mon Sep 17 00:00:00 2001 From: Jeff Kowalczyk Date: Fri, 20 Oct 2023 03:42:49 +0000 Subject: [PATCH] Accepting request 1118746 from home:jfkw:branches:devel:languages:go - Packaging improvements: * Use subpackages for fish-completion and zsh-completion. Upstream currently has no bash completion scripts. Fish and zsh subpackages are marked Suggests: and not installed by default. If a bash-completion subpackage becomes available, we should install that by default. * Build PIE with pattern that may become recommended procedure: %%ifnarch ppc64 GOFLAGS="-buildmode=pie" %%endif go build A go toolchain buildmode default config would be preferable but none exist at this time. * Remove ldflags -X entries for upstream import path and version. This information is embedded in binaries with go1.18+ and available via go version -m or runtime/debug.ReadBuildInfo(). * Remove ldflags -s (Omit symbol table and debug info) and -w (Omit DWARF symbol table). This information is used to produce separate debuginfo packages and binaries are stripped for reduced size by GNU strip during RPM build. * Drop mod=vendor, go1.14+ will detect vendor dir and auto-enable * Use %%name macro where applicable to normalize common lines across Go app packages. Also makes renaming binary easier when required to handle package name conflict. * Remove bash loop for two paramaterized calls of go build. The loop technique is nice for large lists, but making the two go build calls explicit seems a better readability tradeoff. * Add sample API config as doc OBS-URL: https://build.opensuse.org/request/show/1118746 OBS-URL: https://build.opensuse.org/package/show/devel:languages:go/doggo?expand=0&rev=2 --- doggo.changes | 31 ++++++++++++++++++++++++++++++- doggo.spec | 49 +++++++++++++++++++++++++++++++++++++------------ 2 files changed, 67 insertions(+), 13 deletions(-) diff --git a/doggo.changes b/doggo.changes index 36ddc34..7c2ff86 100644 --- a/doggo.changes +++ b/doggo.changes @@ -1,8 +1,37 @@ +------------------------------------------------------------------- +Wed Oct 18 19:10:28 UTC 2023 - Jeff Kowalczyk + +- Packaging improvements: + * Use subpackages for fish-completion and zsh-completion. + Upstream currently has no bash completion scripts. Fish and zsh + subpackages are marked Suggests: and not installed by default. + If a bash-completion subpackage becomes available, we should + install that by default. + * Build PIE with pattern that may become recommended procedure: + %%ifnarch ppc64 GOFLAGS="-buildmode=pie" %%endif go build + A go toolchain buildmode default config would be preferable + but none exist at this time. + * Remove ldflags -X entries for upstream import path and version. + This information is embedded in binaries with go1.18+ and + available via go version -m or runtime/debug.ReadBuildInfo(). + * Remove ldflags -s (Omit symbol table and debug info) and -w + (Omit DWARF symbol table). This information is used to produce + separate debuginfo packages and binaries are stripped for + reduced size by GNU strip during RPM build. + * Drop mod=vendor, go1.14+ will detect vendor dir and auto-enable + * Use %%name macro where applicable to normalize common lines + across Go app packages. Also makes renaming binary easier when + required to handle package name conflict. + * Remove bash loop for two paramaterized calls of go build. + The loop technique is nice for large lists, but making the two + go build calls explicit seems a better readability tradeoff. + * Add sample API config as doc + ------------------------------------------------------------------- Wed Oct 18 17:30:09 UTC 2023 - Eyad Issa - Use xz compression for vendor.tar -- Use obscpio instead of tar for disk storage efficency +- Use obscpio instead of tar for disk storage efficency ------------------------------------------------------------------- Sun Oct 1 12:49:46 UTC 2023 - Alexandre Almeida diff --git a/doggo.spec b/doggo.spec index dd578cf..1387ddb 100644 --- a/doggo.spec +++ b/doggo.spec @@ -19,48 +19,73 @@ Name: doggo Version: 0.5.7 Release: 0 -Summary: Command-line DNS Client for Humans. Written in Golang +Summary: CLI tool and API server DNS client implemented in Go License: GPL-3.0 URL: https://github.com/mr-karan/doggo Source0: %{name}-%{version}.tar Source1: vendor.tar.xz BuildRequires: golang(API) >= 1.20 +Suggests: %{name}-fish-completion +Suggests: %{name}-zsh-completion %description -doggo is a modern command-line DNS client (like dig) written in Golang. +doggo is a modern command-line DNS client (like dig) implemented in Go. It outputs information in a neat concise manner and supports protocols like DoH, DoT, DoQ, and DNSCrypt as well. +%package fish-completion +Summary: fish completion for %{name} +Group: System/Shells +Requires: fish-completion +Supplements: (%{name} and fish-completion) +BuildArch: noarch + +%description fish-completion +fish completion scripts for %{name} + +%package zsh-completion +Summary: zsh completion for %{name} +Group: System/Shells +Requires: zsh-completion +Supplements: (%{name} and zsh-completion) +BuildArch: noarch + +%description zsh-completion +zsh completion scripts for %{name} + %prep %autosetup -a1 %build -export GOFLAGS="$GOFLAGS -buildmode=pie -mod=vendor" - -for BINARY in doggo api -do - go build -trimpath -ldflags "-s -w -X main.buildVersion=%{version}" -o "bin/" -v "./cmd/${BINARY}/..." -done +%ifnarch ppc64 +export GOFLAGS="-buildmode=pie" +%endif +go build ./cmd/%{name} +go build ./cmd/api %install install -d %{buildroot}%{_bindir} -install -D bin/doggo %{buildroot}%{_bindir}/%{name} -install -D bin/api %{buildroot}%{_bindir}/%{name}-api +install -D %{name} %{buildroot}%{_bindir}/%{name} +install -D api %{buildroot}%{_bindir}/%{name}-api install -Dm644 completions/%{name}.fish %{buildroot}%{_datadir}/fish/vendor_completions.d/%{name} install -Dm644 completions/%{name}.zsh %{buildroot}%{_datadir}/zsh/site-functions/_%{name} %files %license LICENSE %doc README.md -%{_bindir}/doggo -%{_bindir}/doggo-api +%doc config-api-sample.toml +%{_bindir}/%{name} +%{_bindir}/%{name}-api %dir %{_datadir}/fish %dir %{_datadir}/fish/vendor_completions.d %dir %{_datadir}/zsh %dir %{_datadir}/zsh/site-functions +%files fish-completion %{_datadir}/fish/vendor_completions.d/%{name} + +%files zsh-completion %{_datadir}/zsh/site-functions/_%{name} %changelog