From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 201F8A0C4C for ; Tue, 21 Sep 2021 16:36:40 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 18CB640DF8; Tue, 21 Sep 2021 16:36:40 +0200 (CEST) Received: from AZHDRRW-EX01.nvidia.com (azhdrrw-ex01.nvidia.com [20.51.104.162]) by mails.dpdk.org (Postfix) with ESMTP id 750524003C for ; Tue, 21 Sep 2021 16:36:38 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.48) by mxs.oss.nvidia.com (10.13.234.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.858.15; Tue, 21 Sep 2021 07:36:37 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BUDPQmY3CyfM+ExhEoL9dKaL8A6FMqYg5/DCU2GxZsUwBsn3H6H18tGTj3ESHBPb2T0HQ1jHYQ4vCMroMJbV8fSH5udW73MjJxx1ugVPcft9sL5DGh52z3TBEsfMGhU+xxjxqw1pEL/S/dBI2PZsrADDNtFLVpvq/3Szga+Ou/4VZ0bng/C5Cr3vIv09csclGyQ9FVleqzyCQCJFU/nZMJan2V76yRMq+vjkGw4aRBYUlWt4PuXghsNHgnha7jur0Cj89moZ8SbnUqf9q5JQzorSgQSP5uOhAzsPbdXFsBe9sCUVY6gmg3yC6qCGYg+FxyJF6/uw7iXfuPlgbyRVCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Q1x2B8qhgJ5xcXA8Pa2XghJ1ojjj7WWNLfa9P0uIYEQ=; b=WbemK9pAwEp6BmpS4DqV03AhyrurenWKG395/HfWCfQP4COGpF+KiD5QA8A0L+kiX6ShwyWn4ZCngmFGPcqZeVa/0/o+Dz2eqTmbP6RgHhuxSxLOx4ZsKvcY1vAPEjzkPt1CQno25lQ2lFlKXCbFBqXJXPX7sn+LuUEIYShmL5xCoLNQhDehAeLcB+Z6l+Q546/paSAed8TqYS7DsaOMyLpd/+ZF+fZsFNrBw3pQ9gkYrjbadCWKWMr6fBPjXDbOEXTJts8nZohqZlmmv4akaRGb3rATYQ30/UVfhStSZ+6S3ly4wSqKgHseVq7CrlY2R28pRTRBOwvjmrPb3FXfhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q1x2B8qhgJ5xcXA8Pa2XghJ1ojjj7WWNLfa9P0uIYEQ=; b=e6bBnmZys1rtHc/5Ul+fRnia63QPVUoj9JE9184znP4PJRYxkqoAAV+v6mlZqpmFf5Bva+v6SxlWNO2KEM8+FGzAyVT9GUCDJ/HYKdGkpmTdl49ZautIoGUMXOMRgCreLIwtOOhDWKJMBr6Mwbh/0ZWQSs/U05ulvIDdTRBPID4n2fhVnYfuz/giTNwk731iy2jQ+myNq7lxcEdYpQRYgeECLpKv9dNsXgi2WqLzusHkBKQF/uQFJ7ZUIXQr0mDh5Hr+px2yyFm7yvHJc5SBSyH/2zy51B0asBhnULpGv66N1uY8XgP3h5mNK+Ud4w/SXD/rK20WZHMni7pScBaC/g== Received: from DM6PR03CA0056.namprd03.prod.outlook.com (2603:10b6:5:100::33) by BY5PR12MB3921.namprd12.prod.outlook.com (2603:10b6:a03:1a2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16; Tue, 21 Sep 2021 14:36:35 +0000 Received: from DM6NAM11FT042.eop-nam11.prod.protection.outlook.com (2603:10b6:5:100:cafe::2b) by DM6PR03CA0056.outlook.office365.com (2603:10b6:5:100::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Tue, 21 Sep 2021 14:36:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.32) by DM6NAM11FT042.mail.protection.outlook.com (10.13.173.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4523.14 via Frontend Transport; Tue, 21 Sep 2021 14:36:35 +0000 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 21 Sep 2021 07:36:34 -0700 Received: from nvidia.com (172.20.187.5) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 21 Sep 2021 14:36:32 +0000 From: To: CC: , , , , Date: Tue, 21 Sep 2021 17:35:35 +0300 Message-ID: <20210921143542.4412-4-alialnu@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210921143542.4412-1-alialnu@nvidia.com> References: <20210906154537.1299-1-alialnu@nvidia.com> <20210921143542.4412-1-alialnu@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To DRHQMAIL107.nvidia.com (10.27.9.16) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 900a98e9-5958-4279-11de-08d97d0d368c X-MS-TrafficTypeDiagnostic: BY5PR12MB3921: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-Transport-Forked: True X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VEIfQYcmdY+toTtiFFWDXqfHFGOXsO7Xdnl4k2joSzlubZ00J/U3DOpTlo2DfW4T8OfQhWfsOvD2CW8AC67FTkm8ccokY66WRMKJAb1+rdBpz1Btn2ag73i5b3c5yY71yoil5NQhY+u0XBdH09Wl0b5BownImIJN7RsTb4VPaiBmNpH37tx//xUoJhhOiD66kXS/bLlIlRf/4BBUj/w0K+FoDnuIy6HNib4nH2qi/v/9IFwYW+LUH4+7Kc46W94OxT/dn7rNZEPx4osF+ZpMep6pGDiyQERopaeHRNGyUpYhyHZ0cioRQnMfRqwHNE1SOyllQQK8R8leC+iyz39sHwCJGndODh8mwcrFDrUWPZWvvEFtML8fgtTVHaX/ZggiR1zPEe07JTdWLpngSHxW2FIQV2qlI1HYLZ4gCHcgVPhXw3TO2PsXeTs6ftJsjZUIw/q3043nVoQefRICq7sQNNvWw7NXEcOcLfgThvVxAT3r+/UcD12uyVvTKy26+n6UTuaYEU0YP3tbctqBamGLErprUPUYZRN/ko9TCR8xIrt4ybfngJI3fKQOKb8pFoutmDW+28EbBMcSbM9qZoTvDVR3KhbWv7/2oF0QLq1FnpC7UKGt4tHrt5gtvvHpVPrd5DoQNisNtb1QxPyDxhzgwhchTd7k00ZdP36xineFej92sw7ZJbYaOd/J2rJcT27h+8uZoppvdHKsZd1aCPM3Hw== X-Forefront-Antispam-Report: CIP:216.228.112.32; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid01.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(107886003)(83380400001)(8936002)(86362001)(54906003)(6286002)(316002)(356005)(2876002)(47076005)(5660300002)(55016002)(82310400003)(7636003)(6916009)(508600001)(2906002)(70586007)(186003)(36756003)(36860700001)(426003)(70206006)(16526019)(336012)(26005)(7696005)(2616005)(4326008)(8676002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2021 14:36:35.1752 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 900a98e9-5958-4279-11de-08d97d0d368c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.32]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT042.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB3921 Subject: [dpdk-ci] [PATCH v2 03/10] tools: update script usage X-BeenThere: ci@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK CI discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ci-bounces@dpdk.org Sender: "ci" From: Ali Alnubani The resource type (whether it's a patch or a series) is now specified by the new argument --type. Both commands: list_trees_for_patch & list_trees_for_series are replaced by the positional arg 'list_trees', and the type must be always set. This makes adding more operations require less arguments. Signed-off-by: Ali Alnubani --- tools/pw_maintainers_cli.py | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/tools/pw_maintainers_cli.py b/tools/pw_maintainers_cli.py index 343e9f5..d4c0056 100755 --- a/tools/pw_maintainers_cli.py +++ b/tools/pw_maintainers_cli.py @@ -31,8 +31,8 @@ variables PW_{SERVER,PROJECT,TOKEN} should be set. If not, the script will try to load the git configurations pw.{server,project,token}. Example usage: - ./pw_maintainers_cli.py --command list_trees_for_series 2054 - ./pw_maintainers_cli.py --command list_trees_for_patch 2054 + ./pw_maintainers_cli.py --type series list_trees 2054 + ./pw_maintainers_cli.py --type patch list_trees 2054 Or if you want to use inside other scripts: @@ -238,14 +238,14 @@ if __name__ == '__main__': """Main procedure.""" parser = argparse.ArgumentParser() git_pw_conf_parser = parser.add_argument_group('git-pw configurations') - options_parser = parser.add_argument_group('optional arguments') + required_args_parser = parser.add_argument_group('required arguments') - options_parser.add_argument( - '--command', + required_args_parser.add_argument( + '--type', choices=( - 'list_trees_for_patch', - 'list_trees_for_series'), - required=True, help='Command to perform') + 'patch', + 'series'), + required=True, help='Resource type.') git_pw_conf_parser.add_argument( '--pw_server', type=str, @@ -262,12 +262,18 @@ if __name__ == '__main__': default=os.environ.get('PW_TOKEN', utils.git_config('pw.token')), help='Authentication token') + parser.add_argument( + 'command', + choices=[ + 'list_trees'], + help='Command to perform') parser.add_argument( 'id', type=int, help='patch/series id') args = parser.parse_args() command = args.command + resource_type = args.type _id = args.id # Pass the needed configurations to git-pw. @@ -279,9 +285,9 @@ if __name__ == '__main__': maintainers = Maintainers() patch_list = [] - if command == 'list_trees_for_patch': + if resource_type == 'patch': patch_list.append(_git_pw.api_get('patches', _id)) - elif command == 'list_trees_for_series': + else: series = _git_pw.api_get('series', _id) patch_list = [ _git_pw.api_get('patches', patch['id']) @@ -290,4 +296,8 @@ if __name__ == '__main__': files = [] for patch in patch_list: files += Diff.find_filenames(patch['diff']) - print(maintainers.get_tree(files).split('/')[-1]) + + tree = maintainers.get_tree(files) + + if command == 'list_trees': + print(tree.split('/')[-1]) -- 2.25.1