mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-08 22:17:34 +01:00
Add support for submodules in makeVCSRelease()
This commit is contained in:
parent
59039a14a5
commit
bcd003685e
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
import flask, json, os, git, tempfile, shutil, gitdb
|
import flask, json, os, git, tempfile, shutil, gitdb
|
||||||
from git import GitCommandError
|
from git import GitCommandError
|
||||||
|
from git_archive_all import GitArchiver
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
from urllib.error import HTTPError
|
from urllib.error import HTTPError
|
||||||
import urllib.request
|
import urllib.request
|
||||||
@ -380,29 +381,31 @@ def makeVCSRelease(id, branch):
|
|||||||
elif release.package is None:
|
elif release.package is None:
|
||||||
raise TaskError("No package attached to release")
|
raise TaskError("No package attached to release")
|
||||||
|
|
||||||
urlmaker = None
|
# url = urlparse(release.package.repo)
|
||||||
url = urlparse(release.package.repo)
|
# if url.netloc == "github.com":
|
||||||
if url.netloc == "github.com":
|
# return makeVCSReleaseFromGithub(id, branch, release, url)
|
||||||
return makeVCSReleaseFromGithub(id, branch, release, url)
|
|
||||||
else:
|
|
||||||
gitDir, repo = cloneRepo(release.package.repo, ref=branch, recursive=True)
|
|
||||||
|
|
||||||
try:
|
gitDir, repo = cloneRepo(release.package.repo, ref=branch, recursive=True)
|
||||||
filename = randomString(10) + ".zip"
|
|
||||||
destPath = os.path.join(app.config["UPLOAD_DIR"], filename)
|
|
||||||
with open(destPath, "wb") as fp:
|
|
||||||
repo.archive(fp, format="zip")
|
|
||||||
|
|
||||||
release.url = "/uploads/" + filename
|
try:
|
||||||
release.task_id = None
|
filename = randomString(10) + ".zip"
|
||||||
release.commit_hash = repo.head.object.hexsha
|
destPath = os.path.join(app.config["UPLOAD_DIR"], filename)
|
||||||
release.approve(release.package.author)
|
|
||||||
print(release.url)
|
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
return release.url
|
assert(not os.path.isfile(destPath))
|
||||||
finally:
|
archiver = GitArchiver(force_sub=True, main_repo_abspath=gitDir)
|
||||||
shutil.rmtree(gitDir)
|
archiver.create(destPath)
|
||||||
|
assert(os.path.isfile(destPath))
|
||||||
|
|
||||||
|
release.url = "/uploads/" + filename
|
||||||
|
release.task_id = None
|
||||||
|
release.commit_hash = repo.head.object.hexsha
|
||||||
|
release.approve(release.package.author)
|
||||||
|
print(release.url)
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
|
return release.url
|
||||||
|
finally:
|
||||||
|
shutil.rmtree(gitDir)
|
||||||
|
|
||||||
@celery.task()
|
@celery.task()
|
||||||
def importRepoScreenshot(id):
|
def importRepoScreenshot(id):
|
||||||
|
@ -15,6 +15,7 @@ beautifulsoup4~=4.6
|
|||||||
celery==4.1.1
|
celery==4.1.1
|
||||||
kombu==4.2.0
|
kombu==4.2.0
|
||||||
GitPython~=2.1
|
GitPython~=2.1
|
||||||
|
git-archive-all~=1.20
|
||||||
lxml~=4.2
|
lxml~=4.2
|
||||||
pillow~=6.2
|
pillow~=6.2
|
||||||
pyScss~=1.3
|
pyScss~=1.3
|
||||||
|
Loading…
Reference in New Issue
Block a user