Merge #26877: fetchFromGitHub: fix fetchSubmodules
... when revision is not hexadecimal. (omitting the last commit in PR)
This commit is contained in:
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
|
|||||||
inherit name;
|
inherit name;
|
||||||
|
|
||||||
srcs = [ src robtkSrc ];
|
srcs = [ src robtkSrc ];
|
||||||
sourceRoot = "sisco.lv2-${src.rev}-src";
|
sourceRoot = src.name;
|
||||||
|
|
||||||
buildInputs = [ pkgconfig lv2 pango cairo libjack2 mesa ];
|
buildInputs = [ pkgconfig lv2 pango cairo libjack2 mesa ];
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,9 @@
|
|||||||
{stdenv, git, cacert}: let
|
{stdenv, git, cacert, gitRepoToName}:
|
||||||
urlToName = url: rev: let
|
|
||||||
inherit (stdenv.lib) removeSuffix splitString last;
|
|
||||||
base = last (splitString ":" (baseNameOf (removeSuffix "/" url)));
|
|
||||||
|
|
||||||
matched = builtins.match "(.*).git" base;
|
|
||||||
|
|
||||||
short = builtins.substring 0 7 rev;
|
|
||||||
|
|
||||||
appendShort = if (builtins.match "[a-f0-9]*" rev) != null
|
|
||||||
then "-${short}"
|
|
||||||
else "";
|
|
||||||
in "${if matched == null then base else builtins.head matched}${appendShort}";
|
|
||||||
in
|
|
||||||
{ url, rev ? "HEAD", md5 ? "", sha256 ? "", leaveDotGit ? deepClone
|
{ url, rev ? "HEAD", md5 ? "", sha256 ? "", leaveDotGit ? deepClone
|
||||||
, fetchSubmodules ? true, deepClone ? false
|
, fetchSubmodules ? true, deepClone ? false
|
||||||
, branchName ? null
|
, branchName ? null
|
||||||
, name ? urlToName url rev
|
, name ? gitRepoToName url rev
|
||||||
, # Shell code executed after the file has been fetched
|
, # Shell code executed after the file has been fetched
|
||||||
# successfully. This can do things like check or transform the file.
|
# successfully. This can do things like check or transform the file.
|
||||||
postFetch ? ""
|
postFetch ? ""
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{ lib }:
|
||||||
|
|
||||||
|
urlOrRepo: rev: let
|
||||||
|
inherit (lib) removeSuffix splitString last;
|
||||||
|
base = last (splitString ":" (baseNameOf (removeSuffix "/" urlOrRepo)));
|
||||||
|
|
||||||
|
matched = builtins.match "(.*).git" base;
|
||||||
|
|
||||||
|
short = builtins.substring 0 7 rev;
|
||||||
|
|
||||||
|
appendShort = if (builtins.match "[a-f0-9]*" rev) != null
|
||||||
|
then "-${short}"
|
||||||
|
else "";
|
||||||
|
in "${if matched == null then base else builtins.head matched}${appendShort}"
|
||||||
@@ -282,8 +282,8 @@ _clone_user_rev() {
|
|||||||
if test -z "$(echo "$rev" | tr -d 0123456789abcdef)"; then
|
if test -z "$(echo "$rev" | tr -d 0123456789abcdef)"; then
|
||||||
clone "$dir" "$url" "$rev" "" 1>&2
|
clone "$dir" "$url" "$rev" "" 1>&2
|
||||||
else
|
else
|
||||||
echo 1>&2 "Bad commit hash or bad reference."
|
# if revision is not hexadecimal it might be a tag
|
||||||
exit 1
|
clone "$dir" "$url" "" "refs/tags/$rev" 1>&2
|
||||||
fi;;
|
fi;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ let
|
|||||||
srcs = [ rubySrc rubygemsSrc ];
|
srcs = [ rubySrc rubygemsSrc ];
|
||||||
sourceRoot =
|
sourceRoot =
|
||||||
if useRailsExpress then
|
if useRailsExpress then
|
||||||
"ruby-${tag}-src"
|
rubySrc.name
|
||||||
else
|
else
|
||||||
unpackdir rubySrc;
|
unpackdir rubySrc;
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ let
|
|||||||
sha256 = "1vmbrw686f41n6xfjphfshn96vl07ynvnsyjdw9yfn9bfnldcjcq";
|
sha256 = "1vmbrw686f41n6xfjphfshn96vl07ynvnsyjdw9yfn9bfnldcjcq";
|
||||||
};
|
};
|
||||||
|
|
||||||
srcRoot = "pfixtools-${pfixtoolsSrc.rev}-src";
|
srcRoot = pfixtoolsSrc.name;
|
||||||
|
|
||||||
libCommonSrc = fetchFromGitHub {
|
libCommonSrc = fetchFromGitHub {
|
||||||
owner = "Fruneau";
|
owner = "Fruneau";
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ let
|
|||||||
sha256 = "1cxxzhm36civ6vjdgrk7mfmlzkih44kdii6l2xgy4r434s8rzcpn";
|
sha256 = "1cxxzhm36civ6vjdgrk7mfmlzkih44kdii6l2xgy4r434s8rzcpn";
|
||||||
};
|
};
|
||||||
|
|
||||||
srcRoot = "eMail-${eMailSrc.rev}-src";
|
srcRoot = eMailSrc.name;
|
||||||
|
|
||||||
dlibSrc = fetchFromGitHub {
|
dlibSrc = fetchFromGitHub {
|
||||||
owner = "deanproxy";
|
owner = "deanproxy";
|
||||||
|
|||||||
@@ -185,8 +185,10 @@ with pkgs;
|
|||||||
|
|
||||||
fetchzip = callPackage ../build-support/fetchzip { };
|
fetchzip = callPackage ../build-support/fetchzip { };
|
||||||
|
|
||||||
|
gitRepoToName = callPackage ../build-support/fetchgit/gitrepotoname.nix { };
|
||||||
|
|
||||||
fetchFromGitHub = {
|
fetchFromGitHub = {
|
||||||
owner, repo, rev, name ? "${repo}-${rev}-src",
|
owner, repo, rev, name ? gitRepoToName repo rev,
|
||||||
fetchSubmodules ? false, private ? false,
|
fetchSubmodules ? false, private ? false,
|
||||||
githubBase ? "github.com", varPrefix ? null,
|
githubBase ? "github.com", varPrefix ? null,
|
||||||
... # For hash agility
|
... # For hash agility
|
||||||
@@ -223,7 +225,7 @@ with pkgs;
|
|||||||
} // passthruAttrs) // { inherit rev; };
|
} // passthruAttrs) // { inherit rev; };
|
||||||
|
|
||||||
fetchFromBitbucket = {
|
fetchFromBitbucket = {
|
||||||
owner, repo, rev, name ? "${repo}-${rev}-src",
|
owner, repo, rev, name ? gitRepoToName repo rev,
|
||||||
... # For hash agility
|
... # For hash agility
|
||||||
}@args: fetchzip ({
|
}@args: fetchzip ({
|
||||||
inherit name;
|
inherit name;
|
||||||
@@ -234,7 +236,7 @@ with pkgs;
|
|||||||
|
|
||||||
# cgit example, snapshot support is optional in cgit
|
# cgit example, snapshot support is optional in cgit
|
||||||
fetchFromSavannah = {
|
fetchFromSavannah = {
|
||||||
repo, rev, name ? "${repo}-${rev}-src",
|
repo, rev, name ? gitRepoToName repo rev,
|
||||||
... # For hash agility
|
... # For hash agility
|
||||||
}@args: fetchzip ({
|
}@args: fetchzip ({
|
||||||
inherit name;
|
inherit name;
|
||||||
@@ -244,7 +246,7 @@ with pkgs;
|
|||||||
|
|
||||||
# gitlab example
|
# gitlab example
|
||||||
fetchFromGitLab = {
|
fetchFromGitLab = {
|
||||||
owner, repo, rev, name ? "${repo}-${rev}-src",
|
owner, repo, rev, name ? gitRepoToName repo rev,
|
||||||
... # For hash agility
|
... # For hash agility
|
||||||
}@args: fetchzip ({
|
}@args: fetchzip ({
|
||||||
inherit name;
|
inherit name;
|
||||||
@@ -254,7 +256,7 @@ with pkgs;
|
|||||||
|
|
||||||
# gitweb example, snapshot support is optional in gitweb
|
# gitweb example, snapshot support is optional in gitweb
|
||||||
fetchFromRepoOrCz = {
|
fetchFromRepoOrCz = {
|
||||||
repo, rev, name ? "${repo}-${rev}-src",
|
repo, rev, name ? gitRepoToName repo rev,
|
||||||
... # For hash agility
|
... # For hash agility
|
||||||
}@args: fetchzip ({
|
}@args: fetchzip ({
|
||||||
inherit name;
|
inherit name;
|
||||||
|
|||||||
Reference in New Issue
Block a user