diff options
author | Florian Klink <flokli@flokli.de> | 2020-04-30 23:50:28 +0200 |
---|---|---|
committer | Florian Klink <flokli@flokli.de> | 2020-05-01 00:13:43 +0200 |
commit | fc64bca95b27cf82e7c185b3a1723b326b0c20e7 (patch) | |
tree | 13d85be40917e41d3165cfcaf47c5e761f9e3697 /pkgs/applications/version-management/gitlab | |
parent | fdd0d0de1f0cc35937296ccee4bc6c99f63f657b (diff) |
gitlab: update.py: use the /refs endpoint
It seems the atom feed now needs authentication. Use the /refs endpoint, which is used for the switch branch/tag dropdown. It doesn't show all records, but has some pagination, but works well enough for now.
Diffstat (limited to 'pkgs/applications/version-management/gitlab')
-rwxr-xr-x | pkgs/applications/version-management/gitlab/update.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/pkgs/applications/version-management/gitlab/update.py b/pkgs/applications/version-management/gitlab/update.py index a128fd5bc4097..4c7bcefacb0d7 100755 --- a/pkgs/applications/version-management/gitlab/update.py +++ b/pkgs/applications/version-management/gitlab/update.py @@ -1,5 +1,5 @@ #!/usr/bin/env nix-shell -#! nix-shell -i python3 -p bundix bundler 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) |