Skip to content

Using aurman as dependency solver

Jonni Westphalen edited this page Jun 20, 2018 · 18 revisions

It is possible to use aurman as dependency solver only.

Usage

Instead of calling aurman with the relevant options, call aurmansolver instead.

The operation has to be -S or --sync.

The command line options which will be used by the solver are:

  • --devel - notice: will not fetch new pkgbuilds and hence does not require user input
  • --deep_search
  • --aur
  • --repo
  • --domain name
  • --holdpkg name
  • --holdpkg_conf
  • --needed
  • --ignore
  • --ignoregroup
  • -u, --sysupgrade
  • --optimistic_versioning
  • --rebuild

explanations of those options are in the README.md of the GitHub repository

To receive the packages installed on your system not known in either repos or the aur, execute aurmansolver with --show_unknown, e.g. aurmansolver -Su --show_unknown. aurmansolver prints only those packages with that flag, \n separated.

Output

Return code

will be 0 in case of at least one valid solution,

1 otherwise.

stdout

In case of at least one valid solution, stdout will contain only the solutions.

JSON is used in this case.

Python code for the printing:

# fetch valid solutions
sol_tuples = installed_system.validate_solutions(solutions, concrete_packages_to_install)
valid_solutions = [sol_tuple[1] for sol_tuple in sol_tuples]
if not valid_solutions:
    aurman_error("we could not find a solution")
    aurman_error("if you think that there should be one, rerun aurman with the --deep_search flag")
    sys.exit(1)

print(json.dumps(
    [valid_solutions, installed_system.differences_between_systems([sol_tuple[0] for sol_tuple in sol_tuples])],
    cls=SolutionEncoder, indent=4))

Hence the whole output is of the following form:

[
    valid_solutions, 
    installed_system.differences_between_systems(...)
]
valid_solutions explained
[
    [solution1, solution2, ...], 
    installed_system.differences_between_systems(...)
]
[
    [
        solution1,
        solution2,
        ...
    ], 
    installed_system.differences_between_systems(...)
]
[
    [
        [package1, package2, ...],
        [package1, package2, ...],
        ...
    ], 
    installed_system.differences_between_systems(...)
]
[
    [
        [
            package1,
            package2,
            ...
        ],
        [
            package1,
            package2,
            ...
        ],
        ...
    ], 
    installed_system.differences_between_systems(...)
]
[
    [
        [
            { package1 values },
            { package2 values },
            ...
        ],
        [
            { package1 values },
            { package2 values },
            ...
        ],
        ...
    ], 
    installed_system.differences_between_systems(...)
]

Notice: for the currently possible values for the package see:

src/aurman/classes.pyclass Packagedef __init__


installed_system.differences_between_systems(...) explained
def differences_between_systems(self, other_systems: Sequence['System']) -> Tuple[
    Tuple[Set['Package'], Set['Package']], List[Tuple[Set['Package'], Set['Package']]]]:
    """
    Evaluates differences between this (.self) system and other systems.

    :param other_systems:   The other systems.
    :return:

                            NOTICE: NONE of the following items
                            contains packages, which
                            are ALREADY INSTALLED on this
                            system AND will NOT be REMOVED!
                            In short: Do not show,
                            what does not change!

                            NOTICE FOR NOTICE:  Packages with another
                                                version are OTHER packages
                                                hence UPDATES will be listed as
                                                old package removed,
                                                new package installed

                            LAST NOTICE: tl;dr read the sourcecode!

                            A tuple containing two items:

                                First item:
                                    Tuple containing two items:
                                        First item:
                                            installed packages in comparison to this system,
                                            which are installed in ALL other systems
                                        Second item:
                                            uninstalled packages in comparison to this system,
                                            which are in ALL other systems NOT installed and HENCE
                                            uninstalled in comparison to this system

                                Second item:
                                    List containing tuples with two items each:
                                        For the i-th tuple (all in all as many tuples as other systems):
                                            First item:
                                                installed packages in comparison to this system,
                                                which are installed in the i-th other system
                                                but NOT in ALL other systems
                                            Second item:
                                                uninstalled packages in comparison to this system,
                                                which are in the i-th other system NOT installed
                                                and HENCE uninstalled in comparison to this system
                                                but NOT in ALL other systems not installed

                            REALLY LAST NOTICE (promised):
                                                            To get all packages which will be installed
                                                            with the i-th solution,
                                                            union of the installed packages in ALL other systems
                                                            and the installed packages of the i-th other system is
                                                            the answer

                                                            same for the uninstalled packages
    """

Example

Example output for aurmansolver -S arch-audit-git:

[
    [
        [
            {
                "name": "rust",
                "version": "1:1.24.1-1",
                "depends": [
                    "gcc-libs",
                    "curl",
                    "libssh2"
                ],
                "conflicts": [
                    "cargo",
                    "rustfmt"
                ],
                "optdepends": [],
                "provides": [
                    "cargo",
                    "rustfmt"
                ],
                "replaces": [
                    "cargo",
                    "rustfmt"
                ],
                "pkgbase": "rust",
                "install_reason": null,
                "makedepends": null,
                "checkdepends": null,
                "type_of": "REPO_PACKAGE",
                "repo": "community",
                "groups": []
            },
            {
                "name": "arch-audit-git",
                "version": "0.1.8.r0.gc078e16-1",
                "depends": [
                    "curl"
                ],
                "conflicts": [
                    "arch-audit"
                ],
                "optdepends": [],
                "provides": [
                    "arch-audit"
                ],
                "replaces": [],
                "pkgbase": "arch-audit-git",
                "install_reason": null,
                "makedepends": [
                    "cargo",
                    "pkg-config",
                    "git"
                ],
                "checkdepends": [],
                "type_of": "DEVEL_PACKAGE",
                "repo": null,
                "groups": []
            }
        ],
        [
            {
                "name": "rustup",
                "version": "1.11.0-1",
                "depends": [],
                "conflicts": [
                    "rust",
                    "cargo",
                    "rustfmt"
                ],
                "optdepends": [],
                "provides": [
                    "rust",
                    "cargo",
                    "rust-nightly",
                    "cargo-nightly",
                    "rustfmt"
                ],
                "replaces": [],
                "pkgbase": "rustup",
                "install_reason": null,
                "makedepends": null,
                "checkdepends": null,
                "type_of": "REPO_PACKAGE",
                "repo": "community",
                "groups": []
            },
            {
                "name": "arch-audit-git",
                "version": "0.1.8.r0.gc078e16-1",
                "depends": [
                    "curl"
                ],
                "conflicts": [
                    "arch-audit"
                ],
                "optdepends": [],
                "provides": [
                    "arch-audit"
                ],
                "replaces": [],
                "pkgbase": "arch-audit-git",
                "install_reason": null,
                "makedepends": [
                    "cargo",
                    "pkg-config",
                    "git"
                ],
                "checkdepends": [],
                "type_of": "DEVEL_PACKAGE",
                "repo": null,
                "groups": []
            }
        ]
    ],
    [
        [
            [
                {
                    "name": "arch-audit-git",
                    "version": "0.1.8.r0.gc078e16-1",
                    "depends": [
                        "curl"
                    ],
                    "conflicts": [
                        "arch-audit"
                    ],
                    "optdepends": [],
                    "provides": [
                        "arch-audit"
                    ],
                    "replaces": [],
                    "pkgbase": "arch-audit-git",
                    "install_reason": null,
                    "makedepends": [
                        "cargo",
                        "pkg-config",
                        "git"
                    ],
                    "checkdepends": [],
                    "type_of": "DEVEL_PACKAGE",
                    "repo": null,
                    "groups": []
                }
            ],
            []
        ],
        [
            [
                [
                    {
                        "name": "rust",
                        "version": "1:1.24.1-1",
                        "depends": [
                            "gcc-libs",
                            "curl",
                            "libssh2"
                        ],
                        "conflicts": [
                            "cargo",
                            "rustfmt"
                        ],
                        "optdepends": [],
                        "provides": [
                            "cargo",
                            "rustfmt"
                        ],
                        "replaces": [
                            "cargo",
                            "rustfmt"
                        ],
                        "pkgbase": "rust",
                        "install_reason": null,
                        "makedepends": null,
                        "checkdepends": null,
                        "type_of": "REPO_PACKAGE",
                        "repo": "community",
                        "groups": []
                    }
                ],
                []
            ],
            [
                [
                    {
                        "name": "rustup",
                        "version": "1.11.0-1",
                        "depends": [],
                        "conflicts": [
                            "rust",
                            "cargo",
                            "rustfmt"
                        ],
                        "optdepends": [],
                        "provides": [
                            "rust",
                            "cargo",
                            "rust-nightly",
                            "cargo-nightly",
                            "rustfmt"
                        ],
                        "replaces": [],
                        "pkgbase": "rustup",
                        "install_reason": null,
                        "makedepends": null,
                        "checkdepends": null,
                        "type_of": "REPO_PACKAGE",
                        "repo": "community",
                        "groups": []
                    }
                ],
                []
            ]
        ]
    ]
]

Notice: type_of may contain AUR_PACKAGE, DEVEL_PACKAGE, REPO_PACKAGE or PACKAGE_NOT_REPO_NOT_AUR

DEVEL_PACKAGE packages are AUR packages, but with a development ending as it was detected by aurman.

For the possible Enum values see:

src/aurman/classes.pyclass PossibleTypes

Example explained: 2 possible solutions are availabe.

  • install rust, arch-audit-git
  • install rustup, arch-audit-git

In all (both) solutions will arch-audit-git be installed

There is no such package which will be deleted in all solutions


In the first solution rust will be installed as package, which will not be installed in ALL solutions

No package will be uninstalled, which will not be uninstalled in ALL solutions


In the second solution rustup will be installed as package, which will not be installed in ALL solutions

No package will be uninstalled, which will not be uninstalled in ALL solutions


So, to get the packages which will be installed with the first solution:

set(arch-audit-git) | set(rust) = set(arch-audit-git, rust)

packages uninstalled: set() | set() = set()


Same for the second solution with rustup

installed: set(arch-audit-git) | set(rustup) = set(arch-audit-git, rustup)

packages uninstalled: set() | set() = set()


In case of no valid solution, the content of stdout is not strictly defined. It will contain the default aurman error messages. e.g.

aurmansolver -S plasma-git-meta yields:

!! While searching for solutions the following errors occurred:
:: Not provided: botan-1.10 but needed by qca-qt5-git-v2.1.1.7.g558f819-1
:: Not provided: discover-git but needed by plasma-git-meta-20151106-1
:: Not provided: oxygen-git but needed by plasma-git-meta-20151106-1

!! we could not find a solution
!! if you think that there should be one, rerun aurman with the --deep_search flag

Notice: For parsing of those messages see:

src/aurman/classes.pyclass DepAlgoFoundProblems and all subclasses

def __repr__ defines the error messages.