Together with goodrepos, takes care of downloads.

There are many fields tracked with a request object that are
assigned during the check process.  The field downloads was
missing too.  The next one is possibly to_ignore.
This commit is contained in:
Alberto Planas 2014-06-27 11:06:23 +02:00
parent 414ad1390e
commit 3e98a7545c
2 changed files with 19 additions and 3 deletions

View File

@ -109,6 +109,7 @@ def _check_repo_download(self, request, opts):
request.downloads = defaultdict(list)
if request.is_cached:
request.downloads = self.checkrepo._get_downloads_from_local(request)
print 'Found cached version for', request
return set()
@ -269,7 +270,7 @@ def _check_repo_group(self, id_, requests, opts):
params_file.write('\n'.join(f for f in toignore if f.strip()))
params_file.close()
# If a package is in a Stagin Project, it will have in
# If a package is in a Staging Project, it will have in
# request.downloads an entry for 'standard' (the repository of a
# Staging Project) Also in this same field there will be another
# valid repository (probably openSUSE_Factory)

View File

@ -14,6 +14,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from collections import defaultdict
import os
import subprocess
from urllib import quote_plus
@ -473,8 +474,22 @@ class CheckRepo(object):
def _get_goodrepos_from_local(self, request):
"""Calculate 'goodrepos' from local cache."""
project_dir = os.path.join(DOWNLOADS, request.src_package, request.src_project)
# This return the full list of firectories at this level.
return os.walk(project_dir).next()[1]
# This return the full list of directories at this level.
goodrepos = os.walk(project_dir).next()[1]
return goodrepos
def _get_downloads_from_local(self, request):
"""Calculate 'downloads' from local cache."""
project_dir = os.path.join(DOWNLOADS, request.src_package, request.src_project)
downloads = defaultdict(list)
for dirpath, dirnames, filenames in os.walk(project_dir):
repo = os.path.basename(os.path.normpath(dirpath))
if filenames:
downloads[repo] = [os.path.join(dirpath, f) for f in filenames]
return downloads
def is_buildsuccess(self, request):
"""Return True if the request is correctly build