Ejemplo n.º 1
0
class ReleasedFilesFilter(django_filters.FilterSet):
    released_date = MultiValueFilter()
    release_date = MultiValueFilter()
    zero_day_release = CaseInsensitiveBooleanFilter()
    obsolete = CaseInsensitiveBooleanFilter()
    file_primary_key = MultiIntFilter()
    repo = MultiValueFilter(name='repo__id')
    repo_name = MultiValueFilter(name='repo__name')
    release_id = MultiValueFilter(
        name='repo__variant_arch__variant__release__release_id')
    service = MultiValueFilter(name='repo__service__name')
    arch = MultiValueFilter(name='repo__variant_arch__arch__name')
    variant_uid = MultiValueFilter(
        name='repo__variant_arch__variant__variant_uid')
    release_date_after = django_filters.DateFilter(name="release_date",
                                                   lookup_type='gte')
    release_date_before = django_filters.DateFilter(name="release_date",
                                                    lookup_type='lte')
    released_date_after = django_filters.DateFilter(name="released_date",
                                                    lookup_type='gte')
    released_date_before = django_filters.DateFilter(name="released_date",
                                                     lookup_type='lte')

    class Meta:
        model = models.ReleasedFiles
        fields = ('released_date', 'release_date', 'file_primary_key',
                  'zero_day_release', 'obsolete', 'repo', 'repo_name',
                  'release_id', 'service', 'arch', 'variant_uid')
Ejemplo n.º 2
0
class ComponentBranchFilter(django_filters.FilterSet):
    name = django_filters.CharFilter(name='name', lookup_type='iexact')
    global_component = django_filters.CharFilter(name='global_component__name',
                                                 lookup_type='iexact')
    type = django_filters.CharFilter(name='type__name', lookup_type='iexact')
    active = CaseInsensitiveBooleanFilter(action=filter_active)
    critical_path = CaseInsensitiveBooleanFilter()

    class Meta:
        model = ComponentBranch
Ejemplo n.º 3
0
class SLAToComponentBranchFilter(django_filters.FilterSet):
    sla = django_filters.CharFilter(name='sla__name', lookup_type='exact')
    branch = django_filters.CharFilter(name='branch__name', lookup_type='exact')
    global_component = django_filters.CharFilter(name='branch__global_component__name', lookup_type='exact')
    branch_type = django_filters.CharFilter(name='branch__type__name', lookup_type='exact')
    branch_active = CaseInsensitiveBooleanFilter(name='branch__active', action=filter_active_sla_to_branch)
    branch_critical_path = CaseInsensitiveBooleanFilter(name='branch__critical_path', lookup_type='iexact')
    eol_after = django_filters.DateFilter(name="eol", lookup_type='gte')
    eol_before = django_filters.DateFilter(name="eol", lookup_type='lte')

    class Meta:
        model = SLAToComponentBranch
        # Specifies the exact lookups to allow
        fields = ('eol',)
Ejemplo n.º 4
0
class RPMFilter(django_filters.FilterSet):
    name        = MultiValueFilter()
    version     = MultiValueFilter()
    epoch       = MultiIntFilter()
    release     = MultiValueFilter()
    arch        = MultiValueFilter()
    srpm_name   = MultiValueFilter()
    srpm_nevra  = NullableCharFilter()
    filename    = MultiValueFilter()
    compose     = MultiValueFilter(name='composerpm__variant_arch__variant__compose__compose_id',
                                   distinct=True)
    linked_release = MultiValueFilter(name='linked_releases__release_id', distinct=True)
    built_for_release = MultiValueFilter(name='built_for_release__release_id', distinct=True)
    provides = django_filters.MethodFilter(action=partial(dependency_filter,
                                                          models.Dependency.PROVIDES))
    requires = django_filters.MethodFilter(action=partial(dependency_filter,
                                                          models.Dependency.REQUIRES))
    obsoletes = django_filters.MethodFilter(action=partial(dependency_filter,
                                                           models.Dependency.OBSOLETES))
    conflicts = django_filters.MethodFilter(action=partial(dependency_filter,
                                                           models.Dependency.CONFLICTS))
    recommends = django_filters.MethodFilter(action=partial(dependency_filter,
                                                            models.Dependency.RECOMMENDS))
    suggests = django_filters.MethodFilter(action=partial(dependency_filter,
                                                          models.Dependency.SUGGESTS))
    has_no_deps = CaseInsensitiveBooleanFilter(name='dependency__isnull', distinct=True)

    class Meta:
        model = models.RPM
        fields = ('name', 'version', 'epoch', 'release', 'arch', 'srpm_name',
                  'srpm_nevra', 'compose', 'filename', 'linked_release', 'built_for_release',
                  'provides', 'requires', 'obsoletes', 'conflicts', 'recommends', 'suggests',
                  'has_no_deps')
Ejemplo n.º 5
0
class ImageFilter(django_filters.FilterSet):
    file_name = MultiValueFilter()
    image_format = MultiValueFilter(name='image_format__name')
    image_type = MultiValueFilter(name='image_type__name')
    disc_number = MultiIntFilter()
    disc_count = MultiIntFilter()
    arch = MultiValueFilter()
    mtime = MultiIntFilter()
    size = MultiIntFilter()
    implant_md5 = MultiValueFilter()
    volume_id = MultiValueFilter()
    md5 = MultiValueFilter()
    sha1 = MultiValueFilter()
    sha256 = MultiValueFilter()
    subvariant = MultiValueFilter()
    compose = MultiValueFilter(
        name='composeimage__variant_arch__variant__compose__compose_id',
        distinct=True)
    bootable = CaseInsensitiveBooleanFilter()

    class Meta:
        model = models.Image
        fields = ('file_name', 'image_format', 'image_type', 'disc_number',
                  'disc_count', 'arch', 'mtime', 'size', 'bootable',
                  'implant_md5', 'volume_id', 'md5', 'sha1', 'sha256',
                  'subvariant')
Ejemplo n.º 6
0
class MultiDestinationFilter(filters.FilterSet):
    global_component = MultiValueFilter(name='global_component__name')
    origin_repo = MultiIntFilter()
    destination_repo = MultiIntFilter()
    origin_repo_name = MultiValueFilter(name='origin_repo__name')
    destination_repo_name = MultiValueFilter(name='destination_repo__name')
    origin_repo_release_id = MultiValueFilter(
        name='origin_repo__variant_arch__variant__release__release_id')
    destination_repo_release_id = MultiValueFilter(
        name='destination_repo__variant_arch__variant__release__release_id')
    subscribers = MultiValueFilter(method='filter_by_subscribers')
    active = CaseInsensitiveBooleanFilter()

    @value_is_not_empty
    def filter_by_subscribers(self, qs, name, value):
        people = Person.objects.filter(username__in=value)
        return qs.filter(subscribers__in=people)

    class Meta:
        model = models.MultiDestination
        fields = (
            'id',
            'global_component',
            'origin_repo',
            'destination_repo',
            'origin_repo_name',
            'destination_repo_name',
            'origin_repo_release_id',
            'destination_repo_release_id',
            'subscribers',
            'active',
        )
Ejemplo n.º 7
0
class OSBSFilter(django_filters.FilterSet):
    autorebuild = CaseInsensitiveBooleanFilter()
    release = MultiValueFilter(name='component__release__release_id')
    component_name = MultiValueFilter(name='component__name')

    class Meta:
        model = models.OSBSRecord
        fields = ('autorebuild', 'release', 'component_name')
class ComposeFilter(django_filters.FilterSet):
    release = MultiValueCaseInsensitiveFilter(name='release__release_id')
    compose_id = MultiValueCaseInsensitiveFilter(name='compose_id')
    compose_type = MultiValueCaseInsensitiveFilter(name='compose_type__name')
    acceptance_testing = MultiValueFilter(name='acceptance_testing__name')
    srpm_name = MultiValueCaseInsensitiveFilter(
        name='variant__variantarch__composerpm__rpm__srpm_name', distinct=True)
    rpm_name = MultiValueCaseInsensitiveFilter(
        name='variant__variantarch__composerpm__rpm__name', distinct=True)
    rpm_version = MultiValueCaseInsensitiveFilter(
        name='variant__variantarch__composerpm__rpm__version', distinct=True)
    rpm_release = MultiValueCaseInsensitiveFilter(
        name='variant__variantarch__composerpm__rpm__release', distinct=True)
    rpm_arch = MultiValueCaseInsensitiveFilter(
        name='variant__variantarch__composerpm__rpm__arch', distinct=True)
    rpm_nvr = django_filters.MethodFilter(action="filter_nvr")
    rpm_nvra = django_filters.MethodFilter(action="filter_nvra")
    deleted = CaseInsensitiveBooleanFilter()
    compose_date = MultiValueFilter(name='compose_date')
    compose_respin = MultiValueFilter(name='compose_respin')
    compose_label = MultiValueFilter(name='compose_label')
    # TODO: return only latest compose

    @value_is_not_empty
    def filter_nvr(self, qs, value):
        try:
            nvr = kobo.rpmlib.parse_nvr(value)
        except ValueError:
            raise ValidationError("Invalid NVR: %s" % value)

        q = Q()
        q &= Q(variant__variantarch__composerpm__rpm__name=nvr["name"])
        q &= Q(variant__variantarch__composerpm__rpm__version=nvr["version"])
        q &= Q(variant__variantarch__composerpm__rpm__release=nvr["release"])
        return qs.filter(q).distinct()

    @value_is_not_empty
    def filter_nvra(self, qs, value):
        try:
            nvra = kobo.rpmlib.parse_nvra(value)
        except ValueError:
            raise ValidationError("Invalid NVRA: %s" % value)

        q = Q()
        q &= Q(variant__variantarch__composerpm__rpm__name=nvra["name"])
        q &= Q(variant__variantarch__composerpm__rpm__version=nvra["version"])
        q &= Q(variant__variantarch__composerpm__rpm__release=nvra["release"])
        q &= Q(variant__variantarch__composerpm__rpm__arch=nvra["arch"])
        return qs.filter(q).distinct()

    class Meta:
        model = Compose
        fields = ('deleted', 'compose_id', 'compose_date', 'compose_respin',
                  'compose_label', 'release', 'compose_type',
                  'acceptance_testing')
Ejemplo n.º 9
0
class ModuleFilterBase(django_filters.FilterSet):
    active = CaseInsensitiveBooleanFilter()
    koji_tag = django_filters.CharFilter(name='koji_tag', lookup_type='iexact')
    runtime_dep_name = MultiValueFilter(name='runtime_deps__dependency',
                                        distinct=True)
    runtime_dep_stream = MultiValueFilter(name='runtime_deps__stream',
                                          distinct=True)
    build_dep_name = MultiValueFilter(name='build_deps__dependency',
                                      distinct=True)
    build_dep_stream = MultiValueFilter(name='build_deps__stream',
                                        distinct=True)
    component_name = MultiValueFilter(name='rpms__srpm_name', distinct=True)
    component_branch = MultiValueFilter(name='rpms__srpm_commit_branch',
                                        distinct=True)
Ejemplo n.º 10
0
class RepoFilter(filters.FilterSet):
    arch = MultiValueFilter(name='variant_arch__arch__name')
    content_category = MultiValueFilter(name='content_category__name')
    content_format = MultiValueFilter(name='content_format__name')
    release_id = MultiValueFilter(name='variant_arch__variant__release__release_id')
    variant_uid = MultiValueFilter(name='variant_arch__variant__variant_uid')
    repo_family = MultiValueFilter(name='repo_family__name')
    service = MultiValueFilter(name='service__name')
    shadow = CaseInsensitiveBooleanFilter()
    product_id = MultiIntFilter()

    class Meta:
        model = models.Repo
        fields = ('arch', 'content_category', 'content_format', 'name', 'release_id',
                  'repo_family', 'service', 'shadow', 'variant_uid', 'product_id')
Ejemplo n.º 11
0
class RPMFilter(django_filters.FilterSet):
    name = MultiValueRegexFilter(help_text="""
            Multiple values will be OR-ed. Preferably use OR inside the regexp.
            """)
    version = MultiValueFilter()
    epoch = MultiIntFilter()
    release = MultiValueFilter()
    arch = MultiValueFilter()
    srpm_name = MultiValueFilter()
    srpm_nevra = NullableCharFilter()
    filename = MultiValueFilter()
    compose = MultiValueFilter(
        name='composerpm__variant_arch__variant__compose__compose_id',
        distinct=True)
    srpm_commit_hash = MultiValueFilter()
    srpm_commit_branch = MultiValueFilter()
    linked_release = MultiValueFilter(name='linked_releases__release_id',
                                      distinct=True)
    built_for_release = MultiValueFilter(name='built_for_release__release_id',
                                         distinct=True)
    provides = django_filters.CharFilter(
        method=partial(dependency_filter, models.Dependency.PROVIDES))
    requires = django_filters.CharFilter(
        method=partial(dependency_filter, models.Dependency.REQUIRES))
    obsoletes = django_filters.CharFilter(
        method=partial(dependency_filter, models.Dependency.OBSOLETES))
    conflicts = django_filters.CharFilter(
        method=partial(dependency_filter, models.Dependency.CONFLICTS))
    recommends = django_filters.CharFilter(
        method=partial(dependency_filter, models.Dependency.RECOMMENDS))
    suggests = django_filters.CharFilter(
        method=partial(dependency_filter, models.Dependency.SUGGESTS))
    has_no_deps = CaseInsensitiveBooleanFilter(name='dependency__isnull',
                                               distinct=True,
                                               help_text="""
    - If "true", lists only RPMs which do not have any dependencies.
    - If "false", lists only RPMs which have at least one dependency.
    """)

    class Meta:
        model = models.RPM
        fields = ('name', 'version', 'epoch', 'release', 'arch', 'srpm_name',
                  'srpm_nevra', 'compose', 'filename', 'linked_release',
                  'built_for_release', 'provides', 'requires', 'obsoletes',
                  'conflicts', 'recommends', 'suggests', 'has_no_deps')
class ReleaseScheduleFilter(django_filters.FilterSet):
    release = django_filters.CharFilter(name='release__release_id',
                                        lookup_expr='exact')
    product_version = django_filters.CharFilter(
        name='release__product_version__product_version_id',
        lookup_expr='exact')
    sla = django_filters.ModelMultipleChoiceFilter(name="sla__name",
                                                   queryset=SLA.objects.all(),
                                                   to_field_name='name',
                                                   lookup_expr='exact')
    active = CaseInsensitiveBooleanFilter(name="date",
                                          method=filter_later_than_today)
    date_after = django_filters.DateFilter(name="date", lookup_expr='gte')
    date_before = django_filters.DateFilter(name="date", lookup_expr='lte')

    class Meta:
        model = ReleaseSchedule
        # Specifies additional exact lookups to allow
        fields = ["date"]
Ejemplo n.º 13
0
class ReleaseComponentFilter(ComposeFilterSet):
    name = MultiValueFilter()
    release = MultiValueFilter(name='release__release_id')
    global_component = MultiValueFilter(name='global_component__name')
    bugzilla_component = MultiValueFilter(name='bugzilla_component__name')
    brew_package = MultiValueFilter()
    active = CaseInsensitiveBooleanFilter()
    type = CharFilter(name='type__name')
    dist_git_branch = MethodFilter(action='filter_by_dist_git_branch', widget=SelectMultiple)

    @value_is_not_empty
    def filter_by_dist_git_branch(self, qs, value):
        q = Q(dist_git_branch__in=value) | Q(release__releasedistgitmapping__dist_git_branch__in=value,
                                             dist_git_branch__isnull=True)
        return qs.filter(q)

    class Meta:
        model = ReleaseComponent
        fields = ('name', 'release', 'global_component', 'active',
                  'bugzilla_component', 'type', 'dist_git_branch')
Ejemplo n.º 14
0
class UnreleasedVariantFilter(django_filters.FilterSet):
    variant_id          = django_filters.CharFilter(name='variant_id', lookup_type='iexact')
    variant_uid         = django_filters.CharFilter(name='variant_uid', lookup_type='iexact')
    variant_name        = django_filters.CharFilter(name='variant_name', lookup_type='iexact')
    variant_type        = django_filters.CharFilter(name='variant_type', lookup_type='iexact')
    variant_version     = django_filters.CharFilter(name='variant_version', lookup_type='iexact')
    variant_release     = django_filters.CharFilter(name='variant_release', lookup_type='iexact')
    active              = CaseInsensitiveBooleanFilter()
    koji_tag            = django_filters.CharFilter(name='koji_tag', lookup_type='iexact')
    runtime_dep_name    = MultiValueFilter(name='runtime_deps__dependency', distinct=True)
    runtime_dep_stream  = MultiValueFilter(name='runtime_deps__stream', distinct=True)
    build_dep_name      = MultiValueFilter(name='build_deps__dependency', distinct=True)
    build_dep_stream    = MultiValueFilter(name='build_deps__stream', distinct=True)
    component_name      = MultiValueFilter(name='rpms__srpm_name', distinct=True)
    component_branch    = MultiValueFilter(name='rpms__srpm_commit_branch', distinct=True)

    class Meta:
        model = UnreleasedVariant
        fields = ('variant_id', 'variant_uid', 'variant_name', 'variant_type',
                  'variant_version', 'variant_release', 'koji_tag',
                  'modulemd', 'runtime_dep_name', 'runtime_dep_stream',
                  'build_dep_name', 'build_dep_stream', 'component_name',
                  'component_branch')
Ejemplo n.º 15
0
class ModuleFilterBase(django_filters.FilterSet):
    active = CaseInsensitiveBooleanFilter()
    koji_tag = django_filters.CharFilter(name='koji_tag', lookup_expr='iexact')
    runtime_dep_name = MultiValueFilter(name='runtime_deps__dependency',
                                        distinct=True)
    runtime_dep_stream = MultiValueFilter(name='runtime_deps__stream',
                                          distinct=True)
    build_dep_name = MultiValueFilter(name='build_deps__dependency',
                                      distinct=True)
    build_dep_stream = MultiValueFilter(name='build_deps__stream',
                                        distinct=True)
    component_name = MultiValueFilter(name='rpms__srpm_name', distinct=True)
    component_branch = MultiValueFilter(name='rpms__srpm_commit_branch',
                                        distinct=True,
                                        help_text="""
        Note that "component_name" filter can match different component than this filter.
        Use "component" filter instead to match both name and branch in a single component.
        """)
    component = ModuleComponentFilter(help_text="""
        Match name and branch in a single component.
        Format is "<component_name>/<component_branch>" or just "<component_name>".
        """)
    rpm_filename = MultiValueFilter(name='rpms__filename', distinct=True)