mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 14:02:24 +01:00
parent
4820d11ce3
commit
c7aecd32be
@ -87,7 +87,7 @@ def create_release(package):
|
||||
db.session.add(rel)
|
||||
db.session.commit()
|
||||
|
||||
makeVCSRelease.apply_async((rel.id, form["vcsLabel"].data), task_id=rel.task_id)
|
||||
makeVCSRelease.apply_async((rel.id, nonEmptyOrNone(form.vcsLabel.data)), task_id=rel.task_id)
|
||||
|
||||
msg = "Release {} created".format(rel.title)
|
||||
addNotification(package.maintainers, current_user, NotificationType.PACKAGE_EDIT, msg, rel.getEditURL(), package)
|
||||
|
@ -35,7 +35,7 @@ def generateGitURL(urlstr):
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def getTempDir():
|
||||
def get_temp_dir():
|
||||
temp = os.path.join(tempfile.gettempdir(), randomString(10))
|
||||
yield temp
|
||||
shutil.rmtree(temp)
|
||||
@ -46,7 +46,7 @@ def getTempDir():
|
||||
# Throws `TaskError` on failure.
|
||||
# Caller is responsible for deleting returned directory.
|
||||
@contextlib.contextmanager
|
||||
def cloneRepo(urlstr, ref=None, recursive=False):
|
||||
def clone_repo(urlstr, ref=None, recursive=False):
|
||||
gitDir = os.path.join(tempfile.gettempdir(), randomString(10))
|
||||
|
||||
err = None
|
||||
@ -58,11 +58,13 @@ def cloneRepo(urlstr, ref=None, recursive=False):
|
||||
repo = git.Repo.clone_from(gitUrl, gitDir,
|
||||
progress=None, env=None, depth=1, recursive=recursive, kill_after_timeout=15)
|
||||
else:
|
||||
assert ref != ""
|
||||
|
||||
repo = git.Repo.init(gitDir)
|
||||
origin = repo.create_remote("origin", url=gitUrl)
|
||||
assert origin.exists()
|
||||
origin.fetch()
|
||||
origin.pull(ref)
|
||||
repo.git.checkout(ref)
|
||||
|
||||
for submodule in repo.submodules:
|
||||
submodule.update(init=True)
|
||||
@ -85,7 +87,7 @@ def cloneRepo(urlstr, ref=None, recursive=False):
|
||||
|
||||
@celery.task()
|
||||
def getMeta(urlstr, author):
|
||||
with cloneRepo(urlstr, recursive=True) as repo:
|
||||
with clone_repo(urlstr, recursive=True) as repo:
|
||||
try:
|
||||
tree = build_tree(repo.working_tree_dir, author=author, repo=urlstr)
|
||||
except MinetestCheckError as err:
|
||||
@ -178,7 +180,7 @@ def updateMetaFromRelease(self, id, path):
|
||||
print("updateMetaFromRelease: {} for {}/{}" \
|
||||
.format(id, release.package.author.display_name, release.package.name))
|
||||
|
||||
with getTempDir() as temp:
|
||||
with get_temp_dir() as temp:
|
||||
with ZipFile(path, 'r') as zip_ref:
|
||||
zip_ref.extractall(temp)
|
||||
|
||||
@ -194,7 +196,7 @@ def checkZipRelease(self, id, path):
|
||||
elif release.package is None:
|
||||
raise TaskError("No package attached to release")
|
||||
|
||||
with getTempDir() as temp:
|
||||
with get_temp_dir() as temp:
|
||||
with ZipFile(path, 'r') as zip_ref:
|
||||
zip_ref.extractall(temp)
|
||||
|
||||
@ -213,7 +215,7 @@ def makeVCSRelease(self, id, branch):
|
||||
elif release.package is None:
|
||||
raise TaskError("No package attached to release")
|
||||
|
||||
with cloneRepo(release.package.repo, ref=branch, recursive=True) as repo:
|
||||
with clone_repo(release.package.repo, ref=branch, recursive=True) as repo:
|
||||
postReleaseCheckUpdate(self, release, repo.working_tree_dir)
|
||||
|
||||
filename = randomString(10) + ".zip"
|
||||
@ -242,7 +244,7 @@ def importRepoScreenshot(id):
|
||||
raise Exception("Unexpected none package")
|
||||
|
||||
try:
|
||||
with cloneRepo(package.repo) as repo:
|
||||
with clone_repo(package.repo) as repo:
|
||||
for ext in ["png", "jpg", "jpeg"]:
|
||||
sourcePath = repo.working_tree_dir + "/screenshot." + ext
|
||||
if os.path.isfile(sourcePath):
|
||||
|
6
utils/reload_worker.sh
Normal file
6
utils/reload_worker.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
docker-compose build worker
|
||||
docker-compose up --no-deps -d worker
|
@ -5,8 +5,8 @@
|
||||
# This is for production use. See reload.sh for debug mode hot/live reloading.
|
||||
#
|
||||
|
||||
sudo docker-compose build app
|
||||
sudo docker-compose build worker
|
||||
docker-compose build app
|
||||
docker-compose build worker
|
||||
|
||||
sudo docker-compose up --no-deps -d app
|
||||
sudo docker-compose up --no-deps --scale worker=2 -d worker
|
||||
docker-compose up --no-deps -d app
|
||||
docker-compose up --no-deps --scale worker=2 -d worker
|
||||
|
Loading…
Reference in New Issue
Block a user