Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: XML DTD or some form of XML schema validation #200

Open
pixdrift opened this issue Jan 16, 2020 · 5 comments
Open

RFE: XML DTD or some form of XML schema validation #200

pixdrift opened this issue Jan 16, 2020 · 5 comments
Assignees

Comments

@pixdrift
Copy link

I would find it really useful to have an authoritative reference for the XML structure that is generated from the createrepo family of tools for metadata validation (that could potentially be used in CI processes to validate changes to metadata format/standard).

Examples (but not limited to):

filelists.xml
other.xml
primary.xml
repomd.xml
@Conan-Kudo
Copy link
Member

@dmach I think we've discussed this before, we should come to some kind of agreement about how we're going to do this. I think it is necessary for being able to add metadata validation to createrepo_c (which we don't currently have...).

@dralley
Copy link
Contributor

dralley commented Feb 25, 2021

Yes, this would be great.

@Conan-Kudo
Copy link
Member

We do have a repo with some files collected on theoretical schemas for this: https://pagure.io/rpm-metadata

We need to figure out an official schema to replace those.

@dralley
Copy link
Contributor

dralley commented Mar 11, 2021

Slight sidenote, there's a couple of metadata features that createrepo_c supports that aren't covered by the test fixtures (though I'm sure they work fine).

repomd.xml

  • <repo>, <contenthash>, <distro cpeid=..> tags
  • some types of compression, I think xz but I forgot to write it down

filelists.xml

  • files of type "ghost"

Having a single small-ish test fixture that covers all of the features at once would be helpful. I may see what I can do in that area since I'm working on a related side project.

@pixdrift
Copy link
Author

pixdrift commented Apr 15, 2021

After some digging I found the originals from Duke University on archive.org, they are fairly basic though.

https://web.archive.org/web/20070705102649/http://linux.duke.edu/projects/metadata/dtd/

Examples:
primary.dtd

<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT package (name, arch, version, checksum+, summary, description,
                   packager, size, url, location, format)>
<!ATTLIST package type CDATA #REQUIRED>
<!ELEMENT name (#PCDATA)>
<!ELEMENT arch (#PCDATA)>
<!ELEMENT version (#PCDATA)>
<!ATTLIST version epoch CDATA #REQUIRED
                  ver CDATA #REQUIRED
                  rel CDATA #REQUIRED>
<!ELEMENT checksum (#PCDATA)>
<!ATTLIST checksum type CDATA #REQUIRED
                   pkgid CDATA #REQUIRED>
<!ELEMENT summary (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT packager (#PCDATA)>
<!ELEMENT size EMPTY>
<!ATTLIST size package CDATA #REQUIRED
               installed CDATA #REQUIRED
               archive CDATA #IMPLIED>
<!ELEMENT url (#PCDATA)>
<!ELEMENT location EMPTY>
<!ATTLIST location xml:base CDATA #REQUIRED
                   href CDATA #REQUIRED>
<!ELEMENT format EMPTY>
<!ELEMENT file (#PCDATA)>
<!ATTLIST file type CDATA #IMPLIED>

repomd.dtd

<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT repository (name*, contact*, description*, key*, metadata)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT contact (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT key (#PCDATA)>
<!ATTLIST key type CDATA #REQUIRED>
<!ELEMENT metadata (data+)>
<!ELEMENT data (#PCDATA)>
<!ATTLIST data type CDATA #REQUIRED
               timestamp CDATA #REQUIRED
               href CDATA #REQUIRED
               xml:base CDATA #IMPLIED>

filelists.dtd

<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT package (file*, version)>
<!ATTLIST package pkgid CDATA #REQUIRED
		  name CDATA #REQUIRED
		  arch CDATA #REQUIRED>
<!ELEMENT version (#PCDATA)>
<!ATTLIST version epoch CDATA #REQUIRED
                  ver CDATA #REQUIRED
                  rel CDATA #REQUIRED>
<!ELEMENT file (#PCDATA)>
<!ATTLIST file type CDATA #IMPLIED>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants