本文整理汇总了Python中coprs.logic.builds_logic.BuildsLogic.delete_local_srpm方法的典型用法代码示例。如果您正苦于以下问题:Python BuildsLogic.delete_local_srpm方法的具体用法?Python BuildsLogic.delete_local_srpm怎么用?Python BuildsLogic.delete_local_srpm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coprs.logic.builds_logic.BuildsLogic
的用法示例。
在下文中一共展示了BuildsLogic.delete_local_srpm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dist_git_upload_completed
# 需要导入模块: from coprs.logic.builds_logic import BuildsLogic [as 别名]
# 或者: from coprs.logic.builds_logic.BuildsLogic import delete_local_srpm [as 别名]
def dist_git_upload_completed():
"""
Mark BuildChroot in a Build as uploaded, which means:
- set it to pending state
- set BuildChroot.git_hash
- if it's the last BuildChroot in a Build:
- delete local srpm
BuildChroot is identified with task_id which is build id + git branch name
- For example: 56-f22 -> build 55, chroots fedora-22-*
"""
result = {"updated": False}
if "task_id" in flask.request.json:
app.logger.debug(flask.request.data)
task_id = flask.request.json["task_id"]
build_chroots = BuildsLogic.get_chroots_from_dist_git_task_id(task_id)
build = build_chroots[0].build
# Is it OK?
if "git_hash" in flask.request.json and "repo_name" in flask.request.json:
git_hash = flask.request.json["git_hash"]
repo_name = flask.request.json["repo_name"]
pkg_name = flask.request.json["pkg_name"]
pkg_version = flask.request.json["pkg_version"]
# Now I need to assign a package to this build
package = PackagesLogic.get(build.copr.id, pkg_name).first()
if not package:
package = PackagesLogic.add(build.copr.owner, build.copr, pkg_name)
db.session.add(package)
db.session.flush()
build.package_id = package.id
build.pkg_version = pkg_version
for ch in build_chroots:
ch.status = helpers.StatusEnum("pending")
ch.git_hash = git_hash
# Failed?
elif "error" in flask.request.json:
error_type = flask.request.json["error"]
try:
build.fail_type = helpers.FailTypeEnum(error_type)
except KeyError:
build.fail_type = helpers.FailTypeEnum("unknown_error")
for ch in build_chroots:
ch.status = helpers.StatusEnum("failed")
# is it the last chroot?
if not build.has_importing_chroot:
BuildsLogic.delete_local_srpm(build)
db.session.commit()
result.update({"updated": True})
return flask.jsonify(result)