[OE-core] [PATCH] cmake: Export SSH_AUTH_SOCK for cmake at configure

Niko Mauno niko.mauno at vaisala.com
Fri May 25 12:37:39 UTC 2018


Update cmake_do_configure() to export a set SSH_AUTH_SOCK variable
before calling cmake.

Otherwise, if cmake call during cmake_do_configure() resorts to
ExternalProject directive containing a GIT_REPOSITORY entry, and git
authentication scheme is based on SSH agent forwarding, it fails
followingly

  | Cloning into 'foo'...
  | Permission denied (publickey).
  | fatal: Could not read from remote repository.
  |
  | Please make sure you have the correct access rights
  | and the repository exists.
  |
  | ...
  |
  | CMake Error at .../tmp/foo-gitclone.cmake:66 (message):
  |   Failed to clone repository: 'ssh://...

Signed-off-by: Niko Mauno <niko.mauno at vaisala.com>
---
 meta/classes/cmake.bbclass | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index fcfd5dda4f..82d36be8ff 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -137,6 +137,11 @@ cmake_do_configure() {
 		oecmake_sitefile=
 	fi
 
+	# Allow cmake to perform eg. git clone in context where authentication relies on SSH agent forwarding
+	if [ "${SSH_AUTH_SOCK}" ] ; then
+		export SSH_AUTH_SOCK=${SSH_AUTH_SOCK}
+	fi
+
 	cmake \
 	  ${OECMAKE_GENERATOR_ARGS} \
 	  $oecmake_sitefile \
-- 
2.11.0




More information about the Openembedded-core mailing list