Skip to content
This repository was archived by the owner on Apr 30, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
language: generic
sudo: required

services:
- docker

env:
- FEDORA=27
- FEDORA=28
- FEDORA=29
- FEDORA=rawhide

install:
- sed -i "s/fedora-28-x86_64/fedora-${FEDORA}-x86_64/" mock.cfg
- sed -i "s|FROM fedora|FROM registry.fedoraproject.org/fedora:${FEDORA}|" Dockerfile
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it be changed directly in the files?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is. I probably don't understand the question.

The registry.fedoraproject.org/ part is there for f29 to work before the release. I can add it directly to the file but it would make no difference.

- docker build -t taskotron .

script:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM fedora

RUN dnf -y install --setopt=install_weak_deps=false --setopt=tsflags=nodocs \
--setopt=deltarpm=false python2-rpm python3-rpm tox python2-dnf \
python3-dnf mock && dnf clean all
python3-dnf mock --allowerasing --best && dnf clean all

ENV LANG=C.UTF-8 LC_ALL=C.UTF-8

Expand Down
22 changes: 8 additions & 14 deletions taskotron_python_versions/requires.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,20 @@ def get_packages_by(self, **kwargs):
"""Return the result of the DNF query execution,
filtered by kwargs.
"""
try:
if self.query is not None:
return self.query.filter(**kwargs).run()
except AttributeError:
else:
log.debug('No query, we continue, but it is bad...')
return []

@staticmethod
def add_repo(base, reponame, repourl):
try:
# Fedora 26
repo = dnf.repo.Repo(reponame, parent_conf=base.conf)
except TypeError:
# Fedora 25
repo = dnf.repo.Repo(reponame, cachedir=base.conf.cachedir)

metalink = ('https://mirrors.fedoraproject.org/'
'metalink?repo={}&arch=$basearch'.format(repourl))
repo.metalink = dnf.conf.parser.substitute(metalink,
base.conf.substitutions)

base.repos.add(repo)
repo.skip_if_unavailable = False
repo = base.repos.add_new_repo(reponame,
base.conf,
metalink=metalink,
skip_if_unavailable=False)
repo.enable()
repo.load()
return repo
Expand All @@ -76,6 +69,7 @@ def get_dnf_query(self):
except dnf.exceptions.RepoError as err:
if self.release == 'rawhide':
log.error('{} (rawhide)'.format(err))
# TODO Do not silently ignore the error
return
log.warning('Failed to load repos for {}, '
'assuming rawhide'.format(self.release))
Expand Down
9 changes: 9 additions & 0 deletions test/functional/test_requires.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pytest

from taskotron_python_versions.requires import (
DNFQuery,
get_versioned_name,
check_requires_naming_scheme,
)
Expand Down Expand Up @@ -86,3 +87,11 @@ def test_package_requires_are_misnamed(pkgglob, repoquery, expected):
# Make sure all items from repoquery.data were popped out.
assert not repoquery.data, (
'Repoquery was not called for: {}'.format(repoquery.data))


@pytest.mark.slow
def test_repoquery():
repoquery = DNFQuery('25')
packages = repoquery.get_packages_by(provides='python-setuptools')
first = packages[0]
assert first.name == 'python2-setuptools'
1 change: 1 addition & 0 deletions test/integration/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def rootdir(self):

def _run(self, what, **kwargs):
command = list(self.mock) # needs a copy not to change in place
command.append('--enable-network')
command.append('--config-opts=root={}'.format(self.root))
command.append('--rootdir={}'.format(self.rootdir))
command.extend(what)
Expand Down