Show a patch.

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

{
    "id": 10744,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/10744/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10744/",
    "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": "<20201224122855.22200-9-laurent.pinchart@ideasonboard.com>",
    "date": "2020-12-24T12:28:55",
    "name": "[libcamera-devel,8/8] utils: checkstyle.py: Add header add checker",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "3f7d8454e5184b070d4e53d6b646f3afe13195b2",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": {
        "id": 14,
        "url": "https://patchwork.libcamera.org/api/1.1/users/14/?format=api",
        "username": "pinchartl",
        "first_name": "Laurent",
        "last_name": "Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/10744/mbox/",
    "series": [
        {
            "id": 1550,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1550/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1550",
            "date": "2020-12-24T12:28:47",
            "name": "checkstyle.py: Ensure meson.build is updated when adding header",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1550/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10744/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10744/checks/",
    "tags": {},
    "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 540C3C0F1A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Dec 2020 12:29:17 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0C220615AF;\n\tThu, 24 Dec 2020 13:29:17 +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 A86C7615AF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Dec 2020 13:29:10 +0100 (CET)",
            "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 47E92FE0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Dec 2020 13:29:10 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"YqrcMpaE\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1608812950;\n\tbh=yD71QmB73qmX72gSMLoN0LKZWfl2nUJ+FCw9LcubTDw=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=YqrcMpaEHiBabiUDKcqM2kPMM+NlCqVTDNDGOv6RjvsAEyYHPb7KX3KmTB97oA4Fe\n\tCCoBpgD9q1/RWeHingsFsimTNhkp6ECCk5m+MHZutf6mB/70YhNdWq9adOMIQqT+Hq\n\tho89Uqmb0tdvjVR1NYtpjYFlPjCcK/y2E/0Yiiqo=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 24 Dec 2020 14:28:55 +0200",
        "Message-Id": "<20201224122855.22200-9-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20201224122855.22200-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20201224122855.22200-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 8/8] utils: checkstyle.py: Add header add\n\tchecker",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Add a commit checker that ensures that all header files added to the\nlibcamera includes (public or internal) are accompanied by a\ncorresponding update of the meson.build file in the same directory.\n\nHere's the output of the new checker when run against a commit that\nforgot to update meson.build.\n\n    $ ./utils/checkstyle.py b3383da79f1d\n    ---------------------------------------------------------------------------------\n    b3383da79f1d513b0d76db220a7104e1c1035e30 libcamera: buffer: Create a MappedBuffer\n    ---------------------------------------------------------------------------------\n    Header include/libcamera/internal/buffer.h added without corresponding update to include/libcamera/internal/meson.build\n    ---\n    1 potential issue detected, please review\n\nIn theory we could extend the checker to cover .cpp files too, but the\nissue will be quite noticeable as meson won't build the file if\nmeson.build isn't updated. Header files are more tricky as problems\nwould only occur at when installing the headers (for public headers), or\nwould result in race conditions in the build. Both of those issues are\nharder to catch.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n utils/checkstyle.py | 44 ++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 44 insertions(+)",
    "diff": "diff --git a/utils/checkstyle.py b/utils/checkstyle.py\nindex c0a6b7ab06cd..e618db937c2b 100755\n--- a/utils/checkstyle.py\n+++ b/utils/checkstyle.py\n@@ -320,6 +320,50 @@ class CommitIssue(object):\n         self.msg = msg\n \n \n+class HeaderAddChecker(CommitChecker):\n+    @classmethod\n+    def check(cls, commit, top_level):\n+        issues = []\n+\n+        meson_files = [f for f in commit.files('M')\n+                       if os.path.basename(f) == 'meson.build']\n+\n+        for filename in commit.files('A'):\n+            if not filename.startswith('include/libcamera/') or \\\n+               not filename.endswith('.h'):\n+                continue\n+\n+            meson = os.path.dirname(filename) + '/meson.build'\n+            header = os.path.basename(filename)\n+\n+            issue = CommitIssue('Header %s added without corresponding update to %s' %\n+                                (filename, meson))\n+\n+            if meson not in meson_files:\n+                issues.append(issue)\n+                continue\n+\n+            diff = commit.get_diff(top_level, meson)\n+            found = False\n+\n+            for hunk in diff:\n+                for line in hunk.lines:\n+                    if line[0] != '+':\n+                        continue\n+\n+                    if line.find(\"'%s'\" % header) != -1:\n+                        found = True\n+                        break\n+\n+                if found:\n+                    break\n+\n+            if not found:\n+                issues.append(issue)\n+\n+        return issues\n+\n+\n # ------------------------------------------------------------------------------\n # Style Checkers\n #\n",
    "prefixes": [
        "libcamera-devel",
        "8/8"
    ]
}