From 1198b7531a4dc6ecadc30284744934dfbaa536d1 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Fri, 17 Feb 2023 00:11:16 +0700 Subject: all: fix build failed due to upstream changes Since PR #1038 merged to master, the build failed due to the $DESTDIR now replaced with "/work" for building with docker. [1] [1] https://github.com/GoogleCloudPlatform/ops-agent/pull/1038#discussion_r1106206200 --- .SRCINFO | 14 ++++++++------ 0001-build-sh.patch | 35 +++++++++++++++++++++++++++++++++++ Makefile | 9 ++++++--- PKGBUILD | 13 +++++++++++-- 4 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 0001-build-sh.patch diff --git a/.SRCINFO b/.SRCINFO index 036163e..9efecef 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,6 +1,6 @@ pkgbase = google-cloud-ops-agent-git pkgdesc = Ops Agents that are part of the Google Cloud Operations product suite (specifically Cloud Logging and Cloud Monitoring) - pkgver = 2.23.0.r33.gdeaa7dec7 + pkgver = 2.25.1.r18.g4f5c90bc5 pkgrel = 1 url = https://github.com/GoogleCloudPlatform/ops-agent arch = x86_64 @@ -21,10 +21,12 @@ pkgbase = google-cloud-ops-agent-git source = fluent-bit::git+https://github.com/fluent/fluent-bit.git source = opentelemetry-operations-collector::git+https://github.com/GoogleCloudPlatform/opentelemetry-operations-collector.git source = opentelemetry-java-contrib::git+https://github.com/open-telemetry/opentelemetry-java-contrib.git - md5sums = SKIP - md5sums = SKIP - md5sums = SKIP - md5sums = SKIP - md5sums = SKIP + source = 0001-build-sh.patch + sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP + sha256sums = a4ec5040542b3b7b33b995f8357fd81dac901975f7d52955b713f8cccc756501 pkgname = google-cloud-ops-agent-git diff --git a/0001-build-sh.patch b/0001-build-sh.patch new file mode 100644 index 0000000..4461f55 --- /dev/null +++ b/0001-build-sh.patch @@ -0,0 +1,35 @@ +diff --git a/build.sh b/build.sh +index 4a97050f7..041b3ac72 100755 +--- a/build.sh ++++ b/build.sh +@@ -40,19 +40,15 @@ if [ -z "$DESTDIR" ]; then + fi + + function build_opsagentengine() { +- if [[ ! -f /work/google_cloud_ops_agent_engine ]]; then +- go build -buildvcs=false -o "/work/google_cloud_ops_agent_engine" \ +- -ldflags "$LD_FLAGS" \ +- github.com/GoogleCloudPlatform/ops-agent/cmd/google_cloud_ops_agent_engine ++ if [[ ! -f "$DESTDIR$prefix/libexec/google_cloud_ops_agent_engine" ]]; then ++ mkdir -p "$DESTDIR$prefix/libexec" ++ go build -buildvcs=false -o "$DESTDIR$prefix/libexec/google_cloud_ops_agent_engine" \ ++ -ldflags "$LD_FLAGS" \ ++ github.com/GoogleCloudPlatform/ops-agent/cmd/google_cloud_ops_agent_engine + fi +- mkdir -p "$DESTDIR$prefix/libexec" +- cp /work/google_cloud_ops_agent_engine "$DESTDIR$prefix/libexec/google_cloud_ops_agent_engine" + } + + (build_opsagentengine) + +-# Copy the cached compilations from docker to the destination +-cp -r /work/cache/* $DESTDIR +- + # N.B. Don't include $DESTDIR itself in the tarball, since mktemp -d will create it mode 0700. + (cd "$DESTDIR" && tar -czf /tmp/google-cloud-ops-agent.tgz *) +diff --git a/submodules/fluent-bit b/submodules/fluent-bit +--- a/submodules/fluent-bit ++++ b/submodules/fluent-bit +@@ -1 +1 @@ +-Subproject commit 97a5e9dcf3f9d2e2107660cf73f6ef253fd227cd ++Subproject commit 97a5e9dcf3f9d2e2107660cf73f6ef253fd227cd-dirty diff --git a/Makefile b/Makefile index 25aa434..13fe8fe 100644 --- a/Makefile +++ b/Makefile @@ -16,13 +16,16 @@ chrootpkg: mkdir -p $$HOME/.gradle mkdir -p _build mkarchroot _build/root base-devel systemd || exit 0 - makechrootpkg -d $$HOME/go:/build/go \ + makechrootpkg \ + -d /tmp \ + -d $$HOME/go:/build/go \ -d $$HOME/.cache/go-build:/build/.cache/go-build \ -d $$HOME/.gradle:/build/.gradle \ - -r _build + -r _build \ + -- --nocolor patch: - git -C src/google-cloud-ops-agent-git diff > 0001-apps-hostmetrics.patch && \ + git -C src/google-cloud-ops-agent-git diff > 0001-build-sh.patch && \ makepkg -g release: diff --git a/PKGBUILD b/PKGBUILD index b278224..49b54f2 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: shulhan pkgname=google-cloud-ops-agent-git -pkgver=2.23.0.r33.gdeaa7dec7 +pkgver=2.25.1.r18.g4f5c90bc5 pkgrel=1 pkgdesc="Ops Agents that are part of the Google Cloud Operations product suite (specifically Cloud Logging and Cloud Monitoring)" @@ -36,13 +36,15 @@ source=( "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-build-sh.patch" ) -md5sums=( +sha256sums=( 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' + 'a4ec5040542b3b7b33b995f8357fd81dac901975f7d52955b713f8cccc756501' ) pkgver() { @@ -72,6 +74,13 @@ build() { echo "destdir: $_destdir" cd "${pkgname}" + + CGO_ENABLED=1 ./builds/otel.sh "$_destdir" + ./builds/fluent_bit.sh "$_destdir" + ./builds/systemd.sh "$_destdir" + ./builds/ops_agent_diagnostics.sh "$_destdir" + + git apply "${srcdir}/0001-build-sh.patch" BUILD_DISTRO=arch CODE_VERSION="${pkgver}" DESTDIR="$_destdir" \ ./build.sh } -- cgit v1.3