Allow slashes in status-go branch names

Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
This commit is contained in:
Pedro Pombeiro 2019-11-28 17:43:28 +01:00
parent 572e028f32
commit 68508a1500
No known key found for this signature in database
GPG Key ID: C4A24185B2AA48A1
3 changed files with 11 additions and 7 deletions

View File

@ -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,

View File

@ -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

View File

@ -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";