Mailinglist Archive: opensuse-factory (723 mails)

< Previous Next >
Re: [opensuse-factory] XML File for repositories
  • From: Pascal Bleser <pascal.bleser@xxxxxxxxx>
  • Date: Wed, 01 Mar 2006 09:03:34 +0100
  • Message-id: <44055556.9000704@xxxxxxxxx>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Azerion wrote:
>>> <de>
>>> <gwdg>
>>> <address>ftp.gwdg.de</address>
>>> <method>ftp,http,rsync</method>
>> Well, this is someting I did not know was possible. That creates new
>> opportunities. :-)

It's not, that's a horrible way to use XML :S

Furthermore, some servers have the same URL for ftp and http, but some don't.

Now if you're going to have 20 different ways of specifying protocols, server names and URLs, you
can stop the whole thing right now, it's going to be
- - unmaintainable
- - useless for automated processing by scripts and applications
- - a nightmare to transform to HTML, PHP, text, ...

>>> <rootfolders>
>>> <opensuse>
>>> <folder>pub/opensuse/distribution/</folder>
>>> <version>10.0<version>
>>> <dir>inst_source</dir>
>>> <dir>inst-source-java</dir>
>> We could then use: <dir>inst_source, inst-source-java</dir>
>> or do I make a mistake here?

Yes: never, ever, use separators like "," for a list of values like above.

Rather do something like this:
<directories>
<dir>inst-source</dir>
<dir>inst-source-java</dir>
</directories>

> I guess that I made some mistakes, but first of all:
> why do you want to use XML?

1) validation of grammar, using a DTD and/or an XML Schema
2) very easy to parse by scripts and applications, for processing (e.g. to validate the URLs by
making HTTP HEAD requests and such)
3) to transform it into various formats, using XSLT:
- HTML/XHTML: a static page with all the data and links
- plain text
- PHP source file: as PHP objects or arrays to make a dynamic frontend to choose a mirror
...

> the <de> and <gwdg> tags are not XML-valid I guess, so they have to be
> replaced like this (and I think the , can be solved more XML-valid too):

Indeed, <de> and <gwdg> tags are.. well.. they're valid XML but they will never be valid against our
schema (and they're very complex to parse) ;-)
And that's not how XML is supposed to be used.

> <tree>
> <country>de</country>
> <name>gwdg</name>
> <address>ftp.gwdg.de</address>
> <method>
> <m>ftp</m>
> <m>http</m>
> <m>rsync</m>
> </method>
> ...cut....
> </tree>
>
> <tree>
> <country>be</country>
> <name>skynet</name>
> ...
> </tree>

Yes, that's more like it :)

To simplify the syntax, better use attributes as well:

<mirrors>
<mirror country="de" id="gwdg" description="Gesellschaft für ...">
<admin name="Eberhard Moenkeberg" email="emoenke@xxxxxxx" />
<baseurl protocol="http" hostname="ftp.gwdg.de"
directory="http://ftp.gwdg.de/pub/opensuse/distribution/"; />
<baseurl protocol="ftp" hostname="ftp.gwdg.de"
directory="http://ftp.gwdg.de/pub/opensuse/distribution/"; />
<dist version="10.0" subdir="SL-10.0-OSS">
<repo type="core" subdir="inst-source">
<arch name="i386"/>
<arch name="ppc"/>
<arch name="x86_64"/>
<meta type="yast2" />
<meta type="rpm-md" />
</repo>
<repo type="java" subdir="inst-source-java" />
<iso type="cd" subdir="iso">
<arch name="i386" />
<arch name="ppc" />
<arch name="x86_64" />
<meta type="yast2" />
<meta type="rpm-md" />
</iso>
</dist>
<boot-iso subdir="inst-source/boot">
<arch name="i386" file="boot.iso" />
<arch name="x86_64" file="boot.iso" />
<arch name="ppc" file="boot.ppc.iso" />
</boot-iso>
</mirror>

...
</mirrors>

While it is very verbose and a lot of typing,
- - we could write a tool that does automatic exploration of URLs and that generates the XML for a
mirror
- - it has to remain flexible and extensible, because
a) some servers might have directory structures of their own
b) who knows how 10.2, 10.3, 11.0 will be structured ;)

Also keep in mind the various pages we could generate from the same XML source:
- - a static HTML page by country
- - static HTML pages by repository type (rpm-md, yast2, ...)
- - smart channel files or yum repository files
- - dynamic HTML through e.g. PHP where you choose your architecture first, then your country, etc...
- - a static HTML page for downloading the network installation boot.iso
etc...

> Too be honest...i'm fugged up now and can't think that well. Messing it all
> up :). Give me a few days and I will present a nice structure that is
> XML-valid .

I also started writing an XML Schema for it, with a sample file, but it's far from finished.
I'll post what I've got later on.

First of all, we really have to decide about
- - what data we need
- - how to structure that data, also in a way it suits XSL transformations best
- - and finally the XML grammar (XML Schema or DTD)

cheers
- --
-o) Pascal Bleser http://linux01.gwdg.de/~pbleser/
/\\ <pascal.bleser@xxxxxxxxx> <guru@xxxxxxxxxxx>
_\_v The more things change, the more they stay insane.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFEBVVWr3NMWliFcXcRAskBAJ9jWfVrmnYRjty06mRdcZB1szHSSACeKlkx
YGbbzQMQpkYoILbwrZu0Mys=
=0D+r
-----END PGP SIGNATURE-----

< Previous Next >
List Navigation
Follow Ups
References