8 hashType
=$NIX_HASH_ALGO
9 if test -z "$hashType"; then
13 if test -z "$cvsRoot"; then
14 echo "syntax: nix-prefetch-cvs CVSROOT MODULE [TAG [HASH]]" >&2
16 elif test -z "$module"; then
17 echo "syntax: nix-prefetch-cvs CVSROOT MODULE [TAG [HASH]]" >&2
23 tmpPath
="$(mktemp -d "${TMPDIR:-/tmp}/nix-prefetch-cvs-XXXXXXXX
")"
24 trap removeTempDir EXIT
32 # If the hash was given, a file with that hash may already be in the
34 if test -n "$expHash"; then
35 finalPath
=$
(nix-store
--print-fixed-path --recursive "$hashType" "$expHash" cvs-export
)
36 if ! nix-store
--check-validity "$finalPath" 2> /dev
/null
; then
43 # If we don't know the hash or a path with that hash doesn't exist,
44 # download the file and add it to the store.
45 if test -z "$finalPath"; then
48 tmpFile
=$tmpPath/cvs-export
51 # Perform the checkout.
52 if test -z "$tag"; then
54 elif test "$USE_DATE" = "1"; then
59 (cd "$tmpPath" && cvs
-f -z0 -d $cvsRoot export "${args[*]}" -d cvs-export
$module >&2)
62 hash=$
(nix-hash
--type $hashType ${hashFormat:-"--sri"} $tmpFile)
63 if ! test -n "$QUIET"; then echo "hash is $hash" >&2; fi
65 # Add the downloaded file to the Nix store.
66 finalPath
=$
(nix-store
--add-fixed --recursive "$hashType" $tmpFile)
68 if test -n "$expHash" -a "$expHash" != "$hash"; then
69 echo "hash mismatch for CVS root \`$cvsRoot'"
74 if ! test -n "$QUIET"; then echo "path is $finalPath" >&2; fi
78 if test -n "$PRINT_PATH"; then