[{"id":25760,"web_url":"https://patchwork.libcamera.org/comment/25760/","msgid":"<Y2xvqKaugLFbtrcG@pyrite.rasen.tech>","date":"2022-11-10T03:27:36","subject":"Re: [libcamera-devel] [PATCH v1] libcamera: tracing: fix header\n\tgeneration when built as subproject","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Wed, Nov 09, 2022 at 04:36:14PM +0000, Barnabás Pőcze via libcamera-devel wrote:\n> Date: Wed, 09 Nov 2022 16:36:14 +0000\n> From: Barnabás Pőcze <pobrn@protonmail.com>\n> To: libcamera-devel@lists.libcamera.org\n> Subject: [PATCH v1] libcamera: tracing: fix header generation when built as\n>  subproject\n> \n> The previously used\n> \n>   path = output.replace('include/', '', 1)\n> \n> logic is not sufficient to correctly determine the proper path\n> when libcamera is built as a subproject. Fix it by using Python's\n> pathlib to calculate the relative path of the output file with\n> respect to the \"include\" directory of libcamera.\n> \n> Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  include/libcamera/internal/meson.build |  2 +-\n>  include/meson.build                    |  2 ++\n>  utils/tracepoints/gen-tp-header.py     | 13 +++++++------\n>  3 files changed, 10 insertions(+), 7 deletions(-)\n> \n> diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build\n> index 7a780d48ee57..f8be86e040c5 100644\n> --- a/include/libcamera/internal/meson.build\n> +++ b/include/libcamera/internal/meson.build\n> @@ -6,7 +6,7 @@ libcamera_tracepoint_header = custom_target(\n>      'tp_header',\n>      input: ['tracepoints.h.in', tracepoint_files],\n>      output: 'tracepoints.h',\n> -    command: [gen_tracepoints_header, '@OUTPUT@', '@INPUT@'],\n> +    command: [gen_tracepoints_header, include_build_dir, '@OUTPUT@', '@INPUT@'],\n>  )\n> \n>  libcamera_internal_headers = files([\n> diff --git a/include/meson.build b/include/meson.build\n> index 27ce2f41c534..19b93a7bd753 100644\n> --- a/include/meson.build\n> +++ b/include/meson.build\n> @@ -1,4 +1,6 @@\n>  # SPDX-License-Identifier: CC0-1.0\n> \n> +include_build_dir = meson.current_build_dir()\n> +\n>  subdir('android')\n>  subdir('libcamera')\n> diff --git a/utils/tracepoints/gen-tp-header.py b/utils/tracepoints/gen-tp-header.py\n> index bbd472d972d0..a454615e4625 100755\n> --- a/utils/tracepoints/gen-tp-header.py\n> +++ b/utils/tracepoints/gen-tp-header.py\n> @@ -8,22 +8,23 @@\n> \n>  import datetime\n>  import jinja2\n> +import pathlib\n>  import os\n>  import sys\n> \n>  def main(argv):\n> -    if len(argv) < 3:\n> -        print(f'Usage: {argv[0]} output template tp_files...')\n> +    if len(argv) < 4:\n> +        print(f'Usage: {argv[0]} include_build_dir output template tp_files...')\n>          return 1\n> \n> -    output = argv[1]\n> -    template = argv[2]\n> +    output = argv[2]\n> +    template = argv[3]\n> \n>      year = datetime.datetime.now().year\n> -    path = output.replace('include/', '', 1)\n> +    path = pathlib.Path(output).absolute().relative_to(argv[1])\n> \n>      source = ''\n> -    for fname in argv[3:]:\n> +    for fname in argv[4:]:\n>          source += open(fname, 'r', encoding='utf-8').read() + '\\n\\n'\n> \n>      template = jinja2.Template(open(template, 'r', encoding='utf-8').read())\n> --\n> 2.38.1\n> \n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C149FBE08B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 10 Nov 2022 03:27:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 30B6C6307B;\n\tThu, 10 Nov 2022 04:27:46 +0100 (CET)","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 5ADA06303D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Nov 2022 04:27:44 +0100 (CET)","from pyrite.rasen.tech (h175-177-042-159.catv02.itscom.jp\n\t[175.177.42.159])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B56A7499;\n\tThu, 10 Nov 2022 04:27:42 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1668050866;\n\tbh=Y8R+La+KMdE1l4m0WX5kIruN86eDOFP6RGe4z6ozGAA=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=h2FLcjkdEJo0ojweM7NobTDOIz9mZ8bl3FmnwrRqgQXnm2yHxAHZ+u1LbdGs7p9n6\n\tRAsAHcyIEbmXX8GxTmeKWQy/MYKMCEJG9shbxtr5gCISpO9a/f/nlq09y5eR/PaOI+\n\tfazfRudN2Qdi5yxJsij+LVVneOIFqKiXi18AXwxrXqpJVw8shM9Qsp+/f1OFsE+aLa\n\thF/zJoqSBEQIYsFYsN8OGjg3kICB4PXto0AUMTeeSStzfla7bXS4uY9YD6MXElVBRo\n\t2Y0r/XiprQsbpVXNsMZNtciqlVS3Dzbf6i7jOVRnzJecsyPhq4926FgJKouRmCU2YP\n\tnm2+d5111bFLQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1668050863;\n\tbh=Y8R+La+KMdE1l4m0WX5kIruN86eDOFP6RGe4z6ozGAA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=iIrFiClTUMcwCBy0uC2+Fwxds6fenyX5IT/CC0geMkdNAD2WcAkY8MuoWPfrqbS8S\n\t0+D7C5MtJpHq562K0frj1/naHtkYQMAHJ/173OzAoPVILRo6NfMg60Xe/1BQI0fCH5\n\t+FTjadk32zxP3pL8kQna/Oc623K8Sqww+CcEwgOM="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"iIrFiClT\"; dkim-atps=neutral","Date":"Thu, 10 Nov 2022 12:27:36 +0900","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Message-ID":"<Y2xvqKaugLFbtrcG@pyrite.rasen.tech>","References":"<mailman.114.1668011787.939.libcamera-devel@lists.libcamera.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<mailman.114.1668011787.939.libcamera-devel@lists.libcamera.org>","Subject":"Re: [libcamera-devel] [PATCH v1] libcamera: tracing: fix header\n\tgeneration when built as subproject","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>","From":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":25788,"web_url":"https://patchwork.libcamera.org/comment/25788/","msgid":"<166844140870.50677.5081194026816068211@Monstersaurus>","date":"2022-11-14T15:56:48","subject":"Re: [libcamera-devel] [PATCH v1] libcamera: tracing: fix header\n\tgeneration when built as subproject","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Paul Elder via libcamera-devel (2022-11-10 03:27:36)\n> On Wed, Nov 09, 2022 at 04:36:14PM +0000, Barnabás Pőcze via libcamera-devel wrote:\n> > Date: Wed, 09 Nov 2022 16:36:14 +0000\n> > From: Barnabás Pőcze <pobrn@protonmail.com>\n> > To: libcamera-devel@lists.libcamera.org\n> > Subject: [PATCH v1] libcamera: tracing: fix header generation when built as\n> >  subproject\n> > \n> > The previously used\n> > \n> >   path = output.replace('include/', '', 1)\n> > \n> > logic is not sufficient to correctly determine the proper path\n> > when libcamera is built as a subproject. Fix it by using Python's\n> > pathlib to calculate the relative path of the output file with\n> > respect to the \"include\" directory of libcamera.\n> > \n> > Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n> \n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\nThis looks ok to me, and doesn't break the builds for my integration\ntests - but I haven't easily tested as a submodule yet.\n\nHowever, given that I expect that has been tested by Barnabás,\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> \n> > ---\n> >  include/libcamera/internal/meson.build |  2 +-\n> >  include/meson.build                    |  2 ++\n> >  utils/tracepoints/gen-tp-header.py     | 13 +++++++------\n> >  3 files changed, 10 insertions(+), 7 deletions(-)\n> > \n> > diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build\n> > index 7a780d48ee57..f8be86e040c5 100644\n> > --- a/include/libcamera/internal/meson.build\n> > +++ b/include/libcamera/internal/meson.build\n> > @@ -6,7 +6,7 @@ libcamera_tracepoint_header = custom_target(\n> >      'tp_header',\n> >      input: ['tracepoints.h.in', tracepoint_files],\n> >      output: 'tracepoints.h',\n> > -    command: [gen_tracepoints_header, '@OUTPUT@', '@INPUT@'],\n> > +    command: [gen_tracepoints_header, include_build_dir, '@OUTPUT@', '@INPUT@'],\n> >  )\n> > \n> >  libcamera_internal_headers = files([\n> > diff --git a/include/meson.build b/include/meson.build\n> > index 27ce2f41c534..19b93a7bd753 100644\n> > --- a/include/meson.build\n> > +++ b/include/meson.build\n> > @@ -1,4 +1,6 @@\n> >  # SPDX-License-Identifier: CC0-1.0\n> > \n> > +include_build_dir = meson.current_build_dir()\n> > +\n> >  subdir('android')\n> >  subdir('libcamera')\n> > diff --git a/utils/tracepoints/gen-tp-header.py b/utils/tracepoints/gen-tp-header.py\n> > index bbd472d972d0..a454615e4625 100755\n> > --- a/utils/tracepoints/gen-tp-header.py\n> > +++ b/utils/tracepoints/gen-tp-header.py\n> > @@ -8,22 +8,23 @@\n> > \n> >  import datetime\n> >  import jinja2\n> > +import pathlib\n> >  import os\n> >  import sys\n> > \n> >  def main(argv):\n> > -    if len(argv) < 3:\n> > -        print(f'Usage: {argv[0]} output template tp_files...')\n> > +    if len(argv) < 4:\n> > +        print(f'Usage: {argv[0]} include_build_dir output template tp_files...')\n> >          return 1\n> > \n> > -    output = argv[1]\n> > -    template = argv[2]\n> > +    output = argv[2]\n> > +    template = argv[3]\n> > \n> >      year = datetime.datetime.now().year\n> > -    path = output.replace('include/', '', 1)\n> > +    path = pathlib.Path(output).absolute().relative_to(argv[1])\n> > \n> >      source = ''\n> > -    for fname in argv[3:]:\n> > +    for fname in argv[4:]:\n> >          source += open(fname, 'r', encoding='utf-8').read() + '\\n\\n'\n> > \n> >      template = jinja2.Template(open(template, 'r', encoding='utf-8').read())\n> > --\n> > 2.38.1\n> > \n> >","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C4014BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 14 Nov 2022 15:56:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EE30863088;\n\tMon, 14 Nov 2022 16:56:52 +0100 (CET)","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 E879661F3B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Nov 2022 16:56:51 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5A0CC903;\n\tMon, 14 Nov 2022 16:56:51 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1668441413;\n\tbh=Eop4Jv8AceWoqK2SDMfbP8IIUBYEDVa4wxzbWR4dJeE=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=MP3ei7t8uBTprL3HMqi+KF1qXk1lk8LdFJ37/eXgEuQTveIQ4meSq6HyTERHDVin8\n\tlsUV7eIP/bk+QCaGCfynimhh/EuAJElniayCterhRcAkdbx2YD7jWFbmBjlCk4kQhi\n\tAjeWnOYOqsewg4+Fh3iH8ki+su6Ebik6ILxN9GhnTQU8p2g4L6iwCEBoyc2nl0iVHg\n\tbQjditKfBCTlUNfHu0pGJmaQJVSeyhMFA8ATYrnc70Bbgx0M36x6DiJFUfDc8crbkz\n\t3fLTpG0liOxPUigRrIiDByp2rJWXveVDBeStqoGEXawDfNCnw7jWRPk58lOpTd+z1C\n\tLKVZYY94+njMw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1668441411;\n\tbh=Eop4Jv8AceWoqK2SDMfbP8IIUBYEDVa4wxzbWR4dJeE=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=QBA1j++uT0jeaMP0tZkQjU44tndRQuFAnhWyhGWgUtuRnPxn1AIb20TNcYuIneiCl\n\tOd5TWAl4xdJ+7UDznDsyArl6QIVblQsbekatAG0J3I3jafnofjwoVQhkGye3TbrFaj\n\trVDfnQZMqhrv/Igh4bYcho759VazSa1j3T+h8xDA="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"QBA1j++u\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<Y2xvqKaugLFbtrcG@pyrite.rasen.tech>","References":"<mailman.114.1668011787.939.libcamera-devel@lists.libcamera.org>\n\t<Y2xvqKaugLFbtrcG@pyrite.rasen.tech>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>, Paul Elder via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Date":"Mon, 14 Nov 2022 15:56:48 +0000","Message-ID":"<166844140870.50677.5081194026816068211@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v1] libcamera: tracing: fix header\n\tgeneration when built as subproject","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>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":25789,"web_url":"https://patchwork.libcamera.org/comment/25789/","msgid":"<mailman.115.1668442352.939.libcamera-devel@lists.libcamera.org>","date":"2022-11-14T16:12:23","subject":"Re: [libcamera-devel] [PATCH v1] libcamera: tracing: fix header\n\tgeneration when built as subproject","submitter":{"id":133,"url":"https://patchwork.libcamera.org/api/people/133/","name":"Pőcze Barnabás","email":"pobrn@protonmail.com"},"content":"Hi\n\n\n> Quoting Paul Elder via libcamera-devel (2022-11-10 03:27:36)\n> > On Wed, Nov 09, 2022 at 04:36:14PM +0000, Barnabás Pőcze via libcamera-devel wrote:\n> > > Date: Wed, 09 Nov 2022 16:36:14 +0000\n> > > From: Barnabás Pőcze <pobrn@protonmail.com>\n> > > To: libcamera-devel@lists.libcamera.org\n> > > Subject: [PATCH v1] libcamera: tracing: fix header generation when built as\n> > >  subproject\n> > >\n> > > The previously used\n> > >\n> > >   path = output.replace('include/', '', 1)\n> > >\n> > > logic is not sufficient to correctly determine the proper path\n> > > when libcamera is built as a subproject. Fix it by using Python's\n> > > pathlib to calculate the relative path of the output file with\n> > > respect to the \"include\" directory of libcamera.\n> > >\n> > > Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n> >\n> > Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> \n> This looks ok to me, and doesn't break the builds for my integration\n> tests - but I haven't easily tested as a submodule yet.\n> \n> However, given that I expect that has been tested by Barnabás,\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n\nI am using this with pipewire. For non-subproject builds it should generate\nthe exact same path that was previously generated.\n\nI did not elaborate in the commit message but the issue is that when built as a\nsubproject, the value of `path` would be\n\n  'subprojects/libcamera/include/libcamera/internal/tracepoints.h'.replace('include/', '', 1)\n\nwhich evaluates to\n\n  'subprojects/libcamera/libcamera/internal/tracepoints.h'\n\nso the tracepoints.h header file will try to include:\n\n  #define TRACEPOINT_INCLUDE \"subprojects/libcamera/libcamera/internal/tracepoints.h\"\n\nwhich will fail.\n\nMy understanding of the previous logic was that it tried to set `path` to\nthe path of the output file relative to the libcamera include directory.\n\nThe\n\n  pathlib.Path(output).absolute().relative_to(argv[1])\n\nexpression is supposed to do the same.\n\n\nRegards,\nBarnabás Pőcze\n\n> >\n> > > ---\n> > >  include/libcamera/internal/meson.build |  2 +-\n> > >  include/meson.build                    |  2 ++\n> > >  utils/tracepoints/gen-tp-header.py     | 13 +++++++------\n> > >  3 files changed, 10 insertions(+), 7 deletions(-)\n> > >\n> > > diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build\n> > > index 7a780d48ee57..f8be86e040c5 100644\n> > > --- a/include/libcamera/internal/meson.build\n> > > +++ b/include/libcamera/internal/meson.build\n> > > @@ -6,7 +6,7 @@ libcamera_tracepoint_header = custom_target(\n> > >      'tp_header',\n> > >      input: ['tracepoints.h.in', tracepoint_files],\n> > >      output: 'tracepoints.h',\n> > > -    command: [gen_tracepoints_header, '@OUTPUT@', '@INPUT@'],\n> > > +    command: [gen_tracepoints_header, include_build_dir, '@OUTPUT@', '@INPUT@'],\n> > >  )\n> > >\n> > >  libcamera_internal_headers = files([\n> > > diff --git a/include/meson.build b/include/meson.build\n> > > index 27ce2f41c534..19b93a7bd753 100644\n> > > --- a/include/meson.build\n> > > +++ b/include/meson.build\n> > > @@ -1,4 +1,6 @@\n> > >  # SPDX-License-Identifier: CC0-1.0\n> > >\n> > > +include_build_dir = meson.current_build_dir()\n> > > +\n> > >  subdir('android')\n> > >  subdir('libcamera')\n> > > diff --git a/utils/tracepoints/gen-tp-header.py b/utils/tracepoints/gen-tp-header.py\n> > > index bbd472d972d0..a454615e4625 100755\n> > > --- a/utils/tracepoints/gen-tp-header.py\n> > > +++ b/utils/tracepoints/gen-tp-header.py\n> > > @@ -8,22 +8,23 @@\n> > >\n> > >  import datetime\n> > >  import jinja2\n> > > +import pathlib\n> > >  import os\n> > >  import sys\n> > >\n> > >  def main(argv):\n> > > -    if len(argv) < 3:\n> > > -        print(f'Usage: {argv[0]} output template tp_files...')\n> > > +    if len(argv) < 4:\n> > > +        print(f'Usage: {argv[0]} include_build_dir output template tp_files...')\n> > >          return 1\n> > >\n> > > -    output = argv[1]\n> > > -    template = argv[2]\n> > > +    output = argv[2]\n> > > +    template = argv[3]\n> > >\n> > >      year = datetime.datetime.now().year\n> > > -    path = output.replace('include/', '', 1)\n> > > +    path = pathlib.Path(output).absolute().relative_to(argv[1])\n> > >\n> > >      source = ''\n> > > -    for fname in argv[3:]:\n> > > +    for fname in argv[4:]:\n> > >          source += open(fname, 'r', encoding='utf-8').read() + '\\n\\n'\n> > >\n> > >      template = jinja2.Template(open(template, 'r', encoding='utf-8').read())\n> > > --\n> > > 2.38.1\n> > >\n> > >\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 40BFBBE08B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 14 Nov 2022 16:12:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B48B16307F;\n\tMon, 14 Nov 2022 17:12:33 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1668442353;\n\tbh=5qNNGlHwVclkrGDna7GEJOYvMhTvf0NCEYZwJPcY3X4=;\n\th=Date:To:In-Reply-To:References:List-Id:List-Post:From:Cc:\n\tList-Subscribe:List-Unsubscribe:List-Archive:Reply-To:List-Help:\n\tSubject:From;\n\tb=cnOo8vSFZVhWXlKF9ITjG7jOFKVd9ScBZZFnIti50rL0PA5ME7ISYNyGc1wKX3ZNH\n\tzHDeJpxnFIcRcyDgCD4P3zaABTnpDfttbSE/gFfEKldj/s3QANz9FK5mihD3JgQY+9\n\tiPt3gV3d3kNdhtFA09H8XaH3/A4tfrn6/WRv47Kb4KBVMOOkgevpIkJWIuu+YkbJuf\n\txkyhVE3IFNLnHb2A7vxYl4uvttTpLTtNpJVagpUagX041xmhgTeIiin1tpvnvrZGcl\n\tk/X5+fyX5SJC6ajXpzAHItxPdGw+zN8EBDKJcmAozg5Kdajw7XjKc9F0rxiEPYLZwR\n\thT0ZmJkRlYewQ==","Date":"Mon, 14 Nov 2022 16:12:23 +0000","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","In-Reply-To":"<166844140870.50677.5081194026816068211@Monstersaurus>","References":"<mailman.114.1668011787.939.libcamera-devel@lists.libcamera.org>\n\t<Y2xvqKaugLFbtrcG@pyrite.rasen.tech>\n\t<166844140870.50677.5081194026816068211@Monstersaurus>","MIME-Version":"1.0","Message-ID":"<mailman.115.1668442352.939.libcamera-devel@lists.libcamera.org>","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze_via_libcamera-devel?=\n\t<libcamera-devel@lists.libcamera.org>","Precedence":"list","Cc":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","X-BeenThere":"libcamera-devel@lists.libcamera.org","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","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/>","Reply-To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","Subject":"Re: [libcamera-devel] [PATCH v1] libcamera: tracing: fix header\n\tgeneration when built as subproject","Content-Type":"message/rfc822","Content-Disposition":"inline","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":25790,"web_url":"https://patchwork.libcamera.org/comment/25790/","msgid":"<Y3JpzXszFH96mE0l@pendragon.ideasonboard.com>","date":"2022-11-14T16:16:13","subject":"Re: [libcamera-devel] [PATCH v1] libcamera: tracing: fix header\n\tgeneration when built as subproject","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Barnabás,\n\nOn Mon, Nov 14, 2022 at 04:12:23PM +0000, Barnabás Pőcze via libcamera-devel wrote:\n> On Mon, 14 Nov 2022 16:12:23 +0000, Kieran Bingham wrote:\n> > Quoting Paul Elder via libcamera-devel (2022-11-10 03:27:36)\n> > > On Wed, Nov 09, 2022 at 04:36:14PM +0000, Barnabás Pőcze via libcamera-devel wrote:\n> > > > Date: Wed, 09 Nov 2022 16:36:14 +0000\n> > > > From: Barnabás Pőcze <pobrn@protonmail.com>\n> > > > To: libcamera-devel@lists.libcamera.org\n> > > > Subject: [PATCH v1] libcamera: tracing: fix header generation when built as\n> > > >  subproject\n> > > >\n> > > > The previously used\n> > > >\n> > > >   path = output.replace('include/', '', 1)\n> > > >\n> > > > logic is not sufficient to correctly determine the proper path\n> > > > when libcamera is built as a subproject. Fix it by using Python's\n> > > > pathlib to calculate the relative path of the output file with\n> > > > respect to the \"include\" directory of libcamera.\n> > > >\n> > > > Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n> > >\n> > > Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> > \n> > This looks ok to me, and doesn't break the builds for my integration\n> > tests - but I haven't easily tested as a submodule yet.\n> > \n> > However, given that I expect that has been tested by Barnabás,\n> > \n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> I am using this with pipewire. For non-subproject builds it should generate\n> the exact same path that was previously generated.\n> \n> I did not elaborate in the commit message but the issue is that when built as a\n> subproject, the value of `path` would be\n> \n>   'subprojects/libcamera/include/libcamera/internal/tracepoints.h'.replace('include/', '', 1)\n> \n> which evaluates to\n> \n>   'subprojects/libcamera/libcamera/internal/tracepoints.h'\n> \n> so the tracepoints.h header file will try to include:\n> \n>   #define TRACEPOINT_INCLUDE \"subprojects/libcamera/libcamera/internal/tracepoints.h\"\n> \n> which will fail.\n\nThank you for the explanation, I was wondering what was wrong with the\nprevious logic. Kieran, could you record this in the commit message when\npushing ?\n\n> My understanding of the previous logic was that it tried to set `path` to\n> the path of the output file relative to the libcamera include directory.\n> \n> The\n> \n>   pathlib.Path(output).absolute().relative_to(argv[1])\n> \n> expression is supposed to do the same.\n> \n> > > > ---\n> > > >  include/libcamera/internal/meson.build |  2 +-\n> > > >  include/meson.build                    |  2 ++\n> > > >  utils/tracepoints/gen-tp-header.py     | 13 +++++++------\n> > > >  3 files changed, 10 insertions(+), 7 deletions(-)\n> > > >\n> > > > diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build\n> > > > index 7a780d48ee57..f8be86e040c5 100644\n> > > > --- a/include/libcamera/internal/meson.build\n> > > > +++ b/include/libcamera/internal/meson.build\n> > > > @@ -6,7 +6,7 @@ libcamera_tracepoint_header = custom_target(\n> > > >      'tp_header',\n> > > >      input: ['tracepoints.h.in', tracepoint_files],\n> > > >      output: 'tracepoints.h',\n> > > > -    command: [gen_tracepoints_header, '@OUTPUT@', '@INPUT@'],\n> > > > +    command: [gen_tracepoints_header, include_build_dir, '@OUTPUT@', '@INPUT@'],\n> > > >  )\n> > > >\n> > > >  libcamera_internal_headers = files([\n> > > > diff --git a/include/meson.build b/include/meson.build\n> > > > index 27ce2f41c534..19b93a7bd753 100644\n> > > > --- a/include/meson.build\n> > > > +++ b/include/meson.build\n> > > > @@ -1,4 +1,6 @@\n> > > >  # SPDX-License-Identifier: CC0-1.0\n> > > >\n> > > > +include_build_dir = meson.current_build_dir()\n> > > > +\n> > > >  subdir('android')\n> > > >  subdir('libcamera')\n> > > > diff --git a/utils/tracepoints/gen-tp-header.py b/utils/tracepoints/gen-tp-header.py\n> > > > index bbd472d972d0..a454615e4625 100755\n> > > > --- a/utils/tracepoints/gen-tp-header.py\n> > > > +++ b/utils/tracepoints/gen-tp-header.py\n> > > > @@ -8,22 +8,23 @@\n> > > >\n> > > >  import datetime\n> > > >  import jinja2\n> > > > +import pathlib\n> > > >  import os\n> > > >  import sys\n> > > >\n> > > >  def main(argv):\n> > > > -    if len(argv) < 3:\n> > > > -        print(f'Usage: {argv[0]} output template tp_files...')\n> > > > +    if len(argv) < 4:\n> > > > +        print(f'Usage: {argv[0]} include_build_dir output template tp_files...')\n> > > >          return 1\n> > > >\n> > > > -    output = argv[1]\n> > > > -    template = argv[2]\n> > > > +    output = argv[2]\n> > > > +    template = argv[3]\n> > > >\n> > > >      year = datetime.datetime.now().year\n> > > > -    path = output.replace('include/', '', 1)\n> > > > +    path = pathlib.Path(output).absolute().relative_to(argv[1])\n> > > >\n> > > >      source = ''\n> > > > -    for fname in argv[3:]:\n> > > > +    for fname in argv[4:]:\n> > > >          source += open(fname, 'r', encoding='utf-8').read() + '\\n\\n'\n> > > >\n> > > >      template = jinja2.Template(open(template, 'r', encoding='utf-8').read())","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 32F74BD16B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 14 Nov 2022 16:16:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 75E2763088;\n\tMon, 14 Nov 2022 17:16:33 +0100 (CET)","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 4800461F3B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Nov 2022 17:16:32 +0100 (CET)","from pendragon.ideasonboard.com (unknown [46.183.103.8])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D5671891;\n\tMon, 14 Nov 2022 17:16:30 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1668442593;\n\tbh=0MPCDnUeEn4Gj3h5fVuYgEuH1tiaie+zJoOa9c4mfkI=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=G35VLklcEgBkEPLqXl2BrFX7MJLqxm4oqJo25ivJN75fp2uriqsrCALA6NMXqd6G1\n\t80WGA0XL+xRa+sHTPpBbUB+o4b8c6O5DU8sdvrwj8VWbRYUTF25cqcll6NQznRnK3+\n\t3m+txSL4NNYsilG74XhSVJ5InkarBzAr7Kly+cObuucxXGbCG0PPPSRuQngPgqSwMx\n\tFbOesfwnNT7XE42IbvjwZOxLALIj3wxdMQQt6rdRwWVM4m5sV+x4ppxL46z3z905as\n\t0jxJCenl+tD3e8L7blFldPb9vJqnh2HHnpngWliG1NIC4ClaDzGN5/aXM/fTYd+kJw\n\tQFAvB3eSsRNTw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1668442591;\n\tbh=0MPCDnUeEn4Gj3h5fVuYgEuH1tiaie+zJoOa9c4mfkI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ROOQeQP2GYG5WHz17xteLbQ/9KTRFYurs1/QoleCBMwKZELBNXZF3HMftiWZRF+UF\n\tiV2d38gHnWKv+875t17dyCmVn0xHsKKxZ2Lb2xKRXAlPqIvVlRsFG9UgajS/wW8umF\n\tKxfaRlpqeKnUrxXUqgCfwMojx5KlAWMEIewFtGk8="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ROOQeQP2\"; dkim-atps=neutral","Date":"Mon, 14 Nov 2022 18:16:13 +0200","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Message-ID":"<Y3JpzXszFH96mE0l@pendragon.ideasonboard.com>","References":"<mailman.114.1668011787.939.libcamera-devel@lists.libcamera.org>\n\t<Y2xvqKaugLFbtrcG@pyrite.rasen.tech>\n\t<166844140870.50677.5081194026816068211@Monstersaurus>\n\t<mailman.115.1668442352.939.libcamera-devel@lists.libcamera.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<mailman.115.1668442352.939.libcamera-devel@lists.libcamera.org>","Subject":"Re: [libcamera-devel] [PATCH v1] libcamera: tracing: fix header\n\tgeneration when built as subproject","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>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]