Skip to content

[Help] WrongArgs error when using the trans_add_pkg function. #53

@hbacelar8

Description

@hbacelar8

I'm trying to establish a transaction step by step and I keep getting a WrongArgs error when using the trans_add_pkg passing a &Package. Here's an example:

use alpm::{Alpm, Error, SigLevel, TransFlag};

fn main() -> Result<(), Error> {
    let alpm = Alpm::new("/", "/var/lib/pacman")?;
    alpm.register_syncdb("core", SigLevel::USE_DEFAULT)?;
    alpm.register_syncdb("extra", SigLevel::USE_DEFAULT)?;

    alpm.trans_init(TransFlag::NO_LOCK)?;

    let pkg = alpm.localdb().pkg("tevent")?;
    alpm.trans_add_pkg(pkg)?;

    let pkgs = alpm.trans_add();

    for pkg in pkgs {
        println!("{}", pkg.name());
    }

    Ok(())
}

If, instead of adding a singular package, I call the sync_sysupgrade, it works fine and all upgradable packages are successfully added.

Am I doing something wrong? A WrongArgs in this case really gives me no clue of what it could be.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions