{"id":1643,"url":"https://patchwork.libcamera.org/api/1.1/patches/1643/?format=json","web_url":"https://patchwork.libcamera.org/patch/1643/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20190710142301.16340-1-paul.elder@ideasonboard.com>","date":"2019-07-10T14:23:01","name":"[libcamera-devel,v2] libcamera: skip auto version generation when building for Chromium OS","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"97c4fe0676b6a23cfaf13733307b86869f73390c","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1643/mbox/","series":[{"id":413,"url":"https://patchwork.libcamera.org/api/1.1/series/413/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=413","date":"2019-07-10T14:23:01","name":"[libcamera-devel,v2] libcamera: skip auto version generation when building for Chromium OS","version":2,"mbox":"https://patchwork.libcamera.org/series/413/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1643/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1643/checks/","tags":{},"headers":{"Return-Path":"<paul.elder@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5B6776156D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Jul 2019 16:23:10 +0200 (CEST)","from neptunite.amanokami.net (softbank126163157105.bbtec.net\n\t[126.163.157.105])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D0D2A31C;\n\tWed, 10 Jul 2019 16:23:08 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1562768589;\n\tbh=UsKtW92sdR1Tc3HsSOdd5T33AnLX3CIQKbRpV79nGr8=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=cWKc0wptAv6snqauMg9hfXtxJuOQ6OzXQREGvaPJke5yykdMr4IDsUqrafnXz7W+R\n\tx02xIHV9OeFxmmlhzBax4zL4/Gipc93MAL54138/Z308Ngsi0uW1cuZVpAEVFHbdoJ\n\tlcNp5zof283iULd3XATAOmV0pTE9GeaJ48Di0iUE=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 10 Jul 2019 23:23:01 +0900","Message-Id":"<20190710142301.16340-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 v2] libcamera: skip auto version\n\tgeneration when 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 14:23:10 -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---\nChanges in v2:\n- add quotes around variable accessess, and the string matcher\n- make the two path arguments to gen-version.sh required\n- actually run gen-version.sh from the needed place in meson\n\n meson.build               |  3 ++-\n src/libcamera/meson.build |  2 +-\n utils/gen-version.sh      | 14 +++++++++++---\n 3 files changed, 14 insertions(+), 5 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/src/libcamera/meson.build b/src/libcamera/meson.build\nindex 97ff86e..4c442b9 100644\n--- a/src/libcamera/meson.build\n+++ b/src/libcamera/meson.build\n@@ -81,7 +81,7 @@ libcamera_sources += control_types_cpp\n \n gen_version = join_paths(meson.source_root(), 'utils', 'gen-version.sh')\n \n-version_cpp = vcs_tag(command : [gen_version, meson.source_root()],\n+version_cpp = vcs_tag(command : [gen_version, meson.source_root(), meson.build_root()],\n                       input : 'version.cpp.in',\n                       output : 'version.cpp',\n                       fallback : meson.project_version())\ndiff --git a/utils/gen-version.sh b/utils/gen-version.sh\nindex 708c01d..5005db9 100755\n--- a/utils/gen-version.sh\n+++ b/utils/gen-version.sh\n@@ -3,11 +3,16 @@\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 [ -z \"$src_dir\" -o -z \"$build_dir\" ]\n then\n-\tcd \"$1\" 2>/dev/null || exit 1\n+\texit\n fi\n \n+cd \"$src_dir\" 2>/dev/null || exit 1\n+\n # Bail out if the directory isn't under git control\n git rev-parse --git-dir >/dev/null 2>&1 || exit 1\n \n@@ -24,7 +29,10 @@ 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 \"$(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","v2"]}