www-servers/caddy: update to 2.9.1

Signed-off-by: Rahil Bhimjiani <me@rahil.rocks>
From: https://github.com/gentoo/gentoo/pull/41080
Signed-off-by: Zac Medico <zmedico@gentoo.org>
This commit is contained in:
Rahil Bhimjiani
2025-03-14 23:58:05 +05:30
committed by Zac Medico
parent cff18ab694
commit 56c19a17f2
2 changed files with 130 additions and 0 deletions

View File

@@ -7,3 +7,6 @@ DIST caddy-2.8.4.tar.gz 662064 BLAKE2B 77aa671c22e55dff6bab3d251fa9f0a082e41176b
DIST caddy-2.9.0-deps.tar.xz 10147016 BLAKE2B 3f33fa41cea04e47ef30f3eba5de7b88731154e1598fd37bc55cb63905a98c2c3ee1119a7b386b2c9f278465484c6d4d00dd8bc90962d472fe0acd559f8675fa SHA512 74124dcb80f87eff1d6834569ac3e8428d55b99044f6cac043f6e997e3b2de1e31089ab712c1b2f4fb0d64b6732291dd30316bfc92c6b9000bd2cda39b4d0a90
DIST caddy-2.9.0-docs.tar.gz 24713 BLAKE2B c022672d818bf56160a561c307bc2526f0e0c6cc920286a744fc800273c9240e2852955c8c7035edad7591a168a177bf5c15822bbaee8704c4c3ca44bc44314d SHA512 f6f8a8d465373b4b2672bdf5a8124d3cedc90c8eea933f1494e6e6eab85ee788320a04c6ca7ccedac0ecbb8a335e0e179a8dd4ba07aeca685f297e525d21c368
DIST caddy-2.9.0.tar.gz 700749 BLAKE2B 299e5bcda972af0b50d51c135a844221222fef91a1b38d9fda70113087f3587253c8c1d6efda1895a1b64a42444b4d95cd4a80822bc9af7979b55b93b3e6a492 SHA512 e2e7f38d11a69159ef347acb93779a35778267440d55a80b90da75739aabc95ee385fb9256eb79e25326d5e16cf831746d98dc03ccfe97e11d8d52f521154a68
DIST caddy-2.9.1-deps.tar.xz 10115764 BLAKE2B a5dbfe050f1e71dd40feea375f93ef94a31bd75dd6605e460265351719130be04e3883523e550256fe03dd976dbf117292b5f9f44ce8c70030c0f9def423ebb2 SHA512 5a794d5afff72eed255badfcb4043e4714a47ed44ad724d16cf6d3f5b73015700951cf67c3f4d7916a44553ad3c0e629d0f257fe6132dcfd8f882c914a04b1af
DIST caddy-2.9.1-docs.tar.gz 24734 BLAKE2B 5c9dd78cd43cd2960f477f1fa89b8a6c4fc4e3d2c1b656051bde06afed8bebf5d1768fff77aab9fd8d5260044159e09e70474dd678cff245632fa7e14dcf05a0 SHA512 91efb7b10f68ab5e6bbfd2789a6f79c325d20692cb84a7651cce0487c97cd7699929e351ca78922ad34716958ebbf9b237e97465abdb263592745f4529cb4909
DIST caddy-2.9.1.tar.gz 701830 BLAKE2B cb36a2dae6f5944ebe44e4233e1e558389394c2176725c8f771d98a69c81de523fa04aed504a9ab7ae97fea4dce7c774d62b799a255a2af658d8677e8c079471 SHA512 2ed36bfe8de3a2c7270e202b2d9ab4c3c78174fcd09c02e38d61d1bd57afa6471a2a690f15edcf91f2bfb105dbf2b0c2186d0c5e6f20ec169e98c66f8f71d0f8

View File

@@ -0,0 +1,127 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit fcaps go-module systemd shell-completion
DESCRIPTION="Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS"
HOMEPAGE="https://caddyserver.com"
if [[ "${PV}" == 9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/caddyserver/caddy.git"
else
SRC_URI="
https://github.com/caddyserver/caddy/archive/v${PV}.tar.gz -> ${P}.tar.gz
https://github.com/rahilarious/gentoo-distfiles/releases/download/${P}/deps.tar.xz -> ${P}-deps.tar.xz
https://github.com/caddyserver/dist/archive/refs/tags/v${PV}.tar.gz -> ${P}-docs.tar.gz
"
KEYWORDS="~amd64 ~arm64 ~loong ~riscv"
fi
# MAIN
LICENSE="Apache-2.0"
# deps
LICENSE+=" BSD ECL-2.0 MIT CC0-1.0"
SLOT="0"
IUSE='events-handlers-exec security'
RESTRICT="test"
RDEPEND="
acct-user/http
acct-group/http"
DEPEND="${RDEPEND}"
FILECAPS=(
-m 755 'cap_net_bind_service=+ep' usr/bin/"${PN}"
)
# takes a module as an only arg
add_custom_module() {
local LINE_NO=$(grep -n 'plug in Caddy modules here' cmd/caddy/main.go | awk -F: '{print $1;}' || die)
sed -i -e "${LINE_NO:?}a \ _ \"$1\"" cmd/caddy/main.go || die
}
src_unpack() {
declare -A MOOMODULES || die
use events-handlers-exec && { MOOMODULES[exec]="github.com/mholt/caddy-events-exec" || die ; }
use security && { MOOMODULES[sec]="github.com/greenpau/caddy-security" || die ; }
export MY_MODULES="${MOOMODULES[@]}" || die
if [[ "${PV}" == 9999* ]]; then
# clone main git repo
git-r3_src_unpack
# get extra modules
pushd "${P}" || die
for moo in ${MY_MODULES}; do
add_custom_module "${moo}"
ego get "${moo}"
done
popd || die
# clone dist repo (docs and misc)
EGIT_REPO_URI="https://github.com/caddyserver/dist.git"
EGIT_CHECKOUT_DIR="${WORKDIR}/dist-${PV}"
git-r3_src_unpack
go-module_live_vendor
else
default
fi
}
src_prepare() {
default
sed -i -e "s|User=caddy|User=http|g;s|Group=caddy|Group=http|g;" ../dist-*/init/*service || die
if [[ "${PV}" != 9999* ]]; then
ln -sv ../vendor ./ || die
eapply ../go-mod-sum.patch
for moo in ${MY_MODULES}; do
add_custom_module "${moo}"
done
fi
}
src_compile() {
# https://github.com/caddyserver/caddy/blob/master/caddy.go#L843
if [[ ${PV} == 9999* ]]; then
local CUSTOM_VER="git-$(git rev-parse --short HEAD)"
else
local CUSTOM_VER="${PV}"
fi
ego build -ldflags "-X github.com/caddyserver/caddy/v2.CustomVersion=${CUSTOM_VER}" ./cmd/caddy
local sh
for sh in bash fish zsh; do
./caddy completion "${sh}" > completion."${sh}" || die
done
./caddy manpage -o manpages || die
}
src_install() {
default
dobin "${PN}"
insinto /etc/"${PN}"
doins ../dist-*/config/Caddyfile
systemd_dounit ../dist-*/init/*.service
newinitd "${FILESDIR}"/initd-2.7.5 "${PN}"
newconfd "${FILESDIR}"/confd-2.7.5 "${PN}"
insinto /etc/logrotate.d
newins "${FILESDIR}/logrotated" "${PN}"
insinto /usr/share/"${PN}"
doins ../dist-*/welcome/index.html
newbashcomp completion.bash "${PN}"
newfishcomp completion.fish "${PN}".fish
newzshcomp completion.zsh _"${PN}"
newdoc ../dist-*/init/README.md systemd-services-README.md
doman manpages/*
}