Show a patch.

GET /api/1.1/patches/1631/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 1631,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/1631/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1631/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20190705082916.13412-1-laurent.pinchart@ideasonboard.com>",
    "date": "2019-07-05T08:29:16",
    "name": "[libcamera-devel] libcamera: Rework automatic version generation to avoid rebuilds",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "10514a94c272480cd4a4137926ce3e0f45193f10",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/1631/mbox/",
    "series": [
        {
            "id": 408,
            "url": "https://patchwork.libcamera.org/api/1.1/series/408/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=408",
            "date": "2019-07-05T08:29:16",
            "name": "[libcamera-devel] libcamera: Rework automatic version generation to avoid rebuilds",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/408/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1631/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1631/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@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 46E2161568\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  5 Jul 2019 10:29:44 +0200 (CEST)",
            "from pendragon.bb.dnainternet.fi\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AD98124B;\n\tFri,  5 Jul 2019 10:29:43 +0200 (CEST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1562315383;\n\tbh=sdb60tOLr8229zGl9KD14v1dSgXEoWxKSlCoyFqbN60=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=dSim8MbJ6wj9snjrF6zF4hXllRYKMdCWeyDxnMuMAaHuoXpChP2TB/K5IUfkPhldI\n\t071s+UGSvWEv59kefQ8wt/XqNqP21TJL5ayXKR7Udx0FHDs7AIclcE51P0+NOcsUQU\n\tOIg5ye+Izf/vi5qptxXz+ti+k5BWfza7gQ5XOV+I=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  5 Jul 2019 11:29:16 +0300",
        "Message-Id": "<20190705082916.13412-1-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH] libcamera: Rework automatic version\n\tgeneration to avoid rebuilds",
        "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": "Fri, 05 Jul 2019 08:29:44 -0000"
    },
    "content": "Commit b817bcec6b53 (\"libcamera: Auto generate version information\")\ngenerates version information in order to automatically include it\nvarious locations (Sphinx and Doxygen documentation, libcamera::version\nvariable available at runtime, and version.h available at compile time).\nUnfortunately this causes lots of unnecessary rebuilds when modifying\nthe git tree state, which hinders development.\n\nThe problem is caused by the generated version.h being listed as a\ndependency for the whole libcamera. This is required as meson (to the\nbest of my knowledge) doesn't provide a way to explicitly specify the\ndependency of a single object file (camera_manager.o in this case, as\ncamera_manager.cpp is the only consumer of the generated version string)\non the custom target used to generate version.h. The dependency can't be\nautomatically detected at build time, like dependencies on normal\nheaders that are generated by parsing the source, because the version.h\nheader may not exist yet. The build could then fail in a racy way.\n\nThis change attempts at solving the issue by generating a version.cpp\ninstead of a version.h. This minimises the number of files that need to\nbe rebuild when then git tree state changes, while retaining the main\npurpose of the original automatic version generation, the ability to\naccess the git-based version string at runtime.\n\nThe Sphinx and Doxygen documentation however lose git-based version\ninformation, to prevent a full documentation rebuild for every commit.\nWe may want to investigate how to preserve detailed version information\nthere, as well as how to make it available in a header file for\napplications. For the time being, this commit should be a good\ncompromise to avoid unnecessary recompilation, and additional features\ncan be built on top of it after taking the time to consider and test\nthem carefully.\n\nFixes: b817bcec6b53 (\"libcamera: Auto generate version information\")\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n Documentation/Doxyfile.in                     |  4 ++-\n include/libcamera/meson.build                 |  8 +-----\n include/libcamera/{version.h.in => version.h} |  4 ---\n meson.build                                   |  4 +--\n src/libcamera/camera_manager.cpp              |  5 ----\n {utils => src/libcamera}/gen-version.sh       |  0\n src/libcamera/meson.build                     |  8 +++++-\n src/libcamera/version.cpp.in                  | 25 +++++++++++++++++++\n 8 files changed, 37 insertions(+), 21 deletions(-)\n rename include/libcamera/{version.h.in => version.h} (79%)\n rename {utils => src/libcamera}/gen-version.sh (100%)\n create mode 100644 src/libcamera/version.cpp.in",
    "diff": "diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in\nindex cad85ff979f8..ed111909b603 100644\n--- a/Documentation/Doxyfile.in\n+++ b/Documentation/Doxyfile.in\n@@ -791,7 +791,9 @@ WARN_LOGFILE           =\n # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING\n # Note: If this tag is empty the current directory is searched.\n \n-INPUT                  = \"@TOP_SRCDIR@/include/libcamera\" \"@TOP_SRCDIR@/src/libcamera\"\n+INPUT                  = \"@TOP_SRCDIR@/include/libcamera\" \\\n+\t\t\t \"@TOP_SRCDIR@/src/libcamera\" \\\n+\t\t\t \"@TOP_BUILDDIR@/src/libcamera\"\n \n # This tag can be used to specify the character encoding of the source files\n # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses\ndiff --git a/include/libcamera/meson.build b/include/libcamera/meson.build\nindex 6f81f1117318..bafa103d141b 100644\n--- a/include/libcamera/meson.build\n+++ b/include/libcamera/meson.build\n@@ -14,15 +14,9 @@ libcamera_api = files([\n     'signal.h',\n     'stream.h',\n     'timer.h',\n+    'version.h',\n ])\n \n-gen_version = join_paths(meson.source_root(), 'utils', 'gen-version.sh')\n-\n-version_h = vcs_tag(command : [gen_version, meson.current_source_dir()],\n-                    input : 'version.h.in',\n-                    output : 'version.h',\n-                    fallback : 'v0.0')\n-\n gen_header = files('gen-header.sh')\n \n libcamera_h = custom_target('gen-header',\ndiff --git a/include/libcamera/version.h.in b/include/libcamera/version.h\nsimilarity index 79%\nrename from include/libcamera/version.h.in\nrename to include/libcamera/version.h\nindex e49b36962aed..75d57d48af0d 100644\n--- a/include/libcamera/version.h.in\n+++ b/include/libcamera/version.h\n@@ -3,16 +3,12 @@\n  * Copyright (C) 2019, Google Inc.\n  *\n  * version.h - Library version information\n- *\n- * This file is auto-generated. Do not edit.\n  */\n #ifndef __LIBCAMERA_VERSION_H__\n #define __LIBCAMERA_VERSION_H__\n \n #include <string>\n \n-#define LIBCAMERA_VERSION \"@VCS_TAG@\"\n-\n namespace libcamera {\n \n extern const std::string version;\ndiff --git a/meson.build b/meson.build\nindex 342b3cc76a93..271b538bdae8 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1,8 +1,6 @@\n project('libcamera', 'c', 'cpp',\n     meson_version : '>= 0.40',\n-    version : run_command('utils/gen-version.sh',\n-                          '@0@'.format(meson.source_root()),\n-                          check : true).stdout().strip(),\n+    version : 'v0.0',\n     default_options : [\n         'werror=true',\n         'warning_level=2',\ndiff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp\nindex c5da46b4062d..69503c6e8726 100644\n--- a/src/libcamera/camera_manager.cpp\n+++ b/src/libcamera/camera_manager.cpp\n@@ -26,11 +26,6 @@ namespace libcamera {\n \n LOG_DEFINE_CATEGORY(Camera)\n \n-/**\n- * \\brief The library global version string\n- */\n-const std::string version(LIBCAMERA_VERSION);\n-\n /**\n  * \\class CameraManager\n  * \\brief Provide access and manage all cameras in the system\ndiff --git a/utils/gen-version.sh b/src/libcamera/gen-version.sh\nsimilarity index 100%\nrename from utils/gen-version.sh\nrename to src/libcamera/gen-version.sh\ndiff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\nindex 336f4f066fac..c35ecb988d72 100644\n--- a/src/libcamera/meson.build\n+++ b/src/libcamera/meson.build\n@@ -79,8 +79,14 @@ control_types_cpp = custom_target('control_types_cpp',\n \n libcamera_sources += control_types_cpp\n \n+version_cpp = vcs_tag(command : ['gen-version.sh', meson.source_root()],\n+                      input : 'version.cpp.in',\n+                      output : 'version.cpp',\n+                      fallback : meson.project_version())\n+\n+libcamera_sources += version_cpp\n+\n libcamera_deps = [\n-    declare_dependency(sources : version_h),\n     cc.find_library('dl'),\n     libudev,\n ]\ndiff --git a/src/libcamera/version.cpp.in b/src/libcamera/version.cpp.in\nnew file mode 100644\nindex 000000000000..055dc0b5c5ad\n--- /dev/null\n+++ b/src/libcamera/version.cpp.in\n@@ -0,0 +1,25 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * version.cpp - libcamera version\n+ *\n+ * This file is auto-generated. Do not edit.\n+ */\n+\n+#include <libcamera/version.h>\n+\n+/**\n+ * \\file version.h\n+ * \\brief libcamera version\n+ */\n+\n+namespace libcamera {\n+\n+/**\n+ * \\var libcamera::version\n+ * \\brief The library global version string\n+ */\n+const std::string version(\"@VCS_TAG@\");\n+\n+} /* namespace libcamera */\n",
    "prefixes": [
        "libcamera-devel"
    ]
}