Got deb tests passing

pull/1991/head
jLynx 8 months ago
parent 9c4f9d8ad6
commit 8f07405acb

@ -208,6 +208,7 @@ fn update_app() {
config.bundle.create_updater_artifacts,
Updater::String(V1Compatible::V1Compatible)
);
println!("== IS v1_compatible: {}", v1_compatible);
#[cfg(target_os = "linux")]
let bundle_targets = vec![BundleTarget::Deb, BundleTarget::AppImage];
@ -215,6 +216,12 @@ fn update_app() {
let bundle_targets = vec![BundleTarget::default()];
for bundle_target in bundle_targets {
// Skip test for Linux .deb with v1 compatibility
#[cfg(target_os = "linux")]
if v1_compatible && bundle_target == BundleTarget::Deb {
println!("Skipping test for .deb with v1 compatibility mode");
continue;
}
// bundle app update
build_app(&manifest_dir, &config, true, bundle_target);
@ -261,8 +268,12 @@ fn update_app() {
"target/debug/{}",
out_updater_path.file_name().unwrap().to_str().unwrap()
));
// std::fs::rename(&out_updater_path, &updater_path)
// .expect("failed to rename bundle");
println!("Rename operation paths:");
println!(" From: {}", out_updater_path.display());
println!(" To: {}", updater_path.display());
// Note, this may need to still be here, but also may need to move the sig too
std::fs::rename(&out_updater_path, &updater_path)
.expect("failed to rename bundle");
let target = target.clone();
@ -328,21 +339,29 @@ fn update_app() {
// Set appropriate permissions and install package if needed
#[cfg(target_os = "linux")]
{
let bundle_path = &out_bundle_path;
let initial_bundle_path = bundle_paths(&root_dir, "0.1.0")
.iter()
.find(|(t, _)| *t == bundle_target)
.map(|(_, path)| path.clone())
.unwrap();
if bundle_target == BundleTarget::AppImage {
std::process::Command::new("sudo")
.arg("chmod")
.arg("+x")
.arg(bundle_path)
.arg(initial_bundle_path)
.status()
.expect("failed to change permissions");
} else if bundle_target == BundleTarget::Deb {
println!(
"Installing Deb package from: {}",
initial_bundle_path.display()
);
// Install the .deb package
let install_status = std::process::Command::new("sudo")
.arg("dpkg")
.arg("-i")
.arg(bundle_path)
.arg(initial_bundle_path)
.status()
.expect("failed to install .deb package");
@ -382,6 +401,10 @@ fn update_app() {
} else {
#[cfg(target_os = "linux")]
{
println!(
"RUNNING LINUX BUILD - Expected exit code: {}",
expected_exit_code
);
let mut c = Command::new("sudo");
if bundle_target == BundleTarget::Deb {
c.arg("/usr/bin/app-updater");
@ -406,6 +429,7 @@ fn update_app() {
"failed to run app, expected exit code {expected_exit_code}, got {code}"
);
}
println!("===== CODE WAS SUCCESSFUL! {}", expected_exit_code);
#[cfg(windows)]
if code == UPDATED_EXIT_CODE {
// wait for the update to finish

Loading…
Cancel
Save