[packagekit] packagekit: Branch 'master' - 8 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Mon Nov 5 02:40:39 PST 2007
backends/yum/.gitignore | 4 +
backends/yum/helpers/Makefile.am | 4 +
backends/yum/helpers/repo-set-data.py | 21 +++++++++
backends/yum/helpers/yumBackend.py | 76 +++++++++++++++++++++++++++++++---
backends/yum/pk-backend-yum.c | 6 +-
html/pk-faq.html | 6 +-
src/pk-backend-python.c | 10 ++++
src/pk-backend-python.h | 3 +
8 files changed, 117 insertions(+), 13 deletions(-)
New commits:
commit e65c2702e2713daaeb3455acd3ce172110e3a8a6
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Nov 5 10:32:33 2007 +0000
update gitignore
diff --git a/backends/yum/.gitignore b/backends/yum/.gitignore
index c851833..996fb0d 100644
--- a/backends/yum/.gitignore
+++ b/backends/yum/.gitignore
@@ -7,4 +7,8 @@ Makefile.in
*.loT
*.o
*~
+*.gcov
+*.gcda
+*.gcno
+*.out
commit bd10b6d63e4064f83b950b55f43e9117b0aa71f6
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Nov 5 10:31:55 2007 +0000
connect up the new yum methods
diff --git a/backends/yum/pk-backend-yum.c b/backends/yum/pk-backend-yum.c
index af6f8f5..44c9341 100644
--- a/backends/yum/pk-backend-yum.c
+++ b/backends/yum/pk-backend-yum.c
@@ -78,8 +78,8 @@ PK_BACKEND_OPTIONS (
pk_backend_python_get_depends, /* get_depends */
pk_backend_python_get_description, /* get_description */
pk_backend_python_get_files, /* get_files */
- NULL, /* get_requires */
- NULL, /* get_update_detail */
+ pk_backend_python_get_requires, /* get_requires */
+ pk_backend_python_get_update_detail, /* get_update_detail */
pk_backend_python_get_updates, /* get_updates */
pk_backend_python_install_package, /* install_package */
pk_backend_python_install_file, /* install_file */
@@ -95,6 +95,6 @@ PK_BACKEND_OPTIONS (
pk_backend_python_update_system, /* update_system */
pk_backend_python_get_repo_list, /* get_repo_list */
pk_backend_python_repo_enable, /* repo_enable */
- NULL /* repo_set_data */
+ pk_backend_python_repo_set_data /* repo_set_data */
);
commit 318da49634de18b307cc8ddeb2c5cb6c87301fe6
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Nov 5 10:31:29 2007 +0000
fix make check
diff --git a/backends/yum/helpers/Makefile.am b/backends/yum/helpers/Makefile.am
index 4ef0f0f..dac2ce7 100644
--- a/backends/yum/helpers/Makefile.am
+++ b/backends/yum/helpers/Makefile.am
@@ -15,13 +15,13 @@ dist_helper_DATA = \
get-description.py \
get-repo-list.py \
repo-enable.py \
- repo-set-data.py \
- get-updates-detail.py \
+ repo-set-data.py \
+ get-update-detail.py \
install.py \
remove.py \
resolve.py \
update.py \
- install-file.py \
+ install-file.py \
refresh-cache.py \
update-system.py \
yumBackend.py \
commit 8ff48cb6d74da76c3131a8b0c351a8c38d44067d
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Nov 5 10:30:35 2007 +0000
add python helper pk_backend_python_get_update_detail,
diff --git a/src/pk-backend-python.c b/src/pk-backend-python.c
index 8e4c671..e9aa646 100644
--- a/src/pk-backend-python.c
+++ b/src/pk-backend-python.c
@@ -83,6 +83,16 @@ pk_backend_python_get_updates (PkBackend *backend)
}
/**
+ * pk_backend_python_get_update_detail:
+ */
+void
+pk_backend_python_get_update_detail (PkBackend *backend, const gchar *package_id)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_spawn_helper (backend, "get-update-detail.py", package_id, NULL);
+}
+
+/**
* pk_backend_python_install_package:
*/
void
diff --git a/src/pk-backend-python.h b/src/pk-backend-python.h
index 5eb7c0f..61f7183 100644
--- a/src/pk-backend-python.h
+++ b/src/pk-backend-python.h
@@ -40,6 +40,9 @@ void pk_backend_python_get_files (PkBackend *backend,
void pk_backend_python_get_requires (PkBackend *backend,
const gchar *package_id);
+void pk_backend_python_get_update_detail (PkBackend *backend,
+ const gchar *package_id);
+
void pk_backend_python_get_updates (PkBackend *backend);
void pk_backend_python_install_package (PkBackend *backend,
commit f0872bcf1d1fe25890fdd61a911c1943e94af495
Author: Tim Lauridsen <tla at rasmil.dk>
Date: Mon Nov 5 11:19:12 2007 +0100
yum : implemented repo-set-data & added missing files to Makefile.am & updated FAQ with yum implemented methods
diff --git a/backends/yum/helpers/Makefile.am b/backends/yum/helpers/Makefile.am
index e748b4d..4ef0f0f 100644
--- a/backends/yum/helpers/Makefile.am
+++ b/backends/yum/helpers/Makefile.am
@@ -15,6 +15,8 @@ dist_helper_DATA = \
get-description.py \
get-repo-list.py \
repo-enable.py \
+ repo-set-data.py \
+ get-updates-detail.py \
install.py \
remove.py \
resolve.py \
diff --git a/backends/yum/helpers/repo-set-data.py b/backends/yum/helpers/repo-set-data.py
new file mode 100755
index 0000000..fca6314
--- /dev/null
+++ b/backends/yum/helpers/repo-set-data.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2007 Richard Hughes <richard at hughsie.com>
+#
+# Licensed under the GNU General Public License Version 2
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+import sys
+
+from yumBackend import PackageKitYumBackend
+repoid = sys.argv[1]
+para = sys.argv[2]
+value=sys.argv[3]
+backend = PackageKitYumBackend(sys.argv[2:])
+backend.repo_set_data(repoid,para,value)
+backend.unLock()
+sys.exit(0)
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 44d6513..5b32139 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -1056,7 +1056,22 @@ class PackageKitYumBackend(PackageKitBaseBackend):
desc,url,reboot = self._get_update_extras(pkg)
self.update_detail(package,update,obsolete,url,reboot,desc)
+ def repo_set_data(self, repoid, parameter, value):
+ '''
+ Implement the {backend}-repo-set-data functionality
+ '''
+ # Get the repo
+ repo = self.yumbase.repos.getRepo(repoid)
+ if repo:
+ repo.cfg.set(repoid, parameter, value)
+ try:
+ repo.cfg.write(file(repo.repofile, 'w'))
+ except IOError, e:
+ self.error(ERROR_INTERNAL_ERROR,str(e))
+ else:
+ self.error(ERROR_REPO_NOT_FOUND,'repo %s not found' % repoid)
+
diff --git a/html/pk-faq.html b/html/pk-faq.html
index 303e4a1..5c8ac18 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -41,7 +41,7 @@ get-files | | X | | X | | X | X |
get-update-detail | | X | | | | | |
get-repo-list | | X | | X | X | X | X |
repo-enable | | X | | X | | X | |
-repo-set-data | | | | X | | | X |
+repo-set-data | | X | | X | | | X |
cancel-transaction| | X | | | | | X |
</pre>
commit 1147fb3715da734fda263c6006e293253fd958ef
Author: Tim Lauridsen <tla at rasmil.dk>
Date: Mon Nov 5 10:58:49 2007 +0100
update supported backend methods for yum
diff --git a/html/pk-faq.html b/html/pk-faq.html
index 6c1f133..303e4a1 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -35,10 +35,10 @@ install-file | | X | | X | | X | X |
remove-package | X | X | | X | X | X | X |
update-package | | X | | X | | X | X |
get-depends | | X | | X | | X | X |
-get-requires | X | | | X | | | X |
+get-requires | X | X | | X | | | X |
get-description | X | X | X | X | | X | X |
get-files | | X | | X | | X | X |
-get-update-detail | | | | | | | |
+get-update-detail | | X | | | | | |
get-repo-list | | X | | X | X | X | X |
repo-enable | | X | | X | | X | |
repo-set-data | | | | X | | | X |
commit 6304c3f5b0f8c11173775ae2de0bd4b0fae3db29
Author: Tim Lauridsen <tla at rasmil.dk>
Date: Mon Nov 5 10:56:11 2007 +0100
yum: implemented get-update-detail
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 31a7500..44d6513 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -947,11 +947,15 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.files(package, file_list)
else:
self.error(ERROR_INTERNAL_ERROR,'Package was not found')
-
- def _show_package(self,pkg,status):
- ''' Show info about package'''
+
+ def _pkg_to_id(self,pkg):
pkgver = self._get_package_ver(pkg)
id = self.get_package_id(pkg.name, pkgver, pkg.arch, pkg.repo)
+ return id
+
+ def _show_package(self,pkg,status):
+ ''' Show info about package'''
+ id = self._pkg_to_id(pkg)
self.package(id,status, pkg.summary)
def _get_status(self,notice):
@@ -1011,12 +1015,51 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.repo_detail(repo.id,repo.name,'true')
else:
self.repo_detail(repo.id,repo.name,'false')
-
+
+ def _get_obsoleted(self,name):
+ obsoletes = self.yumbase.up.getObsoletesTuples( newest=1 )
+ for ( obsoleting, installed ) in obsoletes:
+ if obsoleting[0] == name:
+ pkg = self.yumbase.rpmdb.searchPkgTuple( installed )[0]
+ return self._pkg_to_id(pkg)
+ return ""
+
+ def _get_updated(self,pkg):
+ updated = None
+ pkgs = self.yumbase.rpmdb.searchNevra(name=pkg.name)
+ if pkgs:
+ return self._pkg_to_id(pkgs[0])
+ else:
+ return ""
+
+ def _get_update_extras(self,pkg):
+ md = UpdateMetadata()
+ if md:
+ notice = md.get_notice((pkg.name, pkg.version, pkg.release))
+ if notice:
+ desc = notice['description']
+ url = notice['references']
+ reboot = notice['reboot_suggested']
+ return desc.replace('\n',';'),url,reboot
+ return "","",""
+
def get_update_detail(self,package):
'''
Implement the {backend}-get-update_detail functionality
'''
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
+ self.allow_interrupt(True)
+ self.percentage(None)
+ name = package.split(';')[0]
+ pkg,inst = self._findPackage(package)
+ update = self._get_updated(pkg)
+ obsolete = self._get_obsoleted(pkg.name)
+ desc,url,reboot = self._get_update_extras(pkg)
+ self.update_detail(package,update,obsolete,url,reboot,desc)
+
+
+
+
+
def _setup_yum(self):
self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0) # Setup Yum Config
commit 29294bc3ea733bf6623e1cd4a42a7f5591d0c6a5
Author: Tim Lauridsen <tla at rasmil.dk>
Date: Mon Nov 5 10:00:36 2007 +0100
yum: implemented get-requires
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index d5eacd0..31a7500 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -509,8 +509,14 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
self.allow_interrupt(True)
self.percentage(None)
+ name = package.split(';')[0]
+ pkg,inst = self._findPackage(package)
+ pkgs = self.yumbase.rpmdb.searchRequires(pkg.name)
+ for pkg in pkgs:
+ self._show_package(pkg,inst)
+
+
- self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
def _is_inst(self,pkg):
return self.yumbase.rpmdb.installed(po=pkg)
More information about the PackageKit
mailing list