summaryrefslogtreecommitdiffstats
path: root/scripts/git-integration
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/git-integration')
-rwxr-xr-xscripts/git-integration/gen-templates.py29
-rwxr-xr-xscripts/git-integration/git-serve.py5
-rwxr-xr-xscripts/git-integration/init-repos.py5
3 files changed, 33 insertions, 6 deletions
diff --git a/scripts/git-integration/gen-templates.py b/scripts/git-integration/gen-templates.py
new file mode 100755
index 00000000..e451b53e
--- /dev/null
+++ b/scripts/git-integration/gen-templates.py
@@ -0,0 +1,29 @@
+#!/usr/bin/python3
+
+import configparser
+import os
+import shutil
+import sys
+
+config = configparser.RawConfigParser()
+config.read(os.path.dirname(os.path.realpath(__file__)) + "/../../conf/config")
+
+template_path = config.get('serve', 'template-path')
+git_update_hook = config.get('serve', 'git-update-hook')
+
+def die(msg):
+ sys.stderr.write("%s\n" % (msg))
+ exit(1)
+
+if os.path.exists(template_path):
+ shutil.rmtree(template_path)
+
+os.mkdir(template_path)
+os.chdir(template_path)
+os.mkdir("branches")
+os.mkdir("hooks")
+os.mkdir("info")
+os.symlink(git_update_hook, template_path + 'hooks/update')
+
+with open("description", 'w') as f:
+ f.write("Unnamed repository; push to update the description.\n")
diff --git a/scripts/git-integration/git-serve.py b/scripts/git-integration/git-serve.py
index 6f4d4f95..de9cb59b 100755
--- a/scripts/git-integration/git-serve.py
+++ b/scripts/git-integration/git-serve.py
@@ -19,9 +19,9 @@ aur_db_socket = config.get('database', 'socket')
repo_base_path = config.get('serve', 'repo-base')
repo_regex = config.get('serve', 'repo-regex')
-git_update_hook = config.get('serve', 'git-update-hook')
git_shell_cmd = config.get('serve', 'git-shell-cmd')
ssh_cmdline = config.get('serve', 'ssh-cmdline')
+template_path = config.get('serve', 'template-path')
def repo_path_validate(path):
if not path.startswith(repo_base_path):
@@ -87,8 +87,7 @@ def setup_repo(repo, user):
db.close()
repo_path = repo_base_path + '/' + repo + '.git/'
- pygit2.init_repository(repo_path, True)
- os.symlink(git_update_hook, repo_path + 'hooks/update')
+ pygit2.init_repository(repo_path, True, 48, template_path=template_path)
def check_permissions(pkgbase, user):
db = mysql.connector.connect(host=aur_db_host, user=aur_db_user,
diff --git a/scripts/git-integration/init-repos.py b/scripts/git-integration/init-repos.py
index 62c51b1b..5c4fcfe2 100755
--- a/scripts/git-integration/init-repos.py
+++ b/scripts/git-integration/init-repos.py
@@ -19,7 +19,7 @@ aur_db_socket = config.get('database', 'socket')
repo_base_path = config.get('serve', 'repo-base')
repo_regex = config.get('serve', 'repo-regex')
-git_update_hook = config.get('serve', 'git-update-hook')
+template_path = config.get('serve', 'template-path')
def die(msg):
sys.stderr.write("%s\n" % (msg))
@@ -45,7 +45,6 @@ for repo in repos:
print("[%s/%d] %s" % (str(i).rjust(len(str(n))), n, repo))
repo_path = repo_base_path + '/' + repo + '.git/'
- pygit2.init_repository(repo_path, True)
- os.symlink(git_update_hook, repo_path + 'hooks/update')
+ pygit2.init_repository(repo_path, True, 48, template_path=template_path)
i += 1