summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock16
-rw-r--r--Cargo.toml1
-rwxr-xr-xbuild.sh6
-rw-r--r--mullvad-cli/Cargo.toml2
-rw-r--r--mullvad-problem-report/Cargo.toml19
-rw-r--r--mullvad-problem-report/build.rs24
-rw-r--r--mullvad-problem-report/src/main.rs (renamed from mullvad-daemon/src/bin/problem-report.rs)15
-rwxr-xr-xprepare_release.sh10
8 files changed, 79 insertions, 14 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 3991661529..947439b3e7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -765,7 +765,7 @@ dependencies = [
[[package]]
name = "mullvad-cli"
-version = "2018.1.0"
+version = "2018.2.0-beta1"
dependencies = [
"clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -779,7 +779,7 @@ dependencies = [
[[package]]
name = "mullvad-daemon"
-version = "2018.1.0"
+version = "2018.2.0-beta1"
dependencies = [
"chrono 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -836,6 +836,18 @@ dependencies = [
]
[[package]]
+name = "mullvad-problem-report"
+version = "2018.2.0-beta1"
+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",
diff --git a/build.sh b/build.sh
index 47f5e66bbe..414289c9fb 100755
--- a/build.sh
+++ b/build.sh
@@ -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-cli/Cargo.toml b/mullvad-cli/Cargo.toml
index f0d0ee49fc..dbbe098aa5 100644
--- a/mullvad-cli/Cargo.toml
+++ b/mullvad-cli/Cargo.toml
@@ -2,7 +2,7 @@
name = "mullvad-cli"
version = "2018.2.0-beta1"
authors = ["Mullvad VPN <admin@mullvad.net>", "Linus Färnstrand <linus@mullvad.net>", "Erik Larkö <erik@mullvad.net>", "Andrej Mihajlov <and@mullvad.net>"]
-description = "Run Talpid easily from the command line"
+description = "Manage the Mullvad VPN daemon via a convenient CLI"
license = "GPL-3.0"
[[bin]]
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..b15f14415d 100644
--- a/mullvad-daemon/src/bin/problem-report.rs
+++ b/mullvad-problem-report/src/main.rs
@@ -31,9 +31,10 @@ use std::path::{Path, PathBuf};
use std::process::Command;
/// Maximum number of bytes to read from each log file
-const LOG_MAX_READ_BYTES: usize = 1 * 1024 * 1024;
-/// Fit two logs plus some system information in the report.
-const REPORT_MAX_SIZE: usize = 2 * LOG_MAX_READ_BYTES + 16 * 1024;
+const LOG_MAX_READ_BYTES: usize = 512 * 1024;
+const EXTRA_BYTES: usize = 32 * 1024;
+/// Fit five logs plus some system information in the report.
+const REPORT_MAX_SIZE: usize = (5 * LOG_MAX_READ_BYTES) + EXTRA_BYTES;
/// Field delimeter in generated problem report
@@ -83,7 +84,7 @@ quick_main!(run);
fn run() -> Result<()> {
let app = clap::App::new("problem-report")
- .version(daemon_version())
+ .version(product_version())
.author(crate_authors!())
.about("Mullvad VPN problem report tool. Collects logs and sends them to Mullvad support.")
.setting(clap::AppSettings::SubcommandRequired)
@@ -443,14 +444,14 @@ fn read_file_lossy(path: &Path, max_bytes: usize) -> io::Result<String> {
fn collect_metadata() -> HashMap<String, String> {
let mut metadata = HashMap::new();
metadata.insert(
- String::from("mullvad-daemon-version"),
- daemon_version().to_owned(),
+ String::from("mullvad-product-version"),
+ product_version().to_owned(),
);
metadata.insert(String::from("os"), os_version());
metadata
}
-fn daemon_version() -> &'static str {
+fn product_version() -> &'static str {
concat!(
include_str!(concat!(env!("OUT_DIR"), "/product-version.txt")),
" ",
diff --git a/prepare_release.sh b/prepare_release.sh
index ad9858d070..032e6a55be 100755
--- a/prepare_release.sh
+++ b/prepare_release.sh
@@ -35,13 +35,19 @@ sed -i -re "s/\"version\": \"[^\"]+\",/\"version\": \"$SEMVER_VERSION\",/g" \
package.json
sed -i -re "s/^version = \"[^\"]+\"\$/version = \"$SEMVER_VERSION\"/g" \
mullvad-daemon/Cargo.toml \
- mullvad-cli/Cargo.toml
+ mullvad-cli/Cargo.toml \
+ mullvad-problem-report/Cargo.toml
+
+echo "Syncing Cargo.lock with new version numbers"
+cargo update --package mullvad-daemon
echo "Commiting metadata changes to git..."
git commit -S -m "Updating version in package.json" \
package.json \
mullvad-daemon/Cargo.toml \
- mullvad-cli/Cargo.toml
+ mullvad-cli/Cargo.toml \
+ mullvad-problem-report/Cargo.toml \
+ Cargo.lock
echo "Tagging current git commit with release tag $VERSION..."
git tag -s $VERSION -m $VERSION