portage.git
16 years agoFix SpawnProcess.start() to return early and notify exit listeners if the
Zac Medico [Fri, 11 Jul 2008 22:40:26 +0000 (22:40 -0000)]
Fix SpawnProcess.start() to return early and notify exit listeners if the
spawn call fails.

svn path=/main/trunk/; revision=11019

16 years agoFix a few typos found with pyflakes. Thanks to Cardoe for reporting.
Zac Medico [Fri, 11 Jul 2008 21:28:15 +0000 (21:28 -0000)]
Fix a few typos found with pyflakes. Thanks to Cardoe for reporting.

svn path=/main/trunk/; revision=11018

16 years agoCopy INHERITED/_eclasses_ handling from portdbapi._metadata_callback() to
Zac Medico [Fri, 11 Jul 2008 06:02:40 +0000 (06:02 -0000)]
Copy INHERITED/_eclasses_ handling from portdbapi._metadata_callback() to
portdbapi.aux_get() since it's still needed there or else aux_get won't
properly return INHERITED.

svn path=/main/trunk/; revision=11016

16 years agoCall settings.reset() in EbuildMetadataPhase.start() since that's what
Zac Medico [Fri, 11 Jul 2008 05:12:00 +0000 (05:12 -0000)]
Call settings.reset() in EbuildMetadataPhase.start() since that's what
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

16 years agoDocument the new --jobs and --load-average options for parallelization.
Zac Medico [Fri, 11 Jul 2008 04:16:17 +0000 (04:16 -0000)]
Document the new --jobs and --load-average options for parallelization.

svn path=/main/trunk/; revision=11014

16 years agoRefactor and simplify the main task scheduling and poll loops:
Zac Medico [Fri, 11 Jul 2008 02:38:35 +0000 (02:38 -0000)]
Refactor and simplify the main task scheduling and poll loops:

* 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

16 years agoAdd support for parallel --regen, using the existing --jobs and --load-average
Zac Medico [Thu, 10 Jul 2008 15:00:17 +0000 (15:00 -0000)]
Add support for parallel --regen, using the existing --jobs and --load-average
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

16 years agoWhen a package replaces another one, add the corresponding uninstall task
Zac Medico [Thu, 10 Jul 2008 10:33:03 +0000 (10:33 -0000)]
When a package replaces another one, add the corresponding uninstall task
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

16 years agoBug #231382 - If the open() call in getconfig() raises an unexpected IOError,
Zac Medico [Thu, 10 Jul 2008 09:08:39 +0000 (09:08 -0000)]
Bug #231382 - If the open() call in getconfig() raises an unexpected IOError,
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

16 years agoMake digestcheck() skip the "checking ebuild checksums" part when fetching in
Zac Medico [Thu, 10 Jul 2008 04:41:27 +0000 (04:41 -0000)]
Make digestcheck() skip the "checking ebuild checksums" part when fetching in
the background.

svn path=/main/trunk/; revision=11009

16 years ago* Fix AsynchronousTask._wait_hook() to prevent potential recursive calls
Zac Medico [Thu, 10 Jul 2008 03:40:39 +0000 (03:40 -0000)]
* Fix AsynchronousTask._wait_hook() to prevent potential recursive calls
  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

16 years ago* Handle errno.ECHILD and errno.ESRCH from waitpid() and kill() calls. These
Zac Medico [Thu, 10 Jul 2008 01:24:43 +0000 (01:24 -0000)]
* Handle errno.ECHILD and errno.ESRCH from waitpid() and kill() calls. These
  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

16 years agoFix Scheduler._is_restart_necessary() to return False if the replacement
Zac Medico [Thu, 10 Jul 2008 00:58:08 +0000 (00:58 -0000)]
Fix Scheduler._is_restart_necessary() to return False if the replacement
version of portage is the same exact version as the currently running
instance.

svn path=/main/trunk/; revision=11006

16 years agoLike in Binpkg, cancel or wait for the prefetcher in EbuildBuild.
Zac Medico [Wed, 9 Jul 2008 23:53:10 +0000 (23:53 -0000)]
Like in Binpkg, cancel or wait for the prefetcher in EbuildBuild.

svn path=/main/trunk/; revision=11005

16 years agoBug #231358 - Fix 'NameError: global name 'p' is not defined' in
Zac Medico [Wed, 9 Jul 2008 23:20:32 +0000 (23:20 -0000)]
Bug #231358 - Fix 'NameError: global name 'p' is not defined' in
getmaskingstatus() that's triggered by a conditional in LICENSE.

svn path=/main/trunk/; revision=11004

16 years agoFor parallel-fetch prefetchers, pass fetchonly=1 into the EbuildFetcher
Zac Medico [Wed, 9 Jul 2008 21:51:25 +0000 (21:51 -0000)]
For parallel-fetch prefetchers, pass fetchonly=1 into the EbuildFetcher
constructor.

svn path=/main/trunk/; revision=11003

16 years agoUse the EbuildFetcher class to implement async fetch for the EbuildBuild
Zac Medico [Wed, 9 Jul 2008 21:39:39 +0000 (21:39 -0000)]
Use the EbuildFetcher class to implement async fetch for the EbuildBuild
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

16 years ago * Unify the scheduler's "build" and "extract" queues into a single
Zac Medico [Wed, 9 Jul 2008 12:33:08 +0000 (12:33 -0000)]
 * Unify the scheduler's "build" and "extract" queues into a single
   "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

16 years agoFix SubProcess._poll to handle a missing pid gracefully.
Zac Medico [Wed, 9 Jul 2008 12:03:53 +0000 (12:03 -0000)]
Fix SubProcess._poll to handle a missing pid gracefully.

svn path=/main/trunk/; revision=10998

16 years agoFix Scheduler._choose_pkg() to perform uninstallation actions (due to
Zac Medico [Wed, 9 Jul 2008 02:15:19 +0000 (02:15 -0000)]
Fix Scheduler._choose_pkg() to perform uninstallation actions (due to
blockers) in the correct order when building in parallel.

svn path=/main/trunk/; revision=10996

16 years agoFix _prune_digraph() to correctly distinguish "nomerge" nodes from
Zac Medico [Wed, 9 Jul 2008 01:46:24 +0000 (01:46 -0000)]
Fix _prune_digraph() to correctly distinguish "nomerge" nodes from
"uninstall" nodes.

svn path=/main/trunk/; revision=10995

16 years ago* Fix _choose_pkg() to pop the first node if there are no other jobs running.
Zac Medico [Tue, 8 Jul 2008 23:42:28 +0000 (23:42 -0000)]
* Fix _choose_pkg() to pop the first node if there are no other jobs running.
* 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

16 years agoMake the "tight loop" assertion trigger whenever there is no state change
Zac Medico [Tue, 8 Jul 2008 22:35:27 +0000 (22:35 -0000)]
Make the "tight loop" assertion trigger whenever there is no state change
detected for a given _schedule_main() call.

svn path=/main/trunk/; revision=10993

16 years agoIn scheduler._schedule_main(), only consider a poll() event to be a state
Zac Medico [Tue, 8 Jul 2008 22:28:41 +0000 (22:28 -0000)]
In scheduler._schedule_main(), only consider a poll() event to be a state
change if it results in a handler being unregistered.

svn path=/main/trunk/; revision=10992

16 years agoFix Scheduler._dependent_on_scheduled_merges() to properly distinguish
Zac Medico [Tue, 8 Jul 2008 22:19:21 +0000 (22:19 -0000)]
Fix Scheduler._dependent_on_scheduled_merges() to properly distinguish
"nomerge" nodes from "uninstall" nodes.

svn path=/main/trunk/; revision=10991

16 years agoRemove redundant call to _schedule_main().
Zac Medico [Tue, 8 Jul 2008 21:56:20 +0000 (21:56 -0000)]
Remove redundant call to _schedule_main().

svn path=/main/trunk/; revision=10990

16 years ago* Call self._wait() when unregistering output handlers, in order to avoid
Zac Medico [Tue, 8 Jul 2008 21:19:22 +0000 (21:19 -0000)]
* Call self._wait() when unregistering output handlers, in order to avoid
  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

16 years agoDerive PackageMerge from AsynchronousTask instead of CompositeTask since
Zac Medico [Tue, 8 Jul 2008 17:44:53 +0000 (17:44 -0000)]
Derive PackageMerge from AsynchronousTask instead of CompositeTask since
CompositeTask is designed for self._current_task to be set.

svn path=/main/trunk/; revision=10988

16 years agoRaise an AssertionError in CompositeTask._wait() if it's detected that
Zac Medico [Tue, 8 Jul 2008 17:26:46 +0000 (17:26 -0000)]
Raise an AssertionError in CompositeTask._wait() if it's detected that
self._current_task hasn't been properly updated after calling wait on
it.

svn path=/main/trunk/; revision=10987

16 years agoFix infinite loop in CompositeTask._wait().
Zac Medico [Tue, 8 Jul 2008 16:59:40 +0000 (16:59 -0000)]
Fix infinite loop in CompositeTask._wait().

svn path=/main/trunk/; revision=10986

16 years agoFix ValueError triggered when Scheduler._choose_pkg() doesn't find a package
Zac Medico [Tue, 8 Jul 2008 10:49:02 +0000 (10:49 -0000)]
Fix ValueError triggered when Scheduler._choose_pkg() doesn't find a package
and returns None.

svn path=/main/trunk/; revision=10985

16 years agoUse a normal list instead of a deque for Scheduler._pkg_queue since deque
Zac Medico [Tue, 8 Jul 2008 10:28:43 +0000 (10:28 -0000)]
Use a normal list instead of a deque for Scheduler._pkg_queue since deque
doesn't have a remove() method until python-2.5.

svn path=/main/trunk/; revision=10984

16 years agoImplement parallel build support by adding new --jobs and --load-average
Zac Medico [Tue, 8 Jul 2008 09:50:37 +0000 (09:50 -0000)]
Implement parallel build support by adding new --jobs and --load-average
options that are analogous to the corresponding `make` options. Input and
output handling still need work to make it look better and act more friendly
for things like interactive ebuilds that require input.

svn path=/main/trunk/; revision=10983

16 years ago* Add background support to the SpawProcess class.
Zac Medico [Tue, 8 Jul 2008 05:49:27 +0000 (05:49 -0000)]
* Add background support to the SpawProcess class.
* Make Binpkg pass the current background setting into subtasks.

svn path=/main/trunk/; revision=10982

16 years agoAdd AsynchronousTask.background attribute and add support for it to the
Zac Medico [Tue, 8 Jul 2008 05:15:55 +0000 (05:15 -0000)]
Add AsynchronousTask.background attribute and add support for it to the
EbuildPhase class.

svn path=/main/trunk/; revision=10981

16 years agoAlso add "background" attributes to the EbuildBuild and Binpkg classes.
Zac Medico [Tue, 8 Jul 2008 01:01:54 +0000 (01:01 -0000)]
Also add "background" attributes to the EbuildBuild and Binpkg classes.

svn path=/main/trunk/; revision=10980

16 years agoAdd a MergeListItem.background attribute for putting a task in the background
Zac Medico [Tue, 8 Jul 2008 00:53:33 +0000 (00:53 -0000)]
Add a MergeListItem.background attribute for putting a task in the background
when max_jobs > 1.

svn path=/main/trunk/; revision=10979

16 years agoAdd a missing check in Scheduler._main_loop() to ensure that max_jobs
Zac Medico [Tue, 8 Jul 2008 00:39:48 +0000 (00:39 -0000)]
Add a missing check in Scheduler._main_loop() to ensure that max_jobs
isn't exceeded.

svn path=/main/trunk/; revision=10978

16 years agoUse plain sequential search for the SRC_URI.mirror check since the regex
Zac Medico [Tue, 8 Jul 2008 00:25:56 +0000 (00:25 -0000)]
Use plain sequential search for the SRC_URI.mirror check since the regex
approach is actually much slower.

svn path=/main/trunk/; revision=10977

16 years agoAdd a Scheduler._digraph attribute for use in parallel build scheduling.
Zac Medico [Mon, 7 Jul 2008 23:32:11 +0000 (23:32 -0000)]
Add a Scheduler._digraph attribute for use in parallel build scheduling.

svn path=/main/trunk/; revision=10976

16 years agoRename SubProcess.reg_id to _reg_id since it no longer needs to be exposed.
Zac Medico [Mon, 7 Jul 2008 22:55:26 +0000 (22:55 -0000)]
Rename SubProcess.reg_id to _reg_id since it no longer needs to be exposed.

svn path=/main/trunk/; revision=10975

16 years ago* Add new CompositeTask._default_final_exit() method and use it as the new
Zac Medico [Mon, 7 Jul 2008 22:41:10 +0000 (22:41 -0000)]
* Add new CompositeTask._default_final_exit() method and use it as the new
  generic task exit callback.

* Remove erroneous self.wait() calls inside MergeListItem.start().

svn path=/main/trunk/; revision=10974

16 years agoAdd a new "SRC_URI.mirror" check which checks to if a uri listed in
Zac Medico [Mon, 7 Jul 2008 22:07:03 +0000 (22:07 -0000)]
Add a new "SRC_URI.mirror" check which checks to if a uri listed in
profiles/thirdpartymirrors is found in SRC_URI. Thanks to Betelgeuse for
the initial patch which has now been optimized with a regex.

svn path=/main/trunk/; revision=10973

16 years agoMove the "registered" attribute to the SubProcess class too.
Zac Medico [Mon, 7 Jul 2008 12:04:32 +0000 (12:04 -0000)]
Move the "registered" attribute to the SubProcess class too.

svn path=/main/trunk/; revision=10971

16 years agoMake SubProcess._wait() call scheduler.schedule(self.reg_id) so it's
Zac Medico [Mon, 7 Jul 2008 11:45:27 +0000 (11:45 -0000)]
Make SubProcess._wait() call scheduler.schedule(self.reg_id) so it's
encapsulated and callers don't have to know about it.

svn path=/main/trunk/; revision=10970

16 years agoremove TODO list as it's not maintained anyway
Marius Mauch [Mon, 7 Jul 2008 11:08:14 +0000 (11:08 -0000)]
remove TODO list as it's not maintained anyway

svn path=/main/trunk/; revision=10969

16 years ago* Implement CompositeTask._poll().
Zac Medico [Mon, 7 Jul 2008 05:35:17 +0000 (05:35 -0000)]
* Implement CompositeTask._poll().
* Make AsynchronousTask classes call self.wait() to notify
  exit listeners.
* Rewrite Scheduler._main_loop() to bring it closer to allowing
  parallel build scheduling.

svn path=/main/trunk/; revision=10966

16 years agoFix broken code in AsynchronousTask.poll().
Zac Medico [Mon, 7 Jul 2008 03:12:52 +0000 (03:12 -0000)]
Fix broken code in AsynchronousTask.poll().

svn path=/main/trunk/; revision=10965

16 years agoFix EbuildPhase._set_returncode() so that it correctly updates the returncode
Zac Medico [Mon, 7 Jul 2008 02:18:58 +0000 (02:18 -0000)]
Fix EbuildPhase._set_returncode() so that it correctly updates the returncode
attrbute instead of just a local variable.

svn path=/main/trunk/; revision=10964

16 years agoFix typo in Binpkg.start() which prevents --genbinpkg prefetcher sync
Zac Medico [Mon, 7 Jul 2008 02:11:05 +0000 (02:11 -0000)]
Fix typo in Binpkg.start() which prevents --genbinpkg prefetcher sync
from working properly in some cases.

svn path=/main/trunk/; revision=10963

16 years ago* Implement MergeListItem._poll() and _wait().
Zac Medico [Sun, 6 Jul 2008 18:45:19 +0000 (18:45 -0000)]
* Implement MergeListItem._poll() and _wait().
* Fix BinpkgVerifier.start() to call wait() since it's not asynchronous.

svn path=/main/trunk/; revision=10962

16 years agoAdd a PackageMerge class to serve as an asynchronous interface to package
Zac Medico [Sun, 6 Jul 2008 15:17:10 +0000 (15:17 -0000)]
Add a PackageMerge class to serve as an asynchronous interface to package
merges. For now it executes synchronously inside the start() method.

svn path=/main/trunk/; revision=10961

16 years agoAdd async support to MergeListItem.
Zac Medico [Sun, 6 Jul 2008 14:32:32 +0000 (14:32 -0000)]
Add async support to MergeListItem.

svn path=/main/trunk/; revision=10960

16 years agoAdd async support to the Binpkg class.
Zac Medico [Sun, 6 Jul 2008 13:07:38 +0000 (13:07 -0000)]
Add async support to the Binpkg class.

svn path=/main/trunk/; revision=10959

16 years agoMake BinpkgFetcher send output directly to stdout when appropriate,
Zac Medico [Sun, 6 Jul 2008 09:17:22 +0000 (09:17 -0000)]
Make BinpkgFetcher send output directly to stdout when appropriate,
so that wget's progress bar works normally.

svn path=/main/trunk/; revision=10958

16 years agoFix parent class constructor call in the BinpkgFetcher constructor.
Zac Medico [Sun, 6 Jul 2008 08:22:31 +0000 (08:22 -0000)]
Fix parent class constructor call in the BinpkgFetcher constructor.

svn path=/main/trunk/; revision=10957

16 years agoMake AsynchronousTask subclasses override _wait() and _poll() so that calls
Zac Medico [Sun, 6 Jul 2008 08:16:21 +0000 (08:16 -0000)]
Make AsynchronousTask subclasses override _wait() and _poll() so that calls
to public methods can be wrapped for implementing hooks such as exit listener
notification.

svn path=/main/trunk/; revision=10956

16 years agoFix --getbinpkg to inject downloaded packages into the local bintree.
Zac Medico [Sun, 6 Jul 2008 07:09:46 +0000 (07:09 -0000)]
Fix --getbinpkg to inject downloaded packages into the local bintree.

svn path=/main/trunk/; revision=10955

16 years ago* Fix broke return code handling from previous commit, in
Zac Medico [Sun, 6 Jul 2008 06:48:41 +0000 (06:48 -0000)]
* Fix broke return code handling from previous commit, in
  MergeListItem.execute().
* Fix TaskSequence._task_exit_handler() so it won't call
  final_exit() if _default_exit() has already set
  self._current_task to None.

svn path=/main/trunk/; revision=10954

16 years agoAdd async support to EbuildBuild, and an synchronous install() method.
Zac Medico [Sun, 6 Jul 2008 06:28:32 +0000 (06:28 -0000)]
Add async support to EbuildBuild, and an synchronous install() method.

svn path=/main/trunk/; revision=10953

16 years agoSplit out a CompositeTask._start_task() for subclasses to use as a generic
Zac Medico [Sun, 6 Jul 2008 03:44:25 +0000 (03:44 -0000)]
Split out a CompositeTask._start_task() for subclasses to use as a generic
way to start a task.

svn path=/main/trunk/; revision=10952

16 years agoAdd CompositeTask._final_exit() method and use it to fix breakage from the
Zac Medico [Sun, 6 Jul 2008 01:51:50 +0000 (01:51 -0000)]
Add CompositeTask._final_exit() method and use it to fix breakage from the
previous commit.

svn path=/main/trunk/; revision=10951

16 years agoSplit out a reusable CompositeTask._default_exit() method that subclasses
Zac Medico [Sun, 6 Jul 2008 01:24:29 +0000 (01:24 -0000)]
Split out a reusable CompositeTask._default_exit() method that subclasses
can use as a generic task exit callback.

svn path=/main/trunk/; revision=10950

16 years agoAdd a CompositeTask._assert_current() method that asynchronous callbacks
Zac Medico [Sun, 6 Jul 2008 00:44:00 +0000 (00:44 -0000)]
Add a CompositeTask._assert_current() method that asynchronous callbacks
can use detect possible bugs.

svn path=/main/trunk/; revision=10949

16 years agoFix typo in xterm titles total package count which causes it to show the
Zac Medico [Sun, 6 Jul 2008 00:01:31 +0000 (00:01 -0000)]
Fix typo in xterm titles total package count which causes it to show the
current package instead. Thanks to Arfrever for this patch.

svn path=/main/trunk/; revision=10948

16 years ago* Fix AsynchronousTask.poll() to call _wait_hook() when necessary.
Zac Medico [Sat, 5 Jul 2008 23:17:01 +0000 (23:17 -0000)]
* Fix AsynchronousTask.poll() to call _wait_hook() when necessary.
* Use the default poll() and cancel() implementations for BinpkgVerifier.

svn path=/main/trunk/; revision=10947

16 years agoCall _wait_hook() from poll() if the wait call occurs there.
Zac Medico [Sat, 5 Jul 2008 14:02:13 +0000 (14:02 -0000)]
Call _wait_hook() from poll() if the wait call occurs there.

svn path=/main/trunk/; revision=10946

16 years agoCorrect TaskSequence docstring to refer to the addExitListener() method.
Zac Medico [Sat, 5 Jul 2008 13:44:19 +0000 (13:44 -0000)]
Correct TaskSequence docstring to refer to the addExitListener() method.

svn path=/main/trunk/; revision=10945

16 years agoThanks to Ali Polatel <hawking@g.o> for this patch to fix broken indentation.
Zac Medico [Sat, 5 Jul 2008 13:34:21 +0000 (13:34 -0000)]
Thanks to Ali Polatel <hawking@g.o> for this patch to fix broken indentation.

svn path=/main/trunk/; revision=10944

16 years agoSplit out common code from CompositeTask and EbuildExecuter into a new
Zac Medico [Sat, 5 Jul 2008 13:19:01 +0000 (13:19 -0000)]
Split out common code from CompositeTask and EbuildExecuter into a new
CompositeTask class and rename the old CompositeTask class to TaskSequence.

svn path=/main/trunk/; revision=10943

16 years agoMake EbuildExecuter inherit from AsynchronousTask.
Zac Medico [Sat, 5 Jul 2008 13:06:47 +0000 (13:06 -0000)]
Make EbuildExecuter inherit from AsynchronousTask.

svn path=/main/trunk/; revision=10942

16 years agoFix CompositeTask.cancel() so that it's safe to call when there is no
Zac Medico [Sat, 5 Jul 2008 12:36:40 +0000 (12:36 -0000)]
Fix CompositeTask.cancel() so that it's safe to call when there is no
running task.

svn path=/main/trunk/; revision=10941

16 years agoAdd a new CompositeTask class which can be used to combine separate
Zac Medico [Sat, 5 Jul 2008 12:21:43 +0000 (12:21 -0000)]
Add a new CompositeTask class which can be used to combine separate
AsynchronousTask instances into a single instance. The CompositeTask
instance used task exit listeners as a means to (asynchronously) trigger
progression from one subtask to the next. This technique is used to
group together all the ebuild phases executed by EbuildExecuter, and
should be useful for grouping many more sets of tasks into similar
composite tasks.

svn path=/main/trunk/; revision=10940

16 years agoAdd async support to EbuildBinpkg by making it inherit from EbuildPhase.
Zac Medico [Sat, 5 Jul 2008 08:52:46 +0000 (08:52 -0000)]
Add async support to EbuildBinpkg by making it inherit from EbuildPhase.

svn path=/main/trunk/; revision=10939

16 years agoUse the EbuildPhase class to execute the "clean" phase asynchronously.
Zac Medico [Sat, 5 Jul 2008 08:08:09 +0000 (08:08 -0000)]
Use the EbuildPhase class to execute the "clean" phase asynchronously.

svn path=/main/trunk/; revision=10938

16 years agoRemove unused variable.
Zac Medico [Sat, 5 Jul 2008 07:36:58 +0000 (07:36 -0000)]
Remove unused variable.

svn path=/main/trunk/; revision=10937

16 years agoRename BinpkgFetcherAsync class to BinpkgFetcher and use it to replace the
Zac Medico [Sat, 5 Jul 2008 07:34:25 +0000 (07:34 -0000)]
Rename BinpkgFetcherAsync class to BinpkgFetcher and use it to replace the
older class with the same name

svn path=/main/trunk/; revision=10936

16 years ago* Implement a new binarytree.digestCheck() method and use it to check
Zac Medico [Sat, 5 Jul 2008 07:18:31 +0000 (07:18 -0000)]
* Implement a new binarytree.digestCheck() method and use it to check
  digests for binary packages.

* Split out a AsynchronousTask base class from SubProcess.

* Derive a new BinpkgVerifier class from AsynchronousTask. Even though
  this is not really asynchronous yet, it can fake the interface by
  doing everything in the start() method.

svn path=/main/trunk/; revision=10935

16 years agoMake Binpkg inherit from EbuildBuildDir since it's going to hold
Zac Medico [Fri, 4 Jul 2008 22:49:04 +0000 (22:49 -0000)]
Make Binpkg inherit from EbuildBuildDir since it's going to hold
the build dir lock while it runs asynchronously.

svn path=/main/trunk/; revision=10934

16 years agoMake EbuildBuild inherit from EbuildBuildDir since it's going to hold
Zac Medico [Fri, 4 Jul 2008 22:39:57 +0000 (22:39 -0000)]
Make EbuildBuild inherit from EbuildBuildDir since it's going to hold
the build dir lock while it runs asynchronously.

svn path=/main/trunk/; revision=10933

16 years agoConvert EbuildFetcher to an asynchronous interface:
Zac Medico [Fri, 4 Jul 2008 22:19:18 +0000 (22:19 -0000)]
Convert EbuildFetcher to an asynchronous interface:
* Rename EbuildFetcher to EbuildFetchPretend.
* Rename EbuildFetcherAsync to EbuildFetcher.

svn path=/main/trunk/; revision=10932

16 years agoTODO: For parallel scheduling, everything in MergeListItem needs
Zac Medico [Fri, 4 Jul 2008 21:46:05 +0000 (21:46 -0000)]
TODO: For parallel scheduling, everything in MergeListItem needs
asynchronous execution support (start, poll, and wait methods).

svn path=/main/trunk/; revision=10931

16 years agoAdd a PollConstants class to serve as a layer of indirection for accessing
Zac Medico [Fri, 4 Jul 2008 21:27:10 +0000 (21:27 -0000)]
Add a PollConstants class to serve as a layer of indirection for accessing
select.POLL* attributes which do not exist on interix. Thanks to grobian
for reporting.

svn path=/main/trunk/; revision=10930

16 years agoBug #230525 - Work around ObjectProxy breakage in `portageq vdb_path`.
Zac Medico [Fri, 4 Jul 2008 20:57:24 +0000 (20:57 -0000)]
Bug #230525 - Work around ObjectProxy breakage in `portageq vdb_path`.

svn path=/main/trunk/; revision=10929

16 years agoIn --keep-going mode, display the new merge list when appropriate.
Zac Medico [Fri, 4 Jul 2008 13:58:30 +0000 (13:58 -0000)]
In --keep-going mode, display the new merge list when appropriate.

svn path=/main/trunk/; revision=10928

16 years agoSplit a _main_loop() method out of Scheduler._merge().
Zac Medico [Fri, 4 Jul 2008 13:20:13 +0000 (13:20 -0000)]
Split a _main_loop() method out of Scheduler._merge().

svn path=/main/trunk/; revision=10927

16 years agoSplit out a Scheduler._execute_pkg() method from _merge().
Zac Medico [Fri, 4 Jul 2008 11:12:01 +0000 (11:12 -0000)]
Split out a Scheduler._execute_pkg() method from _merge().

svn path=/main/trunk/; revision=10926

16 years agoRename PollSelectFallback to PollSelectAdapter.
Zac Medico [Fri, 4 Jul 2008 10:48:41 +0000 (10:48 -0000)]
Rename PollSelectFallback to PollSelectAdapter.

svn path=/main/trunk/; revision=10925

16 years ago* Split out a MergeListItem class from Scheduler._execute_task().
Zac Medico [Fri, 4 Jul 2008 10:45:41 +0000 (10:45 -0000)]
* Split out a MergeListItem class from Scheduler._execute_task().
* Remove Scheduler._execute_task() and migrate some of it's code
  to Scheduler._merge().
* Fix _world_atom() so that it doesn't add an atom in --oneshot
  mode or similar.

svn path=/main/trunk/; revision=10924

16 years agoFix broken references to portage.exception.
Zac Medico [Fri, 4 Jul 2008 10:15:37 +0000 (10:15 -0000)]
Fix broken references to portage.exception.

svn path=/main/trunk/; revision=10923

16 years agoCreate a Scheduler._task_queues attribute which has "build" and "prefetch"
Zac Medico [Fri, 4 Jul 2008 07:09:00 +0000 (07:09 -0000)]
Create a Scheduler._task_queues attribute which has "build" and "prefetch"
queues. The build queue is currently unused and the prefetch queue is used
for parallel fetch.

svn path=/main/trunk/; revision=10922

16 years agoChange the way the way things that have to call the scheduler interact
Zac Medico [Fri, 4 Jul 2008 06:15:43 +0000 (06:15 -0000)]
Change the way the way things that have to call the scheduler interact
with it:

 * Return a unique integer id from scheduler.register(), to be passed back
   into other scheduler methods.

 * Control handler unregistration with the handler's return value, like
   some other frameworks do for similar callbacks.

 * Add a SpawnProcess.reg_id attribute to store the id returned from
   scheduler.register()

 * Pass the SpawnProcess.reg_id value into scheduler.schedule() calls,
   so the scheduler knows to return when the callback referred to by
   the given id unregisters itself by returning False.

svn path=/main/trunk/; revision=10921

16 years agoWhen logging is disabled, make the EbuildPhase create a dummy pipe to provide
Zac Medico [Fri, 4 Jul 2008 03:03:44 +0000 (03:03 -0000)]
When logging is disabled, make the EbuildPhase create a dummy pipe to provide
a file descriptor that the scheduler can use to monitor the process from
inside a poll() loop.

svn path=/main/trunk/; revision=10920

16 years agoImport portage before trying to access portage.exception for exception
Zac Medico [Fri, 4 Jul 2008 00:46:07 +0000 (00:46 -0000)]
Import portage before trying to access portage.exception for exception
handling.

svn path=/main/trunk/; revision=10919

16 years ago* Split out a SequentialTaskQueue class to encapsulate the parallel-fetch
Zac Medico [Fri, 4 Jul 2008 00:11:03 +0000 (00:11 -0000)]
* Split out a SequentialTaskQueue class to encapsulate the parallel-fetch
  prefetcher queue.

* Fix broken return value status handling in Scheduler.merge().

svn path=/main/trunk/; revision=10918

16 years agoBug #230469 - Implement non-blocking distlocks for --fetchonly. This adds
Zac Medico [Thu, 3 Jul 2008 22:48:21 +0000 (22:48 -0000)]
Bug #230469 - Implement non-blocking distlocks for --fetchonly. This adds
a "flags" keyword parameter to the portage.locks.lock() function. Default
is flags=0. If flags contains os.O_NONBLOCK then lock() will raise
portage.exception.TryAgain instead of blocking. This new flags parameter
is used to implement non-blocking distlocks in fetch() when fetchonly
mode is enabled.

svn path=/main/trunk/; revision=10917

16 years agoFix typo.
Zac Medico [Thu, 3 Jul 2008 21:53:37 +0000 (21:53 -0000)]
Fix typo.

svn path=/main/trunk/; revision=10916

16 years agoBug #230579 - Handle EOFError raised from cPickle.load() in
Zac Medico [Thu, 3 Jul 2008 21:52:56 +0000 (21:52 -0000)]
Bug #230579 - Handle EOFError raised from cPickle.load() in
PreservedLibsRegistry.load().

svn path=/main/trunk/; revision=10915

16 years agoSplit out a _create_prefetcher() method from _add_prefetchers().
Zac Medico [Thu, 3 Jul 2008 12:04:45 +0000 (12:04 -0000)]
Split out a _create_prefetcher() method from _add_prefetchers().

svn path=/main/trunk/; revision=10913

16 years agoRemove old unused vars inside _execute_task() and fix code not to use the
Zac Medico [Thu, 3 Jul 2008 11:42:06 +0000 (11:42 -0000)]
Remove old unused vars inside _execute_task() and fix code not to use the
old vars.

svn path=/main/trunk/; revision=10912