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
This commit is contained in:
Jeff Kowalczyk 2023-10-20 03:42:49 +00:00 committed by Git OBS Bridge
parent 0d4cf6391d
commit 6ff09ab0e8
2 changed files with 67 additions and 13 deletions

View File

@ -1,3 +1,32 @@
-------------------------------------------------------------------
Wed Oct 18 19:10:28 UTC 2023 - Jeff Kowalczyk <jkowalczyk@suse.com>
- 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 <eyadlorenzo@gmail.com>

View File

@ -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