# Copyright 2024 David Legrand # Distributed under the terms of the GNU General Public License v2 require github [ user=DataDog force_git_clone=true ] require systemd-service require dependencies-helpers providers SUMMARY="A software that collects events and metrics from hosts and sends them to Datadog" LICENCES="Apache-2.0" SLOT="0" PLATFORMS="~amd64 ~armv8" MYOPTIONS="" DEPENDENCIES=" build: dev-lang/go[>=1.23.0] dev-lang/python:*[>=3.11.0&<3.13] dev-python/pip sys-devel/cmake[>=3.12.0] " src_unpack() { scm_src_unpack export GOPATH="${TEMP}/go" export GOBIN="${GOPATH}/bin" export PATH="${GOBIN}:${PATH}" local python_version=$(get_best_slot_dependency dev-lang/python 3.1{2..1}) edo pushd "${WORKBASE}/${PNV}" esandbox disable_net edo python${python_version} -m venv .venv edo source .venv/bin/activate edo sed -i 's/main/59ff0fc027be93b61cf7f6af9acac415d585a296/g' requirements.txt edo pip install -r requirements.txt edo invoke install-tools edo go mod download -x esandbox enable_net edo popd } src_compile() { edo invoke agent.build --build-exclude=systemd --cmake-options='-DPython3_FIND_VIRTUALENV:STRING=ONLY' } src_install() { # We remove unavailable modules edo rm -rf bin/agent/dist/conf.d/{apm.yaml.default,process_agent.yaml.default,winproc.d} insinto /etc/datadog-agent/ doins -r bin/agent/dist/* newbin bin/agent/agent ${PN} dolib.so dev/lib64/* insinto /usr/$(exhost --target)/include/ doins -r dev/include/* install_systemd_files emagicdocs }