def origin_update_pending(apiurl, origin_project, package, target_project, policy, supersede, frequency): apiurl_remote, project_remote = project_remote_apiurl( apiurl, origin_project) request_actions = request_action_list_source(apiurl_remote, project_remote, package, include_release=True) for request, action in sorted(request_actions, key=lambda i: i[0].reqid, reverse=True): reviews_not_allowed = reviews_filter_allowed( reviews_remaining(request, True), policy['pending_submission_allowed_reviews_update']) if len(reviews_not_allowed): continue identifier = request_remote_identifier(apiurl, apiurl_remote, request.reqid) message = 'Newer pending source available from package origin. See {}.'.format( identifier) src_project = project_remote_prefixed(apiurl, apiurl_remote, action.src_project) return request_create_submit(apiurl, src_project, action.src_package, target_project, package, message=message, revision=action.src_rev, supersede=supersede, frequency=frequency) return False
def get(apiurl, project): """Cached version for directly accessing project config.""" # Properly handle loading the config for interconnect projects. from osclib.core import project_remote_apiurl apiurl_remote, project_remote = project_remote_apiurl(apiurl, project) Config(apiurl_remote, project_remote) return conf.config.get(project_remote, [])
def get(apiurl, project): """Cached version for directly accessing project config.""" # Properly handle loading the config for interconnect projects. from osclib.core import project_remote_apiurl apiurl_remote, project_remote = project_remote_apiurl(apiurl, project) Config(apiurl_remote, project_remote) return conf.config.get(project_remote, [])
def project_source_pending(apiurl, project, package, source_hash): apiurl_remote, project_remote = project_remote_apiurl(apiurl, project) requests = get_request_list(apiurl_remote, project_remote, package, None, ['new', 'review'], 'submit') for request in requests: for action in request.actions: source_hash_consider = package_source_hash( apiurl_remote, action.src_project, action.src_package, action.src_rev) project_source_log('pending', project, source_hash_consider, source_hash) if source_hash_consider == source_hash: return PendingRequestInfo( request_remote_identifier(apiurl, apiurl_remote, request.reqid), reviews_remaining(request)) return False
def project_source_pending(apiurl, project, package, source_hash): apiurl_remote, project_remote = project_remote_apiurl(apiurl, project) requests = get_request_list(apiurl_remote, project_remote, package, None, ['new', 'review'], 'submit') for request in requests: for action in request.actions: source_hash_consider = package_source_hash( apiurl_remote, action.src_project, action.src_package, action.src_rev) project_source_log('pending', project, source_hash_consider, source_hash) if source_hash_consider == source_hash: return PendingRequestInfo( request_remote_identifier(apiurl, apiurl_remote, request.reqid), reviews_remaining(request)) return False
def project_source_pending(apiurl, project, package, source_hash): apiurl_remote, project_remote = project_remote_apiurl(apiurl, project) request_actions = request_action_list_source(apiurl_remote, project_remote, package, states=['new', 'review'], include_release=True) for request, action in request_actions: source_hash_consider = package_source_hash(apiurl_remote, action.src_project, action.src_package, action.src_rev) project_source_log('pending', project, source_hash_consider, source_hash) if source_hash_consider == source_hash: return PendingRequestInfo( request_remote_identifier(apiurl, apiurl_remote, request.reqid), reviews_remaining(request, True)) return False