summary refs log tree commit diff
path: root/pkgs/games/ue4/generate-expr-from-cdn.sh
blob: 91cab1ca32f5bab439d71cbd5de0c9a28182189c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh

go() {
    file="$1"

    IFS=$'\n'
    for pack in $(perl -n -e '/(<Pack .*\/>)/ && print "$1\n"' $file); do
        remotepath=$(echo "$pack" | perl -n -e '/RemotePath="([^"]*)"/ && print $1')
        hash=$(echo "$pack" | perl -n -e '/Hash="([^"]*)"/ && print $1')
        url="http://cdn.unrealengine.com/dependencies/$remotepath/$hash"

        until sha256=$(nix-prefetch-url $url --type sha256); do
            true
        done

        cat <<EOF
  "$hash" = fetchurl {
    url = $url;
    sha256 = "$sha256";
  };
EOF
    done
}


cat <<EOF
{ fetchurl }:

{
EOF

go Engine/Build/Commit.gitdeps.xml
go Engine/Build/Promoted.gitdeps.xml

cat <<EOF
}
EOF