public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/build-docbook-catalog:master commit in: /
@ 2021-10-02  6:17 Mike Frysinger
  0 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2021-10-02  6:17 UTC (permalink / raw
  To: gentoo-commits

commit:     0bb79addc38cc95fd0e98b681ea7c626f0d7d21b
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  2 06:14:19 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Oct  2 06:14:19 2021 +0000
URL:        https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=0bb79add

handle corrupt catalogs gracefully

If the files get corrupted for any reason (i.e. are not valid XML),
the current code gets wedged and is unable to recover until the user
deletes or fixes them.  Instead, let's throw them away and start over.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 build-docbook-catalog | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/build-docbook-catalog b/build-docbook-catalog
index 1c7f103..6950f3e 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -161,6 +161,11 @@ multi_xmlcatalog_add() {
 create_catalogs() {
 	local adds
 
+	# Initialize catalogs if they don't exist or are corrupt.
+	if ! xmllint "${ROOT}${ROOTCATALOG}" >&/dev/null ; then
+		rm -f "${ROOTCATALOG}"
+		echo "Deleting corrupt ${ROOT}${ROOTCATALOG} and starting over"
+	fi
 	if [[ ! -r ${ROOT}${ROOTCATALOG} ]] ; then
 		echo "Creating XML Catalog root ${ROOTCATALOG}"
 		xmlcatalog --noout --create "${ROOT}${ROOTCATALOG}"
@@ -174,6 +179,11 @@ create_catalogs() {
 		clean_catalog "file://${CATALOG}" "${ROOTCATALOG}"
 	fi
 
+	# Initialize catalogs if they don't exist or are corrupt.
+	if ! xmllint "${ROOT}${CATALOG}" >&/dev/null ; then
+		rm -f "${ROOT}${CATALOG}"
+		echo "Deleting corrupt ${CATALOG} and starting over"
+	fi
 	if [[ ! -r ${ROOT}${CATALOG} ]] ; then
 		echo "Creating DocBook XML Catalog ${CATALOG}"
 		xmlcatalog --noout --create "${ROOT}${CATALOG}"


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/build-docbook-catalog:master commit in: /
@ 2021-10-02  6:20 Mike Frysinger
  0 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2021-10-02  6:20 UTC (permalink / raw
  To: gentoo-commits

commit:     8df873bb66a2cb9813cc0a1b7b404ff85de26fce
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  2 06:19:06 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Oct  2 06:19:06 2021 +0000
URL:        https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=8df873bb

switch from old `let` to newer `: $((...))` syntax

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 build-docbook-catalog | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/build-docbook-catalog b/build-docbook-catalog
index 6950f3e..669cbf8 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -354,21 +354,21 @@ populate_entities() {
 	while [[ ${i} -lt ${#entities[@]} || ${j} -lt ${#avail[@]} ]]; do
 		if [[ ${i} -ge ${#entities[@]} ]]; then
 			echo "Warning: Extra ISO entities file: ${avail[j]}"
-			let j=j+1
+			: $(( j += 1 ))
 		elif [[ ${j} -ge ${#avail[@]} ]]; then
 			echo "Warning: Entities file not found: ${entities[i]}"
-			let i=i+2
+			: $(( i += 2 ))
 		elif [[ ${avail[j]} < ${entities[i]} ]]; then
 			echo "Warning: Extra ISO entities file: ${avail[j]}"
-			let j=j+1
+			: $(( j += j + 1 ))
 		elif [[ ${entities[i]} < ${avail[j]} ]]; then
 			echo "Warning: Entities file not found: ${entities[i]}"
-			let i=i+2
+			: $(( i += i + 2 ))
 		elif [[ ${entities[i]} == ${avail[j]} ]]; then
 			xmlcatalog --noout --add "public" "${entities[i+1]}" \
 				"file://${isodir}/${entities[i]}" "${ROOT}${CATALOG}"
-			let j=j+1
-			let i=i+2
+			: $(( j += j + 1 ))
+			: $(( i += i + 2 ))
 		else
 			error "${0}: whoah, shouldn't be here"
 		fi


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/build-docbook-catalog:master commit in: /
@ 2021-10-02  6:20 Mike Frysinger
  0 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2021-10-02  6:20 UTC (permalink / raw
  To: gentoo-commits

commit:     7082cc0798ba101fa596ff066e97290fb5f988f0
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  2 06:19:39 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Oct  2 06:19:39 2021 +0000
URL:        https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=7082cc07

use `grep -E` instead of `egrep`

This makes shellcheck happy and is easy enough to do.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 build-docbook-catalog | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/build-docbook-catalog b/build-docbook-catalog
index 669cbf8..495de64 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -221,7 +221,7 @@ create_catalogs() {
 clean_catalog() {
 	local list f regex=$1 catalog=${ROOT}$2
 
-	list=$(egrep --only-matching "${regex}" "${catalog}" | sort -u)
+	list=$(grep -E --only-matching "${regex}" "${catalog}" | sort -u)
 	for f in ${list}; do
 		xmlcatalog --noout --del "${f}" "${catalog}"
 	done
@@ -265,7 +265,7 @@ populate_dtd() {
 		verb "  No entities available for ${dtd}"
 		return 0
 	fi
-	dtd_date=$(egrep --only-matching --max-count=1 \
+	dtd_date=$(grep -E --only-matching --max-count=1 \
 		'[0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}' \
 		"${ROOT}${dtd}")
 	if [[ -z ${dtd_date} ]]; then


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/build-docbook-catalog:master commit in: /
@ 2021-10-03  4:01 Mike Frysinger
  0 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2021-10-03  4:01 UTC (permalink / raw
  To: gentoo-commits

commit:     6f6354f622ef92418cfd3f111064c37d4a6cd6c9
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  3 01:43:05 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Oct  3 01:43:05 2021 +0000
URL:        https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=6f6354f6

switch locking to flock

If the tool gets killed while holding its lock, the files stay locked,
and future runs hang waiting for the lock, until a dev manually clears
things.  Switch to flock as it provides a process-based lock and the
kernel will release it automatically when we exit.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 build-docbook-catalog | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/build-docbook-catalog b/build-docbook-catalog
index b815bfc..b4d7223 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -69,14 +69,11 @@ main() {
 		mkdir -p "${ROOT}${ROOTCONFDIR}" || error "could not create ${ROOTCONFDIR}"
 	fi
 
-	local lock="${ROOT}${ROOTCONFDIR}"/build-docbook-catalog-lock
+	local lock="${ROOT}/run/lock/build-docbook-catalog.lock"
 	(
 	# Lock the dir to avoid trashing other runs that might
 	# be running parallel.
-	touch "${lock}".$$ && \
-		until ln "${lock}".$$ "${lock}" 2>/dev/null; do sleep 1; done && \
-		rm "${lock}".$$
-	[[ -f ${lock}.$$ ]] && error "unable to lock ${ROOTCONFDIR}"
+	flock 200
 
 	create_catalogs			# will exit on error
 	for type in xsl xsl-ns xsl-saxon xsl-xalan; do
@@ -98,8 +95,9 @@ main() {
 		populate_entities
 	fi
 
-	)
-	rm "${lock}"
+	# NB: Don't delete the lock since we can't delete files by fd, and if we do
+	# it by path, we might delete the lock while other processes grab it.
+	) 200>>"${lock}"
 
 	exit 0
 }


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/build-docbook-catalog:master commit in: /
@ 2021-10-03  4:01 Mike Frysinger
  0 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2021-10-03  4:01 UTC (permalink / raw
  To: gentoo-commits

commit:     f6affac471ca772f43441e25bc2420bb49293f81
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  3 02:29:47 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Oct  3 02:29:47 2021 +0000
URL:        https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=f6affac4

do not try to lint missing files

This avoids spurious warnings of corruption when the files don't exist.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 build-docbook-catalog | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/build-docbook-catalog b/build-docbook-catalog
index b4d7223..0da432a 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -161,7 +161,7 @@ create_catalogs() {
 	local adds
 
 	# Initialize catalogs if they don't exist or are corrupt.
-	if ! xmllint "${ROOT}${ROOTCATALOG}" >&/dev/null ; then
+	if [[ -r ${ROOT}${ROOTCATALOG} ]] && ! xmllint "${ROOT}${ROOTCATALOG}" >&/dev/null ; then
 		rm -f "${ROOTCATALOG}"
 		echo "Deleting corrupt ${ROOT}${ROOTCATALOG} and starting over"
 	fi
@@ -179,7 +179,7 @@ create_catalogs() {
 	fi
 
 	# Initialize catalogs if they don't exist or are corrupt.
-	if ! xmllint "${ROOT}${CATALOG}" >&/dev/null ; then
+	if [[ -r ${ROOT}${CATALOG} ]] && ! xmllint "${ROOT}${CATALOG}" >&/dev/null ; then
 		rm -f "${ROOT}${CATALOG}"
 		echo "Deleting corrupt ${CATALOG} and starting over"
 	fi


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/build-docbook-catalog:master commit in: /
@ 2021-10-03  4:01 Mike Frysinger
  0 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2021-10-03  4:01 UTC (permalink / raw
  To: gentoo-commits

commit:     355abc02714fda77f6cac512bed9c40ae690802d
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  3 02:50:41 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Oct  3 02:50:41 2021 +0000
URL:        https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=355abc02

add a --debug option

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 build-docbook-catalog | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/build-docbook-catalog b/build-docbook-catalog
index 0da432a..017ae75 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -32,6 +32,7 @@ usage() {
 	Options:
 	  -r, --root       ROOT path to work on
 	  -v, --verbose    Be verbose
+	  -x, --debug      Run with debugging enabled
 	  -h, --help       This!
 	EOF
 	[[ $# -gt 0 ]] && eerror "$*"
@@ -44,13 +45,14 @@ usage() {
 main() {
 	local d v opts
 
-	opts=$(${GETOPT} -o hr:v --long help,root:,verbose -n "${ZERO}" -- "$@") || exit 1
+	opts=$(${GETOPT} -o hr:vx --long help,root:,verbose,debug -n "${ZERO}" -- "$@") || exit 1
 	eval set -- "${opts}"
 	while true; do
 		case $1 in
 			-h|--help) usage ;;
 			-r|--root) ROOT=$2 ; shift ;;
 			-v|--verbose) VERBOSE=true ;;
+			-x|--debug) set -x ;;
 			--) break ;;
 			*) usage "options parsing failed on $1!" ;;
 		esac


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/build-docbook-catalog:master commit in: /
@ 2021-10-03  4:01 Mike Frysinger
  0 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2021-10-03  4:01 UTC (permalink / raw
  To: gentoo-commits

commit:     bd29656622f75011e723c71880ebba5844f7f518
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  3 03:57:53 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Oct  3 03:57:53 2021 +0000
URL:        https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=bd296566

update README & dist process

Now that we're in git, we can simplify things a lot.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 Makefile              | 14 +++-----------
 README                | 29 ++++-------------------------
 build-docbook-catalog |  9 ++-------
 3 files changed, 9 insertions(+), 43 deletions(-)

diff --git a/Makefile b/Makefile
index b920de3..cb8634a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,5 @@
-PN = build-docbook-catalog
-PV = $(shell awk '/^\# .Header:/{print $$4;exit}' build-docbook-catalog)
-P = $(PN)-$(PV)
+# Copyright 2004-2021 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
 
 all:
 
@@ -14,11 +13,4 @@ install:
 	install -d $(DESTDIR)$(SBINDIR)
 	install -m 755 build-docbook-catalog $(DESTDIR)$(SBINDIR)
 
-dist:
-	rm -rf $(P)
-	mkdir -p $(P)
-	cp -pPR build-docbook-catalog Makefile README $(P)/
-	tar --posix --owner 0 --group 0 -cf - $(P) | xz -9 > $(P).tar.xz
-	rm -rf $(P)
-
-.PHONY: all clean dist install
+.PHONY: all clean install

diff --git a/README b/README
index 8c3716d..8e1e345 100644
--- a/README
+++ b/README
@@ -1,31 +1,10 @@
-$Header: /usr/local/src/gentoo/gentoo-src/cvsroot/gentoo-src/build-docbook-catalog/README,v 1.2 2012/03/27 22:36:51 vapier Exp $
-
 This is the source for app-text/build-docbook-catalog, which is a
 script to regenerate the xml docbook catalog.
 
 You can find it here:
-	http://sources.gentoo.org/gentoo-src/build-docbook-catalog/
-
-To make a release of this script, do the following:
-
-1. Commit your changes, create the tarball, and post it:
-
-    make dist
-    cp build-docbook-catalog-*.tar.xz /usr/portage/distfiles/
-    scp build-docbook-catalog-*.tar.xz dev.gentoo.org:/space/distfiles-local/
-
-2. Make a new version of the build-docbook-catalog ebuild:
-
-    ego build-docbook-catalog
-    cp $(ls -t1 *.ebuild | head -n 1) build-docbook-catalog-${rev}.ebuild
-    ekeyword ~all build-docbook-catalog-${rev}.ebuild
-
-3. Do the normal steps to generate a digest, mark the previous version
-   stable, use echangelog to add a ChangeLog entry, etc.
+	https://gitweb.gentoo.org/proj/build-docbook-catalog.git/
 
-    cvs add build-docbook-catalog-${rev}.ebuild
-    ebuild build-docbook-catalog-${rev}.ebuild digest
-    echangelog
-    repoman commit -m "version bump to ${rev}"
+To make a release of this script, create a new git tag.
+	git tag v2.0
 
-vim:sw=4 expandtab
+We pull tarballs from the git site now.  So update the ebuild like normal.

diff --git a/build-docbook-catalog b/build-docbook-catalog
index b420541..9064d72 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -1,13 +1,7 @@
 #!/bin/bash
-# $Header: /usr/local/src/gentoo/gentoo-src/cvsroot/gentoo-src/build-docbook-catalog/build-docbook-catalog,v 1.21 2016/05/23 15:53:13 haubi Exp $
-#
-# build-docbook-catalog: populate /etc/xml/docbook based in
-# installed docbook-xml-dtd versions.
-#
-# Copyright 2004-2012 Gentoo Foundation
+# Copyright 2004-2021 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # written by Aron Griffis
-#
 
 EPREFIX=
 ROOTCONFDIR="${EPREFIX}"/etc/xml
@@ -28,6 +22,7 @@ GETOPT=getopt
 usage() {
 	cat <<-EOF
 	Usage: ${ZERO} [options]
+	Regenerate the XML docbook catalog under ${ROOTCONFDIR}.
 
 	Options:
 	  -r, --root       ROOT path to work on


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/build-docbook-catalog:master commit in: /
@ 2021-10-03  4:01 Mike Frysinger
  0 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2021-10-03  4:01 UTC (permalink / raw
  To: gentoo-commits

commit:     203b974cdde83e876ba665df47928868278581ae
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  3 03:25:41 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Oct  3 03:25:41 2021 +0000
URL:        https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=203b974c

make file updates atomic

While we have locks against other invocations of build-docbook-catalog
to keep them from clobbering each other (write locks), we didn't have
any locks for users of the databases (read locks).  Rewriting the files
in place causes those readers to get partially written files and then
fail (due to missing entries).

Closes: https://bugs.gentoo.org/773517
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 build-docbook-catalog | 51 +++++++++++++++++++++++++++++++--------------------
 1 file changed, 31 insertions(+), 20 deletions(-)

diff --git a/build-docbook-catalog b/build-docbook-catalog
index 017ae75..b420541 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -84,8 +84,8 @@ main() {
 
 	# Clean out old dtds from catalog
 	verb "Cleaning out old DocBook XML versions from ${CATALOG} and ${ROOTCATALOG}"
-	clean_catalog "${DOCBOOKDIR}/xml\(-simple\)*-dtd-[^/\"']*/[^/\"']*" "${CATALOG}"
-	clean_catalog "${DOCBOOKDIR}/xml\(-simple\)*-dtd-[^/\"']*/[^/\"']*" "${ROOTCATALOG}"
+	clean_catalog "${DOCBOOKDIR}/xml\(-simple\)*-dtd-[^/\"']*/[^/\"']*" "${CATALOG}.tmp"
+	clean_catalog "${DOCBOOKDIR}/xml\(-simple\)*-dtd-[^/\"']*/[^/\"']*" "${ROOTCATALOG}.tmp"
 
 	if set_dtds; then
 		for d in "${DTDS[@]}"; do
@@ -97,6 +97,14 @@ main() {
 		populate_entities
 	fi
 
+	sed -i \
+		-e "s:${ROOTCATALOG}\.tmp:${ROOTCATALOG}:g" \
+		-e "s:${CATALOG}\.tmp:${CATALOG}:g" \
+		"${ROOT}${ROOTCATALOG}.tmp" \
+		"${ROOT}${CATALOG}.tmp" || error "could not clean up"
+	mv "${ROOT}${ROOTCATALOG}.tmp" "${ROOT}${ROOTCATALOG}"
+	mv "${ROOT}${CATALOG}.tmp" "${ROOT}${CATALOG}"
+
 	# NB: Don't delete the lock since we can't delete files by fd, and if we do
 	# it by path, we might delete the lock while other processes grab it.
 	) 200>>"${lock}"
@@ -173,11 +181,13 @@ create_catalogs() {
 		if [[ ! -r ${ROOT}${ROOTCATALOG} ]] ; then
 			error "failed creating ${ROOTCATALOG}"
 		fi
+		cp "${ROOT}${ROOTCATALOG}" "${ROOT}${ROOTCATALOG}.tmp"
 	else
 		verb "Found XML Catalog root ${ROOTCATALOG}"
 		# clean out existing entries
 		verb "  Cleaning existing ${CATALOG} delegates from ${ROOTCATALOG}"
-		clean_catalog "file://${CATALOG}" "${ROOTCATALOG}"
+		cp "${ROOTCATALOG}" "${ROOTCATALOG}.tmp"
+		clean_catalog "file://${CATALOG}" "${ROOTCATALOG}.tmp"
 	fi
 
 	# Initialize catalogs if they don't exist or are corrupt.
@@ -194,24 +204,25 @@ create_catalogs() {
 	else
 		verb "Found DocBook XML Catalog ${CATALOG}"
 	fi
+	cp "${ROOT}${CATALOG}" "${ROOT}${CATALOG}.tmp"
 
 	# dtd pointers
 	verb "  Populating ${ROOTCATALOG} with DTD delegates to ${CATALOG}"
 	adds=(
-		"delegatePublic"  "-//OASIS//ENTITIES DocBook"          "${CATALOG}"
-		"delegatePublic"  "-//OASIS//ELEMENTS DocBook"          "${CATALOG}"
-		"delegatePublic"  "-//OASIS//DTD DocBook"               "${CATALOG}"
-		"delegateSystem"  "http://www.oasis-open.org/docbook/"  "${CATALOG}"
-		"delegateURI"     "http://www.oasis-open.org/docbook/"  "${CATALOG}"
+		"delegatePublic"  "-//OASIS//ENTITIES DocBook"          "${CATALOG}.tmp"
+		"delegatePublic"  "-//OASIS//ELEMENTS DocBook"          "${CATALOG}.tmp"
+		"delegatePublic"  "-//OASIS//DTD DocBook"               "${CATALOG}.tmp"
+		"delegateSystem"  "http://www.oasis-open.org/docbook/"  "${CATALOG}.tmp"
+		"delegateURI"     "http://www.oasis-open.org/docbook/"  "${CATALOG}.tmp"
 	)
-	multi_xmlcatalog_add "${ROOTCATALOG}" "${adds[@]}"
+	multi_xmlcatalog_add "${ROOTCATALOG}.tmp" "${adds[@]}"
 
 	# entities pointer
 	verb "  Populating ${ROOTCATALOG} with ISO entities delegate to ${CATALOG}"
 	adds=(
-		"delegatePublic"  "ISO 8879:1986"  "${CATALOG}"
+		"delegatePublic"  "ISO 8879:1986"  "${CATALOG}.tmp"
 	)
-	multi_xmlcatalog_add "${ROOTCATALOG}" "${adds[@]}"
+	multi_xmlcatalog_add "${ROOTCATALOG}.tmp" "${adds[@]}"
 }
 
 #
@@ -259,7 +270,7 @@ populate_dtd() {
 		"rewriteSystem"  "http://www.oasis-open.org/docbook/xml/${v}"                            "${docbookdir}"
 		"rewriteURI"     "http://www.oasis-open.org/docbook/xml/${v}"                            "${docbookdir}"
 	)
-	multi_xmlcatalog_add "${CATALOG}" "${adds[@]}"
+	multi_xmlcatalog_add "${CATALOG}.tmp" "${adds[@]}"
 
 	# grab the RCS date from docbookx.dtd for comparison purposes
 	if [[ ! -f ${ROOT}${docbookdir}/ent/iso-lat1.ent ]]; then
@@ -305,7 +316,7 @@ populate_simple_dtd() {
 		"rewriteSystem"  "http://www.oasis-open.org/docbook/xml/simple/${v}"  "${docbookdir}"
 		"rewriteURI"     "http://www.oasis-open.org/docbook/xml/simple/${v}"  "${docbookdir}"
 	)
-	multi_xmlcatalog_add "${CATALOG}" "${adds[@]}"
+	multi_xmlcatalog_add "${CATALOG}.tmp" "${adds[@]}"
 }
 
 #
@@ -367,7 +378,7 @@ populate_entities() {
 			: $(( i += 2 ))
 		elif [[ ${entities[i]} == "${avail[j]}" ]]; then
 			xmlcatalog --noout --add "public" "${entities[i+1]}" \
-				"file://${isodir}/${entities[i]}" "${ROOT}${CATALOG}"
+				"file://${isodir}/${entities[i]}" "${ROOT}${CATALOG}.tmp"
 			: $(( j += 1 ))
 			: $(( i += 2 ))
 		else
@@ -386,8 +397,8 @@ populate_xsl() {
 	local type=$1
 
 	# Delete current entries from the catalog (delete legacy versioned entries too)
-	clean_catalog "${DOCBOOKDIR}/${type}-stylesheets(-[0-9\.]+)?" "${CATALOG}"
-	clean_catalog "${DOCBOOKDIR}/${type}-stylesheets(-[0-9\.]+)?" "${ROOTCATALOG}"
+	clean_catalog "${DOCBOOKDIR}/${type}-stylesheets(-[0-9\.]+)?" "${CATALOG}.tmp"
+	clean_catalog "${DOCBOOKDIR}/${type}-stylesheets(-[0-9\.]+)?" "${ROOTCATALOG}.tmp"
 
 	local xsldir=${DOCBOOKDIR}/${type}-stylesheets
 
@@ -406,17 +417,17 @@ populate_xsl() {
 
 	verb "  Populating ${ROOTCATALOG} with XSL delegations"
 	adds=(
-		"delegateSystem"  "http://docbook.sourceforge.net/release/${type}/"  "${CATALOG}"
-		"delegateURI"     "http://docbook.sourceforge.net/release/${type}/"  "${CATALOG}"
+		"delegateSystem"  "http://docbook.sourceforge.net/release/${type}/"  "${CATALOG}.tmp"
+		"delegateURI"     "http://docbook.sourceforge.net/release/${type}/"  "${CATALOG}.tmp"
 	)
-	multi_xmlcatalog_add "${ROOTCATALOG}" "${adds[@]}"
+	multi_xmlcatalog_add "${ROOTCATALOG}.tmp" "${adds[@]}"
 
 	verb "  Populating ${CATALOG} with XSL stylesheets"
 	adds=(
 		"rewriteSystem"  "http://docbook.sourceforge.net/release/${type}/current"  "${xsldir}"
 		"rewriteURI"     "http://docbook.sourceforge.net/release/${type}/current"  "${xsldir}"
 	)
-	multi_xmlcatalog_add "${CATALOG}" "${adds[@]}"
+	multi_xmlcatalog_add "${CATALOG}.tmp" "${adds[@]}"
 }
 
 # Call the main routine


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/build-docbook-catalog:master commit in: /
@ 2021-10-03  4:01 Mike Frysinger
  0 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2021-10-03  4:01 UTC (permalink / raw
  To: gentoo-commits

commit:     d03e5fcf3b23d33d240acc356c3d5bd1f009d047
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  3 01:23:45 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Oct  3 01:23:45 2021 +0000
URL:        https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=d03e5fcf

switch to arrays

The files we work with are supposed to be simple so this shouldn't
super matter, but now that newer bash and tools have options to
easily work with these, might as well switch over to fix quoting.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 build-docbook-catalog | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/build-docbook-catalog b/build-docbook-catalog
index 0ecbc1c..b815bfc 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -14,7 +14,8 @@ ROOTCONFDIR="${EPREFIX}"/etc/xml
 ROOTCATALOG=${ROOTCONFDIR}/catalog
 CATALOG=${ROOTCONFDIR}/docbook
 DOCBOOKDIR="${EPREFIX}"/usr/share/sgml/docbook
-DTDS=
+DTDS=()
+SIMPLE_DTDS=()
 LATEST_DTD=
 LATEST_DATE=
 VERBOSE=false
@@ -56,7 +57,7 @@ main() {
 		shift
 	done
 
-	: ${ROOT:=/}
+	: "${ROOT:=/}"
 	[[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
 	[[ ${ROOT} != /* ]] && ROOT="${PWD}${ROOT}"
 	if [[ ${ROOT} != "/" ]] ; then
@@ -88,11 +89,11 @@ main() {
 	clean_catalog "${DOCBOOKDIR}/xml\(-simple\)*-dtd-[^/\"']*/[^/\"']*" "${ROOTCATALOG}"
 
 	if set_dtds; then
-		for d in ${DTDS}; do
-			populate_dtd ${d}
+		for d in "${DTDS[@]}"; do
+			populate_dtd "${d}"
 		done
-		for d in ${SIMPLE_DTDS}; do
-			populate_simple_dtd ${d}
+		for d in "${SIMPLE_DTDS[@]}"; do
+			populate_simple_dtd "${d}"
 		done
 		populate_entities
 	fi
@@ -122,17 +123,17 @@ error() {
 # fill in the DTDS variable based on installed versions
 #
 set_dtds() {
-	DTDS= SIMPLE_DTS=
+	DTDS=() SIMPLE_DTDS=()
 
 	local d=${ROOT}${DOCBOOKDIR}
 	if [[ -d ${d} ]] ; then
 		pushd "${d}" >/dev/null || return 1
-		DTDS=$(find xml-dtd-*/ -name docbookx.dtd)
-		SIMPLE_DTDS=$(find xml-simple-dtd-*/ -name sdocbook.dtd)
-		popd >/dev/null
+		mapfile -d $'\0' DTDS < <(find xml-dtd-*/ -name docbookx.dtd -print0)
+		mapfile -d $'\0' SIMPLE_DTDS < <(find xml-simple-dtd-*/ -name sdocbook.dtd -print0)
+		popd >/dev/null || return 1
 	fi
 
-	if [[ -z ${DTDS} ]]; then
+	if [[ ${#DTDS[@]} -eq 0 ]]; then
 		echo "No installed DocBook XML DTDs found"
 		return 1
 	else
@@ -346,10 +347,10 @@ populate_entities() {
 	)
 
 	# here are the entities available; assume no spaces in filenames...
-	avail=($(ls "${ROOT}${isodir}" | sort))
+	mapfile -d $'\0' avail < <(find "${ROOT}${isodir}" -maxdepth 1 -type f -printf '%f\0' | sort -z)
 
 	# double-check the lists
-	verb "  Populating ${CATALOG} with ISO DocBook entities"
+	verb "  Populating ${CATALOG} with ${#avail[@]} ISO DocBook entities"
 	i=0 ; j=0
 	while [[ ${i} -lt ${#entities[@]} || ${j} -lt ${#avail[@]} ]]; do
 		if [[ ${i} -ge ${#entities[@]} ]]; then
@@ -358,13 +359,13 @@ populate_entities() {
 		elif [[ ${j} -ge ${#avail[@]} ]]; then
 			echo "Warning: Entities file not found: ${entities[i]}"
 			: $(( i += 2 ))
-		elif [[ ${avail[j]} < ${entities[i]} ]]; then
+		elif [[ ${avail[j]} < "${entities[i]}" ]]; then
 			echo "Warning: Extra ISO entities file: ${avail[j]}"
 			: $(( j += 1 ))
-		elif [[ ${entities[i]} < ${avail[j]} ]]; then
+		elif [[ ${entities[i]} < "${avail[j]}" ]]; then
 			echo "Warning: Entities file not found: ${entities[i]}"
 			: $(( i += 2 ))
-		elif [[ ${entities[i]} == ${avail[j]} ]]; then
+		elif [[ ${entities[i]} == "${avail[j]}" ]]; then
 			xmlcatalog --noout --add "public" "${entities[i+1]}" \
 				"file://${isodir}/${entities[i]}" "${ROOT}${CATALOG}"
 			: $(( j += 1 ))


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/build-docbook-catalog:master commit in: /
@ 2021-10-03  4:01 Mike Frysinger
  0 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2021-10-03  4:01 UTC (permalink / raw
  To: gentoo-commits

commit:     52ac30c3b95a9582ac71b8c266141dd29e71e171
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  3 03:10:54 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Oct  3 03:10:54 2021 +0000
URL:        https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=52ac30c3

fix bad let conversion

Previous commit changing away from let and to += left a var behind.
Fix that up.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 build-docbook-catalog | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/build-docbook-catalog b/build-docbook-catalog
index 495de64..0ecbc1c 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -360,15 +360,15 @@ populate_entities() {
 			: $(( i += 2 ))
 		elif [[ ${avail[j]} < ${entities[i]} ]]; then
 			echo "Warning: Extra ISO entities file: ${avail[j]}"
-			: $(( j += j + 1 ))
+			: $(( j += 1 ))
 		elif [[ ${entities[i]} < ${avail[j]} ]]; then
 			echo "Warning: Entities file not found: ${entities[i]}"
-			: $(( i += i + 2 ))
+			: $(( i += 2 ))
 		elif [[ ${entities[i]} == ${avail[j]} ]]; then
 			xmlcatalog --noout --add "public" "${entities[i+1]}" \
 				"file://${isodir}/${entities[i]}" "${ROOT}${CATALOG}"
-			: $(( j += j + 1 ))
-			: $(( i += i + 2 ))
+			: $(( j += 1 ))
+			: $(( i += 2 ))
 		else
 			error "${0}: whoah, shouldn't be here"
 		fi


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/build-docbook-catalog:master commit in: /
@ 2021-10-05  1:14 Mike Frysinger
  0 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2021-10-05  1:14 UTC (permalink / raw
  To: gentoo-commits

commit:     ec9ee7e4085408a83f6071c596d425ec3d41be06
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  5 01:13:50 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Oct  5 01:13:50 2021 +0000
URL:        https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=ec9ee7e4

tweak usage output to make --root argument clearer

Show that the --root option takes an explicit argument.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 build-docbook-catalog | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/build-docbook-catalog b/build-docbook-catalog
index 5b6cd85..b212822 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -25,10 +25,10 @@ usage() {
 	Regenerate the XML docbook catalog under ${ROOTCONFDIR}.
 
 	Options:
-	  -r, --root       ROOT path to work on
-	  -v, --verbose    Be verbose
-	  -x, --debug      Run with debugging enabled
-	  -h, --help       This!
+	  -r, --root <ROOT>   Path to work on (defaults to \$ROOT)
+	  -v, --verbose       Be verbose
+	  -x, --debug         Run with debugging enabled
+	  -h, --help          This!
 	EOF
 	[[ $# -gt 0 ]] && eerror "$*"
 	exit 0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/build-docbook-catalog:master commit in: /
@ 2021-10-05  1:14 Mike Frysinger
  0 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2021-10-05  1:14 UTC (permalink / raw
  To: gentoo-commits

commit:     2b69063f19a03e9224eeaa6cecd35dd2004127c0
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  5 01:11:27 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Oct  5 01:11:27 2021 +0000
URL:        https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=2b69063f

add explicit check & error message for /run/lock

If the system is missing its lock dir, show an explicit error message
instead of confusing bash "file does not exist" errors.

Bug: https://bugs.gentoo.org/816303
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 build-docbook-catalog | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/build-docbook-catalog b/build-docbook-catalog
index 9064d72..5b6cd85 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -66,7 +66,12 @@ main() {
 		mkdir -p "${ROOT}${ROOTCONFDIR}" || error "could not create ${ROOTCONFDIR}"
 	fi
 
-	local lock="${ROOT}/run/lock/build-docbook-catalog.lock"
+	local lock_dir="${ROOT}/run/lock"
+	if [[ ! -d ${lock_dir} ]] ; then
+		error "${lock_dir}: missing critical system path; please create it"
+	fi
+
+	local lock="${lock_dir}/build-docbook-catalog.lock"
 	(
 	# Lock the dir to avoid trashing other runs that might
 	# be running parallel.


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/build-docbook-catalog:master commit in: /
@ 2021-10-08 12:22 Mike Frysinger
  0 siblings, 0 replies; 17+ messages in thread
From: Mike Frysinger @ 2021-10-08 12:22 UTC (permalink / raw
  To: gentoo-commits

commit:     85b15e9f180c2237166eca4194a4d4bd107fa8c6
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  8 12:19:25 2021 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Oct  8 12:19:25 2021 +0000
URL:        https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=85b15e9f

add eprefix to lockdir #816747

Bug: https://bugs.gentoo.org/816747
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 build-docbook-catalog | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/build-docbook-catalog b/build-docbook-catalog
index b212822..aabc756 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -8,6 +8,7 @@ ROOTCONFDIR="${EPREFIX}"/etc/xml
 ROOTCATALOG=${ROOTCONFDIR}/catalog
 CATALOG=${ROOTCONFDIR}/docbook
 DOCBOOKDIR="${EPREFIX}"/usr/share/sgml/docbook
+LOCKDIR=${EPREFIX}/run/lock
 DTDS=()
 SIMPLE_DTDS=()
 LATEST_DTD=
@@ -66,7 +67,7 @@ main() {
 		mkdir -p "${ROOT}${ROOTCONFDIR}" || error "could not create ${ROOTCONFDIR}"
 	fi
 
-	local lock_dir="${ROOT}/run/lock"
+	local lock_dir="${ROOT}${LOCKDIR}"
 	if [[ ! -d ${lock_dir} ]] ; then
 		error "${lock_dir}: missing critical system path; please create it"
 	fi


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/build-docbook-catalog:master commit in: /
@ 2022-01-17 23:13 Andreas K. Hüttel
  0 siblings, 0 replies; 17+ messages in thread
From: Andreas K. Hüttel @ 2022-01-17 23:13 UTC (permalink / raw
  To: gentoo-commits

commit:     301eedd615b1f9f7369f39c06831dbec84235c08
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 17 23:07:04 2022 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jan 17 23:12:57 2022 +0000
URL:        https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=301eedd6

Place the locks in a subdirectory of /etc/xml

* $ROOT/run is not mounted in stage1root during stage1 build, which leads
  to build failures
* Even if we mount it, we don't have /run/lock in there then (applies also
  to stage2 and stage3).
* On systemd installs we could workaround via running systemd-tmpfiles, but
* On openrc installs /run/lock is created inside openrc, inaccessible for
  a chroot.
* Crossdev users do not mount /run either.

While all these things could be worked around somehow, that amounts to a
lot of effort for no gain.

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 build-docbook-catalog | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/build-docbook-catalog b/build-docbook-catalog
index aabc756..1b4ccf3 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -8,7 +8,7 @@ ROOTCONFDIR="${EPREFIX}"/etc/xml
 ROOTCATALOG=${ROOTCONFDIR}/catalog
 CATALOG=${ROOTCONFDIR}/docbook
 DOCBOOKDIR="${EPREFIX}"/usr/share/sgml/docbook
-LOCKDIR=${EPREFIX}/run/lock
+LOCKDIR=${EPREFIX}/etc/xml/.lock
 DTDS=()
 SIMPLE_DTDS=()
 LATEST_DTD=
@@ -69,7 +69,7 @@ main() {
 
 	local lock_dir="${ROOT}${LOCKDIR}"
 	if [[ ! -d ${lock_dir} ]] ; then
-		error "${lock_dir}: missing critical system path; please create it"
+		mkdir -p "${lock_dir}"
 	fi
 
 	local lock="${lock_dir}/build-docbook-catalog.lock"


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/build-docbook-catalog:master commit in: /
@ 2022-01-27 20:28 Sam James
  0 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2022-01-27 20:28 UTC (permalink / raw
  To: gentoo-commits

commit:     273d518b5512ecdee5c7e5c215f9230de52c3879
Author:     Marvin Schmidt <marv <AT> exherbo <DOT> org>
AuthorDate: Thu Jan 20 09:06:13 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jan 27 20:28:27 2022 +0000
URL:        https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=273d518b

Honour ROOT when deleting existing catalog

The condition checked for `${ROOT}${ROOTCATALOG}`, but then deleted
the catalog file outside of ROOT (`${ROOTCATALOG}`). Fix this by adding
the missing `${ROOT}`

Signed-off-by: Sam James <sam <AT> gentoo.org>

 build-docbook-catalog | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build-docbook-catalog b/build-docbook-catalog
index 1b4ccf3..cee9af0 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -173,7 +173,7 @@ create_catalogs() {
 
 	# Initialize catalogs if they don't exist or are corrupt.
 	if [[ -r ${ROOT}${ROOTCATALOG} ]] && ! xmllint "${ROOT}${ROOTCATALOG}" >&/dev/null ; then
-		rm -f "${ROOTCATALOG}"
+		rm -f "${ROOT}${ROOTCATALOG}"
 		echo "Deleting corrupt ${ROOT}${ROOTCATALOG} and starting over"
 	fi
 	if [[ ! -r ${ROOT}${ROOTCATALOG} ]] ; then


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/build-docbook-catalog:master commit in: /
@ 2023-04-25  3:43 Sam James
  0 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-04-25  3:43 UTC (permalink / raw
  To: gentoo-commits

commit:     8a94952d5f7208e6fd75e4eef6c937c58bc8775e
Author:     Raul E Rangel <rrangel <AT> chromium <DOT> org>
AuthorDate: Tue Apr  4 22:13:57 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Apr 25 03:42:52 2023 +0000
URL:        https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=8a94952d

Fix noisy find command

We weren't using nullglob, so the wildcard parameter was incorrectly
getting passed to `find`.

+ pushd /build/arm64-generic//usr/share/sgml/docbook
+ mapfile -d '' DTDS
++ find xml-dtd-4.3/ xml-dtd-4.5/ -name docbookx.dtd -print0
+ mapfile -d '' SIMPLE_DTDS
++ find 'xml-simple-dtd-*/' -name sdocbook.dtd -print0
find: ‘xml-simple-dtd-*/’: No such file or directory
+ popd

Signed-off-by: Raul E Rangel <rrangel <AT> chromium.org>
Closes: https://github.com/gentoo/build-docbook-catalog/pull/1
Signed-off-by: Sam James <sam <AT> gentoo.org>

 build-docbook-catalog | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/build-docbook-catalog b/build-docbook-catalog
index 2275703..f5995da 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -137,8 +137,10 @@ set_dtds() {
 	local d=${ROOT}${DOCBOOKDIR}
 	if [[ -d ${d} ]] ; then
 		pushd "${d}" >/dev/null || return 1
-		mapfile -d $'\0' DTDS < <(find xml-dtd-*/ -name docbookx.dtd -print0)
-		mapfile -d $'\0' SIMPLE_DTDS < <(find xml-simple-dtd-*/ -name sdocbook.dtd -print0)
+		shopt -s nullglob
+		DTDS=( xml-dtd-*/docbookx.dtd )
+		SIMPLE_DTDS=( xml-simple-dtd-*/sdocbook.dtd )
+		shopt -u nullglob
 		popd >/dev/null || return 1
 	fi
 


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [gentoo-commits] proj/build-docbook-catalog:master commit in: /
@ 2023-04-25  3:43 Sam James
  0 siblings, 0 replies; 17+ messages in thread
From: Sam James @ 2023-04-25  3:43 UTC (permalink / raw
  To: gentoo-commits

commit:     158daca4d8dc373b5b6c5757cfa6491b6eda3b18
Author:     Raul E Rangel <rrangel <AT> chromium <DOT> org>
AuthorDate: Tue Apr  4 21:57:13 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Apr 25 03:42:51 2023 +0000
URL:        https://gitweb.gentoo.org/proj/build-docbook-catalog.git/commit/?id=158daca4

Fix incorrect cp when using ROOT

We were missing the ROOT prefix on the cp operation:
+ [[ -r /build/arm64-generic//etc/xml/catalog ]]
+ xmllint /build/arm64-generic//etc/xml/catalog
+ [[ ! -r /build/arm64-generic//etc/xml/catalog ]]
+ verb 'Found XML Catalog root /etc/xml/catalog'
+ false
+ verb '  Cleaning existing /etc/xml/docbook delegates from /etc/xml/catalog'
+ false
+ cp /etc/xml/catalog /etc/xml/catalog.tmp
+ clean_catalog file:///etc/xml/docbook /etc/xml/catalog.tmp
+ local list f regex=file:///etc/xml/docbook catalog=/build/arm64-generic//etc/xml/catalog.tmp
++ grep -E --only-matching file:///etc/xml/docbook /build/arm64-generic//etc/xml/catalog.tmp
++ sort -u
grep: /build/arm64-generic//etc/xml/catalog.tmp: No such file or directory

Signed-off-by: Raul E Rangel <rrangel <AT> chromium.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 build-docbook-catalog | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build-docbook-catalog b/build-docbook-catalog
index cee9af0..2275703 100755
--- a/build-docbook-catalog
+++ b/build-docbook-catalog
@@ -187,7 +187,7 @@ create_catalogs() {
 		verb "Found XML Catalog root ${ROOTCATALOG}"
 		# clean out existing entries
 		verb "  Cleaning existing ${CATALOG} delegates from ${ROOTCATALOG}"
-		cp "${ROOTCATALOG}" "${ROOTCATALOG}.tmp"
+		cp "${ROOT}${ROOTCATALOG}" "${ROOT}${ROOTCATALOG}.tmp"
 		clean_catalog "file://${CATALOG}" "${ROOTCATALOG}.tmp"
 	fi
 


^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2023-04-25  3:43 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-02  6:17 [gentoo-commits] proj/build-docbook-catalog:master commit in: / Mike Frysinger
  -- strict thread matches above, loose matches on Subject: below --
2021-10-02  6:20 Mike Frysinger
2021-10-02  6:20 Mike Frysinger
2021-10-03  4:01 Mike Frysinger
2021-10-03  4:01 Mike Frysinger
2021-10-03  4:01 Mike Frysinger
2021-10-03  4:01 Mike Frysinger
2021-10-03  4:01 Mike Frysinger
2021-10-03  4:01 Mike Frysinger
2021-10-03  4:01 Mike Frysinger
2021-10-05  1:14 Mike Frysinger
2021-10-05  1:14 Mike Frysinger
2021-10-08 12:22 Mike Frysinger
2022-01-17 23:13 Andreas K. Hüttel
2022-01-27 20:28 Sam James
2023-04-25  3:43 Sam James
2023-04-25  3:43 Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox