diff options
-rwxr-xr-x | merge-gitosis-conf-into-repositories-xml.py | 9 | ||||
-rw-r--r-- | samples/repositories.xml | 2 | ||||
-rw-r--r-- | schema/repositories.dtd | 7 | ||||
-rw-r--r-- | schema/repositories.rng | 6 | ||||
-rwxr-xr-x | write-layman-global-txt.py | 7 | ||||
-rwxr-xr-x | write-repositories-xml.py | 14 |
6 files changed, 29 insertions, 16 deletions
diff --git a/merge-gitosis-conf-into-repositories-xml.py b/merge-gitosis-conf-into-repositories-xml.py index 5c5f8d1..06010ff 100755 --- a/merge-gitosis-conf-into-repositories-xml.py +++ b/merge-gitosis-conf-into-repositories-xml.py @@ -17,7 +17,7 @@ gitosis_conf.read('gitosis.conf') a = ET.parse(open('repositories.xml')) repositories = a.getroot() -overlays_gentoo_org_dict = dict([[e.attrib['name'], e] for e in repositories]) +overlays_gentoo_org_dict = dict([[e.find('name').text, e] for e in repositories]) for section_name in gitosis_conf.sections(): if section_name.startswith('repo '): @@ -50,9 +50,12 @@ for section_name in gitosis_conf.sections(): else: print 'Adding %s' % repo_name _description = gitosis_conf.get(section_name, 'description') - repo = ET.Element('repo', name=repo_name, status='official') + repo = ET.Element('repo', status='official') repositories.append(repo) + name = ET.Element('name') + name.text = repo_name + homepage = ET.Element('homepage') homepage.text = 'http://git.overlays.gentoo.org/gitweb/?p=%s.git;a=summary' % _repo_base @@ -69,7 +72,7 @@ for section_name in gitosis_conf.sections(): owner_email.text = _owner_match.group(2) owner[:] = [owner_email, owner_name] - repo[:] = [description, homepage, owner] + repo[:] = [name, description, homepage, owner] source_uris = ( 'git://git.overlays.gentoo.org/%s.git' % _repo_base, diff --git a/samples/repositories.xml b/samples/repositories.xml index a45c0b3..7b90078 100644 --- a/samples/repositories.xml +++ b/samples/repositories.xml @@ -1,8 +1,8 @@ <repositories version="1.0"> <repo - name="sping" quality="experimental" status="unofficial"> + <name>sping</name> <description lang="en">Gentoo overlay of Sebastian Pipping</description> <description lang="de">Gentoo-Overlay von Sebastian Pipping</description> <longdescription lang="en"> diff --git a/schema/repositories.dtd b/schema/repositories.dtd index e16564e..4a3703f 100644 --- a/schema/repositories.dtd +++ b/schema/repositories.dtd @@ -15,14 +15,17 @@ xmlns CDATA #FIXED '' version CDATA #FIXED '1.0'> -<!ELEMENT repo ((description)+,(longdescription)*,(homepage)?,owner,(source)+,(feed)*)> +<!ELEMENT repo (name,(description)+,(longdescription)*,(homepage)?,owner,(source)+,(feed)*)> <!ATTLIST repo xmlns CDATA #FIXED '' - name CDATA #REQUIRED priority CDATA #IMPLIED quality (core|stable|testing|experimental|graveyard) #IMPLIED status (official|unofficial) #IMPLIED> +<!ELEMENT name (#PCDATA)> +<!ATTLIST name + xmlns CDATA #FIXED ''> + <!ELEMENT description (#PCDATA)> <!ATTLIST description xmlns CDATA #FIXED '' diff --git a/schema/repositories.rng b/schema/repositories.rng index f35b486..f75c4eb 100644 --- a/schema/repositories.rng +++ b/schema/repositories.rng @@ -19,9 +19,6 @@ </attribute> <zeroOrMore> <element name="repo"> - <attribute name="name"> - <text/> - </attribute> <optional> <attribute name="priority"> <data type="integer"/> @@ -46,6 +43,9 @@ </choice> </attribute> </optional> + <element name="name"> + <text/> + </element> <oneOrMore> <element name="description"> <optional> diff --git a/write-layman-global-txt.py b/write-layman-global-txt.py index b18481e..bba6a7f 100755 --- a/write-layman-global-txt.py +++ b/write-layman-global-txt.py @@ -9,8 +9,6 @@ a = ET.parse(open('repositories.xml')) repositories = a.getroot() for repo in repositories: - repo_name = repo.attrib['name'] - # Transform 'repo' tag repo.tag = 'overlay' @@ -52,6 +50,11 @@ for repo in repositories: del description.attrib['lang'] descriptions_kept = descriptions_kept + 1 + # Transform 'name' tag + name = repo.find('name') + repo.attrib['name'] = name.text + repo.remove(name) + # Kill unsupported tags for tag_name in ('feed', 'source', 'longdescription'): for o in repo.findall(tag_name): diff --git a/write-repositories-xml.py b/write-repositories-xml.py index 0bea5c5..6961d19 100755 --- a/write-repositories-xml.py +++ b/write-repositories-xml.py @@ -31,19 +31,23 @@ for overlay in overlays: repo_name = overlay.attrib['name'] extra_data = TRANSITION_DATA_EXTRA.get(repo_name, {}) + # Move 'description' tag + description = overlay.find('description') + overlay.remove(description) + overlay.insert(0, description) + # Transform 'overlay' tag overlay.tag = 'repo' + del overlay.attrib['name'] + name = ET.Element('name') + name.text = repo_name + overlay.insert(0, name) # Transform 'link' tag link = overlay.find('link') if link != None: link.tag = 'homepage' - # Move 'description' tag - description = overlay.find('description') - overlay.remove(description) - overlay.insert(0, description) - # Transform 'contact' attribute owner = ET.Element('owner') overlay.append(owner) |