From patchwork Wed Jul 10 11:49:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 1642 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7B34360C23 for ; Wed, 10 Jul 2019 13:49:26 +0200 (CEST) Received: from neptunite.amanokami.net (softbank126163157105.bbtec.net [126.163.157.105]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0E61F54B; Wed, 10 Jul 2019 13:49:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1562759366; bh=Vri+24vhtAJPDfMJIeYKcYilV6QYzxx/qLbyzJ6tcTo=; h=From:To:Cc:Subject:Date:From; b=Q6YzAOtB6cd7glSiAIcYGA5Dv6/9NHLxYvlIfOcA72D+zeZOT6RTEdzsEoIhMM5B8 OaQbHm/UQ9Kcz+FP8ZFuO+Hmw1pdeFomwV7k1NLYUpH8x4kWvPno4LfOKhDgzBtXRJ G2yvkBnyyL/y1T+/alCTtw65Qau+bCDmOQEUQP6k= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 10 Jul 2019 20:49:16 +0900 Message-Id: <20190710114916.29203-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: skip auto version generation when building for Chromium OS X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jul 2019 11:49:26 -0000 Commit b817bcec6b53 ("libcamera: Auto generate version information") causes the build to fail in the Chromium OS build environment, because git update-index tries to take a lock (ie. write) in the git repo that is outside of the build directory. The solution is to simply skip git update-index if we are building in the Chromium OS build environment, and this decision is made if the build directory is not a subdirectory of the source directory. Signed-off-by: Paul Elder --- meson.build | 3 ++- utils/gen-version.sh | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 8f3d0ce..99a3a80 100644 --- a/meson.build +++ b/meson.build @@ -15,7 +15,8 @@ project('libcamera', 'c', 'cpp', # git version tag, the build metadata (e.g. +211-c94a24f4) is omitted from # libcamera_git_version. libcamera_git_version = run_command('utils/gen-version.sh', - meson.source_root()).stdout().strip() + meson.source_root(), + meson.build_root()).stdout().strip() if libcamera_git_version == '' libcamera_git_version = meson.project_version() endif diff --git a/utils/gen-version.sh b/utils/gen-version.sh index 708c01d..8700479 100755 --- a/utils/gen-version.sh +++ b/utils/gen-version.sh @@ -3,7 +3,10 @@ # SPDX-License-Identifier: GPL-2.0-or-later # Generate a version string using git describe -if [ -n "$1" ] +SRC_DIR="$1" +BUILD_DIR="$2" + +if [ -n $SRC_DIR ] then cd "$1" 2>/dev/null || exit 1 fi @@ -24,7 +27,11 @@ fi # Append a '-dirty' suffix if the working tree is dirty. Prevent false # positives due to changed timestamps by running git update-index. -git update-index --refresh > /dev/null 2>&1 +if [ \( -n $SRC_DIR \) -a \( -n $BUILD_DIR \) -a + $(echo $BUILD_DIR | grep $SRC_DIR) ] +then + git update-index --refresh > /dev/null 2>&1 +fi git diff-index --quiet HEAD || version="$version-dirty" # Replace first '-' with a '+' to denote build metadata, strip the 'g' in from