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 732F9A0C4B for ; Mon, 8 Nov 2021 07:29:27 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6AAFE40151; Mon, 8 Nov 2021 07:29:27 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2072.outbound.protection.outlook.com [40.107.237.72]) by mails.dpdk.org (Postfix) with ESMTP id 57CDA40040 for ; Mon, 8 Nov 2021 07:29:26 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JgCHQxWn8AP61QJOYTPCekN4l12aRcB9JGz9IKcXoNwzIIqAHT70Q0cEwoTwu0jCpMb+d4r9lHF103pV1zbQ3GilBw/P/Lc9MblZ+eE89cl/qTOiWXofwn2/4vvtuPTiqQJThceFR+s+volSzTRtX5G4w5RjGi2xMLzaCewdvWKyYPj0A9XBjML78k8716MUNTTlwr297fvP4+FFoUNaDuz867VerdxNcLY8DbvkMoSiJKFqhMZCJVct3DnMyg5Xe64AgAEFDI1b3KKe8XuZc1P74LWvViulppGkQpC11JN2lZguxa+ZoNK03HsGt6TgpTnMss74ItjXUwr2zBcdEA== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZkQh8SKW/6uMyu2subKNkrIY83w0oBkZ6WTJMFBwuLc=; b=ITmUKKD7fMSbD+t1qbJFfiTQXflVxQbYYtXHz1dVJhlf6NSme8g8hoMvNrsHVUOdbBZiSVUzqsRKfZBDMbLkFdLHBSbwcXYnYFuExaQCr+PM+FoEIRyiioc1LLsZko3LIBkJjyKwNLT2s14wRq9D4B+1ro83TtPhiP1cplb0cQil9escBBukhy5Mxyk9pSapIOgGUJTpcRUY1+VB6LAo847cKdctbfEA7NTXBzRyUWfDOwDYMbQNPxfDjnfgjEKwwFBGAyfIox37JBPlouAX/g430P0R8yjdJh+Er15m2yMNIoo4nsGeCEvp+7ZJGl1+eJNIl3aH9qGKL/El0hYwmw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=ZkQh8SKW/6uMyu2subKNkrIY83w0oBkZ6WTJMFBwuLc=; b=qmEGDTrkDOYC7qyACHj/cXfVPeI19kPUtrLCv9bi3t5EBSPZm+LJ10amUtXskZ/xVt5WXXbF3zuzN5SCZNC0XfuSGsPXdxhDhxzLyxJziaB45oi5u468zJOO/JcE51B5AIcQdN1oa2FM5fgp8ddQ2FVT6XU6HGB+Ty+meS8RChvCYEdoZ0Igib2fWYyqVbZUHC6OlytnRp3B7Ohw5M+peegJrsukZBju2AeNBON8rmJ/vju2H5axE+PJZcr6Rmuw7VrClmKXw4ReOi4pAXDG2SB/chTIMFwDrtHW7+KO+YGT8vc8YdOiNm38QgVSB0hiDXuXtKWQAToG1tKAVqMPPA== Received: from DM6PR03CA0042.namprd03.prod.outlook.com (2603:10b6:5:100::19) by BN8PR12MB4594.namprd12.prod.outlook.com (2603:10b6:408:a2::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10; Mon, 8 Nov 2021 06:29:24 +0000 Received: from DM6NAM11FT003.eop-nam11.prod.protection.outlook.com (2603:10b6:5:100:cafe::ea) by DM6PR03CA0042.outlook.office365.com (2603:10b6:5:100::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10 via Frontend Transport; Mon, 8 Nov 2021 06:29:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT003.mail.protection.outlook.com (10.13.173.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4669.10 via Frontend Transport; Mon, 8 Nov 2021 06:29:23 +0000 Received: from nvidia.com (172.20.187.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 8 Nov 2021 06:29:18 +0000 From: Ali Alnubani To: CC: , , , , Date: Mon, 8 Nov 2021 08:28:08 +0200 Message-ID: <20211108062815.7614-4-alialnu@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211108062815.7614-1-alialnu@nvidia.com> References: <20210906154537.1299-1-alialnu@nvidia.com> <20211108062815.7614-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: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a4ef8986-6520-4f4b-0002-08d9a2811b2d X-MS-TrafficTypeDiagnostic: BN8PR12MB4594: X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cFSfwJlY8vBQSJTlnuSaFa/sg5nzHFN+uobefE/l+YxfH2vtksjTSWreI7Ix9PCv4bgCa6j/FwBdeTuOBJsXerQVj+nIBA4vdqif9NUgw3SQ9SD+WqX59PLCDb3uVjOaQG7RrC1NCeZXz/Aa7ILUt1rYEmj17HqzvQ1P5xH1XVsyhU41oMM+j+NUXle1srdeKuKWLq2vBvSI8rLng3oH34BxcVADWrWiA8yLRkhp2YhbYNtIhkQBfD5EAAZ2zwCIBJQDFpUQ8bILlZI56MdtiG2l97lbtTLYfUSleSpWc21WF7IS1+BPsL1q8RHj2TsuLkzNIAtvmnwzCIjIW47lco4sYLlQQmOOrV7JeEt7QJJ7u0vd9tgEwfJUyc8B6wPtVj4wAnWYvTW3fLf7sZ42OhWfLbVajpmsuNHZDAbTly5mtR8ood0f04/znFXOE0cZ3EY/DfIeQjHGLqsCbfAmYzJCKUnGRvO6ZxH8zauZlvUWcP2bqd3OYnd8QHpN9iNwN7XEdvcYZrD39unnnlF8Gc8i0TkVrq1tciG8xfInp7zp6XlHDMYSa1HpGSoU0KKQYrvo1er/vvQzgoj/XvDSgTVY0pEzoHNvC28cxLr0sJ95+hE2D45VMB3PjzkC3vi6sN3MD7FAQBI50IlgRWMWXBMjztBpTBuQlNTpKd99miIrc2IFWiiOCP5YB36sLocJghVbAoKtcz6GZAcGZdrXpA== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(16526019)(70206006)(7696005)(8936002)(36756003)(186003)(82310400003)(83380400001)(6916009)(36860700001)(55016002)(316002)(7636003)(5660300002)(54906003)(8676002)(356005)(508600001)(2616005)(6666004)(70586007)(6286002)(336012)(47076005)(2906002)(1076003)(26005)(36906005)(86362001)(426003)(4326008); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2021 06:29:23.9011 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4ef8986-6520-4f4b-0002-08d9a2811b2d 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.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT003.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB4594 Subject: [dpdk-ci] [PATCH v4 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" 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. Additionally, use the more common dashes in argument names instead of underscores. Signed-off-by: Ali Alnubani --- Changes in v4: - Use dashes in argument names instead of underscores. tools/pw_maintainers_cli.py | 38 +++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/tools/pw_maintainers_cli.py b/tools/pw_maintainers_cli.py index 343e9f5..67d8586 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,36 +238,42 @@ 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, + '--pw-server', type=str, default=os.environ.get( 'PW_SERVER', utils.git_config('pw.server')), help='Patchwork server') git_pw_conf_parser.add_argument( - '--pw_project', type=str, + '--pw-project', type=str, default=os.environ.get( 'PW_PROJECT', utils.git_config('pw.project')), help='Patchwork project') git_pw_conf_parser.add_argument( - '--pw_token', type=str, + '--pw-token', type=str, 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