gitlab: add gitaly go mod handling for the updater

This commit is contained in:
Robin Gloster 2019-07-16 01:18:11 +02:00
parent 6c98b0ff43
commit 722ee7756b
No known key found for this signature in database
GPG Key ID: D5C458DF6DD97EDF

View File

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#! nix-shell -i python3 -p bundix common-updater-scripts nix nix-prefetch-git python3 python3Packages.requests python3Packages.lxml python3Packages.click python3Packages.click-log
#! nix-shell -i python3 -p bundix common-updater-scripts nix nix-prefetch-git python3 python3Packages.requests python3Packages.lxml python3Packages.click python3Packages.click-log vgo2nix
import click
import click_log
@ -194,13 +194,21 @@ def update_gitaly():
data = _get_data_json()
gitaly_server_version = data['ce']['passthru']['GITALY_SERVER_VERSION']
r = GitLabRepo('gitlab-org', 'gitaly')
rubyenv_dir = pathlib.Path(__file__).parent / 'gitaly'
gitaly_dir = pathlib.Path(__file__).parent / 'gitaly'
for fn in ['Gemfile.lock', 'Gemfile']:
with open(rubyenv_dir / fn, 'w') as f:
with open(gitaly_dir / fn, 'w') as f:
f.write(r.get_file(f"ruby/{fn}", f"v{gitaly_server_version}"))
subprocess.check_output(['bundix'], cwd=rubyenv_dir)
for fn in ['go.mod', 'go.sum']:
with open(gitaly_dir / fn, 'w') as f:
f.write(r.get_file(fn, f"v{gitaly_server_version}"))
subprocess.check_output(['bundix'], cwd=gitaly_dir)
subprocess.check_output(['vgo2nix'], cwd=gitaly_dir)
for fn in ['go.mod', 'go.sum']:
os.unlink(gitaly_dir / fn)
# currently broken, as `gitaly.meta.position` returns
# pkgs/development/go-modules/generic/default.nix
# so update-source-version doesn't know where to update hashes