summaryrefslogtreecommitdiff
path: root/src/gtk/resolver.cc
AgeCommit message (Collapse)AuthorFilesLines
2012-01-31Handle enhances/obsoletes in more places.Daniel Hartwig1-0/+3
2010-05-28Transition from log4cxx to the new logging framework.Daniel Burrows1-1/+1
Hopefully this will eliminate some of the random crashes on exit that people were seeing.
2010-04-24Fix several places where gui.h is included as a nonlocal header.Daniel Burrows1-2/+1
Using <> means the source directory isn't searched, which causes trouble with the scons build, which doesn't put the source directory into the include path. Most of aptitude follows this convention, but these two files have trouble with it.
2010-04-21Rename the log4cxx namespace to logging.Daniel Burrows1-11/+11
There are various problems with log4cxx, especially that it seems to be unreliable and leads to random crashes. It might be a good idea to eventually move to a different framework or roll our own. Decreasing the number of explicit dependencies on log4cxx is a good way to do that.
2010-03-05Overhaul the resolver to distinguish between tiers and changes to tiers; ↵Daniel Burrows1-5/+3
this is the first step towards being able to minimize the number of changes meeting a criterion. The biggest change for this is that the new cost objects (tier operations) are not totally ordered, so various places that used to take a maximum now take a least-upper-bound instead; similarly for minimum and greatest-lower-bound. Still to do: find a sound way to allow the resolver to add together costs instead of upper-bounding them: "this change will force us to remove 10 packages". The new code seems to be a little too slow -- probably it lost some optimizations by accident. It does seem to be correct, though.
2009-11-03Rename resolver_trampoline to post_thunk and move it to the main GUI header.Daniel Burrows1-8/+3
This is preparation for a future where it will be used more generally than just in the resolver.
2009-10-27Don't try to compute a new solution every time the resolver state changes in ↵Daniel Burrows1-2/+1
the upgrade fixing resolver tab. Instead, we just ensure that the first solution is generated. The main symptom of this bug was that if you ran out of solutions, then loosened a constraint so that new solutions were available, a new solution would be produced immediately.
2009-10-27When manipulating resolver entries in the GUI, copy the choices that we're ↵Daniel Burrows1-32/+43
working on before acting on any of them. This fixes crashes caused by the fact that acting on a choice could cause the tree store to be torn down and rebuilt. When we were operating on iterators of the store, this meant that the next item we operated on would access freed memory and crash.
2009-10-26Get rid of get_solution_background_blocking.Daniel Burrows1-14/+11
Now that the resolver continuations run in the foreground thread, this was causing irreconcilable deadlocks (since the foreground thread would be waiting for someone to post the return result, which could only happen when the foreground thread finished running the continuation and polled for new posted thunks).
2009-10-26Fix a typo in a text string.Daniel Burrows1-1/+1
2009-10-26Fix up more places where the wrong version was being displayed.Daniel Burrows1-14/+12
2009-10-11Run resolver continuations in the foreground thread via a trampoline callback.Daniel Burrows1-6/+24
This eliminates a whole class of bugs caused by calling into resolver routines from the background thread. The specific one I ran into here was that the resolver thread is shut down by join()ing it while its global lock is held, and it's hard to avoid that -- but most resolver routines want to take the global lock, so calling them from the background thread risks a deadlock. There is a loophole here: you can safely use the resolver manager in the background thread if you know that no-one else is accessing it. The command line frontend uses this to simplify its code.
2009-04-29Fix a missing escape_text() around a dependency string (oops).Daniel Burrows1-1/+3
2009-04-29Fix some dumb stuff with the dep_text change that somehow got by me.Daniel Burrows1-16/+17
I swear I made some of these changes in the last commit; I halfway suspect that "hg record" glitched.
2009-04-29Clean the code up a bit by making dep_text return a std::string, not a ↵Daniel Burrows1-12/+11
std::wstring. This way we don't have to do several useless conversions to and from UTF-8.
2009-04-29Include short descriptions in the resolver tab, just like in the package list.Daniel Burrows1-9/+53
I feel like this makes things a little cluttered, but the short descriptions are also very useful.
2009-04-29Set up connections to the resolver manager whenever a new manager is ↵Daniel Burrows1-0/+1
attached to a resolver tab. This was causing icons and colors of items in a solution to fail to update when the state of the items was changed (since the callbacks that trigger this were connected to the global resolver, not the one specific to the tab).
2009-04-29Make setup_resolver_connections() always discard any old connections that exist.Daniel Burrows1-0/+4
2009-04-29Log when the resolver tab gets a new manager and when it connects its ↵Daniel Burrows1-1/+11
signals to its manager.
2009-04-29Be more paranoid about NULL resolvers.Daniel Burrows1-0/+3
2009-04-27Don't crash when displaying a solution that cancels the installation of a ↵Daniel Burrows1-7/+14
package. (Closes: #525898)
2009-04-26When rejecting / accepting a collection of iterators, make a copy of the ↵Daniel Burrows1-3/+42
selection list and work on that. This fixes the warnings that were getting spewed about how we were modifying the list during iteration.
2009-04-26Don't access freed memory after applying a solution.Daniel Burrows1-4/+9
2009-04-20Change the behavior of the resolver tab to be more correct.Daniel Burrows1-29/+41
Before, the resolver would be automatically started sometimes even though the user hadn't pushed the "find next solution" button. This is now fixed: solutions won't be computed until the user is ready for them (that's important so that their rejections/approvals are reflected in any solution that gets generated).
2009-04-19Don't always display brief descriptions of unresolved recommendations in ↵Daniel Burrows1-1/+1
boldface.
2009-04-19Be more paranoid about cache closes in the resolver tab.Daniel Burrows1-1/+19
2009-04-19Use analyze_action() to generate more accurate and more complete tooltips ↵Daniel Burrows1-25/+90
for action preference icons.
2009-04-19Consolidate code to render markup for resolver choices, and make the way ↵Daniel Burrows1-173/+159
markup is used more consistent. I'm not sure the current markup is what we want, but at least it's the same everywhere and there are now fewer places to change if I decide to rip it out.
2009-04-19Overhaul the resolver tab.Daniel Burrows1-147/+633
Eliminated the previous/next holdover from the curses interface: it made sense there because of the limited real estate and input mechanisms, but in the GTK+ frontend it's much better to have a list of the already-generated solutions and a button to make a new solution. There are still a bunch of loose ends. The display of the current solution doesn't adapt well to being narrow -- I think the "action" column should be nuked and merged with "name", but I'm not sure what else to do there. Display of actions is somewhat inconsistent. It would be nice to unify them, but we should do that with an eye to the fact that differing renders are also useful. At the very least, use of text styles should be straightened out: I'm not sure that showing version numbers in a larger font works, but we should either do it everywhere or nowhere. It's scattershoot now partly because I wanted to throw lots of stuff at the wall and see what stuck. I also would not bet much money on the behavior being absolutely correct.
2009-04-19Instead of manually freeing the resolver tab when it's deleted, rely on the ↵Daniel Burrows1-1/+3
fact that if all the dependencies are fixed, the resolver tab will go away on its own. This fixes a double-free bug that was crashing the program.
2009-04-19Expose accept/reject states in the resolver view and add UI elements to ↵Daniel Burrows1-141/+645
modify them. Arguably we should have better UI here, but at least the capability is visible now.
2009-04-19Make ResolverTab::dep_text() and ResolverTab::dep_targets() const methods.Daniel Burrows1-76/+214
Actually, I bet they could be static (doesn't really matter, though).
2009-04-05Build a tree of resolver steps as the resolver runs.Daniel Burrows1-1/+1
This is in preparation for backpropagating conflict/promotion information, and in fact much of the code for that is already implemented in this commit (just not activated yet). I decided to use integer references into a deque to keep things a little more compact instead of having a huge number of structures on the heap: the resolver is already memory-hungry enough, no need to make things even worse.
2009-04-05Show tiers instead of scores in the resolver tab.Daniel Burrows1-1/+2
2009-03-23Restructure the resolver so that it stores and returns sets of choices using ↵Daniel Burrows1-107/+145
choice_sets, rather than manually storing the different types of choices in the solution object. This has two beneficial effects. First, it should make it a bit easier to add a new choice type, although many parts of the program will still have to be touched. Perhaps more importantly, this provides a cleaner conceptual model of what the resolver does: it finds "choice points" (that is to say, dependencies that need to be solved) and makes choices at them. This commit sneaks in a few optimizations that I came across in the process of rewiring all the resolver logic. The big one is that testing whether a solution violates a user constraint now requires steps proportional to the size of the solution, not to the number of user constraints. (each step is logarithmic in the number of constraints, but that's still a big improvement)
2009-02-18Close the resolver tab after the user presses "Apply Changes", and open a ↵Daniel Burrows1-0/+7
preview tab if it was an upgrade resolver.
2009-02-17Add support for trying to fix up an upgrade manually if some packages can't ↵Daniel Burrows1-21/+75
be upgraded. This is done by creating a special resolver tab, in which the initial state consists of all the upgrades that the safe upgrader could figure out. The user can then work towards a resolution to these dependencies. If the cache is closed while this resolver tab is open, it will be disabled until a new safe upgrade is calculated, and then filled in with that upgrade's information. This commit also tweaks the "number to install" message to also show how many upgrades are available. But it's still not really satisfactory. I might just go for "N upgrades out of M available upgrades" even at the cost of nested ngettext() calls (the horror!)
2009-02-17Add a logger for stuff related to the resolver tab.Daniel Burrows1-0/+34
Because "hg record" can't split diff hunks, some places that need logging are bound up in another pending commit, unfortunately.
2009-01-04Improve the note on how to do this better.Daniel Burrows1-1/+2
2009-01-04Add radio buttons to choose between showing the actions contained in a ↵Daniel Burrows1-7/+22
solution, and showing an explanation of the whole solution. The button text and tooltips still need some work IMO.
2009-01-04Implement a first cut of an explanation mode for the GUI resolver.Daniel Burrows1-1/+106
2009-01-04Extract the logic to build a tree that groups the actions of a resolver ↵Daniel Burrows1-181/+188
solution by type into its own method.
2008-11-09Remove unnecessary traces left when using the resolver.Obey Arthur Liu1-18/+3
2008-11-07Make the passing of slots between threads safer.Daniel Burrows1-5/+13
Since copying a slot is not a thread-safe operation, this commit introduces a "safe_slot" object that hides the slot behind a pointer and uses thread-safe reference counting to manage it. This should make it OK to pass slots between threads as long as the slot is only actually invoked in the thread that "owns" it. (or the slot is safe to pass around anyway)
2008-08-20Refix previous changeset. Didn't work on non-64bit architectures.Obey Arthur Liu1-3/+3
2008-08-20Fix 64-bit warnings threated as errors. Thanks to Luca Bruno. Closes ↵Obey Arthur Liu1-1/+1
http://dev.graffit.net/aptitude/trac/ticket/5 .
2008-08-16Overhaul the resolver to always update correctly and to allow the resolver ↵Daniel Burrows1-181/+357
to run in the background. The new code is based on the code from the curses UI, but adapted to the land of GTK+. This was accomplished with two main changes: (a) Instead of trying to store a resolver state and solution in the object and to use that to update, we update the display whenever the state change signal fires. This means that we're always up-to-date with the resolver state (eliminating the various cases where the resolver and the view would get out of sync). Also, we now always use the resolver state to figure out which solution is current rather than retrieving the state twice. This avoids a potential race condition that could have led to an inconsistent state display. (b) Run the resolver in the background the same way the curses UI does, and use GTK-specific code to post the result to the main thread.
2008-08-03Use "manage" everywhere to ensure that GTK+ objects get destroyed as ↵Daniel Burrows1-1/+1
appropriate.
2008-07-31Push the signal for changed packages into aptitudeDepCache.Daniel Burrows1-7/+3
My idea earlier was that it might somehow be "safer" to have the signal emitted manually by the caller. In practice, though, this just led to a situation where every caller had the same boilerplate to invoke a callback. So now I emit the signal directly in the backend; much cleaner.
2008-07-27Split gtk/gui.cc into 7 smaller files to speed up edition and compilation.Obey Arthur Liu1-0/+472