From e145c0a975b31134abc6dd39981c35a635890775 Mon Sep 17 00:00:00 2001 From: Patrick Pichler Date: Thu, 15 Apr 2021 15:44:37 +0200 Subject: [PATCH] caddy: upgrade to 2.4.3 As there is currently a bug with go build info a patch is needed to fix printing the correct version number of the binary. Once the bug is fixed, the patch can be dropped. Fixes #22092 --- srcpkgs/caddy/INSTALL | 2 +- srcpkgs/caddy/INSTALL.md | 3 +++ srcpkgs/caddy/files/Caddyfile | 1 + srcpkgs/caddy/files/caddy/run | 6 +++--- .../caddy/patches/fix_version_command.patch | 21 +++++++++++++++++++ srcpkgs/caddy/template | 20 +++++++++++------- 6 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 srcpkgs/caddy/INSTALL.md create mode 100644 srcpkgs/caddy/files/Caddyfile create mode 100644 srcpkgs/caddy/patches/fix_version_command.patch diff --git a/srcpkgs/caddy/INSTALL b/srcpkgs/caddy/INSTALL index db063595f436..202af2396ee7 100644 --- a/srcpkgs/caddy/INSTALL +++ b/srcpkgs/caddy/INSTALL @@ -1,6 +1,6 @@ case "${ACTION}" in post) - setcap CAP_NET_BIND_SERVICE=+ep usr/bin/caddy + setcap CAP_NET_BIND_SERVICE=+ep bin/caddy chown -R caddy:caddy etc/caddy ;; esac diff --git a/srcpkgs/caddy/INSTALL.md b/srcpkgs/caddy/INSTALL.md new file mode 100644 index 000000000000..2b425ede6ea6 --- /dev/null +++ b/srcpkgs/caddy/INSTALL.md @@ -0,0 +1,3 @@ +WARNING: The config syntax has changed from caddy 1.x to 2.x + +Be sure to upgrade all your configuration files! diff --git a/srcpkgs/caddy/files/Caddyfile b/srcpkgs/caddy/files/Caddyfile new file mode 100644 index 000000000000..8b137891791f --- /dev/null +++ b/srcpkgs/caddy/files/Caddyfile @@ -0,0 +1 @@ + diff --git a/srcpkgs/caddy/files/caddy/run b/srcpkgs/caddy/files/caddy/run index ff0cc9c80306..c8670fa67b69 100644 --- a/srcpkgs/caddy/files/caddy/run +++ b/srcpkgs/caddy/files/caddy/run @@ -2,7 +2,7 @@ [ -r ./conf ] && . ./conf -export CADDYPATH=/var/lib/caddy +export HOME=/var/lib/caddy ulimit -n ${MAX_OPEN_FILES:-8192} -cd /etc/caddy -exec chpst -u caddy caddy + +exec chpst -u caddy caddy run --config ${CONFFILE:-/etc/caddy/Caddyfile} diff --git a/srcpkgs/caddy/patches/fix_version_command.patch b/srcpkgs/caddy/patches/fix_version_command.patch new file mode 100644 index 000000000000..a55d571574b3 --- /dev/null +++ b/srcpkgs/caddy/patches/fix_version_command.patch @@ -0,0 +1,21 @@ +*** caddy.go.bkp 2021-06-30 20:00:39.914085640 +0200 +--- caddy.go 2021-06-30 20:02:48.007142966 +0200 +*************** func goModule(mod *debug.Module) *debug. +*** 711,726 **** + mod.Version = "unknown" +- bi, ok := debug.ReadBuildInfo() +- if ok { +- mod.Path = bi.Main.Path +- // The recommended way to build Caddy involves +- // creating a separate main module, which +- // TODO: track related Go issue: https://github.com/golang/go/issues/29228 +- // once that issue is fixed, we should just be able to use bi.Main... hopefully. +- for _, dep := range bi.Deps { +- if dep.Path == ImportPath { +- return dep +- } +- } +- return &bi.Main +- } + return mod +--- 711,712 ---- diff --git a/srcpkgs/caddy/template b/srcpkgs/caddy/template index 6fe986419c94..31a10e2928b3 100644 --- a/srcpkgs/caddy/template +++ b/srcpkgs/caddy/template @@ -1,28 +1,32 @@ # Template file for 'caddy' pkgname=caddy -version=1.0.5 +version=2.4.3 revision=1 build_style=go -# XXX: use caddy/v2 when updating -go_import_path=github.com/caddyserver/caddy -go_package="${go_import_path}/caddy" -hostmakedepends="git" +go_import_path=github.com/caddyserver/caddy/v2 +go_package="${go_import_path}/cmd/caddy" short_desc="Fast, cross-platform HTTP/2 web server with automatic HTTPS" maintainer="Dominic Monroe " license="Apache-2.0" homepage="https://caddyserver.com" distfiles="https://github.com/caddyserver/caddy/archive/v${version}.tar.gz" -checksum=0e7dc07e4f61f9a00a4c962755098e19ebf8c8a8e0d72e311597ce021b7a2a5e +checksum=10317b5ab7bee861631a8d94d13aeafb62e9665759271a6c65422a70d6584d6b system_accounts="caddy" +caddy_homedir="/var/lib/caddy" +caddy_descr="caddy daemon" + +conf_files="/etc/caddy/Caddyfile" + make_dirs=" /etc/caddy 0700 caddy caddy /var/lib/caddy 0700 caddy caddy" -pre_build() { - vsed -e 's,var EnableTelemetry = true,var EnableTelemetry = false,g' -i caddy/caddymain/run.go +post_extract() { + vsed -e "s,unknown,${version},g" -i ${wrksrc}/caddy.go } post_install() { vsv caddy + vinstall ${FILESDIR}/Caddyfile 600 etc/caddy }