mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
fetchgit: add preFetch hook (#404488)
This commit is contained in:
commit
3fd3d5bc7b
3 changed files with 14 additions and 2 deletions
|
@ -773,9 +773,14 @@ Additionally, the following optional arguments can be given:
|
||||||
|
|
||||||
: Whether to fetch LFS objects.
|
: Whether to fetch LFS objects.
|
||||||
|
|
||||||
|
*`preFetch`* (String)
|
||||||
|
|
||||||
|
: Shell code to be executed before the repository has been fetched, to allow
|
||||||
|
changing the environment the fetcher runs in.
|
||||||
|
|
||||||
*`postFetch`* (String)
|
*`postFetch`* (String)
|
||||||
|
|
||||||
: Shell code executed after the file has been fetched successfully.
|
: Shell code executed after the repository has been fetched successfully.
|
||||||
This can do things like check or transform the file.
|
This can do things like check or transform the file.
|
||||||
|
|
||||||
*`leaveDotGit`* (Boolean)
|
*`leaveDotGit`* (Boolean)
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
echo "exporting $url (rev $rev) into $out"
|
echo "exporting $url (rev $rev) into $out"
|
||||||
|
|
||||||
|
runHook preFetch
|
||||||
|
|
||||||
$SHELL $fetcher --builder --url "$url" --out "$out" --rev "$rev" --name "$name" \
|
$SHELL $fetcher --builder --url "$url" --out "$out" --rev "$rev" --name "$name" \
|
||||||
${leaveDotGit:+--leave-dotGit} \
|
${leaveDotGit:+--leave-dotGit} \
|
||||||
${fetchLFS:+--fetch-lfs} \
|
${fetchLFS:+--fetch-lfs} \
|
||||||
|
|
|
@ -38,6 +38,11 @@ lib.makeOverridable (
|
||||||
nonConeMode ? false,
|
nonConeMode ? false,
|
||||||
name ? null,
|
name ? null,
|
||||||
nativeBuildInputs ? [ ],
|
nativeBuildInputs ? [ ],
|
||||||
|
# Shell code executed before the file has been fetched. This, in
|
||||||
|
# particular, can do things like set NIX_PREFETCH_GIT_CHECKOUT_HOOK to
|
||||||
|
# run operations between the checkout completing and deleting the .git
|
||||||
|
# directory.
|
||||||
|
preFetch ? "",
|
||||||
# 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 ? "",
|
||||||
|
@ -75,7 +80,6 @@ lib.makeOverridable (
|
||||||
server admins start using the new version?
|
server admins start using the new version?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
assert deepClone -> leaveDotGit;
|
|
||||||
assert nonConeMode -> (sparseCheckout != [ ]);
|
assert nonConeMode -> (sparseCheckout != [ ]);
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -130,6 +134,7 @@ lib.makeOverridable (
|
||||||
deepClone
|
deepClone
|
||||||
branchName
|
branchName
|
||||||
nonConeMode
|
nonConeMode
|
||||||
|
preFetch
|
||||||
postFetch
|
postFetch
|
||||||
;
|
;
|
||||||
rev = revWithTag;
|
rev = revWithTag;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue