Пример #1
0
 def full_name_cmp(clazz, pi1, pi2):
     'Compare name, version and revision and return an int either -1, 0, or 1'
     check.check_package_descriptor(pi1)
     check.check_package_descriptor(pi2)
     name_cmp = cmp(pi1.name, pi2.name)
     if name_cmp != 0:
         return name_cmp
     return build_version.compare(pi1.version, pi2.version)
Пример #2
0
 def _install_package(self, pm, desc, bt):
     if check.is_string(desc):
         desc = PD.parse(desc)
     check.check_package_descriptor(desc)
     if check.is_string(bt):
         bt = BT.parse_path(bt)
     check.check_build_target(bt)
     pm.install_package(desc, bt, ['RUN'])
Пример #3
0
 def add_package(self, pdesc):
     check.check_package_descriptor(pdesc)
     self.log_i('add_package(%s)' % (str(pdesc)))
     name = pdesc.name
     if name in self._descriptor_map:
         raise ValueError('package \"%s\" already added.' % (name))
     self._descriptor_map[name] = pdesc
     tool_reqs = pdesc.requirements.filter_by_hardness(['TOOL'])
     self._is_tool_set |= set(tool_reqs.names())
Пример #4
0
 def artifact_path(self, pkg_desc, build_target, relative):
     check.check_package_descriptor(pkg_desc)
     check.check_build_target(build_target)
     artifact_path_rel, artifact_path_abs = self._artifact_paths(
         pkg_desc, build_target)
     if not path.isfile(artifact_path_abs):
         return None
     if relative:
         return artifact_path_rel
     return artifact_path_abs
Пример #5
0
 def install_package(self,
                     pkg_desc,
                     build_target,
                     hardness,
                     allow_downgrade=False,
                     force_install=False):
     check.check_package_descriptor(pkg_desc)
     result = self._install_package(pkg_desc, build_target, hardness,
                                    allow_downgrade, force_install)
     return result
Пример #6
0
 def find_by_package_descriptor(self, pdesc, build_target, relative_filename):
   check.check_package_descriptor(pdesc)
   check.check_build_target(build_target)
   self.log_i('by_package_descriptor(pdesc=%s, build_target=%s, relative_filename=%s)' % (str(pdesc),
                                                                                          build_target.build_path,
                                                                                          relative_filename))
   adesc = artifact_descriptor(pdesc.name, pdesc.version.upstream_version,
                               pdesc.version.revision, pdesc.version.epoch,
                               build_target.system, build_target.level, build_target.arch,
                               build_target.distro, build_target.distro_version)
   return self.find_by_artifact_descriptor(adesc, relative_filename)
Пример #7
0
 def __lt__(self, other):
     check.check_package_descriptor(other)
     name_rv = cmp(self.name, other.name)
     if name_rv < 0:
         return True
     version_rv = build_version.compare(self.version, other.version)
     if version_rv < 0:
         return True
     requirements_rv = cmp(self.requirements, other.requirements)
     if requirements_rv < 0:
         return True
     if self.properties.keys() < other.properties.keys():
         return True
     return False
Пример #8
0
 def __eq__(self, other):
     check.check_package_descriptor(other)
     return self.__dict__ == other.__dict__
Пример #9
0
 def _checksum_dir(self, pd, level):
     check.check_package_descriptor(pd)
     check.check(level, build_target)
     return path.join(self._root_dir, level.build_path, pd.full_name)