Skip to content

Commit a90ced5

Browse files
committed
Use fresh alpm instance to check install queue flush
1 parent 3620089 commit a90ced5

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

src/config.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ impl Config {
688688
Ok(())
689689
}
690690

691-
pub fn init_alpm(&mut self) -> Result<()> {
691+
pub fn new_alpm(&self) -> Result<alpm::Alpm> {
692692
let mut alpm = alpm_utils::alpm_with_conf(&self.pacman).with_context(|| {
693693
tr!(
694694
"failed to initialize alpm: root={} dbpath={}",
@@ -715,7 +715,11 @@ impl Config {
715715
alpm.add_ignoregroup(group.as_str())?;
716716
}
717717

718-
self.alpm = Alpm::new(alpm);
718+
Ok(alpm)
719+
}
720+
721+
pub fn init_alpm(&mut self) -> Result<()> {
722+
self.alpm = Alpm::new(self.new_alpm()?);
719723
Ok(())
720724
}
721725

src/install.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,11 +1392,12 @@ fn build_install_pkgbuild<'a>(
13921392
let c = config.color;
13931393
let mut debug_paths = HashMap::new();
13941394
let dir = config.build_dir.join(base.package_base());
1395-
let db = config.alpm.localdb().pkgs();
13961395

1397-
let satisfied = !config.chroot
1398-
&& config.batch_install
1399-
&& base
1396+
let mut satisfied = false;
1397+
if !config.chroot && config.batch_install {
1398+
let db = config.new_alpm()?;
1399+
let db = db.localdb().pkgs();
1400+
if base
14001401
.pkgs
14011402
.iter()
14021403
.flat_map(|pkg| {
@@ -1406,7 +1407,11 @@ fn build_install_pkgbuild<'a>(
14061407
.chain(&pkg.pkg.make_depends)
14071408
.chain(&pkg.pkg.check_depends)
14081409
})
1409-
.all(|dep| db.find_satisfier(dep.as_str()).is_some());
1410+
.all(|dep| db.find_satisfier(dep.as_str()).is_some())
1411+
{
1412+
satisfied = true
1413+
}
1414+
}
14101415

14111416
if !config.chroot && !satisfied {
14121417
do_install(config, deps, exp, install_queue, *conflict, devel_info)?;

0 commit comments

Comments
 (0)