3
0
Fork 0
forked from mirrors/nixpkgs

fetchdarcs: fetch by commit hash

This commit is contained in:
Hraban Luyat 2022-12-05 14:49:37 -05:00
parent 671be4403c
commit 1f9b92b0e6
2 changed files with 15 additions and 6 deletions

View file

@ -2,11 +2,15 @@ source $stdenv/setup
tagtext=""
tagflags=""
if test -n "$rev"; then
tagtext="(tag $rev) "
# Darcs hashes are sha1 (120 bits, 40-character hex)
if [[ "$rev" =~ [a-fA-F0-9]{40} ]]; then
tagtext="(hash $rev)"
tagflags="--to-hash=$rev"
elif test -n "$rev"; then
tagtext="(tag $rev)"
tagflags="--tag=$rev"
elif test -n "$context"; then
tagtext="(context) "
tagtext="(context)"
tagflags="--context=$context"
fi

View file

@ -1,12 +1,17 @@
{stdenvNoCC, darcs, cacert}:
{url, rev ? null, context ? null, md5 ? "", sha256 ? ""}:
{ url
, rev ? null
, context ? null
, md5 ? ""
, sha256 ? ""
, name ? "fetchdarcs"
}:
if md5 != "" then
throw "fetchdarcs does not support md5 anymore, please use sha256"
else
stdenvNoCC.mkDerivation {
name = "fetchdarcs";
builder = ./builder.sh;
nativeBuildInputs = [cacert darcs];
@ -14,5 +19,5 @@ stdenvNoCC.mkDerivation {
outputHashMode = "recursive";
outputHash = sha256;
inherit url rev context;
inherit url rev context name;
}