SGML catalog generation fixes
cover SGML catalog generation fixes
From: Scott Garman <[email protected]>
Hi Saul,
This pull request improves the way the SGML catalog files are generated in the native sysroot. Richard helped out with the addition of SSTATEPOSTINSTFUNCS when we realized there was no way to dynamically run a post-install script when doing a build from sstate cache.
I believe this should fix bug #748.
Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: sgarman/sgml-catalog-fixes
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=sgarman/sgml-catalog-fixes
Thanks,
Scott Garman <[email protected]>
---
Scott Garman (4):
sstate.bbclass: add SSTATEPOSTINSTFUNCS docbook-sgml-dtd-native.inc: run install-catalog from
SSTATEPOSTINSTFUNCS
docbook-dsssl-stylesheets-native: run install-catalog from
SSTATEPOSTINSTFUNCS
openjade-native: run install-catalog from SSTATEPOSTINSTFUNCS
meta/classes/sstate.bbclass | 8 +++++ .../docbook-dsssl-stylesheets-native_1.79.bb | 30 ++++++++------------ .../docbook-sgml-dtd/docbook-sgml-dtd-native.inc | 26 ++++++---------- .../openjade/openjade-native_1.3.2.bb | 17 ++++++++--- 4 files changed, 42 insertions(+), 39 deletions(-)
PATCH 1/4 sstate.bbclass: add SSTATEPOSTINSTFUNCS
From: Scott Garman <[email protected]>
When doing builds using sstate cache, there was no way to run the equivalent of a pkg_postinst function. This is needed by the SGML-related documentation recipes to properly update the catalog files when new DTDs and stylesheets are installed.
SSTATEPOSTINSTFUNCS is a new variable you can set to function(s) in your recipe to run after install is completed from sstate.
Thanks to Richard Purdie for suggesting this solution.
--- meta/classes/sstate.bbclass | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
meta/classes/sstate.bbclass +8 -0
@@ -16,6 +16,8 @@ BB_HASHFILENAME = "${SSTATE_PKGNAME}" SSTATE_MANMACH ?= "${SSTATE_PKGARCH}" +SSTATEPOSTINSTFUNCS ?= "" + python () { if bb.data.inherits_class('native', d): bb.data.setVar('SSTATE_PKGARCH', bb.data.getVar('BUILD_ARCH', d), d)
@@ -129,6 +131,12 @@ def sstate_install(ss, d): f.write(di + "\n") f.close() + # This is used for running post-install functions for sstate packages + # which need to generate dynamic data. Various SGML-related recipes + # need this to update the super catalog correctly. + for postinst in (bb.data.getVar('SSTATEPOSTINSTFUNCS', d, True) or '').split(): + bb.build.exec_func(postinst, d) + for lock in locks: bb.utils.unlockfile(lock)
Signature · 1 line
1.7.1
PATCH 2/4 docbook-sgml-dtd-native.inc: run install-catalog from SSTATEPOSTINSTFUNCS
In reply to Scott GarmanFrom: Scott Garman <[email protected]>
Otherwise the sgml-docbook.cat catalog would not be updated when a build from sstate cache is run.
--- .../docbook-sgml-dtd/docbook-sgml-dtd-native.inc | 26 +++++++------------ 1 files changed, 10 insertions(+), 16 deletions(-)
meta/recipes-devtools/docbook-sgml-dtd/docbook-sgml-dtd-native.inc +10 -16
@@ -20,9 +20,9 @@ SRC_URI = "http://www.docbook.org/sgml/${DTD_VERSION}/docbook-${DTD_VERSION}.zip # The .zip file extracts to the current dir S = "${WORKDIR}" -INC_PR = "r0" +INC_PR = "r1" -SYSROOT_PREPROCESS_FUNCS += "docbook_sgml_dtd_native_mangle" +SSTATEPOSTINSTFUNCS += "docbook_sgml_dtd_sstate_postinst" inherit native
@@ -33,21 +33,15 @@ do_install () { install docbook.cat ${D}${datadir}/sgml/docbook/sgml-dtd-${DTD_VERSION}/catalog cp -PpRr *.dtd *.mod *.dcl ${D}${datadir}/sgml/docbook/sgml-dtd-${DTD_VERSION} - install-catalog \ - --add ${sysconfdir}/sgml/sgml-docbook-dtd-${DTD_VERSION}.cat \ - ${D}${datadir}/sgml/docbook/sgml-dtd-${DTD_VERSION}/catalog - - install-catalog \ - --add ${sysconfdir}/sgml/sgml-docbook-dtd-${DTD_VERSION}.cat \ - ${sysconfdir}/sgml/sgml-docbook.cat - - # Copy the generated catalog to the image directory for staging. install -d ${D}${sysconfdir}/sgml - cp ${sysconfdir}/sgml/sgml-docbook-dtd-${DTD_VERSION}.cat ${D}${sysconfdir}/sgml/ + echo "CATALOG ${datadir}/sgml/docbook/sgml-dtd-${DTD_VERSION}/catalog" > \ + ${D}${sysconfdir}/sgml/sgml-docbook-dtd-${DTD_VERSION}.cat } -docbook_sgml_dtd_native_mangle () { - # Remove the image directory path ${D} from the .cat files. - sed -i -e "s|${D}||g" ${SYSROOT_DESTDIR}${sysconfdir}/sgml/sgml-docbook.cat || true - sed -i -e "s|${D}||g" ${SYSROOT_DESTDIR}${sysconfdir}/sgml/sgml-docbook-dtd-${DTD_VERSION}.cat +docbook_sgml_dtd_sstate_postinst () { + # Ensure that the catalog file sgml-docbook.cat is properly + # updated when the package is installed from sstate cache. + install-catalog \ + --add ${sysconfdir}/sgml/sgml-docbook.cat \ + ${sysconfdir}/sgml/sgml-docbook-dtd-${DTD_VERSION}.cat }
Signature · 1 line
1.7.1
PATCH 3/4 docbook-dsssl-stylesheets-native: run install-catalog from SSTATEPOSTINSTFUNCS
In reply to Scott GarmanFrom: Scott Garman <[email protected]>
Otherwise the sgml-docbook.cat catalog would not be updated when a build from sstate cache is run.
--- .../docbook-dsssl-stylesheets-native_1.79.bb | 30 ++++++++------------ 1 files changed, 12 insertions(+), 18 deletions(-)
meta/recipes-devtools/docbook-dsssl-stylesheets/docbook-dsssl-stylesheets-native_1.79.bb +12 -18
@@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://README;beginline=41;endline=74;md5=875385159b2ee76ecf DEPENDS = "sgml-common-native" -PR = "r1" +PR = "r2" SRC_URI = "${SOURCEFORGE_MIRROR}/docbook/docbook-dsssl-${PV}.tar.bz2"
@@ -18,7 +18,7 @@ S = "${WORKDIR}/docbook-dsssl-${PV}" inherit native -SYSROOT_PREPROCESS_FUNCS += "docbook_dssl_stylesheets_native_mangle" +SSTATEPOSTINSTFUNCS += "docbook_dsssl_stylesheets_sstate_postinst" do_install () { # Refer to http://www.linuxfromscratch.org/blfs/view/stable/pst/docbook-dsssl.html
@@ -30,23 +30,17 @@ do_install () { install -m 0644 catalog ${D}${datadir}/sgml/docbook/dsssl-stylesheets-${PV} cp -v -R * ${D}${datadir}/sgml/docbook/dsssl-stylesheets-${PV} - install-catalog --add ${sysconfdir}/sgml/dsssl-docbook-stylesheets.cat \ - ${D}${datadir}/sgml/docbook/dsssl-stylesheets-${PV}/catalog - - install-catalog --add ${sysconfdir}/sgml/dsssl-docbook-stylesheets.cat \ - ${D}${datadir}/sgml/docbook/dsssl-stylesheets-${PV}/common/catalog - - install-catalog --add ${sysconfdir}/sgml/sgml-docbook.cat \ - ${sysconfdir}/sgml/dsssl-docbook-stylesheets.cat - - # Move these to the image directory so they get staged properly. install -d ${D}${sysconfdir}/sgml - cp ${sysconfdir}/sgml/dsssl-docbook-stylesheets.cat ${D}${sysconfdir}/sgml/ - cp ${sysconfdir}/sgml/sgml-docbook.cat ${D}${sysconfdir}/sgml/ - cp ${sysconfdir}/sgml/catalog ${D}${sysconfdir}/sgml/ + echo "CATALOG ${datadir}/sgml/docbook/dsssl-stylesheets-${PV}/catalog" > \ + ${D}${sysconfdir}/sgml/dsssl-docbook-stylesheets.cat + echo "CATALOG ${datadir}/sgml/docbook/dsssl-stylesheets-${PV}/common/catalog" >> \ + ${D}${sysconfdir}/sgml/dsssl-docbook-stylesheets.cat } -docbook_dssl_stylesheets_native_mangle () { - # Remove the image directory path ${D} from the .cat file. - sed -i -e "s|${D}||g" ${SYSROOT_DESTDIR}${sysconfdir}/sgml/dsssl-docbook-stylesheets.cat +docbook_dsssl_stylesheets_sstate_postinst () { + # Ensure that the catalog file sgml-docbook.cat is properly + # updated when the package is installed from sstate cache. + install-catalog \ + --add ${sysconfdir}/sgml/sgml-docbook.cat \ + ${sysconfdir}/sgml/dsssl-docbook-stylesheets.cat }
Signature · 1 line
1.7.1
PATCH 4/4 openjade-native: run install-catalog from SSTATEPOSTINSTFUNCS
In reply to Scott GarmanFrom: Scott Garman <[email protected]>
Otherwise the sgml-docbook.cat catalog would not be updated when a build from sstate cache is run.
--- .../openjade/openjade-native_1.3.2.bb | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-)
meta/recipes-devtools/openjade/openjade-native_1.3.2.bb +12 -5
@@ -29,6 +29,8 @@ CONFIGUREOPTS := "${@d.getVar('CONFIGUREOPTS', True).replace('--datadir=${datadi CFLAGS =+ "-I${S}/include" +SSTATEPOSTINSTFUNCS += "openjade_sstate_postinst" + do_install() { # Refer to http://www.linuxfromscratch.org/blfs/view/stable/pst/openjade.html # for details.
@@ -44,13 +46,18 @@ do_install() { install -m 644 dsssl/catalog ${D}${datadir}/sgml/openjade-${PV} install -m 644 dsssl/*.{dtd,dsl,sgm} ${D}${datadir}/sgml/openjade-${PV} - # The catalog must live in the sysroot and it must be there for - # install-catalog to do its thing. install -d ${datadir}/sgml/openjade-${PV} install -m 644 dsssl/catalog ${datadir}/sgml/openjade-${PV}/catalog - install-catalog --add ${sysconfdir}/sgml/openjade-${PV}.cat \ - ${datadir}/sgml/openjade-${PV}/catalog - install-catalog --add ${sysconfdir}/sgml/sgml-docbook.cat \ + install -d ${D}${sysconfdir}/sgml + echo "CATALOG ${datadir}/sgml/openjade-${PV}/catalog" > \ + ${D}${sysconfdir}/sgml/openjade-${PV}.cat +} + +openjade_sstate_postinst() { + # Ensure that the catalog file sgml-docbook.cat is properly + # updated when the package is installed from sstate cache. + install-catalog \ + --add ${sysconfdir}/sgml/sgml-docbook.cat \ ${sysconfdir}/sgml/openjade-${PV}.cat }
Signature · 1 line
1.7.1
Re: [PATCH 1/4] sstate.bbclass: add SSTATEPOSTINSTFUNCS
In reply to Scott GarmanQuoted 11 lines · Scott Garman
From: Scott Garman <[email protected]>
When doing builds using sstate cache, there was no way to run the equivalent of a
pkg_postinstfunction. This is needed by the SGML-related documentation recipes to properly update the catalog files when new DTDs and stylesheets are installed.SSTATEPOSTINSTFUNCS is a new variable you can set to function(s) in your recipe to run after install is completed from sstate.
Thanks to Richard Purdie for suggesting this solution.
I merged this but I did drop your comments from the class. In the general class code, comments about specific use cases become inaccurate quickly and you'd usually just use grep to determine a variable's users.
Cheers,
Richard