[packagekit] packagekit: Branch 'master' - 9 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Fri Jan 4 06:36:59 PST 2008
backends/conary/helpers/conaryBackend.py | 3
backends/dummy/pk-backend-dummy.c | 5 +
backends/yum/helpers/Makefile.am | 1
backends/yum/helpers/yumBackend.py | 110 +++++++++++++++++++++++--------
client/pk-console.c | 13 ++-
docs/spec/pk-backends.xml | 2
docs/spec/pk-introduction.xml | 19 ++++-
libpackagekit/pk-client.c | 27 ++++---
python/packagekit/Makefile.am | 4 +
python/packagekit/backend.py | 16 +++-
src/Makefile.am | 2
src/pk-backend.c | 20 +++--
src/pk-backend.h | 4 -
src/pk-engine.c | 15 ++--
src/pk-interface.xml | 4 -
src/pk-marshal.list | 2
16 files changed, 181 insertions(+), 66 deletions(-)
New commits:
commit 195c6b6d7764077438e70aecbf27027b1e970b68
Author: Tim Lauridsen <tla at rasmil.dk>
Date: Fri Jan 4 10:43:32 2008 +0100
yum: Implemented bugzilla_url, cve_url, vendor_url in get-update-details
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index f21b8d1..a824010 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -1095,7 +1095,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
"""
Convert a multi line string to a list separated by ';'
"""
- return ";".join(lst)
+ if lst:
+ return ";".join(lst)
+ else:
+ return "none"
def _get_update_extras(self,pkg):
md = self.updateMetadata
@@ -1104,17 +1107,23 @@ class PackageKitYumBackend(PackageKitBaseBackend):
# Update Description
desc = notice['description']
# Update References (Bugzilla,CVE ...)
- urls = []
+ urls = {'bugzilla':[], 'cve' : []}
refs = notice['references']
if refs:
- for ref in refs:
- urls.append(ref['href'])
+ for ref in refs:
+ typ = ref['type']
+ if typ in ('bugzilla','cve'):
+ urls[typ].append("%s;%s" % (ref['href'],ref['title']))
+ else:
+ print " unknown url type : %s " % typ
+ print ref
+
# Reboot flag
if notice.get_metadata().has_key('reboot_suggested') and notice['reboot_suggested']:
reboot = 'system'
else:
reboot = 'none'
- return self._format_str(desc),self._format_list(urls),reboot
+ return self._format_str(desc),urls,reboot
else:
return "","","none"
@@ -1128,8 +1137,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
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)
+ desc,urls,reboot = self._get_update_extras(pkg)
+ cve_url = self._format_list(urls['cve'])
+ bz_url = self._format_list(urls['bugzilla'])
+ self.update_detail(package,update,obsolete,"none",bz_url,cve_url,reboot,desc)
def repo_set_data(self, repoid, parameter, value):
'''
@@ -1322,7 +1333,6 @@ class ProcessTransPackageKitCallback:
if state == PT_DOWNLOAD_PKGS: # Packages to download
self.base.dnlCallback.setPackages(data,10,30)
elif state == PT_GPGCHECK:
- sys.exit(1)
self.base.percentage(40)
pass
elif state == PT_TEST_TRANS:
commit de1b0c93a3d4af948e9d90c7258e3fb8a254b050
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jan 3 20:01:36 2008 +0000
Convert the UpdateDetail::url field into UpdateDetail::{vendor_url,bugzilla_url,cve_url}
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 5b64909..cf2a521 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -149,9 +149,12 @@ static void
backend_get_update_detail (PkBackend *backend, const gchar *package_id)
{
g_return_if_fail (backend != NULL);
+ pk_backend_change_status (backend, PK_STATUS_ENUM_QUERY);
pk_backend_update_detail (backend, "glib2;2.14.0;i386;fedora",
"glib2;2.12.0;i386;fedora", "",
- "http://nvd.nist.gov/nvd.cfm?cvename=CVE-2007-3381",
+ "http://www.distro-update.org/page?moo;Bugfix release for PackageKit",
+ "http://bgzilla.fd.org/result.php?#12344;Freedesktop Bugzilla #12344",
+ "http://nvd.nist.gov/nvd.cfm?cvename=CVE-2007-3381;CVE-2007-3381",
"system", "Update to newest upstream source");
pk_backend_finished (backend);
}
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 5058adc..f21b8d1 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -1129,7 +1129,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
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)
+ self.update_detail(package,update,obsolete,url,"","",reboot,desc)
def repo_set_data(self, repoid, parameter, value):
'''
diff --git a/client/pk-console.c b/client/pk-console.c
index 4199841..98595a8 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -119,7 +119,8 @@ pk_console_transaction_cb (PkClient *client, const gchar *tid, const gchar *time
static void
pk_console_update_detail_cb (PkClient *client, const gchar *package_id,
const gchar *updates, const gchar *obsoletes,
- const gchar *url, PkRestartEnum restart,
+ const gchar *vendor_url, const gchar *bugzilla_url,
+ const gchar *cve_url, PkRestartEnum restart,
const gchar *update_text, gpointer data)
{
g_print ("Update detail\n");
@@ -130,8 +131,14 @@ pk_console_update_detail_cb (PkClient *client, const gchar *package_id,
if (pk_strzero (obsoletes) == FALSE) {
g_print (" obsoletes: '%s'\n", obsoletes);
}
- if (pk_strzero (url) == FALSE) {
- g_print (" url: '%s'\n", url);
+ if (pk_strzero (vendor_url) == FALSE) {
+ g_print (" vendor URL: '%s'\n", vendor_url);
+ }
+ if (pk_strzero (bugzilla_url) == FALSE) {
+ g_print (" bug URL: '%s'\n", bugzilla_url);
+ }
+ if (pk_strzero (cve_url) == FALSE) {
+ g_print (" cve URL: '%s'\n", cve_url);
}
if (restart != PK_RESTART_ENUM_NONE) {
g_print (" restart: '%s'\n", pk_restart_enum_to_text (restart));
diff --git a/docs/spec/pk-backends.xml b/docs/spec/pk-backends.xml
index deaf25b..ea8e28c 100644
--- a/docs/spec/pk-backends.xml
+++ b/docs/spec/pk-backends.xml
@@ -197,7 +197,7 @@
</row>
<row>
<entry>UpdateDetail</entry>
- <entry><literal>package_id[tab]updates[tab]obsoletes[tab]url[tab]restart[tab]update_text</literal></entry>
+ <entry><literal>package_id[tab]updates[tab]obsoletes[tab]vendor_url[tab]bugzilla_url[tab]cve_url[tab]restart[tab]update_text</literal></entry>
<entry><literal>stdout</literal></entry>
</row>
<row>
diff --git a/docs/spec/pk-introduction.xml b/docs/spec/pk-introduction.xml
index b02c072..9cdf8a6 100644
--- a/docs/spec/pk-introduction.xml
+++ b/docs/spec/pk-introduction.xml
@@ -1727,9 +1727,24 @@
<entry>A list of package_id's that are to be obsoletes</entry>
</row>
<row>
- <entry><literal>url</literal></entry>
+ <entry><literal>vendor_url</literal></entry>
+ <entry>
+ A URL with more details on the update, e.g. a page with more
+ information on the update.
+ The format of this command should be
+ <literal>http://www.foo.org/page.html?4567;Update to SELinux</literal>
+ </entry>
+ </row>
+ <row>
+ <entry><literal>bugzilla_url</literal></entry>
+ <entry>
+ A bugzilla URL with more details on the update
+ </entry>
+ </row>
+ <row>
+ <entry><literal>cve_url</literal></entry>
<entry>
- A URL with more details on the update, e.g. a security advisory
+ A CVE URL with more details on the security advisory
</entry>
</row>
<row>
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index d2fa6cd..25b8e8e 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -523,7 +523,9 @@ pk_client_update_detail_cb (DBusGProxy *proxy,
const gchar *package_id,
const gchar *updates,
const gchar *obsoletes,
- const gchar *url,
+ const gchar *vendor_url,
+ const gchar *bugzilla_url,
+ const gchar *cve_url,
const gchar *restart_text,
const gchar *update_text,
PkClient *client)
@@ -537,11 +539,11 @@ pk_client_update_detail_cb (DBusGProxy *proxy,
return;
}
- pk_debug ("emit update-detail %s, %s, %s, %s, %s, %s",
- package_id, updates, obsoletes, url, restart_text, update_text);
+ pk_debug ("emit update-detail %s, %s, %s, %s, %s, %s, %s, %s",
+ package_id, updates, obsoletes, vendor_url, bugzilla_url, cve_url, restart_text, update_text);
restart = pk_restart_enum_from_text (restart_text);
g_signal_emit (client , signals [PK_CLIENT_UPDATE_DETAIL], 0,
- package_id, updates, obsoletes, url, restart, update_text);
+ package_id, updates, obsoletes, vendor_url, bugzilla_url, cve_url, restart, update_text);
}
/**
@@ -1434,7 +1436,7 @@ pk_client_rollback (PkClient *client, const gchar *transaction_id)
return FALSE;
}
/* save this so we can re-issue it */
- client->priv->role = PK_ROLE_ENUM_GET_UPDATE_DETAIL;
+ client->priv->role = PK_ROLE_ENUM_ROLLBACK;
client->priv->xcached_transaction_id = g_strdup (transaction_id);
error = NULL;
@@ -2492,9 +2494,10 @@ pk_client_class_init (PkClientClass *klass)
signals [PK_CLIENT_UPDATE_DETAIL] =
g_signal_new ("update-detail",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING,
- G_TYPE_NONE, 6, G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING);
+ 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING,
+ G_TYPE_NONE, 8, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING);
signals [PK_CLIENT_DESCRIPTION] =
g_signal_new ("description",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
@@ -2671,9 +2674,10 @@ pk_client_init (PkClient *client)
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_INVALID);
/* UpdateDetail */
- dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_STRING,
+ dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING,
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
/* Transaction */
dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING_BOOL_STRING_UINT_STRING,
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN,
@@ -2712,7 +2716,8 @@ pk_client_init (PkClient *client)
dbus_g_proxy_add_signal (proxy, "UpdateDetail",
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_INVALID);
dbus_g_proxy_connect_signal (proxy, "UpdateDetail",
G_CALLBACK (pk_client_update_detail_cb), client, NULL);
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index 7b1f539..1d2e2a0 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -136,17 +136,19 @@ class PackageKitBaseBackend:
'''
print >> sys.stdout,"files\t%s\t%s" % (id, file_list)
- def update_detail(self,id,updates,obsoletes,url,restart,update_text):
+ def update_detail(self,id,updates,obsoletes,vendor_url,bugzilla_url,cve_url,restart,update_text):
'''
Send 'updatedetail' signal
@param id: The package ID name, e.g. openoffice-clipart;2.6.22;ppc64;fedora
@param updates:
@param obsoletes:
- @param url:
+ @param vendor_url:
+ @param bugzilla_url:
+ @param cve_url:
@param restart:
@param update_text:
'''
- print >> sys.stdout,"updatedetail\t%s\t%s\t%s\t%s\t%s\t%s" % (id,updates,obsoletes,url,restart,update_text)
+ print >> sys.stdout,"updatedetail\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s" % (id,updates,obsoletes,vendor_url,bugzilla_url,cve_url,restart,update_text)
def require_restart(self,restart_type,details):
'''
diff --git a/src/pk-backend.c b/src/pk-backend.c
index cbf6cb6..eea4173 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -323,13 +323,14 @@ pk_backend_parse_common_output (PkBackend *backend, const gchar *line)
goto out;
}
} else if (pk_strequal (command, "updatedetail") == TRUE) {
- if (size != 7) {
+ if (size != 9) {
pk_warning ("invalid command '%s'", command);
ret = FALSE;
goto out;
}
pk_backend_update_detail (backend, sections[1], sections[2],
- sections[3], sections[4], sections[5], sections[6]);
+ sections[3], sections[4], sections[5],
+ sections[6], sections[7], sections[8]);
} else {
pk_warning ("invalid command '%s'", command);
}
@@ -826,7 +827,8 @@ pk_backend_package (PkBackend *backend, PkInfoEnum info, const gchar *package, c
gboolean
pk_backend_update_detail (PkBackend *backend, const gchar *package_id,
const gchar *updates, const gchar *obsoletes,
- const gchar *url, const gchar *restart,
+ const gchar *vendor_url, const gchar *bugzilla_url,
+ const gchar *cve_url, const gchar *restart,
const gchar *update_text)
{
gchar *update_text_safe;
@@ -836,10 +838,10 @@ pk_backend_update_detail (PkBackend *backend, const gchar *package_id,
/* replace unsafe chars */
update_text_safe = pk_strsafe (update_text);
- pk_debug ("emit update-detail %s, %s, %s, %s, %s, %s",
- package_id, updates, obsoletes, url, restart, update_text_safe);
+ pk_debug ("emit update-detail %s, %s, %s, %s, %s, %s, %s, %s",
+ package_id, updates, obsoletes, vendor_url, bugzilla_url, cve_url, restart, update_text_safe);
g_signal_emit (backend, signals [PK_BACKEND_UPDATE_DETAIL], 0,
- package_id, updates, obsoletes, url, restart, update_text_safe);
+ package_id, updates, obsoletes, vendor_url, bugzilla_url, cve_url, restart, update_text_safe);
g_free (update_text_safe);
return TRUE;
}
@@ -1976,9 +1978,9 @@ pk_backend_class_init (PkBackendClass *klass)
signals [PK_BACKEND_UPDATE_DETAIL] =
g_signal_new ("update-detail",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING,
- G_TYPE_NONE, 6, G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+ 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING,
+ G_TYPE_NONE, 8, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
signals [PK_BACKEND_REQUIRE_RESTART] =
g_signal_new ("require-restart",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
diff --git a/src/pk-backend.h b/src/pk-backend.h
index 742a618..793d3ba 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -54,7 +54,9 @@ gboolean pk_backend_update_detail (PkBackend *backend,
const gchar *package_id,
const gchar *updates,
const gchar *obsoletes,
- const gchar *url,
+ const gchar *vendor_url,
+ const gchar *bugzilla_url,
+ const gchar *cve_url,
const gchar *restart,
const gchar *update_text);
gboolean pk_backend_require_restart (PkBackend *backend,
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 9241a20..16507d8 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -318,7 +318,8 @@ pk_engine_package_cb (PkBackend *backend, PkInfoEnum info, const gchar *package_
static void
pk_engine_update_detail_cb (PkBackend *backend, const gchar *package_id,
const gchar *updates, const gchar *obsoletes,
- const gchar *url, const gchar *restart,
+ const gchar *vendor_url, const gchar *bugzilla_url,
+ const gchar *cve_url, const gchar *restart,
const gchar *update_text, PkEngine *engine)
{
PkTransactionItem *item;
@@ -331,10 +332,10 @@ pk_engine_update_detail_cb (PkBackend *backend, const gchar *package_id,
pk_warning ("could not find backend");
return;
}
- pk_debug ("emitting package tid:%s value=%s, %s, %s, %s, %s, %s", item->tid,
- package_id, updates, obsoletes, url, restart, update_text);
+ pk_debug ("emitting package tid:%s value=%s, %s, %s, %s, %s, %s, %s, %s", item->tid,
+ package_id, updates, obsoletes, vendor_url, bugzilla_url, cve_url, restart, update_text);
g_signal_emit (engine, signals [PK_ENGINE_UPDATE_DETAIL], 0, item->tid,
- package_id, updates, obsoletes, url, restart, update_text);
+ package_id, updates, obsoletes, vendor_url, bugzilla_url, cve_url, restart, update_text);
pk_engine_reset_timer (engine);
}
@@ -2829,9 +2830,9 @@ pk_engine_class_init (PkEngineClass *klass)
signals [PK_ENGINE_UPDATE_DETAIL] =
g_signal_new ("update-detail",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_STRING,
- G_TYPE_NONE, 7, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+ 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING_STRING,
+ G_TYPE_NONE, 9, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
signals [PK_ENGINE_ALLOW_INTERRUPT] =
g_signal_new ("allow-interrupt",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
diff --git a/src/pk-interface.xml b/src/pk-interface.xml
index cc0f1d9..7bacb5b 100644
--- a/src/pk-interface.xml
+++ b/src/pk-interface.xml
@@ -140,7 +140,9 @@
<arg type="s" name="package_id" direction="out"/>
<arg type="s" name="updates" direction="out"/>
<arg type="s" name="obsoletes" direction="out"/>
- <arg type="s" name="url" direction="out"/>
+ <arg type="s" name="vendor_url" direction="out"/>
+ <arg type="s" name="bugzilla_url" direction="out"/>
+ <arg type="s" name="cve_url" direction="out"/>
<arg type="s" name="restart" direction="out"/>
<arg type="s" name="update_text" direction="out"/>
</signal>
diff --git a/src/pk-marshal.list b/src/pk-marshal.list
index 585636a..3710358 100644
--- a/src/pk-marshal.list
+++ b/src/pk-marshal.list
@@ -14,6 +14,8 @@ VOID:STRING,STRING,STRING
VOID:STRING,STRING,STRING,STRING
VOID:STRING,STRING,STRING,STRING,STRING
VOID:STRING,STRING,STRING,STRING,STRING,STRING
+VOID:STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING
+VOID:STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING
VOID:STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING
VOID:STRING,STRING,STRING,STRING,STRING,STRING,STRING
VOID:STRING,STRING,UINT,STRING,STRING,UINT64
commit 541f5485515b58056868767400c360a67328ba02
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jan 3 18:25:16 2008 +0000
clean pyc files
diff --git a/backends/yum/helpers/Makefile.am b/backends/yum/helpers/Makefile.am
index dac2ce7..aefc764 100644
--- a/backends/yum/helpers/Makefile.am
+++ b/backends/yum/helpers/Makefile.am
@@ -31,5 +31,6 @@ install-data-hook:
chmod a+rx $(DESTDIR)$(helperdir)/*.py
clean-local :
+ rm -f *.pyc
rm -f *~
diff --git a/python/packagekit/Makefile.am b/python/packagekit/Makefile.am
index 6448281..7a53cfe 100644
--- a/python/packagekit/Makefile.am
+++ b/python/packagekit/Makefile.am
@@ -13,3 +13,7 @@ packagekitpython_PYTHON = \
enums.py \
$(NULL)
+clean-local :
+ rm -f *.pyc
+ rm -f *~
+
commit c5b2871e6e0d622fc944e3b4128638a13adc2fa1
Author: Tim Lauridsen <tla at rasmil.dk>
Date: Thu Jan 3 12:58:27 2008 +0100
yum: make the updates severity work and show all 3 types (enhancement,bugfix,security) show as (low,normal,security)
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index d6a6f4c..5058adc 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -998,11 +998,14 @@ class PackageKitYumBackend(PackageKitBaseBackend):
def _get_status(self,notice):
ut = notice['type']
- # TODO : Add more types to check
if ut == 'security':
return INFO_SECURITY
- else:
+ elif ut == 'bugfix':
return INFO_NORMAL
+ elif ut == 'enhancement':
+ return INFO_LOW
+ else:
+ return INFO_UNKNOWN
def get_updates(self):
'''
@@ -1011,8 +1014,8 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.allow_interrupt(True)
self.percentage(None)
self.status(STATUS_INFO)
- md = self.updateMetadata
ygl = self.yumbase.doPackageLists(pkgnarrow='updates')
+ md = self.updateMetadata
for pkg in ygl.updates:
# Get info about package in updates info
notice = md.get_notice((pkg.name, pkg.version, pkg.release))
commit 21c7af30e6acb382e47cadd41d1949d92900c40e
Merge: 043dd18... a9c5aba...
Author: Thomas Wood <thomas at openedhand.com>
Date: Thu Jan 3 12:01:37 2008 +0000
Merge branch 'master' of git+ssh://thos@git.packagekit.org/srv/git/PackageKit
commit 043dd187bcd5a6ed12eab3ebee32c5232fd20f0b
Author: Thomas Wood <thomas at openedhand.com>
Date: Thu Jan 3 12:00:04 2008 +0000
Use $(LIBTOOL) rather than hardcoding libtool filename to prevent problems when cross compiling.
diff --git a/src/Makefile.am b/src/Makefile.am
index 1ee4df9..f149a80 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -113,7 +113,7 @@ pk-marshal.h: pk-marshal.list
glib-genmarshal $< --prefix=pk_marshal --header > $@
pk-interface.h: pk-interface.xml
- libtool --mode=execute dbus-binding-tool \
+ $(LIBTOOL) --mode=execute dbus-binding-tool \
--prefix=pk_engine \
--mode=glib-server \
--output=pk-interface.h \
commit a9c5abaf13448a50a938511166be0d44531ef25a
Author: Tim Lauridsen <tla at rasmil.dk>
Date: Thu Jan 3 11:54:11 2008 +0100
yum:
- fixed issues with missing package signals when downloading packages with '-' in the name.
- make percent / subpercent show in a better way.
- fixed issue with percent not shown if the bump is < 1%
- added new metadata signal to send when downloading metadata
metadata<tab>type<tab>file
type : (unknown,repository,package,filelist,changelog,group)
file : filename of metadata file
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 90420f3..d6a6f4c 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -37,6 +37,7 @@ import exceptions
import types
import signal
import time
+import os.path
from packagekit.backend import PackagekitProgress
# Global vars
@@ -185,6 +186,18 @@ groupMap = {
'language-support;ethiopic-support' : GROUP_LOCALIZATION
}
+MetaDataMap = {
+'repomd.xml' : "repository",
+'primary.sqlite.bz2' : "package",
+'primary.xml.gz' : "package",
+'filelists.sqlite.bz2' : "filelist",
+'filelists.xml.gz' : "filelist",
+'other.sqlite.bz2' : "changelog",
+'other.xml.gz' : "changelog",
+'comps.xml' : "group",
+'updateinfo.xml.gz' : "update"
+}
+
GUI_KEYS = re.compile(r'(qt)|(gtk)')
class GPGKeyNotImported(exceptions.Exception):
@@ -732,7 +745,6 @@ class PackageKitYumBackend(PackageKitBaseBackend):
txmbr = self.yumbase.install(name=pkg.name)
self._runYumTransaction()
except yum.Errors.InstallError,e:
- print e
msgs = ';'.join(e)
self.error(ERROR_PACKAGE_ALREADY_INSTALLED,msgs)
else:
@@ -827,7 +839,6 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if len(self.yumbase.tsInfo) > 0:
self._runYumTransaction()
except yum.Errors.InstallError,e:
- print e
msgs = ';'.join(e)
self.error(ERROR_PACKAGE_ALREADY_INSTALLED,msgs)
@@ -855,10 +866,9 @@ class PackageKitYumBackend(PackageKitBaseBackend):
pkg = txmbr.po
# check if package is in reboot list or flagged with reboot_suggested
# in the update metadata and is installed/updated etc
- print pkg.name,txmbr.output_state
notice = md.get_notice((pkg.name, pkg.version, pkg.release))
- if (pkg.name in self.rebootpkgs or (notice and
- notice.get_metadata().has_key('reboot_suggested') and notice['reboot_suggested']))\
+ if (pkg.name in self.rebootpkgs \
+ or (notice and notice.get_metadata().has_key('reboot_suggested') and notice['reboot_suggested']))\
and txmbr.ts_state in TS_INSTALL_STATES:
self.require_restart(RESTART_SYSTEM,"")
break
@@ -1155,15 +1165,15 @@ class DownloadCallback( BaseMeter ):
def setPackages(self,pkgs,startPct,numPct):
self.pkgs = pkgs
- self.numPkgs = len(self.pkgs)
+ self.numPkgs = float(len(self.pkgs))
self.bump = numPct/self.numPkgs
self.totalPct = startPct
-
+
def _getPackage(self,name):
- name = name.split('-')[0]
if self.pkgs:
for pkg in self.pkgs:
- if pkg.name == name:
+ rpmfn = os.path.basename(pkg.remote_path) # get the rpm filename of the package
+ if rpmfn == name:
return pkg
return None
@@ -1217,19 +1227,30 @@ class DownloadCallback( BaseMeter ):
@param ftime : formated string containing remaining or elapsed time
'''
pct = int( frac*100 )
- if self.lastPct != pct:
- self.lastPct = pct
- # bump the sub persentage for this package
- self.base.sub_percentage(int( frac*100 ))
- if name != self.oldName:
+ if name != self.oldName: # If this a new package
+ if self.oldName:
+ self.base.sub_percentage(100)
self.oldName = name
if self.bump > 0.0: # Bump the total download percentage
self.totalPct += self.bump
+ self.lastPct = 0
self.base.percentage(int(self.totalPct))
if self.showNames:
pkg = self._getPackage(name)
if pkg: # show package to download
self.base._show_package(pkg,INFO_DOWNLOADING)
+ else:
+ if name in MetaDataMap:
+ typ = MetaDataMap[name]
+ else:
+ typ = 'unknown'
+ self.base.metadata(typ,name)
+ self.base.sub_percentage(0)
+ else:
+ if self.lastPct != pct and pct != 0 and pct != 100:
+ self.lastPct = pct
+ # bump the sub persentage for this package
+ self.base.sub_percentage(pct)
class PackageKitCallback(RPMBaseCallback):
def __init__(self,base):
@@ -1298,6 +1319,7 @@ class ProcessTransPackageKitCallback:
if state == PT_DOWNLOAD_PKGS: # Packages to download
self.base.dnlCallback.setPackages(data,10,30)
elif state == PT_GPGCHECK:
+ sys.exit(1)
self.base.percentage(40)
pass
elif state == PT_TEST_TRANS:
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index 87c718f..7b1f539 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -108,6 +108,14 @@ class PackageKitBaseBackend:
'''
print >> sys.stderr,"data\t%s" % (data)
+ def metadata(self,typ,fname):
+ '''
+ send 'metadata' signal:
+ @param type: The type of metadata (repository,package,filelist,changelog,group,unknown)
+ @param fname: The filename being downloaded
+ '''
+ print >> sys.stderr,"metadata\t%s\t%s" % (typ,fname)
+
def description(self,id,license,group,desc,url,bytes,file_list):
'''
Send 'description' signal
commit fa3065487bb6927338d87fdb2c1e6ba451a42af1
Author: Tim Lauridsen <tla at rasmil.dk>
Date: Thu Jan 3 10:12:47 2008 +0100
yum: make get-update-detail work better and dont brake on missing update metadata
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 0bd34dd..90420f3 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -715,6 +715,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
break
except yum.Errors.RepoError,e:
self.error(ERROR_NO_CACHE,"Yum cache is invalid")
+
def install(self, package):
'''
Implement the {backend}-install functionality
@@ -1066,19 +1067,43 @@ class PackageKitYumBackend(PackageKitBaseBackend):
_updateMetadata = None
updateMetadata = property(fget=_get_update_metadata)
+
+ def _format_str(self,str):
+ """
+ Convert a multi line string to a list separated by ';'
+ """
+ if str:
+ lines = str.split('\n')
+ return ";".join(lines)
+ else:
+ return ""
+
+ def _format_list(self,lst):
+ """
+ Convert a multi line string to a list separated by ';'
+ """
+ return ";".join(lst)
def _get_update_extras(self,pkg):
md = self.updateMetadata
notice = md.get_notice((pkg.name, pkg.version, pkg.release))
if notice:
+ # Update Description
desc = notice['description']
- url = notice['references']
+ # Update References (Bugzilla,CVE ...)
+ urls = []
+ refs = notice['references']
+ if refs:
+ for ref in refs:
+ urls.append(ref['href'])
+ # Reboot flag
if notice.get_metadata().has_key('reboot_suggested') and notice['reboot_suggested']:
- reboot = 'system'
- else:
- reboot = 'none'
- return desc.replace('\n',';'),url,reboot
- return "","",""
+ reboot = 'system'
+ else:
+ reboot = 'none'
+ return self._format_str(desc),self._format_list(urls),reboot
+ else:
+ return "","","none"
def get_update_detail(self,package):
'''
commit ba252ad99e4c0b8882451aec418546ab887ea34f
Author: Ken VanDine <ken at vandine.org>
Date: Wed Jan 2 14:04:49 2008 -0500
Return status for get_updates
diff --git a/backends/conary/helpers/conaryBackend.py b/backends/conary/helpers/conaryBackend.py
index 89b93d7..42fa664 100644
--- a/backends/conary/helpers/conaryBackend.py
+++ b/backends/conary/helpers/conaryBackend.py
@@ -362,7 +362,8 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
@ExceptionHandler
def get_updates(self):
self.allow_interrupt(True)
- self.percentage()
+ self.percentage(None)
+ self.status(STATUS_INFO)
updateItems = self.client.fullUpdateItemList()
applyList = [ (x[0], (None, None), x[1:], True) for x in updateItems ]
More information about the PackageKit
mailing list