linux_xanmod: 5.11.14 -> 5.11.15
[NixPkgs.git] / pkgs / development / libraries / v8 / update.sh
blobf046bb8e6885e04c0f30498e84a6184bedeca3ed
1 #!/usr/bin/env nix-shell
2 #! nix-shell -i bash -p curl -p nix-prefetch-git
3 VERSION_OVERVIEW=https://omahaproxy.appspot.com/all?os=linux
4 TARGET_CHANNEL=beta
5 FILE_PATH=6_x.nix
7 set -eo pipefail
9 v8_version=$(curl -s "$VERSION_OVERVIEW" | awk -F "," "\$2 ~ /${TARGET_CHANNEL}/ { print \$11 }")
11 echo "Using V8 version --> $v8_version"
12 sed -e "s#\\(version = \\)\"[0-9\.]*\"#\1\"$v8_version\"#" -i ${FILE_PATH}
14 sha256=$(nix-prefetch-git --no-deepClone https://github.com/v8/v8.git "refs/tags/${v8_version}" \
15 | sed -ne '/sha256/ { s#.*: "\(.*\)".*#\1#; p }')
16 sed -e "/repo = \"v8\"/ { n;n; s#\".*\"#\"${sha256}\"# }" -i ${FILE_PATH}
18 deps="$(mktemp)"
20 curl -s -o "$deps" "https://raw.githubusercontent.com/v8/v8/${v8_version}/DEPS"
21 echo $deps
23 sed -ne '/= fetchgit {/ { s/.*"\(.*\)".*/\1/; p }' < ${FILE_PATH} | while read dep; do
24 echo "Processing dependency --> $dep"
25 escaped_dep=$(echo "$dep" | sed -e 's#/#\\/#g')
26 dep_rev=$(sed -ne "/\"v8\/${escaped_dep}\":/ { n; s#.*+ \"##; s#\".*##; p }" "$deps")
28 if [ "$dep_rev" = "" ]; then
29 echo "Failed to resolve dependency $dep, not listed in DEPS file"
30 rm -f "$deps"
31 exit 2
34 repo_url=$(sed -ne "/\"${escaped_dep}\" = fetchgit/ { n; s/.*\"\(.*\)\".*/\1/; s#\${git_url}#https://chromium.googlesource.com#; p }" ${FILE_PATH})
35 sha256=$(nix-prefetch-git --no-deepClone "$repo_url" "$dep_rev" 2>/dev/null | sed -ne '/sha256/ { s#.*: "\(.*\)".*#\1#; p }')
37 if [ "$sha256" = "" ]; then
38 echo "Failed to get sha256 via nix-prefetch-git $repo_url $dep_rev"
39 rm -f "$deps"
40 exit 2
43 sed -e "/\"${escaped_dep}\" = fetchgit/ { n; n; s/\".*\"/\"${dep_rev}\"/; n; s/\".*\"/\"${sha256}\"/ }" -i ${FILE_PATH}
44 done
46 rm -f "$deps"
47 echo done.