Commit 7248155c authored by Kamil Godzwon's avatar Kamil Godzwon Committed by Tomasz Zawadzki
Browse files

pkgdep/git: update git -C commands while adding submodule



Changed 'git -C' to 'git --git-dir' when adding
submodules to cloned spdk repo. Both commands are not
equivalent. 'git -C' does not override the GIT_DIR
environment variable and some systems may have set
the spdk repository location incorrectly (not visible
by OS). Using 'git --git-dir' allows to set repo
options remotely (without being inside).

Changed the ownership of the spdk repo (Linux only)
to the actual $USER while checking if repo exists.
That prevents from unsafe directory detection run
by GIT.

Such issues happend on Ubuntu 18.04 and 20.04

Signed-off-by: default avatarKamil Godzwon <kamilx.godzwon@intel.com>
Change-Id: I61dceddebde7e3c66e4b37990e205c513fe38414
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12551


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarMichal Berger <michallinuxstuff@gmail.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 70b31195
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
function install_spdk() {
	mkdir -p "$GIT_REPOS/spdk_repo/output" || echo "Can not create spdk_repo/output directory."

	if [[ -d $GIT_REPOS/spdk_repo/spdk ]]; then
	if [[ -d $GIT_REPOS/spdk_repo/spdk/.git ]]; then
		echo "spdk source already present, not cloning"
		if [[ $OSID != freebsd ]]; then
			chown -R "$USER:$USER" "$GIT_REPOS/spdk_repo/spdk"
		fi
	else
		git -C "$GIT_REPOS/spdk_repo" clone "${GIT_REPO_SPDK}"
	fi
	git -C "$GIT_REPOS/spdk_repo/spdk" config submodule.dpdk.url "${GIT_REPO_DPDK}"
	git -C "$GIT_REPOS/spdk_repo/spdk" config submodule.intel-ipsec-mb.url "${GIT_REPO_INTEL_IPSEC_MB}"
	git --git-dir=$GIT_REPOS/spdk_repo/spdk/.git config submodule.dpdk.url ${GIT_REPO_DPDK}
	git --git-dir=$GIT_REPOS/spdk_repo/spdk/.git config submodule.intel-ipsec-mb.url ${GIT_REPO_INTEL_IPSEC_MB}
	git -C "$GIT_REPOS/spdk_repo/spdk" submodule update --init --recursive
}