From 3ddd53e57618ac45c5e78e530c688e77fd459b8d Mon Sep 17 00:00:00 2001 From: Marius Bergmann Date: Wed, 6 Nov 2019 00:19:08 +0100 Subject: [PATCH] terraform-providers: fix handling of version/rev in provider list I interpreted the purpose of stripping the first character from the 'version' argument as an attempt to remove a prefixed 'v' (e.g. 'v1.0.0') from a version tag. This works if the tag actually has a 'v' prefix, but also removes the first character if version tags are not prefixed (e.g. '1.0.0'). Additionally, the 'v' was added again when specifying the `rev` for `fetchFromGitHub` in default.nix. As described above, this did also not work when provider repos did not prefix their version tags with 'v'. I changed the implementation as follows: - `version` and `rev` are stored inside data.nix - `version` is used to declare the nix package version - `rev` is used to fetch the proper git ref when building the package - for determining `version`, an optional leading 'v' is trimmed from the tag name Now this has the implication that the latest tag must always be a release tag when using the `update-all` script, but as the result of running `update-all` should always be reviewed before submission, makes this appear a manageable tradeoff to me. --- .../networking/cluster/terraform-providers/default.nix | 5 ++--- .../networking/cluster/terraform-providers/update-all | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/networking/cluster/terraform-providers/default.nix b/pkgs/applications/networking/cluster/terraform-providers/default.nix index 83157c90a48..6298c25ba25 100644 --- a/pkgs/applications/networking/cluster/terraform-providers/default.nix +++ b/pkgs/applications/networking/cluster/terraform-providers/default.nix @@ -9,13 +9,12 @@ let toDrv = data: buildGoPackage rec { - inherit (data) owner repo version sha256; + inherit (data) owner repo rev version sha256; name = "${repo}-${version}"; goPackagePath = "github.com/${owner}/${repo}"; subPackages = [ "." ]; src = fetchFromGitHub { - inherit owner repo sha256; - rev = "v${version}"; + inherit owner repo rev sha256; }; diff --git a/pkgs/applications/networking/cluster/terraform-providers/update-all b/pkgs/applications/networking/cluster/terraform-providers/update-all index 2009d474db7..893a6b1c7d7 100755 --- a/pkgs/applications/networking/cluster/terraform-providers/update-all +++ b/pkgs/applications/networking/cluster/terraform-providers/update-all @@ -58,12 +58,14 @@ prefetch_github() { echo_entry() { local owner=$1 local repo=$2 - local version=${3:1} + local rev=$3 + local version=$(echo $3 | sed 's/^v//') local sha256=$4 cat <