whitespace formatting

This commit is contained in:
Tomas Kopecek 2017-03-07 14:42:57 +01:00 committed by Mike McLean
parent ed86da02dc
commit 22bedc900d
10 changed files with 99 additions and 99 deletions

View file

@ -5092,7 +5092,7 @@ class CG_Importer(object):
'package': self.buildinfo['name'],
'source': self.buildinfo.get('source'),
'metadata_only': self.metadata_only,
'cg_list' : list(self.cgs),
'cg_list': list(self.cgs),
# TODO: provide more data
}
assert_policy('cg_import', policy_data)
@ -5212,20 +5212,20 @@ class CG_Importer(object):
def prep_buildroot(self, brdata):
ret = {}
brinfo = {
'cg_id' : brdata['cg_id'],
'cg_version' : brdata['content_generator']['version'],
'container_type' : brdata['container']['type'],
'container_arch' : brdata['container']['arch'],
'host_os' : brdata['host']['os'],
'host_arch' : brdata['host']['arch'],
'extra' : brdata.get('extra'),
'cg_id': brdata['cg_id'],
'cg_version': brdata['content_generator']['version'],
'container_type': brdata['container']['type'],
'container_arch': brdata['container']['arch'],
'host_os': brdata['host']['os'],
'host_arch': brdata['host']['arch'],
'extra': brdata.get('extra'),
}
rpmlist, archives = self.match_components(brdata['components'])
ret = {
'brinfo' : brinfo,
'rpmlist' : rpmlist,
'archives' : archives,
'tools' : brdata['tools'],
'brinfo': brinfo,
'rpmlist': rpmlist,
'archives': archives,
'tools': brdata['tools'],
}
return ret
@ -6410,11 +6410,11 @@ def query_history(tables=None, **kwargs):
"""
common_fields = {
#fields:aliases common to all versioned tables
'active' : 'active',
'create_event' : 'create_event',
'revoke_event' : 'revoke_event',
'creator_id' : 'creator_id',
'revoker_id' : 'revoker_id',
'active': 'active',
'create_event': 'create_event',
'revoke_event': 'revoke_event',
'creator_id': 'creator_id',
'revoker_id': 'revoker_id',
}
common_joins = [
"events AS ev1 ON ev1.id = create_event",
@ -6423,45 +6423,45 @@ def query_history(tables=None, **kwargs):
"LEFT OUTER JOIN users AS revoker ON revoker.id = revoker_id",
]
common_joined_fields = {
'creator.name' : 'creator_name',
'revoker.name' : 'revoker_name',
'EXTRACT(EPOCH FROM ev1.time) AS create_ts' : 'create_ts',
'EXTRACT(EPOCH FROM ev2.time) AS revoke_ts' : 'revoke_ts',
'creator.name': 'creator_name',
'revoker.name': 'revoker_name',
'EXTRACT(EPOCH FROM ev1.time) AS create_ts': 'create_ts',
'EXTRACT(EPOCH FROM ev2.time) AS revoke_ts': 'revoke_ts',
}
table_fields = {
'user_perms' : ['user_id', 'perm_id'],
'user_groups' : ['user_id', 'group_id'],
'cg_users' : ['user_id', 'cg_id'],
'tag_inheritance' : ['tag_id', 'parent_id', 'priority', 'maxdepth', 'intransitive', 'noconfig', 'pkg_filter'],
'tag_config' : ['tag_id', 'arches', 'perm_id', 'locked', 'maven_support', 'maven_include_all'],
'tag_extra' : ['tag_id', 'key', 'value'],
'build_target_config' : ['build_target_id', 'build_tag', 'dest_tag'],
'external_repo_config' : ['external_repo_id', 'url'],
'tag_external_repos' : ['tag_id', 'external_repo_id', 'priority'],
'tag_listing' : ['build_id', 'tag_id'],
'tag_packages' : ['package_id', 'tag_id', 'owner', 'blocked', 'extra_arches'],
'group_config' : ['group_id', 'tag_id', 'blocked', 'exported', 'display_name', 'is_default', 'uservisible',
'user_perms': ['user_id', 'perm_id'],
'user_groups': ['user_id', 'group_id'],
'cg_users': ['user_id', 'cg_id'],
'tag_inheritance': ['tag_id', 'parent_id', 'priority', 'maxdepth', 'intransitive', 'noconfig', 'pkg_filter'],
'tag_config': ['tag_id', 'arches', 'perm_id', 'locked', 'maven_support', 'maven_include_all'],
'tag_extra': ['tag_id', 'key', 'value'],
'build_target_config': ['build_target_id', 'build_tag', 'dest_tag'],
'external_repo_config': ['external_repo_id', 'url'],
'tag_external_repos': ['tag_id', 'external_repo_id', 'priority'],
'tag_listing': ['build_id', 'tag_id'],
'tag_packages': ['package_id', 'tag_id', 'owner', 'blocked', 'extra_arches'],
'group_config': ['group_id', 'tag_id', 'blocked', 'exported', 'display_name', 'is_default', 'uservisible',
'description', 'langonly', 'biarchonly'],
'group_req_listing' : ['group_id', 'tag_id', 'req_id', 'blocked', 'type', 'is_metapkg'],
'group_package_listing' : ['group_id', 'tag_id', 'package', 'blocked', 'type', 'basearchonly', 'requires'],
'group_req_listing': ['group_id', 'tag_id', 'req_id', 'blocked', 'type', 'is_metapkg'],
'group_package_listing': ['group_id', 'tag_id', 'package', 'blocked', 'type', 'basearchonly', 'requires'],
}
name_joins = {
#joins triggered by table fields for name lookup
#field : [table, join-alias, alias]
'user_id' : ['users', 'users', 'user'],
'perm_id' : ['permissions', 'permission'],
'cg_id' : ['content_generator'],
'user_id': ['users', 'users', 'user'],
'perm_id': ['permissions', 'permission'],
'cg_id': ['content_generator'],
#group_id is overloaded (special case below)
'tag_id' : ['tag'],
'parent_id' : ['tag', 'parent'],
'build_target_id' : ['build_target'],
'build_tag' : ['tag', 'build_tag'],
'dest_tag' : ['tag', 'dest_tag'],
'external_repo_id' : ['external_repo'],
'tag_id': ['tag'],
'parent_id': ['tag', 'parent'],
'build_target_id': ['build_target'],
'build_tag': ['tag', 'build_tag'],
'dest_tag': ['tag', 'dest_tag'],
'external_repo_id': ['external_repo'],
# build_id is special cased
'package_id' : ['package'],
'owner' : ['users', 'owner'],
'req_id' : ['groups', 'req'],
'package_id': ['package'],
'owner': ['users', 'owner'],
'req_id': ['groups', 'req'],
}
if tables is None:
tables = table_fields.keys()
@ -6501,11 +6501,11 @@ def query_history(tables=None, **kwargs):
elif field == 'build_id':
#special case
fields.update({
'package.name' : 'name', #XXX?
'build.version' : 'version',
'build.release' : 'release',
'build.epoch' : 'epoch',
'build.state' : 'build.state',
'package.name': 'name', #XXX?
'build.version': 'version',
'build.release': 'release',
'build.epoch': 'epoch',
'build.state': 'build.state',
})
joins.extend([
'build ON build_id = build.id',
@ -9916,7 +9916,7 @@ class RootExports(object):
return query.execute()
def checkTagPackage(self,tag,pkg):
def checkTagPackage(self, tag, pkg):
"""Check that pkg is in the list for tag. Returns true/false"""
tag_id = get_tag_id(tag, strict=False)
pkg_id = get_package_id(pkg, strict=False)
@ -12339,9 +12339,9 @@ def handle_upload(environ):
# this will also remove our lock
os.close(fd)
ret = {
'size' : koji.encode_int(size),
'fileverify' : verify,
'offset' : koji.encode_int(offset),
'size': koji.encode_int(size),
'fileverify': verify,
'offset': koji.encode_int(offset),
}
if verify:
# unsigned 32bit - could be too big for xmlrpc

View file

@ -539,28 +539,28 @@ def load_plugins(opts):
return tracker
_default_policies = {
'build_from_srpm' : '''
'build_from_srpm': '''
has_perm admin :: allow
all :: deny
''',
'build_from_repo_id' : '''
'build_from_repo_id': '''
has_perm admin :: allow
all :: deny
''',
'package_list' : '''
'package_list': '''
has_perm admin :: allow
all :: deny
''',
'channel' : '''
'channel': '''
has req_channel :: req
is_child_task :: parent
all :: use default
''',
'vm' : '''
'vm': '''
has_perm admin win-admin :: allow
all :: deny
''',
'cg_import' :'''
'cg_import': '''
all :: allow
''',
}

View file

@ -142,12 +142,12 @@ class CompareTest(BaseSimpleTest):
allow_float = True
operators = {
'<' : lambda a, b: a < b,
'>' : lambda a, b: a > b,
'<=' : lambda a, b: a <= b,
'>=' : lambda a, b: a >= b,
'=' : lambda a, b: a == b,
'!=' : lambda a, b: a != b,
'<': lambda a, b: a < b,
'>': lambda a, b: a > b,
'<=': lambda a, b: a <= b,
'>=': lambda a, b: a >= b,
'=': lambda a, b: a == b,
'!=': lambda a, b: a != b,
}
def __init__(self, str):

View file

@ -48,21 +48,21 @@ class WSGIWrapper(object):
self._env = None
host, port = req.connection.remote_addr
environ = {
'REMOTE_ADDR' : req.connection.remote_ip,
'REMOTE_ADDR': req.connection.remote_ip,
# or remote_addr[0]?
# or req.get_remote_host(apache.REMOTE_NOLOOKUP)?
'REMOTE_PORT' : str(req.connection.remote_addr[1]),
'REMOTE_USER' : req.user,
'REQUEST_METHOD' : req.method,
'REQUEST_URI' : req.uri,
'PATH_INFO' : req.path_info,
'SCRIPT_FILENAME' : req.filename,
'QUERY_STRING' : req.args or '',
'SERVER_NAME' : req.hostname,
'SERVER_PORT' : str(req.connection.local_addr[1]),
'wsgi.version' : (1, 0),
'wsgi.input' : InputWrapper(req),
'wsgi.errors' : sys.stderr,
'REMOTE_PORT': str(req.connection.remote_addr[1]),
'REMOTE_USER': req.user,
'REQUEST_METHOD': req.method,
'REQUEST_URI': req.uri,
'PATH_INFO': req.path_info,
'SCRIPT_FILENAME': req.filename,
'QUERY_STRING': req.args or '',
'SERVER_NAME': req.hostname,
'SERVER_PORT': str(req.connection.local_addr[1]),
'wsgi.version': (1, 0),
'wsgi.input': InputWrapper(req),
'wsgi.errors': sys.stderr,
#TODO - file_wrapper support
}
environ = LazyDict(environ)

View file

@ -125,7 +125,7 @@ class RunRootTask(tasks.BaseTaskHandler):
if not tag_arches:
raise koji.BuildError("No arch list for tag: %s" % root)
#index canonical host arches
host_arches = dict([(koji.canonArch(a),1) for a in host_arches.split()])
host_arches = dict([(koji.canonArch(a), 1) for a in host_arches.split()])
#pick the first suitable match from tag's archlist
for br_arch in tag_arches.split():
br_arch = koji.canonArch(br_arch)
@ -250,10 +250,10 @@ class RunRootTask(tasks.BaseTaskHandler):
logfile = "%s/do_mounts.log" % self.workdir
uploadpath = self.getUploadDir()
error = None
for dev,path,type,opts in mounts:
for dev, path, type, opts in mounts:
if not path.startswith('/'):
raise koji.GenericError("invalid mount point: %s" % path)
mpoint = "%s%s" % (rootdir,path)
mpoint = "%s%s" % (rootdir, path)
if opts is None:
opts = []
else:
@ -294,7 +294,7 @@ class RunRootTask(tasks.BaseTaskHandler):
mounts = {}
fn = '%s/tmp/runroot_mounts' % rootdir
if os.path.exists(fn):
fslog = file(fn,'r')
fslog = file(fn, 'r')
for line in fslog:
mounts.setdefault(line.strip(), 1)
fslog.close()

View file

@ -57,6 +57,6 @@ def runroot(tagInfo, arch, command, channel=None, **opts):
% (tagInfo, taskopts['channel']))
taskopts['arch'] = koji.canonArch(random.choice(choices))
args = koji.encode_args(tagInfo, arch, command,**opts)
args = koji.encode_args(tagInfo, arch, command, **opts)
return kojihub.make_task('runroot', args, **taskopts)

View file

@ -140,7 +140,7 @@ class TestSessionConnection(unittest.TestCase):
ret = session.get_connection(uri, None, None, None)
@mock.patch('httplib.HTTPConnection')
@mock.patch('sys.version_info', new=(2,7,12,'final', 0))
@mock.patch('sys.version_info', new=(2, 7, 12, 'final', 0))
def test_timeout(self, HTTPConnection):
# no cert, no verify
session = koji.compatrequests.Session()
@ -199,7 +199,7 @@ class TestSessionConnection(unittest.TestCase):
@mock.patch('ssl._create_unverified_context')
@mock.patch('httplib.HTTPSConnection')
@mock.patch('sys.version_info', new=(2,7,12,'final', 0))
@mock.patch('sys.version_info', new=(2, 7, 12, 'final', 0))
def test_unverified(self, HTTPSConnection, create_unverified_context):
# no cert, verify=False, no timeout
session = koji.compatrequests.Session()
@ -230,7 +230,7 @@ class TestSessionConnection(unittest.TestCase):
@mock.patch('ssl._create_unverified_context')
@mock.patch('ssl.SSLContext')
@mock.patch('httplib.HTTPSConnection')
@mock.patch('sys.version_info', new=(2,7,12,'final', 0))
@mock.patch('sys.version_info', new=(2, 7, 12, 'final', 0))
def test_verify(self, HTTPSConnection, SSLContext, create_unverified_context):
# no cert, no timeout
session = koji.compatrequests.Session()

View file

@ -281,7 +281,7 @@ has DEPTH :: {
lines = policy.splitlines()
for depth in ['1','2','3','4']:
for depth in ['1', '2', '3', '4']:
data = {'DEPTH': depth}
obj = koji.policy.SimpleRuleSet(lines, tests)
action = obj.apply(data)

View file

@ -76,7 +76,7 @@ def _clearUserCookie(environ):
def _getUserCookie(environ):
options = environ['koji.options']
cookies = Cookie.SimpleCookie(environ.get('HTTP_COOKIE',''))
cookies = Cookie.SimpleCookie(environ.get('HTTP_COOKIE', ''))
if 'user' not in cookies:
return None
value = cookies['user'].value
@ -2205,14 +2205,14 @@ _VALID_SEARCH_SYMS = r""" @.,_/\()%+-*?|[]^$"""
_VALID_SEARCH_RE = re.compile('^[' + _VALID_SEARCH_CHARS + re.escape(_VALID_SEARCH_SYMS) + ']+$')
_DEFAULT_SEARCH_ORDER = {
# For searches against large tables, use '-id' to show most recent first
'build' : '-id',
'rpm' : '-id',
'maven' : '-id',
'win' : '-id',
'build': '-id',
'rpm': '-id',
'maven': '-id',
'win': '-id',
# for other tables, ordering by name makes much more sense
'tag' : 'name',
'target' : 'name',
'package' : 'name',
'tag': 'name',
'target': 'name',
'package': 'name',
# any type not listed will default to 'name'
}

View file

@ -411,7 +411,7 @@ class Dispatcher(object):
start_response(status, headers)
return result
headers = {
'allow' : ('Allow', 'GET, POST, HEAD'),
'allow': ('Allow', 'GET, POST, HEAD'),
}
extra = []
for name, value in environ.get('koji.headers', []):