summaryrefslogtreecommitdiff
blob: 831e860e464cd71335a0ce014b59c68cc3fc9dec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="5"

inherit versionator sgml-catalog

MY_PV=$(replace_version_separator 2 '+')
MY_PV=${MY_PV/p/nmu}

DESCRIPTION="XML catalog infrastructure support"
HOMEPAGE="http://packages.debian.org/xml-core"
SRC_URI="mirror://debian/pool/main/x/${PN}/${PN}_${MY_PV}.tar.gz"

LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

RDEPEND="dev-libs/libxml2
	dev-libs/sgml-data"

S="${WORKDIR}/${PN}-${MY_PV}"

sgml-catalog_cat_include "/etc/sgml/${P}.cat" \
	"/usr/share/sgml/dtd/xml-core/catalog"

src_install() {
	# Note: we don't install update-xmlcatalog or its debhelper
	# because it conflicts with xmlcatalog in libxml2 and xmlcatalog
	# already provides the necessary functionality
	dodir /etc/sgml /etc/xml
	insinto /usr/share/sgml/dtd/${PN}
	doins schemas/{catalog,catalog.dtd}
	insinto /usr/share/xml/schema/${PN}
	doins schemas/catalog.xml
	insinto /usr/share/lintian/overrides
	doins debian/lintian-overrides/xml-core
	dodoc debian/{TODO,changelog}
}

pkg_postinst() {
	einfo "Creating package XML catalog"
	"${EPREFIX}"/usr/bin/xmlcatalog --noout --create /etc/xml/${PN}
	einfo "Adding entries to root XML catalog and package XML catalog"
	"${EPREFIX}"/usr/bin/xmlcatalog --noout --add "system" \
		"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd" \
		"${EPREFIX}"/etc/xml/${PN} /etc/xml/catalog
	"${EPREFIX}"/usr/bin/xmlcatalog --noout --add "system" \
		"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd" \
		"${EPREFIX}"/usr/share/xml/schema/xml-core/catalog.xml /etc/xml/${PN}

	"${EPREFIX}"/usr/bin/xmlcatalog --noout --add "public" \
		"-//OASIS//DTD XML Catalogs V1.0//EN" \
		"${EPREFIX}"/etc/xml/${PN} /etc/xml/catalog
	"${EPREFIX}"/usr/bin/xmlcatalog --noout --add "public" \
		"-//OASIS//DTD XML Catalogs V1.0//EN" \
		"${EPREFIX}"/usr/share/xml/schema/xml-core/catalog.xml /etc/xml/${PN}

	"${EPREFIX}"/usr/bin/xmlcatalog --noout --add "system" \
		"http://globaltranscorp.org/oasis/catalog/xml/tr9401.dtd" \
		"${EPREFIX}"/etc/xml/${PN} /etc/xml/catalog
	"${EPREFIX}"/usr/bin/xmlcatalog --noout --add "system" \
		"http://globaltranscorp.org/oasis/catalog/xml/tr9401.dtd" \
		"${EPREFIX}"/usr/share/xml/schema/xml-core/catalog.xml /etc/xml/${PN}

	"${EPREFIX}"/usr/bin/xmlcatalog --noout --add "public" \
		"-//GlobalTransCorp//DTD XML Catalogs V1.0-Based Extension V1.0//EN" \
		"${EPREFIX}"/etc/xml/${PN} /etc/xml/catalog
	"${EPREFIX}"/usr/bin/xmlcatalog --noout --add "public" \
		"-//GlobalTransCorp//DTD XML Catalogs V1.0-Based Extension V1.0//EN" \
		"${EPREFIX}"/usr/share/xml/schema/xml-core/catalog.xml /etc/xml/${PN}
	sgml-catalog_pkg_postinst
}

pkg_postrm() {
	einfo "Removing entries from the root XML catalog"
	"${EPREFIX}"/usr/bin/xmlcatalog --noout --del \
		"${EPREFIX}"/etc/xml/${PN} /etc/xml/catalog
	einfo "Removing the package XML catalog"
	if [ -e /etc/xml/${PN} ]; then
		rm /etc/xml/${PN}
	fi
	sgml-catalog_pkg_postrm
}