History log of /haikuporter/HaikuPorter/DependencyResolver.py
Revision Date Author Comments
# 377491ee 18-Oct-2023 OscarL <oscar.lesta@gmail.com>

Fix #256. (#275)


# f197120d 18-Sep-2023 jurgenwigg <53076001+jurgenwigg@users.noreply.github.com>

Import statements sorted with isort and fixed MockBuilder.py (#266)

* Fixed missing closing bracket in the MockBuilder.py

* Import statements sorted with isort


# 8d5c14b6 31-Jan-2020 Michael Lotz <mmlr@mlotz.ch>

python3: Finish python3 change. python2 breaking

* Based on mmlr's 2017 work to use Python3 with
changes and adjustments for the current codebase


# 2cc27775 22-Sep-2019 alaviss <alaviss@users.noreply.github.com>

DependencyResolver: remove whitespace before passing to pkgman (#191)

pkgman doesn't seem to be able to process this: 'cmd:lrelease >= 5', but
it can if you remove all the spaces: 'cmd:lrelease>=5'.

This appears to be a bug in our outdated `libsolv`, which probably won't
be updated anytime soon.

Fixes #188


# 7ef59ca2 31-Mar-2018 Michael Lotz <mmlr@mlotz.ch>

DependencyResolver: Use stopAtHpkgs for --update-dependencies.

The existing mechanism to stop propagation across HPKGs works for the
--update-dependencies case as well and removes the need for the custom
logic in the DependencyResolver.


# 3d118f80 17-Mar-2018 Michael Lotz <mmlr@mlotz.ch>

Introduce TEST_REQUIRES for test-only requires.

This lets recipes specify dependencies that are only needed for the test
phase. Separating them out from BUILD_[PRE]REQUIRES allows for
situations that could otherwise result in cyclic dependencies.

Note that this bumps the repository format version, causing a repository
rebuild (re-parsing of all recipes, flushing of all caches). This is
required because the dependency info files and various caches need to be
regenerated to cope with the added test requires keys.

Fixes #151.


# 2b7ba23e 17-Dec-2017 Michael Lotz <mmlr@mlotz.ch>

DependencyResolver: Avoid needless creation of PackageNodes.

These duplicate PackageNodes were just created to be converted to a
string. Use the list of pending nodes instead, which contains the same
info.


# b1ae63d0 16-Dec-2017 Michael Lotz <mmlr@mlotz.ch>

DependencyResolver: Cache successful dependency resolution.

Dramatically cuts down the overhead when doing multiple dependency
resolutions as common dependencies don't need to be fully resolved each
time. This impacts consistency checks (package repository and
repository) that now run in a fraction of the time.


# 05732a24 16-Dec-2017 Michael Lotz <mmlr@mlotz.ch>

DependencyResolver: Move updateDependencies evaluation to init.


# cac46dfd 10-Dec-2017 Michael Lotz <mmlr@mlotz.ch>

DependencyResolver: Fix missing superclass init in restart.


# 269954fb 10-Dec-2017 Michael Lotz <mmlr@mlotz.ch>

Cleanup: Make some constructs more idiomatic.

* Change 'not x in y' to 'x not in y'.
* Use 'is' to compare None singleton.
* Use 'instanceof(x, y)' instead of 'type(x) == y'.
* Replace map builtin with list comprehension.
* Rename self argument to cls for static method.


# 5184286e 05-Dec-2017 Michael Lotz <mmlr@mlotz.ch>

DependencyResolver: Add quiet keyword arg to prevent printing.


# dc967bc0 05-Dec-2017 Michael Lotz <mmlr@mlotz.ch>

DependencyResolver: Make build platform optional.

It is only used to get the implicit provides of the platform.


# a956c70f 05-Dec-2017 Michael Lotz <mmlr@mlotz.ch>

DependencyResolver: Factor out population of ProvidesManager.

This will allow reuse of the DependencyResolver with less overhead.


# c5705a42 26-Nov-2017 Michael Lotz <mmlr@mlotz.ch>

DependencyResolver: Try harder to resolve dependencies.

When a dependency of a package can't be met, remove the provides of that
package from the ProvidesManager and restart the dependency resolution.

This allows to still find valid solutions where dependencies can be met
by multiple sources of which earlier ones fail to have their requires
fulfilled.

For example:

program.recipe requires lib:first
libfirst-1.0.hpkg provides lib:first requires lib:second >= 1
libfirst-1.1.recipe provides lib:first requires lib:second >= 2
libsecond-2.0.hpkg provides lib:second == 2 compat >= 2

In the case above, the dependency lib:second of libfirst-1.0.hpkg
can't be resolved, because libsecond-2.0.hpkg provides an incompatible
version. However, the recipe for libfirst-1.1 would build a compatible
package and should therefore be used instead. Before this change,
dependency resolution would fail at the former. Now it will remove
the source of the provides that can't have its dependencies met,
libfirst-1.0.hpkg in the example above, and restart the dependency
resolution so that libfirst-1.1.recipe will be picked up and built.

The dependency resolution failures are collected and a combined message
including all of them is presented if the dependency resolution
ultimately still fails. This has the nice effect of showing the whole
dependency tree that failed, not just the last leave, which should make
it more obvious why a certain, possibly indirect, unresolved dependency
was pulled in in the first place.


# f8773d23 09-Nov-2017 Michael Lotz <mmlr@mlotz.ch>

BuildMaster: Make skip reason include unresolved dependencies.

Also drop the verbose debug output of used repositories.


# 5c66dddf 15-Oct-2017 Michael Lotz <mmlr@mlotz.ch>

DependencyResolver: Make HPKG parse errors non-fatal.

These come from various repositories and may contain broken package
files. Warn instead of exiting in such cases. Still treat errors in
other types of PackageInfo sources as fatal as these are under direct
management of HaikuPorter and errors there should be highlighted.


# e997f48d 17-Sep-2017 Adrien Destugues <pulkomandy@pulkomandy.tk>

Use a more precise regexp to parse pkgman output.

Matching anything that ends with ".hpkg" is a bad idea when the URL has
"eu.hpkg" in it. Now we use greedy matching and a capturing group to
make sure only the last ".hpkg" in an URL is found.


# 6bbf293c 16-Nov-2016 Jerome Duval <jerome.duval@gmail.com>

Add option --update-dependencies


# 71a83f90 18-Dec-2016 Jessica Hamilton <jessica.l.hamilton@gmail.com>

Use Unicode strings for warn() & sysExit().


# da22310c 21-Nov-2015 Michael Lotz <mmlr@mlotz.ch>

DependencySolver: Add way to track present dependency packages.

When a list for tracking present dependency packages is supplied, all
packages that are directly or indirectly required and already present
will be collected into that list.


# d116b248 21-Nov-2015 Michael Lotz <mmlr@mlotz.ch>

DependencyResolver: Cache all package infos.

The package infos from HPKGs were already cached at a deeper level, but
the DependencyInfo based ones were not. This lead to a lot of
unnecessary file reading/parsing. Instead of caching them at the
PackageInfo level, do that directly in the DependencyResolver.


# 56499b3c 22-Nov-2015 Michael Lotz <mmlr@mlotz.ch>

ShellScriptlets: Internalize parsing of scriptlet prerequires.

Reduces duplication and knowledge of the original format.


# ff5f53eb 07-Jun-2015 Jessica Hamilton <jessica.l.hamilton@gmail.com>

Add --get-dependencies option to haikuporter.

This will automatically search for packages with pkgman,
which get installed to your system. Use with caution!

Using --get-dependencies automatically sets --no-dependencies,
so you'll still need to manually build packages which aren't
available using pkgman.


# 2506419d 03-Dec-2014 Oliver Tappe <zooey@hirschkaefer.de>

Handle scriptlet-prerequires when resolving dependencies, too.

* That part apparently has been lost during the rewrite of the resolver.


# 4a148f26 20-Nov-2014 Oliver Tappe <zooey@hirschkaefer.de>

Add new DependencyResolver.

* Instead of delegating the dependency resolution to pkgman, this class
implements a manual, graph-based dependency resolution algorithm:
+ Starting from a set of given dependency info files, a graph of
package nodes is built, taking into account the different types
of requires (requires, build-requires and build-prerequires).
+ For each package node, all the dependencies are processed and
(depending on the type of file that the package node represents)
added to the graph, too, until all dependencies have been handled.
+ The resulting graph is sorted topologically, yielding a list of
packages that can be built one after the other in that order.


# ff5f53ebcb1b5a5216f89bd078d54675ded57f7e 07-Jun-2015 Jessica Hamilton <jessica.l.hamilton@gmail.com>

Add --get-dependencies option to haikuporter.

This will automatically search for packages with pkgman,
which get installed to your system. Use with caution!

Using --get-dependencies automatically sets --no-dependencies,
so you'll still need to manually build packages which aren't
available using pkgman.


# 2506419de9cc2ee8ff5eb04b9f4a9f173d5bb659 03-Dec-2014 Oliver Tappe <zooey@hirschkaefer.de>

Handle scriptlet-prerequires when resolving dependencies, too.

* That part apparently has been lost during the rewrite of the resolver.


# 4a148f26d9aded2864f096a54f04e9faf5b7a780 20-Nov-2014 Oliver Tappe <zooey@hirschkaefer.de>

Add new DependencyResolver.

* Instead of delegating the dependency resolution to pkgman, this class
implements a manual, graph-based dependency resolution algorithm:
+ Starting from a set of given dependency info files, a graph of
package nodes is built, taking into account the different types
of requires (requires, build-requires and build-prerequires).
+ For each package node, all the dependencies are processed and
(depending on the type of file that the package node represents)
added to the graph, too, until all dependencies have been handled.
+ The resulting graph is sorted topologically, yielding a list of
packages that can be built one after the other in that order.