summaryrefslogtreecommitdiffstats
path: root/pym
Commit message (Collapse)AuthorAgeFilesLines
* * Since can_poll_pty() is unsafe due to he possibility of the poll() callZac Medico2008-07-132-58/+27
| | | | | | | | | blocking forever, replace it with a simpler test on /dev/null that's derived from a test in a glib2 configure script. * Remove PtyReaderTestCase since it has the same problem as can_poll_pty(). svn path=/main/trunk/; revision=11039
* In can_poll_tty(), direct bash's stderr into the pty since we don't wantZac Medico2008-07-131-1/+1
| | | | | | | | | so see any error message it generates (due to PipeReader closing it's end of the pty). The error message is irrelevant since all we want to know is whether or not the data is successfully transmitted through the pty. svn path=/main/trunk/; revision=11037
* Changes to pym/_emerge/__init__.py from the previous commit weren't meantZac Medico2008-07-131-21/+3
| | | | | | to be committed yet. svn path=/main/trunk/; revision=11035
* Fix broken binpkg path comparison in in binarytree.inject() so that duplicateZac Medico2008-07-132-4/+22
| | | | | | entries are correctly from the Packages index. svn path=/main/trunk/; revision=11034
* In order to avoid having BlockerDB instantiate a new FakeVartree for eachZac Medico2008-07-131-9/+110
| | | | | | | | merge, add a FakeVartree.sync() method and so that the same FakeVartree can be reused. Package counters and timestamps are used to validate package instances during each sync() call. svn path=/main/trunk/; revision=11033
* Fix Scheduler._schedule_tasks() so that it never schedules a task when aZac Medico2008-07-131-1/+1
| | | | | | package has already failed. svn path=/main/trunk/; revision=11032
* Decrement the job count prior to merging a given package (after it's beenZac Medico2008-07-131-9/+7
| | | | | | | built or extracted). This will allow additional jobs to spawn sooner in some cases when there may be idle resources. svn path=/main/trunk/; revision=11031
* * Wrap calls to PollScheduler._schedule_tasks() with a _schedule() methodZac Medico2008-07-121-5/+25
| | | | | | | | | | | | | | | that automatically returns early from any recursive calls that the _schedule_tasks() call might trigger. This makes _schedule() safe to call from inside exit listeners. * Call _schedule() inside Scheduler._job_exit() to trigger a new job when possible. * Fix SequentialTaskQueue._task_exit() to avoid a potential KeyError if the task had already been removed from self.running_tasks for some reason. svn path=/main/trunk/; revision=11030
* Rename PollScheduler._schedule() to _schedule_wait().Zac Medico2008-07-121-4/+4
| | | | svn path=/main/trunk/; revision=11029
* Remember to close file descriptors before returning early from can_poll_pty().Zac Medico2008-07-121-0/+2
| | | | svn path=/main/trunk/; revision=11028
* Add missing self.wait() calls when tasks return unsuccessfully.Zac Medico2008-07-121-2/+8
| | | | svn path=/main/trunk/; revision=11027
* Set self._mergelist inside Scheduler._calc_resume_list() since it needs toZac Medico2008-07-121-5/+6
| | | | | | be set when calling _set_digraph(). svn path=/main/trunk/; revision=11026
* Implement a runtime test that checks whether it's possible to use poll() toZac Medico2008-07-121-9/+69
| | | | | | | | | | | read data from a pty device. The test only runs the first time that the can_poll_pty() function is called (currently happens when the first PollScheduler instance is created). The test is known to fail on Darwin and we're not sure how many other kernels might have a similar problem, this runtime test allows us to avoid having to maintain special cases for various kernels. svn path=/main/trunk/; revision=11025
* Split out a portage._create_pty_or_pipe() function to avoid duplicate code.Zac Medico2008-07-123-80/+62
| | | | svn path=/main/trunk/; revision=11024
* Derive a PtyReaderTestCase from PipeReaderTestCase. This test is expected toZac Medico2008-07-122-5/+64
| | | | | | | fail on some operating systems such as Darwin that do not support poll() on pty devices. svn path=/main/trunk/; revision=11023
* Create a test case for the poll loop which uses the loop to read data from aZac Medico2008-07-124-41/+272
| | | | | | | | | | | | | | | | | | | | | | | | | | pipe and assert that the data written to the pipe is identical to the data read from the pipe. In order to implement this test, several useful classes have been added: * PipeReader Reads output from one or more files and saves it in memory, for retrieval via the getvalue() method. This is driven by the scheduler's poll() loop, so it runs entirely within the current process. * QueueScheduler Add instances of SequentialTaskQueue and then call run(). The run() method returns when no tasks remain. * TaskScheduler A simple way to handle scheduling of AsynchrousTask instances. Simply add tasks and call run(). The run() method returns when no tasks remain. svn path=/main/trunk/; revision=11022
* * Add a digraph.get() method, analogous to dict.get(), used to simplifyZac Medico2008-07-122-6/+7
| | | | | | | | Scheduler._pkg(). * Define digraph.__contains__ for containment tests via the "in" operator. svn path=/main/trunk/; revision=11021
* For subclasses of Task, explicitly assign __hash__ = Task.__hash__ forZac Medico2008-07-121-0/+5
| | | | | | compatibility with python-2.6_beta. Thanks to Arfrever for reporting. svn path=/main/trunk/; revision=11020
* Fix SpawnProcess.start() to return early and notify exit listeners if theZac Medico2008-07-111-1/+10
| | | | | | spawn call fails. svn path=/main/trunk/; revision=11019
* Fix a few typos found with pyflakes. Thanks to Cardoe for reporting.Zac Medico2008-07-111-3/+5
| | | | svn path=/main/trunk/; revision=11018
* Copy INHERITED/_eclasses_ handling from portdbapi._metadata_callback() toZac Medico2008-07-111-0/+6
| | | | | | | portdbapi.aux_get() since it's still needed there or else aux_get won't properly return INHERITED. svn path=/main/trunk/; revision=11016
* Call settings.reset() in EbuildMetadataPhase.start() since that's whatZac Medico2008-07-111-0/+1
| | | | | | | | portdbapi does too before generating metadata, and without it, a previous CATEGORY can leak into the ebuild env and corrupt it (breaks lots of packages that reference $CATEGORY). svn path=/main/trunk/; revision=11015
* Document the new --jobs and --load-average options for parallelization.Zac Medico2008-07-111-4/+24
| | | | svn path=/main/trunk/; revision=11014
* Refactor and simplify the main task scheduling and poll loops:Zac Medico2008-07-111-94/+74
| | | | | | | | | | | | | | * Make output handlers unregister themselves and call wait() to notify exit listeners immediately. This makes the exit listeners more useful for scheduling tasks. This makes the poll loop nice an clean because it just calls the handlers and then the handlers can do the scheduling when necessary. * Make SequentialTaskQueue.add() and addFront() trigger scheduling internally, so that it's more of a chain reaction than something that has to be done explicitly. svn path=/main/trunk/; revision=11013
* Add support for parallel --regen, using the existing --jobs and --load-averageZac Medico2008-07-103-202/+434
| | | | | | | | | | | | | | | | options: * Split out a PollLoop base class from Scheduler and derive a MetadataRegen class to handle parallel scheduling for --regen. * Add pordbapi._metadata_process() and _metadata_callback() methods to implement asynchronous metadata generation. One method returns an EbuildMetadataPhase instance to encapsulate the async task. The other method is called to save the metadata when the process completes successfully. These methods share code with aux_get to avoid duplicate code. svn path=/main/trunk/; revision=11012
* When a package replaces another one, add the corresponding uninstall taskZac Medico2008-07-101-1/+19
| | | | | | | for the replaced package to Scheduler._completed_tasks so that it's properly accounted for in _dependent_on_scheduled_merges(). svn path=/main/trunk/; revision=11011
* Bug #231382 - If the open() call in getconfig() raises an unexpected IOError,Zac Medico2008-07-101-0/+1
| | | | | | | write a message to stderr showing the exact call that failed, including the path of the file, in order to aid in debugging. svn path=/main/trunk/; revision=11010
* Make digestcheck() skip the "checking ebuild checksums" part when fetching inZac Medico2008-07-101-1/+1
| | | | | | the background. svn path=/main/trunk/; revision=11009
* * Fix AsynchronousTask._wait_hook() to prevent potential recursive callsZac Medico2008-07-101-2/+22
| | | | | | | | | | | triggered when calling exit listeners. * Make SequentialTaskQueue use exit listeners to trigger scheduling as soon as a task exits. This makes it possible for the queues to automatically schedule new tasks while scheduler remains in it's poll() loop. svn path=/main/trunk/; revision=11008
* * Handle errno.ECHILD and errno.ESRCH from waitpid() and kill() calls. TheseZac Medico2008-07-101-4/+28
| | | | | | | | | errors commonly occur when ^C is used to kill emerge. * Remove spawned pids from portage.process.spawned_pids immediately in order to avoid a race condition for removing it. svn path=/main/trunk/; revision=11007
* Fix Scheduler._is_restart_necessary() to return False if the replacementZac Medico2008-07-101-0/+48
| | | | | | | version of portage is the same exact version as the currently running instance. svn path=/main/trunk/; revision=11006
* Like in Binpkg, cancel or wait for the prefetcher in EbuildBuild.Zac Medico2008-07-091-4/+36
| | | | svn path=/main/trunk/; revision=11005
* Bug #231358 - Fix 'NameError: global name 'p' is not defined' inZac Medico2008-07-091-1/+1
| | | | | | getmaskingstatus() that's triggered by a conditional in LICENSE. svn path=/main/trunk/; revision=11004
* For parallel-fetch prefetchers, pass fetchonly=1 into the EbuildFetcherZac Medico2008-07-091-1/+2
| | | | | | constructor. svn path=/main/trunk/; revision=11003
* Use the EbuildFetcher class to implement async fetch for the EbuildBuildZac Medico2008-07-092-32/+48
| | | | | | | | | | | class. When in background mode, fetch output is logged to emerge-fetch.log. This solves a problem with calling doebuild(returnpid=1) and then doebuild calling fetch() synchronously. In that case, doebuild would return an int if fetch() failed (including when running pkg_nofetch), which would lead to a TypeError since doebuild(returnpid=1) is supposed to return a list containing a spawned pid. svn path=/main/trunk/; revision=11002
* * Unify the scheduler's "build" and "extract" queues into a singleZac Medico2008-07-091-11/+34
| | | | | | | | | | | | | | | "jobs" queue. * Add support for logging fetches to /var/log/emerge-fetch.log when --jobs is enabled. Previously this log was only used for the parallel-fetch feature but now it's also used for --jobs. The scheduler's "prefetch" queue has been renamed to "fetch" since it's not exclusively used for parallel-fetch anymore. * Pass the "background" parameter from Binpkg in to the BinpkgFetcher instance, to send output to emerge-fetch.log instead of stdout. svn path=/main/trunk/; revision=10999
* Fix SubProcess._poll to handle a missing pid gracefully.Zac Medico2008-07-091-0/+2
| | | | svn path=/main/trunk/; revision=10998
* Fix Scheduler._choose_pkg() to perform uninstallation actions (due toZac Medico2008-07-091-5/+25
| | | | | | blockers) in the correct order when building in parallel. svn path=/main/trunk/; revision=10996
* Fix _prune_digraph() to correctly distinguish "nomerge" nodes fromZac Medico2008-07-091-1/+2
| | | | | | "uninstall" nodes. svn path=/main/trunk/; revision=10995
* * Fix _choose_pkg() to pop the first node if there are no other jobs running.Zac Medico2008-07-081-2/+6
| | | | | | | | | * Allow _choose_pkg() to choose an uninstall node when it reaches the front of the queue. TODO: fix order for uninstall operations. * Fix _dependent_on_scheduled_merges() to handle direct circular deps correctly. svn path=/main/trunk/; revision=10994
* Make the "tight loop" assertion trigger whenever there is no state changeZac Medico2008-07-081-1/+1
| | | | | | detected for a given _schedule_main() call. svn path=/main/trunk/; revision=10993
* In scheduler._schedule_main(), only consider a poll() event to be a stateZac Medico2008-07-081-1/+1
| | | | | | change if it results in a handler being unregistered. svn path=/main/trunk/; revision=10992
* Fix Scheduler._dependent_on_scheduled_merges() to properly distinguishZac Medico2008-07-081-1/+1
| | | | | | "nomerge" nodes from "uninstall" nodes. svn path=/main/trunk/; revision=10991
* Remove redundant call to _schedule_main().Zac Medico2008-07-081-2/+0
| | | | svn path=/main/trunk/; revision=10990
* * Call self._wait() when unregistering output handlers, in order to avoidZac Medico2008-07-081-8/+24
| | | | | | | | | | | | triggering a tight loop. Also fix Subprocess._wait() to only schedule when self.registered is True. * Add an assertion inside Scheduler._schedule_main() to try and detect tight loops like the one above. * Fix typo in Scheduler._merge_exit(). svn path=/main/trunk/; revision=10989
* Derive PackageMerge from AsynchronousTask instead of CompositeTask sinceZac Medico2008-07-081-1/+1
| | | | | | CompositeTask is designed for self._current_task to be set. svn path=/main/trunk/; revision=10988
* Raise an AssertionError in CompositeTask._wait() if it's detected thatZac Medico2008-07-081-1/+7
| | | | | | | self._current_task hasn't been properly updated after calling wait on it. svn path=/main/trunk/; revision=10987
* Fix infinite loop in CompositeTask._wait().Zac Medico2008-07-081-1/+4
| | | | svn path=/main/trunk/; revision=10986
* Fix ValueError triggered when Scheduler._choose_pkg() doesn't find a packageZac Medico2008-07-081-1/+2
| | | | | | and returns None. svn path=/main/trunk/; revision=10985
* Use a normal list instead of a deque for Scheduler._pkg_queue since dequeZac Medico2008-07-081-3/+3
| | | | | | doesn't have a remove() method until python-2.5. svn path=/main/trunk/; revision=10984