Skip to content

Commit

Permalink
Merge pull request #205115 from hraban/fetchdarcs-by-hash
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 authored Mar 14, 2023
2 parents 61aaaa5 + 1f9b92b commit 112654f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
10 changes: 7 additions & 3 deletions pkgs/build-support/fetchdarcs/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,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

Expand Down
11 changes: 8 additions & 3 deletions pkgs/build-support/fetchdarcs/default.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
{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];

outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = sha256;

inherit url rev context;
inherit url rev context name;
}

0 comments on commit 112654f

Please sign in to comment.