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 6e74549783
commit b0f5ee7207
2 changed files with 67 additions and 13 deletions

View File

@ -1,8 +1,37 @@
-------------------------------------------------------------------
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> Wed Oct 18 17:30:09 UTC 2023 - Eyad Issa <eyadlorenzo@gmail.com>
- Use xz compression for vendor.tar - 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 <me@aoalmeida.com> Sun Oct 1 12:49:46 UTC 2023 - Alexandre Almeida <me@aoalmeida.com>

View File

@ -19,48 +19,73 @@
Name: doggo Name: doggo
Version: 0.5.7 Version: 0.5.7
Release: 0 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 License: GPL-3.0
URL: https://github.com/mr-karan/doggo URL: https://github.com/mr-karan/doggo
Source0: %{name}-%{version}.tar Source0: %{name}-%{version}.tar
Source1: vendor.tar.xz Source1: vendor.tar.xz
BuildRequires: golang(API) >= 1.20 BuildRequires: golang(API) >= 1.20
Suggests: %{name}-fish-completion
Suggests: %{name}-zsh-completion
%description %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 It outputs information in a neat concise manner and supports protocols
like DoH, DoT, DoQ, and DNSCrypt as well. 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 %prep
%autosetup -a1 %autosetup -a1
%build %build
export GOFLAGS="$GOFLAGS -buildmode=pie -mod=vendor" %ifnarch ppc64
export GOFLAGS="-buildmode=pie"
for BINARY in doggo api %endif
do go build ./cmd/%{name}
go build -trimpath -ldflags "-s -w -X main.buildVersion=%{version}" -o "bin/" -v "./cmd/${BINARY}/..." go build ./cmd/api
done
%install %install
install -d %{buildroot}%{_bindir} install -d %{buildroot}%{_bindir}
install -D bin/doggo %{buildroot}%{_bindir}/%{name} install -D %{name} %{buildroot}%{_bindir}/%{name}
install -D bin/api %{buildroot}%{_bindir}/%{name}-api install -D api %{buildroot}%{_bindir}/%{name}-api
install -Dm644 completions/%{name}.fish %{buildroot}%{_datadir}/fish/vendor_completions.d/%{name} install -Dm644 completions/%{name}.fish %{buildroot}%{_datadir}/fish/vendor_completions.d/%{name}
install -Dm644 completions/%{name}.zsh %{buildroot}%{_datadir}/zsh/site-functions/_%{name} install -Dm644 completions/%{name}.zsh %{buildroot}%{_datadir}/zsh/site-functions/_%{name}
%files %files
%license LICENSE %license LICENSE
%doc README.md %doc README.md
%{_bindir}/doggo %doc config-api-sample.toml
%{_bindir}/doggo-api %{_bindir}/%{name}
%{_bindir}/%{name}-api
%dir %{_datadir}/fish %dir %{_datadir}/fish
%dir %{_datadir}/fish/vendor_completions.d %dir %{_datadir}/fish/vendor_completions.d
%dir %{_datadir}/zsh %dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions %dir %{_datadir}/zsh/site-functions
%files fish-completion
%{_datadir}/fish/vendor_completions.d/%{name} %{_datadir}/fish/vendor_completions.d/%{name}
%files zsh-completion
%{_datadir}/zsh/site-functions/_%{name} %{_datadir}/zsh/site-functions/_%{name}
%changelog %changelog