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
This commit is contained in:
parent
aee71f07fa
commit
75bea2c98f
@ -1,3 +1,27 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 6 13:22:22 UTC 2024 - Jeff Kowalczyk <jkowalczyk@suse.com>
|
||||
|
||||
- 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 <dimstar@opensuse.org>
|
||||
|
||||
|
24
caddy.spec
24
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
|
||||
|
Loading…
Reference in New Issue
Block a user