summaryrefslogtreecommitdiffstats
path: root/pkgs/applications/version-management/gitlab/update.py
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/version-management/gitlab/update.py')
-rwxr-xr-xpkgs/applications/version-management/gitlab/update.py46
1 files changed, 12 insertions, 34 deletions
diff --git a/pkgs/applications/version-management/gitlab/update.py b/pkgs/applications/version-management/gitlab/update.py
index 0f322a5d375e..266ca3e4cebd 100755
--- a/pkgs/applications/version-management/gitlab/update.py
+++ b/pkgs/applications/version-management/gitlab/update.py
@@ -15,22 +15,6 @@ 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 = [
- "bundler-checksum",
- "devise-pbkdf2-encryptable",
- "omniauth-azure-oauth2",
- "omniauth-cas3",
- "omniauth-gitlab",
- "omniauth_crowd",
- "omniauth-salesforce",
- "attr_encrypted",
- "mail-smtp_pool",
- "microsoft_graph_mailer",
- "ipynbdiff",
- "error_tracking_open_api",
-]
logger = logging.getLogger(__name__)
@@ -101,8 +85,7 @@ class GitLabRepo:
owner=self.owner,
repo=self.repo,
rev=rev,
- passthru=passthru,
- vendored_gems=VENDORED_GEMS)
+ passthru=passthru)
def _get_data_json():
@@ -155,30 +138,25 @@ def update_rubyenv():
# load rev from data.json
data = _get_data_json()
rev = data['rev']
+ version = data['version']
- gemfile = repo.get_file('Gemfile', rev)
- gemfile_lock = repo.get_file('Gemfile.lock', rev)
+ for fn in ['Gemfile.lock', 'Gemfile']:
+ with open(rubyenv_dir / fn, 'w') as f:
+ f.write(repo.get_file(fn, rev))
- with open(rubyenv_dir / 'Gemfile', 'w') as f:
- f.write(re.sub(f'.*({"|".join(VENDORED_GEMS)}).*', "", gemfile))
+ # Fetch vendored dependencies temporarily in order to build the gemset.nix
+ subprocess.check_output(['mkdir', '-p', 'vendor/gems'], cwd=rubyenv_dir)
+ subprocess.check_output(['sh', '-c', f'curl -L https://gitlab.com/gitlab-org/gitlab/-/archive/v{version}-ee/gitlab-v{version}-ee.tar.bz2?path=vendor/gems | tar -xj --strip-components=3'], cwd=f'{rubyenv_dir}/vendor/gems')
- with open(rubyenv_dir / 'Gemfile.lock', 'w') as f:
- f.write(gemfile_lock)
+ # Undo our gemset.nix patches so that bundix runs through
+ subprocess.check_output(['sed', '-i', '-e', '1d', '-e', 's:\\${src}/::g' , 'gemset.nix'], cwd=rubyenv_dir)
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}')
+ subprocess.check_output(['sed', '-i', '-e', '1i\\src:', '-e', 's:path = \\(vendor/[^;]*\\);:path = "${src}/\\1";:g', 'gemset.nix'], cwd=rubyenv_dir)
+ subprocess.check_output(['rm', '-rf', 'vendor'], cwd=rubyenv_dir)
- f.write(gemfile_lock)
@cli.command('update-gitaly')