diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2018-07-02 16:10:37 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2018-07-03 11:33:30 +0200 |
| commit | 212ab525ed69e3ba47ade75dcc04a3d528ca7ece (patch) | |
| tree | 154673d53e58a5c4d514279a732a3cd02aea8344 | |
| parent | 56922a2b644a1dc6f4b872e2dfcd84571ca354a3 (diff) | |
| download | mullvadvpn-212ab525ed69e3ba47ade75dcc04a3d528ca7ece.tar.xz mullvadvpn-212ab525ed69e3ba47ade75dcc04a3d528ca7ece.zip | |
Move problem-report out to own crate
| -rw-r--r-- | Cargo.lock | 12 | ||||
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rwxr-xr-x | build.sh | 6 | ||||
| -rw-r--r-- | mullvad-problem-report/Cargo.toml | 19 | ||||
| -rw-r--r-- | mullvad-problem-report/build.rs | 24 | ||||
| -rw-r--r-- | mullvad-problem-report/src/main.rs (renamed from mullvad-daemon/src/bin/problem-report.rs) | 0 |
6 files changed, 60 insertions, 2 deletions
diff --git a/Cargo.lock b/Cargo.lock index 3991661529..eef37d23e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -836,6 +836,18 @@ dependencies = [ ] [[package]] +name = "mullvad-problem-report" +version = "2018.1.0" +dependencies = [ + "clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "mullvad-paths 0.1.0", + "mullvad-rpc 0.1.0", + "regex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "mullvad-rpc" version = "0.1.0" dependencies = [ diff --git a/Cargo.toml b/Cargo.toml index 80ab5c0a1e..8e68361379 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ members = [ "mullvad-daemon", "mullvad-cli", + "mullvad-problem-report", "mullvad-ipc-client", "mullvad-paths", "mullvad-types", @@ -87,8 +87,9 @@ SEMVER_VERSION=$(echo $PRODUCT_VERSION | sed -Ee 's/($|-.*)/.0\1/g') function restore_metadata_backups() { mv package.json.bak package.json || true mv Cargo.lock.bak Cargo.lock || true - mv mullvad-cli/Cargo.toml.bak mullvad-cli/Cargo.toml || true mv mullvad-daemon/Cargo.toml.bak mullvad-daemon/Cargo.toml || true + mv mullvad-cli/Cargo.toml.bak mullvad-cli/Cargo.toml || true + mv mullvad-problem-report/Cargo.toml.bak mullvad-problem-report/Cargo.toml || true } trap 'restore_metadata_backups' EXIT @@ -100,7 +101,8 @@ cp Cargo.lock Cargo.lock.bak sed -i.bak \ -Ee "s/^version = \"[^\"]+\"\$/version = \"$SEMVER_VERSION\"/g" \ mullvad-daemon/Cargo.toml \ - mullvad-cli/Cargo.toml + mullvad-cli/Cargo.toml \ + mullvad-problem-report/Cargo.toml ################################################################################ # Compile and link all binaries. diff --git a/mullvad-problem-report/Cargo.toml b/mullvad-problem-report/Cargo.toml new file mode 100644 index 0000000000..a78264a2e9 --- /dev/null +++ b/mullvad-problem-report/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "mullvad-problem-report" +version = "2018.2.0-beta1" +authors = ["Mullvad VPN <admin@mullvad.net>", "Linus Färnstrand <linus@mullvad.net>", "Andrej Mihajlov <and@mullvad.net>"] +description = "Collect Mullvad VPN logs into a report and send it to support" +license = "GPL-3.0" + +[[bin]] +name = "problem-report" +path = "src/main.rs" + +[dependencies] +clap = "2.25" +error-chain = "0.12" +lazy_static = "1.0" +regex = "1.0" + +mullvad-paths = { path = "../mullvad-paths" } +mullvad-rpc = { path = "../mullvad-rpc" } diff --git a/mullvad-problem-report/build.rs b/mullvad-problem-report/build.rs new file mode 100644 index 0000000000..f1f507670e --- /dev/null +++ b/mullvad-problem-report/build.rs @@ -0,0 +1,24 @@ +use std::env; +use std::fs; +use std::path::PathBuf; +use std::process::Command; + + +fn main() { + let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); + + let product_version = env!("CARGO_PKG_VERSION").replacen(".0", "", 1); + fs::write(out_dir.join("product-version.txt"), product_version).unwrap(); + fs::write(out_dir.join("git-commit-date.txt"), commit_date()).unwrap(); +} + +fn commit_date() -> String { + let output = Command::new("git") + .args(&["log", "-1", "--date=short", "--pretty=format:%cd"]) + .output() + .expect("Unable to get git commit date"); + ::std::str::from_utf8(&output.stdout) + .unwrap() + .trim() + .to_owned() +} diff --git a/mullvad-daemon/src/bin/problem-report.rs b/mullvad-problem-report/src/main.rs index c4db962ab5..c4db962ab5 100644 --- a/mullvad-daemon/src/bin/problem-report.rs +++ b/mullvad-problem-report/src/main.rs |
