Merge remote-tracking branch 'origin/master' into stdenv-updates
This commit is contained in:
@@ -6,7 +6,7 @@ source $mirrorsFile
|
||||
# Curl flags to handle redirects, not use EPSV, handle cookies for
|
||||
# servers to need them during redirects, and work on SSL without a
|
||||
# certificate (this isn't a security problem because we check the
|
||||
# cryptographic hash of the output anyway).
|
||||
# cryptographic hash of the output anyway).
|
||||
curl="curl \
|
||||
--location --max-redirs 20 \
|
||||
--retry 3
|
||||
@@ -29,20 +29,6 @@ tryDownload() {
|
||||
|
||||
|
||||
finish() {
|
||||
# On old versions of Nix, verify the hash of the output. On newer
|
||||
# versions, Nix verifies the hash itself.
|
||||
if test "$NIX_OUTPUT_CHECKED" != "1"; then
|
||||
if test "$outputHashAlgo" != "md5"; then
|
||||
echo "hashes other than md5 are unsupported in Nix <= 0.7, upgrade to Nix 0.8"
|
||||
exit 1
|
||||
fi
|
||||
actual=$(md5sum -b "$out" | cut -c1-32)
|
||||
if test "$actual" != "$id"; then
|
||||
echo "hash is $actual, expected $id"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
stopNest
|
||||
exit 0
|
||||
}
|
||||
@@ -52,10 +38,11 @@ tryHashedMirrors() {
|
||||
if test -n "$NIX_HASHED_MIRRORS"; then
|
||||
hashedMirrors="$NIX_HASHED_MIRRORS"
|
||||
fi
|
||||
|
||||
|
||||
for mirror in $hashedMirrors; do
|
||||
url="$mirror/$outputHashAlgo/$outputHash"
|
||||
if $curl --fail --silent --show-error --head "$url" \
|
||||
if $curl --retry 0 --connect-timeout "${NIX_CONNECT_TIMEOUT:-15}" \
|
||||
--fail --silent --show-error --head "$url" \
|
||||
--write-out "%{http_code}" --output /dev/null > code 2> log; then
|
||||
tryDownload "$url"
|
||||
if test -n "$success"; then finish; fi
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{stdenv, curl}: # Note that `curl' may be `null', in case of the native stdenv.
|
||||
{ stdenv, curl }: # Note that `curl' may be `null', in case of the native stdenv.
|
||||
|
||||
let
|
||||
|
||||
@@ -17,10 +17,7 @@ let
|
||||
|
||||
# Names of the master sites that are mirrored (i.e., "sourceforge",
|
||||
# "gnu", etc.).
|
||||
sites =
|
||||
if builtins ? attrNames
|
||||
then builtins.attrNames mirrors
|
||||
else [] /* backwards compatibility */;
|
||||
sites = builtins.attrNames mirrors;
|
||||
|
||||
impureEnvVars = [
|
||||
# We borrow these environment variables from the caller to allow
|
||||
@@ -35,10 +32,14 @@ let
|
||||
# This variable allows the user to override hashedMirrors from the
|
||||
# command-line.
|
||||
"NIX_HASHED_MIRRORS"
|
||||
|
||||
# This variable allows overriding the timeout for connecting to
|
||||
# the hashed mirrors.
|
||||
"NIX_CONNECT_TIMEOUT"
|
||||
] ++ (map (site: "NIX_MIRRORS_${site}") sites);
|
||||
|
||||
in
|
||||
|
||||
|
||||
{ # URL to fetch.
|
||||
url ? ""
|
||||
|
||||
@@ -79,9 +80,9 @@ stdenv.mkDerivation {
|
||||
if showURLs then "urls"
|
||||
else if name != "" then name
|
||||
else baseNameOf (toString (builtins.head urls_));
|
||||
|
||||
|
||||
builder = ./builder.sh;
|
||||
|
||||
|
||||
buildInputs = [curl];
|
||||
|
||||
urls = urls_;
|
||||
@@ -90,9 +91,6 @@ stdenv.mkDerivation {
|
||||
# (http://nixos.org/tarballs) over the original URLs.
|
||||
preferHashedMirrors = true;
|
||||
|
||||
# Compatibility with Nix <= 0.7.
|
||||
id = md5;
|
||||
|
||||
# New-style output content requirements.
|
||||
outputHashAlgo = if outputHashAlgo != "" then outputHashAlgo else
|
||||
if sha256 != "" then "sha256" else if sha1 != "" then "sha1" else "md5";
|
||||
|
||||
@@ -46,17 +46,17 @@ stdenv.mkDerivation (
|
||||
header "Copying build directory to $KEEPBUILDDIR"
|
||||
mkdir -p $KEEPBUILDDIR
|
||||
cp -R $TMPDIR/* $KEEPBUILDDIR
|
||||
stopNest
|
||||
stopNest
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
}
|
||||
|
||||
// args //
|
||||
// args //
|
||||
|
||||
{
|
||||
name = name + (if src ? version then "-" + src.version else "");
|
||||
|
||||
|
||||
postHook = ''
|
||||
. ${./functions.sh}
|
||||
origSrc=$src
|
||||
@@ -75,7 +75,10 @@ stdenv.mkDerivation (
|
||||
echo "$system" > $out/nix-support/system
|
||||
|
||||
if [ -z "${toString doCoverageAnalysis}" ]; then
|
||||
echo "nix-build none $out" >> $out/nix-support/hydra-build-products
|
||||
for i in $outputs; do
|
||||
if [ "$i" = out ]; then j=none; else j="$i"; fi
|
||||
echo "nix-build $j ''${!i}" >> $out/nix-support/hydra-build-products
|
||||
done
|
||||
fi
|
||||
'';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user