[sysadmin-bin] Adapt for hashed storage layout



commit ff695ae2caa096bb176447acbf7b7243f1c7326f
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Tue Jul 14 13:00:07 2020 +0200

    Adapt for hashed storage layout

 git/post-receive-mirror-github | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
---
diff --git a/git/post-receive-mirror-github b/git/post-receive-mirror-github
index f60c579..afa19d6 100755
--- a/git/post-receive-mirror-github
+++ b/git/post-receive-mirror-github
@@ -40,7 +40,7 @@ from email.mime.text import MIMEText
 import tempfile
 import json
 
-from git import get_project_head_name, get_project_branches
+from git import get_project_head_name, get_project_branches, get_module_name
 
 ORGANIZATION="GNOME"
 ADDITIONAL_ORGANIZATIONS={"pitivi": ["pitivi"]}
@@ -50,8 +50,8 @@ class GitHub:
     def __init__(self, organization):
         self.organization = organization
 
-        allowed_paths = ['/var/opt/gitlab/git-data/repositories/GNOME', 
'/var/opt/gitlab/git-data/repositories/Infrastructure']
-        if os.path.dirname(os.getcwd()) not in allowed_paths:
+        namespace = os.getenv('NAMESPACE')
+        if namespace not in ('GNOME', 'Infrastructure'):
             sys.exit(1)
 
         config = ConfigParser.ConfigParser()
@@ -145,14 +145,6 @@ class GitHub:
         return name
 
 
-def get_repo_name():
-    repo_name = os.getcwd().split("/")[-1]
-    if repo_name == ".git":
-        repo_name = os.getcwd().split("/")[-2]
-    elif repo_name.endswith(".git"):
-        repo_name = repo_name[0:-4]
-    return repo_name
-
 def get_doap_settings(repo_name):
     nss = {'doap': 'http://usefulinc.com/ns/doap#',
            'rdf':  'http://www.w3.org/1999/02/22-rdf-syntax-ns#'}
@@ -212,7 +204,7 @@ stderr: {}
 
 
 def main():
-    repo_name = get_repo_name()
+    repo_name = get_module_name()
     if repo_name.endswith('.wiki'):
         sys.exit(1)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]