about summary refs log tree commit diff
path: root/pkgs/applications/version-management/gitlab/update.py
diff options
context:
space:
mode:
authorMartin Weinelt <mweinelt@users.noreply.github.com>2022-08-12 12:12:54 +0200
committerGitHub <noreply@github.com>2022-08-12 12:12:54 +0200
commit7cc655c69504042a624351046e353f2c89ef107a (patch)
tree589e051659200075a193bcdc1395fc9a66c2623a /pkgs/applications/version-management/gitlab/update.py
parentacfdcba14f4bc6afda9e36f166b30ee4b8e2850b (diff)
parent58bb8ab012e4ca5edf90b8e00a262eb0bd7ffb94 (diff)
Merge pull request #183718 from winterqt/update-gitlab
Diffstat (limited to 'pkgs/applications/version-management/gitlab/update.py')
-rwxr-xr-xpkgs/applications/version-management/gitlab/update.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/pkgs/applications/version-management/gitlab/update.py b/pkgs/applications/version-management/gitlab/update.py
index 4c6ddcde486f7..f862e1aca349c 100755
--- a/pkgs/applications/version-management/gitlab/update.py
+++ b/pkgs/applications/version-management/gitlab/update.py
@@ -15,6 +15,9 @@ from typing import Iterable
 
 import requests
 
+# Always keep this in sync with the GitLaab version you're updating to.
+# If you see any errors about vendored dependencies during an update, check the Gemfile.
+VENDORED_GEMS = ['devise-pbkdf2-encryptable', 'omniauth-gitlab', 'omniauth_crowd', 'mail-smtp_pool', 'ipynbdiff', 'error_tracking_open_api']
 logger = logging.getLogger(__name__)
 
 
@@ -85,7 +88,8 @@ class GitLabRepo:
                     owner=self.owner,
                     repo=self.repo,
                     rev=rev,
-                    passthru=passthru)
+                    passthru=passthru,
+                    vendored_gems=VENDORED_GEMS)
 
 
 def _get_data_json():
@@ -139,15 +143,30 @@ def update_rubyenv():
     data = _get_data_json()
     rev = data['rev']
 
-    with open(rubyenv_dir / 'Gemfile.lock', 'w') as f:
-        f.write(repo.get_file('Gemfile.lock', rev))
+    gemfile = repo.get_file('Gemfile', rev)
+    gemfile_lock = repo.get_file('Gemfile.lock', rev)
+
     with open(rubyenv_dir / 'Gemfile', 'w') as f:
-        original = repo.get_file('Gemfile', rev)
-        f.write(re.sub(r".*mail-smtp_pool.*", "", original))
+        f.write(re.sub(f'.*({"|".join(VENDORED_GEMS)}).*', "", gemfile))
+
+    with open(rubyenv_dir / 'Gemfile.lock', 'w') as f:
+        f.write(gemfile_lock)
 
     subprocess.check_output(['bundle', 'lock'], cwd=rubyenv_dir)
     subprocess.check_output(['bundix'], cwd=rubyenv_dir)
 
+    with open(rubyenv_dir / 'Gemfile', 'w') as f:
+        for gem in VENDORED_GEMS:
+            gemfile = gemfile.replace(f'path: \'vendor/gems/{gem}\'', f'path: \'{gem}\'')
+
+        f.write(gemfile)
+
+    with open(rubyenv_dir / 'Gemfile.lock', 'w') as f:
+        for gem in VENDORED_GEMS:
+            gemfile_lock = gemfile_lock.replace(f'remote: vendor/gems/{gem}', f'remote: {gem}')
+
+        f.write(gemfile_lock)
+
 
 @cli.command('update-gitaly')
 def update_gitaly():