commit:     742ee61180552eb76f30327ea8e3ec7a02ab114a
Author:     Rahil Bhimjiani <me <AT> rahil <DOT> rocks>
AuthorDate: Tue Apr  9 08:38:55 2024 +0000
Commit:     Rahil Bhimjiani <rahil3108 <AT> gmail <DOT> com>
CommitDate: Tue Apr  9 08:38:55 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=742ee611

net-dns/AdGuardHome: update to 0.107.48, xz->zstd, build frontend

* Instead of using prebuilt frontend, build it from source

Signed-off-by: Rahil Bhimjiani <me <AT> rahil.rocks>

 net-dns/AdGuardHome/AdGuardHome-0.107.48.ebuild | 153 ++++++++++++++++++++++++
 net-dns/AdGuardHome/Manifest                    |   3 +
 2 files changed, 156 insertions(+)

diff --git a/net-dns/AdGuardHome/AdGuardHome-0.107.48.ebuild 
b/net-dns/AdGuardHome/AdGuardHome-0.107.48.ebuild
new file mode 100644
index 0000000000..65f97c53fb
--- /dev/null
+++ b/net-dns/AdGuardHome/AdGuardHome-0.107.48.ebuild
@@ -0,0 +1,153 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit fcaps go-module readme.gentoo-r1 systemd unpacker
+
+DESCRIPTION="Network-wide ads & trackers blocking DNS server like Pi-Hole with 
web ui"
+HOMEPAGE="https://github.com/AdguardTeam/AdGuardHome/";
+
+WIKI_COMMIT="7964837"
+SRC_URI="
+       https://github.com/AdguardTeam/${PN}/archive/refs/tags/v${PV}.tar.gz -> 
${P}.tar.gz
+       
https://github.com/rahilarious/gentoo-distfiles/releases/download/${P}/deps.tar.zst
 -> ${P}-deps.tar.zst
+       
https://github.com/rahilarious/gentoo-distfiles/releases/download/${PN}-0.107.46/wiki.tar.xz
 -> ${PN}-wiki-${WIKI_COMMIT}.tar.xz
+       web? ( 
https://github.com/rahilarious/gentoo-distfiles/releases/download/${P}/npm-deps.tar.zst
 -> ${P}-npm-deps.tar.zst )
+"
+
+# main
+LICENSE="GPL-3"
+# deps
+LICENSE+=" Apache-2.0 BSD BSD-2 MIT ZLIB"
+
+SLOT="0"
+KEYWORDS="~amd64 ~arm64"
+
+IUSE="+web"
+# RESTRICT="test"
+
+BDEPEND="
+       $(unpacker_src_uri_depends)
+       >=dev-lang/go-1.22.2
+       web? ( net-libs/nodejs[npm] )
+"
+
+FILECAPS=(
+       -m 755 'cap_net_bind_service=+eip cap_net_raw=+eip' usr/bin/${PN}
+)
+
+PATCHES=(
+       "${FILESDIR}"/disable-update-cmd-opt.patch
+)
+
+DOCS="
+       ../${PN,,}.wiki/*
+"
+
+DOC_CONTENTS="\n
+User is advised to not run binary directly instead use systemd service\n\n
+Defaults for systemd service:\n
+Web UI: 0.0.0.0:3000\n
+Data directory: /var/lib/${PN}\n
+Default config: /var/lib/${PN}/${PN}.yaml
+"
+src_unpack() {
+       # because we're using  vendor/ so we don't need go-module_src_unpack
+       unpacker_src_unpack
+}
+
+src_prepare() {
+       ln -sv ../vendor ./ || die
+
+       default
+
+       if use web; then
+               # mimicking `make js-deps`
+               export npm_config_cache="${WORKDIR}/npm-cache" 
NODE_OPTIONS=--openssl-legacy-provider || die
+               npm --verbose --offline --prefix client/ --no-progress 
--ignore-engines --ignore-optional --ignore-platform --ignore-scripts ci || die
+       fi
+}
+
+src_compile() {
+       # mimicking `make js-build`
+       use web && npm --verbose --offline --prefix client run build-prod || die
+
+       # mimicking 
https://github.com/AdguardTeam/AdGuardHome/blob/master/scripts/make/go-build.sh
+
+       local MY_LDFLAGS="-s -w"
+       MY_LDFLAGS+=" -X 
github.com/AdguardTeam/AdGuardHome/internal/version.version=${PV}"
+       MY_LDFLAGS+=" -X 
github.com/AdguardTeam/AdGuardHome/internal/version.channel=release"
+       MY_LDFLAGS+=" -X 
github.com/AdguardTeam/AdGuardHome/internal/version.committime=$(date +%s)"
+       if [ "$(go env GOARM)" != '' ]
+       then
+               MY_LDFLAGS+=" -X 
github.com/AdguardTeam/AdGuardHome/internal/version.goarm=$(go env GOARM)"
+       elif [ "$(go env GOMIPS)" != '' ]
+       then
+               MY_LDFLAGS+=" -X 
github.com/AdguardTeam/AdGuardHome/internal/version.gomips=$(go env GOMIPS)"
+       fi
+
+       ego build -ldflags "${MY_LDFLAGS}" -trimpath -v=1 -x=1
+}
+
+src_test() {
+
+       # mimicking 
https://github.com/AdguardTeam/AdGuardHome/blob/master/scripts/make/go-test.sh
+       count_flags='--count=1'
+       cover_flags='--coverprofile=./coverage.txt'
+       shuffle_flags='--shuffle=on'
+       timeout_flags="--timeout=30s"
+       fuzztime_flags="--fuzztime=20s"
+       readonly count_flags cover_flags shuffle_flags timeout_flags 
fuzztime_flags
+
+       # race only works when pie is disabled
+       export GOFLAGS="${GOFLAGS/-buildmode=pie/}"
+
+       # following test is failing without giving any reason. Tried disabling 
internal/updater internal/whois tests toggling race, but still failing.
+       # ego test\
+       #         "$count_flags"\
+       #         "$cover_flags"\
+       #         "$shuffle_flags"\
+       #         --race=1\
+       #         "$timeout_flags"\
+       #         ./...
+
+       # mimicking 
https://github.com/AdguardTeam/AdGuardHome/blob/master/scripts/make/go-bench.sh
+       ego test\
+                 "$count_flags"\
+                 "$shuffle_flags"\
+                 --race=0\
+                 "$timeout_flags"\
+                 --bench='.'\
+                 --benchmem\
+                 --benchtime=1s\
+                 --run='^$'\
+                 ./...
+
+       # mimicking 
https://github.com/AdguardTeam/AdGuardHome/blob/master/scripts/make/go-fuzz.sh
+       ego test\
+                 "$count_flags"\
+                 "$shuffle_flags"\
+                 --race=0\
+                 "$timeout_flags"\
+                 "$fuzztime_flags"\
+                 --fuzz='.'\
+                 --run='^$'\
+                 ./internal/filtering/rulelist/\
+               ;
+
+}
+
+src_install() {
+       dobin "${PN}"
+       dosym -r /usr/bin/"${PN}" /usr/bin/adguardhome
+
+       einstalldocs
+       readme.gentoo_create_doc
+
+       systemd_newunit "${FILESDIR}"/AdGuardHome-0.107.43.service 
"${PN}".service
+}
+
+pkg_postinst() {
+       readme.gentoo_print_elog
+}

diff --git a/net-dns/AdGuardHome/Manifest b/net-dns/AdGuardHome/Manifest
index 9753fd25ce..8838d320bf 100644
--- a/net-dns/AdGuardHome/Manifest
+++ b/net-dns/AdGuardHome/Manifest
@@ -4,4 +4,7 @@ DIST AdGuardHome-0.107.45.tar.gz 2248687 BLAKE2B 
257fbd716d769657c9b40a03f91f7dc
 DIST AdGuardHome-0.107.46-deps.tar.xz 2617456 BLAKE2B 
b53495335b348bcc86dd1c03765e14e6d30a85a60405179d5de9105ebc83ffc39dc035ff6c58adec9f92dfe3dee9714a563372f16902e8c8956b32926b4b117c
 SHA512 
15b7521f038914757ff9e72f441b78957750a26730041adea57488548711402b76a642ae49fc970f69aea84e5d033a146fd201cb8707c0de099be096ae68a81c
 DIST AdGuardHome-0.107.46-frontend.tar.gz 2791684 BLAKE2B 
086826322a3cfa799081bc7b67ae91f7222cb4fa020e0be51ab6f46cb862edca967289f66747dc95f287a48e342e91156f9d155e1080aa2ca02b342223ce8192
 SHA512 
b4b9b5f9dfae16af9b6a77ca70226ad30e7ecf7eff883bf071304b4a3583ad6bc57d122f956db2bf7cd199abeb582f14e91393740062396eebc376d1c1018ad6
 DIST AdGuardHome-0.107.46.tar.gz 2258665 BLAKE2B 
d3b7a6cd24e35fc22fc90919ce7143fbe3475891f151011b5c059f66cbcb78b756d40e797cbee5a1cc2d22064969abac329165f16794619e1b60ea6b22366692
 SHA512 
aaac649e162885c7128a0e8596b03a2b3e1a53fb605ff6d0070e97632d5b8141a3ebba6f93e7f17a51e69394dace0f5bc9b7715a739137dca6740a678ff6a075
+DIST AdGuardHome-0.107.48-deps.tar.zst 3702175 BLAKE2B 
2da4d5e43d8c43f3222ed638726ea541e560978ee5b7d1a452f4ca3f9af6b8f019ee9fb1115485ea76c61ec627b29b9f25d3ee00326ae3a97d7c3e3c5d391153
 SHA512 
2783962df7216566c87c04619488786199d2b82ea8378e2d28e01413c5f3eae66a76a85d0966b25857533548b134e2df361c97205bb00a4c51b22571e99073a1
+DIST AdGuardHome-0.107.48-npm-deps.tar.zst 31298525 BLAKE2B 
8b52fd0eddd4fcb5405e0d08d48c38023ef5a75715ec8eca406bd8811a7ef8d719cc842011b00e364ece9bc1deed415f65eae863baea4d09df6ad7536c0b9da7
 SHA512 
4bae696c842a24d3e7d0c197e3a8a42efc4c67a158a20ba7243f20300f2ddd35a89c1ad46e90c2498ec5bdfe5733a1fa961d11d033a53549240b85ddb2ee5993
+DIST AdGuardHome-0.107.48.tar.gz 2264834 BLAKE2B 
3fc50e5d76b9e73ab14a355f005ba0a57d51e2b45b39667b31e7558a86ea31ab23009ce5738232a9de3bdf781edda9eea9689d315c285ac5bd5273351ba6f606
 SHA512 
861affc0628a14b7823822c4b2b2c66a874801fc4b4fa50b909785ea57b39f86bb6cc4df84d04d941b251a6eec6055e93f41cb04eeba92a4a9477c1904e8d14f
 DIST AdGuardHome-wiki-7964837.tar.xz 44012 BLAKE2B 
0cef0fb890e9fd80db12d74abd39ea90efa5561e11fba0e9df55b5e48536cd5a604d18bd17907921568d73bcc1b08ebb2980e16cb4e1eeb37be10ef89a106243
 SHA512 
2177fe47986f3086804ef900d2e338efbaf647df7f81d8b28235f77f0375681f96db112d3b06f69ee36706fc44698bdd960b919f5b87f82546ce87cb93b3f196

Reply via email to