commit:     e9edd0a0cbb9103f0197359ee81a37a5b7ab6071
Author:     Rahil Bhimjiani <me <AT> rahil <DOT> rocks>
AuthorDate: Wed Feb  7 01:41:13 2024 +0000
Commit:     Rahil Bhimjiani <rahil3108 <AT> gmail <DOT> com>
CommitDate: Wed Feb  7 01:43:01 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=e9edd0a0

net-dns/AdGuardHome: add 0.107.44

New opt-out USE flag, 'web' which toggles web UI.

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

 net-dns/AdGuardHome/AdGuardHome-0.107.44.ebuild    | 119 +++++++++++++++++++++
 net-dns/AdGuardHome/Manifest                       |   3 +
 .../AdGuardHome/files/fix-go.mod-0.107.44.patch    |  10 ++
 net-dns/AdGuardHome/metadata.xml                   |   3 +
 4 files changed, 135 insertions(+)

diff --git a/net-dns/AdGuardHome/AdGuardHome-0.107.44.ebuild 
b/net-dns/AdGuardHome/AdGuardHome-0.107.44.ebuild
new file mode 100644
index 0000000000..f1d2096380
--- /dev/null
+++ b/net-dns/AdGuardHome/AdGuardHome-0.107.44.ebuild
@@ -0,0 +1,119 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit fcaps go-module systemd
+
+DESCRIPTION="Network-wide ads & trackers blocking DNS server like Pi-Hole with 
web ui"
+HOMEPAGE="https://github.com/AdguardTeam/AdGuardHome/";
+
+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.xz
 -> ${P}-deps.tar.xz
+       web? ( 
https://github.com/AdguardTeam/${PN}/releases/download/v${PV}/AdGuardHome_frontend.tar.gz
 -> ${P}-frontend.tar.gz )
+"
+
+# main
+LICENSE="GPL-3"
+# deps
+LICENSE+=" Apache-2.0 BSD BSD-2 MIT ZLIB"
+
+SLOT="0"
+KEYWORDS="~amd64 ~arm64"
+
+IUSE="+web"
+# RESTRICT="test"
+
+# see the patch below
+BDEPEND=">=dev-lang/go-1.21:="
+BDEPEND+=" app-arch/unzip"
+
+FILECAPS=(
+       -m 755 'cap_net_bind_service=+eip cap_net_raw=+eip' usr/bin/${PN}
+)
+
+# otherwise it'll error out saying "update go.mod file"
+# Since dev-lang/go-1.21 is stable i think it's safe to update
+PATCHES=(
+       "${FILESDIR}"/fix-go.mod-0.107.44.patch
+)
+
+src_prepare() {
+       default
+       # move frontend to project directory
+       use web && { rm -v build/gitkeep && mv -v ../build ./ || die ; }
+}
+
+src_compile() {
+       # 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}"
+       einstalldocs
+
+       systemd_newunit "${FILESDIR}"/AdGuardHome-0.107.43.service 
"${PN}".service
+}

diff --git a/net-dns/AdGuardHome/Manifest b/net-dns/AdGuardHome/Manifest
index ced137539c..3485842436 100644
--- a/net-dns/AdGuardHome/Manifest
+++ b/net-dns/AdGuardHome/Manifest
@@ -1,3 +1,6 @@
 DIST AdGuardHome-0.107.43-deps.tar.xz 104529544 BLAKE2B 
4fde3b1e2f85cf85209eb2149c40a5478e4d55cbae90847fafdb5f056b7af2a8234a5880fac6bbed1b62e64d7e849162abbc9e5fef3b262ecea8760fcb21c21c
 SHA512 
44458c3d1d46c7ccf50308227ff765927e1b6d4876065af13004bd0ec2c82c7727e76a81bfc52cf920ea2dee361e5c761db73ed610d04b23568c6e7611301348
 DIST AdGuardHome-0.107.43-frontend.tar.gz 2781809 BLAKE2B 
72d42f40a5f671f5dab72a7fcbd77fdfbd58126b67c73fd6e1dbec5f956c017ff64c01cb8c89ec5c72ef2058640e7cea5b93fe1b3c2c7b76edc6de32ab7f4801
 SHA512 
1c1fd527638c3e35fa21b5738868dae04b41a0bbb04942c94cc36d1dc7f6961bd202c7862fdfffe3ed52039c75b3f358e399c17ccd121e78432ec58fa837f4a0
 DIST AdGuardHome-0.107.43.tar.gz 2227903 BLAKE2B 
a4811969b2e156a33d6267edeca4be3535e095e8133c6c8d761e132e5f95d21403df37f8ac5567d85994b89ff8912f1799f21f648d6a26a6bf7971d02bd11ffd
 SHA512 
cc9f7602ada6e40ff7c8449bfc1c40fb184c848019ff95b1db46a974f4a72606c587015d440e25094c51cc0b6d01eb68686765d0a92f01752615db63e4527803
+DIST AdGuardHome-0.107.44-deps.tar.xz 115115688 BLAKE2B 
198d1f86f24d5d7857eb0bb992ba7be34ee58fa9edd110c2434a59d4dd7cb936acb56175733a86ca847bcf48e99e8960d1a2b38bef072a0151d6b8875b9e13e4
 SHA512 
a8e77ce8b112f1c1dd6d993fcc8a52c802bf51ce9edc2383137360745f40b95a29c0e913920b17fc9f203286d18bd3ec5813eca0640bff0eb1655e9165c30763
+DIST AdGuardHome-0.107.44-frontend.tar.gz 2784087 BLAKE2B 
9c9d1a165bb885d120780f8f35cc38c11d9a0865ee706a33932feba98c13f0b181dbc7fcab10fa16d6654846fe2acf16ccc3aff7aec8b78f44e0092e623f1380
 SHA512 
0beae751490fb5095e2459b222781d177c4c206d86dc7fcc8a048b03ffcab1896d82cf2b741b9cb94dc817e2c53393ee001a4a182a795f9546d57a8988cebc4d
+DIST AdGuardHome-0.107.44.tar.gz 2243237 BLAKE2B 
f7a7299304f915de2c5e1a673170d480578d68b2b05a15edf7302e3499b55f74dd786b145c5d97a9834c79bf1f7c8e89b5db7ced57b8cea3871cb1415efef51e
 SHA512 
3db00251b9e6567ebe8404c12be2fddaf9d6a924b3d12980a1ab4f7c314089cea68bf1ddbce98702c9f94e1997a717afcb723a9214b3d9a34edcff390b73cb88

diff --git a/net-dns/AdGuardHome/files/fix-go.mod-0.107.44.patch 
b/net-dns/AdGuardHome/files/fix-go.mod-0.107.44.patch
new file mode 100644
index 0000000000..1e2d06602d
--- /dev/null
+++ b/net-dns/AdGuardHome/files/fix-go.mod-0.107.44.patch
@@ -0,0 +1,10 @@
+--- a/go.mod
++++ b/go.mod
+@@ -1,6 +1,6 @@
+ module github.com/AdguardTeam/AdGuardHome
+ 
+-go 1.20
++go 1.21
+ 
+ require (
+       github.com/AdguardTeam/dnsproxy v0.63.1

diff --git a/net-dns/AdGuardHome/metadata.xml b/net-dns/AdGuardHome/metadata.xml
index 2aeba77180..4176d1743b 100644
--- a/net-dns/AdGuardHome/metadata.xml
+++ b/net-dns/AdGuardHome/metadata.xml
@@ -5,6 +5,9 @@
     <email>me@rahil.rocks</email>
     <name>Rahil Bhimjiani</name>
   </maintainer>
+  <use>
+    <flag name="web">Enables web user interface (UI)</flag>
+  </use>
   <upstream>
     <remote-id type="github">AdguardTeam/AdGuardHome</remote-id>
     <bugs-to>https://github.com/AdguardTeam/AdGuardHome/issues</bugs-to>

Reply via email to