diff options
author | Sebastian Pipping <sebastian@pipping.org> | 2010-04-11 17:33:57 +0200 |
---|---|---|
committer | Sebastian Pipping <sebastian@pipping.org> | 2010-04-11 17:33:57 +0200 |
commit | 20fe7304d7d44dd1a6b6c0838dbcfe7231fa9594 (patch) | |
tree | 0e29b44d2b0df8482877a2b1ece548d19c523206 | |
parent | Move library files to layman/dbtools/ (diff) | |
download | repositories-xml-format-20fe7304d7d44dd1a6b6c0838dbcfe7231fa9594.tar.gz repositories-xml-format-20fe7304d7d44dd1a6b6c0838dbcfe7231fa9594.tar.bz2 repositories-xml-format-20fe7304d7d44dd1a6b6c0838dbcfe7231fa9594.zip |
gitosis.conf differ: make it work with user overlays, introduce repo_name mapping
-rwxr-xr-x | diff-gitosis-conf-against-repositories-xml.py | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/diff-gitosis-conf-against-repositories-xml.py b/diff-gitosis-conf-against-repositories-xml.py index 38f7181..4152485 100755 --- a/diff-gitosis-conf-against-repositories-xml.py +++ b/diff-gitosis-conf-against-repositories-xml.py @@ -27,6 +27,17 @@ import re from layman.dbtools.sharedutils import * # local +# From gitosis.conf +# ..to repositories.xml +repo_name_mapping = { + 'ruby-overlay':'ruby', + 'sci':'science', + 'perl-overlay':'perl-experimental', + 'xfce':'xfce-dev', + 'steev':'steev-stable', +} + + def sort_as_in(elements, tag_order): order_map = dict((v, i) for i, v in enumerate(tag_order)) deco = (t for t in enumerate(elements)) @@ -34,17 +45,17 @@ def sort_as_in(elements, tag_order): return list(v for _, v in deco_sorted) class ChangeLog: - def __init__(self, repo_name, is_new): + def __init__(self, gitosis_repo_name, is_new): self.empty = True - self.repo_name = repo_name + self.gitosis_repo_name = gitosis_repo_name self.is_new = is_new def log(self, kind, details): if self.empty: if self.is_new: - print 'Repo "%s" missing completely' % self.repo_name + print 'Repo "%s" missing completely' % self.gitosis_repo_name else: - print 'Analyzing repo "%s":' % self.repo_name + print 'Analyzing repo "%s":' % self.gitosis_repo_name self.empty = False if not self.is_new: @@ -91,41 +102,46 @@ def is_public(section_name): for section_name in gitosis_conf.sections(): if section_name.startswith('repo '): _repo_base = section_name[len('repo '):].strip() - if _repo_base.startswith('dev/'): - repo_name = _repo_base[len('dev/'):].strip() - if repo_name == 'steev': - repo_name = 'steev-stable' - owner_type = "person" - elif _repo_base.startswith('proj/'): - repo_name = _repo_base[len('proj/'):].strip() + + try: + owner_type, gitosis_repo_name = _repo_base.split('/') + except (ValueError) as e: + # TODO print NOT_AN_OVERLAY_MESSAGE % gitosis_repo_name + continue + + if owner_type == 'proj': owner_type = "project" + elif owner_type in ('dev', 'user'): + owner_type = "person" else: - # TODO print NOT_AN_OVERLAY_MESSAGE % repo_name + # TODO print NOT_AN_OVERLAY_MESSAGE % gitosis_repo_name continue _description = gitosis_conf.get(section_name, 'description') if not gitosis_conf.has_option(section_name, 'gentoo-is-overlay') or \ not gitosis_conf.getboolean(section_name, 'gentoo-is-overlay'): - if not _description.lower().endswith('overlay'): - # TODO print NOT_AN_OVERLAY_MESSAGE % repo_name + if not gitosis_repo_name.endswith('overlay') \ + and not _description.lower().endswith('overlay'): + # TODO print NOT_AN_OVERLAY_MESSAGE % gitosis_repo_name continue if not is_public(section_name): - # TODO print 'Skipping %s (not public)' % repo_name + # TODO print 'Skipping %s (not public)' % gitosis_repo_name continue - is_new = repo_name not in overlays_gentoo_org_dict + repositores_xml_repo_name = repo_name_mapping.get(gitosis_repo_name, gitosis_repo_name) + is_new = repositores_xml_repo_name not in overlays_gentoo_org_dict if is_new: if opts.fixes_only: continue repo = ET.Element('repo') repositories.append(repo) name = ET.Element('name') - name.text = repo_name + name.text = gitosis_repo_name repo.append(name) else: - repo = overlays_gentoo_org_dict[repo_name] - log = ChangeLog(repo_name, is_new) + repo = overlays_gentoo_org_dict[repositores_xml_repo_name] + log = ChangeLog(gitosis_repo_name, is_new) if 'status' not in repo.attrib: repo.attrib['status'] = 'official' |