From nobody Thu Oct 2 10:55:20 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0477B3054C7; Thu, 18 Sep 2025 11:55:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758196507; cv=none; b=gPQE1K2lwrf1PHCZNPq+G2luJfLUwRn0TjU1w6VyEaCogcOKWiiKjq3u0DdqGoCi6vSHbRRUdQEvdwvXHH0sKEP9S4EMmDmqGosD+kfGqoIB9UWyQ2SV6R5Ly/gQG7pQtJcRm0y9jkLeGQj3+AXcviDgP0/5vK3mW12tnFsxY7g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758196507; c=relaxed/simple; bh=k6YcbtXwsJKesw6XBa4evKMXBMHtuUFMe++T/iQChqE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DDXens9UZGpaTNuz4lksIjNUIdvHstykHp40ORXlknDW7Scz7doyOuAm5Ss1O+jC4KovIuNvEyiRdDGWemsJ4t8j0SgkM6L7n1I538DqmbsWPjQzbF+YCTw5Bo4kq5kyqzjnJcaU6On3+5eyf9eL1GafW8fThcr+o9m5vB9ggZ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LVv/HXV5; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LVv/HXV5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBACBC4CEE7; Thu, 18 Sep 2025 11:55:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758196506; bh=k6YcbtXwsJKesw6XBa4evKMXBMHtuUFMe++T/iQChqE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LVv/HXV5lJeEQx/4YKkpJbhFEJ/P8kAUlZmUu6jB2i4zMFVJ5pNBMVy5KIYuQf5ML EupaPCu1Jq66TubtXjKDB0zYlO8HDgICRXeO6prILWlvG+T7mVw67M+jgMwQAwg5lx fPgeiSX/bnEJdBwA6G6tC2ubAnTXV61beMv+8UTJuDx+EgRfcqRmWeANhdbvkAW8La +45ns09YOnrjImSUyXt/8yzaRN2mFHSVyjT8sILAeXXDYhOSug8dCwcezEGThlehpy 9iVR7YzMSDRchRoRNFgT/Pv0KUqwJ/JQOWMIyRMknmEiCwizodp0tjyPtWWk4KnBvh 0H28n//IsHIFQ== Received: from mchehab by mail.kernel.org with local (Exim 4.98.2) (envelope-from ) id 1uzDE8-0000000CrtK-1EIb; Thu, 18 Sep 2025 13:55:04 +0200 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Jonathan Corbet Cc: Mauro Carvalho Chehab , "Akira Yokosawa" , "Mauro Carvalho Chehab" , linux-kernel@vger.kernel.org Subject: [PATCH v8 18/24] tools/docs: sphinx-build-wrapper: Fix output for duplicated names Date: Thu, 18 Sep 2025 13:54:52 +0200 Message-ID: X-Mailer: git-send-email 2.51.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" When SPHINXDIRS is used, basename may be identical for different files. If this happens, the summary and error detection won't be accurate. Fix it by using relative names from builddir. While here, don't duplicate names. Report, instead: - SUCCESS output PDF file was built - FAILED latexmk/xelatex didn't build any PDF output - FAILED: no .tex files were generated Sphinx didn't build any tex file for SPHINXDIRS directories - FAILED ({python exception}) When a concurrent.futures is catched. Usually indicates an internal error at the build logic. With that, building multiple dirs with the same name is reported properly: $ make V=3D1 SPHINXDIRS=3D"admin-guide/media driver-api/media userspace= -api/media" pdfdocs Summary =3D=3D=3D=3D=3D=3D=3D admin-guide/media/pdf/media.pdf : SUCCESS driver-api/media/pdf/media.pdf : SUCCESS userspace-api/media/pdf/media.pdf: SUCCESS And if at least one of them fails, return code will be 1. Signed-off-by: Mauro Carvalho Chehab --- tools/docs/sphinx-build-wrapper | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tools/docs/sphinx-build-wrapper b/tools/docs/sphinx-build-wrap= per index 6c2580303e8e..8d1f77c4a880 100755 --- a/tools/docs/sphinx-build-wrapper +++ b/tools/docs/sphinx-build-wrapper @@ -329,9 +329,6 @@ class SphinxBuilder: continue =20 name =3D name[:-len(tex_suffix)] - - max_len =3D max(max_len, len(name)) - has_tex =3D True =20 future =3D executor.submit(self.build_pdf_file, latex_cmd, @@ -343,34 +340,35 @@ class SphinxBuilder: =20 pdf_name =3D name + ".pdf" pdf_from =3D os.path.join(from_dir, pdf_name) + pdf_to =3D os.path.join(pdf_dir, pdf_name) + out_name =3D os.path.relpath(pdf_to, self.builddir) + max_len =3D max(max_len, len(out_name)) =20 try: success =3D future.result() =20 if success and os.path.exists(pdf_from): - pdf_to =3D os.path.join(pdf_dir, pdf_name) - os.rename(pdf_from, pdf_to) =20 # # if verbose, get the name of built PDF file # if self.verbose: - builds[name] =3D os.path.relpath(pdf_to, self.b= uilddir) + builds[out_name] =3D "SUCCESS" else: - builds[name] =3D "FAILED" + builds[out_name] =3D "FAILED" build_failed =3D True except futures.Error as e: - builds[name] =3D f"FAILED ({repr(e)})" + builds[out_name] =3D f"FAILED ({repr(e)})" build_failed =3D True =20 # # Handle case where no .tex files were found # if not has_tex: - name =3D "Sphinx LaTeX builder" - max_len =3D max(max_len, len(name)) - builds[name] =3D "FAILED (no .tex file was generated)" + out_name =3D "LaTeX files" + max_len =3D max(max_len, len(out_name)) + builds[out_name] =3D "FAILED: no .tex files were generated" build_failed =3D True =20 return builds, build_failed, max_len --=20 2.51.0