コード例 #1
0
ファイル: overlays.py プロジェクト: DocOnDev/mythtv
 def __init__(self):
     self._publish = Gate().grants('gentoo', 'repositories')
     self._fill_overlays()
     tree_config = config()
     tree_config['PORTDIR_OVERLAY'] = ' '.join(self._get_active_paths())
     tree_config['PORTDIR'] = main_tree_dir()
     self._dbapi = portdbapi(main_tree_dir(), tree_config)
コード例 #2
0
ファイル: overlays.py プロジェクト: DocOnDev/mythtv
 def __init__(self):
     self._publish = Gate().grants('gentoo', 'repositories')
     self._fill_overlays()
     tree_config = config()
     tree_config['PORTDIR_OVERLAY'] = ' '.join(self._get_active_paths())
     tree_config['PORTDIR'] = main_tree_dir()
     self._dbapi = portdbapi(main_tree_dir(), tree_config)
コード例 #3
0
ファイル: systemprofile.py プロジェクト: DocOnDev/mythtv
 def _collect_known_profiles(self):
     # TODO extract to parser class?
     f = open('%s/profiles/profiles.desc' % main_tree_dir(), 'r')
     subst_pattern = re.compile('^[^ #]+\s+(\S+)\s+\S+\s*$')
     lines = [re.sub(subst_pattern, '\\1', l) for l in
             f.readlines() if re.match(subst_pattern, l)]
     f.close()
     return set(lines)
コード例 #4
0
ファイル: systemprofile.py プロジェクト: DocOnDev/mythtv
 def _collect_known_profiles(self):
     # TODO extract to parser class?
     f = open('%s/profiles/profiles.desc' % main_tree_dir(), 'r')
     subst_pattern = re.compile('^[^ #]+\s+(\S+)\s+\S+\s*$')
     lines = [
         re.sub(subst_pattern, '\\1', l) for l in f.readlines()
         if re.match(subst_pattern, l)
     ]
     f.close()
     return set(lines)
コード例 #5
0
ファイル: globaluseflags.py プロジェクト: DocOnDev/mythtv
 def _registered_global_use_flags(self):
     global_line_sub = re.compile('^([^ ]+) - .*\\n')
     global_line_filter = re.compile('^[^ ]+ - ')
     try:
         f = open(os.path.join(main_tree_dir(), 'profiles', 'use.desc'), 'r')
         lines = [global_line_sub.sub('\\1', l) for l in
                 f.readlines() if global_line_filter.match(l)]
         f.close()
         return set(lines)
     except IOError:
         return set()
コード例 #6
0
ファイル: overlays.py プロジェクト: DocOnDev/mythtv
    def _fill_overlays(self):
        self._global_overlays_dict = self._get_known_overlay_map()
        enabled_installed_overlays = \
                portage.settings['PORTDIR_OVERLAY'].split(' ')

        def overlay_name(overlay_location):
            repo_name_file = os.path.join(overlay_location, REPO_NAME_LOC)
            file = open(repo_name_file, 'r')
            name = file.readline().strip()
            file.close()
            return name

        def is_non_private(overlay_location):
            try:
                name = overlay_name(overlay_location)
            except:
                return False

            # TODO improve
            return name in ('g-ctan', ) or \
                    (name in self._global_overlays_dict)

        def fix_repo_name(repo_name):
            try:
                return _REPO_NAME_RENAME_MAP[repo_name]
            except KeyError:
                return repo_name

        non_private_active_overlay_paths = [
            e for e in enabled_installed_overlays if is_non_private(e)
        ]
        non_private_active_overlay_names = [fix_repo_name(overlay_name(e)) \
                for e in non_private_active_overlay_paths]

        # Dirty hack to get the main tree's name in, too
        main_tree_name = fix_repo_name(overlay_name(main_tree_dir()))
        enabled_installed_overlays.append(main_tree_name)
        if not self.is_private_overlay_name(main_tree_name):
            non_private_active_overlay_names.append(main_tree_name)

        self._active_overlay_paths = non_private_active_overlay_paths
        if self._publish:
            self._active_overlay_names = non_private_active_overlay_names
            self._repo_count_non_private = len(
                non_private_active_overlay_names)
            self._repo_count_private = len(enabled_installed_overlays) - \
                    self._repo_count_non_private
        else:
            self._active_overlay_names = []
            self._repo_count_non_private = 0
            self._repo_count_private = 0
コード例 #7
0
ファイル: globaluseflags.py プロジェクト: DocOnDev/mythtv
 def _registered_global_use_flags(self):
     global_line_sub = re.compile('^([^ ]+) - .*\\n')
     global_line_filter = re.compile('^[^ ]+ - ')
     try:
         f = open(os.path.join(main_tree_dir(), 'profiles', 'use.desc'),
                  'r')
         lines = [
             global_line_sub.sub('\\1', l) for l in f.readlines()
             if global_line_filter.match(l)
         ]
         f.close()
         return set(lines)
     except IOError:
         return set()
コード例 #8
0
ファイル: overlays.py プロジェクト: DocOnDev/mythtv
    def _fill_overlays(self):
        self._global_overlays_dict = self._get_known_overlay_map()
        enabled_installed_overlays = \
                portage.settings['PORTDIR_OVERLAY'].split(' ')

        def overlay_name(overlay_location):
            repo_name_file = os.path.join(overlay_location, REPO_NAME_LOC)
            file = open(repo_name_file, 'r')
            name = file.readline().strip()
            file.close()
            return name

        def is_non_private(overlay_location):
            try:
                name = overlay_name(overlay_location)
            except:
                return False

            # TODO improve
            return name in ('g-ctan', ) or \
                    (name in self._global_overlays_dict)

        def fix_repo_name(repo_name):
            try:
                return _REPO_NAME_RENAME_MAP[repo_name]
            except KeyError:
                return repo_name

        non_private_active_overlay_paths = [e for e in
                enabled_installed_overlays if is_non_private(e)]
        non_private_active_overlay_names = [fix_repo_name(overlay_name(e)) \
                for e in non_private_active_overlay_paths]

        # Dirty hack to get the main tree's name in, too
        main_tree_name = fix_repo_name(overlay_name(main_tree_dir()))
        enabled_installed_overlays.append(main_tree_name)
        if not self.is_private_overlay_name(main_tree_name):
            non_private_active_overlay_names.append(main_tree_name)

        self._active_overlay_paths = non_private_active_overlay_paths
        if self._publish:
            self._active_overlay_names = non_private_active_overlay_names
            self._repo_count_non_private = len(non_private_active_overlay_names)
            self._repo_count_private = len(enabled_installed_overlays) - \
                    self._repo_count_non_private
        else:
            self._active_overlay_names = []
            self._repo_count_non_private = 0
            self._repo_count_private = 0
コード例 #9
0
ファイル: globaluseflags.py プロジェクト: DocOnDev/mythtv
 def _expanded_use_flags(self):
     use_flags = []
     expand_desc_dir = os.path.join(main_tree_dir(), 'profiles', 'desc')
     try:
         expand_list = os.listdir(expand_desc_dir)
     except OSError:
         pass
     else:
         for desc_filename in expand_list:
             if not desc_filename.endswith('.desc'):
                 continue
             use_prefix = desc_filename[:-5].lower() + '_'
             for line in portage.grabfile(
                     os.path.join(expand_desc_dir, desc_filename)):
                 x = line.split()
                 if x:
                     use_flags.append(use_prefix + x[0])
     return set(use_flags)
コード例 #10
0
ファイル: globaluseflags.py プロジェクト: DocOnDev/mythtv
 def _expanded_use_flags(self):
     use_flags = []
     expand_desc_dir = os.path.join(main_tree_dir(), 'profiles', 'desc')
     try:
         expand_list = os.listdir(expand_desc_dir)
     except OSError:
         pass
     else:
         for desc_filename in expand_list:
             if not desc_filename.endswith('.desc'):
                 continue
             use_prefix = desc_filename[:-5].lower() + '_'
             for line in portage.grabfile(os.path.join(
                     expand_desc_dir, desc_filename)):
                 x = line.split()
                 if x:
                     use_flags.append(use_prefix + x[0])
     return set(use_flags)
コード例 #11
0
ファイル: globaluseflags.py プロジェクト: DocOnDev/mythtv
 def _auto_use_flags(self):
     return set(
         portage.grabfile(
             os.path.join(main_tree_dir(), 'profiles', 'arch.list')))
コード例 #12
0
ファイル: globaluseflags.py プロジェクト: DocOnDev/mythtv
 def _auto_use_flags(self):
     return set(portage.grabfile(os.path.join(main_tree_dir(), 'profiles',
         'arch.list')))