From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AEC38372B27 for ; Tue, 7 Apr 2026 02:38:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.40.44.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775529538; cv=none; b=rH+JnyGXrPtkgKJfHRZwDOUKdBUZ0Flrd254bcxtZZ4JryrqiKAYptFLX4IW2+1BJ9ZWE9DaVNQvLn5ajKop0mN37lYykE/W1rVf7eedcHnI6zU84pGvbtgMg+w7gv4B0fuJARfrjHV3IlMHZVqOgXWsbGOfwsJ78rXf5T77mH4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775529538; c=relaxed/simple; bh=vj6Id2OYCFyn7JBHgnFTguKrJNzjos2bneKQiVeynEU=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=Y3ClQO4bIc6Mjrk1fUApcx5fzcoF/AhDm9183Nem0YriDIwyGjOzo9TCKxNgCW3rMOGtRkTKmCNb8RmM9E96eh1nRyEpxT360kje55MleFTddkkcVrmKdyoYbPaU3pelqKOExa1hnkVdRoFrriGzbC68aUAAVlZe2UqRGFP3PyA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com; spf=pass smtp.mailfrom=perches.com; arc=none smtp.client-ip=216.40.44.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=perches.com Received: from omf18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 2FE441B7F8B; Tue, 7 Apr 2026 02:38:50 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf18.hostedemail.com (Postfix) with ESMTPA id 8481D30; Tue, 7 Apr 2026 02:38:48 +0000 (UTC) Message-ID: <001ffb26478da41247e2500e1102b4e34f9808fc.camel@perches.com> Subject: Re: [PATCH] get_maintainer: add --json output mode From: Joe Perches To: Sasha Levin Cc: linux-kernel@vger.kernel.org Date: Mon, 06 Apr 2026 19:38:47 -0700 In-Reply-To: <20260406170138.4034983-1-sashal@kernel.org> References: <20260406170138.4034983-1-sashal@kernel.org> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Stat-Signature: jzoz5usjmrqyb8w7worc1hhfbsfe1df9 X-Rspamd-Server: rspamout04 X-Rspamd-Queue-Id: 8481D30 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX19wgCTpv+VDfAMbSZHKBI4E+M2QAEJPw6A= X-HE-Tag: 1775529528-796325 X-HE-Meta: U2FsdGVkX1+ZBQXW4aOjnpK06UUWlGrqZpLapM7uHCG3VvHMtNo0m0LU7RvrRcvGCAWTO8VkWF86gv904j27Y4OFfBBtOh0ReUcbQOZd/Ptt0I7HNAMc45xcu/FDXgjtVIZbNMlGHp0RvdnlV1OAKd8a5vV8onRvx1g0m77nIVaWH9hQk1B4kHQvewQ3OPc7PGQ/EYVAaCuwDa4tMQg4NsM1nHRGg/tYNknqwhB1MX5qM1VRn66xxNF6RM7crWtR48H6xd2HdCJiexR0iFcIztaruxfFeq8ObF/p088ZSF7miUHbYMPRJEgVdrnJB/BR On Mon, 2026-04-06 at 13:01 -0400, Sasha Levin wrote: > Add a --json flag to get_maintainer.pl that emits structured JSON > output, making results machine-parseable for CI systems, IDE > integrations, and AI-assisted development tools. OK here too but perhaps the code can be consolidated a bit more. > diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl > index 4414194bedcfd..37817ca701bd6 100755 > --- a/scripts/get_maintainer.pl > +++ b/scripts/get_maintainer.pl > @@ -68,6 +68,7 @@ my $pattern_depth =3D 0; > my $self_test =3D undef; > my $version =3D 0; > my $help =3D 0; > +my $json =3D 0; > my $find_maintainer_files =3D 0; > my $maintainer_path; > my $vcs_used =3D 0; > @@ -285,6 +286,7 @@ if (!GetOptions( > 'find-maintainer-files' =3D> \$find_maintainer_files, > 'mpath|maintainer-path=3Ds' =3D> \$maintainer_path, > 'self-test:s' =3D> \$self_test, > + 'json!' =3D> \$json, > 'v|version' =3D> \$version, > 'h|help|usage' =3D> \$help, > )) { > @@ -648,39 +650,74 @@ my %deduplicate_name_hash =3D (); > my %deduplicate_address_hash =3D (); > =20 > my @maintainers =3D get_maintainers(); > -if (@maintainers) { > - @maintainers =3D merge_email(@maintainers); > - output(@maintainers); > -} > =20 > -if ($scm) { > - @scm =3D uniq(@scm); > - output(@scm); > -} > +if ($json) { > + my @json_maintainers; > + if (@maintainers) { > + my %saw; > + for (@maintainers) { > + my ($address, $role) =3D @$_; > + if (!$saw{$address}) { > + my ($name, $email_addr) =3D parse_email($address); > + my $entry =3D '{"name":"' . json_escape_str($name) . > + '","email":"' . json_escape_str($email_addr) . '"'; > + $entry .=3D ',"role":"' . json_escape_str($role) . '"' if ($output_rol= es && $role ne ''); > + $entry .=3D '}'; > + push(@json_maintainers, $entry); > + $saw{$address} =3D 1; Isn't this effectively the merge_email(@maintainers) above? Why not use it?