Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp626587ybi; Fri, 21 Jun 2019 05:35:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfGvbrAp5HgB3rSr0fLzrgLSN4wPxQ0uzu0lh9Q2kXtl8zs5E7p18EFb0sXuA2/59vKqUU X-Received: by 2002:a63:f50d:: with SMTP id w13mr18247094pgh.411.1561120503670; Fri, 21 Jun 2019 05:35:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561120503; cv=none; d=google.com; s=arc-20160816; b=s4lGj3mgeI0rP4h933GOnY/8m9g9OApZZpmb9JY1oKiPm5ddDTFrkIzNPxieIcCiRz uUIi4XYjO0HCbf4Bgt8D6JQysO+j0TEM5H/wm/YHOtj1QR4FVAW/Qfly0ArAtKU0kaFK HqEBm0K7tcqiAGC0dbQLCG8Q1udkobFma3BPhajrIkobG8p4qXfGjLDRIGTQ1DGO6pfz Jx9ZNJdwWwMiEz/u790f29u1hpptAPfwFvgFiQ/VjZl9p6TbmCix6J87V85gmLYLCoTl gjRxrw6ZLzC4NIXZxm9NDDRbyTTeWa0gCtFVd7Ybrgopq8ZVmYVO8Sr0USpXnReqOnBn dprg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jfDLdG1JsACai41gG2VqGBxF4feZMwdDcvPG6u5absg=; b=e3DM+Sfy4DtpIXh4CpIBom37NSjnwugBTaUCqj5SsWIQudo85l4M1PEa/8m3VA87GZ zCoOqQR2aeFMo+ipwQ/TxtQFBLkc9kcLcg23LHnrArAi/mhJGcrjQ5z0PfgyDxBFW5AP yMW02BX6z8vbOtu2etAr7npyy0yCXC6ETGHIpLajolIMEIMgMKJuKohf5t/bEPOZ18Dd 3BbTL/YzHL5HMwzU97Y+ozEvKzsz8xMOo5VutjA4L2Pz6xHnw/UXNfizVJMh6P8DCdRL V2cxROoN5kxWfhWuCLlBBrkwdkJcEGm7GixuvYZmVy1plu6w+bEl4gygTLkud00pmdYj 0Agg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="Wyi4/zh+"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n10si2383746pgp.481.2019.06.21.05.34.48; Fri, 21 Jun 2019 05:35:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="Wyi4/zh+"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726923AbfFUMck (ORCPT + 99 others); Fri, 21 Jun 2019 08:32:40 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:34932 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726414AbfFUMcL (ORCPT ); Fri, 21 Jun 2019 08:32:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=jfDLdG1JsACai41gG2VqGBxF4feZMwdDcvPG6u5absg=; b=Wyi4/zh+yGcOfgEWXQiYy40PYF UP+jNmsJlF7fvLJPjodWQBBEyFFgJ15bo1yZcC6OvYJFjh9b9ddYbWgVHIZUatdD0LH33tAne/ANB CSkZMtYHb3rpdvvCFpOQnC+pcWH5/ndsCEuiOlv9PrqYkX2t5gvCMysxGuxndXUKM/Wxfb3dqOjMm cwRaqUo1Wh66Qa5nQgVEXEZzbjs9/HMWs2Q13uGGRJivmbe9alcwBd/eE1FBh9E9MGMOhXaVkwBxU 9rzwwB4S6VUMWdjECJHne4eeT+wAuknt41jG+V4hPAyH395FkYK12EGHTZAOdsMStaX/bxjD+Npw6 QJu+lw6g==; Received: from [177.97.20.138] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1heIiA-0003xN-E9; Fri, 21 Jun 2019 12:32:10 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1heIi7-0001Ev-Qd; Fri, 21 Jun 2019 09:32:07 -0300 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Greg Kroah-Hartman Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Jonathan Corbet Subject: [PATCH RFC 1/6] get_abi.pl: fix parsing on ReST mode Date: Fri, 21 Jun 2019 09:32:01 -0300 Message-Id: <25e3e20ef1a300ce2bb6f87dfbdc12dbdd7ffcb0.1561118631.git.mchehab+samsung@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the source ABI file is using ReST notation, the script should handle whitespaces and lines with care, as otherwise the file won't be properly recognized. Address the bugs that are on such part of the script. Signed-off-by: Mauro Carvalho Chehab --- scripts/get_abi.pl | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/scripts/get_abi.pl b/scripts/get_abi.pl index e2cd2234af34..03f3c57af7ab 100755 --- a/scripts/get_abi.pl +++ b/scripts/get_abi.pl @@ -159,7 +159,8 @@ sub parse_abi { $content = $2; } while ($space =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {} - $data{$what}->{$tag} .= $content; + + $data{$what}->{$tag} .= "$content\n" if ($content); } else { $data{$what}->{$tag} = $content; } @@ -174,31 +175,28 @@ sub parse_abi { } if ($tag eq "description") { + my $content = $_; + while ($content =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {} if (!$data{$what}->{description}) { - s/^($space)//; - if (m/^(\s*)(.*)/) { - my $sp = $1; - while ($sp =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {} - my $content = "$sp$2"; - - $content =~ s/^($space)//; - - $data{$what}->{$tag} .= "$content"; + # Preserve initial spaces for the first line + if ($content =~ m/^(\s*)(.*)$/) { + $space = $1; + $content = $2; } + + $data{$what}->{$tag} .= "$content\n" if ($content); } else { - my $content = $_; if (m/^\s*\n/) { $data{$what}->{$tag} .= $content; next; } - while ($content =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {} $space = "" if (!($content =~ s/^($space)//)); - # Compress spaces with tabs - $content =~ s<^ {8}> <\t>; - $content =~ s<^ {1,7}\t> <\t>; - $content =~ s< {1,7}\t> <\t>; +# # Compress spaces with tabs +# $content =~ s<^ {8}> <\t>; +# $content =~ s<^ {1,7}\t> <\t>; +# $content =~ s< {1,7}\t> <\t>; $data{$what}->{$tag} .= $content; } next; -- 2.21.0