aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Doan <andy.doan@linaro.org>2016-11-04 11:48:31 -0500
committerAndy Doan <andy.doan@linaro.org>2016-11-04 11:48:31 -0500
commita2fb9626a79765dad3067afb7e93bd2de7e63a8c (patch)
treea7c34759b43332161362af747ba8cf70d0aa1f8f
parent89a55b58fddb3eeb948b4b3f057c04e1bc3dd395 (diff)
downloadlinaro-git-tools-a2fb9626a79765dad3067afb7e93bd2de7e63a8c.tar.gz
handle repository renaming better
Relying on projects.list was never a great idea and now that we use cgit there's no need for projects.list anymore. Additionally, we sometimes need to move a repository to another location (for example when someone leaves Linaro). The current process for handling this is a pain. With this change we can automatically handle renamed repositories by looking at the list of all repositories defined on disk. Change-Id: I91d15c207525a996f0d170ec2ab1b73a9a20ef65
-rwxr-xr-xgrok-cron.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/grok-cron.py b/grok-cron.py
index dd8df8d..37efbb1 100755
--- a/grok-cron.py
+++ b/grok-cron.py
@@ -7,6 +7,10 @@ import subprocess
import grokmirror
+EXCLUDES = (
+ 'gitolite-admin.git',
+)
+
logging.basicConfig(level=logging.INFO)
log = logging.getLogger('grok-cron')
@@ -20,15 +24,16 @@ def handle_unmanaged(manifile, manifest_repos, repo_dir, dryrun):
# look at projects.list which is what we serve to the public
# see if it exists and isn't known to grokmirror
missing = []
- with open('/home/git/projects.list') as f:
- for repo in f:
- repo = repo.strip()
- full_path = os.path.join(repo_dir, repo)
- # we have a couple of old symlinks set up, that we don't have
- # to manage via grokmirror
- if os.path.isdir(full_path) and not os.path.islink(full_path):
- if repo not in manifest_repos:
- missing.append(repo)
+ repos = subprocess.check_output(
+ ['/home/git/bin/gitolite', 'list-phy-repos'])
+ for repo in repos.splitlines():
+ repo = repo.strip() + '.git'
+ full_path = os.path.join(repo_dir, repo)
+ # we have a couple of old symlinks set up, that we don't have
+ # to manage via grokmirror
+ if os.path.isdir(full_path) and not os.path.islink(full_path):
+ if repo not in manifest_repos and repo not in EXCLUDES:
+ missing.append(repo)
# grok-manifest is particular about the path format
if repo_dir[-1] != '/':