From 68508a1500c0cab68ae7e551f446ff55a3a663dd Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Thu, 28 Nov 2019 17:43:28 +0100 Subject: [PATCH] Allow slashes in status-go branch names Signed-off-by: Pedro Pombeiro --- nix/status-go/build-mobile-status-go.nix | 2 +- nix/status-go/build-status-go.nix | 6 +++--- nix/status-go/default.nix | 10 +++++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/nix/status-go/build-mobile-status-go.nix b/nix/status-go/build-mobile-status-go.nix index 9e03c32f4b..d10e4e503b 100644 --- a/nix/status-go/build-mobile-status-go.nix +++ b/nix/status-go/build-mobile-status-go.nix @@ -2,7 +2,7 @@ { stdenv, utils, callPackage, buildGoPackage, go, gomobile, openjdk, xcodeWrapper }: -{ owner, repo, rev, version, goPackagePath, src, host, +{ owner, repo, rev, version, sanitizedVersion, goPackagePath, src, host, # mobile-only arguments goBuildFlags, goBuildLdFlags, diff --git a/nix/status-go/build-status-go.nix b/nix/status-go/build-status-go.nix index 66d74fc1e0..968bffa29c 100644 --- a/nix/status-go/build-status-go.nix +++ b/nix/status-go/build-status-go.nix @@ -1,6 +1,6 @@ { buildGoPackage, go, xcodeWrapper, stdenv, utils }: -{ owner, repo, rev, version, goPackagePath, src, host, +{ owner, repo, rev, version, sanitizedVersion, goPackagePath, src, host, nativeBuildInputs ? [], buildPhase, buildMessage, installPhase ? "", @@ -19,7 +19,7 @@ let args = removeAttrs args' [ "buildMessage" ]; # Remove our arguments from args before passing them on to buildGoPackage buildStatusGo = buildGoPackage (args // { pname = repo; - version = "${version}-${strings.substring 0 7 rev}-${host}"; + version = "${sanitizedVersion}-${strings.substring 0 7 rev}-${host}"; nativeBuildInputs = nativeBuildInputs ++ @@ -58,7 +58,7 @@ let return # make sure we stop fixup so as to not allow the host preFixup script to proceed ''; - passthru = { inherit owner version rev; }; + passthru = { inherit owner repo version rev; }; meta = { # Add default meta information diff --git a/nix/status-go/default.nix b/nix/status-go/default.nix index fbe9e964bf..538fdc0ff1 100644 --- a/nix/status-go/default.nix +++ b/nix/status-go/default.nix @@ -43,13 +43,17 @@ let versionJSON = importJSON ../../status-go-version.json; # TODO: Simplify this path search with lib.locateDominatingFile versionRegex = "^v?[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+(-[[:alnum:].]+)$"; sha256 = versionJSON.src-sha256; + sanitizeVersion = builtins.replaceStrings + [ "/" ] + [ "_" ]; in rec { inherit (versionJSON) owner repo version; + sanitizedVersion = sanitizeVersion versionJSON.version; goPackagePath = "github.com/${owner}/${repo}"; rev = versionJSON.commit-sha1; shortRev = strings.substring 0 7 rev; - versionName = if (builtins.match versionRegex version) != null - then removePrefix "v" version # Geth forces a 'v' prefix + versionName = if (builtins.match versionRegex sanitizedVersion) != null + then removePrefix "v" sanitizedVersion # Geth forces a 'v' prefix else "develop"; # to reduce metrics cardinality in Prometheus src = fetchFromGitHub { inherit rev owner repo sha256; name = "${repo}-${srcData.shortRev}-source"; }; }; @@ -100,7 +104,7 @@ let "-w" # -w disables DWARF debugging information ]; - statusGoArgs = { inherit (srcData) src owner repo rev version goPackagePath; inherit goBuildFlags goBuildLdFlags; }; + statusGoArgs = { inherit (srcData) src owner repo rev version sanitizedVersion goPackagePath; inherit goBuildFlags goBuildLdFlags; }; status-go-packages = { desktop = buildStatusGoDesktopLib (statusGoArgs // { outputFileName = "libstatus.a";