summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz93@gmail.com>2024-03-04 18:43:06 -0500
committerSam James <sam@gentoo.org>2024-03-05 04:46:44 +0000
commitc540a31ca37a285140485fd37173120a97f4a56c (patch)
tree2a00241e66512e1cadeace77de68c1efc93cf285 /app-text/docbook-sgml-utils
parentsys-apps/uutils-coreutils: guarantee the use of system deps (diff)
downloadgentoo-c540a31ca37a285140485fd37173120a97f4a56c.tar.gz
gentoo-c540a31ca37a285140485fd37173120a97f4a56c.tar.bz2
gentoo-c540a31ca37a285140485fd37173120a97f4a56c.zip
app-text/docbook-sgml-utils: drop dependency on "which"
Patch it to use command -v instead. No upstream remaining to forward the patch to. Bug: https://bugs.gentoo.org/102464 Signed-off-by: Eli Schwartz <eschwartz93@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-text/docbook-sgml-utils')
-rw-r--r--app-text/docbook-sgml-utils/docbook-sgml-utils-0.6.14-r6.ebuild76
-rw-r--r--app-text/docbook-sgml-utils/files/0001-Migrate-from-1998-style-which-progname-lookup-to-com.patch90
2 files changed, 166 insertions, 0 deletions
diff --git a/app-text/docbook-sgml-utils/docbook-sgml-utils-0.6.14-r6.ebuild b/app-text/docbook-sgml-utils/docbook-sgml-utils-0.6.14-r6.ebuild
new file mode 100644
index 000000000000..8a3acfb1438d
--- /dev/null
+++ b/app-text/docbook-sgml-utils/docbook-sgml-utils-0.6.14-r6.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit autotools prefix
+
+MY_P=${PN/-sgml/}-${PV}
+DESCRIPTION="Shell scripts to manage DocBook documents"
+HOMEPAGE="https://sourceware.org/docbook-tools/"
+SRC_URI="https://sourceware.org/pub/docbook-tools/new-trials/SOURCES/${MY_P}.tar.gz"
+S=${WORKDIR}/${MY_P}
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="jadetex"
+
+DEPEND=">=dev-lang/perl-5
+ app-text/docbook-dsssl-stylesheets
+ app-text/docbook-xml-dtd:4.2
+ app-text/openjade
+ app-text/xhtml1
+ dev-perl/SGMLSpm
+ ~app-text/docbook-sgml-dtd-3.0
+ ~app-text/docbook-sgml-dtd-3.1
+ ~app-text/docbook-sgml-dtd-4.0
+ ~app-text/docbook-sgml-dtd-4.1
+ ~app-text/docbook-sgml-dtd-4.2
+ ~app-text/docbook-sgml-dtd-4.4
+ ~app-text/docbook-xml-simple-dtd-1.0
+ ~app-text/docbook-xml-simple-dtd-4.1.2.4
+ jadetex? ( dev-texlive/texlive-formatsextra )
+ || (
+ www-client/lynx
+ www-client/links
+ www-client/elinks
+ virtual/w3m
+ )"
+RDEPEND="${DEPEND}"
+
+# including both xml-simple-dtd 4.1.2.4 and 1.0, to ease
+# transition to simple-dtd 1.0, <obz@gentoo.org>
+
+PATCHES=(
+ "${FILESDIR}"/${MY_P}-elinks.patch
+ "${FILESDIR}"/${P}-grep-2.7.patch
+
+ # drop dependency on sys-apps/which
+ "${FILESDIR}"/0001-Migrate-from-1998-style-which-progname-lookup-to-com.patch
+)
+
+src_prepare() {
+ default
+ if use prefix; then
+ eapply "${FILESDIR}"/${MY_P}-prefix.patch
+ eprefixify doc/{man,HTML}/Makefile.am bin/jw.in backends/txt configure.in
+ eautoreconf
+ fi
+}
+
+src_install() {
+ make DESTDIR="${D}" \
+ htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \
+ install
+
+ if ! use jadetex; then
+ local i
+ for i in dvi pdf ps; do
+ rm "${ED}"/usr/bin/docbook2${i} || die
+ rm "${ED}"/usr/share/sgml/docbook/utils-${PV}/backends/${i} || die
+ rm "${ED}"/usr/share/man/man1/docbook2${i}.1 || die
+ done
+ fi
+ einstalldocs
+}
diff --git a/app-text/docbook-sgml-utils/files/0001-Migrate-from-1998-style-which-progname-lookup-to-com.patch b/app-text/docbook-sgml-utils/files/0001-Migrate-from-1998-style-which-progname-lookup-to-com.patch
new file mode 100644
index 000000000000..764d06ad4d78
--- /dev/null
+++ b/app-text/docbook-sgml-utils/files/0001-Migrate-from-1998-style-which-progname-lookup-to-com.patch
@@ -0,0 +1,90 @@
+From a5956fccad44bed98b5de22a6169e0aa098d169f Mon Sep 17 00:00:00 2001
+From: Eli Schwartz <eschwartz93@gmail.com>
+Date: Mon, 4 Mar 2024 18:16:32 -0500
+Subject: [PATCH] Migrate from 1998 style "which progname" lookup to command -v
+
+The "which" utility is not guaranteed to be installed either, and if it
+is, its behavior is not portable either. This means that when sgml tools
+are installed, the `which` check will report a fatal error because the
+which tool did not exist and the shell returned a nonzero status when
+attempting to fork+exec. If it did exist, it might not be an
+implementation of `which` that returns nonzero when commands do not
+exist.
+
+The general scripting suggestion is to use the "command -v" shell
+builtin that is required to exist in all POSIX 2008 compliant shells,
+and is thus guaranteed to work everywhere.
+
+For some in-depth discussions on the topic, see:
+- https://mywiki.wooledge.org/BashFAQ/081
+- https://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-use-then/85250#85250
+
+Examples of open-source shells likely to be installed as /bin/sh on
+Linux, which implement the 15-year-old standard: ash, bash, busybox,
+dash, ksh, mksh and zsh.
+
+However, in this case there's a pretty good exuse for not using a 2008
+standard. The docbook-utils project is dead since 2004. So we patch it
+(and scratch our heads about where to try sending patches).
+
+Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
+---
+ bin/jw.in | 16 ++++++----------
+ 1 file changed, 6 insertions(+), 10 deletions(-)
+
+diff --git a/bin/jw.in b/bin/jw.in
+index 4bfb312..82bd497 100644
+--- a/bin/jw.in
++++ b/bin/jw.in
+@@ -58,8 +58,7 @@ SGML_ERRORS_LIST="\n\
+ \040 no-valid \t Do not require the document to be type-valid"
+
+ # Get name of main SGML configuration file
+-which sgmlwhich >/dev/null 2>/dev/null
+-if [ $? -eq 0 ]
++if command -v sgmlwhich >/dev/null
+ then
+ SGML_CONF=`sgmlwhich`
+ else
+@@ -296,10 +295,10 @@ fi
+ # Try to find the SGML normalizer
+ if [ -z "$SGML_NORM" ]
+ then
+- SGML_NORM=`which sgmlnorm 2>/dev/null`
++ SGML_NORM=`command -v sgmlnorm`
+ if [ -z "SGML_NORM" ]
+ then
+- SGML_NORM=`which osgmlnorm 2>/dev/null`
++ SGML_NORM=`command -v osgmlnorm`
+ fi
+ fi
+
+@@ -376,13 +375,11 @@ esac
+ # Choose a parser
+ if [ -z "$SGML_JADE" ]
+ then
+- which jade >/dev/null 2>/dev/null
+- if [ $? -eq 0 ]
++ if command -v jade >/dev/null
+ then
+ SGML_JADE="jade"
+ else
+- which openjade >/dev/null 2>/dev/null
+- if [ $? -eq 0 ]
++ if command -v openjade >/dev/null
+ then
+ SGML_JADE="openjade"
+ else
+@@ -391,8 +388,7 @@ then
+ fi
+ fi
+ else
+- which $SGML_JADE >/dev/null 2>/dev/null
+- if [ $? -ne 0 ]
++ if ! command -v $SGML_JADE >/dev/null
+ then
+ echo "`basename $0`: parser $SGML_JADE is not available" >&2
+ exit 6
+--
+2.43.0
+