Skip to content

Commit b2976c8

Browse files
committed
feat(topics)!: only upgrade affected packages when enabling topics
1 parent de9d8dd commit b2976c8

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/subcommand/topics.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use inquire::{
1212
ui::{Color, RenderConfig, StyleSheet, Styled},
1313
};
1414
use oma_pm::{
15-
apt::{AptConfig, FilterMode, OmaApt, OmaAptArgs, Upgrade},
15+
apt::{AptConfig, FilterMode, OmaApt, OmaAptArgs},
1616
matches::{GetArchMethod, PackagesMatcher},
1717
};
1818
use oma_utils::dpkg::dpkg_arch;
@@ -218,6 +218,7 @@ impl CliExecuter for Topics {
218218
let matcher = PackagesMatcher::builder()
219219
.cache(&apt.cache)
220220
.native_arch(GetArchMethod::SpecifySysroot(&sysroot))
221+
.select_dbg(false)
221222
.build();
222223

223224
for pkg in downgrade_pkgs {
@@ -232,14 +233,27 @@ impl CliExecuter for Topics {
232233

233234
if pkg.is_installed() {
234235
let pkginfo = matcher.find_candidate_by_pkgname(pkg.name())?;
235-
236236
pkgs.push(pkginfo);
237237
}
238238
}
239239
}
240240

241+
for pkg in enabled_pkgs {
242+
let mut f = apt
243+
.filter_pkgs(&[FilterMode::Default])?
244+
.filter(|x| x.name() == pkg);
245+
246+
if let Some(pkg) = f.next() {
247+
if !pkg.is_installed() {
248+
continue;
249+
}
250+
251+
let pkginfo = matcher.find_candidate_by_pkgname(pkg.name())?;
252+
pkgs.push(pkginfo);
253+
}
254+
}
255+
241256
apt.install(&pkgs, false)?;
242-
apt.upgrade(Upgrade::FullUpgrade)?;
243257

244258
let code = CommitChanges::builder()
245259
.apt(apt)

0 commit comments

Comments
 (0)