diff --git a/.travis.yml b/.travis.yml index dbc75285..e7d5d01b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,8 @@ python: install: - pip install python-coveralls - pip install -r requirements.txt + - sudo mkdir -p /var/cache/repo-checker + - sudo chown $USER /var/cache/repo-checker # command to run tests, e.g. python setup.py test script: - nosetests --with-coverage --cover-package=oscs,osclib --cover-inclusive diff --git a/osc-staging.py b/osc-staging.py index 944074d7..2dc8f88e 100644 --- a/osc-staging.py +++ b/osc-staging.py @@ -92,7 +92,7 @@ def do_staging(self, subcmd, opts, *args): raise oscerr.WrongArgs('Unknown command: %s' % cmd) if len(args) - 1 < min_args: raise oscerr.WrongArgs('Too few arguments.') - if not max_args is None and len(args) - 1 > max_args: + if max_args is not None and len(args) - 1 > max_args: raise oscerr.WrongArgs('Too many arguments.') # init the obs access diff --git a/osclib/request_finder.py b/osclib/request_finder.py index a7e405ed..2fb82ba0 100644 --- a/osclib/request_finder.py +++ b/osclib/request_finder.py @@ -56,10 +56,6 @@ class RequestFinder(object): :param element: XML with list of reviews """ reviews = self._filter_review_by_project(element, 'new') - # First filter out reviews to contain only STAGING ones - # NOTE: this is hardcoded path to projects so usage elsewhere - # will need adjustements - reviews = [prj for prj in reviews if prj.startswith('openSUSE:Factory:Staging:')] assert len(reviews) <= 1, 'Request "{}" have multiple review by project in new state "{}"'.format(request_id, reviews) return reviews[0] if reviews else None @@ -92,7 +88,7 @@ class RequestFinder(object): self.srs[int(request_id)] = {'project': project} review = self._new_review_by_project(request_id, root) - if review: + if review and review.startswith(STG_PREFIX): self.srs[int(request_id)]['staging'] = review return True @@ -123,7 +119,7 @@ class RequestFinder(object): self.srs[request] = {'project': 'openSUSE:Factory', 'state': state} review = self._new_review_by_project(request, sr) - if review: + if review and review.startswith(STG_PREFIX): self.srs[int(request)]['staging'] = review if last_rq: @@ -163,7 +159,7 @@ class RequestFinder(object): state = sr.find('state').get('name') self.srs[request] = {'project': 'openSUSE:Factory', 'state': state} review = self._new_review_by_project(request, sr) - if review: + if review and review.startswith(STG_PREFIX): self.srs[int(request)]['staging'] = review ret = True diff --git a/osclib/select_command.py b/osclib/select_command.py index 9dbda0f8..0558dc30 100644 --- a/osclib/select_command.py +++ b/osclib/select_command.py @@ -4,7 +4,7 @@ from osc import oscerr from osc.core import http_GET from osclib.request_finder import RequestFinder -from osclib.freeze_command import FreezeCommand +# from osclib.freeze_command import FreezeCommand class SelectCommand(object): @@ -98,7 +98,7 @@ class SelectCommand(object): # If the project is not frozen enough yet freeze it if not self.api.prj_frozen_enough(target_project): print('Freeze the prj first') - #FreezeCommand(self.api).perform(target_project) + # FreezeCommand(self.api).perform(target_project) self.target_project = target_project for request, request_project in RequestFinder.find_sr(requests, self.api.apiurl).items():