[PackageKit-commit] packagekit: Branch 'master' - 22 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Mon Aug 18 12:07:21 PDT 2008
NEWS | 133 +++++++++++++
backends/apt/TODO | 41 ----
backends/apt/aptDBUSBackend.py | 374 ++++++++++++++++++++++++++++++++++++-
backends/apt/pk-backend-apt.c | 38 +++
backends/apt/test.py | 9
client/pk-generate-pack.c | 16 +
docs/html/pk-download.html | 29 ++
docs/html/pk-matrix.html | 4
libpackagekit/pk-enum.c | 3
libpackagekit/pk-enum.h | 3
python/packagekit/daemonBackend.py | 17 +
src/pk-transaction.c | 2
12 files changed, 605 insertions(+), 64 deletions(-)
New commits:
commit aa383de73c3dd6507d62a901a113c87344f70f07
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Aug 18 20:03:08 2008 +0100
Release version 0.3.0
diff --git a/NEWS b/NEWS
index 2b5fbfc..dc37283 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,136 @@
+Version 0.3.0
+~~~~~~~~~~~~~~
+Released: 2008-08-18
+
+Notes:
+ - This is the first release of the 0.3.x codebase and it may still have
+ regressions when compared to 0.2.4. These will be fixed as a priority.
+ - There is a lot of new functionality and many bug fixes in this release.
+ - The 0.3.0 branch is not ABI stable, as new API will be added on this branch
+ to support new use cases.
+ - The 0.2.x branch is ABI and API stable, and the 0.1.x branch is now obsolete.
+
+New Features:
+ - Add a PackageKit browser plugin (Owen W. Taylor)
+ - Add a README section on testing the plugin (Owen W. Taylor)
+ - Add a profiles page on the website so we can show typical users (Richard Hughes)
+ - Rename some of the PolicyKit actions on advice of David Zeuthen (Richard Hughes)
+ - GetRole now returns the role and the search parameter or the package name (Richard Hughes)
+ - Add a SetLocale method so we can support native localisations (Richard Hughes)
+ - Add a libtar build requirement for the new pkgenpack executable (Richard Hughes)
+ - Add pk-generate-package-list to generate a package list (Richard Hughes)
+ - Add pkgenpack, a way of packaging up a package and it's deps for installation (Shishir Goel)
+ - Add 4 new fields to the UpdateDetail callback struct (Richard Hughes)
+ - Add a new method DownloadPackages() to be able to create ServicePacks (Shishir Goel)
+ - Added download packages functionality to pkcon (Shishir Goel)
+
+Translations:
+ - Updated German translation (Fabian Affolter)
+ - Updated Brazilian Portuguese translation (Igor Pires Soares)
+ - Updated Brazilian Portuguese translation (Matt Domsch)
+ - Updated Polish translation (Piotr DrÄ
g)
+
+Backends:
+ - alpm: fix build for 0.3.0 (Valeriy Lyasotskiy)
+ - apt: Add a first try to implement DownloadPackages. Does not work yet (Sebastian Heinlein)
+ - apt: Add a small script to analyze the HotShot profiling stats (Sebastian Heinlein)
+ - apt: Add mime-type support for WhatProvides (Sebastian Heinlein)
+ - apt: Add new command line options to the backend (Sebastian Heinlein)
+ - apt: Clean up doUpdatePackages () (Sebastian Heinlein)
+ - apt: Allow to get details of several package ids (Sebastian Heinlein)
+ - apt: Fix doResolve. Thanks to Martin Pitt for the patch (Sebastian Heinlein)
+ - apt: fixes in GetDepends: report packages to be upgraded and installed (Sebastian Heinlein)
+ - apt: GetDepends(): Take version requirements into account (Sebastian Heinlein)
+ - apt: Implement a basic doGetDepends() (Sebastian Heinlein)
+ - apt: Implement codec searching in WhatProvides (Sebastian Heinlein)
+ - apt: Implement GetRequires (Sebastian Heinlein)
+ - apt: Implement SetLocale (Sebastian Heinlein)
+ - apt: Implement SetProxy (Sebastian Heinlein)
+ - apt: implement the missing doUpdatePackages() method (Michael Vogt)
+ - apt: Provide more details about updates (Sebastian Heinlein)
+ - apt: Report packages that are upgradable but cannot be upgraded (Sebastian Heinlein)
+ - apt: Show license information based on the repositories (Sebastian Heinlein)
+ - apt: Support string array of package names in doResolve (Sebastian Heinlein)
+ - dummy: add some more functionality to the dummy backend (Richard Hughes)
+ - dummy: properly emulate package_ids for get_update_detail (Richard Hughes)
+ - opkg: fix some memory leak issue (I-Fan, Chen)
+ - PiSi: compile with 0.3 changes (S.ÃaÄlar Onur)
+ - poldek: build fix (Marcin Banasiak)
+ - poldek: implement DownloadPackages (Marcin Banasiak)
+ - razor: add an experimental razor backend (Richard Hughes)
+ - razor: add initial functionality (Richard Hughes)
+ - razor: add Resolve() functionality (Richard Hughes)
+ - razor: add SearchName and SearchDescription (Richard Hughes)
+ - razor: add the devel filter (Richard Hughes)
+ - smart: change packageid to packageids (Anders F Bjorklund)
+ - smart: use smart status flags. Fixes #16525 (Anders F Bjorklund)
+ - urpmi: Improve download error handling in installation method (Aurelien Lefebvre)
+ - yum: add a nice class to access the yum sqlite database directly (Richard Hughes)
+ - yum: add Bohdi ID to the UpdateDetail if available. Fixes RH#457358 (Richard Hughes)
+ - yum: add the SericePack decompressing code (Shishir Goel)
+ - yum: allow more than one package to be removed in one transaction (Richard Hughes)
+ - yum: don't show a backtrace if we try to install a zero byte rpm (Richard Hughes)
+ - yum: fix an error message which can lead to printf breakage in the daemon (Richard Hughes)
+ - yum: fix the DownloadPackages call to give useful output (Richard Hughes)
+ - yum: fix the GetDepends call to match on installed before available (Richard Hughes)
+ - yum: fix the Resolve call with multiple packages (Richard Hughes)
+ - yum: fix up DownloadPackages for the yum backend (Shishir Goel)
+ - yum: fix up GetRequires and GetDepends to do the filtering in the backend (Richard Hughes)
+ - yum: fix up the GPG key method since the yum API changed (Richard Hughes)
+ - yum: return all packages when we do GetPackages() rather than just the newest (Richard Hugh
+ - yum: abstract out the filtering stuff (Richard Hughes)
+ - yum: support passing more than one package_id to GetUpdateDetail (Richard Hughes)
+ - yum: tidy up yumBackend and use yumComps, yumDirect and yumProgress (Richard Hughes)
+ - zypp: added driver search for new hardware (Stefan Haas)
+ - zypp: added relogin-flag for patches (Stefan Haas)
+ - zypp: changes for new api (Wang Hoi)
+ - zypp: changes for zypp 5.4.0 (Stefan Haas)
+ - zypp: change to return all restart_suggested patches not just the first one (Scott Reeves)
+ - zypp match the libzypp updates for listing repos (Scott Reeves)
+ - zypp: pk_backend_require_restart will be send when needed (Stefan Haas)
+
+Bindings:
+ - C: Bump the soname as we changed ABI some time ago (Richard Hughes)
+ - C: Rename some source files and be more militant with const (Richard Hughes)
+ - C: Don't use-after-free in pk_task_list_status_changed_cb (Richard Hughes)
+ - C: Export libpackagekit with -export-dynamic. Fixes fd#16991 (Richard Hughes)
+ - C: Correct the 'over the wire' enum for update-packages (Richard Hughes)
+ - python: Import new python frontend bindings (Aidan Skinner)
+ - python: Use glib mainloop for running (Aidan Skinner)
+ - python: Make Resolve and GetDetails return easy-to-use dicts, not tuples (Aidan Skinner)
+ - python: Add generic wrapper call that takes a dict of callbacks to connect (Aidan Skinner)
+ - python: Wrap dbus calls so that they attempt to obtain the right privilages (Aidan Skinner)
+ - browser-plugin: Use org.freedesktop.PackageKit session service (Owen W. Taylor)
+ - browser-plugin: Call gnome_desktop_item_set_launch_time() with value from event (Owen W. Taylor)
+ - browser-plugin: Switch launching from gnome-desktop to GAppInfo (Owen W. Taylor)
+
+Bugfixes:
+ - Fixed a typo in policy file (Daniel Nicoletti)
+ - Fix building with -Wformat-security. Fixes fd#16431 (Martin Pitt)
+ - Changed the required version of dbus-glib to 0.76 (Patrick Niklaus)
+ - Add the EulaRequired signal to the dbus python backend (Sebastian Heinlein)
+ - Check the package_id for UTF8 validity (Richard Hughes)
+ - Don't optimise for the common case in pk-import-desktop (Richard Hughes)
+ - Add a new helper class for talking to an embedded python instance (Richard Hughes)
+ - Fix a small memory leak in pk_engine_transaction_list_changed_cb (Richard Hughes)
+ - Don't leak the package_ids in pk_transaction_get_update_detail (Richard Hughes)
+ - AllowCancel(FALSE) is allowed when we are finished, but not TRUE (Richard Hughes)
+ - Don't print out '%' chars on the console from python exceptions (Richard Hughes)
+ - Properly match local files correctly so we don't try to resolve them (Richard Hughes)
+ - WhatProvides has a free form search string that we need to check (Richard Hughes)
+ - Check for a zero destination in the unix network code. Fixes rh#453531 (Richard Hughes)
+ - Add some convenience helpers for managing ISO8601 dates (Richard Hughes)
+ - Use g_key_file_* in pkgenpack as we need to use a group name (Richard Hughes)
+ - Check service pack's compatibility with the distro before installing it (Shishir Goel)
+ - Don't blacklist apostrophe characters. Fixes rh#459155 (Richard Hughes)
+ - Check for write access on the directory we are downloading into (Richard Hughes)
+ - Fix broken DownloadPackages in the DBus backend (Sebastian Heinlein)
+ - Submit the filters to the doGetDepends method in the python backend (Sebastian Heinlein)
+ - Implement SetLocale in the python dbus backend (Sebastian Heinlein)
+ - Add a --with-package-list option to pkgenpack to make it useful (Shishir Goel)
+ - Add a metadata.conf file while creating the pack (Shishir Goel)
+ - Fix the configure check for libtar.h (Val L)
+
Version 0.2.3
~~~~~~~~~~~~~~
Released: 2008-07-04
diff --git a/docs/html/pk-download.html b/docs/html/pk-download.html
index db94c1f..b7044ee 100644
--- a/docs/html/pk-download.html
+++ b/docs/html/pk-download.html
@@ -29,8 +29,7 @@ easier to install.
Conary: Yes, just run: <code>sudo conary update PackageKit gnome-packagekit</code>
</li>
<li>
- Fedora 8: Yes, just install <a href="http://people.freedesktop.org/~hughsient/fedora/">this</a>
- repository file and run: <code>yum install PackageKit gnome-packagekit</code> (as root)
+ Fedora 9: Yes, just run: <code>yum install PackageKit gnome-packagekit</code> (as root)
</li>
<li>
openSUSE 11: Yes, add <a href="http://download.opensuse.org/distribution/SL-OSS-factory/inst-source">this</a>
@@ -46,6 +45,27 @@ easier to install.
Released versions are found on
<a href="http://www.packagekit.org/releases/">http://www.packagekit.org/releases/</a>.
</p>
+<h3>
+Latest Supported Versions:
+</h3>
+<table>
+<tr><td><b>Version</b></td><td> </td><td><b>Date</b></td></tr>
+<tr><td>0.3.0</td><td></td><td>2008-08-18</td></tr>
+</table>
+<h3>
+ABI Stable Versions:
+</h3>
+<table>
+<tr><td><b>Version</b></td><td> </td><td><b>Date</b></td></tr>
+<tr><td>0.2.0</td><td></td><td>2008-05-06</td></tr>
+<tr><td>0.2.1</td><td></td><td>2008-05-09</td></tr>
+<tr><td>0.2.2</td><td></td><td>2008-06-05</td></tr>
+<tr><td>0.2.3</td><td></td><td>2008-07-04</td></tr>
+<tr><td>0.2.4</td><td></td><td>2008-07-30</td></tr>
+</table>
+<h3>
+Obsolete Versions:
+</h3>
<table>
<tr><td><b>Version</b></td><td> </td><td><b>Date</b></td></tr>
<tr><td>0.1.0</td><td></td><td>2007-10-16</td></tr>
@@ -60,11 +80,6 @@ Released versions are found on
<tr><td>0.1.9</td><td></td><td>2008-03-04</td></tr>
<tr><td>0.1.10</td><td></td><td>2008-03-28</td></tr>
<tr><td>0.1.11</td><td></td><td>2008-04-05</td></tr>
-<tr><td>0.2.0</td><td></td><td>2008-05-06</td></tr>
-<tr><td>0.2.1</td><td></td><td>2008-05-09</td></tr>
-<tr><td>0.2.2</td><td></td><td>2008-06-05</td></tr>
-<tr><td>0.2.3</td><td></td><td>2008-07-04</td></tr>
-<tr><td>0.2.4</td><td></td><td>2008-07-30</td></tr>
</table>
<h2>Dependencies</h2>
commit db87c0ff63faa59085517b6092432926b1859254
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Aug 18 19:57:01 2008 +0100
trivial: comment out the new group defines, until we can cope with 64 bit enums
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index c031d2c..dd5433e 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -231,9 +231,9 @@ static PkEnumMatch enum_group[] = {
{PK_GROUP_ENUM_NETWORK, "network"},
{PK_GROUP_ENUM_MAPS, "maps"},
{PK_GROUP_ENUM_REPOS, "repos"},
- {PK_GROUP_ENUM_SCIENCE, "science"},
- {PK_GROUP_ENUM_DOCUMENTATION, "documentation"},
- {PK_GROUP_ENUM_ELECTRONICS, "electronics"},
+// {PK_GROUP_ENUM_SCIENCE, "science"},
+// {PK_GROUP_ENUM_DOCUMENTATION, "documentation"},
+// {PK_GROUP_ENUM_ELECTRONICS, "electronics"},
{0, NULL}
};
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index c0cf776..b5c0ba2 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -296,10 +296,10 @@ typedef enum {
PK_GROUP_ENUM_SERVERS = 1 << 25,
PK_GROUP_ENUM_SYSTEM = 1 << 26,
PK_GROUP_ENUM_VIRTUALIZATION = 1 << 27,
- PK_GROUP_ENUM_SCIENCE = 1 << 28,
- PK_GROUP_ENUM_DOCUMENTATION = 1 << 29,
- PK_GROUP_ENUM_ELECTRONICS = 1 << 30,
- PK_GROUP_ENUM_UNKNOWN = 1 << 31
+// PK_GROUP_ENUM_SCIENCE = 1 << 28,
+// PK_GROUP_ENUM_DOCUMENTATION = 1 << 29,
+// PK_GROUP_ENUM_ELECTRONICS = 1 << 30,
+ PK_GROUP_ENUM_UNKNOWN = 1 << 28
} PkGroupEnum;
/**
commit 2e02f32a3851e20be15f242deda2994df47d2aee
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Aug 18 16:39:05 2008 +0100
trivial: apt: don't localise text as we don't want to bring in gettext for the backends
diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index dc004ab..2ff256a 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -1232,7 +1232,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
"/%(src_section)s/%(prefix)s/%(src_pkg)s" \
"/%(src_pkg)s_%(src_ver)s/changelog"
else:
- return _("The list of changes is not available")
+ return "The list of changes is not available"
# get the src package name
src_pkg = pkg.sourcePackageName
commit da2a30af622943774d73293c9c4e235b7fd4a454
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Aug 18 12:58:03 2008 +0100
trivial: fix my last commit
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index 14807aa..c031d2c 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -231,9 +231,9 @@ static PkEnumMatch enum_group[] = {
{PK_GROUP_ENUM_NETWORK, "network"},
{PK_GROUP_ENUM_MAPS, "maps"},
{PK_GROUP_ENUM_REPOS, "repos"},
- {PK_GROUP_ENUM_SCIENCE "science"},
- {PK_GROUP_ENUM_DOCUMENTATION "documentation"},
- {PK_GROUP_ENUM_ELECTRONICS "electronics"},
+ {PK_GROUP_ENUM_SCIENCE, "science"},
+ {PK_GROUP_ENUM_DOCUMENTATION, "documentation"},
+ {PK_GROUP_ENUM_ELECTRONICS, "electronics"},
{0, NULL}
};
commit 583272ebdc0490e8a77fca1f24a37a1a170daa56
Author: Shishir Goel <crazyontheedge at gmail.com>
Date: Mon Aug 18 12:23:34 2008 +0100
pkgenpack:fix the memory leaks in test cases
diff --git a/client/pk-generate-pack.c b/client/pk-generate-pack.c
index 8beeab9..774e1a3 100644
--- a/client/pk-generate-pack.c
+++ b/client/pk-generate-pack.c
@@ -579,6 +579,7 @@ libst_generate_pack (LibSelfTest *test)
else
libst_failed (test, NULL);
g_strfreev (package_ids);
+ g_object_unref (client);
/************************************************************/
libst_title (test, "exclude NULL");
@@ -597,6 +598,7 @@ libst_generate_pack (LibSelfTest *test)
libst_success (test, NULL);
else
libst_failed (test, NULL);
+ g_object_unref (list);
/************************************************************/
libst_title (test, "exclude false.txt");
@@ -606,6 +608,7 @@ libst_generate_pack (LibSelfTest *test)
libst_success (test, NULL);
else
libst_failed (test, NULL);
+ g_object_unref (list);
/************************************************************/
libst_title (test, "metadata NULL");
@@ -701,6 +704,8 @@ libst_generate_pack (LibSelfTest *test)
} else {
libst_failed (test, NULL);
}
+ if (file_array != NULL)
+ g_ptr_array_free (file_array, TRUE);
/************************************************************/
libst_title (test, "generate pack /tmp/gitk.pack gitk");
@@ -709,13 +714,20 @@ libst_generate_pack (LibSelfTest *test)
g_ptr_array_add (file_array, src);
ret = pk_generate_pack_create ("/tmp/gitk.pack",file_array, &error);
if (!ret) {
- if (error != NULL)
+ if (error != NULL) {
libst_failed (test, "failed to create pack %s" , error->message);
- else
+ g_error_free (error);
+ } else {
libst_failed (test, "could not set error");
+ }
} else {
libst_success (test, NULL);
}
+ if (file_array != NULL)
+ g_ptr_array_free (file_array, TRUE);
+ g_remove ("/tmp/gitk.pack");
+
/************************************************************/
+ libst_end (test);
}
#endif
commit 65f7cd183adbb11fdec049b66283e5461cc94189
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Aug 18 12:21:29 2008 +0100
trivial: add some new group enums
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index abb1abb..14807aa 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -231,6 +231,9 @@ static PkEnumMatch enum_group[] = {
{PK_GROUP_ENUM_NETWORK, "network"},
{PK_GROUP_ENUM_MAPS, "maps"},
{PK_GROUP_ENUM_REPOS, "repos"},
+ {PK_GROUP_ENUM_SCIENCE "science"},
+ {PK_GROUP_ENUM_DOCUMENTATION "documentation"},
+ {PK_GROUP_ENUM_ELECTRONICS "electronics"},
{0, NULL}
};
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index 21461b3..c0cf776 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -296,7 +296,10 @@ typedef enum {
PK_GROUP_ENUM_SERVERS = 1 << 25,
PK_GROUP_ENUM_SYSTEM = 1 << 26,
PK_GROUP_ENUM_VIRTUALIZATION = 1 << 27,
- PK_GROUP_ENUM_UNKNOWN = 1 << 28
+ PK_GROUP_ENUM_SCIENCE = 1 << 28,
+ PK_GROUP_ENUM_DOCUMENTATION = 1 << 29,
+ PK_GROUP_ENUM_ELECTRONICS = 1 << 30,
+ PK_GROUP_ENUM_UNKNOWN = 1 << 31
} PkGroupEnum;
/**
commit 09a44966676efc3761dc5cdfe868c108a0ee1fe6
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Mon Aug 18 12:25:14 2008 +0200
APT: Fix calling the name search instead of the group search
diff --git a/backends/apt/pk-backend-apt.c b/backends/apt/pk-backend-apt.c
index da1ef97..f49b92d 100644
--- a/backends/apt/pk-backend-apt.c
+++ b/backends/apt/pk-backend-apt.c
@@ -191,7 +191,7 @@ backend_search_name (PkBackend *backend, PkFilterEnum filters, const gchar *sear
static void
backend_search_group (PkBackend *backend, PkFilterEnum filters, const gchar *group)
{
- pk_backend_dbus_search_name (dbus, filters, group);
+ pk_backend_dbus_search_group (dbus, filters, group);
}
commit 706b0645c68918fdc8533135abb69d157030f0ec
Merge: f6145d7... b28c410...
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Mon Aug 18 12:22:39 2008 +0200
Merge branch 'master' of git+ssh://glatzor@git.packagekit.org/srv/git/PackageKit
commit f6145d74e639a9283b889c2a918930320baf2c71
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Mon Aug 18 12:21:30 2008 +0200
APT: Update TODO
diff --git a/backends/apt/TODO b/backends/apt/TODO
index 0ff4a49..62ce787 100644
--- a/backends/apt/TODO
+++ b/backends/apt/TODO
@@ -25,43 +25,6 @@ TODO:
the xapian database to also make use of it in search group and
search name (do we want this?)
- * Map Debian/Ubuntu sections to PackageKit groups:
- - admin : System Administration => admin-tools
- - base : Base System => system
- - comm : Communication => communication
- - devel : Development => programming
- - doc : Documentation => ???
- - editors : Editors => accessoires
- - electronics : Electronics => other
- - embedded : Embedded Devices => system
- - games : Games and Amusement => games
- - gnome : GNOME Desktop Environment => desktop-gnome
- - graphics : Graphics => graphics
- - hamradio : Amateur Radio => communication
- - interpreters : Interpreted Computer L. => programming
- - kde : KDE Desktop Environment => desktop-kde
- - libdevel : Libraries - Development => programming
- - libs : Libraries => system
- - mail : Email => internet
- - math : Mathematics => ??? science/education
- - misc : Miscellaneous - Text Based => other
- - net : Networkinga => network
- - news : Newsgroup => internet
- - oldlibs : Libraries - Old => legacy
- - otherosfs : Cross Platform => system
- - perl : Perl Programming Language => programming
- - python : Python Programming Language => programming
- - science : Science => ??? science/education
- - shells : Shells => system
- - sound : Multimedia => multimedia
- - tex : TeX Authoring => publishing
- - text : Word Processing => publishing
- - utils : Utilities => accessoires
- - web : World Wide Web => internet
- - x11 : Miscellaneous - Graphical => desktop-other
- - unknown : Unknown => unknown
- - alien : Converted From RPM by Alien" => unknown
- - translations => localization
- The following could not be maped: science, documentation, electronics
- Are there any derivates with additional sections?
+ * Group mapping: Are there any derivates with additional sections? We need
+ additional groups for doc, science and electronics
commit 8ebf6d2dae4bea16ddf95d7f902b2acc33191aaa
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Mon Aug 18 12:21:08 2008 +0200
APT: Implement SearchGroup
diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index cb52e99..dc004ab 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -254,6 +254,29 @@ class PackageKitAptBackend(PackageKitBaseBackend):
self._canceled.wait()
@threaded
+ def doSearchGroup(self, filters, group):
+ '''
+ Implement the apt2-search-group functionality
+ '''
+ pklog.info("Searching for group: %s" % group)
+ self.StatusChanged(STATUS_QUERY)
+ self.NoPercentageUpdates()
+ self._check_init(progress=False)
+ self.AllowCancel(True)
+
+ for pkg in self._cache:
+ if self._canceled.isSet():
+ self.ErrorCode(ERROR_TRANSACTION_CANCELLED,
+ "The search was canceled")
+ self.Finished(EXIT_KILLED)
+ self._canceled.clear()
+ return
+ elif self._get_package_group(pkg) == group and \
+ self._is_package_visible(pkg, filters):
+ self._emit_package(pkg)
+ self.Finished(EXIT_SUCCESS)
+
+ @threaded
def doSearchName(self, filters, search):
'''
Implement the apt2-search-name functionality
@@ -437,15 +460,15 @@ class PackageKitAptBackend(PackageKitBaseBackend):
# replace all multiple spaces by newlines
p = re.compile(r'\s\s+', re.MULTILINE)
desc = p.sub('\n', desc)
- #FIXME: group information missing
#FIXME: We need more fine grained license information!
- origin = pkg.candidateOrigin
- if origin[0].component in ["main", "universe"] and \
- origin[0].origin in ["Debian", "Ubuntu"]:
+ origin = pkg.candidateOrigin[0]
+ if origin.component in ["main", "universe"] and \
+ origin.origin in ["Debian", "Ubuntu"]:
license = "free"
else:
license = "unknown"
- self.Details(pkg_id, license, 'unknown', desc,
+ group = self._get_package_group(pkg)
+ self.Details(pkg_id, license, group, desc,
pkg.homepage, pkg.packageSize)
self.Finished(EXIT_SUCCESS)
@@ -1315,6 +1338,90 @@ class PackageKitAptBackend(PackageKitBaseBackend):
"check your Internet connection."
return changelog
+ def _get_package_group(self, pkg):
+ """
+ Return the packagekit group corresponding to the package's section
+ """
+ section = pkg.section
+ if section == "admin":
+ return GROUP_ADMIN_TOOLS
+ elif section == "base":
+ return GROUP_SYSTEM
+ elif section == "comm":
+ return GROUP_COMMUNICATION
+ elif section == "devel":
+ return GROUP_PROGRAMMING
+ elif section == "doc":
+ #FIXME: introduce a new group
+ return GROUP_OTHER
+ elif section == "editors":
+ return GROUP_PUBLISHING
+ elif section == "electronics":
+ #FIXME: do we need a special group?
+ return GROUP_OTHER
+ elif section == "embedded":
+ return GROUP_SYSTEM
+ elif section == "games":
+ return GROUP_GAMES
+ elif section == "GNOME":
+ return GROUP_DESKTOP_GNOME
+ elif section == "graphics":
+ return GROUP_GRAPHICS
+ elif section == "hamradio":
+ return GROUP_COMMUNICATION
+ elif section == "interpreters":
+ return GROUP_PROGRAMMING
+ elif section == "kde":
+ return GROUP_DESKTOP_KDE
+ elif section == "libdevel":
+ return GROUP_PROGRAMMING
+ elif section == "lib":
+ return GROUP_SYSTEM
+ elif section == "mail":
+ return GROUP_INTERNET
+ elif section == "math":
+ #FIXME: Need a group science
+ return GROUP_OTHER
+ elif section == "misc":
+ return GROUP_OTHER
+ elif section == "net":
+ return GROUP_NETWORK
+ elif section == "news":
+ return GROUP_INTERNET
+ elif section == "oldlibs":
+ return GROUP_LEGACY
+ elif section == "otherosfs":
+ return GROUP_SYSTEM
+ elif section == "perl":
+ return GROUP_PROGRAMMING
+ elif section == "python":
+ return GROUP_PROGRAMMING
+ elif section == "science":
+ #FIXME Need a new group
+ return GROUP_OTHER
+ elif section == "shells":
+ return GROUP_SYSTEM
+ elif section == "sound":
+ return GROUP_MULTIMEDIA
+ elif section == "tex":
+ return GROUP_PUBLISHING
+ elif section == "text":
+ return GROUP_PUBLISHING
+ elif section == "utils":
+ return GROUP_ACCESSORIES
+ elif section == "web":
+ return GROUP_INTERNET
+ elif section == "x11":
+ return GROUP_DESKTOP_OTHER
+ elif section == "unknown":
+ return GROUP_UNKNOWN
+ elif section == "alien":
+ return GROUP_UNKNOWN
+ elif section == "translations":
+ return GROUP_LOCALIZATION
+ else:
+ return GROUP_UNKNOWN
+
def takeover():
"""
Exit the currently running backend
diff --git a/backends/apt/pk-backend-apt.c b/backends/apt/pk-backend-apt.c
index d128548..da1ef97 100644
--- a/backends/apt/pk-backend-apt.c
+++ b/backends/apt/pk-backend-apt.c
@@ -58,14 +58,23 @@ static PkGroupEnum
backend_get_groups (PkBackend *backend)
{
return (PK_GROUP_ENUM_ACCESSORIES |
+ PK_GROUP_ENUM_ADMIN_TOOLS |
+ PK_GROUP_ENUM_COMMUNICATION |
+ PK_GROUP_ENUM_DESKTOP_GNOME |
+ PK_GROUP_ENUM_DESKTOP_KDE |
+ PK_GROUP_ENUM_DESKTOP_OTHER |
PK_GROUP_ENUM_GAMES |
PK_GROUP_ENUM_GRAPHICS |
PK_GROUP_ENUM_INTERNET |
- PK_GROUP_ENUM_OFFICE |
+ PK_GROUP_ENUM_LEGACY |
+ PK_GROUP_ENUM_LOCALIZATION |
+ PK_GROUP_ENUM_MULTIMEDIA |
+ PK_GROUP_ENUM_NETWORK |
PK_GROUP_ENUM_OTHER |
PK_GROUP_ENUM_PROGRAMMING |
- PK_GROUP_ENUM_MULTIMEDIA |
- PK_GROUP_ENUM_SYSTEM);
+ PK_GROUP_ENUM_PUBLISHING |
+ PK_GROUP_ENUM_SYSTEM |
+ PK_GROUP_ENUM_UNKNOWN);
}
/**
@@ -177,6 +186,16 @@ backend_search_name (PkBackend *backend, PkFilterEnum filters, const gchar *sear
}
/**
+ * * pk_backend_search_group:
+ * */
+static void
+backend_search_group (PkBackend *backend, PkFilterEnum filters, const gchar *group)
+{
+ pk_backend_dbus_search_name (dbus, filters, group);
+}
+
+
+/**
* * pk_backend_cancel:
* */
static void
@@ -268,7 +287,7 @@ PK_BACKEND_OPTIONS (
NULL, /* rollback */
backend_search_details, /* search_details */
NULL, /* search_file */
- NULL, /* search_group */
+ backend_search_group, /* search_group */
backend_search_name, /* search_name */
NULL, /* service_pack */
backend_update_packages, /* update_packages */
commit b28c410452fe9fa73be18286fe3bace6e2f4110f
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Aug 18 09:31:41 2008 +0100
trivial: fix built with -Wformat-security
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 9fc5d25..6ede97d 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -2191,7 +2191,7 @@ pk_transaction_install_files (PkTransaction *transaction, gboolean trusted,
if (g_str_has_suffix (full_paths[i], ".pack")) {
ret = pk_transaction_check_pack_distro_id (full_paths[i], &failure);
if (!ret) {
- error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_PACK_INVALID, failure);
+ error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_PACK_INVALID, "%s", failure);
dbus_g_method_return_error (context, error);
g_free (failure);
return;
commit a75453457f167831e37a19a7248340155f69ba97
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Mon Aug 18 10:13:51 2008 +0200
APT: Add what provides calls to the test script
diff --git a/backends/apt/test.py b/backends/apt/test.py
index a1d5ffb..19fa28c 100755
--- a/backends/apt/test.py
+++ b/backends/apt/test.py
@@ -83,6 +83,15 @@ try:
if cmd == 'get-repolist' or cmd == 'all':
print "Testing GetRepoList()"
iface.GetRepoList()
+ if cmd == 'get-whatprovides-mimetype' or cmd == 'all':
+ print "Testing WhatProvides mime type perl"
+ iface.WhatProvides("none", PROVIDES_MIMETYPE, "text/x-perl")
+ if cmd == 'get-whatprovides-codec' or cmd == 'all':
+ print "Testing WhatProvides codec divx"
+ iface.WhatProvides("none", PROVIDES_CODEC,
+ "gstreamer.net|0.10|totem|DivX MPEG-4 Version 5 "
+ "decoder|decoder-video/x-divx, divxversion=(int)5 "
+ "(DivX MPEG-4 Version 5 decoder)")
if cmd == 'get-updatedetail' or cmd == 'all':
print "Testing GetUpdateDetail(PKG_ID)"
iface.GetUpdateDetail(PKG_ID)
commit e1f083865d9e9dab951ee15365199d850cf92899
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Sun Aug 17 22:01:18 2008 +0200
Raise the default log level of the python dbus backend to warnings.
diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index bf750fa..0060376 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -42,7 +42,7 @@ from pkexceptions import *
logging.basicConfig(format="%(levelname)s:%(message)s")
pklog = logging.getLogger("PackageKitBackend")
-pklog.setLevel(logging.INFO)
+pklog.setLevel(logging.WARN)
syslog = logging.handlers.SysLogHandler(facility=logging.handlers.SysLogHandler.LOG_DAEMON,address='/dev/log')
formatter = logging.Formatter('PackageKit: %(levelname)s: %(message)s')
commit 88023eb803e8077f9b64855c79f20a54e8fd3c75
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Sun Aug 17 16:24:12 2008 +0200
Update the feature matrix for the apt backend.
diff --git a/docs/html/pk-matrix.html b/docs/html/pk-matrix.html
index 44d365b..d70764d 100644
--- a/docs/html/pk-matrix.html
+++ b/docs/html/pk-matrix.html
@@ -231,7 +231,7 @@
</tr>
<tr>
<td><b>GetRequires</b></td>
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- apt -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- alpm -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- box -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- conary -->
@@ -366,7 +366,7 @@
</tr>
<tr>
<td><b>WhatProvides</b></td>
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- apt -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- alpm -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- box -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- conary -->
commit ea52a4495cb348044244c07139672ee9cf270f7d
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Sun Aug 17 16:18:08 2008 +0200
APT: Make use of the newly introduced helpers in doWhatProvides to simplify the code and add some comments.
diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index 0310c2e..cb52e99 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -962,14 +962,15 @@ class PackageKitAptBackend(PackageKitBaseBackend):
if ":" in codec:
codec = codec.split(":")[1]
if codec in term:
+ # The codec mapping db stores the packages as a string
+ # separated by spaces. Each package has its section
+ # prefixed and separated by a slash
+ # FIXME: Should make use of the section and emit a
+ # RepositoryRequired signal if the package does
+ # not exist
handlers.update(set(map(lambda s: s.split("/")[1],
db[k].split(" "))))
- for p in handlers:
- if not self._cache.has_key(p):
- continue
- pkg = self._cache[p]
- if self._is_package_visible(pkg, filters):
- self._emit_package(pkg)
+ self._emit_visible_packages_by_name(filters, handlers)
elif provides_type == PROVIDES_MIMETYPE:
# Emit packages that contain an application that can handle
# the given mime type
@@ -980,12 +981,14 @@ class PackageKitAptBackend(PackageKitBaseBackend):
return
if db.has_key(search):
pklog.debug("Mime type is registered: %s" % db[search])
- for p in map(lambda s: s.split("/")[1], db[search].split(" ")):
- if not self._cache.has_key(p):
- continue
- pkg = self._cache[p]
- if self._is_package_visible(pkg, filters):
- self._emit_package(pkg)
+ # The mime type handler db stores the packages as a string
+ # separated by spaces. Each package has its section
+ # prefixed and separated by a slash
+ # FIXME: Should make use of the section and emit a
+ # RepositoryRequired signal if the package does not exist
+ handlers = map(lambda s: s.split("/")[1],
+ db[search].split(" "))
+ self._emit_visible_packages_by_name(filters, handlers)
else:
self.ErrorCode(ERROR_NOT_SUPPORTED,
"This function is not implemented in this backend")
commit 423d75f8d1894fa27f544b1ea437e0609a8e3292
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Sun Aug 17 16:08:48 2008 +0200
APT: Add two helper methods _emit_visible_packages and _emit_visible_packages_by_name
diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index 47bc579..0310c2e 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -1118,6 +1118,25 @@ class PackageKitAptBackend(PackageKitBaseBackend):
summary = pkg.summary
self.Package(info, id, summary)
+ def _emit_visible_packages(self, filters, pkgs, info=None):
+ """
+ Filter and emit packages
+ """
+ for p in pkgs:
+ if self._is_package_visible(p, filters):
+ self._emit_package(p, info)
+
+ def _emit_visible_packages_by_name(self, filters, pkgs, info=None):
+ """
+ Find the packages with the given namens. Afterwards filter and emit
+ them
+ """
+ for name in pkgs:
+ if self._cache.has_key(name) and \
+ self._is_package_visible(self._cache[name], filters):
+ self._emit_package(self._cache[name], info)
+
+
def _is_package_visible(self, pkg, filters):
'''
Return True if the package should be shown in the user interface
commit 9a3cccea59b8188aa180e8326197481478a9e086
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Sun Aug 17 16:01:20 2008 +0200
APT: Rename the helper method open_mapping_db to get_mapping_db and use it for the codecs too.
diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index afa1e24..47bc579 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -904,7 +904,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
@threaded
def doWhatProvides(self, filters, provides_type, search):
- def open_mapping_db(path):
+ def get_mapping_db(path):
"""
Return the gdbm database at the given path or send an
appropriate error message
@@ -952,15 +952,10 @@ class PackageKitAptBackend(PackageKitBaseBackend):
"The search term is invalid")
self.Finished(EXIT_FAILED)
return
- MAPPING_DB = "/var/cache/app-install/gai-codec-map.gdbm"
- if not os.access(MAPPING_DB, os.R_OK):
- self.ErrorCode(ERROR_UNKNOWN,
- "The list of codecs is not available. "
- "Please make sure that the package "
- "app-install-data is installed.")
+ db = get_mapping_db("/var/cache/app-install/gai-codec-map.gdbm")
+ if db == None:
self.Finished(EXIT_FAILED)
return
- db = gdbm.open(MAPPING_DB)
handlers = set()
for k in db.keys():
codec = k
@@ -979,11 +974,10 @@ class PackageKitAptBackend(PackageKitBaseBackend):
# Emit packages that contain an application that can handle
# the given mime type
handlers = set()
- db = open_mapping_db("/var/cache/app-install/gai-mime-map.gdbm")
+ db = get_mapping_db("/var/cache/app-install/gai-mime-map.gdbm")
if db == None:
self.Finished(EXIT_FAILED)
return
-
if db.has_key(search):
pklog.debug("Mime type is registered: %s" % db[search])
for p in map(lambda s: s.split("/")[1], db[search].split(" ")):
commit 6336b2f1067b4c16b36a7982817a4342f66d9cda
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Sun Aug 17 15:59:24 2008 +0200
APT: Add mime-type support for WhatProvides
diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index c1b2a8e..afa1e24 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -904,6 +904,38 @@ class PackageKitAptBackend(PackageKitBaseBackend):
@threaded
def doWhatProvides(self, filters, provides_type, search):
+ def open_mapping_db(path):
+ """
+ Return the gdbm database at the given path or send an
+ appropriate error message
+ """
+ if not os.access(path, os.R_OK):
+ if self._cache.has_key("app-install-data") and \
+ self._cache["app-install-data"].isInstalled == False:
+ self.ErrorCode(ERROR_UNKNOWN,
+ "Please install the package "
+ "app-install data for a list of "
+ "applications that can handle files of "
+ "the given type")
+ else:
+ self.ErrorCode(ERROR_UNKNOWN,
+ "The list of applications that can handle "
+ "files of the given type cannot be opened.\n"
+ "Try to reinstall the package "
+ "app-install-data.")
+ return None
+ try:
+ db = gdbm.open(path)
+ except:
+ self.ErrorCode(ERROR_UNKNOWN,
+ "The list of applications that can handle "
+ "files of the given type cannot be opened.\n"
+ "Try to reinstall the package "
+ "app-install-data.")
+ return None
+ else:
+ return db
+
self.StatusChanged(STATUS_INFO)
self.NoPercentageUpdates()
self._check_init(progress=False)
@@ -943,6 +975,23 @@ class PackageKitAptBackend(PackageKitBaseBackend):
pkg = self._cache[p]
if self._is_package_visible(pkg, filters):
self._emit_package(pkg)
+ elif provides_type == PROVIDES_MIMETYPE:
+ # Emit packages that contain an application that can handle
+ # the given mime type
+ handlers = set()
+ db = open_mapping_db("/var/cache/app-install/gai-mime-map.gdbm")
+ if db == None:
+ self.Finished(EXIT_FAILED)
+ return
+
+ if db.has_key(search):
+ pklog.debug("Mime type is registered: %s" % db[search])
+ for p in map(lambda s: s.split("/")[1], db[search].split(" ")):
+ if not self._cache.has_key(p):
+ continue
+ pkg = self._cache[p]
+ if self._is_package_visible(pkg, filters):
+ self._emit_package(pkg)
else:
self.ErrorCode(ERROR_NOT_SUPPORTED,
"This function is not implemented in this backend")
commit 0e3ee7c3f54ba64555fe7fd312c23b24d7f31931
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Sun Aug 17 11:35:21 2008 +0200
APT: Implement codec searching in WhatProvides
diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index a269ecd..c1b2a8e 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -17,6 +17,7 @@ the Free Software Foundation; either version 2 of the License, or
__author__ = "Sebastian Heinlein <devel at glatzor.de>"
+import gdbm
import httplib
import locale
import logging
@@ -901,6 +902,54 @@ class PackageKitAptBackend(PackageKitBaseBackend):
self._cache._depcache.Init()
self.Finished(EXIT_SUCCESS)
+ @threaded
+ def doWhatProvides(self, filters, provides_type, search):
+ self.StatusChanged(STATUS_INFO)
+ self.NoPercentageUpdates()
+ self._check_init(progress=False)
+ self.AllowCancel(False)
+ if provides_type == PROVIDES_CODEC:
+ # The search term from the codec helper looks like this one:
+ # "gstreamer.net|0.10|totem|DivX MPEG-4 Version 5 decoder|" \
+ # "decoder-video/x-divx, divxversion=(int)5 (DivX MPEG-4 Version " \
+ # "5 decoder)"
+ try:
+ (origin, version, app, descr, term) = search.split("|")
+ except ValueError, e:
+ self.ErrorCode(ERROR_UNKNOWN,
+ "The search term is invalid")
+ self.Finished(EXIT_FAILED)
+ return
+ MAPPING_DB = "/var/cache/app-install/gai-codec-map.gdbm"
+ if not os.access(MAPPING_DB, os.R_OK):
+ self.ErrorCode(ERROR_UNKNOWN,
+ "The list of codecs is not available. "
+ "Please make sure that the package "
+ "app-install-data is installed.")
+ self.Finished(EXIT_FAILED)
+ return
+ db = gdbm.open(MAPPING_DB)
+ handlers = set()
+ for k in db.keys():
+ codec = k
+ if ":" in codec:
+ codec = codec.split(":")[1]
+ if codec in term:
+ handlers.update(set(map(lambda s: s.split("/")[1],
+ db[k].split(" "))))
+ for p in handlers:
+ if not self._cache.has_key(p):
+ continue
+ pkg = self._cache[p]
+ if self._is_package_visible(pkg, filters):
+ self._emit_package(pkg)
+ else:
+ self.ErrorCode(ERROR_NOT_SUPPORTED,
+ "This function is not implemented in this backend")
+ self.Finished(EXIT_FAILED)
+ return
+ self.Finished(EXIT_SUCCESS)
+
def doSetProxy(self, http_proxy, ftp_proxy):
'''
Set a proxy server for http and ftp transfer
diff --git a/backends/apt/pk-backend-apt.c b/backends/apt/pk-backend-apt.c
index 00b2fee..d128548 100644
--- a/backends/apt/pk-backend-apt.c
+++ b/backends/apt/pk-backend-apt.c
@@ -230,6 +230,15 @@ backend_download_packages (PkBackend *backend, gchar **package_ids, const gchar
pk_backend_dbus_download_packages (dbus, package_ids, directory);
}
+/**
+ * * pk_backend_what_provides
+ * */
+static void
+backend_what_provides (PkBackend *backend, PkFilterEnum filters, PkProvidesEnum provides, const gchar *search)
+{
+ pk_backend_dbus_what_provides (dbus, filters, provides, search);
+}
+
PK_BACKEND_OPTIONS (
"Apt", /* description */
@@ -264,5 +273,5 @@ PK_BACKEND_OPTIONS (
NULL, /* service_pack */
backend_update_packages, /* update_packages */
backend_update_system, /* update_system */
- NULL /* what_provides */
+ backend_what_provides /* what_provides */
);
commit 36131076b78592bfdb15ea9f0b8747862b6c2eb6
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Sat Aug 16 12:22:45 2008 +0200
Add the EulaRequired signal to the dbus python backend
diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index eb2ac8a..bf750fa 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -316,6 +316,21 @@ class PackageKitBaseBackend(dbus.service.Object):
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
+ signature='ssss')
+ def EulaRequired(self, eula_id, package_id, vendor_name, license_agreement):
+ '''
+ send 'eula-required' signal:
+ @param eula_id: unique identifier of the EULA agreement
+ @param package_id: the package affected by this agreement
+ @param vendor_name: the freedom hater
+ @param license_agreement: the plain text license agreement
+ '''
+ pklog.info("Eula required (%s,%s,%s,%s)" % (eula_id, package_id,
+ vendor_name,
+ license_agreement))
+
+ @PKSignalHouseKeeper
+ @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
signature='')
def UpdatesChanged(self,typ,fname):
'''
commit 2ef5b0795fb9af604299764b1ecd2d0d46df50a4
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Sat Aug 16 10:48:09 2008 +0200
APT: The backend isn't any toy anymore.
diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index dcba5ef..a269ecd 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -16,7 +16,6 @@ the Free Software Foundation; either version 2 of the License, or
"""
__author__ = "Sebastian Heinlein <devel at glatzor.de>"
-__state__ = "experimental"
import httplib
import locale
commit b2c2be6cf6a6e3a41877e8961c7b90d9fac3e9c6
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Sat Aug 16 10:45:35 2008 +0200
APT: Steal and adapt some bits from update-manager to get the changelog for a package. Those will be merged with python-apt soon and removed again from packgekit.
diff --git a/backends/apt/aptDBUSBackend.py b/backends/apt/aptDBUSBackend.py
index ebcf2e3..dcba5ef 100755
--- a/backends/apt/aptDBUSBackend.py
+++ b/backends/apt/aptDBUSBackend.py
@@ -18,6 +18,7 @@ the Free Software Foundation; either version 2 of the License, or
__author__ = "Sebastian Heinlein <devel at glatzor.de>"
__state__ = "experimental"
+import httplib
import locale
import logging
import optparse
@@ -26,9 +27,11 @@ import pty
import re
import signal
import shutil
+import socket
import sys
import time
import threading
+import urllib2
import warnings
import apt
@@ -60,6 +63,9 @@ else:
pklog.debug("Use XAPIAN for the search")
XAPIAN_SUPPORT = True
+# Set a timeout for the changelog download
+socket.setdefaulttimeout(2)
+
# Required for daemon mode
os.putenv("PATH",
"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin")
@@ -386,7 +392,9 @@ class PackageKitAptBackend(PackageKitBaseBackend):
cvs_url = ""
restart = ""
update_text = ""
- changelog = ""
+ #FIXME: Replace this method with the python-apt one as soon as the
+ # consolidate branch gets merged
+ changelog = self._get_changelog(pkg)
state = ""
issued = ""
updated = ""
@@ -1062,6 +1070,138 @@ class PackageKitAptBackend(PackageKitBaseBackend):
else:
return None
+ def _get_changelog(self, pkg, uri=None, cancel_lock=None):
+ """
+ Download the changelog of the package and return it as unicode
+ string
+
+ This method is already part of the consolidate branch of python-apt
+
+ uri: Is the uri to the changelog file. The following named variables
+ will be substituted: src_section, prefix, src_pkg and src_ver
+ For example the Ubuntu changelog:
+ uri = "http://changelogs.ubuntu.com/changelogs/pool" \\
+ "/%(src_section)s/%(prefix)s/%(src_pkg)s" \\
+ "/%(src_pkg)s_%(src_ver)s/changelog"
+ cancel_lock: If this threading.Lock() is set, the download will be
+ canceled
+ """
+ if uri == None:
+ if pkg.candidateOrigin[0].origin == "Debian":
+ uri = "http://packages.debian.org/changelogs/pool" \
+ "/%(src_section)s/%(prefix)s/%(src_pkg)s" \
+ "/%(src_pkg)s_%(src_ver)s/changelog"
+ elif pkg.candidateOrigin[0].origin == "Ubuntu":
+ uri = "http://changelogs.ubuntu.com/changelogs/pool" \
+ "/%(src_section)s/%(prefix)s/%(src_pkg)s" \
+ "/%(src_pkg)s_%(src_ver)s/changelog"
+ else:
+ return _("The list of changes is not available")
+
+ # get the src package name
+ src_pkg = pkg.sourcePackageName
+
+ # assume "main" section
+ src_section = "main"
+ # use the section of the candidate as a starting point
+ section = pkg._depcache.GetCandidateVer(pkg._pkg).Section
+
+ # get the source version, start with the binaries version
+ bin_ver = pkg.candidateVersion
+ src_ver = pkg.candidateVersion
+ #print "bin: %s" % binver
+ try:
+ # try to get the source version of the pkg, this differs
+ # for some (e.g. libnspr4 on ubuntu)
+ # this feature only works if the correct deb-src are in the
+ # sources.list
+ # otherwise we fall back to the binary version number
+ src_records = apt_pkg.GetPkgSrcRecords()
+ src_rec = src_records.Lookup(src_pkg)
+ if src_rec:
+ src_ver = src_records.Version
+ #if apt_pkg.VersionCompare(binver, srcver) > 0:
+ # srcver = binver
+ if not src_ver:
+ src_ver = bin_ver
+ #print "srcver: %s" % src_ver
+ section = src_records.Section
+ #print "srcsect: %s" % section
+ else:
+ # fail into the error handler
+ raise SystemError
+ except SystemError, e:
+ src_ver = bin_ver
+
+ l = section.split("/")
+ if len(l) > 1:
+ src_section = l[0]
+
+ # lib is handled special
+ prefix = src_pkg[0]
+ if src_pkg.startswith("lib"):
+ prefix = "lib" + src_pkg[3]
+
+ # stip epoch
+ l = src_ver.split(":")
+ if len(l) > 1:
+ src_ver = "".join(l[1:])
+
+ uri = uri % {"src_section" : src_section,
+ "prefix" : prefix,
+ "src_pkg" : src_pkg,
+ "src_ver" : src_ver}
+ try:
+ # Check if the download was canceled
+ if cancel_lock and cancel_lock.isSet(): return ""
+ changelog_file = urllib2.urlopen(uri)
+ # do only get the lines that are new
+ changelog = ""
+ regexp = "^%s \((.*)\)(.*)$" % (re.escape(src_pkg))
+
+ i=0
+ while True:
+ # Check if the download was canceled
+ if cancel_lock and cancel_lock.isSet(): return ""
+ # Read changelog line by line
+ line_raw = changelog_file.readline()
+ if line_raw == "":
+ break
+ # The changelog is encoded in utf-8, but since there isn't any
+ # http header, urllib2 seems to treat it as ascii
+ line = line_raw.decode("utf-8")
+
+ #print line.encode('utf-8')
+ match = re.match(regexp, line)
+ if match:
+ # strip epoch from installed version
+ # and from changelog too
+ installed = pkg.installedVersion
+ if installed and ":" in installed:
+ installed = installed.split(":",1)[1]
+ changelog_ver = match.group(1)
+ if changelog_ver and ":" in changelog_ver:
+ changelog_ver = changelog_ver.split(":", 1)[1]
+ if installed and \
+ apt_pkg.VersionCompare(changelog_ver, installed) <= 0:
+ break
+ # EOF (shouldn't really happen)
+ changelog += line
+
+ # Print an error if we failed to extract a changelog
+ if len(changelog) == 0:
+ changelog = "The list of changes is not available"
+ except urllib2.HTTPError,e:
+ return "The list of changes is not available yet.\n\n" \
+ "Please use http://launchpad.net/ubuntu/+source/%s/%s/" \
+ "+changelog\n" \
+ "until the changes become available or try again " \
+ "later." % (srcpkg, srcver),
+ except IOError, httplib.BadStatusLine:
+ return "Failed to download the list of changes.\nPlease " \
+ "check your Internet connection."
+ return changelog
+
def takeover():
"""
Exit the currently running backend
More information about the PackageKit-commit
mailing list