Beispiel #1
0
    def _collect_known_mirror_urls(self):
        sync_file = SyncFile(MIRRORS_3_XML, 'mirrors3.xml')

        # Parse, retry atfer re-sync if errors
        try:
            for retry in (2, 1, 0):
                file = open(sync_file.path(), 'r')
                content = file.read()
                file.close()
                try:
                    parser = MirrorParser3()
                    parser.parse(content)
                except ExpatError:
                    if retry > 0:
                        logging.info('Re-syncing %s due to parse errors' %
                                     sync_file.path())
                        sync_file.sync()
                    else:
                        return set()
        except IOError:
            return set()

        known_mirror_urls = [_normalize_url(e) for e in parser.uris()]
        extra_mirror_urls = [_normalize_url(e) for e in \
            _EXTRA_DISTFILES_MIRRORS_WHITELIST]
        return set(known_mirror_urls + extra_mirror_urls)
Beispiel #2
0
    def _get_known_overlay_map(self):
        sync_file = SyncFile(
                'http://www.gentoo.org/proj/en/overlays/layman-global.txt',
                'layman-global.txt')

        # Parse, retry atfer re-sync if errors
        try:
            for retry in (2, 1, 0):
                try:
                    return self._parse_overlay_meta(sync_file.path())
                except ExpatError:
                    if retry > 0:
                        logging.info('Re-syncing %s due to parse errors' % sync_file.path())
                        sync_file.sync()
        except IOError:
            pass
        return {}
Beispiel #3
0
    def _get_known_overlay_map(self):
        sync_file = SyncFile(
            'http://www.gentoo.org/proj/en/overlays/layman-global.txt',
            'layman-global.txt')

        # Parse, retry atfer re-sync if errors
        try:
            for retry in (2, 1, 0):
                try:
                    return self._parse_overlay_meta(sync_file.path())
                except ExpatError:
                    if retry > 0:
                        logging.info('Re-syncing %s due to parse errors' %
                                     sync_file.path())
                        sync_file.sync()
        except IOError:
            pass
        return {}
Beispiel #4
0
    def _collect_known_mirror_urls(self):
        sync_file = SyncFile(MIRRORS_3_XML, "mirrors3.xml")

        # Parse, retry atfer re-sync if errors
        try:
            for retry in (2, 1, 0):
                file = open(sync_file.path(), "r")
                content = file.read()
                file.close()
                try:
                    parser = MirrorParser3()
                    parser.parse(content)
                except ExpatError:
                    if retry > 0:
                        logging.info("Re-syncing %s due to parse errors" % sync_file.path())
                        sync_file.sync()
                    else:
                        return set()
        except IOError:
            return set()

        known_mirror_urls = [_normalize_url(e) for e in parser.uris()]
        extra_mirror_urls = [_normalize_url(e) for e in _EXTRA_DISTFILES_MIRRORS_WHITELIST]
        return set(known_mirror_urls + extra_mirror_urls)