summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b4f5ea6954acd655f448dffab11597c990c6b0b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Maintainer: shulhan <ms@kilabit.info>

pkgname=google-cloud-ops-agent-git
pkgver=2.16.0.r5.ge742da55
pkgrel=1

pkgdesc="Ops Agents that are part of the Google Cloud Operations product suite (specifically Cloud Logging and Cloud Monitoring)"
arch=(x86_64)
url='https://github.com/GoogleCloudPlatform/ops-agent'
license=('Apache License 2.0')
groups=()

depends=(
	'java-environment'
	'libyaml'
)
makedepends=(
	'cmake'
	'go'
	'git'
	'pkg-config'
)
optdepends=()

provides=('google-cloud-ops-agent')
conflicts=('stackdriver-collectd')

backup=()

source=(
	"$pkgname::git+https://github.com/GoogleCloudPlatform/ops-agent.git"
	"collectd::git+https://github.com/Stackdriver/collectd.git"
	"fluent-bit::git+https://github.com/fluent/fluent-bit.git"
	"opentelemetry-operations-collector::git+https://github.com/GoogleCloudPlatform/opentelemetry-operations-collector.git"
	"opentelemetry-java-contrib::git+https://github.com/open-telemetry/opentelemetry-java-contrib.git"
	"0001-apps-hostmetrics.patch"
)
md5sums=(
	'SKIP'
	'SKIP'
	'SKIP'
	'SKIP'
	'SKIP'
	'9a4dfd7fe6298c12c46ca50d7f473094'
)

pkgver() {
	cd "${pkgname}"
	git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
	cd "${pkgname}"
	git submodule init
	git config submodule."submodules/collectd".url \
		"${srcdir}/collectd"
	git config submodule."submodules/fluent-bit".url \
		"${srcdir}/fluent-bit"
	git config submodule."submodules/opentelemetry-operations-collector".url \
		"${srcdir}/opentelemetry-operations-collector"
	git config submodule."submodules/opentelemetry-java-contrib".url \
		"${srcdir}/opentelemetry-java-contrib"
	git submodule update
	git apply "${srcdir}/0001-apps-hostmetrics.patch"
}

build() {
	cd "${pkgname}"
	echo "build in $PWD"
	BUILD_DISTRO=arch CODE_VERSION="${pkgver}" \
		./build.sh
}

package() {
	cd "${pkgname}"
	tar -xf /tmp/google-cloud-ops-agent.tgz -C ${pkgdir}/
	rm -rf ${pkgdir}/lib
	chown -R root:root ${pkgdir}/etc
	chown -R root:root ${pkgdir}/opt
	chown -R root:root ${pkgdir}/usr
}