diff options
Diffstat (limited to 'nixpkgs/pkgs/applications/version-management/gitlab/update.py')
-rwxr-xr-x | nixpkgs/pkgs/applications/version-management/gitlab/update.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/nixpkgs/pkgs/applications/version-management/gitlab/update.py b/nixpkgs/pkgs/applications/version-management/gitlab/update.py index a2a3a6d05b7..4c7bcefacb0 100755 --- a/nixpkgs/pkgs/applications/version-management/gitlab/update.py +++ b/nixpkgs/pkgs/applications/version-management/gitlab/update.py @@ -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 vgo2nix yarn2nix +#! nix-shell -i python3 -p bundix bundler common-updater-scripts nix nix-prefetch-git python3 python3Packages.requests python3Packages.click python3Packages.click-log vgo2nix yarn2nix import click import click_log @@ -13,7 +13,6 @@ from distutils.version import LooseVersion from typing import Iterable import requests -from xml.etree import ElementTree logger = logging.getLogger(__name__) @@ -30,12 +29,11 @@ class GitLabRepo: @property def tags(self) -> Iterable[str]: - r = requests.get(self.url + "/tags?format=atom", stream=True) + r = requests.get(self.url + "/refs?sort=updated_desc&ref=master").json() + tags = r.get("Tags", []) - tree = ElementTree.fromstring(r.content) - versions = [e.text for e in tree.findall('{http://www.w3.org/2005/Atom}entry/{http://www.w3.org/2005/Atom}title')] # filter out versions not matching version_regex - versions = list(filter(self.version_regex.match, versions)) + versions = list(filter(self.version_regex.match, tags)) # sort, but ignore v and -ee for sorting comparisons versions.sort(key=lambda x: LooseVersion(x.replace("v", "").replace("-ee", "")), reverse=True) @@ -100,7 +98,7 @@ def cli(): @cli.command('update-data') -@click.option('--rev', default='latest', help='The rev to use, \'latest\' points to the latest (stable) tag') +@click.option('--rev', default='latest', help='The rev to use (vX.Y.Z-ee), or \'latest\'') def update_data(rev: str): """Update data.nix""" repo = GitLabRepo() @@ -135,6 +133,7 @@ def update_rubyenv(): with open(rubyenv_dir / fn, 'w') as f: f.write(repo.get_file(fn, rev)) + subprocess.check_output(['bundle', 'lock'], cwd=rubyenv_dir) subprocess.check_output(['bundix'], cwd=rubyenv_dir) @@ -174,6 +173,7 @@ def update_gitaly(): with open(gitaly_dir / fn, 'w') as f: f.write(repo.get_file(fn, f"v{gitaly_server_version}")) + subprocess.check_output(['bundle', 'lock'], cwd=gitaly_dir) subprocess.check_output(['bundix'], cwd=gitaly_dir) os.environ['GOROOT'] = "" @@ -227,10 +227,11 @@ def update_gitlab_workhorse(): os.unlink(gitlab_workhorse_dir / fn) @cli.command('update-all') +@click.option('--rev', default='latest', help='The rev to use (vX.Y.Z-ee), or \'latest\'') @click.pass_context -def update_all(ctx): +def update_all(ctx, rev: str): """Update all gitlab components to the latest stable release""" - ctx.invoke(update_data, rev='latest') + ctx.invoke(update_data, rev=rev) ctx.invoke(update_rubyenv) ctx.invoke(update_yarnpkgs) ctx.invoke(update_gitaly) |