Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/107508/?format=api
http://patches.dpdk.org/api/patches/107508/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220214144406.4192233-2-sean.morrissey@intel.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20220214144406.4192233-2-sean.morrissey@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20220214144406.4192233-2-sean.morrissey@intel.com", "date": "2022-02-14T14:43:17", "name": "[v8,01/50] devtools: script to remove unused headers includes", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "02b0f5243cad7e6c8f19a6ba3c9114b8ff0d98fa", "submitter": { "id": 1359, "url": "http://patches.dpdk.org/api/people/1359/?format=api", "name": "Sean Morrissey", "email": "sean.morrissey@intel.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20220214144406.4192233-2-sean.morrissey@intel.com/mbox/", "series": [ { "id": 21662, "url": "http://patches.dpdk.org/api/series/21662/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=21662", "date": "2022-02-14T14:43:16", "name": "introduce IWYU", "version": 8, "mbox": "http://patches.dpdk.org/series/21662/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/107508/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/107508/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 2FAADA034E;\n\tMon, 14 Feb 2022 15:45:25 +0100 (CET)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 265C24114A;\n\tMon, 14 Feb 2022 15:45:23 +0100 (CET)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n by mails.dpdk.org (Postfix) with ESMTP id 5BAA54067E\n for <dev@dpdk.org>; Mon, 14 Feb 2022 15:45:18 +0100 (CET)", "from orsmga003.jf.intel.com ([10.7.209.27])\n by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 14 Feb 2022 06:45:18 -0800", "from silpixa00401215.ir.intel.com ([10.55.128.96])\n by orsmga003.jf.intel.com with ESMTP; 14 Feb 2022 06:45:16 -0800" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1644849918; x=1676385918;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=pjX+mx97VoeEUCRAGvzhtBBr34EDSL09KhLFuikBuwg=;\n b=Wr3eE0RBRE2n+F2sOXkQMwZtHWjs2ud1YQMCNLCNd4MphIgBlDrK8kF7\n 71njKO9EVUPYmo35YmGl9+kmIUE/bYemdby50rIWUTrXIA/yg0GAhZrU+\n AizvkRomNmQwc59YYWn52Y+nsYJI6GL71QScNE7RiiGYy67SEpFU7zgxZ\n Eh26IYIdmQ4SXKCf0DPIy1321k/MbbsxgevUPFbiBXlAmlVAgZyvNCBaX\n 6rB0OaciGwOECbHc4dCfx5+RcAC/iIrCwK4QYdeUkbGsvZrsZLfkQYPR1\n cX8IA8UYHG/7EewwXe620ag8yVbvt23Y5STkasiwWVJFNIY2N9Pb+OECc g==;", "X-IronPort-AV": [ "E=McAfee;i=\"6200,9189,10257\"; a=\"237511643\"", "E=Sophos;i=\"5.88,368,1635231600\"; d=\"scan'208\";a=\"237511643\"", "E=Sophos;i=\"5.88,368,1635231600\"; d=\"scan'208\";a=\"485504931\"" ], "X-ExtLoop1": "1", "From": "Sean Morrissey <sean.morrissey@intel.com>", "To": "", "Cc": "dev@dpdk.org, Sean Morrissey <sean.morrissey@intel.com>,\n Conor Fogarty <conor.fogarty@intel.com>,\n Bruce Richardson <bruce.richardson@intel.com>", "Subject": "[PATCH v8 01/50] devtools: script to remove unused headers includes", "Date": "Mon, 14 Feb 2022 14:43:17 +0000", "Message-Id": "<20220214144406.4192233-2-sean.morrissey@intel.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20220214144406.4192233-1-sean.morrissey@intel.com>", "References": "<20220214113632.3184921-1-sean.morrissey@intel.com>\n <20220214144406.4192233-1-sean.morrissey@intel.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "This script can be used for removing headers flagged for removal by the\ninclude-what-you-use (IWYU) tool. The script has the ability to remove\nheaders from specified sub-directories or dpdk as a whole and tests the\nbuild after each removal by calling meson compile.\n\nexample usages:\n\nRemove headers flagged by iwyu_tool output file\n$ ./devtools/process_iwyu.py iwyu.out -b build\n\nRemove headers flagged by iwyu_tool output file from sub-directory\n$ ./devtools/process_iwyu.py iwyu.out -b build -d lib/kvargs\n\nRemove headers directly piped from the iwyu_tool\n$ iwyu_tool -p build | ./devtools/process_iwyu.py - -b build\n\nSigned-off-by: Sean Morrissey <sean.morrissey@intel.com>\nSigned-off-by: Conor Fogarty <conor.fogarty@intel.com>\nReviewed-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n devtools/process_iwyu.py | 109 +++++++++++++++++++++++++++++++++++++++\n 1 file changed, 109 insertions(+)\n create mode 100755 devtools/process_iwyu.py", "diff": "diff --git a/devtools/process_iwyu.py b/devtools/process_iwyu.py\nnew file mode 100755\nindex 0000000000..50f3d4c5c7\n--- /dev/null\n+++ b/devtools/process_iwyu.py\n@@ -0,0 +1,109 @@\n+#!/usr/bin/env python3\n+# SPDX-License-Identifier: BSD-3-Clause\n+# Copyright(c) 2021 Intel Corporation\n+#\n+\n+import argparse\n+import fileinput\n+import sys\n+from os.path import abspath, relpath, join\n+from pathlib import Path\n+from mesonbuild import mesonmain\n+\n+\n+def args_parse():\n+ \"parse arguments and return the argument object back to main\"\n+ parser = argparse.ArgumentParser(description=\"This script can be used to remove includes which are not in use\\n\")\n+ parser.add_argument('-b', '--build_dir', type=str, default='build',\n+ help=\"The path to the build directory in which the IWYU tool was used in.\")\n+ parser.add_argument('-d', '--sub_dir', type=str, default='',\n+ help=\"The sub-directory to remove headers from.\")\n+ parser.add_argument('file', type=Path,\n+ help=\"The path to the IWYU log file or output from stdin.\")\n+\n+ return parser.parse_args()\n+\n+\n+def run_meson(args):\n+ \"Runs a meson command logging output to process.log\"\n+ with open('process_iwyu.log', 'a') as sys.stdout:\n+ ret = mesonmain.run(args, abspath('meson'))\n+ sys.stdout = sys.__stdout__\n+ return ret\n+\n+\n+def remove_includes(filepath, include, build_dir):\n+ \"Attempts to remove include, if it fails then revert to original state\"\n+ with open(filepath) as f:\n+ lines = f.readlines() # Read lines when file is opened\n+\n+ with open(filepath, 'w') as f:\n+ for ln in lines: # Removes the include passed in\n+ if not ln.startswith(include):\n+ f.write(ln)\n+\n+ # run test build -> call meson on the build folder, meson compile -C build\n+ ret = run_meson(['compile', '-C', build_dir])\n+ if (ret == 0): # Include is not needed -> build is successful\n+ print('SUCCESS')\n+ else:\n+ # failed, catch the error\n+ # return file to original state\n+ with open(filepath, 'w') as f:\n+ f.writelines(lines)\n+ print('FAILED')\n+\n+\n+def get_build_config(builddir, condition):\n+ \"returns contents of rte_build_config.h\"\n+ with open(join(builddir, 'rte_build_config.h')) as f:\n+ return [ln for ln in f.readlines() if condition(ln)]\n+\n+\n+def uses_libbsd(builddir):\n+ \"return whether the build uses libbsd or not\"\n+ return bool(get_build_config(builddir, lambda ln: 'RTE_USE_LIBBSD' in ln))\n+\n+\n+def process(args):\n+ \"process the iwyu output on a set of files\"\n+ filepath = None\n+ build_dir = abspath(args.build_dir)\n+ directory = args.sub_dir\n+\n+ print(\"Warning: The results of this script may include false positives which are required for different systems\",\n+ file=sys.stderr)\n+\n+ keep_str_fns = uses_libbsd(build_dir) # check for libbsd\n+ if keep_str_fns:\n+ print(\"Warning: libbsd is present, build will fail to detect incorrect removal of rte_string_fns.h\",\n+ file=sys.stderr)\n+ # turn on werror\n+ run_meson(['configure', build_dir, '-Dwerror=true'])\n+ # Use stdin if no iwyu_tool out file given\n+ for line in fileinput.input(args.file):\n+ if 'should remove' in line:\n+ # If the file path in the iwyu_tool output is an absolute path it\n+ # means the file is outside of the dpdk directory, therefore ignore it.\n+ # Also check to see if the file is within the specified sub directory.\n+ filename = line.split()[0]\n+ if (filename != abspath(filename) and\n+ directory in filename):\n+ filepath = relpath(join(build_dir, filename))\n+ elif line.startswith('-') and filepath:\n+ include = '#include ' + line.split()[2]\n+ print(f\"Remove {include} from {filepath} ... \", end='', flush=True)\n+ if keep_str_fns and '<rte_string_fns.h>' in include:\n+ print('skipped')\n+ continue\n+ remove_includes(filepath, include, build_dir)\n+ else:\n+ filepath = None\n+\n+\n+def main():\n+ process(args_parse())\n+\n+\n+if __name__ == '__main__':\n+ main()\n", "prefixes": [ "v8", "01/50" ] }{ "id": 107508, "url": "