fetchSvn: Add support for --ignore-keywords flag

This is a flag that disables subversion keyword substitution.
Keyword substitution inserts metadata into the files being checked
out, and is therefore somewhat at odds with build reproducibility.

In particular, it can become a problem if you're trying to switch
between svn and a git export of the same thing (keyword substitutions
are normally not exported into git).
This commit is contained in:
Arseniy Alekseyev 2017-03-13 03:02:33 +00:00
parent 23e4e32b91
commit 6a51b55af6
2 changed files with 5 additions and 3 deletions

View file

@ -22,7 +22,8 @@ fi;
# server's certificate. This is perfectly safe: we don't care
# whether the server is being spoofed --- only the cryptographic
# hash of the output matters. Pass in extra p's to handle redirects.
printf 'p\np\np\n' | svn export --trust-server-cert --non-interactive ${ignoreExternals:+--ignore-externals} \
printf 'p\np\np\n' | svn export --trust-server-cert --non-interactive \
${ignoreExternals:+--ignore-externals} ${ignoreKeywords:+--ignore-keywords} \
-r "$rev" "$url" "$out"
stopNest

View file

@ -1,5 +1,6 @@
{stdenv, subversion, sshSupport ? false, openssh ? null}:
{url, rev ? "HEAD", md5 ? "", sha256 ? "", ignoreExternals ? false, name ? null}:
{url, rev ? "HEAD", md5 ? "", sha256 ? "",
ignoreExternals ? false, ignoreKeywords ? false, name ? null}:
let
repoName = with stdenv.lib;
@ -31,7 +32,7 @@ stdenv.mkDerivation {
outputHashMode = "recursive";
outputHash = if sha256 == "" then md5 else sha256;
inherit url rev sshSupport openssh ignoreExternals;
inherit url rev sshSupport openssh ignoreExternals ignoreKeywords;
impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
preferLocalBuild = true;