From aee71f07fa2d91ee7b9d42c8881ba5727ee36e09756718458346317db616d75f Mon Sep 17 00:00:00 2001 From: Alexandre Vicenzi Date: Tue, 6 Feb 2024 08:54:28 +0000 Subject: [PATCH 1/2] Accepting request 1144504 from home:dimstar:Factory - Drop deprecated go_provides macro: even though it tries to guard on suse_version <= 1110, it has entirely disarms the dep scanner. - Remove the manual user/group provides: the package uses sysusers.d; the auto-provides were not working due to the broken go_provides. OBS-URL: https://build.opensuse.org/request/show/1144504 OBS-URL: https://build.opensuse.org/package/show/server:http/caddy?expand=0&rev=43 --- caddy.changes | 9 +++++++++ caddy.spec | 5 ----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/caddy.changes b/caddy.changes index fb3c621..474fdd7 100644 --- a/caddy.changes +++ b/caddy.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Tue Feb 6 08:23:06 UTC 2024 - Dominique Leuenberger + +- Drop deprecated go_provides macro: even though it tries to guard + on suse_version <= 1110, it has entirely disarms the dep scanner. +- Remove the manual user/group provides: the package uses + sysusers.d; the auto-provides were not working due to the broken + go_provides. + ------------------------------------------------------------------- Mon Feb 5 13:40:52 UTC 2024 - Alexandre Vicenzi diff --git a/caddy.spec b/caddy.spec index e8b31c4..517f9ac 100644 --- a/caddy.spec +++ b/caddy.spec @@ -47,13 +47,8 @@ BuildRequires: golang-packaging BuildRequires: systemd-rpm-macros BuildRequires: sysuser-tools BuildRequires: golang(API) >= 1.20 -Provides: group(%{gname}) -Provides: user(%{uname}) %{?systemd_requires} %{sysusers_requires} -%{go_provides} -# Make sure that the binary is not getting stripped. -%{go_nostrip} %description Caddy is a powerful, extensible platform to serve your sites, services, and From 75bea2c98f1bd8168edcec220f5c987c68bdab7cf713f5210b295a0e2048fd0b Mon Sep 17 00:00:00 2001 From: Alexandre Vicenzi Date: Tue, 6 Feb 2024 15:10:28 +0000 Subject: [PATCH 2/2] Accepting request 1144628 from home:jfkw:branches:server:http - Packaging improvements: * Remove define github project name components no longer needed * Remove define gname and uname for user and group creation, use package name macro with identical value * Drop BuildRequires: golang-packaging. The original macros for file movements into GOPATH are obsolete with Go modules. Macro go_nostrip is no longer needed with current binutils and Go. * Use autosetup -a 1 to unpack source and vendored dependencies * Drop export CGO_ENABLED="0". Use the default unless there is a defined requirement or benefit. * 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. * Drop mod=vendor, go1.14+ will detect vendor dir and auto-enable * 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. * Add basic %check to execute binary --help OBS-URL: https://build.opensuse.org/request/show/1144628 OBS-URL: https://build.opensuse.org/package/show/server:http/caddy?expand=0&rev=44 --- caddy.changes | 24 ++++++++++++++++++++++++ caddy.spec | 24 ++++++++++-------------- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/caddy.changes b/caddy.changes index 474fdd7..7947dbc 100644 --- a/caddy.changes +++ b/caddy.changes @@ -1,3 +1,27 @@ +------------------------------------------------------------------- +Tue Feb 6 13:22:22 UTC 2024 - Jeff Kowalczyk + +- Packaging improvements: + * Remove define github project name components no longer needed + * Remove define gname and uname for user and group creation, use + package name macro with identical value + * Drop BuildRequires: golang-packaging. The original macros for + file movements into GOPATH are obsolete with Go modules. Macro + go_nostrip is no longer needed with current binutils and Go. + * Use autosetup -a 1 to unpack source and vendored dependencies + * Drop export CGO_ENABLED="0". Use the default unless there is a + defined requirement or benefit. + * 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. + * Drop mod=vendor, go1.14+ will detect vendor dir and auto-enable + * 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. + * Add basic %check to execute binary --help + ------------------------------------------------------------------- Tue Feb 6 08:23:06 UTC 2024 - Dominique Leuenberger diff --git a/caddy.spec b/caddy.spec index 517f9ac..a9ca918 100644 --- a/caddy.spec +++ b/caddy.spec @@ -16,10 +16,6 @@ # -%define project github.com/caddyserver/caddy -%define gname caddy -%define uname caddy - # SLE-12 _sharedstatedir was /usr/com, _localstatedir is /var as expected # SLE-15+ _sharedstatedir is /var/lib, _localstatedir is /var # _sharedstatedir used here as home directory for newly created user caddy @@ -43,7 +39,6 @@ Source4: index.html Source5: bash-completion Source6: zsh-completion Source7: caddy.sysusers -BuildRequires: golang-packaging BuildRequires: systemd-rpm-macros BuildRequires: sysuser-tools BuildRequires: golang(API) >= 1.20 @@ -58,17 +53,18 @@ It operates primarily at L4 (transport layer) and L7 (application layer) of the OSI model, though it has the ability to work with other layers. %prep -%setup -q +%autosetup -a 1 %build -%{goprep} %{project} +# Build the binary. +%ifnarch ppc64 +export GOFLAGS="-buildmode=pie" +%endif +go build ./cmd/%{name} -# tarball causes "inconsistent vendoring" -tar -xf %{SOURCE1} - -CGO_ENABLED=0 - -go build -v -buildmode=pie -mod=vendor -ldflags "-s -w" -o caddy cmd/caddy/main.go +%check +# execute the binary as a basic check +./%{name} --help %sysusers_generate_pre %{SOURCE7} %{name} %{name}.conf @@ -117,7 +113,7 @@ install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_datadir}/zsh/site-functions/_%{n %{_sysusersdir}/%{name}.conf %dir %{_sysconfdir}/%{name} %config(noreplace) %{_sysconfdir}/%{name}/Caddyfile -%dir %attr(0750, %{uname}, %{gname}) %{_sharedstatedir}/%{name} +%dir %attr(0750, %{name}, %{name}) %{_sharedstatedir}/%{name} # filesystem owns all the parent directories here %{_datadir}/bash-completion/completions/%{name} # own parent directories in case zsh is not installed