Skip to content

Commit 350568e

Browse files
committed
fix(oma-pm): fix upgrade use APT::Solver=3.0
1 parent b868067 commit 350568e

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

Cargo.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

oma-pm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "GPL-3.0-or-later"
88
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
99

1010
[dependencies]
11-
oma-apt = "0.12"
11+
oma-apt = { git = "https://github.com/aosc-dev/oma-apt.git", rev = "b2171c27224628f670c3a7484ac678492a6df6c8" }
1212
thiserror = "2"
1313
chrono = { version = "0.4", features = ["unstable-locales"] }
1414
glob-match = "0.2"

oma-refresh/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ oma-topics = { version = "^0.25.0", path = "../oma-topics", optional = true, def
1919
tracing ="0.1"
2020
oma-repo-verify = { version = "^0.9.0", path = "../oma-repo-verify", default-features = false }
2121
ahash = "0.8.11"
22-
oma-apt = { version = "0.12", optional = true }
22+
oma-apt = { git = "https://github.com/aosc-dev/oma-apt.git", rev = "b2171c27224628f670c3a7484ac678492a6df6c8", optional = true}
2323
aho-corasick = "1.1.3"
2424
# https://github.com/bytecodealliance/rustix/pull/1077
2525
# rustix = { version = "0.38", features = ["fs"] }

src/subcommand/upgrade.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ impl CliExecuter for Upgrade {
241241
.maybe_auth_config(Some(&auth_config))
242242
.fix_dpkg_status(!no_fix_dpkg_status)
243243
.download_only(download_only)
244+
.is_upgrade(true)
244245
.build()
245246
.run()?;
246247

src/subcommand/utils.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,8 @@ pub(crate) struct CommitChanges<'a> {
321321
topics_disabled: Vec<String>,
322322
#[builder(default)]
323323
download_only: bool,
324+
#[builder(default)]
325+
is_upgrade: bool,
324326
}
325327

326328
impl CommitChanges<'_> {
@@ -344,6 +346,7 @@ impl CommitChanges<'_> {
344346
topics_enabled,
345347
topics_disabled,
346348
download_only,
349+
is_upgrade,
347350
} = self;
348351

349352
fix_broken(
@@ -353,6 +356,7 @@ impl CommitChanges<'_> {
353356
fix_dpkg_status,
354357
remove_config,
355358
autoremove,
359+
is_upgrade,
356360
)?;
357361

358362
let op = apt.summary(
@@ -575,15 +579,18 @@ pub fn fix_broken(
575579
fix_dpkg_status: bool,
576580
remove_config: bool,
577581
autoremove: bool,
582+
is_upgrade: bool,
578583
) -> Result<(), OutputError> {
579584
let pb = create_progress_spinner(no_progress, fl!("resolving-dependencies"));
580585

581586
let res = Ok(()).and_then(|_| -> Result<(), OmaAptError> {
587+
let solver = apt.config.find("APT::Solver", "internal");
588+
582589
if autoremove {
583590
apt.autoremove(remove_config)?;
584591
}
585592

586-
if !no_fixbroken {
593+
if !no_fixbroken && solver != "3.0" {
587594
apt.fix_resolver_broken();
588595
}
589596

@@ -598,6 +605,10 @@ pub fn fix_broken(
598605
}
599606
}
600607

608+
if solver == "3.0" && is_upgrade {
609+
return Ok(());
610+
}
611+
601612
apt.resolve(no_fixbroken, remove_config)?;
602613

603614
Ok(())

0 commit comments

Comments
 (0)