0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-11-24 15:19:31 -05:00

use lockfile to prevent linking of partially downloaded lib (#543)

This commit is contained in:
mash-graz 2020-12-27 17:37:14 +01:00 committed by GitHub
parent cf7bb2d001
commit 6c54f184cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 20 deletions

47
Cargo.lock generated
View file

@ -12,6 +12,16 @@ version = "0.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ba7d7f7b201dfcbc314b14f2176c92f8ba521dab538b40e426ffed25ed7cd80"
[[package]]
name = "fslock"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b14c83e47c73f7d62d907ae24a1a98e9132df3c33eb6c54fcf4bce0dbc41d5af"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "glob"
version = "0.3.0"
@ -38,9 +48,9 @@ checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614"
[[package]]
name = "proc-macro2"
version = "1.0.20"
version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "175c513d55719db99da20232b06cda8bab6b83ec2d04e3283edf0213c37c1a29"
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
dependencies = [
"unicode-xid",
]
@ -60,6 +70,7 @@ version = "0.14.0"
dependencies = [
"bitflags",
"cargo_gn",
"fslock",
"lazy_static",
"libc",
"trybuild",
@ -74,18 +85,18 @@ checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
[[package]]
name = "serde"
version = "1.0.115"
version = "1.0.117"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e54c9a88f2da7238af84b5101443f0c0d0a3bbdc455e34a5c9497b1903ed55d5"
checksum = "b88fa983de7720629c9387e9f517353ed404164b1e482c970a90c1a4aaf7dc1a"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.115"
version = "1.0.117"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "609feed1d0a73cc36a0182a840a9b37b4a82f0b1150369f0536a9e3f2a31dc48"
checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e"
dependencies = [
"proc-macro2",
"quote",
@ -94,9 +105,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.57"
version = "1.0.59"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c"
checksum = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95"
dependencies = [
"itoa",
"ryu",
@ -105,9 +116,9 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.40"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "963f7d3cc59b59b9325165add223142bbf1df27655d07789f109896d353d8350"
checksum = "443b4178719c5a851e1bde36ce12da21d74a0e60b4d982ec3385a933c812f0f6"
dependencies = [
"proc-macro2",
"quote",
@ -116,27 +127,27 @@ dependencies = [
[[package]]
name = "termcolor"
version = "1.1.0"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f"
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
dependencies = [
"winapi-util",
]
[[package]]
name = "thiserror"
version = "1.0.20"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08"
checksum = "0e9ae34b84616eedaaf1e9dd6026dbe00dcafa92aa0c8077cb69df1fcfe5e53e"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.20"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793"
checksum = "9ba20f23e85b10754cd195504aebf6a27e2e6cbe28c17778a0c930724628dd56"
dependencies = [
"proc-macro2",
"quote",
@ -145,9 +156,9 @@ dependencies = [
[[package]]
name = "toml"
version = "0.5.6"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a"
checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645"
dependencies = [
"serde",
]

View file

@ -60,6 +60,7 @@ bitflags = "1.2.1"
[build-dependencies]
cargo_gn = "0.0.15"
which = "4.0.2"
fslock = "0.1"
[dev-dependencies]
trybuild = "1.0.35"

View file

@ -61,14 +61,14 @@ Then populate the cache:
# see https://github.com/denoland/rusty_v8/releases
for REL in v0.9.0 v0.10.0; do
for REL in v0.13.0 v0.12.0; do
mkdir -p $RUSTY_V8_MIRROR/$REL
for FILE in \
librusty_v8_debug_x86_64-unknown-linux-gnu.a \
librusty_v8_release_x86_64-unknown-linux-gnu.a \
; do
if [ ! -f $RUSTY_V8_MIRROR/$REL/$FILE ]; then
wget -O $CACHE_DIR/$REL/$FILE \
wget -O $RUSTY_V8_MIRROR/$REL/$FILE \
https://github.com/denoland/rusty_v8/releases/download/$REL/$FILE
fi
done

View file

@ -1,4 +1,5 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
use fslock::LockFile;
use std::env;
use std::fs;
use std::path::Path;
@ -27,7 +28,23 @@ fn main() {
if env::var_os("V8_FROM_SOURCE").is_some() {
build_v8()
} else {
// utilize a lockfile to prevent linking of
// only partially downloaded static library.
let root = env::current_dir().unwrap();
let out_dir = env::var_os("OUT_DIR").unwrap();
let lockfilepath = root
.join(out_dir)
.parent()
.unwrap()
.parent()
.unwrap()
.join("lib_download.fslock");
println!("download lockfile: {:?}", &lockfilepath);
let mut lockfile = LockFile::open(&lockfilepath)
.expect("Couldn't open lib download lockfile.");
lockfile.lock().expect("Couldn't get lock");
download_static_lib_binaries();
lockfile.unlock().expect("Couldn't unlock lockfile");
}
}