Show a patch.

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

{
    "id": 3201,
    "url": "https://patchwork.libcamera.org/api/patches/3201/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3201/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20200319152533.GA4938@kaaira-HP-Pavilion-Notebook>",
    "date": "2020-03-19T15:25:33",
    "name": "[libcamera-devel,v4] libcamera: utils: adapt libcameraPath to match use cases",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "7e2d743f754df0f7453d5ffc8406462922c7a5ca",
    "submitter": {
        "id": 39,
        "url": "https://patchwork.libcamera.org/api/people/39/?format=api",
        "name": "Kaaira Gupta",
        "email": "kgupta@es.iitr.ac.in"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/3201/mbox/",
    "series": [
        {
            "id": 743,
            "url": "https://patchwork.libcamera.org/api/series/743/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=743",
            "date": "2020-03-19T15:25:33",
            "name": "[libcamera-devel,v4] libcamera: utils: adapt libcameraPath to match use cases",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/743/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/3201/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3201/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<kgupta@es.iitr.ac.in>",
        "Received": [
            "from mail-pl1-x635.google.com (mail-pl1-x635.google.com\n\t[IPv6:2607:f8b0:4864:20::635])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 14304629AC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Mar 2020 16:25:43 +0100 (CET)",
            "by mail-pl1-x635.google.com with SMTP id m1so1202173pll.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Mar 2020 08:25:42 -0700 (PDT)",
            "from kaaira-HP-Pavilion-Notebook ([103.113.213.153])\n\tby smtp.gmail.com with ESMTPSA id\n\tgc16sm2417024pjb.8.2020.03.19.08.25.38\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tThu, 19 Mar 2020 08:25:40 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:subject:message-id:mime-version:content-disposition\n\t:user-agent; bh=ps4FgPstPR09Br6RJ5ePHDC5/6I2wW7HsL2VU0fGD4E=;\n\tb=02hda8GYXXpAhGb1Z1KgQLWBMY+1cI1JIB5vS3f2A8unWZN7POPGyiDQaQZa/1kjYt\n\tD0+BcWkeDmWt8/UYjVLu/9FiXKwXnkKFwi0nXc4+Wl/0Mbt4hzWgzFtgVUa4y3BDzA8V\n\tO1+kAaIfgBkGv25wyNXEtq4kajtUuYt23kLxGCyYl5/70JymQI76o+b0VSR2tkNcTD2H\n\toL0SFxFhzOq9/kWWt2KW7sfMj1d2Tn4jqZachJOL4e7h2IZ6ajh8kEYHKObykBo5gaDb\n\tn2M7TSkcutmR2gognAhiAmkKq6HudwiHjw4/sDvzHZ1BRXQn74wyNrn+980ZExskQh7K\n\tPYtw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:subject:message-id:mime-version\n\t:content-disposition:user-agent;\n\tbh=ps4FgPstPR09Br6RJ5ePHDC5/6I2wW7HsL2VU0fGD4E=;\n\tb=SmX8rmOlrNVVfF6TBR6U8DjzGN6TjbJhTPtpGm72VQGGuhYdXd26DNQacca4I+Xbj/\n\tkticZsvkfCk1HiImBZdZlrcBULyWUWjU4BoXH+h/xin254/ci+++JF1GeCLauQhhKOVH\n\ttitduOsU6OG6MFujTlk68/juSBJ6cuuAo7EDVlc7ceaTbVDqCQbm2qCSUlCnaOoCL9Dn\n\t28RsLC4o9BYe9jx88Fsbxy2ePeKFiTdrhF5dAdB7Dj0h21xNmyy5X8qsfHVisfsYA8M6\n\twsUsNymoKEm4smoRYXq3nfTWrvK4KzXJV6QgAtznYH56zhvz7eIIEH20RlaGVi9hn2W7\n\tuTEw==",
        "X-Gm-Message-State": "ANhLgQ3yPBZjyhESbnh3J55KsE385GbvAi12M+IxQXXiuY6+hOfuXpg8\n\tQLIhmeYnAoAL4lKpxmnsFKEo5g==",
        "X-Google-Smtp-Source": "ADFU+vulA4aQ2NNy9UVizV4VgMTrAg1viLtRrS60Gg18kwmynUCA4+x+igWfWQMFNCYse31yQxMHhg==",
        "X-Received": "by 2002:a17:90a:228c:: with SMTP id\n\ts12mr4420935pjc.68.1584631541258; \n\tThu, 19 Mar 2020 08:25:41 -0700 (PDT)",
        "Date": "Thu, 19 Mar 2020 20:55:33 +0530",
        "From": "Kaaira Gupta <kgupta@es.iitr.ac.in>",
        "To": "Kieran Bingham <kieran.bingham@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tKaaira Gupta <kgupta@es.iitr.ac.in>,\n\tHelen Koike <helen.koike@collabora.com>,\n\tVaishali Thakkar <vthakkar@vaishalithakkar.in>,\n\tlibcamera-devel@lists.libcamera.org",
        "Message-ID": "<20200319152533.GA4938@kaaira-HP-Pavilion-Notebook>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=us-ascii",
        "Content-Disposition": "inline",
        "User-Agent": "Mutt/1.9.4 (2018-02-28)",
        "Subject": "[libcamera-devel] [PATCH LIBCAMERA v4] libcamera: utils: adapt\n\tlibcameraPath to match use cases",
        "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>",
        "X-List-Received-Date": "Thu, 19 Mar 2020 15:25:43 -0000"
    },
    "content": "The two callers of functions libcameraPath() and isLibcameraInstalled()\nend up using the same process and finally use the path with\nlibcamera.so. Hence write a function libcameraBuildPath() which\ncombines their functions and returns the root of the build sources\nwhen the library has not been installed, but is running, thereby making\ncall sites simpler.\n\nWhen the library is installed, libcameraBuildPath() will return an empty\nstring.\n\nMake changes in the call sites accordingly.\n\nSigned-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>\n---\nChanges since v3:\n        - removed isLibcameraInstalled() from utils.h\n        - reformatted the code to reduce indentation of the code that\n          implements actual logic, also, to catch the errors\n          immediately.\n        - changes in spellings and whitespaces in commit messages.\n\nChanges since v2:\n        - rename subject line and add necessary details in commit\n          message.\n        - Solve whitespace issues.\n        - specify the final 'slash' for directory path in return\n          statement itself.\n\nChanges since v1:\n        - rename function to libcameraBuildPath() instead, and return\n          the root of libcamera source, and not the source directory\n          root.\n        - Return empty string instead of nullptr when ret==0\n\n src/libcamera/include/utils.h |  4 +---\n src/libcamera/ipa_manager.cpp |  5 +++--\n src/libcamera/ipa_proxy.cpp   |  6 +++---\n src/libcamera/utils.cpp       | 11 +++++++----\n 4 files changed, 14 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h\nindex bc96e79..cfa620f 100644\n--- a/src/libcamera/include/utils.h\n+++ b/src/libcamera/include/utils.h\n@@ -143,9 +143,7 @@ private:\n \n details::StringSplitter split(const std::string &str, const std::string &delim);\n \n-bool isLibcameraInstalled();\n-\n-std::string libcameraPath();\n+std::string libcameraBuildPath();\n \n } /* namespace utils */\n \ndiff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\nindex 0bd280c..bcaae35 100644\n--- a/src/libcamera/ipa_manager.cpp\n+++ b/src/libcamera/ipa_manager.cpp\n@@ -119,8 +119,9 @@ IPAManager::IPAManager()\n \t * path for the IPA from that point. We need to recurse one level of\n \t * sub-directories to match the build tree.\n \t */\n-\tif (!utils::isLibcameraInstalled()) {\n-\t\tstd::string ipaBuildPath = utils::dirname(utils::libcameraPath()) + \"/../ipa\";\n+\tstd::string root = utils::libcameraBuildPath();\n+\tif (!root.empty()) {\n+\t\tstd::string ipaBuildPath = root + \"src/ipa\";\n \t\tconstexpr int maxDepth = 1;\n \n \t\tLOG(IPAManager, Info)\ndiff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp\nindex 2f866cc..5fd88a4 100644\n--- a/src/libcamera/ipa_proxy.cpp\n+++ b/src/libcamera/ipa_proxy.cpp\n@@ -97,9 +97,9 @@ std::string IPAProxy::resolvePath(const std::string &file) const\n \t * This requires identifying the path of the libcamera.so, and\n \t * referencing a relative path for the proxy workers from that point.\n \t */\n-\tif (!utils::isLibcameraInstalled()) {\n-\t\tstd::string ipaProxyDir = utils::dirname(utils::libcameraPath())\n-\t\t\t\t\t  + \"/proxy/worker\";\n+\tstd::string root = utils::libcameraBuildPath();\n+\tif (!root.empty()) {\n+\t\tstd::string ipaProxyDir = root + \"src/libcamera/proxy/worker\";\n \n \t\tLOG(IPAProxy, Info)\n \t\t\t<< \"libcamera is not installed. Loading proxy workers from'\"\ndiff --git a/src/libcamera/utils.cpp b/src/libcamera/utils.cpp\nindex 7e118fa..40a8367 100644\n--- a/src/libcamera/utils.cpp\n+++ b/src/libcamera/utils.cpp\n@@ -347,16 +347,19 @@ bool isLibcameraInstalled()\n  *\n  * \\return A string stating the path\n  */\n-std::string libcameraPath()\n+std::string libcameraBuildPath()\n {\n+\tif (isLibcameraInstalled())\n+\t\treturn std::string();\n+\n \tDl_info info;\n \n \t/* Look up our own symbol. */\n-\tint ret = dladdr(reinterpret_cast<void *>(libcameraPath), &info);\n+\tint ret = dladdr(reinterpret_cast<void *>(libcameraBuildPath), &info);\n \tif (ret == 0)\n-\t\treturn nullptr;\n+\t\treturn std::string();\n \n-\treturn info.dli_fname;\n+\treturn dirname(info.dli_fname) + \"/../../\";\n }\n \n } /* namespace utils */\n",
    "prefixes": [
        "libcamera-devel",
        "v4"
    ]
}