Skip to content

Commit

Permalink
bcc: CMakeLists.txt: don't modify .gitconfig on build host nor try to…
Browse files Browse the repository at this point in the history
… update git submodules

* bitbake fetcher will correctly handle safe.directory issues and
  blazesym or libbpf submodules are managed by gitsm:// fetcher
  we don't want to call git from CMake in do_configure

* prevents many safe.directory entries in users .gitconfig when
  bcc was built in many different TMPDIRs

  added in iovisor/bcc#4186

  causing:
  [safe]
        directory = /OE/build/oe-core/tmp-glibc/work/cortexa57-oe-linux/bcc/0.28.0+git/git
        directory = /OE/build/oe-core/tmp-glibc/work/cortexa57-oe-linux/bcc/0.28.0+git/git/libbpf-tools/blazesym

  to be added for every TMPDIR where it was built

Signed-off-by: Martin Jansa <[email protected]>
  • Loading branch information
shr-project authored and kraj committed Sep 7, 2023
1 parent 09e448e commit 0bbb4ab
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
From 9ee5d9ca2e1ea709571613326b81e8e651fa9f00 Mon Sep 17 00:00:00 2001
From: Martin Jansa <[email protected]>
Date: Thu, 7 Sep 2023 11:43:25 +0200
Subject: [PATCH] CMakeLists.txt: don't modify .gitconfig on build host nor try
to update git submodules

* bitbake fetcher will correctly handle safe.directory issues and
blazesym or libbpf submodules are managed by gitsm:// fetcher
we don't want to call git from CMake in do_configure

Upstream-Status: Pending
Signed-off-by: Martin Jansa <[email protected]>
---
CMakeLists.txt | 62 --------------------------------------------------
1 file changed, 62 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index dfed06e5..ffd88043 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,68 +26,6 @@ endif()

enable_testing()

-execute_process(COMMAND git config --global --add safe.directory ${CMAKE_CURRENT_SOURCE_DIR}
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- RESULT_VARIABLE CONFIG_RESULT)
-if(CONFIG_RESULT AND NOT CONFIG_RESULT EQUAL 0)
- message(WARNING "Failed to add root source directory to safe.directory")
-endif()
-
-# populate submodule blazesym
-if(NOT NO_BLAZESYM)
- execute_process(COMMAND git config --global --add safe.directory ${CMAKE_CURRENT_SOURCE_DIR}/libbpf-tools/blazesym
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- RESULT_VARIABLE CONFIG_RESULT)
- if(CONFIG_RESULT AND NOT CONFIG_RESULT EQUAL 0)
- message(WARNING "Failed to add blazesym source directory to safe.directory")
- endif()
-
- execute_process(COMMAND git submodule update --init --recursive -- libbpf-tools/blazesym
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- RESULT_VARIABLE UPDATE_RESULT)
- if(UPDATE_RESULT AND NOT UPDATE_RESULT EQUAL 0)
- message(WARNING "Failed to update submodule blazesym")
- endif()
-endif()
-
-# populate submodules (libbpf)
-if(NOT CMAKE_USE_LIBBPF_PACKAGE)
- execute_process(COMMAND git config --global --add safe.directory ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/libbpf
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- RESULT_VARIABLE CONFIG_RESULT)
- if(CONFIG_RESULT AND NOT CONFIG_RESULT EQUAL 0)
- message(WARNING "Failed to add libbpf source directory to safe.directory")
- endif()
- execute_process(COMMAND git config --global --add safe.directory ${CMAKE_CURRENT_SOURCE_DIR}/libbpf-tools/bpftool
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- RESULT_VARIABLE CONFIG_RESULT)
- if(CONFIG_RESULT AND NOT CONFIG_RESULT EQUAL 0)
- message(WARNING "Failed to add bpftool source directory to safe.directory")
- endif()
-
- if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/libbpf/src)
- execute_process(COMMAND git submodule update --init --recursive
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- RESULT_VARIABLE UPDATE_RESULT)
- if(UPDATE_RESULT AND NOT UPDATE_RESULT EQUAL 0)
- message(WARNING "Failed to update submodule libbpf")
- endif()
- else()
- execute_process(COMMAND git diff --shortstat ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/libbpf/
- OUTPUT_VARIABLE DIFF_STATUS)
- if("${DIFF_STATUS}" STREQUAL "")
- execute_process(COMMAND git submodule update --init --recursive
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- RESULT_VARIABLE UPDATE_RESULT)
- if(UPDATE_RESULT AND NOT UPDATE_RESULT EQUAL 0)
- message(WARNING "Failed to update submodule libbpf")
- endif()
- else()
- message(WARNING "submodule libbpf dirty, so no sync")
- endif()
- endif()
-endif()
-
# It's possible to use other kernel headers with
# KERNEL_INCLUDE_DIRS build variable, like:
# $ cd <kernel-dir>
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ SRC_URI = "gitsm://github.com/iovisor/bcc;branch=master;protocol=https \
file://0001-CMakeLists.txt-override-the-PY_CMD_ESCAPED.patch \
file://0001-Vendor-just-enough-extra-headers-to-allow-libbpf-to-.patch \
file://0001-tests-cc-Use-c-14-standard.patch \
file://0001-CMakeLists.txt-don-t-modify-.gitconfig-on-build-host.patch \
file://run-ptest \
file://ptest_wrapper.sh \
"
Expand Down

0 comments on commit 0bbb4ab

Please sign in to comment.