Show a patch.

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

{
    "id": 3200,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/3200/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/3200/",
    "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": "<20200319151919.GA4693@kaaira-HP-Pavilion-Notebook>",
    "date": "2020-03-19T15:19:19",
    "name": "[libcamera-devel,v4] libcamera: utils: adapt libcameraPath to match use cases",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "dc6511da3d105a2a5cec49460a59a814d1600239",
    "submitter": {
        "id": 39,
        "url": "https://patchwork.libcamera.org/api/1.1/people/39/?format=api",
        "name": "Kaaira Gupta",
        "email": "kgupta@es.iitr.ac.in"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/3200/mbox/",
    "series": [
        {
            "id": 742,
            "url": "https://patchwork.libcamera.org/api/1.1/series/742/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=742",
            "date": "2020-03-19T15:19:19",
            "name": "[libcamera-devel,v4] libcamera: utils: adapt libcameraPath to match use cases",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/742/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/3200/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/3200/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<kgupta@es.iitr.ac.in>",
        "Received": [
            "from mail-pf1-x429.google.com (mail-pf1-x429.google.com\n\t[IPv6:2607:f8b0:4864:20::429])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 03C21629AC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Mar 2020 16:19:29 +0100 (CET)",
            "by mail-pf1-x429.google.com with SMTP id l184so1592061pfl.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 19 Mar 2020 08:19:28 -0700 (PDT)",
            "from kaaira-HP-Pavilion-Notebook ([103.113.213.153])\n\tby smtp.gmail.com with ESMTPSA id\n\t20sm2578676pfn.58.2020.03.19.08.19.23\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tThu, 19 Mar 2020 08:19:26 -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=xYNQMHyPKu8uqaR7FDWqvuxH569oUVfd3E6rB2FCNx4=;\n\tb=WU5eW9zXRJrnVTHQSJrNd67TuNMvbe4gP5xisnsdA5AT3e6UH6GAfvDD1O/xgOF9B0\n\tVGieGBG61pCHQvzith+Pq9bdkXmPp9Bh99yadqzv0x9LwQCUeAMOnahuS7izIYoYqSVz\n\tLd7JSDQjGrAKfrBlLedC360T6THqmykjCp5WcL8+X7Ys+/X8k3xDXeJ35iFWzwF+OkA3\n\t+5iW9Fdk9XU+wdtHdpvzevvxmlCUoTWacrwCCy4mGztgEIXSACUguHcwR6wzkpJzcDwv\n\t+IteD/r2iQwC3jdtsvSr+8XBeF9IoGZmthcuGvPULxpIsBi6DfHdebS6jBzLfJXXLquh\n\t8dhg==",
        "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=xYNQMHyPKu8uqaR7FDWqvuxH569oUVfd3E6rB2FCNx4=;\n\tb=JkWO7TbQOJ1yFZhY2Sh9T9PKIRDO8gugdVZci8uXHPDrYROboQiRdnwXXGpNurEcXY\n\trvOLHtSML2GM2u5m8O3YPdlYjO+c1qZS4H5KRMokHiI6zw5stpZaq2GydfhdFsNpP0vY\n\t0PD2TiNbgmW0Y14rUsFBGBYsONLz73u+Q5SvtRYyx+6/LYyr9kYYWxujv21OvASctk5o\n\twyANnrJbOnwEXxQpywolhQw3YEM/Qeq/X5x+Vli2kFPunURZU/Z4FiO5l4to7tAFJwPa\n\tEaqTKMWR4eLsOuTwu2qhSuK41Fs3m/xuHBi/C9basDiuR5SNOVPecT1zfkn4ol3KnSMn\n\t+A3A==",
        "X-Gm-Message-State": "ANhLgQ1zPdLgvXgM8005g0w+uVyzJNG18ueg6A10lmXsCDeNNTVOmIgF\n\tcW4cK0DyVcj7G5paS5buVmoJHg==",
        "X-Google-Smtp-Source": "ADFU+vtXNMqw2+ALe5WCJGVKo+EhxbWO84HpSsEw/OBVQV4+x5dfa5f2CmuYK/I7x1xCeFA7tSp+lA==",
        "X-Received": "by 2002:aa7:95ae:: with SMTP id\n\ta14mr4342371pfk.164.1584631167462; \n\tThu, 19 Mar 2020 08:19:27 -0700 (PDT)",
        "Date": "Thu, 19 Mar 2020 20:49:19 +0530",
        "From": "Kaaira Gupta <kgupta@es.iitr.ac.in>",
        "To": "Helen Koike <helen.koike@collabora.com>,\n\tVaishali Thakkar <vthakkar@vaishalithakkar.in>,\n\tkieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org",
        "Message-ID": "<20200319151919.GA4693@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:19:30 -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\t- removed isLibcameraInstalled() from utils.h\n\t- reformatted the code to reduce indentation of the code that\n\t  implements actual logic, also, to catch the errors\n\t  immediately.\n\t- 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 |  2 +-\n src/libcamera/ipa_manager.cpp |  5 +++--\n src/libcamera/ipa_proxy.cpp   |  6 +++---\n src/libcamera/utils.cpp       | 16 +++++++++-------\n 4 files changed, 16 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h\nindex bc96e79..5dea8d2 100644\n--- a/src/libcamera/include/utils.h\n+++ b/src/libcamera/include/utils.h\n@@ -145,7 +145,7 @@ 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..42c5c76 100644\n--- a/src/libcamera/utils.cpp\n+++ b/src/libcamera/utils.cpp\n@@ -347,16 +347,18 @@ bool isLibcameraInstalled()\n  *\n  * \\return A string stating the path\n  */\n-std::string libcameraPath()\n+std::string libcameraBuildPath()\n {\n-\tDl_info info;\n+\tif (!isLibcameraInstalled()) {\n+\t\tDl_info info;\n \n-\t/* Look up our own symbol. */\n-\tint ret = dladdr(reinterpret_cast<void *>(libcameraPath), &info);\n-\tif (ret == 0)\n-\t\treturn nullptr;\n+\t\t/* Look up our own symbol. */\n+\t\tint ret = dladdr(reinterpret_cast<void *>(libcameraBuildPath), &info);\n+\t\tif (ret)\n+\t\t\treturn dirname(info.dli_fname) + \"/../../\";\n+\t}\n \n-\treturn info.dli_fname;\n+\treturn std::string();\n }\n \n } /* namespace utils */\n",
    "prefixes": [
        "libcamera-devel",
        "v4"
    ]
}