fetchbower: clean common uri characters from version string

Some bower.json files have URL dependencies missing a version.

Fixes rvl/bower2nix#18
This commit is contained in:
Rodney Lorrimar 2017-10-29 22:07:48 +00:00 committed by Domen Kožar
parent 0a5ecde808
commit 9b0d50e3d0

View file

@ -4,13 +4,13 @@ let
let
components = lib.splitString "#" version;
hash = lib.last components;
ver = if builtins.length components == 1 then version else hash;
ver = if builtins.length components == 1 then (cleanName version) else hash;
in ver;
bowerName = name: lib.replaceStrings ["/"] ["-"] name;
cleanName = name: lib.replaceStrings ["/" ":"] ["-" "-"] name;
fetchbower = name: version: target: outputHash: stdenv.mkDerivation {
name = "${bowerName name}-${bowerVersion version}";
name = "${cleanName name}-${bowerVersion version}";
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
buildCommand = ''
fetch-bower --quiet --out=$PWD/out "${name}" "${target}" "${version}"