[tor-commits] [gettor/master] Change gitlab repository name to include version

cohosh at torproject.org cohosh at torproject.org
Wed Mar 11 16:47:05 UTC 2020


commit 0297dbcddbda4085e30c6923d4d744792f59914e
Author: Cecylia Bocovich <cohosh at torproject.org>
Date:   Wed Mar 4 17:18:55 2020 -0500

    Change gitlab repository name to include version
    
    This fixes an issue caused by gitlab repositories soft-delete for 7 days
    before they are fully deleted. If we remove a repository in order
    to upload new binaries, we need to be able to create a new one right
    away. See https://bugs.torproject.org/33034
---
 scripts/add_links_to_db |  5 +++--
 scripts/update_git      | 18 +++++++++++++-----
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/scripts/add_links_to_db b/scripts/add_links_to_db
index 039bc4f..4078bf0 100755
--- a/scripts/add_links_to_db
+++ b/scripts/add_links_to_db
@@ -73,7 +73,7 @@ def main():
     # For gitlab, we have three repositories for linux, mac, and windows.
     # The string "arch" will later be replaced with the respective architecture
     providers = {
-        "gitlab": "https://gitlab.com/thetorproject/torbrowser-arch/raw/master/",
+        "gitlab": "https://gitlab.com/thetorproject/torbrowser-version-arch/raw/master/",
         "github": "https://github.com/torproject/torbrowser-releases/releases/download/torbrowser-release/"
     }
 
@@ -148,7 +148,8 @@ def main():
                     c.execute(
                         "INSERT INTO links(link, platform, language, arch, version, provider, status, file)"
                         "VALUES ('%s', '%s', '%s', '64', '%s', '%s', 'ACTIVE', '%s')"
-                        % (providers.get(p).replace("arch", k) + release_link, k, l, version, p, release_link))
+                        % (providers.get(p).replace("arch", k).replace("version", version) +
+                            release_link, k, l, version, p, release_link))
 
 
 if __name__ == "__main__":
diff --git a/scripts/update_git b/scripts/update_git
index 4861baf..722e29d 100755
--- a/scripts/update_git
+++ b/scripts/update_git
@@ -24,6 +24,9 @@ failure = False
 
 failed_uploads = []
 
+version = None
+data = None
+
 class GitlabRemote:
     def __init__(self, token):
         self.gl = Gitlab("https://gitlab.com", private_token=token)
@@ -35,11 +38,11 @@ class GitlabRemote:
 
     def create_projects(self):
         # Create one project for each platform
-        windows_repo = self.gl.projects.create({'name': 'torbrowser-windows',
+        windows_repo = self.gl.projects.create({'name': 'torbrowser-'+version+'-windows',
             'visibility': 'public'})
-        mac_repo = self.gl.projects.create({'name': 'torbrowser-osx',
+        mac_repo = self.gl.projects.create({'name': 'torbrowser-'+version+'-osx',
             'visibility': 'public'})
-        linux_repo = self.gl.projects.create({'name': 'torbrowser-linux',
+        linux_repo = self.gl.projects.create({'name': 'torbrowser-'+version+'-linux',
             'visibility': 'public'})
 
         self.repositories = {
@@ -93,8 +96,6 @@ def upload_files(remotes):
         print("Error: No remotes to update", file=sys.stderr)
         return 1
 
-    url = urllib.request.urlopen("https://aus1.torproject.org/torbrowser/update_3/release/downloads.json")
-    data = json.loads(url.read().decode())
     for arch in data['downloads']:
         for locale in data['downloads'][arch]:
             for asset in data['downloads'][arch][locale]:
@@ -133,6 +134,13 @@ def upload_files(remotes):
 
 
 def main():
+    global version
+    global data
+
+    url = urllib.request.urlopen("https://aus1.torproject.org/torbrowser/update_3/release/downloads.json")
+    data = json.loads(url.read().decode())
+    version = data["version"]
+
     remotes = []
     if 'GITHUB_AUTH' not in os.environ:
         print("WARNING: No Github authentication token given", file=sys.stderr)



More information about the tor-commits mailing list