Commit Graph

37 Commits

Author SHA1 Message Date
Ettore Di Giacinto
6ba028f0ea Make sure we do compute the best fit
While install calls upgrade which in turns calls a relaxed install on
its results, this doesn't make sure that the new results are at the best
available version. We do iterate here over the results to compute the
best set.

It also expands computeUpgrade with the possibility to selectively
choose which packages to upgrade and which not.
2021-10-10 19:04:55 +02:00
Ettore Di Giacinto
1ef18ed2c5 Add salted method for assertion hashing
- Add the spec Hash as salt for image hashes
- Add tests and adapt existing ones
- Use a signature to build a spec hash

Fixes: #207
2021-05-19 17:34:01 +02:00
Ettore Di Giacinto
25f69d4f1c Bump topsort 2020-11-03 17:20:52 +01:00
Ettore Di Giacinto
102a788c91 Revert "Revert "Stabilize ordering graph""
This reverts commit 2b23016a51.
2020-11-02 15:43:35 +01:00
Ettore Di Giacinto
2b23016a51 Revert "Stabilize ordering graph"
This reverts commit 940f553e1c.
2020-11-02 15:43:15 +01:00
Ettore Di Giacinto
940f553e1c Stabilize ordering graph
In this way when we order, we always return the same solution order in
case there are weak deps.

The following is optional - it doesn't change the "correctness" of the
solver results: We add an extra edge between deps that
share common dependendencies. This makes the link more stronger and
balances the graph so it doesn't show different results for the same query, as they
could be shuffled as don't have a direct connection.
2020-11-02 14:30:41 +01:00
Ettore Di Giacinto
f6a4b634c1 Don't always walk all World() packages
With this change the solver during install now considers only the part
of the tree which is required to calculate the solution, it doesn't
consider anymore World() as the search space.

The search space now is narrowed down to the packages that related to
the one which we are considering.

In this subset of changes we are also optimizing the Parallel solver
avoiding an useless loop.

This change boost overall performance on large datasets which don't
necessarly have relations touching the whole tree.
2020-10-30 19:12:12 +01:00
Ettore Di Giacinto
9971fe9f45
Unique hashes for packages without deps 2020-05-18 19:57:01 +02:00
Ettore Di Giacinto
20cb96e0cc
Simplify ordering check
we don't need a map[string]map[string]interface{}, as we don't need to
keep the data around
2020-05-04 17:34:29 +02:00
Daniele Rondina
b68634b58a solver: skip same packages in the order and avoid loop 2020-05-04 12:21:49 +02:00
Daniele Rondina
c2e9176ab2 solver.Order now return error 2020-04-09 17:07:57 +02:00
Ettore Di Giacinto
5e8a29caf5
Detect already installed packages when calling install
We wasn't checking this previously, which was drawing weird errors on the CLI
2020-01-01 11:58:33 +01:00
Ettore Di Giacinto
15250bd991 Add support for Package provides
Add "provides" field in packages (which affect both runtime and buildtime deps).
It replaces all the occurences in the deptree before solving, actually
allowing to swap packages and provide virtuals. Along with a mechanism
for package rename #25.
2019-12-17 19:32:31 +01:00
Ettore Di Giacinto
fe608469d8
Do not call solver multiple times, reuse same assertion
Introduce Cut(), it allows to filter in the assertion to achieve the same hashes
2019-12-14 15:00:16 +01:00
Ettore Di Giacinto
c4b83605ef
Add SearchByName and avoid false positive due to greedy search 2019-12-14 09:12:49 +01:00
Ettore Di Giacinto
66f2115cd1
Decoder must search in assertions only 2019-12-13 23:45:02 +01:00
Ettore Di Giacinto
926f636dff
Revert "Do not allow multiple versions in the results"
This reverts commit 15534ce253.
2019-12-13 23:05:09 +01:00
Ettore Di Giacinto
15534ce253
Do not allow multiple versions in the results
This happens because we select the best instead of selecting the best match in Package BuildFormula()

- Extend the selection test
- Select from databases when ordering
- Relax assertions search
- Split compile step in test
- Adapt tests

Note: This is temporarly until we treat this case in BuildFormula() inside Package
we need to build the constraints between all the requires when expanding
and then create a new constraint that selects the best match
2019-12-13 22:10:12 +01:00
Ettore Di Giacinto
55fa7265e5
Move selection logic to a db accessor #19
In this way the compiler consume such accessor, and make it possible to expand whenever used
2019-12-01 19:11:31 +01:00
Ettore Di Giacinto
d0c84d24a0
Expand also when ordering assertions 2019-11-29 19:01:52 +01:00
Ettore Di Giacinto
c9d93454b8
Drop IsFlagged() from what the solver considers 2019-11-29 19:01:47 +01:00
Ettore Di Giacinto
b5381e0248
Make solver consume databases instead of world lists
first step - it is slower in the implementation for now, but all cases
seems to be sorted out.
Drop Flagged() and IsSet() from solver. the solver wont care, and only
the assertion value does matter (exception for uninstall)
2019-11-29 19:01:41 +01:00
Ettore Di Giacinto
542d45a646
Do not use interface in struct used for serialization 2019-11-23 00:29:44 +01:00
Geaaru
8989d3f8d7 Add String implementation 2019-11-16 17:29:58 +01:00
Ettore Di Giacinto
b2060c82e3
Make DB Switchable
Fixes races conditions and make the DB Switchable. Also prepare inside
the CompilationSpec the tree of the deps to be built, and parallelize
only the building jobs.

Closes #7

Signed-off-by: Ettore Di Giacinto <mudler@gentoo.org>
2019-11-16 13:26:33 +01:00
Ettore Di Giacinto
c95e0ed91d
Add revdep calculation
Add CompilationSpecs type to handle slices of CompilationSpec, to
perform operation such as Unique() and Remove().

Add also dependencies and the spec associated to the Artifact, to track
how the artifact was generated.

Add revdeps compilation wrapper, and unit tests
2019-11-15 18:11:26 +01:00
Ettore Di Giacinto
83fb1d1219
Add Matches() to pkg.Package 2019-11-15 18:04:46 +01:00
Ettore Di Giacinto
a85f4a53ec
Fix topological ordering
Keep unordered things on top and add two ways of topological sorting

Note: AssertionHash cannot order here as doesn't know the start point
2019-11-12 17:28:22 +01:00
Ettore Di Giacinto
e7a328bca7
Fix compilation and hash image calculation. Tests fails on spec (installing d) 2019-11-12 00:13:03 +01:00
Ettore Di Giacinto
8550265d75
Add assertion hashing 2019-11-11 14:58:12 +01:00
Ettore Di Giacinto
2dd56e9e49
Create a type for lists of PackageAssertion, and move Order() inside it 2019-11-11 11:02:47 +01:00
Ettore Di Giacinto
e5db47a679
Add Explain() to Assertions and Packages 2019-10-31 12:38:59 +01:00
Ettore Di Giacinto
ff582ce77c
Enhance Uninstall and resolve conflict sets
Compute a minimum conflict set over the uninstall.

Adds also tests for specific cases covered by Uninstall now
2019-06-11 18:03:50 +02:00
Ettore Di Giacinto
0bb72e67fd
Refactor package imports 2019-06-05 19:13:09 +02:00
Ettore Di Giacinto
39a3e433a7
Cleanup 2019-06-05 18:49:34 +02:00
Ettore Di Giacinto
a342bc515f
Implement basic install algorithm 2019-06-05 18:49:34 +02:00
Ettore Di Giacinto
1084941240
Draft 2019-06-05 18:49:34 +02:00