From c08d9c97a630d94ac465968ac8237e8f220ad981 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Oct 05 2018 03:31:43 +0000 Subject: [PATCH 1/4] Skip disabled paths in pre-flight check Signed-off-by: Patrick Uiterwijk --- diff --git a/pagure/lib/tasks.py b/pagure/lib/tasks.py index d47f01e..5857b18 100644 --- a/pagure/lib/tasks.py +++ b/pagure/lib/tasks.py @@ -642,6 +642,8 @@ def move_to_repospanner(self, session, name, namespace, user, region): incompatible_hooks = [] for repotype in pagure.lib.REPOTYPES: path = project.repopath(repotype) + if path is None: + continue hookpath = os.path.join(path, "hooks") for hook in os.listdir(hookpath): if not hook.startswith( From 87315e92b130f1b2babe839058e7e005441c8a86 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Oct 05 2018 03:36:15 +0000 Subject: [PATCH 2/4] Run %s over the hooks Signed-off-by: Patrick Uiterwijk --- diff --git a/pagure/lib/tasks.py b/pagure/lib/tasks.py index 5857b18..66b2bc3 100644 --- a/pagure/lib/tasks.py +++ b/pagure/lib/tasks.py @@ -657,7 +657,8 @@ def move_to_repospanner(self, session, name, namespace, user, region): if incompatible_hooks: raise Exception( "Repository contains repoSpanner-incompatible " - "hooks: %s" % ", ".join(incompatible_hooks) + "hooks: %s" + % ", ".join(["%s" % (hook,) for hook in incompatible_hooks]) ) # Create the repositories From 05520eb622aac0f175a43e6ce7625ef2ba59ce7e Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Oct 05 2018 03:38:31 +0000 Subject: [PATCH 3/4] Make the pre-flight check ignore samples Signed-off-by: Patrick Uiterwijk --- diff --git a/pagure/lib/tasks.py b/pagure/lib/tasks.py index 66b2bc3..2f0edb7 100644 --- a/pagure/lib/tasks.py +++ b/pagure/lib/tasks.py @@ -650,6 +650,9 @@ def move_to_repospanner(self, session, name, namespace, user, region): ("pre-receive.", "update.", "post-receive.") ): continue + if hook.endswith(".sample"): + # Ignore the samples that Git inserts + continue hookfile = os.path.join(hookpath, hook) if os.path.realpath(hookfile) not in compatible_targets: incompatible_hooks.append((repotype, hook)) From aeb0452bd775c3e514e3e4a8ca16ce19682e2915 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Oct 05 2018 04:42:33 +0000 Subject: [PATCH 4/4] Do not attempt to migrate unused repos Signed-off-by: Patrick Uiterwijk --- diff --git a/pagure/lib/tasks.py b/pagure/lib/tasks.py index 2f0edb7..6949be9 100644 --- a/pagure/lib/tasks.py +++ b/pagure/lib/tasks.py @@ -668,8 +668,10 @@ def move_to_repospanner(self, session, name, namespace, user, region): pagure.lib.git.create_project_repos(project, region, None, False) for repotype in pagure.lib.REPOTYPES: - repourl, _ = project.repospanner_repo_info(repotype, region) repopath = project.repopath(repotype) + if repopath is None: + continue + repourl, _ = project.repospanner_repo_info(repotype, region) repo_obj = pagure.lib.repo.PagureRepo(repopath) repo_obj.create_remote("repospanner_push", repourl)