uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
87
pkgs/build-support/fetchipfs/builder.sh
Normal file
87
pkgs/build-support/fetchipfs/builder.sh
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
source $stdenv/setup
|
||||
|
||||
# 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).
|
||||
|
||||
set -o noglob
|
||||
|
||||
curl="curl \
|
||||
--location \
|
||||
--max-redirs 20 \
|
||||
--retry 2 \
|
||||
--disable-epsv \
|
||||
--cookie-jar cookies \
|
||||
--insecure \
|
||||
--speed-time 5 \
|
||||
-# \
|
||||
--fail \
|
||||
$curlOpts \
|
||||
$NIX_CURL_FLAGS"
|
||||
|
||||
finish() {
|
||||
runHook postFetch
|
||||
set +o noglob
|
||||
exit 0
|
||||
}
|
||||
|
||||
ipfs_add() {
|
||||
if curl --retry 0 --head --silent "localhost:5001" > /dev/null; then
|
||||
echo "[0m[01;36m=IPFS=[0m add $ipfs"
|
||||
tar --owner=root --group=root -cWf "source.tar" $(echo *)
|
||||
res=$(curl -# -F "file=@source.tar" "localhost:5001/api/v0/tar/add" | sed 's/.*"Hash":"\(.*\)".*/\1/')
|
||||
if [ $ipfs != $res ]; then
|
||||
echo "\`ipfs tar add' results in $res when $ipfs is expected"
|
||||
exit 1
|
||||
fi
|
||||
rm "source.tar"
|
||||
fi
|
||||
}
|
||||
|
||||
echo
|
||||
|
||||
mkdir download
|
||||
cd download
|
||||
|
||||
if curl --retry 0 --head --silent "localhost:5001" > /dev/null; then
|
||||
curlexit=18;
|
||||
echo "[0m[01;36m=IPFS=[0m get $ipfs"
|
||||
# if we get error code 18, resume partial download
|
||||
while [ $curlexit -eq 18 ]; do
|
||||
# keep this inside an if statement, since on failure it doesn't abort the script
|
||||
if $curl -C - "http://localhost:5001/api/v0/tar/cat?arg=$ipfs" --output "$ipfs.tar"; then
|
||||
unpackFile "$ipfs.tar"
|
||||
rm "$ipfs.tar"
|
||||
set +o noglob
|
||||
mv $(echo *) "$out"
|
||||
finish
|
||||
else
|
||||
curlexit=$?;
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if test -n "$url"; then
|
||||
curlexit=18;
|
||||
echo "Downloading $url"
|
||||
while [ $curlexit -eq 18 ]; do
|
||||
# keep this inside an if statement, since on failure it doesn't abort the script
|
||||
if $curl "$url" -O; then
|
||||
set +o noglob
|
||||
tmpfile=$(echo *)
|
||||
unpackFile $tmpfile
|
||||
rm $tmpfile
|
||||
ipfs_add
|
||||
mv $(echo *) "$out"
|
||||
finish
|
||||
else
|
||||
curlexit=$?;
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
echo "[01;31merror:[0m cannot download $ipfs from ipfs or the given url"
|
||||
echo
|
||||
set +o noglob
|
||||
exit 1
|
||||
50
pkgs/build-support/fetchipfs/default.nix
Normal file
50
pkgs/build-support/fetchipfs/default.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{ stdenv
|
||||
, curl
|
||||
}:
|
||||
|
||||
{ ipfs
|
||||
, url ? ""
|
||||
, curlOpts ? ""
|
||||
, outputHash ? ""
|
||||
, outputHashAlgo ? ""
|
||||
, md5 ? ""
|
||||
, sha1 ? ""
|
||||
, sha256 ? ""
|
||||
, sha512 ? ""
|
||||
, meta ? {}
|
||||
, port ? "8080"
|
||||
, postFetch ? ""
|
||||
, preferLocalBuild ? true
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
hasHash = (outputHash != "" && outputHashAlgo != "")
|
||||
|| md5 != "" || sha1 != "" || sha256 != "" || sha512 != "";
|
||||
|
||||
in
|
||||
|
||||
if (!hasHash) then throw "Specify sha for fetchipfs fixed-output derivation" else stdenv.mkDerivation {
|
||||
name = ipfs;
|
||||
builder = ./builder.sh;
|
||||
nativeBuildInputs = [ curl ];
|
||||
|
||||
# New-style output content requirements.
|
||||
outputHashAlgo = if outputHashAlgo != "" then outputHashAlgo else
|
||||
if sha512 != "" then "sha512" else if sha256 != "" then "sha256" else if sha1 != "" then "sha1" else "md5";
|
||||
outputHash = if outputHash != "" then outputHash else
|
||||
if sha512 != "" then sha512 else if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
|
||||
|
||||
outputHashMode = "recursive";
|
||||
|
||||
inherit curlOpts
|
||||
postFetch
|
||||
ipfs
|
||||
url
|
||||
port
|
||||
meta;
|
||||
|
||||
# Doing the download on a remote machine just duplicates network
|
||||
# traffic, so don't do that.
|
||||
inherit preferLocalBuild;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue