diff options
author | Sandro <sandro.jaeckel@gmail.com> | 2023-03-14 01:25:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-14 01:25:22 +0100 |
commit | 112654fc41a10672b6dd7a3c0d0a3a577350c148 (patch) | |
tree | e7527d2cd5f9e7002621cbf9f9c97c8c9fbfce3f | |
parent | 61aaaa5b49082e5b7396987f90a0eadf372fa415 (diff) | |
parent | 1f9b92b0e6f2dd073f1863d95fd6587448415214 (diff) | |
download | nixpkgs-112654fc41a10672b6dd7a3c0d0a3a577350c148.tar nixpkgs-112654fc41a10672b6dd7a3c0d0a3a577350c148.tar.gz nixpkgs-112654fc41a10672b6dd7a3c0d0a3a577350c148.tar.bz2 nixpkgs-112654fc41a10672b6dd7a3c0d0a3a577350c148.tar.lz nixpkgs-112654fc41a10672b6dd7a3c0d0a3a577350c148.tar.xz nixpkgs-112654fc41a10672b6dd7a3c0d0a3a577350c148.tar.zst nixpkgs-112654fc41a10672b6dd7a3c0d0a3a577350c148.zip |
Merge pull request #205115 from hraban/fetchdarcs-by-hash
-rw-r--r-- | pkgs/build-support/fetchdarcs/builder.sh | 10 | ||||
-rw-r--r-- | pkgs/build-support/fetchdarcs/default.nix | 11 |
2 files changed, 15 insertions, 6 deletions
diff --git a/pkgs/build-support/fetchdarcs/builder.sh b/pkgs/build-support/fetchdarcs/builder.sh index ce5537f46f4..75b9066dba6 100644 --- a/pkgs/build-support/fetchdarcs/builder.sh +++ b/pkgs/build-support/fetchdarcs/builder.sh @@ -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 diff --git a/pkgs/build-support/fetchdarcs/default.nix b/pkgs/build-support/fetchdarcs/default.nix index 02777c9900d..ae38edee4fd 100644 --- a/pkgs/build-support/fetchdarcs/default.nix +++ b/pkgs/build-support/fetchdarcs/default.nix @@ -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; } |