mirror of
https://github.com/storytold/craft-launcher.git
synced 2026-11-15 22:52:40 +00:00
Allow going back to an older version over the launcher's own Flatpak; bump to 0.19.2 (#1416)
* Allow going back to an older version over the launcher's own Flatpak * Bump to 0.19.2
This commit is contained in:
1 parent
eb6f1fb35a
commit
66beafa52e
4 files changed
+21
-9
No files matched your search
Generated
+6
-6
@@ -272,7 +272,7 @@ checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56"
|
||||
|
||||
[[package]]
|
||||
name = "artcraft-launcher"
|
||||
version = "0.19.1"
|
||||
version = "0.19.2"
|
||||
dependencies = [
|
||||
"artcraft-launcher-core",
|
||||
"artcraft-launcher-native",
|
||||
@@ -298,7 +298,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "artcraft-launcher-core"
|
||||
version = "0.19.1"
|
||||
version = "0.19.2"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"ed25519-dalek",
|
||||
@@ -312,7 +312,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "artcraft-launcher-native"
|
||||
version = "0.19.1"
|
||||
version = "0.19.2"
|
||||
dependencies = [
|
||||
"artcraft-launcher-core",
|
||||
"craft-update",
|
||||
@@ -336,7 +336,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "artcraft-launcher-ui-egui"
|
||||
version = "0.19.1"
|
||||
version = "0.19.2"
|
||||
dependencies = [
|
||||
"artcraft-launcher-core",
|
||||
"craft-ui",
|
||||
@@ -356,7 +356,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "artcraft-launcher-web"
|
||||
version = "0.19.1"
|
||||
version = "0.19.2"
|
||||
dependencies = [
|
||||
"artcraft-launcher-core",
|
||||
"artcraft-launcher-ui-egui",
|
||||
@@ -6355,7 +6355,7 @@ checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9"
|
||||
|
||||
[[package]]
|
||||
name = "xtask"
|
||||
version = "0.19.1"
|
||||
version = "0.19.2"
|
||||
dependencies = [
|
||||
"jiff",
|
||||
"semver",
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ resolver = "3"
|
||||
members = ["crates/*", "apps/*", "xtask"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.19.1"
|
||||
version = "0.19.2"
|
||||
edition = "2024"
|
||||
license = "MIT OR Apache-2.0"
|
||||
rust-version = "1.95"
|
||||
|
||||
@@ -803,7 +803,7 @@ fn run_install(
|
||||
let InstallPlan { release, platform, asset, kind } = install_plan(app, latest, platform, options, (existing, record), Asking::Install)?;
|
||||
let http = http.ok_or("secure connections aren't available on this system")?;
|
||||
let track = options.versions.get(app.id).unwrap_or(&VersionTrack::Stable);
|
||||
// Going back to a version chosen by name. A macOS bundle or a launcher AppImage keeps the old
|
||||
// Going back to a version chosen by name. A macOS bundle, a launcher AppImage or Flatpak keeps the old
|
||||
// copy until the new one is in place. Otherwise the installed version's own package is found
|
||||
// first, so a downgrade that fails can put it back. Without it nothing changes.
|
||||
let keeps_old_copy = install::keeps_old_copy(kind, existing, record);
|
||||
|
||||
@@ -86,12 +86,16 @@ pub enum Downgrade<'a> {
|
||||
/// Whether going back over `existing` keeps the old copy until the new one is in place, the same
|
||||
/// way an update does. A macOS bundle is moved aside and moved back if the swap fails. An
|
||||
/// AppImage the launcher installed (`previous` records it) is renamed in whole, and the old file
|
||||
/// is removed only after that. A tarball is left out: its `bin` and `share` swap one at a time.
|
||||
/// is removed only after that. A Flatpak bundle over the launcher's own Flatpak (same bundle
|
||||
/// origin) deploys the new commit before undeploying the old one, as an update does; a Flatpak
|
||||
/// from a repository is left to that repository. A tarball is left out: its `bin` and `share`
|
||||
/// swap one at a time.
|
||||
pub fn keeps_old_copy(kind: PackageKind, existing: Option<&Installed>, previous: Option<&Record>) -> bool {
|
||||
let source = existing.map(|inst| inst.source);
|
||||
match kind {
|
||||
PackageKind::Dmg => source == Some(InstallSource::MacApp),
|
||||
PackageKind::AppImage => source == Some(InstallSource::Launcher) && previous.is_some_and(|r| r.kind == PackageKind::AppImage),
|
||||
PackageKind::Flatpak => existing.is_some_and(|inst| inst.source == InstallSource::Flatpak && !inst.externally_managed),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
@@ -2889,6 +2893,14 @@ mod tests {
|
||||
assert!(!keeps_old_copy(PackageKind::AppImage, Some(&installed(InstallSource::AppImage)), Some(&appimage)));
|
||||
assert!(!keeps_old_copy(PackageKind::AppImage, Some(&portable), Some(&tarball)));
|
||||
assert!(!keeps_old_copy(PackageKind::TarGz, Some(&portable), Some(&tarball)));
|
||||
// A Flatpak bundle over the launcher's own Flatpak keeps it; one from a repository doesn't.
|
||||
let flatpak = installed(InstallSource::Flatpak);
|
||||
let managed = Installed { externally_managed: true, ..installed(InstallSource::Flatpak) };
|
||||
assert!(keeps_old_copy(PackageKind::Flatpak, Some(&flatpak), None));
|
||||
assert!(downgrade_is_safe(keep, PackageKind::Flatpak, Some(&flatpak), None));
|
||||
assert!(!keeps_old_copy(PackageKind::Flatpak, Some(&managed), None));
|
||||
assert!(!keeps_old_copy(PackageKind::Flatpak, Some(&portable), None));
|
||||
assert!(!keeps_old_copy(PackageKind::Flatpak, None, None));
|
||||
// Each way back fits one kind of install; anything else is refused.
|
||||
assert!(downgrade_is_safe(None, PackageKind::AppImage, Some(&portable), None));
|
||||
assert!(downgrade_is_safe(keep, PackageKind::Dmg, Some(&mac), None));
|
||||
|
||||
Reference in new issue
Block a user