From nobody Thu Oct 2 14:25:57 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 3D5C1306B1E; Tue, 16 Sep 2025 10:23:37 +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=1758018218; cv=none; b=c38WC3GseLnR/JAka7iid8H4k8M+BdUoWsPfM23uBb1yUcfojEA0aIj2PeawYTxxIMg29hM1f+dUUNhc+/ZVu7QBr+Wk0cKilWKzZv9JP0RQmfAKJJ4My4CdIJ/qzPH78PWBVIdJClxLwT94lzAfQ1ikX01oqh75yScWxVgcryQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758018218; c=relaxed/simple; bh=wEAxHaH+b5lGJ2p9wznCjcSzxoTOkCLXr72tiMvcqis=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=DHCQHeWm9LkfAK2ByfzCvtPtbORPtyItCtHqfA+YYO3V2mKQoVV6O70Zakls1MLuPyrA1O5vEcadduHX/wpf4I/vXqBZvdx5pFiXzYpENM00Vn+42j/kpquvtH4JapbFrZ5FAVa/KpWxxlPKKw/2xdhdwdm83DMU2IeYDmERU3Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oIZNDe55; 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="oIZNDe55" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEB81C4CEF0; Tue, 16 Sep 2025 10:23:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1758018217; bh=wEAxHaH+b5lGJ2p9wznCjcSzxoTOkCLXr72tiMvcqis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oIZNDe55/Q7Ls0C12HR4UdsoSw5HDT5JRVBnkC3bFB1XO2+to9Br3IhpxcOH8g83T 7dsOTnADVAR+19A3929DsEsfla51SwTxt8GTbE2ze+4V/OOSe17ELJfvSxxfgUS9ag eWbwGXmBV+U73RLEUevpg8S0X9xtJHKI+REGJDFdxmy17nRapmq7topVIOd0AZzAxS h4Di79qIBp+8cLpSkn9AxaZ9DM9MilgCDRi8NOVqyVNUhXgAoTGb/S+h65PwGGVH+R ZLwC2hl0K24NweGaB5tJbJ7HwqvXVUzAFXXVfo7ac97fJi9K62AxSNINsf4hdata3D /0J8g42XKCdUA== Received: from mchehab by mail.kernel.org with local (Exim 4.98.2) (envelope-from ) id 1uySqT-0000000BBPl-0YIc; Tue, 16 Sep 2025 12:23:33 +0200 From: Mauro Carvalho Chehab To: Jonathan Corbet , Linux Doc Mailing List Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org Subject: [PATCH v6 16/21] tools/docs: sphinx-build-wrapper: Fix output for duplicated names Date: Tue, 16 Sep 2025 12:22:52 +0200 Message-ID: <3b22d3fde97520edd0120453ab44e23c90f1ae1f.1758018030.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: References: Content-Type: text/plain; charset="utf-8" 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 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 0e2cb087cdac..cd7c450832d0 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