Exemplo n.º 1
0
    def is_equal(self, other):
        """
        Return true if the other version is equal to version in this dep.

        :paramtype other: string
        """
        return self.parsed_version == parse_epoch_version(other)
Exemplo n.º 2
0
    def is_lower(self, other):
        """
        Return true if version in this dep is lower than the other version.

        :paramtype other: string
        """
        return self.parsed_version < parse_epoch_version(other)
Exemplo n.º 3
0
    def is_lower(self, other):
        """
        Return true if version in this dep is lower than the other version.

        :paramtype other: string
        """
        return self.parsed_version < parse_epoch_version(other)
Exemplo n.º 4
0
    def is_equal(self, other):
        """
        Return true if the other version is equal to version in this dep.

        :paramtype other: string
        """
        return self.parsed_version == parse_epoch_version(other)
Exemplo n.º 5
0
def dependency_filter(type, queryset, value):
    m = models.Dependency.DEPENDENCY_PARSER.match(value)
    if not m:
        raise FieldError('Unrecognized value for filter for {}'.format(type))

    groups = m.groupdict()
    name = groups['name']
    op = groups['op']
    version = groups['version']

    queryset = queryset.filter(dependency__name=name,
                               dependency__type=type).distinct()

    if not version:
        return queryset

    version = parse_epoch_version(version)
    matches = dependency_predicate(op, version)
    deps = models.Dependency.objects.filter(type=type, name=name)

    for dep in deps:
        dep_version = dep.parsed_version
        if dep_version is not None and not matches(dep.comparison,
                                                   dep_version):
            queryset = queryset.exclude(pk=dep.rpm_id)

    return queryset
Exemplo n.º 6
0
    def is_satisfied_by(self, other):
        """
        Check if other version satisfies this dependency.

        :paramtype other: string
        """
        funcs = {
            '=': lambda x: x == self.parsed_version,
            '<': lambda x: x < self.parsed_version,
            '<=': lambda x: x <= self.parsed_version,
            '>': lambda x: x > self.parsed_version,
            '>=': lambda x: x >= self.parsed_version,
        }
        return funcs[self.comparison](parse_epoch_version(other))
Exemplo n.º 7
0
    def is_satisfied_by(self, other):
        """
        Check if other version satisfies this dependency.

        :paramtype other: string
        """
        funcs = {
            '=': lambda x: x == self.parsed_version,
            '<': lambda x: x < self.parsed_version,
            '<=': lambda x: x <= self.parsed_version,
            '>': lambda x: x > self.parsed_version,
            '>=': lambda x: x >= self.parsed_version,
        }
        return funcs[self.comparison](parse_epoch_version(other))
Exemplo n.º 8
0
 def parsed_version(self):
     if not hasattr(self, '_version'):
         self._version = parse_epoch_version(self.version)
     return self._version
Exemplo n.º 9
0
 def sort_key(self):
     return (self.epoch, parse_epoch_version(self.version), parse_epoch_version(self.release))
Exemplo n.º 10
0
 def parsed_version(self):
     if not hasattr(self, '_version'):
         self._version = parse_epoch_version(self.version)
     return self._version
Exemplo n.º 11
0
 def sort_key(self):
     return (self.epoch, parse_epoch_version(self.version), parse_epoch_version(self.release))