Exemple #1
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 {}
Exemple #2
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)
Exemple #3
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)
Exemple #4
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 {}
Exemple #5
0
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

from tools.syncfile import SyncFile
from tools.overlayparser import OverlayParser
import ConfigParser
import os
import sys

layman_config = ConfigParser.ConfigParser()
layman_config.read('/etc/layman/layman.cfg')
layman_storage_path = layman_config.get('MAIN', 'storage')
if not layman_storage_path.endswith('/'):
    layman_storage_path = layman_storage_path + '/'

sync_file = SyncFile(
    'http://www.gentoo.org/proj/en/overlays/layman-global.txt',
    'layman-global.txt')
parser = OverlayParser()
file = open(sync_file.path(), 'r')
parser.parse(file.read())
file.close()

legend_printed = False
for i in parser.get().keys():
    layman_global_name = i
    overlay_folder = os.path.join(layman_storage_path, layman_global_name)
    if not os.path.exists(overlay_folder):
        sys.stderr.write('ERROR: Overlay "%s" not found\n' %
                         layman_global_name)
        continue
    filename = os.path.join(overlay_folder, 'profiles', 'repo_name')
Exemple #6
0
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

from tools.syncfile import SyncFile
from tools.overlayparser import OverlayParser
import ConfigParser
import os
import sys

layman_config = ConfigParser.ConfigParser()
layman_config.read('/etc/layman/layman.cfg')
layman_storage_path = layman_config.get('MAIN', 'storage')
if not layman_storage_path.endswith('/'):
    layman_storage_path = layman_storage_path + '/'

sync_file = SyncFile(
        'http://www.gentoo.org/proj/en/overlays/layman-global.txt',
        'layman-global.txt')
parser = OverlayParser()
file = open(sync_file.path(), 'r')
parser.parse(file.read())
file.close()

legend_printed = False
for i in parser.get().keys():
    layman_global_name = i
    overlay_folder = os.path.join(layman_storage_path, layman_global_name)
    if not os.path.exists(overlay_folder):
        sys.stderr.write('ERROR: Overlay "%s" not found\n' % layman_global_name)
        continue
    filename = os.path.join(overlay_folder, 'profiles', 'repo_name')
    if not os.path.exists(filename):