Patch Detail
Show a patch.
GET /api/1.1/patches/14495/?format=api
{ "id": 14495, "url": "https://patchwork.libcamera.org/api/1.1/patches/14495/?format=api", "web_url": "https://patchwork.libcamera.org/patch/14495/", "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": "<20211013101650.1810576-2-naush@raspberrypi.com>", "date": "2021-10-13T10:16:50", "name": "[libcamera-devel,RFC,1/1] build: Preserve upstream git versioning using meson dist", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "ca2e4157703fe707ed435a5cdd093c15ad9fe2f5", "submitter": { "id": 34, "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api", "name": "Naushir Patuck", "email": "naush@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/14495/mbox/", "series": [ { "id": 2621, "url": "https://patchwork.libcamera.org/api/1.1/series/2621/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2621", "date": "2021-10-13T10:16:49", "name": "Save version string with meson dist", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2621/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/14495/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/14495/checks/", "tags": {}, "headers": { "Return-Path": "<kieran.bingham@ideasonboard.com>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": [ "parsemail@patchwork.libcamera.org", "kbingham@ideasonboard.com" ], "Received": [ "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 9F133BDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 9 Nov 2021 17:41:54 +0000 (UTC)", "from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net\n\t[86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3C5BE501\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 9 Nov 2021 18:41:54 +0100 (CET)", "from perceval.ideasonboard.com\n\tby perceval.ideasonboard.com with LMTP id eKqwDpyyZmH6NAAA4E0KoQ\n\t(envelope-from <libcamera-devel-bounces@lists.libcamera.org>)\n\tfor <kbingham@ideasonboard.com>; Wed, 13 Oct 2021 12:19:08 +0200", "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\tby perceval.ideasonboard.com (Postfix) with ESMTPS\n\tid 0A44318FF;\tWed, 13 Oct 2021 12:19:08 +0200 (CEST)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B836268F50;\n\tWed, 13 Oct 2021 12:19:07 +0200 (CEST)", "from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com\n\t[IPv6:2a00:1450:4864:20::42d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5357360501\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Oct 2021 12:19:06 +0200 (CEST)", "by mail-wr1-x42d.google.com with SMTP id e12so6583042wra.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Oct 2021 03:19:06 -0700 (PDT)", "from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:a13d:95a9:c25e:7597])\n\tby smtp.gmail.com with ESMTPSA id\n\ty5sm7904902wrq.85.2021.10.13.03.19.05\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 13 Oct 2021 03:19:05 -0700 (PDT)" ], "Authentication-Results": [ "perceval.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"t0+3wBU+\"; dkim-atps=neutral", "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature\n\tverification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com header.b=\"t0+3wBU+\";\tdkim-atps=neutral" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=y7mEJ+pwpU7N62NwAYoOxAHnlZ330zf8im/kM1eJFR4=;\n\tb=t0+3wBU+kIvlxhMMFvtsW3CXTjFvdIVvldETbvStqUpGOsb7YDu4DHJIlEOdUclDvo\n\tsco4W+Fee7wivo6V48qBKH+Q9A0XMVMWI7Zq+LsVk8BBRfNrr4yIUarAIX0jhzIF9oK/\n\tm4sA7PtM9b6Q4EhyNHz45tLjZM4c84fccMlRP77otRkHkiFWeTxVKSQzM5Nk5GSJgE27\n\tN22Gb5kPUMLQcDctPhvcZEkFXc/IpqH8B+9/Y2ZKirL8xl3tucB9JGGu07JzLFPp2I32\n\tBJTKUijnAzC3RSJgtHXqS0BqRQxsZNrpXfaPYFnG6kYzSkJUDLZ4q6YA9pdFoiExrKPe\n\t4asQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=y7mEJ+pwpU7N62NwAYoOxAHnlZ330zf8im/kM1eJFR4=;\n\tb=YoqOOBpGLkpKAPqG8V6e9uArqlu5vzs2oaJoy0C9NSPYXqmDzkw0HWTUbZm9PZ4WC6\n\tU1M1etEULLlq8QoRtR0QdV8/0OWVFh9kEgi8QriEKKh57I5ExsvCP+oQY4TMNcUCSuTh\n\tMU9FJda0g4yEhoAdnAKNabCgDoulzL6AfWOB4JeyZ2p0+JyKRZpTGSoRskZTNPhCrGo6\n\tdIzW/cdnPAsCkPa221xQYxHpElYnpW35akIRBjsqKKcpd+kxJlrQ0bhNpVJiilmCFZHD\n\tDH/Ghyq4P7zFFaGLPHDBFWIsaOTV0VG8cQ2vR0bl/cmVWto0yYVenbXZfI2xCWcNuJ6S\n\trzMA==", "X-Gm-Message-State": "AOAM5319dOMX9qQ1HeJT5xhQSqMlINtOKN55U6TcmE9nRPYC7Mi6G4dg\n\tAucP/GlFz2KJsgAIN1Xow43vRhmf7UQ=", "X-Google-Smtp-Source": "=?utf-8?q?ABdhPJwwAQTp/QT0MTVOlCcRYsGsuHRR0eDaM1Haa?=\n\t=?utf-8?q?DAHEt6OBfcpKn3CJK0b5a9QWw/YAwqiAsqAJg=3D=3D?=", "X-Received": "by 2002:adf:a45c:: with SMTP id\n\te28mr39047440wra.347.1634120345821;\n\tWed, 13 Oct 2021 03:19:05 -0700 (PDT)", "From": "Naushir Patuck <naush@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 13 Oct 2021 11:16:50 +0100", "Message-Id": "<20211013101650.1810576-2-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20211013101650.1810576-1-naush@raspberrypi.com>", "References": "<20211013101650.1810576-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [RFC 1/1] build: Preserve upstream git versioning\n\tusing meson dist", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>", "X-TUID": "pDLR32bicpsi", "Resent-From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "Resent-To": "parsemail@patchwork.libcamera.org" }, "content": "When distributions build and package libcamera libraries, they may not\nnecessarily run the build in the upstream source tree. In these cases, the git\nSHA1 versioning information will be lost.\n\nThis change addresses that problem by requiring package managers to run\n'meson dist' to create a tarball of the source files and build from there.\nOn runing 'meson dist', the utils/run-dist.sh script will create a version.gen\nfile in the release tarball with the version string generated from the existing\nutils/gen-version.sh script.\n\nThe build system has been updated to check for the presence of this version.gen\nfile and read the version string from it. If the file is not present, the\nversion string is generated by running utils/gen-version.sh as it currently\ndoes.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n meson.build | 30 ++++++++++++++++++++----------\n src/libcamera/meson.build | 11 +++++------\n utils/run-dist.sh | 9 +++++++++\n 3 files changed, 34 insertions(+), 16 deletions(-)\n create mode 100644 utils/run-dist.sh", "diff": "diff --git a/meson.build b/meson.build\nindex a49c484fe64e..f27bfd479a5c 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -10,20 +10,30 @@ project('libcamera', 'c', 'cpp',\n ],\n license : 'LGPL 2.1+')\n \n-# Generate version information. The libcamera_git_version variable contains the\n-# full version with git patch count and SHA1 (e.g. 1.2.3+211-c94a24f4), while\n-# the libcamera_version variable contains the major.minor.patch (e.g. 1.2.3)\n-# only. If the source tree isn't under git control, or if it matches the last\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.build_root()).stdout().strip()\n-if libcamera_git_version == ''\n- libcamera_git_version = meson.project_version()\n+fs_mod = import('fs')\n+if not fs_mod.is_file('version.gen')\n+ # Generate version information. The libcamera_git_version variable contains the\n+ # the full version with git patch count and SHA1 (e.g. 1.2.3+211-c94a24f4), while\n+ # the libcamera_version variable contains the major.minor.patch (e.g. 1.2.3)\n+ # only. If the source tree isn't under git control, or if it matches the last\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.build_root()).stdout().strip()\n+ if libcamera_git_version == ''\n+ libcamera_git_version = meson.project_version()\n+ endif\n+else\n+ # Read the version information from the file generated by the utils/run-dist.sh\n+ # script on a 'meson dist' command.\n+ libcamera_git_version = run_command(['cat', 'version.gen']).stdout().strip()\n endif\n \n libcamera_version = libcamera_git_version.split('+')[0]\n \n+# This script gererates the version.gen file on a 'meson dist' command.\n+meson.add_dist_script('utils/run-dist.sh')\n+\n # Configure the build environment.\n cc = meson.get_compiler('c')\n cxx = meson.get_compiler('cpp')\ndiff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\nindex 243dd3c180eb..360eaf80ecf1 100644\n--- a/src/libcamera/meson.build\n+++ b/src/libcamera/meson.build\n@@ -93,12 +93,11 @@ endforeach\n \n libcamera_sources += control_sources\n \n-gen_version = meson.source_root() / 'utils' / 'gen-version.sh'\n-\n-version_cpp = vcs_tag(command : [gen_version, meson.build_root()],\n- input : 'version.cpp.in',\n- output : 'version.cpp',\n- fallback : meson.project_version())\n+version_data = configuration_data()\n+version_data.set('VCS_TAG', libcamera_git_version)\n+version_cpp = configure_file(input : 'version.cpp.in',\n+ output : 'version.cpp',\n+ configuration : version_data)\n \n libcamera_sources += version_cpp\n \ndiff --git a/utils/run-dist.sh b/utils/run-dist.sh\nnew file mode 100644\nindex 000000000000..1b2a6348c6bc\n--- /dev/null\n+++ b/utils/run-dist.sh\n@@ -0,0 +1,9 @@\n+#!/bin/sh\n+\n+# SPDX-License-Identifier: GPL-2.0-or-later\n+#\n+# On a meson dist run, generate the version string and store it in a file.\n+# This will late be picked up by the build system and used in place of running\n+# the utils/gen-version.sh script again since we may not be running in the\n+# upstream git source tree, and so version information would be lost.\n+\"$MESON_DIST_ROOT\"/utils/gen-version.sh > \"$MESON_DIST_ROOT\"/version.gen\n", "prefixes": [ "libcamera-devel", "RFC", "1/1" ] }