Пример #1
0
 def _internal_load_key(self, path, key):
     key = self._metadata_rewrites.get(key, key)
     if key == "contents":
         data = ContentsFile(pjoin(path, "CONTENTS"), mutable=True)
     elif key == "environment":
         fp = pjoin(path, key)
         if not os.path.exists(fp + ".bz2"):
             if not os.path.exists(fp):
                 # icky.
                 raise KeyError("environment: no environment file found")
             data = data_source.local_source(fp)
         else:
             data = data_source.bz2_source(fp + ".bz2")
     elif key == "ebuild":
         fp = pjoin(path,
                    os.path.basename(path.rstrip(os.path.sep)) + ".ebuild")
         data = data_source.local_source(fp)
     elif key == 'repo':
         # try both, for portage/paludis compatibility.
         data = readfile(pjoin(path, 'repository'), True)
         if data is None:
             data = readfile(pjoin(path, 'REPOSITORY'), True)
             if data is None:
                 raise KeyError(key)
     else:
         data = readfile(pjoin(path, key), True)
         if data is None:
             raise KeyError((path, key))
     return data
Пример #2
0
 def _internal_load_key(self, path, key):
     key = self._metadata_rewrites.get(key, key)
     if key == "contents":
         data = ContentsFile(pjoin(path, "CONTENTS"), mutable=True)
     elif key == "environment":
         fp = pjoin(path, key)
         if not os.path.exists(fp + ".bz2"):
             if not os.path.exists(fp):
                 # icky.
                 raise KeyError("environment: no environment file found")
             data = data_source.local_source(fp)
         else:
             data = data_source.bz2_source(fp + ".bz2")
     elif key == "ebuild":
         fp = pjoin(path, os.path.basename(path.rstrip(os.path.sep)) + ".ebuild")
         data = data_source.local_source(fp)
     elif key == 'repo':
         # try both, for portage/paludis compatibility.
         data = readfile(pjoin(path, 'repository'), True)
         if data is None:
             data = readfile(pjoin(path, 'REPOSITORY'), True)
             if data is None:
                 raise KeyError(key)
     else:
         data = readfile(pjoin(path, key), True)
         if data is None:
             raise KeyError((path, key))
     return data
Пример #3
0
    def pms_repo_name(self):
        """Repository name from profiles/repo_name (as defined by PMS).

        We're more lenient than the spec and don't verify it conforms to the
        specified format.
        """
        name = readfile(pjoin(self.profiles_base, 'repo_name'), none_on_missing=True)
        if name is not None:
            name = name.split('\n', 1)[0].strip()
        return name