From patchwork Tue May 2 09:30:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 757507 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3wHGKB6VCwz9s7g for ; Tue, 2 May 2017 19:32:14 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="r4o53fKu"; dkim-atps=neutral Received: by lists.denx.de (Postfix, from userid 105) id A39C5C21C7A; Tue, 2 May 2017 09:31:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 7A159C21C6B; Tue, 2 May 2017 09:31:27 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3164CC21C68; Tue, 2 May 2017 09:31:15 +0000 (UTC) Received: from mail-pg0-f65.google.com (mail-pg0-f65.google.com [74.125.83.65]) by lists.denx.de (Postfix) with ESMTPS id 6493DC21C65 for ; Tue, 2 May 2017 09:31:12 +0000 (UTC) Received: by mail-pg0-f65.google.com with SMTP id i63so1293745pgd.2 for ; Tue, 02 May 2017 02:31:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2mUZiN9BHppBeErLU6NRs8kusmpIJwO1NoqglSOvDJ4=; b=r4o53fKuvay15GNRstP76v1sORE628w6a74IntmWoIw9m8Mc/OCueNO3yq4lDr3wxo /Y6cGGPc36lpJR/uDuMSjjNj88BRB7JjB1mqIk3lR+5EDyb0me934YcDX73EAI9Fb9Oo UWGviGf69qcnYmpHi665LV8N1b79hTrjGAurgRLuZjEV0LHDr2AT0qwyx1kdw5t+SkE2 C7l4gBh0N+U8FuoRcVkGZTM5x0MIPXvYuiX3+7mlJ4ByWmoBBK2+7ffuDHwmlS22y/cK xmk35eljf3gVuyjhsF0zE2IVurvcU1XglF/E5IlHtNUhPo6OUt9HD1Kd9ZgeQz5RBIsu OhtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2mUZiN9BHppBeErLU6NRs8kusmpIJwO1NoqglSOvDJ4=; b=aNCp1WBxtPyB1D2NZbQroHM/eCNiQnc0KIr7Y6IsYTaqRTrI+Cik9WkNf6RADNtdWO bvhLDsvCM0+QDEyOkQlUjwGd6rnl8CLbCuhKrPqWBzq9mIdqIMttpg5z97z/QK3FT8xP NeG+b3WuuqS56T4K192L46rJpGjOkzACo57j/WEQUNAr0uuD0TQegfNLrhNGag+sKeqG BH2CtICuS1kg43+aVrQ8NJZ5ZUMWkhGHpGkTwzGQyW1Z/c/S6AjfeDoSy4AgDfdYfgVg lXrDiC+b4ByF6fzzbCLMyXkb33rjnO8ZlFzX/NMVQO7FUVqQHjrlYjioEfbkMgZT0u5r gsig== X-Gm-Message-State: AN3rC/73h1n4PelyNCKlqd2fJJoEKgYTXwUEk/ueEpqVEcFDBOiOVS+t YSpyNsGph5uB4g== X-Received: by 10.99.56.90 with SMTP id h26mr31488754pgn.43.1493717471067; Tue, 02 May 2017 02:31:11 -0700 (PDT) Received: from chrisp-ll.ws.atlnz.lc (125-237-160-122.jetstream.xtra.co.nz. [125.237.160.122]) by smtp.gmail.com with ESMTPSA id 129sm27257033pgj.23.2017.05.02.02.31.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 May 2017 02:31:10 -0700 (PDT) From: Chris Packham To: u-boot@lists.denx.de Date: Tue, 2 May 2017 21:30:48 +1200 Message-Id: <20170502093049.20915-3-judge.packham@gmail.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20170502093049.20915-1-judge.packham@gmail.com> References: <20170502093049.20915-1-judge.packham@gmail.com> Cc: Joe Hershberger , Chris Packham Subject: [U-Boot] [PATCH v3 3/4] tools: moveconfig: cleanup README entires X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The Kconfig description replaces the description in the README file so as options are migrated they can be removed from the README. Signed-off-by: Chris Packham Reviewed-by: Simon Glass --- Changes in v3: None Changes in v2: None tools/moveconfig.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 2361a43..95ef352 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -618,6 +618,46 @@ def cleanup_whitelist(configs, options): with open(os.path.join('scripts', 'config_whitelist.txt'), 'w') as f: f.write(''.join(lines)) +def find_matching(patterns, line): + for pat in patterns: + if pat.search(line): + return True + return False + +def cleanup_readme(configs, options): + """Delete config description in README + + Arguments: + configs: A list of CONFIGs to remove. + options: option flags. + """ + if not confirm(options, 'Clean up README?'): + return + + patterns = [] + for config in configs: + patterns.append(re.compile(r'^\s+%s' % config)) + + with open('README') as f: + lines = f.readlines() + + found = False + newlines = [] + for line in lines: + if not found: + found = find_matching(patterns, line) + if found: + continue + + if found and re.search(r'^\s+CONFIG', line): + found = False + + if not found: + newlines.append(line) + + with open('README', 'w') as f: + f.write(''.join(newlines)) + ### classes ### class Progress: @@ -1316,6 +1356,7 @@ def main(): cleanup_headers(configs, options) cleanup_extra_options(configs, options) cleanup_whitelist(configs, options) + cleanup_readme(configs, options) if options.commit: subprocess.call(['git', 'add', '-u'])