1 #!/usr/bin/env nix-shell
2 #! nix-shell -i bash -p curl -p nix-prefetch-git -p jq
3 VERSION_OVERVIEW
=https
://omahaproxy.appspot.com
/all?os
=linux
12 v8_version
=$
(curl
-s "$VERSION_OVERVIEW" |
awk -F "," "\$2 ~ /${TARGET_CHANNEL}/ { print \$11 }")
21 echo "Using V8 version --> $v8_version"
23 prefetched
=$
(nix-prefetch-git
--no-deepClone https
://chromium.googlesource.com
/v
8/v8
"refs/tags/${v8_version}")
25 path
=$
(echo "$prefetched" | jq
-r .path
)
26 sha256
=$
(echo "$prefetched" | jq
-r .sha256
)
27 sed -e "s#\\(version = \\)\"[0-9\.]*\"#\1\"$v8_version\"#" -i ${file_path}
28 sed -e "/v8Src = fetchgit/ { n; n; n; s/\".*\"/\"${sha256}\"/ }" -i ${file_path}
35 gn_rev
=$
(sed -ne "s/.*'gn_version': 'git_revision:\([^']*\).*/\1/p" < "$deps")
36 gn_sha256
=$
(nix-prefetch-git
--no-deepClone https
://gn.googlesource.com
/gn
"$gn_rev" 2>/dev
/null | jq
-r .sha256
)
37 sed -e "/gnSrc = fetchgit/ { n; n; s/\".*\"/\"${gn_rev}\"/; n; s/\".*\"/\"${gn_sha256}\"/ }" -i ${file_path}
39 sed -ne '/" = fetchgit {/ { s/.*"\(.*\)".*/\1/; p }' < ${file_path} |
while read dep
; do
40 echo "Processing dependency --> $dep"
41 escaped_dep
=$
(echo "$dep" |
sed -e 's#/#\\/#g')
42 dep_rev
=$
(sed -ne "/'${escaped_dep}':/ { n; s#.*+ '##; s#'.*##; p }" "$deps")
44 if [ "$dep_rev" = "" ]; then
45 echo "Failed to resolve dependency $dep, not listed in DEPS file"
50 repo_url
=$
(sed -ne "/\"${escaped_dep}\" = fetchgit/ { n; s/.*\"\(.*\)\".*/\1/; s#\${git_url}#https://chromium.googlesource.com#; p }" ${file_path})
51 sha256
=$
(nix-prefetch-git
--no-deepClone "$repo_url" "$dep_rev" 2>/dev
/null | jq
-r .sha256
)
53 if [ "$sha256" = "" ]; then
54 echo "Failed to get sha256 via nix-prefetch-git $repo_url $dep_rev"
59 sed -e "/\"${escaped_dep}\" = fetchgit/ { n; n; s/\".*\"/\"${dep_rev}\"/; n; s/\".*\"/\"${sha256}\"/ }" -i ${file_path}