net-dns/AdGuardHome: add 0.107.45

1. Disable  `--update` option from command because it alters binary
from remote
2. install wiki pages

Signed-off-by: Rahil Bhimjiani <me@rahil.rocks>
This commit is contained in:
Rahil Bhimjiani
2024-03-07 14:08:30 +05:30
parent 9f42e7c4e4
commit c02919c912
3 changed files with 147 additions and 0 deletions

View File

@@ -0,0 +1,124 @@
# 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/"
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.xz -> ${P}-deps.tar.xz
https://github.com/rahilarious/gentoo-distfiles/releases/download/${P}/wiki.tar.xz -> ${PN}-wiki-${WIKI_COMMIT}.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"
# so that pkgcheck doesn't complain
BDEPEND="app-arch/unzip"
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/*
"
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}"
dosym -r /usr/bin/"${PN}" /usr/bin/adguardhome
einstalldocs
systemd_newunit "${FILESDIR}"/AdGuardHome-0.107.43.service "${PN}".service
}

View File

@@ -4,3 +4,7 @@ DIST AdGuardHome-0.107.43.tar.gz 2227903 BLAKE2B a4811969b2e156a33d6267edeca4be3
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
DIST AdGuardHome-0.107.45-deps.tar.xz 109986456 BLAKE2B a2b78f368d3fb406cae26c3869fd5c30588373a4c58687e5821c75afe943ada8e7f79f18625cd324e0979b8d11a2964fcfc10fe1ce99750a3abbc0952f5d8880 SHA512 31d6fa1758aaac5039b5310dedd851ca3125eddc183dee33ef8c34af9ba9637fca197d278910854746c24d7dc9fa1628ccca12e38b39b8456879e38e6eefc9e6
DIST AdGuardHome-0.107.45-frontend.tar.gz 2793159 BLAKE2B 361a10477317787e2ed414f92bc3d01724182fe7054be2ce0febc68968a3227b875baa1e3b01aee1374652b22d395128041a23af923cffd437c7a9ead31b622b SHA512 68f1163459673e0213675d195196aaabb564b50640d005ef0664653a2580da6f3fbf84e1c6034119e7f55260b03d61d4513c65e8fd1a00ea5c8a856b2946b822
DIST AdGuardHome-0.107.45.tar.gz 2248687 BLAKE2B 257fbd716d769657c9b40a03f91f7dcaaee5c59788b43c86d1b90120f301cfbbfdf68f547143b6505d5bed70f03e992ca6ca3d86d0b1e9b760d0a21d9a19db89 SHA512 cfbb6eaacde706c9ce1bb632484a8d18a915be9642435fbeff087e9cc8cb8f6c787a244068a2f4cc051750a367558aa7487af7c4c58b88d28b64df7e80b55e09
DIST AdGuardHome-wiki-7964837.tar.xz 44012 BLAKE2B 0cef0fb890e9fd80db12d74abd39ea90efa5561e11fba0e9df55b5e48536cd5a604d18bd17907921568d73bcc1b08ebb2980e16cb4e1eeb37be10ef89a106243 SHA512 2177fe47986f3086804ef900d2e338efbaf647df7f81d8b28235f77f0375681f96db112d3b06f69ee36706fc44698bdd960b919f5b87f82546ce87cb93b3f196

View File

@@ -0,0 +1,19 @@
diff --git a/internal/home/options.go b/internal/home/options.go
index d32aaa1..4503dad 100644
--- a/internal/home/options.go
+++ b/internal/home/options.go
@@ -243,14 +243,6 @@ var cmdLineOpts = []cmdLineOpt{{
description: "Don't check for updates.",
longName: "no-check-update",
shortName: "",
-}, {
- updateWithValue: nil,
- updateNoValue: func(o options) (options, error) { o.performUpdate = true; return o, nil },
- effect: nil,
- serialize: func(o options) (val string, ok bool) { return "", o.performUpdate },
- description: "Update the current binary and restart the service in case it's installed.",
- longName: "update",
- shortName: "",
}, {
updateWithValue: nil,
updateNoValue: nil,