diff options
author | Mounir Lamouri (volkmar) <mounir.lamouri@gmail.com> | 2009-06-03 00:23:17 +0200 |
---|---|---|
committer | Mounir Lamouri (volkmar) <mounir.lamouri@gmail.com> | 2009-06-03 00:23:17 +0200 |
commit | 42fae258b9c4641fbddaac0a69625b5f558af230 (patch) | |
tree | 3650b79c98aef99dfd022b0c613306ed200d2856 | |
parent | 0fcd7529e8e1d60f050e7840ed08c7013c7720db (diff) |
portage: not yet working install-packages function
-rw-r--r-- | backends/portage/pk-backend-portage.c | 27 | ||||
-rwxr-xr-x | backends/portage/portageBackend.py | 31 |
2 files changed, 49 insertions, 9 deletions
diff --git a/backends/portage/pk-backend-portage.c b/backends/portage/pk-backend-portage.c index 4c42412f0..31267810f 100644 --- a/backends/portage/pk-backend-portage.c +++ b/backends/portage/pk-backend-portage.c @@ -198,22 +198,22 @@ backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_id } /** - * backend_get_updates: + * backend_get_update_detail: */ static void -backend_get_updates (PkBackend *backend, PkBitfield filters) +backend_get_update_detail (PkBackend *backend, gchar **package_ids) { - egg_debug ("backend: updates"); + egg_debug ("backend: update_detail"); pk_backend_finished (backend); } /** - * backend_get_update_detail: + * backend_get_updates: */ static void -backend_get_update_detail (PkBackend *backend, gchar **package_ids) +backend_get_updates (PkBackend *backend, PkBitfield filters) { - egg_debug ("backend: update_detail"); + egg_debug ("backend: updates"); pk_backend_finished (backend); } @@ -223,8 +223,19 @@ backend_get_update_detail (PkBackend *backend, gchar **package_ids) static void backend_install_packages (PkBackend *backend, gchar **package_ids) { - egg_debug ("backend: install"); - pk_backend_finished (backend); + gchar *package_ids_temp; + + /* + * TODO: portage manage to install when offline + * but maybe packagekit implementation will make this forbidden + * (because of download funcion dir) + * If needed, add something that will check for network _NOW_ (see yum) + */ + + /* send the complete list as stdin */ + package_ids_temp = pk_package_ids_to_text (package_ids); + pk_backend_spawn_helper (spawn, BACKEND_FILE, "install-packages", package_ids_temp, NULL); + g_free (package_ids_temp); } /** diff --git a/backends/portage/portageBackend.py b/backends/portage/portageBackend.py index 0000a7c85..b773787f4 100755 --- a/backends/portage/portageBackend.py +++ b/backends/portage/portageBackend.py @@ -32,7 +32,7 @@ import _emerge import sys import signal import re -#from urlgrabber.progress import BaseMeter, format_number +from itertools import izip # NOTES: # @@ -230,6 +230,35 @@ class PackageKitPortageBackend(PackageKitBaseBackend, PackagekitPackage): for cpv in portage.portdb.match(cp): self.package(cpv) + def install_packages(self, pkgs): + self.status(STATUS_RUNNING) + self.allow_cancel(True) # TODO: sure ? + self.percentage(None) + + myopts = {} # TODO: --nodepends ? + spinner = "" + favorites = [] + settings, trees, mtimedb = _emerge.load_emerge_config() + spinner = _emerge.stdout_spinner() + rootconfig = _emerge.RootConfig(self.portage_settings, trees["/"], portage._sets.load_default_config(self.portage_settings, trees["/"])) + # setconfig ? + if "resume" not in mtimedb: + mtimedb["resume"] = mtimedb["resume_backup"] + del mtimedb["resume_backup"] + + for pkg in pkgs: + # check for installed is not mandatory as there are a lot of reason + # to re-install a package (USE/LDFLAGS/CFLAGS change for example) (or live) + # TODO: keep a final position + cpv = id_to_cpv(pkg) + db_keys = list(portage.portdb._aux_cache_keys) + metadata = izip(db_keys, portage.portdb.aux_get(cpv, db_keys)) + package = _emerge.Package(type_name="ebuild", root_config=rootconfig, cpv=cpv, metadata=metadata) + + mergetask = _emerge.Scheduler(settings, trees, mtimedb, myopts, spinner, [package], favorites, package) + mergetask.merge() + + def resolve(self, filters, pkgs): # TODO: filters self.status(STATUS_QUERY) |