portage.emaint.modules.sync.sync module¶
- class portage.emaint.modules.sync.sync.SyncRepos(emerge_config=None, emerge_logging=False)¶
Bases:
object
- _check_updates()¶
- _do_pkg_moves()¶
- _filter_auto(repos)¶
- _get_repos(auto_sync_only=True, match_repos=None)¶
- static _match_repos(repos, available)¶
Internal search, matches up the repo name or alias in repos.
- Parameters
repos – list of repo names or aliases to match
avalable – list of repo objects to search
- Returns
list of repo objects that match
- _reload_config()¶
Reload the whole config from scratch.
- _sync(selected_repos, return_messages, emaint_opts=None)¶
- all_repos(**kwargs)¶
Sync all repos defined in repos.conf
- auto_sync(**kwargs)¶
Sync auto-sync enabled repos
- can_progressbar(func)¶
- static name()¶
- repo(**kwargs)¶
Sync the specified repo
- rmessage(rvals, action)¶
Creates emaint style messages to return to the task handler
- short_desc = 'Check repos.conf settings and/or sync repositories'¶
- class portage.emaint.modules.sync.sync.SyncScheduler(**kwargs)¶
Bases:
portage.util._async.AsyncScheduler.AsyncScheduler
Sync repos in parallel, but don’t sync a given repo until all of its masters have synced.
- _async_wait()¶
Override _async_wait to call self._cleanup().
- _can_add_job()¶
Returns False if there are no leaf nodes available.
- _cancel()¶
Subclasses should implement this, as a template method to be called by AsynchronousTask.cancel().
- _cancelled_returncode = -2¶
- _cleanup()¶
Cleanup any callbacks that have been registered with the global event loop.
- _exit_listener_cb(listener)¶
- _exit_listener_handles¶
- _exit_listeners¶
- _init_graph()¶
Graph relationships between repos and their masters.
- _is_background()¶
- _is_work_scheduled()¶
- _keep_scheduling()¶
Schedule as long as the graph is non-empty, and we haven’t been terminated.
- _loadavg_latency = None¶
- _master_hooks(repo_name)¶
- Parameters
repo_name (str) – a repo name
- Returns
True if hooks would have been executed for any master repositories of the given repo, False otherwise
- Return type
bool
- _next_task()¶
Return a task for the next available leaf node.
- _poll()¶
- _running_job_count()¶
- _schedule()¶
Calls _schedule_tasks() and automatically returns early from any recursive calls to this method that the _schedule_tasks() call might trigger. This makes _schedule() safe to call from inside exit listeners. This method always returns True, so that it may be scheduled continuously via EventLoop.timeout_add().
- _schedule_tasks()¶
This is called from inside the _schedule() method, which guarantees the following:
It will not be called recursively.
_terminate_tasks() will not be called while it is running.
The state of the boolean _terminated_tasks variable will not change while it is running.
Unless this method is used to perform user interface updates, or something like that, the first thing it should do is check the state of _terminated_tasks and if that is True then it should return immediately (since there’s no need to schedule anything after _terminate_tasks() has been called).
- _start()¶
- _start_hook()¶
- _start_listeners¶
- _task_exit(task)¶
Remove the task from the graph, in order to expose more leaf nodes.
- _terminate_tasks()¶
Send signals to terminate all tasks. This is called once from _keep_scheduling() or _is_work_scheduled() in the event dispatching thread. It will not be called while the _schedule_tasks() implementation is running, in order to avoid potential interference. All tasks should be cleaned up at the earliest opportunity, but not necessarily before this method returns. Typically, this method will send kill signals and return without waiting for exit status. This allows basic cleanup to occur, such as flushing of buffered output to logs.
- _termination_check(retry=False)¶
Calls _terminate_tasks() if appropriate. It’s guaranteed not to call it while _schedule_tasks() is being called. This method must only be called via the event loop thread.
- Parameters
retry (bool) – If True then reschedule if scheduling state prevents immediate termination.
- _update_leaf_nodes()¶
Populate self._leaf_nodes with current leaves from self._sync_graph. If a circular master relationship is discovered, choose a random node to break the cycle.
- _wait_hook()¶
Call this method after the task completes, just before returning the returncode from wait() or poll(). This hook is used to trigger exit listeners when the returncode first becomes available.
- _was_cancelled()¶
If cancelled, set returncode if necessary and return True. Otherwise, return False.
- addExitListener(f)¶
The function will be called with one argument, a reference to self.
- addStartListener(f)¶
The function will be called with one argument, a reference to self.
- async_wait()¶
Wait for returncode asynchronously. Notification is available via the add_done_callback method of the returned Future instance.
- Returns
Future, result is self.returncode
- background¶
- cancel()¶
Cancel the task, but do not wait for exit status. If asynchronous exit notification is desired, then use addExitListener to add a listener before calling this method. NOTE: Synchronous waiting for status is not supported, since it would be vulnerable to hitting the recursion limit when a large number of tasks need to be terminated simultaneously, like in bug #402335.
- cancelled¶
- copy()¶
Create a new instance and copy all attributes defined from __slots__ (including those from inherited classes).
- property global_hooks_enabled¶
- Returns
True if repo.postsync.d hooks would have been executed for any repositories.
- Return type
bool
- isAlive()¶
- poll()¶
- removeExitListener(f)¶
- removeStartListener(f)¶
- returncode¶
- scheduler¶
- start()¶
Start an asynchronous task and then return as soon as possible.
- terminate()¶
Schedules asynchronous, graceful termination of the scheduler at the earliest opportunity.
This method is thread-safe (and safe for signal handlers).
- wait()¶
Wait for the returncode attribute to become ready, and return it. If the returncode is not ready and the event loop is already running, then the async_wait() method should be used instead of wait(), because wait() will raise asyncio.InvalidStateError in this case.
- Return type
int
- Returns
the value of self.returncode