Compare commits
1 Commits
minetestch
...
master
Author | SHA1 | Date |
---|---|---|
rubenwardy | 8ad066409c |
|
@ -27,6 +27,7 @@ from sqlalchemy import or_, and_
|
|||
from app.logic.game_support import GameSupportResolver
|
||||
from app.models import PackageRelease, db, Package, PackageState, PackageScreenshot, MetaPackage, User, \
|
||||
NotificationType, PackageUpdateConfig, License, UserRank, PackageType, PackageGameSupport
|
||||
from app.tasks.emails import send_pending_digests
|
||||
from app.tasks.forumtasks import importTopicList, checkAllForumAccounts
|
||||
from app.tasks.importtasks import importRepoScreenshot, checkZipRelease, check_for_updates
|
||||
from app.utils import addNotification, get_system_user
|
||||
|
@ -330,3 +331,8 @@ def detect_game_support():
|
|||
resolver = GameSupportResolver()
|
||||
resolver.update_all()
|
||||
db.session.commit()
|
||||
|
||||
|
||||
@action("Send pending notif digests")
|
||||
def do_send_pending_digests():
|
||||
send_pending_digests.delay()
|
||||
|
|
|
@ -78,6 +78,8 @@ def postReleaseCheckUpdate(self, release: PackageRelease, path):
|
|||
tree = build_tree(path, expected_type=ContentType[release.package.type.name],
|
||||
author=release.package.author.username, name=release.package.name)
|
||||
|
||||
if tree.name is not None and release.package.name != tree.name and tree.type == ContentType.MOD:
|
||||
raise MinetestCheckError(f"Expected {tree.relative} to have technical name {release.package.name}, instead has name {tree.name}")
|
||||
|
||||
cache = {}
|
||||
def getMetaPackages(names):
|
||||
|
@ -101,6 +103,11 @@ def postReleaseCheckUpdate(self, release: PackageRelease, path):
|
|||
depends.discard(mod)
|
||||
optional_depends.discard(mod)
|
||||
|
||||
# Raise error on unresolved game dependencies
|
||||
if package.type == PackageType.GAME and len(depends) > 0:
|
||||
deps = ", ".join(depends)
|
||||
raise MinetestCheckError("Game has unresolved hard dependencies: " + deps)
|
||||
|
||||
# Add dependencies
|
||||
for meta in getMetaPackages(depends):
|
||||
db.session.add(Dependency(package, meta=meta, optional=False))
|
||||
|
|
|
@ -22,6 +22,18 @@ class ContentType(Enum):
|
|||
"""
|
||||
assert other
|
||||
|
||||
if self == ContentType.MOD:
|
||||
if not other.isModLike():
|
||||
raise MinetestCheckError("Expected a mod or modpack, found " + other.value)
|
||||
|
||||
elif self == ContentType.TXP:
|
||||
if other != ContentType.UNKNOWN and other != ContentType.TXP:
|
||||
raise MinetestCheckError("expected a " + self.value + ", found a " + other.value)
|
||||
|
||||
elif other != self:
|
||||
raise MinetestCheckError("Expected a " + self.value + ", found a " + other.value)
|
||||
|
||||
|
||||
from .tree import PackageTreeNode, get_base_dir
|
||||
|
||||
def build_tree(path, expected_type=None, author=None, repo=None, name=None):
|
||||
|
|
|
@ -53,7 +53,13 @@ class PackageTreeNode:
|
|||
self.read_meta()
|
||||
|
||||
if self.type == ContentType.GAME:
|
||||
if not os.path.isdir(baseDir + "/mods"):
|
||||
raise MinetestCheckError("Game at {} does not have a mods/ folder".format(self.relative))
|
||||
self.add_children_from_mod_dir("mods")
|
||||
elif self.type == ContentType.MOD:
|
||||
if self.name and not basenamePattern.match(self.name):
|
||||
raise MinetestCheckError("Invalid base name for mod {} at {}, names must only contain a-z0-9_." \
|
||||
.format(self.name, self.relative))
|
||||
elif self.type == ContentType.MODPACK:
|
||||
self.add_children_from_mod_dir(None)
|
||||
|
||||
|
@ -88,7 +94,14 @@ class PackageTreeNode:
|
|||
conf = parse_conf(myfile.read())
|
||||
for key, value in conf.items():
|
||||
result[key] = value
|
||||
except IOError: pass
|
||||
except SyntaxError as e:
|
||||
raise MinetestCheckError("Error while reading {}: {}".format(meta_file_rel , e.msg))
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
if "release" in result:
|
||||
raise MinetestCheckError("{} should not contain 'release' key, as this is for use by ContentDB only.".format(meta_file_rel))
|
||||
|
||||
|
||||
# description.txt
|
||||
if not "description" in result:
|
||||
|
@ -126,7 +139,16 @@ class PackageTreeNode:
|
|||
result["optional_depends"] = []
|
||||
|
||||
|
||||
def checkDependencies(deps): pass
|
||||
def checkDependencies(deps):
|
||||
for dep in deps:
|
||||
if not basenamePattern.match(dep):
|
||||
if " " in dep:
|
||||
raise MinetestCheckError("Invalid dependency name '{}' for mod at {}, did you forget a comma?" \
|
||||
.format(dep, self.relative))
|
||||
else:
|
||||
raise MinetestCheckError(
|
||||
"Invalid dependency name '{}' for mod at {}, names must only contain a-z0-9_." \
|
||||
.format(dep, self.relative))
|
||||
|
||||
# Check dependencies
|
||||
checkDependencies(result["depends"])
|
||||
|
@ -165,6 +187,12 @@ class PackageTreeNode:
|
|||
path = os.path.join(dir, entry)
|
||||
if not entry.startswith('.') and os.path.isdir(path):
|
||||
child = PackageTreeNode(path, relative + entry + "/", name=entry)
|
||||
if not child.type.isModLike():
|
||||
raise MinetestCheckError("Expecting mod or modpack, found {} at {} inside {}" \
|
||||
.format(child.type.value, child.relative, self.type.value))
|
||||
|
||||
if child.name is None:
|
||||
raise MinetestCheckError("Missing base name for mod at {}".format(self.relative))
|
||||
|
||||
self.children.append(child)
|
||||
|
||||
|
|
|
@ -17,20 +17,23 @@
|
|||
</ul>
|
||||
{% endfor %}
|
||||
|
||||
{% for group in notifications | selectattr("package", "none") %}
|
||||
{% set other_notifications = notifications | selectattr("package", "none") %}
|
||||
|
||||
{% if other_notifications %}
|
||||
<h2>
|
||||
{{ _("Other Notifications") }}
|
||||
</h2>
|
||||
|
||||
<ul>
|
||||
{% for notification in group %}
|
||||
{% for notification in other_notifications %}
|
||||
<li>
|
||||
<a href="{{ notification.url | abs_url }}">{{ notification.title }}</a> -
|
||||
{{ _("from %(username)s.", username=notification.causer.username) }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
<p style="margin-top: 3em;">
|
||||
<a class="btn" href="{{ abs_url_for('notifications.list_all') }}">
|
||||
{{ _("View Notifications") }}
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
version: '3'
|
||||
|
||||
|
||||
services:
|
||||
db:
|
||||
image: "postgres:14.1"
|
||||
volumes:
|
||||
- "./data/db:/var/lib/postgresql/data"
|
||||
environment: &env
|
||||
- POSTGRES_USER=contentdb
|
||||
- POSTGRES_PASSWORD=password
|
||||
- POSTGRES_DB=contentdb
|
||||
- FLASK_DEBUG=1
|
||||
- FLASK_CONFIG=../config.cfg
|
||||
adminer:
|
||||
image: adminer
|
||||
restart: always
|
||||
environment:
|
||||
- ADMINER_DEFAULT_SERVER=db
|
||||
- ADMINER_DESIGN=pepa-linha
|
||||
ports:
|
||||
- 8081:8080
|
||||
|
||||
redis:
|
||||
image: 'redis:6.2-alpine'
|
||||
command: redis-server
|
||||
volumes:
|
||||
- './data/redis:/data'
|
||||
|
||||
app:
|
||||
build: .
|
||||
container_name: contentdb_app_1
|
||||
command: ./utils/entrypoint.sh
|
||||
environment: *env
|
||||
ports:
|
||||
- 5123:5123
|
||||
volumes:
|
||||
- "./data/uploads:/var/cdb/uploads"
|
||||
- "./app:/source/app"
|
||||
- "./migrations:/source/migrations"
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
|
||||
worker:
|
||||
build: .
|
||||
command: celery -A app.tasks.celery worker --concurrency 1
|
||||
environment: *env
|
||||
volumes:
|
||||
- "./data/uploads:/var/cdb/uploads"
|
||||
- "./app:/home/cdb/app"
|
||||
depends_on:
|
||||
- redis
|
||||
|
||||
beat:
|
||||
build: .
|
||||
command: celery -A app.tasks.celery beat
|
||||
environment: *env
|
||||
depends_on:
|
||||
- redis
|
||||
|
||||
exporter:
|
||||
image: ovalmoney/celery-exporter
|
||||
environment: *env
|
||||
ports:
|
||||
- 5125:9540
|
||||
depends_on:
|
||||
- redis
|
|
@ -1,17 +1,11 @@
|
|||
version: '3'
|
||||
|
||||
|
||||
services:
|
||||
db:
|
||||
image: "postgres:14.1"
|
||||
volumes:
|
||||
- "./data/db:/var/lib/postgresql/data"
|
||||
environment: &env
|
||||
- POSTGRES_USER=contentdb
|
||||
- POSTGRES_PASSWORD=password
|
||||
- POSTGRES_DB=contentdb
|
||||
- FLASK_DEBUG=0
|
||||
- FLASK_CONFIG=../config.cfg
|
||||
env_file:
|
||||
- config.env
|
||||
|
||||
redis:
|
||||
image: 'redis:6.2-alpine'
|
||||
|
@ -21,9 +15,9 @@ services:
|
|||
|
||||
app:
|
||||
build: .
|
||||
container_name: contentdb_app_1
|
||||
command: ./utils/entrypoint.sh
|
||||
environment: *env
|
||||
env_file:
|
||||
- config.env
|
||||
ports:
|
||||
- 5123:5123
|
||||
volumes:
|
||||
|
@ -37,7 +31,10 @@ services:
|
|||
worker:
|
||||
build: .
|
||||
command: celery -A app.tasks.celery worker --concurrency 1
|
||||
environment: *env
|
||||
env_file:
|
||||
- config.env
|
||||
environment:
|
||||
- FLASK_CONFIG=../config.cfg
|
||||
volumes:
|
||||
- "./data/uploads:/var/cdb/uploads"
|
||||
- "./app:/home/cdb/app"
|
||||
|
@ -47,13 +44,17 @@ services:
|
|||
beat:
|
||||
build: .
|
||||
command: celery -A app.tasks.celery beat
|
||||
environment: *env
|
||||
env_file:
|
||||
- config.env
|
||||
environment:
|
||||
- FLASK_CONFIG=../config.cfg
|
||||
depends_on:
|
||||
- redis
|
||||
|
||||
exporter:
|
||||
image: ovalmoney/celery-exporter
|
||||
environment: *env
|
||||
env_file:
|
||||
- config.env
|
||||
ports:
|
||||
- 5125:9540
|
||||
depends_on:
|
||||
|
|
Loading…
Reference in New Issue