commit:     65a031f4c9d702c4fc8b6ce6b0541453a6db8c08
Author:     Raul E Rangel <rrangel <AT> chromium <DOT> org>
AuthorDate: Mon Apr  3 17:28:49 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Apr  4 04:48:47 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=65a031f4

sgml-catalog-r1.eclass: Strip ROOT when generating catalog

When cross compiling by setting the ROOT variable, the eclass was
writing the full EROOT path into the catalog file. This results in an
invalid path at runtime.

i.e.,
    $ cat /build/amd64-host/etc/sgml/catalog
    CATALOG "/build/amd64-host/etc/sgml/sgml-docbook.cat"
    CATALOG "/build/amd64-host/etc/sgml/sgml-ent.cat"
    CATALOG "/build/amd64-host/etc/sgml/xml-docbook-4.1.2.cat"

Instead we should be stripping off the ROOT so we get a valid path:

    $ cat /build/amd64-host/etc/sgml/catalog
    CATALOG "/etc/sgml/sgml-docbook.cat"
    CATALOG "/etc/sgml/sgml-ent.cat"
    CATALOG "/etc/sgml/xml-docbook-4.1.2.cat"

We don't strip EROOT because we want to keep the prefix if it's
present.

Closes: https://bugs.gentoo.org/903747
Signed-off-by: Raul E Rangel <rrangel <AT> chromium.org>
Closes: https://github.com/gentoo/gentoo/pull/30462
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/sgml-catalog-r1.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/sgml-catalog-r1.eclass b/eclass/sgml-catalog-r1.eclass
index 2258b3e2bf0f..eff6db31062f 100644
--- a/eclass/sgml-catalog-r1.eclass
+++ b/eclass/sgml-catalog-r1.eclass
@@ -35,7 +35,7 @@ sgml-catalog-r1_update_catalog() {
 
        if [[ ${#cats[@]} -gt 0 ]]; then
                ebegin "Updating ${EROOT}/etc/sgml/catalog"
-               printf 'CATALOG "%s"\n' "${cats[@]}" > "${T}"/catalog &&
+               printf 'CATALOG "%s"\n' "${cats[@]#${ROOT}}" > "${T}"/catalog &&
                mv "${T}"/catalog "${EROOT}"/etc/sgml/catalog
                eend "${?}"
        else

Reply via email to