Commit Graph

93 Commits (b960759daa5cdc6e7fa04126bc501480fefbdf86)

Author SHA1 Message Date
Timo Teräs b960759daa solver: fix reset of last_touched to zero 2013-01-18 16:21:38 +02:00
Timo Teräs cb15b31b79 solver: some code clean ups 2013-01-18 16:20:55 +02:00
Natanael Copa 3c40070752 solver: build fix for debug print on x86_64
use %zu for size_t
2013-01-18 14:46:25 +01:00
Timo Teräs 86a7338575 solver: fix name assignment logic to not mess up internal state
Should get rid of error messages like:
ERROR: Saved_score {4/0/0,74} != score {6/0/0,74}
2013-01-18 11:38:31 +02:00
Timo Teräs 832dfed637 solver: fix package prefence calculation a bit 2012-11-04 12:13:19 +02:00
Timo Teräs 16b70566bf solver: additional backjumping scheme
Enabled when all attempts to satisfy a name failed, we know that we
can ignore all decisions until we find a decision affecting the name
we wanted to satisfy.
2012-10-08 15:22:06 +03:00
Timo Teräs 01d0e4c408 solver: optimize backjumping
to be functional when backtracking
2012-10-08 12:25:43 +03:00
Timo Teräs 831bce5cf9 solver: properly calculate decision "strength" with provides 2012-10-08 11:50:52 +03:00
Timo Teräs dec409c6d4 solver: fix back jumping once more 2012-10-05 17:26:53 +03:00
Timo Teräs bc7e8f5da8 solver: record dependency apk_name in apk_decision
We can't just use the primary name, as that would mess up
backtracking. We need to record the name which caused the name
to get considered - that way the right last_touched_decision is
used on backtracking.
2012-10-05 15:48:12 +03:00
Timo Teräs 4dd8c58df9 solver: various fixes
* push_decision expects to always get the package primary 'name'
   as apk_name. ASSERT that and fix problem cases.
   (though - this might need to be reverted, and store the non
    primary name in apk_decision instead to accomodate for better
    backtracking optimizations)
 * fix error reporting of virtual package names
 * make 'assign_name' errors soft. the incorrect packages just are
   no longer consider instead of aborting whole calculation.
 * fix backtracking of virtual packages that are not depended
   directly
2012-10-03 15:07:31 +03:00
Natanael Copa 081155c438 solver: improve assert error messages
Print name of package and void double "ERROR"
2012-10-03 09:16:28 +02:00
Natanael Copa 00958d9207 solver: fix compile with -Werror on 64bit 2012-10-03 09:04:35 +02:00
Timo Teräs 43850a126b apk: implement --progress-fd to write progress to a specified fd 2012-09-20 15:12:15 +03:00
Timo Teräs bbba72c694 solver: fix install_if triggers on cyclic and early deps 2012-04-27 09:13:11 +03:00
Timo Teräs 29c7fb359e solver: fix backtracking with install_if dependencies 2012-04-27 08:47:20 +03:00
Timo Teräs 7458e4d3f4 solver: fix a type from previous commit 2012-03-31 23:31:43 +03:00
Timo Teräs a57db1bba0 solver: fix installation of non-repository packages 2012-03-31 23:27:15 +03:00
Timo Teräs 5ae0206d0b solver: properly set allowed flag for installed packages 2012-03-01 15:17:58 +02:00
Timo Teräs 3e429a8100 solver: rename some fields 2012-02-29 13:15:10 +02:00
Timo Teräs 2f66295fc7 solver: merge apk_name_state to apk_name
apk_name_state is now quite small; and we avoid overhead of two
pointers (+ malloc overhead) when we just make it part of apk_name.
It also fixes some problems (that got introduced) where apk_name_state
was not allocated.
2012-02-29 11:26:12 +02:00
Timo Teräs f27f194d92 solver, test: make conflicts unconditional
Solver will now never report partial solution where a conflict
constraint is not satisfied. The is because with --force we might
install the partial solution; and if conflicted packages were to
be installed we might have extra trouble.
2012-02-29 08:53:43 +02:00
Timo Teräs ef53dd52c5 solver: ask confirmation in interactive mode only if there's changes 2012-02-28 11:32:39 +02:00
Timo Teräs c7bd973367 solver: do not consider non-allowed packages in main loop
Instead cache the allowed pinning decision, and use it. Update
install decision heuristic to also use this cached information.
2012-02-28 11:27:56 +02:00
Timo Teräs 2655d27ea1 solver: consider provided names also for preference
ref #574
2012-02-28 11:27:17 +02:00
Timo Teräs 179b453ab7 solver: fix conflicting provides detection
ref #574
2012-02-28 10:28:39 +02:00
Timo Teräs 536c21979b solver: allow multiple packages with same virtual provides
ref #574
2012-02-28 09:39:35 +02:00
Timo Teräs b7a22e555f solver, test: implements more provides things, add tests
ref #574
2012-02-27 16:35:04 +02:00
Timo Teräs 1074c4d326 solver: have most inherited things per-package and clean ups
Required for provides support as package might be pulled in via
non-primary package name. This allows relatively easily to pass
through inherited flags via the provided names. ref #574.
2012-02-27 10:26:30 +02:00
Timo Teräs f0f2029eb1 solver: remove minimum penalty logic
Reasoning:
- it is less useful now that we do not do common dependency merging
- provides support would make the required logic overly complicated
- callgrind reports that depending on the case it can improve or
  decrease performance (the overhead pays off only in some cases);
  the difference is not large either way
2012-02-27 08:29:35 +02:00
Timo Teräs 12bdec38a3 solver, dot: elementary provides fixes
implementation is still not near finished, but now at least it
can handle it to a minimum degree. many cases are not done right
yet, though. ref #574.
2012-02-24 18:29:30 +02:00
Timo Teräs 99145e2c0d all: introduce apk_provides and use it in apk_name
in preparation for provides support. implements also some
dependency satisfaction helper routines.

ref #574.
2012-02-24 16:31:40 +02:00
Timo Teräs 97d44b5a00 solver: unallowed pinning is worse than changing installed package 2012-02-24 16:27:51 +02:00
Timo Teräs d420d41148 solver: non preferred actions are worse then non preferred pinning
Otherwise we might start to change packages unexpectedly when not
upgrading. This also fixes some other things the solver might've
decided to do.

Add also few test cases to detect bad behaviour.
2012-02-24 11:13:31 +02:00
Timo Teräs 4676c5d63a test: improve pinning tests 2012-02-24 08:42:40 +02:00
Timo Teräs 1bb2fa7862 solver: fix output of broken dependencies 2012-02-23 22:05:33 +02:00
Timo Teräs a9a84215c7 solver: report size difference in kibi- or mebibytes 2012-02-23 16:02:03 +02:00
Timo Teräs d633746892 solver: lock early names that have only single option left
care is needed to get the score right.
2012-02-22 13:09:51 +02:00
Timo Teräs 93a0f0b3cc solver: lazily update name state in main loop 2012-02-22 12:59:46 +02:00
Timo Teräs b9f3db2158 solver: handle fix/reinstall better
In case someone did "fix --force" for package for which we have no
APK available, we would uninstall the package instead of silently
ignoring the request. This could mean worse things.

So now we just consider unavailable packages a bad deal for reinstall
requests. And will downgrade if necessary. But if we really don't
have any APK available, we just skip the request but report it.
2012-02-22 10:31:07 +02:00
Timo Teräs a7500a9df5 solver: transitive dependency requiring
If n+1 packages depend A, and A depend on B. Add n+1 dependencies
to B. Otherwise if someone conflicts B, B might be left out.

Leaving package unassigned is no longer a non-preferred action,
this fixes the final test case that was failing.

And with --force we might even install that scenario.
Add also some debug checks.
2012-02-22 09:43:47 +02:00
Timo Teräs 955153eac2 solver: remove dependency merging; it's not worth it
callgrind says it's more overhead than improvement. back jumping
effectively prunes all bad trees. but can be added later if it
becomes needed; due to e.g. provides support.
2012-02-22 09:08:14 +02:00
Timo Teräs bf82e2e5fd db, solver, io: scan cache items at startup
It is faster to just scan the cache directory for existing packages
at startup than trying to faccessat() them on demand. It also makes
quite a few parts of the code more readable and simpler.
2012-02-22 08:45:40 +02:00
Timo Teräs 568d57336d solver: make apk_score a 64-bit int for speed 2012-02-21 11:01:21 +02:00
Timo Teräs c18e159185 solver: remove unneeded flag 2012-02-21 10:36:26 +02:00
Timo Teräs 6f237d9149 solver: implement backwards jumping and various other optimizations 2012-02-21 09:19:24 +02:00
Timo Teräs 6ae573887d solver: rewrite backtracking and scoring system
* properly do absolute scoring now, the previous scoring where
  preference could get reduced could have caused incorrect early
  pruning of search tree

* backtracking is now separated from package state, and first
  branching point is the decision if a name is left unassigned
  or if something _has_ to be assigned. this allows multiple future
  search tree optimizations like handling of common dependencies
  early.

* merge common dependency names early to provide deeper forward
  checking.
2012-02-20 13:02:09 +02:00
Timo Teräs a9d526836e apk: fix some unharmful leaks reported by valgrind 2012-02-17 10:02:44 +02:00
Timo Teräs 15c920ab90 solver: get rid of saved score in backtracking
also, discover late if package is needed or not.
2012-02-17 09:43:14 +02:00
Timo Teräs 4bc8add78d solver: convert some package state flags to bitfields 2012-02-16 21:46:09 +02:00