fetchgit: improve name detection, discard nix-1.8 check
The name detection didn't work for e.g. http://git.suckless.org/sinit/. I tested the tarball builds now. @shlevy claimed nixpkgs requires nix-1.8 features anyway, so the additional check with message were superfluous.
This commit is contained in:
parent
7d1d89e532
commit
77d66ed834
@ -1,10 +1,8 @@
|
|||||||
{stdenv, git, cacert}: let
|
{stdenv, git, cacert}: let
|
||||||
urlToName = url: rev: let
|
urlToName = url: rev: let
|
||||||
base = baseNameOf url;
|
base = baseNameOf (stdenv.lib.removeSuffix "/" url);
|
||||||
|
|
||||||
matched = (builtins.match or (x: y:
|
matched = builtins.match "(.*).git" base;
|
||||||
abort "This version of fetchgit requires Nix >= 1.8, please upgrade!"
|
|
||||||
)) "(.*).git" base;
|
|
||||||
|
|
||||||
short = builtins.substring 0 7 rev;
|
short = builtins.substring 0 7 rev;
|
||||||
|
|
||||||
@ -12,7 +10,8 @@
|
|||||||
then "-${short}"
|
then "-${short}"
|
||||||
else "";
|
else "";
|
||||||
in "${if matched == null then base else builtins.head matched}${appendShort}";
|
in "${if matched == null then base else builtins.head matched}${appendShort}";
|
||||||
in {url, rev ? "HEAD", md5 ? "", sha256 ? "", leaveDotGit ? false
|
in
|
||||||
|
{ url, rev ? "HEAD", md5 ? "", sha256 ? "", leaveDotGit ? false
|
||||||
, fetchSubmodules ? true
|
, fetchSubmodules ? true
|
||||||
, name ? urlToName url rev
|
, name ? urlToName url rev
|
||||||
}:
|
}:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user