- Add OBS manual service download_files

- Source Caddyfile and index.html from upstream
- Remove part of inaccurate description
- Package shell completion separately
- Generate shell completion during build
- Include manpages
- Remove compatibility with SLE-12
- Source buildable-artifact tar from github to embed version
  information (https://github.com/golang/go/issues/29228)
- Check binary with version subcommand
- Raise golang(API) required version

OBS-URL: https://build.opensuse.org/package/show/server:http/caddy?expand=0&rev=52
This commit is contained in:
Alexandre Vicenzi 2024-06-14 11:27:48 +00:00 committed by Git OBS Bridge
parent 4a98a1f8d6
commit fc007faedb
9 changed files with 465 additions and 1676 deletions

View File

@ -5,10 +5,10 @@
# #
# To use your own domain name (with automatic HTTPS), first make # To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to # sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace the line below with your # this machine's public IP, then replace ":80" below with your
# domain name. # domain name.
:80
:80 {
# Set this path to your site's directory. # Set this path to your site's directory.
root * /usr/share/caddy root * /usr/share/caddy
@ -20,6 +20,7 @@ file_server
# Or serve a PHP site through php-fpm: # Or serve a PHP site through php-fpm:
# php_fastcgi localhost:9000 # php_fastcgi localhost:9000
}
# Refer to the Caddy docs for more information: # Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile # https://caddyserver.com/docs/caddyfile

View File

@ -1,20 +1,8 @@
<services> <services>
<service name="tar_scm" mode="manual"> <service name="download_files" mode="manual"/>
<param name="url">https://github.com/caddyserver/caddy.git</param>
<param name="scm">git</param>
<param name="filename">caddy</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="versionrewrite-pattern">v(.*)</param>
<param name="revision">v2.8.4</param>
<param name="changesgenerate">enable</param>
</service>
<service mode="manual" name="set_version">
</service>
<service name="recompress" mode="manual">
<param name="file">*.tar</param>
<param name="compression">gz</param>
</service>
<service name="go_modules" mode="manual"> <service name="go_modules" mode="manual">
<param name="basename">./</param>
<param name="subdir">./</param>
</service> </service>
</services> </services>

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:3e0792d64cf4c30314f078dff742dac165ce347cf75a4b1d929a82df50e4f655 oid sha256:9e2125dda6200fc997d3965578e7b526e042857f2305261c02853775c04e1cf6
size 678314 size 10306476

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Fri Jun 14 10:21:50 UTC 2024 - Enrico Belleri <kilgore.trout@idesmi.eu>
- Add OBS manual service download_files
-------------------------------------------------------------------
Tue Jun 11 14:55:47 UTC 2024 - Enrico Belleri <kilgore.trout@idesmi.eu>
- Source Caddyfile and index.html from upstream
- Remove part of inaccurate description
- Package shell completion separately
- Generate shell completion during build
- Include manpages
- Remove compatibility with SLE-12
- Source buildable-artifact tar from github to embed version
information (https://github.com/golang/go/issues/29228)
- Check binary with version subcommand
- Raise golang(API) required version
------------------------------------------------------------------- -------------------------------------------------------------------
Sun Jun 02 14:15:59 UTC 2024 - Jeff Kowalczyk <jkowalczyk@suse.com> Sun Jun 02 14:15:59 UTC 2024 - Jeff Kowalczyk <jkowalczyk@suse.com>

View File

@ -16,14 +16,6 @@
# #
# 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
# If not redefined build fails with empty /usr/com not owned by any package
%if 0%{?suse_version} < 1500
%define _sharedstatedir /var/lib
%endif
Name: caddy Name: caddy
Version: 2.8.4 Version: 2.8.4
Release: 0 Release: 0
@ -31,17 +23,16 @@ Summary: Fast, multi-platform web server with automatic HTTPS
License: Apache-2.0 License: Apache-2.0
Group: Productivity/Networking/Web/Proxy Group: Productivity/Networking/Web/Proxy
URL: https://caddyserver.com/ URL: https://caddyserver.com/
Source0: %{name}-%{version}.tar.gz # bug https://github.com/golang/go/issues/29228
Source0: https://github.com/caddyserver/%{name}/releases/download/v%{version}/%{name}_%{version}_buildable-artifact.tar.gz#/%{name}-%{version}.tar.gz
Source1: vendor.tar.gz Source1: vendor.tar.gz
Source2: Caddyfile Source2: https://github.com/caddyserver/dist/raw/v%{version}/config/Caddyfile
Source3: caddy.service Source3: caddy.service
Source4: index.html Source4: https://github.com/caddyserver/dist/raw/v%{version}/welcome/index.html
Source5: bash-completion Source5: caddy.sysusers
Source6: zsh-completion
Source7: caddy.sysusers
BuildRequires: systemd-rpm-macros BuildRequires: systemd-rpm-macros
BuildRequires: sysuser-tools BuildRequires: sysuser-tools
BuildRequires: golang(API) >= 1.21 BuildRequires: golang(API) >= 1.22
%{?systemd_requires} %{?systemd_requires}
%{sysusers_requires} %{sysusers_requires}
@ -49,22 +40,47 @@ BuildRequires: golang(API) >= 1.21
Caddy is a powerful, extensible platform to serve your sites, services, and Caddy is a powerful, extensible platform to serve your sites, services, and
apps, written in Go. apps, written in Go.
It operates primarily at L4 (transport layer) and L7 (application layer) of %package bash-completion
the OSI model, though it has the ability to work with other layers. Summary: Bash Completion for %{name}
Group: System/Shells
Requires: bash-completion
Supplements: (%{name} and bash)
BuildArch: noarch
%description bash-completion
Bash completion script for %{name}, generated during the build.
%package zsh-completion
Summary: ZSH Completion for %{name}
Group: System/Shells
Supplements: (%{name} and zsh)
BuildArch: noarch
%description zsh-completion
ZSH completion script for %{name}, generated during the build.
%package fish-completion
Summary: Fish Completion for %{name}
Group: System/Shells
Supplements: (%{name} and fish)
BuildArch: noarch
%description fish-completion
Fish shell completion script for %{name}, generated during the build.
%prep %prep
%autosetup -a 1 %autosetup -a 1 -c
%build %build
# Build the binary. # Build the binary.
%ifnarch ppc64 %ifnarch ppc64
export GOFLAGS="-buildmode=pie" export GOFLAGS="-buildmode=pie"
%endif %endif
go build ./cmd/%{name} go build -v -x
%check %check
# execute the binary as a basic check # Execute binary and check version
./%{name} --help [[ "$(./%{name} version)" == "v%{version}" ]] || exit 1
%install %install
install -d %{buildroot}/%{_sbindir} install -d %{buildroot}/%{_sbindir}
@ -76,7 +92,7 @@ install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/%{name}/Caddyfile
# service # service
install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.service
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name} ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
install -Dpm0644 %{SOURCE7} %{buildroot}%{_sysusersdir}/%{name}.conf install -Dpm0644 %{SOURCE5} %{buildroot}%{_sysusersdir}/%{name}.conf
# data directory # data directory
install -d -m 0750 %{buildroot}%{_sharedstatedir}/%{name} install -d -m 0750 %{buildroot}%{_sharedstatedir}/%{name}
@ -85,10 +101,21 @@ install -d -m 0750 %{buildroot}%{_sharedstatedir}/%{name}
install -D -p -m 0644 %{SOURCE4} %{buildroot}%{_datadir}/%{name}/index.html install -D -p -m 0644 %{SOURCE4} %{buildroot}%{_datadir}/%{name}/index.html
# bash completion # bash completion
install -D -p -m 0644 %{SOURCE5} %{buildroot}%{_datadir}/bash-completion/completions/%{name} install -d -p -m 0755 %{buildroot}%{_datadir}/bash-completion/completions
install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_datadir}/zsh/site-functions/_%{name} ./%{name} completion bash > %{buildroot}%{_datadir}/bash-completion/completions/%{name}
%sysusers_generate_pre %{SOURCE7} %{name} %{name}.conf # zsh completion
install -d -p -m 0755 %{buildroot}%{_datadir}/zsh/site-functions
./%{name} completion zsh > %{buildroot}%{_datadir}/zsh/site-functions/_%{name}
# fish completion
install -d -p -m 0755 %{buildroot}%{_datadir}/fish/vendor_completions.d
./%{name} completion fish > %{buildroot}%{_datadir}/fish/vendor_completions.d/%{name}.fish
# man pages
./%{name} manpage --directory %{buildroot}%{_mandir}/man8
%sysusers_generate_pre %{SOURCE5} %{name} %{name}.conf
%pre -f %{name}.pre %pre -f %{name}.pre
%service_add_pre %{name}.service %service_add_pre %{name}.service
@ -106,6 +133,7 @@ install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_datadir}/zsh/site-functions/_%{n
%files %files
%license LICENSE %license LICENSE
%doc AUTHORS README.md %doc AUTHORS README.md
%{_mandir}/man8/caddy*.8%{?ext_man}
%{_bindir}/%{name} %{_bindir}/%{name}
%{_datadir}/%{name} %{_datadir}/%{name}
%{_unitdir}/%{name}.service %{_unitdir}/%{name}.service
@ -114,11 +142,14 @@ install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_datadir}/zsh/site-functions/_%{n
%dir %{_sysconfdir}/%{name} %dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/Caddyfile %config(noreplace) %{_sysconfdir}/%{name}/Caddyfile
%dir %attr(0750, %{name}, %{name}) %{_sharedstatedir}/%{name} %dir %attr(0750, %{name}, %{name}) %{_sharedstatedir}/%{name}
# filesystem owns all the parent directories here
%{_datadir}/bash-completion/completions/%{name} %files bash-completion
# own parent directories in case zsh is not installed %{_datadir}/bash-completion
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions %files fish-completion
%{_datadir}/zsh/site-functions/_%{name} %{_datadir}/fish
%files zsh-completion
%{_datadir}/zsh
%changelog %changelog

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:b7c720de94ae3f6e752f03e9f07b3304c3ee3ef0e9f68ec99642779a7c4db9a3 oid sha256:4b6de27cc755b38ce0fbb1bb41ad566de9c7d8aa3a5cd13ef3e670f4ff939bba
size 9782477 size 10210785

View File

@ -1,165 +0,0 @@
#compdef caddy
function _caddy {
local _line
_arguments -C \
"1: :(adapt build-info environ file-server fmt hash-password help list-modules reload reverse-proxy run start stop trust untrust validate version)" \
"*::arg:->args"
case $line[1] in
adapt)
__caddy_adapt
;;
build-info)
__caddy_build-info
;;
environ)
__caddy_environ
;;
file-server)
__caddy_file-server
;;
fmt)
__caddy_fmt
;;
hash-password)
__caddy_hash-password
;;
help)
__caddy_help
;;
list-modules)
__caddy_list-modules
;;
reload)
__caddy_reload
;;
reverse-proxy)
__caddy_reverse-proxy
;;
run)
__caddy_run
;;
start)
__caddy_start
;;
stop)
__caddy_stop
;;
trust)
__caddy_trust
;;
untrust)
__caddy_untrust
;;
validate)
__caddy_validate
;;
version)
__caddy_version
;;
esac
}
function __caddy_adapt {
_arguments \
"--pretty: :" \
"--validate: :" \
"--adapter: :_files" \
"--config: :_files" \
}
function __caddy_build-info {
}
function __caddy_environ {
}
function __caddy_file-server {
_arguments \
"--browse: :" \
"--templates: :" \
"--domain: :_files" \
"--listen: :_files" \
"--root: :_dirs" \
}
function __caddy_fmt {
_arguments \
"--overwrite: :" \
}
function __caddy_hash-password {
_arguments \
"--algorithm: :_files" \
"--plaintext: :_files" \
"--salt: :_files" \
}
function __caddy_help {
}
function __caddy_list-modules {
_arguments \
"--versions: :" \
}
function __caddy_reload {
_arguments \
"--adapter: :_files" \
"--config: :_files" \
"--address: :_files" \
}
function __caddy_reverse-proxy {
_arguments \
"--change-host-header: :" \
"--from: :_files" \
"--to: :_files" \
}
function __caddy_run {
_arguments \
"--environ: :" \
"--resume: :" \
"--watch: :" \
"--adapter: :_files" \
"--config: :_files" \
"--pingback: :_files" \
"--pidfile: :_files" \
}
function __caddy_start {
_arguments \
"--watch: :" \
"--adapter: :_files" \
"--config: :_files" \
"--pidfile: :_files" \
}
function __caddy_stop {
_arguments \
"--address: :_files" \
}
function __caddy_trust {
}
function __caddy_untrust {
_arguments \
"--ca: :_files" \
"--cert: :_files" \
}
function __caddy_validate {
_arguments \
"--config: :_files" \
"--adapter: :_files" \
}
function __caddy_version {
}
_caddy