Re: [gentoo-dev] [PATCH] latex-package.eclass: Support EAPI 6.

2016-01-27 Thread Alexis Ballier
On Wed, 27 Jan 2016 20:59:21 +0100
Ulrich Mueller  wrote:

> Please find below a patch which will enable EAPI 6 support in
> latex-package.eclass. The main change is that it won't inherit base
> any more.
> 
> Ulrich


lgtm, thanks



[gentoo-dev] [PATCH] latex-package.eclass: Support EAPI 6.

2016-01-27 Thread Ulrich Mueller
[Re-sent, with good GPG signature this time.]

Please find below a patch which will enable EAPI 6 support in
latex-package.eclass. The main change is that it won't inherit base
any more.

Ulrich


From 990fce89a3ec1a462399089541b67bbcc6baff87 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ulrich=20M=C3=BCller?= 
Date: Wed, 27 Jan 2016 17:15:23 +0100
Subject: [PATCH] latex-package.eclass: Support EAPI 6.

Don't inherit base.eclass in EAPI 6.

Don't define SRC_URI and S (which was the default).

Convert latex-package_has_tetex_3() to a dummy function for backwards
compatibility and remove its documentation.

Add some die commands.
---
 eclass/latex-package.eclass | 40 
 1 file changed, 16 insertions(+), 24 deletions(-)

diff --git a/eclass/latex-package.eclass b/eclass/latex-package.eclass
index 0acfcc9..f0228d5 100644
--- a/eclass/latex-package.eclass
+++ b/eclass/latex-package.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -51,16 +51,18 @@
 # you must either grab each file individually, or find a place to mirror an
 # archive of them.  (iBiblio)
 #
-# It inherits base.
+# It inherits base in EAPI 5 and earlier.
 
-inherit base
+case ${EAPI:-0} in
+   0|1|2|3|4|5) inherit base ;;
+   6) ;;
+   *) die "Unknown EAPI ${EAPI} for ${ECLASS}" ;;
+esac
 
 RDEPEND="virtual/latex-base"
 DEPEND="${RDEPEND}
>=sys-apps/texinfo-4.2-r5"
 HOMEPAGE="http://www.tug.org/";
-SRC_URI="ftp://tug.ctan.org/macros/latex/";
-S=${WORKDIR}/${P}
 TEXMF="/usr/share/texmf-site"
 
 # @ECLASS-VARIABLE: SUPPLIER
@@ -69,18 +71,12 @@ TEXMF="/usr/share/texmf-site"
 # DESCRIPTION above)
 SUPPLIER="misc"
 
-# @FUNCTION: latex-package_has_tetex3
-# @RETURN: true if at least one of (>=tetex-3 or >=ptex-3.1.8 or 
>=texlive-core-2007) is installed, else false
-# @DESCRIPTION:
-# It is often used to know if the current TeX installation supports gentoo's
-# texmf-update or if the package has to do it the old way
-latex-package_has_tetex_3() {
-   if has_version '>=app-text/tetex-3' || has_version 
'>=app-text/ptex-3.1.8' || has_version '>=app-text/texlive-core-2007' ; then
-   true
-   else
-   false
-   fi
-}
+case ${EAPI:-0} in
+   0|1|2|3|4|5)
+   # Kept for backwards compatibility
+   latex-package_has_tetex_3() { true; }
+   ;;
+esac
 
 # @FUNCTION: latex-package_src_doinstall
 # @USAGE: [ module ]
@@ -130,7 +126,7 @@ latex-package_src_doinstall() {
for i in `find . -maxdepth 1 -type f -name 
"*.${1}"`
do
einfo "Making documentation: $i"
-   texi2dvi -q -c --language=latex $i &> 
/dev/null
+   texi2dvi -q -c --language=latex $i &> 
/dev/null || die
done
;;
"tfm" | "vf" | "afm")
@@ -190,7 +186,7 @@ latex-package_src_compile() {
for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"`
do
einfo "Extracting from $i"
-   latex --interaction=batchmode $i &> /dev/null
+   latex --interaction=batchmode $i &> /dev/null || die
done
 }
 
@@ -228,11 +224,7 @@ latex-package_pkg_postrm() {
 # Rehashes the kpathsea database, according to the current TeX installation
 latex-package_rehash() {
debug-print function $FUNCNAME $*
-   if latex-package_has_tetex_3 ; then
-   texmf-update
-   else
-   texconfig rehash
-   fi
+   texmf-update
 }
 
 EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm
-- 
2.7.0


pgp9oB7KNLOUG.pgp
Description: PGP signature


[gentoo-dev] [PATCH] latex-package.eclass: Support EAPI 6.

2016-01-27 Thread Ulrich Mueller
Please find below a patch which will enable EAPI 6 support in
latex-package.eclass. The main change is that it won't inherit base
any more.

Ulrich


From 990fce89a3ec1a462399089541b67bbcc6baff87 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ulrich=20M=C3=BCller?= 
Date: Wed, 27 Jan 2016 17:15:23 +0100
Subject: [PATCH] latex-package.eclass: Support EAPI 6.

Don't inherit base.eclass in EAPI 6.

Don't define SRC_URI and S (which was the default).

Convert latex-package_has_tetex_3() to a dummy function for backwards
compatibility and remove its documentation.

Add some die commands.
---
 eclass/latex-package.eclass | 40 
 1 file changed, 16 insertions(+), 24 deletions(-)

diff --git a/eclass/latex-package.eclass b/eclass/latex-package.eclass
index 0acfcc9..f0228d5 100644
--- a/eclass/latex-package.eclass
+++ b/eclass/latex-package.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -51,16 +51,18 @@
 # you must either grab each file individually, or find a place to mirror an
 # archive of them.  (iBiblio)
 #
-# It inherits base.
+# It inherits base in EAPI 5 and earlier.
 
-inherit base
+case ${EAPI:-0} in
+   0|1|2|3|4|5) inherit base ;;
+   6) ;;
+   *) die "Unknown EAPI ${EAPI} for ${ECLASS}" ;;
+esac
 
 RDEPEND="virtual/latex-base"
 DEPEND="${RDEPEND}
>=sys-apps/texinfo-4.2-r5"
 HOMEPAGE="http://www.tug.org/";
-SRC_URI="ftp://tug.ctan.org/macros/latex/";
-S=${WORKDIR}/${P}
 TEXMF="/usr/share/texmf-site"
 
 # @ECLASS-VARIABLE: SUPPLIER
@@ -69,18 +71,12 @@ TEXMF="/usr/share/texmf-site"
 # DESCRIPTION above)
 SUPPLIER="misc"
 
-# @FUNCTION: latex-package_has_tetex3
-# @RETURN: true if at least one of (>=tetex-3 or >=ptex-3.1.8 or 
>=texlive-core-2007) is installed, else false
-# @DESCRIPTION:
-# It is often used to know if the current TeX installation supports gentoo's
-# texmf-update or if the package has to do it the old way
-latex-package_has_tetex_3() {
-   if has_version '>=app-text/tetex-3' || has_version 
'>=app-text/ptex-3.1.8' || has_version '>=app-text/texlive-core-2007' ; then
-   true
-   else
-   false
-   fi
-}
+case ${EAPI:-0} in
+   0|1|2|3|4|5)
+   # Kept for backwards compatibility
+   latex-package_has_tetex_3() { true; }
+   ;;
+esac
 
 # @FUNCTION: latex-package_src_doinstall
 # @USAGE: [ module ]
@@ -130,7 +126,7 @@ latex-package_src_doinstall() {
for i in `find . -maxdepth 1 -type f -name 
"*.${1}"`
do
einfo "Making documentation: $i"
-   texi2dvi -q -c --language=latex $i &> 
/dev/null
+   texi2dvi -q -c --language=latex $i &> 
/dev/null || die
done
;;
"tfm" | "vf" | "afm")
@@ -190,7 +186,7 @@ latex-package_src_compile() {
for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"`
do
einfo "Extracting from $i"
-   latex --interaction=batchmode $i &> /dev/null
+   latex --interaction=batchmode $i &> /dev/null || die
done
 }
 
@@ -228,11 +224,7 @@ latex-package_pkg_postrm() {
 # Rehashes the kpathsea database, according to the current TeX installation
 latex-package_rehash() {
debug-print function $FUNCNAME $*
-   if latex-package_has_tetex_3 ; then
-   texmf-update
-   else
-   texconfig rehash
-   fi
+   texmf-update
 }
 
 EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm
-- 
2.7.0


pgpU26MS6n6DP.pgp
Description: PGP signature


pgpqqWAgpVbE0.pgp
Description: PGP signature


[gentoo-dev] Re: Is it safe to do umask +rx in eselect globally?

2016-01-27 Thread Ulrich Mueller
> This came up in bug 572348. Question, especially to maintainers of
> eselect modules, is it safe to globally set "umask +rx" in eselect,
> or are there any circumstances where files should be created with
> more restrictive permissions when root's umask asks for it?

No reply, therefore this is in git now:
https://gitweb.gentoo.org/proj/eselect.git/commit/?id=366064aa7478a3f8bee31d37e8b1076649264455

Ulrich


pgpNbFjzZudiM.pgp
Description: PGP signature


Re: [gentoo-dev] New schema language for metadata validation?

2016-01-27 Thread Michael Orlitzky
On 01/27/2016 10:28 AM, Dirkjan Ochtman wrote:
> 
>> Therefore, I'd suggest we just ship properly hand-written XML Schema,
>> with some nice comments. I don't see a reason to ship any RELAX-NG
>> files unless we actually have tools that support only that.
> 
> I'd be curious what Michael, Ulrich, and others think.
> 

I'm ambivalent, I gave up my emotional attachment to XML back when HTML
jumped the shark. Being able to type-check a document is important, but
XSD/RNG are a means to an end and I could put up with either one.




Re: [gentoo-dev] New schema language for metadata validation?

2016-01-27 Thread Dirkjan Ochtman
On Wed, Jan 27, 2016 at 4:43 PM, Michał Górny  wrote:
> Yes, that part makes some sense. Except that it immediately follows
> braces which makes me think it applies only to the thing in the braces.
> Furthermore, the use of {} vs () seems pretty much random, and the &
> is completely unclear what it could mean (I'm not reading the docs
> here!). I look at it and I wonder if that forces some ordering or not,
> if it supports interspersing or not. And finally, the fact that '*'
> follows closing brace on the other end of file does not help
> readability.

A full expression runs from a keyword to the closing brace (e.g.
"element  { }"). Parentheses are only used to group expressions
that have the infix operators (one of "," for concatenate -- e.g.,
order --, "|" -- alternative -- and "&" -- interleaving), because
there's no implicit precedence order. Yes, the quantizer comes at the
end. On the other hand, you could rewrite the large expression to be a
named pattern, and then put the quantization after the pattern name if
you prefer that style. That would probably make more sense for large
named patterns. :)

Cheers,

Dirkjan



Re: [gentoo-dev] New schema language for metadata validation?

2016-01-27 Thread Michael Orlitzky
On 01/27/2016 09:49 AM, Dirkjan Ochtman wrote:
> 
> Can I ask what your interest is?
> 

An easy, automated way to make sure that I didn't screw up the file
before I commit it. For personal use, it can hit the network, but I was
also considering a pre-commit hook that would need to look locally (but
could be a more complicated beast).






Re: [gentoo-dev] New schema language for metadata validation?

2016-01-27 Thread Ulrich Mueller
> On Wed, 27 Jan 2016, Michał Górny wrote:

> Do we use the  variant anywhere? If not, I suggest we
> drop it since it's completely unclear to me and only pollutes the
> schema.

+1

Here is the commit (from 2003) that had introduced the packages
element:
https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/xml/htdocs/dtd/metadata.dtd?revision=1.4&view=markup

Ulrich


pgp8jFhxDkjTj.pgp
Description: PGP signature


Re: [gentoo-dev] New schema language for metadata validation?

2016-01-27 Thread Michał Górny
On Tue, 26 Jan 2016 20:52:09 +0100
Dirkjan Ochtman  wrote:

> TL;DR: I think we should switch from DTD to RELAX NG (compact syntax,
> ideally) for our XML validation needs. It is more expressive and more
> readable.

Oh, one more thing.

Do we use the  variant anywhere? If not, I suggest we drop
it since it's completely unclear to me and only pollutes the schema.

-- 
Best regards,
Michał Górny



pgp5kreUsSg63.pgp
Description: OpenPGP digital signature


Re: [gentoo-dev] New schema language for metadata validation?

2016-01-27 Thread Michał Górny
On Wed, 27 Jan 2016 16:28:13 +0100
Dirkjan Ochtman  wrote:

> On Wed, Jan 27, 2016 at 4:20 PM, Michał Górny  wrote:
> > First of all, I don't like RELAX-NG Compact at all. It looks like
> > someone tried hard to combine some variation of BNF, DOCTYPE
> > and something else in order to get something that is both readable
> > and compact. And got a result that doesn't meet either criteria.
> > It looks like some terrible mixture of over-verbose descriptive text
> > format with a lot of enigmatic symbols that are not even clear what
> > they apply to.  
> 
> Wow, that's surprising to me! I found that a lot of the compact syntax
> made immediate sense to me as I was already familiar with what ?*+
> mean from EBNF and regular expressions. For me, it's mostly how much
> less verbose it is than a full XML syntax that makes it easier to
> comprehend and manipulate.

Yes, that part makes some sense. Except that it immediately follows
braces which makes me think it applies only to the thing in the braces.
Furthermore, the use of {} vs () seems pretty much random, and the &
is completely unclear what it could mean (I'm not reading the docs
here!). I look at it and I wonder if that forces some ordering or not,
if it supports interspersing or not. And finally, the fact that '*'
follows closing brace on the other end of file does not help
readability.

> > Secondly, RELAX-NG and XML Schema look pretty similar in volume.
> > However, XML Schema looks definitely more readable, robust and XML-ish
> > (and doesn't use camelcase!). Furthermore, as far as I'm aware XML
> > Schema is more widely supported (not sure if that applies to any tools
> > we're considering).  
> 
> I agree that XML Schema is probably more widely supported, though it'd
> be hard to assess by how much. On other hand, I find XML Schema much
> less readable; and it feels like "more XML-ish" is just because it
> uses namespaces a lot more, and is more commonly used? Indeed, to me
> the fact that RELAX NG is less XML-ish is a positive aspect.

When you use XML, use XML. If you don't want XML, don't use XML. Don't
try to make non-XML out of XML.

-- 
Best regards,
Michał Górny



pgptU0cl6GLyn.pgp
Description: OpenPGP digital signature


Re: [gentoo-dev] New schema language for metadata validation?

2016-01-27 Thread Dirkjan Ochtman
On Wed, Jan 27, 2016 at 4:20 PM, Michał Górny  wrote:
> First of all, I don't like RELAX-NG Compact at all. It looks like
> someone tried hard to combine some variation of BNF, DOCTYPE
> and something else in order to get something that is both readable
> and compact. And got a result that doesn't meet either criteria.
> It looks like some terrible mixture of over-verbose descriptive text
> format with a lot of enigmatic symbols that are not even clear what
> they apply to.

Wow, that's surprising to me! I found that a lot of the compact syntax
made immediate sense to me as I was already familiar with what ?*+
mean from EBNF and regular expressions. For me, it's mostly how much
less verbose it is than a full XML syntax that makes it easier to
comprehend and manipulate.

> Secondly, RELAX-NG and XML Schema look pretty similar in volume.
> However, XML Schema looks definitely more readable, robust and XML-ish
> (and doesn't use camelcase!). Furthermore, as far as I'm aware XML
> Schema is more widely supported (not sure if that applies to any tools
> we're considering).

I agree that XML Schema is probably more widely supported, though it'd
be hard to assess by how much. On other hand, I find XML Schema much
less readable; and it feels like "more XML-ish" is just because it
uses namespaces a lot more, and is more commonly used? Indeed, to me
the fact that RELAX NG is less XML-ish is a positive aspect.

> Therefore, I'd suggest we just ship properly hand-written XML Schema,
> with some nice comments. I don't see a reason to ship any RELAX-NG
> files unless we actually have tools that support only that.

I'd be curious what Michael, Ulrich, and others think.

Cheers,

Dirkjan



Re: [gentoo-dev] New schema language for metadata validation?

2016-01-27 Thread Ulrich Mueller
> On Wed, 27 Jan 2016, Michał Górny wrote:

> First of all, I don't like RELAX-NG Compact at all. It looks like
> someone tried hard to combine some variation of BNF, DOCTYPE and
> something else in order to get something that is both readable and
> compact. And got a result that doesn't meet either criteria. It
> looks like some terrible mixture of over-verbose descriptive text
> format with a lot of enigmatic symbols that are not even clear what
> they apply to.

> Secondly, RELAX-NG and XML Schema look pretty similar in volume.
> However, XML Schema looks definitely more readable, robust and
> XML-ish (and doesn't use camelcase!). Furthermore, as far as I'm
> aware XML Schema is more widely supported (not sure if that applies
> to any tools we're considering).

> Therefore, I'd suggest we just ship properly hand-written XML
> Schema, with some nice comments. I don't see a reason to ship any
> RELAX-NG files unless we actually have tools that support only that.

Emacs nXML mode supports only RNC. Do we have a tool (i.e. a package
in the tree) for automatic conversion from XML Schema to RNC?

Ulrich


pgp7lsFJ1f_Mq.pgp
Description: PGP signature


Re: [gentoo-dev] New schema language for metadata validation?

2016-01-27 Thread Michał Górny
On Wed, 27 Jan 2016 14:39:02 +0100
Dirkjan Ochtman  wrote:

> On Wed, Jan 27, 2016 at 1:09 PM, Michał Górny  wrote:
> > Could you post a generated .rng and XML Schema files for comparison?
> > They don't have to be perfect conversions, just to see how different
> > they are.  
> 
> Here's the RNG, generated with dev-python/rnc2rng:
> 
> https://raw.githubusercontent.com/djc/gentoo-data-dtd/metadata-rnc/metadata.rng
> 
> The best way to convert from RELAX NG to XML Schema seems to be with
> trang; I downloaded an older binary and a JDK on my laptop, but
> couldn't easily get it to run. I don't really have a Gentoo machine on
> which I want to install the whole Java shebang, so maybe someone else
> can run a quick conversion?

Thanks to you and to ulm for the XML Schema conversion. Now my points.

First of all, I don't like RELAX-NG Compact at all. It looks like
someone tried hard to combine some variation of BNF, DOCTYPE
and something else in order to get something that is both readable
and compact. And got a result that doesn't meet either criteria.
It looks like some terrible mixture of over-verbose descriptive text
format with a lot of enigmatic symbols that are not even clear what
they apply to.

Secondly, RELAX-NG and XML Schema look pretty similar in volume.
However, XML Schema looks definitely more readable, robust and XML-ish
(and doesn't use camelcase!). Furthermore, as far as I'm aware XML
Schema is more widely supported (not sure if that applies to any tools
we're considering).

Therefore, I'd suggest we just ship properly hand-written XML Schema,
with some nice comments. I don't see a reason to ship any RELAX-NG
files unless we actually have tools that support only that.

-- 
Best regards,
Michał Górny



pgpXBZwVlwbd_.pgp
Description: OpenPGP digital signature


Re: [gentoo-dev] New schema language for metadata validation?

2016-01-27 Thread Ulrich Mueller
> On Wed, 27 Jan 2016, Dirkjan Ochtman wrote:

> Here's the RNG, generated with dev-python/rnc2rng:

> https://raw.githubusercontent.com/djc/gentoo-data-dtd/metadata-rnc/metadata.rng

> The best way to convert from RELAX NG to XML Schema seems to be with
> trang; I downloaded an older binary and a JDK on my laptop, but
> couldn't easily get it to run. I don't really have a Gentoo machine on
> which I want to install the whole Java shebang, so maybe someone else
> can run a quick conversion?

Voila: http://dev.gentoo.org/~ulm/metadata.xsd

This was generated with:
$ trang -I rng -O xsd 
https://raw.githubusercontent.com/djc/gentoo-data-dtd/metadata-rnc/metadata.rng 
metadata.xsd

Ulrich


pgpMhNwpf9lYu.pgp
Description: PGP signature


Re: [gentoo-dev] New schema language for metadata validation?

2016-01-27 Thread Dirkjan Ochtman
On Wed, Jan 27, 2016 at 3:21 PM, Michael Orlitzky  wrote:
>> But libxml2 does not seem to support it; that is, substituting the
>> DOCTYPE for an xml-model processing instruction and then using xmllint
>> --valid does not do the right thing (it complains there's no DOCTYPE).
>
> But does it /complain/ about the xml-model? Is it safe to add that to
> our XML files (in terms of tooling and stability of the spec)? If so, I
> can at least script the validation: parse the href from xml-model, fetch
> it somehow, run it through rnc2rng, and then pass it to xmllint.

It does not seem to complain about the xml-model, so that should be
quite viable.

Can I ask what your interest is? What tools are you involved with that
would want to use this?

> Or we could even generate the rng files automatically and host them like
> we do the DTDs to skip a step.

Yeah, that's what I was thinking. Too bad that we have to drag around
both, but I think the advantages in terms of readability and
modifiability for RNC and tool support for RNG really do make it the
best solution to have canonical RNCs with pre-generated RNGs.

Cheers,

Dirkjan



Re: [gentoo-dev] Re: News item: Upgrading Apache from 2.2 to 2.4

2016-01-27 Thread Kristian Fiskerstrand
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On 01/27/2016 03:17 PM, Dirkjan Ochtman wrote:
> On Fri, Jan 22, 2016 at 3:20 PM, Kristian Fiskerstrand
>  wrote:
>> Advanced notice, please
> 
> Committed 2016-01-27-upgrading-to-apache-2_4 to news.
> 
> Time to request stabilization?

I'm not aware of any formal policy on it, but from perspective of a
sysadmin I'd say anything starting a week from now should be fine.

(Although my normal maintenance window this week is affected by FOSDEM
unless there are security critical patches.. but at least gives time
to get the news :) )

- -- 
Kristian Fiskerstrand
Public PGP key 0xE3EDFAE3 at hkp://pool.sks-keyservers.net
fpr:94CB AFDD 3034 5109 5618 35AA 0B7F 8B60 E3ED FAE3
-BEGIN PGP SIGNATURE-

iQEcBAEBCgAGBQJWqNK5AAoJECULev7WN52FrlkH/1jlyemX/mCwwQ6YWpLOFMp6
0srq7x2qjEW8SDl8osd6tNv9foN6zzbiSerlVjXCx5qCzQkYdw67+YmYvedzrwg3
Gp6xuu9A4OvYH9Yh3Xn1kcLFcnwstUotSJJ0E/ct8BQMgQRAZI4gabo8EmrqPeHX
MNMOOF10z0ABXugxYWAgK0nFhy6IKF9nPmxCGzObGlg+oZIAa4lreb2nprb8D1WC
WjSr0GZxX4hQRxxKnwYRvT+gSFzIhLzu+EAq5VWKdETR9ali7fNNfDbj1fE00OEM
4vCS3JEF7ob1KwVEgWqLTcpgxuFBJPqk6vFaS0IPlMYCUjEtXeiTMtIU32cq1bw=
=2XWG
-END PGP SIGNATURE-



Re: [gentoo-dev] New schema language for metadata validation?

2016-01-27 Thread Michael Orlitzky
On 01/27/2016 04:22 AM, Dirkjan Ochtman wrote:
> On Tue, Jan 26, 2016 at 9:52 PM, Michael Orlitzky  wrote:
>> I would appreciate examples of some common tasks like validating
>> projects.xml, but since we don't have those now, it's not critical.
>> This used to be kinda straightforward with xmllint,
>>
>>   $ xmllint --valid --noout projects.xml && echo "OK"
> 
> The closest equivalent for this is just:
> 
> xmllint --relaxng metadata.rng --noout metadata.xml && echo "OK"
> 

Ok, so basically the same situation we have now. You have to figure out
where to get the rng and supply it manually...


> I.e., you have to specify the schema file manually (also, as mentioned
> before, libxml2 does not support RNC natively, so you have to convert
> to RNG first -- but we can keep those around). You can use a non-HTTPS
> URL for --relaxng, as well.
> 
> There is a standard to link an XML file to a RELAX NG (XML or compact
> syntax) schema, here:
> 
> http://www.w3.org/TR/xml-model/

Nice! I was looking for this.


> But libxml2 does not seem to support it; that is, substituting the
> DOCTYPE for an xml-model processing instruction and then using xmllint
> --valid does not do the right thing (it complains there's no DOCTYPE).

But does it /complain/ about the xml-model? Is it safe to add that to
our XML files (in terms of tooling and stability of the spec)? If so, I
can at least script the validation: parse the href from xml-model, fetch
it somehow, run it through rnc2rng, and then pass it to xmllint.

Or we could even generate the rng files automatically and host them like
we do the DTDs to skip a step.




Re: [gentoo-dev] Re: News item: Upgrading Apache from 2.2 to 2.4

2016-01-27 Thread Dirkjan Ochtman
On Fri, Jan 22, 2016 at 3:20 PM, Kristian Fiskerstrand  wrote:
> Advanced notice, please

Committed 2016-01-27-upgrading-to-apache-2_4 to news.

Time to request stabilization?

Cheers,

Dirkjan



Re: [gentoo-dev] New schema language for metadata validation?

2016-01-27 Thread Brian Dolbec
On Wed, 27 Jan 2016 14:39:02 +0100
Dirkjan Ochtman  wrote:

> On Wed, Jan 27, 2016 at 1:09 PM, Michał Górny 
> wrote:
> > Could you post a generated .rng and XML Schema files for comparison?
> > They don't have to be perfect conversions, just to see how different
> > they are.  
> 
> Here's the RNG, generated with dev-python/rnc2rng:
> 
> https://raw.githubusercontent.com/djc/gentoo-data-dtd/metadata-rnc/metadata.rng
> 
> The best way to convert from RELAX NG to XML Schema seems to be with
> trang; I downloaded an older binary and a JDK on my laptop, but
> couldn't easily get it to run. I don't really have a Gentoo machine on
> which I want to install the whole Java shebang, so maybe someone else
> can run a quick conversion?
> 
> Cheers,
> 
> Dirkjan
> 

that looks very easy to read and modify.

-- 
Brian Dolbec 




Re: [gentoo-dev] New schema language for metadata validation?

2016-01-27 Thread Dirkjan Ochtman
On Wed, Jan 27, 2016 at 1:09 PM, Michał Górny  wrote:
> Could you post a generated .rng and XML Schema files for comparison?
> They don't have to be perfect conversions, just to see how different
> they are.

Here's the RNG, generated with dev-python/rnc2rng:

https://raw.githubusercontent.com/djc/gentoo-data-dtd/metadata-rnc/metadata.rng

The best way to convert from RELAX NG to XML Schema seems to be with
trang; I downloaded an older binary and a JDK on my laptop, but
couldn't easily get it to run. I don't really have a Gentoo machine on
which I want to install the whole Java shebang, so maybe someone else
can run a quick conversion?

Cheers,

Dirkjan



Re: [gentoo-dev] New schema language for metadata validation?

2016-01-27 Thread Michał Górny
On Tue, 26 Jan 2016 20:52:09 +0100
Dirkjan Ochtman  wrote:

> All,
> 
> TL;DR: I think we should switch from DTD to RELAX NG (compact syntax,
> ideally) for our XML validation needs. It is more expressive and more
> readable.
> 
> Most people who know anything about XML stuff know that DTDs are not
> that great a solution for validation. Their expression power is very
> limited; there are a few examples of this is in our metadata.dtd [1].
> For a few years now, I've wanted to see if we could replace
> metadata.dtd with something in RELAX NG, which is a more modern XML
> schema language; it's an ISO standard with an emphasis on readability
> both for humans and for tools (by using a rigorous formalism). Some
> arguments in favor of RELAX NG (and some counter-arguments) are
> enumerated on Tim Bray's weblog [2]. I've created a compact syntax
> schema for metadata that can validate all metadata.xml files currently
> in the tree, as an example [3].
> 
> Some arguments against:
> 
> - Not enough tool support for RELAX NG: I'd be curious to hear what
> tools you want to use. At least libxml2 supports RELAX NG natively.
> The Python lxml library uses that support to provide pretty simple
> RELAX NG validation. libxml2 does not have native compact syntax
> support, but I maintain a simple library called rnc2rng [4] that is
> used transparently by lxml if installed. rnc2rng also comes with a
> rnc2rng command-line script to do the conversion.
> 
> - Performance: in a quick test with lxml (backed by libxml2), RELAX NG
> validation takes very similar time compared to DTD. Testing with
> ~19000 metadata.xml files in the tree, with DTD (best of 3):
> 
> real0m2.861s
> user0m2.560s
> sys0m0.296s
> 
> With RNC (best of 3):
> 
> real0m3.058s
> user0m2.688s
> sys0m0.364s
> 
> We could probably easily maintain an XML Schema shadow schema if
> that's really desired, but I would be in favor of making RELAX NG our
> main schema language. I can easily do the work to update repoman for
> this (I've already refactored the metadata code in repoman). What
> other stuff would need to be updated?
> 
> Comments?

Could you post a generated .rng and XML Schema files for comparison?
They don't have to be perfect conversions, just to see how different
they are.

-- 
Best regards,
Michał Górny



pgp0qWpv8SyPi.pgp
Description: OpenPGP digital signature


Re: [gentoo-dev] New schema language for metadata validation?

2016-01-27 Thread Dirkjan Ochtman
On Tue, Jan 26, 2016 at 9:52 PM, Michael Orlitzky  wrote:
> I would appreciate examples of some common tasks like validating
> projects.xml, but since we don't have those now, it's not critical.
> This used to be kinda straightforward with xmllint,
>
>   $ xmllint --valid --noout projects.xml && echo "OK"

The closest equivalent for this is just:

xmllint --relaxng metadata.rng --noout metadata.xml && echo "OK"

I.e., you have to specify the schema file manually (also, as mentioned
before, libxml2 does not support RNC natively, so you have to convert
to RNG first -- but we can keep those around). You can use a non-HTTPS
URL for --relaxng, as well.

There is a standard to link an XML file to a RELAX NG (XML or compact
syntax) schema, here:

http://www.w3.org/TR/xml-model/

But libxml2 does not seem to support it; that is, substituting the
DOCTYPE for an xml-model processing instruction and then using xmllint
--valid does not do the right thing (it complains there's no DOCTYPE).

Cheers,

Dirkjan