Commit de7483cc authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

update repo metadata

parent 289165d7
Pipeline #613 passed with stages
in 1 minute and 14 seconds
......@@ -3,10 +3,12 @@ import logging
from django.core.management.base import BaseCommand
from rainboard.models import Project, Robotpkg
from rainboard.utils import SOURCES
ALLOWED_MAINTAINERS = ['hpp@laas.fr', 'pinocchio@laas.fr']
ATTRIBUTES = ['homepage', 'license', 'description']
NUM_ATTRS = ['license']
NOT_GITLAB = ['homepage', 'license']
logger = logging.getLogger('rainboard.management.checks')
......@@ -37,6 +39,8 @@ class Command(BaseCommand):
rattr = getattr(rpkg, 'comment' if attr_name == 'description' else attr_name)
logger.warning(f"project {project}'s rpkg {rpkg} {attr_name}: {attr} Vs. {rattr}")
for repo in project.repo_set.exclude(**{attr_name: attr}):
if repo.forge.source == SOURCES.gitlab and attr in NOT_GITLAB:
continue
rattr = getattr(repo, attr_name)
logger.warning(f"project {project}'s repo {repo.git_remote()} {attr_name}: {attr} Vs. {rattr}")
......
......@@ -154,7 +154,6 @@ class Project(Links, NamedModel, TimeStampedModel):
updated = models.DateTimeField(blank=True, null=True)
tests = models.BooleanField(default=True)
docs = models.BooleanField(default=True)
# TODO: release github ↔ robotpkg
def git_path(self):
return settings.RAINBOARD_GITS / self.main_namespace.slug / self.slug
......@@ -723,7 +722,8 @@ def update_gitlab(forge, data):
repo.clone_url = data['http_url_to_repo']
repo.open_issues = data['open_issues_count']
repo.default_branch = data['default_branch']
# TODO license, open_pr, homepage
repo.description = data['description']
# TODO license (https://gitlab.com/gitlab-org/gitlab-ce/issues/28267), open_pr
if 'forked_from_project' in data:
repo.forked_from = data['forked_from_project']['id']
elif created or project.main_namespace is None:
......@@ -744,6 +744,7 @@ def update_github(forge, namespace, data):
repo.repo_id = data['id']
repo.default_branch = data['default_branch']
repo.open_issues = data['open_issues']
repo.description = data['description']
repo_data = repo.api_data()
if repo_data and 'license' in repo_data and repo_data['license']:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment