diff --git a/app/blueprints/admin/admin.py b/app/blueprints/admin/admin.py index 969244da..89ae0a3b 100644 --- a/app/blueprints/admin/admin.py +++ b/app/blueprints/admin/admin.py @@ -26,7 +26,7 @@ from wtforms.validators import InputRequired, Length from app.models import * from app.tasks.forumtasks import importTopicList, checkAllForumAccounts -from app.tasks.importtasks import importRepoScreenshot, checkZipRelease, updateMetaFromRelease, importForeignDownloads +from app.tasks.importtasks import importRepoScreenshot, checkZipRelease, importForeignDownloads from app.utils import rank_required, addAuditLog, addNotification from . import bp @@ -64,7 +64,7 @@ def admin_page(): release = package.releases.first() if release: zippath = release.url.replace("/uploads/", app.config["UPLOAD_DIR"]) - tasks.append(updateMetaFromRelease.s(release.id, zippath)) + tasks.append(checkZipRelease.s(release.id, zippath)) result = group(tasks).apply_async() diff --git a/app/blueprints/packages/packages.py b/app/blueprints/packages/packages.py index 08489b1e..8d038b9b 100644 --- a/app/blueprints/packages/packages.py +++ b/app/blueprints/packages/packages.py @@ -30,7 +30,7 @@ from wtforms.validators import * from app.querybuilder import QueryBuilder from app.rediscache import has_key, set_key -from app.tasks.importtasks import importRepoScreenshot, updateMetaFromRelease +from app.tasks.importtasks import importRepoScreenshot, checkZipRelease from app.utils import * from . import bp @@ -545,6 +545,6 @@ def update_from_release(package): task_id = uuid() zippath = release.url.replace("/uploads/", app.config["UPLOAD_DIR"]) - updateMetaFromRelease.apply_async((release.id, zippath), task_id=task_id) + checkZipRelease.apply_async((release.id, zippath), task_id=task_id) return redirect(url_for("tasks.check", id=task_id, r=package.getEditURL())) diff --git a/app/blueprints/packages/releases.py b/app/blueprints/packages/releases.py index f51da0d0..57a2d6a3 100644 --- a/app/blueprints/packages/releases.py +++ b/app/blueprints/packages/releases.py @@ -24,7 +24,7 @@ from wtforms.ext.sqlalchemy.fields import QuerySelectField from wtforms.validators import * from app.rediscache import has_key, set_key, make_download_key -from app.tasks.importtasks import makeVCSRelease, checkZipRelease, updateMetaFromRelease +from app.tasks.importtasks import makeVCSRelease, checkZipRelease from app.utils import * from . import bp @@ -108,7 +108,6 @@ def create_release(package): db.session.commit() checkZipRelease.apply_async((rel.id, uploadedPath), task_id=rel.task_id) - updateMetaFromRelease.delay(rel.id, uploadedPath) msg = "Release {} created".format(rel.title) addNotification(package.maintainers, current_user, NotificationType.PACKAGE_EDIT, msg, rel.getEditURL(), package) diff --git a/app/tasks/importtasks.py b/app/tasks/importtasks.py index f4bdc0e7..e43aa8b4 100644 --- a/app/tasks/importtasks.py +++ b/app/tasks/importtasks.py @@ -169,25 +169,6 @@ def postReleaseCheckUpdate(self, release, path): raise TaskError(str(err)) -@celery.task(bind=True) -def updateMetaFromRelease(self, id, path): - release = PackageRelease.query.get(id) - if release is None: - raise TaskError("No such release!") - elif release.package is None: - raise TaskError("No package attached to release") - - print("updateMetaFromRelease: {} for {}/{}" \ - .format(id, release.package.author.display_name, release.package.name)) - - with get_temp_dir() as temp: - with ZipFile(path, 'r') as zip_ref: - zip_ref.extractall(temp) - - postReleaseCheckUpdate(self, release, temp) - db.session.commit() - - @celery.task(bind=True) def checkZipRelease(self, id, path): release = PackageRelease.query.get(id) @@ -232,8 +213,6 @@ def makeVCSRelease(self, id, branch): release.approve(release.package.author) db.session.commit() - updateMetaFromRelease.delay(release.id, destPath) - return release.url