use alpm::{Alpm, Error, SigLevel, TransFlag};
fn main() {
let mut handle = Alpm::new("/", "tests/db").unwrap();
let db = handle.register_syncdb_mut("core", SigLevel::NONE).unwrap();
db.add_server("https://ftp.rnl.tecnico.ulisboa.pt/pub/archlinux/core/os/x86_64")
.unwrap();
let core = handle
.syncdbs()
.iter()
.find(|db| db.name() == "core")
.unwrap();
let pkg = core.pkg("filesystem").unwrap();
let flags = TransFlag::DB_ONLY | TransFlag::NO_DEPS;
handle.trans_init(flags).unwrap();
handle.trans_add_pkg(pkg).unwrap();
handle.sync_sysupgrade(false).unwrap();
handle.trans_prepare().unwrap();
let toinstall = handle.trans_add();
println!("{:#?}", toinstall);
assert!(handle.trans_commit().unwrap_err().error() == Error::Retrieve);
}