[PackageKit-commit] packagekit: Branch 'master' - 5 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Fri Dec 19 07:35:42 PST 2008
backends/yum/yumBackend.py | 35 +++++++++++-------
docs/html/pk-faq.html | 48 +++++++++++++++++++++++++
lib/packagekit-glib/pk-common.c | 8 +---
src/org.freedesktop.PackageKit.Transaction.xml | 12 ++++--
4 files changed, 82 insertions(+), 21 deletions(-)
New commits:
commit 550e7a5579abd1083b03f58ad22b9140f83e41b1
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Dec 19 15:10:49 2008 +0000
trivial: remove double quote from the list of 'unsafe' characters to fix some summary texts
diff --git a/lib/packagekit-glib/pk-common.c b/lib/packagekit-glib/pk-common.c
index 4b353bd..f04ef5b 100644
--- a/lib/packagekit-glib/pk-common.c
+++ b/lib/packagekit-glib/pk-common.c
@@ -318,9 +318,8 @@ pk_strsafe (const gchar *text)
gboolean ret;
const gchar *delimiters;
- if (text == NULL) {
+ if (text == NULL)
return NULL;
- }
/* is valid UTF8? */
ret = g_utf8_validate (text, -1, NULL);
@@ -330,7 +329,7 @@ pk_strsafe (const gchar *text)
}
/* rip out any insane characters */
- delimiters = "\\\f\r\t\"";
+ delimiters = "\\\f\r\t";
text_safe = g_strdup (text);
g_strdelimit (text_safe, delimiters, ' ');
return text_safe;
@@ -416,9 +415,8 @@ pk_strv_to_ptr_array (gchar **array)
parray = g_ptr_array_new ();
length = g_strv_length (array);
- for (i=0; i<length; i++) {
+ for (i=0; i<length; i++)
g_ptr_array_add (parray, g_strdup (array[i]));
- }
return parray;
}
commit d477d595267ca0a70d119381205df83d3adeea61
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Dec 18 18:10:03 2008 +0000
yum: don't show an error when we try to get the details of a package that does not have a description field. Fixes RH#477018
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 15fada4..ded53e0 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -1820,7 +1820,13 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
pkgver = _get_package_ver(pkg)
package_id = self.get_package_id(pkg.name, pkgver, pkg.arch, pkg.repo)
desc = pkg.description
- desc = desc.replace('\n', ';')
+
+ # some RPM's (especially from google) have no description
+ if desc:
+ desc = desc.replace('\n', ';')
+ else:
+ desc = ''
+
group = self.comps.get_group(pkg.name)
self.details(package_id, pkg.license, group, desc, pkg.url, pkg.size)
commit 6f24c9f17a36025b3163a0910e77f71d4b9cd78e
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Dec 18 13:40:26 2008 +0000
yum: treat new packages dragged in as update deps as enhancements, rather than unknown
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index fcfbcb5..15fada4 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -117,17 +117,6 @@ def _format_list(lst):
else:
return ""
-def _get_status(notice):
- ut = notice['type']
- if ut == 'security':
- return INFO_SECURITY
- elif ut == 'bugfix':
- return INFO_BUGFIX
- elif ut == 'enhancement':
- return INFO_ENHANCEMENT
- else:
- return INFO_UNKNOWN
-
def _getEVR(idver):
'''
get the e, v, r from the package id version
@@ -1964,6 +1953,20 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
name = "%s-%s" % (tok[0].lower(), tok[1])
self.distro_upgrade(DISTRO_UPGRADE_STABLE, name, newest)
+ def _get_status(self, notice):
+ ut = notice['type']
+ if ut == 'security':
+ return INFO_SECURITY
+ elif ut == 'bugfix':
+ return INFO_BUGFIX
+ elif ut == 'enhancement':
+ return INFO_ENHANCEMENT
+ elif ut == 'newpackage':
+ return INFO_ENHANCEMENT
+ else:
+ self.message(MESSAGE_BACKEND_ERROR, "status unrecognised, please report in bugzilla: %s" % ut)
+ return INFO_NORMAL
+
def get_updates(self, filters):
'''
Implement the {backend}-get-updates functionality
@@ -2000,7 +2003,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
# Get info about package in updates info
notice = md.get_notice((pkg.name, pkg.version, pkg.release))
if notice:
- status = _get_status(notice)
+ status = self._get_status(notice)
pkgfilter.add_custom(pkg, status)
else:
pkgfilter.add_custom(pkg, INFO_NORMAL)
commit 118095971305ab662a34bc325a7f05f339cef90e
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Dec 17 22:59:44 2008 +0000
trivial: add help text about markdown
diff --git a/docs/html/pk-faq.html b/docs/html/pk-faq.html
index 4c0df26..23d0346 100644
--- a/docs/html/pk-faq.html
+++ b/docs/html/pk-faq.html
@@ -23,6 +23,7 @@
<ul>
<li><a href="#how-complete">How complete are the backends?</a></li>
<li><a href="#catalogs">What's a package catalog?</a></li>
+<li><a href="#markup">Can I include formatting characters in package descriptions?</a></li>
<li><a href="#1-click-install">Does PackageKit support 1-Click Install?</a></li>
<li><a href="#run-as-root">When run as root, gpk-application and pkcon do not work!</a></li>
<li><a href="#session-system">Why is there a session service and and a system service?</a></li>
@@ -126,6 +127,53 @@ Note: this isn't designed to replace one click install, it just does something t
a different way.
</p>
<hr>
+
+<h3><a name="markup">Can I include formatting characters in package descriptions?</a></h3>
+<p>
+Yes, as long as the descripions are formatted with
+<a href="http://en.wikipedia.org/wiki/Markdown">Markdown</a> then the descriptions will be
+formatted correctly in client programs.
+Using Markdown is a deliberate choice as it does not force the vendor to adopt any specific
+markup language.
+An example Markdown package description would be:
+</p>
+<pre>
+GNOME Power Manager uses the information and facilities
+provided by HAL displaying icons and handling user
+callbacks in an **interactive** GNOME session.
+
+The following *GUI* programs are provided:
+* `gnome-power-preferences` - set policy and change preferences
+* `gnome-power-statistics` - view power graphs and device history
+</pre>
+<p>
+This would be rendered by a text program as:
+</p>
+<pre>
+GNOME Power Manager uses the information and facilities provided by HAL
+displaying icons and handling user callbacks in an interactive GNOME session.
+
+The following GUI programs are provided:
+* gnome-power-preferences - set policy and change preferences
+* gnome-power-statistics - view power graphs and device history
+</pre>
+<p>
+A GUI front-end would format the text like this:
+</p>
+<table bgcolor="#eeeeee" cellpadding="6px"><tr><td>
+<p>
+GNOME Power Manager uses the information and facilities provided by HAL displaying icons and handling user callbacks in an <b>interactive</b> GNOME session.
+</p>
+<p>
+The following <i>GUI</i> programs are provided:
+</p>
+<ul>
+<li><code>gnome-power-preferences</code> - set policy and change preferences</li>
+<li><code>gnome-power-statistics</code> - view power graphs and device history</li>
+</ul>
+</td></tr></table>
+<hr>
+
<h3><a name="1-click-install">Does PackageKit support 1-Click Install?</a></h3>
<p>
No, as they are a potential security problem. The issues are as follows:
commit 601db65e708c603ae333555adbb79f233f0b6ec9
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Dec 17 22:35:53 2008 +0000
bugfix: clarify that free form text in Details and UpdateDetail is formatted to markdown syntax
diff --git a/src/org.freedesktop.PackageKit.Transaction.xml b/src/org.freedesktop.PackageKit.Transaction.xml
index d87b893..3dec4c0 100644
--- a/src/org.freedesktop.PackageKit.Transaction.xml
+++ b/src/org.freedesktop.PackageKit.Transaction.xml
@@ -1441,7 +1441,10 @@
<doc:summary>
<doc:para>
The multi-line package description.
- NOTE: Tabs may have to be stripped from the description to avoid being split.
+ </doc:para>
+ <doc:para>
+ If formatting is required, then markdown syntax should be used,
+ e.g. <doc:tt>This is **critically** important</doc:tt>
</doc:para>
</doc:summary>
</doc:doc>
@@ -2112,8 +2115,11 @@
<doc:doc>
<doc:summary>
<doc:para>
- The update text describing the update in a non-localised way.
- Newlines should be converted to <doc:tt>;</doc:tt> before printed.
+ The update text describing the update.
+ </doc:para>
+ <doc:para>
+ If formatting is required, then markdown syntax should be used,
+ e.g. <doc:tt>This is **critically** important</doc:tt>
</doc:para>
</doc:summary>
</doc:doc>
More information about the PackageKit-commit
mailing list