{"id":1642,"url":"https://patchwork.libcamera.org/api/patches/1642/?format=json","web_url":"https://patchwork.libcamera.org/patch/1642/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190710114916.29203-1-paul.elder@ideasonboard.com>","date":"2019-07-10T11:49:16","name":"[libcamera-devel] libcamera: skip auto version generation when building for Chromium OS","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"7462c41f58a5b0879871ec4c404c820643c664ad","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1642/mbox/","series":[{"id":412,"url":"https://patchwork.libcamera.org/api/series/412/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=412","date":"2019-07-10T11:49:16","name":"[libcamera-devel] libcamera: skip auto version generation when building for Chromium OS","version":1,"mbox":"https://patchwork.libcamera.org/series/412/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1642/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1642/checks/","tags":{},"headers":{"Return-Path":"<paul.elder@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7B34360C23\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Jul 2019 13:49:26 +0200 (CEST)","from neptunite.amanokami.net (softbank126163157105.bbtec.net\n\t[126.163.157.105])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0E61F54B;\n\tWed, 10 Jul 2019 13:49:24 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1562759366;\n\tbh=Vri+24vhtAJPDfMJIeYKcYilV6QYzxx/qLbyzJ6tcTo=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=Q6YzAOtB6cd7glSiAIcYGA5Dv6/9NHLxYvlIfOcA72D+zeZOT6RTEdzsEoIhMM5B8\n\tOaQbHm/UQ9Kcz+FP8ZFuO+Hmw1pdeFomwV7k1NLYUpH8x4kWvPno4LfOKhDgzBtXRJ\n\tG2yvkBnyyL/y1T+/alCTtw65Qau+bCDmOQEUQP6k=","From":"Paul Elder <paul.elder@ideasonboard.com>","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","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] libcamera: skip auto version generation\n\twhen building for Chromium OS","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 10 Jul 2019 11:49:26 -0000"},"content":"Commit b817bcec6b53 (\"libcamera: Auto generate version information\")\ncauses the build to fail in the Chromium OS build environment, because\ngit update-index tries to take a lock (ie. write) in the git repo that\nis outside of the build directory.\n\nThe solution is to simply skip git update-index if we are building in\nthe Chromium OS build environment, and this decision is made if the\nbuild directory is not a subdirectory of the source directory.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n meson.build          |  3 ++-\n utils/gen-version.sh | 11 +++++++++--\n 2 files changed, 11 insertions(+), 3 deletions(-)","diff":"diff --git a/meson.build b/meson.build\nindex 8f3d0ce..99a3a80 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -15,7 +15,8 @@ project('libcamera', 'c', 'cpp',\n # git version tag, the build metadata (e.g. +211-c94a24f4) is omitted from\n # libcamera_git_version.\n libcamera_git_version = run_command('utils/gen-version.sh',\n-                                    meson.source_root()).stdout().strip()\n+                                    meson.source_root(),\n+                                    meson.build_root()).stdout().strip()\n if libcamera_git_version == ''\n     libcamera_git_version = meson.project_version()\n endif\ndiff --git a/utils/gen-version.sh b/utils/gen-version.sh\nindex 708c01d..8700479 100755\n--- a/utils/gen-version.sh\n+++ b/utils/gen-version.sh\n@@ -3,7 +3,10 @@\n # SPDX-License-Identifier: GPL-2.0-or-later\n # Generate a version string using git describe\n \n-if [ -n \"$1\" ]\n+SRC_DIR=\"$1\"\n+BUILD_DIR=\"$2\"\n+\n+if [ -n $SRC_DIR ]\n then\n \tcd \"$1\" 2>/dev/null || exit 1\n fi\n@@ -24,7 +27,11 @@ fi\n \n # Append a '-dirty' suffix if the working tree is dirty. Prevent false\n # positives due to changed timestamps by running git update-index.\n-git update-index --refresh > /dev/null 2>&1\n+if [ \\( -n $SRC_DIR \\) -a \\( -n $BUILD_DIR \\) -a\n+     $(echo $BUILD_DIR | grep $SRC_DIR) ]\n+then\n+\tgit update-index --refresh > /dev/null 2>&1\n+fi\n git diff-index --quiet HEAD || version=\"$version-dirty\"\n \n # Replace first '-' with a '+' to denote build metadata, strip the 'g' in from\n","prefixes":["libcamera-devel"]}