[PackageKit-commit] packagekit: Branch 'master' - 200 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Thu Nov 10 11:46:35 PST 2011
Makefile.am | 9
NEWS | 167
RELEASE | 12
backends/Makefile.am | 8
backends/apt/20packagekit | 12
backends/apt/HACKING.apt | 5
backends/apt/Makefile.am | 37
backends/apt/README.apt | 23
backends/apt/TODO.apt | 27
backends/apt/aptBackend.py | 2245 ------
backends/apt/data/Packages | 71
backends/apt/data/status | 38
backends/apt/data/xterm.list | 49
backends/apt/hotshot-analyze.py | 39
backends/apt/packagekit | 1
backends/apt/pk-backend-apt.c | 598 -
backends/apt/profiler.py | 40
backends/apt/test.sh | 2
backends/apt/tests.py | 155
backends/apt/update-packagekit-app-data | 86
backends/aptcc/apt-utils.cpp | 11
backends/aptcc/apt.cpp | 133
backends/aptcc/apt.h | 10
backends/aptcc/get-distro-upgrade.py | 4
backends/aptcc/gstMatcher.cpp | 4
backends/aptcc/pk-backend-aptcc.cpp | 29
backends/dummy/pk-backend-dummy.c | 27
backends/entropy/entropyBackend.py | 82
backends/entropy/pk-backend-entropy.c | 260
backends/portage/pk-backend-portage.c | 222
backends/ports/pk-backend-ports.c | 209
backends/ports/portsBackend.rb | 120
backends/ports/ruby_packagekit/Makefile.am | 1
backends/ports/ruby_packagekit/backend.rb | 138
backends/ports/ruby_packagekit/enums.rb | 164
backends/razor/Makefile.am | 13
backends/razor/pk-backend-razor.c | 439 -
backends/slapt/pk-backend-slapt.c | 312
backends/smart/pk-backend-smart.c | 256
backends/smart/smartBackend.py | 104
backends/yum/TODO | 109
backends/yum/licenses.txt | 25
backends/yum/yum-api-search.txt | 87
backends/yum/yumBackend.py | 35
backends/zif/pk-backend-zif.c | 399 -
backends/zypp/Makefile.am | 3
backends/zypp/pk-backend-zypp-private.h | 24
backends/zypp/pk-backend-zypp.cpp | 63
backends/zypp/zypp-utils.cpp | 28
backends/zypp/zypp-utils.h | 5
client/egg-string.c | 1
client/egg-string.h | 1
client/pk-console.c | 7
configure.ac | 148
contrib/PackageKit.spec.in | 33
contrib/browser-plugin/Makefile.am | 3
contrib/browser-plugin/pk-main.c | 85
contrib/browser-plugin/pk-main.h | 51
contrib/browser-plugin/pk-plugin-install.c | 188
contrib/browser-plugin/pk-plugin.c | 23
contrib/command-not-found/Makefile.am | 4
contrib/command-not-found/egg-string.c | 1
contrib/command-not-found/egg-string.h | 1
contrib/command-not-found/pk-command-not-found.c | 10
contrib/debuginfo-install/Makefile.am | 2
contrib/gstreamer-plugin/pk-gstreamer-install.c | 56
contrib/gtk-module/Makefile.am | 26
contrib/gtk-module/gtk-2.0/Makefile.am | 12
contrib/gtk-module/gtk-3.0/Makefile.am | 18
contrib/gtk-module/org.gnome.setttings-daemon.gtk-modules-packagekit.gschema.xml | 12
contrib/gtk-module/pk-gtk-module.c | 86
contrib/gtk-module/pk-gtk-module.desktop | 4
contrib/pk-plugin-external.c | 145
docs/html/pk-bugs.html | 17
docs/html/pk-download.html | 32
docs/html/pk-matrix.html | 14
docs/provides-component-naming.txt | 44
lib/Makefile.am | 4
lib/packagekit-glib2/Makefile.am | 2
lib/packagekit-glib2/pk-client.c | 15
lib/packagekit-glib2/pk-console-shared.c | 133
lib/packagekit-glib2/pk-control.c | 8
lib/packagekit-glib2/pk-enum.c | 232
lib/packagekit-glib2/pk-enum.h | 240
lib/packagekit-glib2/pk-progress-bar.c | 2
lib/packagekit-glib2/pk-progress.c | 67
lib/packagekit-glib2/pk-progress.h | 4
lib/packagekit-glib2/pk-self-test.c | 17
lib/packagekit-glib2/pk-service-pack.c | 17
lib/packagekit-glib2/pk-task-text.c | 5
lib/packagekit-glib2/pk-task.c | 54
lib/packagekit-qt/Doxyfile | 1258 ---
lib/packagekit-qt/Makefile.am | 13
lib/packagekit-qt/modules/FindQPackageKit.cmake | 40
lib/packagekit-qt/modules/Makefile.am | 10
lib/packagekit-qt/packagekit-qt.pc.in | 12
lib/packagekit-qt/src/Makefile.am | 118
lib/packagekit-qt/src/QPackageKit | 3
lib/packagekit-qt/src/bitfield.cpp | 70
lib/packagekit-qt/src/bitfield.h | 31
lib/packagekit-qt/src/client.cpp | 587 -
lib/packagekit-qt/src/client.h | 663 -
lib/packagekit-qt/src/clientprivate.cpp | 90
lib/packagekit-qt/src/clientprivate.h | 64
lib/packagekit-qt/src/common.h | 36
lib/packagekit-qt/src/enum.cpp | 23
lib/packagekit-qt/src/enum.h | 621 -
lib/packagekit-qt/src/package.cpp | 231
lib/packagekit-qt/src/package.h | 176
lib/packagekit-qt/src/transaction.cpp | 614 -
lib/packagekit-qt/src/transaction.h | 669 -
lib/packagekit-qt/src/transactionprivate.cpp | 160
lib/packagekit-qt/src/transactionprivate.h | 84
lib/packagekit-qt/src/util.cpp | 74
lib/packagekit-qt/src/util.h | 162
lib/packagekit-qt/test/Makefile.am | 67
lib/packagekit-qt/test/daemontest.cpp | 43
lib/packagekit-qt/test/daemontest.h | 33
lib/packagekit-qt/test/main.cpp | 23
lib/packagekit-qt/test/transactiontest.cpp | 139
lib/packagekit-qt/test/transactiontest.h | 48
lib/packagekit-qt2/Makefile.am | 2
lib/packagekit-qt2/modules/FindPackageKitQt2.cmake | 40
lib/packagekit-qt2/modules/Makefile.am | 13
lib/packagekit-qt2/modules/packagekit-qt2-config-version.cmake.in | 12
lib/packagekit-qt2/modules/packagekit-qt2-config.cmake.in | 11
lib/python/enum-convertor.py | 15
lib/python/packagekit/Makefile.am | 7
lib/python/packagekit/backend.py | 116
lib/python/packagekit/client.py | 481 -
lib/python/packagekit/filter.py | 4
lib/python/packagekit/frontend.py | 628 -
lib/python/packagekit/misc.py | 86
lib/python/packagekit/package.py | 4
lib/python/packagekit/pkdbus.py | 60
lib/python/packagekit/pkexceptions.py | 58
lib/python/pk-frontend-test.py | 166
lib/python/wrapper-test.py | 140
po/ar.po | 139
po/bg_BG.po | 139
po/ca at valencia.po | 139
po/cs.po | 199
po/fa_IR.po | 139
po/ga.po | 41
po/gl.po | 54
po/id.po | 145
po/kk.po | 139
po/pa.po | 48
po/ru.po | 155
po/sk.po | 182
po/sv.po | 145
po/wa.po | 139
po/zh_TW.po | 58
src/Makefile.am | 140
src/egg-dbus-monitor.c | 285
src/egg-dbus-monitor.h | 70
src/egg-string.c | 251
src/egg-string.h | 50
src/org.freedesktop.PackageKit.Transaction.xml | 34
src/packagekit-plugin.h | 40
src/pk-backend-spawn.c | 182
src/pk-backend.c | 493 -
src/pk-backend.h | 80
src/pk-conf.c | 2
src/pk-dbus.c | 139
src/pk-engine.c | 1284 +--
src/pk-engine.h | 39
src/pk-file-monitor.c | 177
src/pk-file-monitor.h | 57
src/pk-inhibit.c | 290
src/pk-inhibit.h | 61
src/pk-lsof.c | 332
src/pk-lsof.h | 59
src/pk-main.c | 140
src/pk-network-stack-connman.c | 138
src/pk-network-stack-nm.c | 300
src/pk-network-stack-unix.c | 45
src/pk-network-stack.h | 1
src/pk-network.c | 1
src/pk-notify.c | 3
src/pk-plugin.h | 78
src/pk-proc.c | 342
src/pk-proc.h | 63
src/pk-self-test.c | 321
src/pk-shared.c | 167
src/pk-shared.h | 17
src/pk-spawn.c | 46
src/pk-store.c | 2
src/pk-transaction-db.c | 14
src/pk-transaction-extra.c | 1293 ---
src/pk-transaction-extra.h | 69
src/pk-transaction-list.c | 71
src/pk-transaction-list.h | 2
src/pk-transaction-private.h | 52
src/pk-transaction.c | 3692 ++++------
src/pk-transaction.h | 197
src/plugins/Makefile.am | 116
src/plugins/packagekit-plugin.pc.in | 12
src/plugins/pk-lsof.c | 359
src/plugins/pk-lsof.h | 59
src/plugins/pk-plugin-check-shared-libraries-in-use.c | 576 +
src/plugins/pk-plugin-clear-firmware-requests.c | 60
src/plugins/pk-plugin-example.c | 125
src/plugins/pk-plugin-no-update-process.c | 243
src/plugins/pk-plugin-scan-desktop-files.c | 687 +
src/plugins/pk-plugin-scripts.c | 160
src/plugins/pk-plugin-update-check-processes.c | 219
src/plugins/pk-plugin-update-package-list.c | 201
src/plugins/pk-proc.c | 362
src/plugins/pk-proc.h | 63
src/plugins/pk-self-test.c | 120
src/run-pk.sh | 2
tools/pk-refresh-licenses.c | 44
213 files changed, 10925 insertions(+), 22232 deletions(-)
New commits:
commit 4dfdfa4800fddb5f6eccd47852922f0ff10f41c9
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Nov 10 19:45:39 2011 +0000
Release version 0.7.1
diff --git a/NEWS b/NEWS
index ab94fbd..65963bc 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,79 @@
+Version 0.7.1
+~~~~~~~~~~~~~
+Released: 2011-11-10
+
+Libraries:
+ - qt2: Remove old Find* macro (Matthias Klumpp)
+ - qt2: Really do not distribute moc files (Vincent Untz)
+ - qt: Drop packagekit-qt1 which is obsolete in favor of packagekit-qt2 (Daniel Nicoletti)
+
+Backends:
+ - aptcc: Don't wrap sys.stdout with codecs.getwriter(...) (Nils Philippsen)
+ - dummy: Make sure we don't ask for eula or repo signatures while simulating (Daniel Nicoletti)
+ - entropy: Add forward compatibility with upcoming API changes (Fabio Erculiani)
+ - entropy: Drop PK_BACKEND_OPTIONS macro usage (Fabio Erculiani)
+ - entropy: Update entropy library path (Fabio Erculiani)
+ - portage: Drop PK_BACKEND_OPTIONS macro usage (Fabio Erculiani)
+ - ports: Remove the vfuncs table (Anders F Bjorklund)
+ - python: Add initial Python3 compatibility (keeping Python2.7 support) (Fabio Erculiani)
+ - python: Implement and use utf8 stream writer for stdout, stderr (Nils Philippsen)
+ - python: Require at least Python 2.7 (in configure.ac) (Fabio Erculiani)
+ - python: Update exception code syntax, make it work with both Python2 and Python3 (Fabio Erculiani)
+ - python: Use print() as function (Fabio Erculiani)
+ - slapt: Implement the simulate methods (Anders F Bjorklund)
+ - slapt: Remove the vfuncs table (Anders F Bjorklund)
+ - smart: Don't wrap sys.stdout with codecs.getwriter(...) (Nils Philippsen)
+ - smart: Implement the simulate methods (Anders F Bjorklund)
+ - smart: Make sure that data=installed is honored (Anders F Bjorklund)
+ - smart: Remove the vfuncs table (Anders F Bjorklund)
+ - yum: Add ourselves to YumBase.run_with_package_names (Nils Philippsen)
+ - yum: Cope with missing YumBase.run_with_package_names (Nils Philippsen)
+ - yum: Don't let yum.misc.setup_locale() override stdout codec (Nils Philippsen)
+ - zif: Add an unhandled ZifStateAction mapping (Richard Hughes)
+ - zif: Add support for the latest status and transaction enum values (Richard Hughes)
+ - zif: Always show the update metadata if available by using the correct repo (Richard Hughes)
+ - zif: Do not always ask for untrusted authentication for trusted repos (Richard Hughes)
+ - zif: Do not report packages as installable if they are already installed (Richard Hughes)
+ - zif: Don't call zif_init() in newer versions of the library (Richard Hughes)
+ - zif: Don't try to map error domains that are no longer exported (Richard Hughes)
+ - zif: Don't use zif_package_get_package_id() (Richard Hughes)
+ - zif: Enable globbing for Resolve() (Richard Hughes)
+ - zif: Ensure the downloading status is set correctly (Richard Hughes)
+ - zif: Fix a critical warning when using WhatProvides (Richard Hughes)
+ - zif: Include zif-private.h for very new versions of zif (Richard Hughes)
+ - zif: Prefer native packages when resolving user input (Richard Hughes)
+ - zif: Refresh the cache rather than just cleaning it for RefreshCache (Richard Hughes)
+ - zif: Save the effective user ID and command line (Richard Hughes)
+ - zif: Use zif_store_array_resolve_full() when possible (Richard Hughes)
+ - zif: Use zif_transaction_commit_full() to be able to install untrusted packages (Richard Hughes)
+ - zif: When the transaction has no thing to do, use the correct PK error code enum (Richard Hughes)
+ - zypp: Dont call build pool inside the loop (Duncan Mac-Vicar P)
+ - zypp: Only load repositories once (Duncan Mac-Vicar P)
+ - zypp: Refactor the private static data into one structure (Duncan Mac-Vicar P)
+
+New Features:
+ - Add command line option to keep environment (Nils Philippsen)
+ - Add Introspection support for PK-Plugins (Matthias Klumpp)
+ - Add possibility for backends/plugins to skip transactions (Matthias Klumpp)
+ - Add 'uid' and 'cmdline' properties to PkBackend (Richard Hughes)
+ - Use the new g_thread_new() for new versions of GLib (Richard Hughes)
+
+Bugfixes:
+ - Check if a transaction should be skipped after it has started too (Matthias Klumpp)
+ - Don't use the deprecated g_thread_supported() in the dameon code (Richard Hughes)
+ - Finalize PackageKitPlugin GIR file (Matthias Klumpp)
+ - Find uninstalled PackageKitGlib-1.0.gir when building (Nils Philippsen)
+ - Fix the role of the EULA transaction (Daniel Nicoletti)
+ - Make PK compile on GNU Hurd (Matthias Klumpp)
+ - Move the gtk-module extra files to the PK tarball (Richard Hughes)
+ - Offset the cache age by 30 minutes (Richard Hughes)
+ - plugin: Add a few GIR annotations (Matthias Klumpp)
+ - Remove the implemented checks for the simulate methods (Richard Hughes)
+ - Require exactly 'y<enter>' or 'yes<enter>' before running a transaction (Richard Hughes)
+ - Use the newest filter when resolving for new packages to install (Richard Hughes)
+ - website: Fix broken link to gdb docs (Milan Bouchet-Valat)
+ - website: Improve links to bug trackers (Milan Bouchet-Valat)
+
Version 0.7.0
~~~~~~~~~~~~~
Released: 2011-09-05
diff --git a/configure.ac b/configure.ac
index 7873d77..3699c86 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,7 +45,7 @@ AC_SUBST(PK_VERSION)
# AGE If libpackagekit can be linked into executables which can be
# built with previous versions of this library. Don't use.
LT_CURRENT=14
-LT_REVISION=9
+LT_REVISION=10
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
diff --git a/docs/html/pk-download.html b/docs/html/pk-download.html
index d3396aa..d8ce101 100644
--- a/docs/html/pk-download.html
+++ b/docs/html/pk-download.html
@@ -72,6 +72,7 @@ Releases are normally on the first working Monday of each month.
</p>
<table>
<tr><td><b>Version</b></td><td> </td><td><b>Date</b></td></tr>
+<tr><td>0.7.1</td><td></td><td>2011-11-10</td></tr>
<tr><td>0.7.0</td><td></td><td>2011-09-05</td></tr>
</table>
<h3>
diff --git a/po/ar.po b/po/ar.po
index 71d227c..c14a512 100644
--- a/po/ar.po
+++ b/po/ar.po
@@ -2,12 +2,13 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-08-01 10:58+0100\n"
-"PO-Revision-Date: 2011-09-05 15:42+0000\n"
+"POT-Creation-Date: 2011-09-05 16:58+0100\n"
+"PO-Revision-Date: 2010-12-13 12:37+0000\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: Arabic (http://www.transifex.net/projects/p/freedesktop/team/ar/)\n"
"MIME-Version: 1.0\n"
@@ -284,7 +285,7 @@ msgstr ""
#. TRANSLATORS: the transaction failed in a way we could not expect
#: ../client/pk-console.c:704
-#: ../contrib/command-not-found/pk-command-not-found.c:639
+#: ../contrib/command-not-found/pk-command-not-found.c:634
msgid "The transaction failed"
msgstr ""
@@ -710,154 +711,154 @@ msgid "PackageKit Monitor"
msgstr ""
#. TRANSLATORS: when we are getting data from the daemon
-#: ../contrib/browser-plugin/pk-plugin-install.c:499
+#: ../contrib/browser-plugin/pk-plugin-install.c:503
msgid "Getting package information..."
msgstr ""
#. TRANSLATORS: run an applicaiton
-#: ../contrib/browser-plugin/pk-plugin-install.c:505
+#: ../contrib/browser-plugin/pk-plugin-install.c:509
#, c-format
msgid "Run %s"
msgstr ""
#. TRANSLATORS: show the installed version of a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:511
+#: ../contrib/browser-plugin/pk-plugin-install.c:515
msgid "Installed version"
msgstr ""
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:519
+#: ../contrib/browser-plugin/pk-plugin-install.c:523
#, c-format
msgid "Run version %s now"
msgstr ""
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:525
+#: ../contrib/browser-plugin/pk-plugin-install.c:529
msgid "Run now"
msgstr ""
#. TRANSLATORS: update to a new version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:531
+#: ../contrib/browser-plugin/pk-plugin-install.c:535
#, c-format
msgid "Update to version %s"
msgstr ""
#. TRANSLATORS: To install a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:537
+#: ../contrib/browser-plugin/pk-plugin-install.c:541
#, c-format
msgid "Install %s now"
msgstr ""
#. TRANSLATORS: the version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:540
+#: ../contrib/browser-plugin/pk-plugin-install.c:544
msgid "Version"
msgstr ""
#. TRANSLATORS: noting found, so can't install
-#: ../contrib/browser-plugin/pk-plugin-install.c:545
+#: ../contrib/browser-plugin/pk-plugin-install.c:549
msgid "No packages found for your system"
msgstr ""
#. TRANSLATORS: package is being installed
-#: ../contrib/browser-plugin/pk-plugin-install.c:550
+#: ../contrib/browser-plugin/pk-plugin-install.c:554
msgid "Installing..."
msgstr ""
#. TRANSLATORS: downloading repo data so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:366
+#: ../contrib/command-not-found/pk-command-not-found.c:363
msgid "Downloading details about the software sources."
msgstr ""
#. TRANSLATORS: downloading file lists so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:370
+#: ../contrib/command-not-found/pk-command-not-found.c:367
msgid "Downloading filelists (this may take some time to complete)."
msgstr ""
#. TRANSLATORS: waiting for native lock
-#: ../contrib/command-not-found/pk-command-not-found.c:374
+#: ../contrib/command-not-found/pk-command-not-found.c:371
msgid "Waiting for package manager lock."
msgstr ""
#. TRANSLATORS: loading package cache so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:378
+#: ../contrib/command-not-found/pk-command-not-found.c:375
msgid "Loading list of packages."
msgstr ""
#. TRANSLATORS: we failed to find the package, this shouldn't happen
-#: ../contrib/command-not-found/pk-command-not-found.c:444
+#: ../contrib/command-not-found/pk-command-not-found.c:439
msgid "Failed to search for file"
msgstr ""
#. TRANSLATORS: the transaction failed in a way we could not expect
-#: ../contrib/command-not-found/pk-command-not-found.c:456
+#: ../contrib/command-not-found/pk-command-not-found.c:451
msgid "Getting the list of files failed"
msgstr ""
#. TRANSLATORS: we failed to launch the executable, the error follows
-#: ../contrib/command-not-found/pk-command-not-found.c:602
+#: ../contrib/command-not-found/pk-command-not-found.c:597
msgid "Failed to launch:"
msgstr ""
#. TRANSLATORS: we failed to install the package
-#: ../contrib/command-not-found/pk-command-not-found.c:630
+#: ../contrib/command-not-found/pk-command-not-found.c:625
msgid "Failed to install packages"
msgstr ""
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:729
+#: ../contrib/command-not-found/pk-command-not-found.c:723
msgid "command not found"
msgstr ""
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:747
+#: ../contrib/command-not-found/pk-command-not-found.c:741
msgid "Similar command is:"
msgstr ""
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:761
+#: ../contrib/command-not-found/pk-command-not-found.c:755
msgid "Run similar command:"
msgstr ""
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:775
-#: ../contrib/command-not-found/pk-command-not-found.c:784
+#: ../contrib/command-not-found/pk-command-not-found.c:769
+#: ../contrib/command-not-found/pk-command-not-found.c:778
msgid "Similar commands are:"
msgstr ""
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:791
+#: ../contrib/command-not-found/pk-command-not-found.c:785
msgid "Please choose a command to run"
msgstr ""
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:809
+#: ../contrib/command-not-found/pk-command-not-found.c:803
msgid "The package providing this file is:"
msgstr ""
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:816
+#: ../contrib/command-not-found/pk-command-not-found.c:810
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:843
+#: ../contrib/command-not-found/pk-command-not-found.c:837
msgid "Packages providing this file are:"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:853
+#: ../contrib/command-not-found/pk-command-not-found.c:847
msgid "Suitable packages are:"
msgstr ""
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:862
+#: ../contrib/command-not-found/pk-command-not-found.c:856
msgid "Please choose a package to install"
msgstr ""
@@ -1998,96 +1999,63 @@ msgstr ""
msgid "Upgrade System"
msgstr ""
-#. TRANSLATORS: failed due to DBus security
-#: ../src/pk-main.c:91
-msgid "Startup failed due to security policies on this machine."
-msgstr ""
-
-#. TRANSLATORS: only two ways this can fail...
-#: ../src/pk-main.c:93
-msgid "This can happen for two reasons:"
-msgstr ""
-
-#. TRANSLATORS: only allowed to be owned by root
-#: ../src/pk-main.c:95
-msgid "The correct user is not launching the executable (usually root)"
-msgstr ""
-
-#. TRANSLATORS: or we are installed in a prefix
-#: ../src/pk-main.c:97
-msgid ""
-"The org.freedesktop.PackageKit.conf file is not installed in the system "
-"directory:"
-msgstr ""
-
#. TRANSLATORS: a backend is the system package tool, e.g. yum, apt
-#: ../src/pk-main.c:223
+#: ../src/pk-main.c:148
msgid "Packaging backend to use, e.g. dummy"
msgstr ""
#. TRANSLATORS: if we should run in the background
-#: ../src/pk-main.c:226
+#: ../src/pk-main.c:151
msgid "Daemonize and detach from the terminal"
msgstr ""
#. TRANSLATORS: if we should not monitor how long we are inactive for
-#: ../src/pk-main.c:229
+#: ../src/pk-main.c:154
msgid "Disable the idle timer"
msgstr ""
#. TRANSLATORS: show version
-#: ../src/pk-main.c:232
+#: ../src/pk-main.c:157
msgid "Show version and exit"
msgstr ""
#. TRANSLATORS: exit after we've started up, used for user profiling
-#: ../src/pk-main.c:235
+#: ../src/pk-main.c:160
msgid "Exit after a small delay"
msgstr ""
#. TRANSLATORS: exit straight away, used for automatic profiling
-#: ../src/pk-main.c:238
+#: ../src/pk-main.c:163
msgid "Exit after the engine has loaded"
msgstr ""
#. TRANSLATORS: describing the service that is running
-#: ../src/pk-main.c:253
+#: ../src/pk-main.c:177
msgid "PackageKit service"
msgstr ""
-#. TRANSLATORS: fatal error, dbus is not running
-#: ../src/pk-main.c:298
-msgid "Cannot connect to the system bus"
-msgstr ""
-
-#: ../src/pk-main.c:344
+#: ../src/pk-main.c:249
msgid "Failed to load any of the specified backends:"
msgstr ""
-#. TRANSLATORS: cannot register on system bus, unknown reason -- geeky error
-#. follows
-#: ../src/pk-main.c:358
-msgid "Error trying to start:"
-msgstr ""
-
#. TRANSLATORS: is not GPG signed
-#: ../src/pk-transaction.c:2611 ../src/pk-transaction.c:2618
+#: ../src/pk-transaction.c:2659
msgid "The software is not from a trusted source."
msgstr ""
-#: ../src/pk-transaction.c:2623
+#: ../src/pk-transaction.c:2667
msgid "Do not update this package unless you are sure it is safe to do so."
msgstr ""
-#: ../src/pk-transaction.c:2624
+#: ../src/pk-transaction.c:2668
msgid "Do not update these packages unless you are sure it is safe to do so."
msgstr ""
-#: ../src/pk-transaction.c:2634
+#: ../src/pk-transaction.c:2678
msgid "Do not install this package unless you are sure it is safe to do so."
msgstr ""
-#: ../src/pk-transaction.c:2635
+#: ../src/pk-transaction.c:2679
msgid "Do not install these packages unless you are sure it is safe to do so."
msgstr ""
diff --git a/po/bg_BG.po b/po/bg_BG.po
index 51fbde8..2968dbf 100644
--- a/po/bg_BG.po
+++ b/po/bg_BG.po
@@ -2,12 +2,13 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-08-01 10:58+0100\n"
-"PO-Revision-Date: 2011-09-05 15:41+0000\n"
+"POT-Creation-Date: 2011-09-05 16:58+0100\n"
+"PO-Revision-Date: 2010-12-13 12:37+0000\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: Bulgarian (Bulgaria) (http://www.transifex.net/projects/p/freedesktop/team/bg_BG/)\n"
"MIME-Version: 1.0\n"
@@ -284,7 +285,7 @@ msgstr ""
#. TRANSLATORS: the transaction failed in a way we could not expect
#: ../client/pk-console.c:704
-#: ../contrib/command-not-found/pk-command-not-found.c:639
+#: ../contrib/command-not-found/pk-command-not-found.c:634
msgid "The transaction failed"
msgstr ""
@@ -710,154 +711,154 @@ msgid "PackageKit Monitor"
msgstr ""
#. TRANSLATORS: when we are getting data from the daemon
-#: ../contrib/browser-plugin/pk-plugin-install.c:499
+#: ../contrib/browser-plugin/pk-plugin-install.c:503
msgid "Getting package information..."
msgstr ""
#. TRANSLATORS: run an applicaiton
-#: ../contrib/browser-plugin/pk-plugin-install.c:505
+#: ../contrib/browser-plugin/pk-plugin-install.c:509
#, c-format
msgid "Run %s"
msgstr ""
#. TRANSLATORS: show the installed version of a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:511
+#: ../contrib/browser-plugin/pk-plugin-install.c:515
msgid "Installed version"
msgstr ""
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:519
+#: ../contrib/browser-plugin/pk-plugin-install.c:523
#, c-format
msgid "Run version %s now"
msgstr ""
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:525
+#: ../contrib/browser-plugin/pk-plugin-install.c:529
msgid "Run now"
msgstr ""
#. TRANSLATORS: update to a new version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:531
+#: ../contrib/browser-plugin/pk-plugin-install.c:535
#, c-format
msgid "Update to version %s"
msgstr ""
#. TRANSLATORS: To install a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:537
+#: ../contrib/browser-plugin/pk-plugin-install.c:541
#, c-format
msgid "Install %s now"
msgstr ""
#. TRANSLATORS: the version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:540
+#: ../contrib/browser-plugin/pk-plugin-install.c:544
msgid "Version"
msgstr ""
#. TRANSLATORS: noting found, so can't install
-#: ../contrib/browser-plugin/pk-plugin-install.c:545
+#: ../contrib/browser-plugin/pk-plugin-install.c:549
msgid "No packages found for your system"
msgstr ""
#. TRANSLATORS: package is being installed
-#: ../contrib/browser-plugin/pk-plugin-install.c:550
+#: ../contrib/browser-plugin/pk-plugin-install.c:554
msgid "Installing..."
msgstr ""
#. TRANSLATORS: downloading repo data so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:366
+#: ../contrib/command-not-found/pk-command-not-found.c:363
msgid "Downloading details about the software sources."
msgstr ""
#. TRANSLATORS: downloading file lists so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:370
+#: ../contrib/command-not-found/pk-command-not-found.c:367
msgid "Downloading filelists (this may take some time to complete)."
msgstr ""
#. TRANSLATORS: waiting for native lock
-#: ../contrib/command-not-found/pk-command-not-found.c:374
+#: ../contrib/command-not-found/pk-command-not-found.c:371
msgid "Waiting for package manager lock."
msgstr ""
#. TRANSLATORS: loading package cache so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:378
+#: ../contrib/command-not-found/pk-command-not-found.c:375
msgid "Loading list of packages."
msgstr ""
#. TRANSLATORS: we failed to find the package, this shouldn't happen
-#: ../contrib/command-not-found/pk-command-not-found.c:444
+#: ../contrib/command-not-found/pk-command-not-found.c:439
msgid "Failed to search for file"
msgstr ""
#. TRANSLATORS: the transaction failed in a way we could not expect
-#: ../contrib/command-not-found/pk-command-not-found.c:456
+#: ../contrib/command-not-found/pk-command-not-found.c:451
msgid "Getting the list of files failed"
msgstr ""
#. TRANSLATORS: we failed to launch the executable, the error follows
-#: ../contrib/command-not-found/pk-command-not-found.c:602
+#: ../contrib/command-not-found/pk-command-not-found.c:597
msgid "Failed to launch:"
msgstr ""
#. TRANSLATORS: we failed to install the package
-#: ../contrib/command-not-found/pk-command-not-found.c:630
+#: ../contrib/command-not-found/pk-command-not-found.c:625
msgid "Failed to install packages"
msgstr ""
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:729
+#: ../contrib/command-not-found/pk-command-not-found.c:723
msgid "command not found"
msgstr ""
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:747
+#: ../contrib/command-not-found/pk-command-not-found.c:741
msgid "Similar command is:"
msgstr ""
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:761
+#: ../contrib/command-not-found/pk-command-not-found.c:755
msgid "Run similar command:"
msgstr ""
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:775
-#: ../contrib/command-not-found/pk-command-not-found.c:784
+#: ../contrib/command-not-found/pk-command-not-found.c:769
+#: ../contrib/command-not-found/pk-command-not-found.c:778
msgid "Similar commands are:"
msgstr ""
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:791
+#: ../contrib/command-not-found/pk-command-not-found.c:785
msgid "Please choose a command to run"
msgstr ""
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:809
+#: ../contrib/command-not-found/pk-command-not-found.c:803
msgid "The package providing this file is:"
msgstr ""
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:816
+#: ../contrib/command-not-found/pk-command-not-found.c:810
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:843
+#: ../contrib/command-not-found/pk-command-not-found.c:837
msgid "Packages providing this file are:"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:853
+#: ../contrib/command-not-found/pk-command-not-found.c:847
msgid "Suitable packages are:"
msgstr ""
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:862
+#: ../contrib/command-not-found/pk-command-not-found.c:856
msgid "Please choose a package to install"
msgstr ""
@@ -1998,96 +1999,63 @@ msgstr ""
msgid "Upgrade System"
msgstr ""
-#. TRANSLATORS: failed due to DBus security
-#: ../src/pk-main.c:91
-msgid "Startup failed due to security policies on this machine."
-msgstr ""
-
-#. TRANSLATORS: only two ways this can fail...
-#: ../src/pk-main.c:93
-msgid "This can happen for two reasons:"
-msgstr ""
-
-#. TRANSLATORS: only allowed to be owned by root
-#: ../src/pk-main.c:95
-msgid "The correct user is not launching the executable (usually root)"
-msgstr ""
-
-#. TRANSLATORS: or we are installed in a prefix
-#: ../src/pk-main.c:97
-msgid ""
-"The org.freedesktop.PackageKit.conf file is not installed in the system "
-"directory:"
-msgstr ""
-
#. TRANSLATORS: a backend is the system package tool, e.g. yum, apt
-#: ../src/pk-main.c:223
+#: ../src/pk-main.c:148
msgid "Packaging backend to use, e.g. dummy"
msgstr ""
#. TRANSLATORS: if we should run in the background
-#: ../src/pk-main.c:226
+#: ../src/pk-main.c:151
msgid "Daemonize and detach from the terminal"
msgstr ""
#. TRANSLATORS: if we should not monitor how long we are inactive for
-#: ../src/pk-main.c:229
+#: ../src/pk-main.c:154
msgid "Disable the idle timer"
msgstr ""
#. TRANSLATORS: show version
-#: ../src/pk-main.c:232
+#: ../src/pk-main.c:157
msgid "Show version and exit"
msgstr ""
#. TRANSLATORS: exit after we've started up, used for user profiling
-#: ../src/pk-main.c:235
+#: ../src/pk-main.c:160
msgid "Exit after a small delay"
msgstr ""
#. TRANSLATORS: exit straight away, used for automatic profiling
-#: ../src/pk-main.c:238
+#: ../src/pk-main.c:163
msgid "Exit after the engine has loaded"
msgstr ""
#. TRANSLATORS: describing the service that is running
-#: ../src/pk-main.c:253
+#: ../src/pk-main.c:177
msgid "PackageKit service"
msgstr ""
-#. TRANSLATORS: fatal error, dbus is not running
-#: ../src/pk-main.c:298
-msgid "Cannot connect to the system bus"
-msgstr ""
-
-#: ../src/pk-main.c:344
+#: ../src/pk-main.c:249
msgid "Failed to load any of the specified backends:"
msgstr ""
-#. TRANSLATORS: cannot register on system bus, unknown reason -- geeky error
-#. follows
-#: ../src/pk-main.c:358
-msgid "Error trying to start:"
-msgstr ""
-
#. TRANSLATORS: is not GPG signed
-#: ../src/pk-transaction.c:2611 ../src/pk-transaction.c:2618
+#: ../src/pk-transaction.c:2659
msgid "The software is not from a trusted source."
msgstr ""
-#: ../src/pk-transaction.c:2623
+#: ../src/pk-transaction.c:2667
msgid "Do not update this package unless you are sure it is safe to do so."
msgstr ""
-#: ../src/pk-transaction.c:2624
+#: ../src/pk-transaction.c:2668
msgid "Do not update these packages unless you are sure it is safe to do so."
msgstr ""
-#: ../src/pk-transaction.c:2634
+#: ../src/pk-transaction.c:2678
msgid "Do not install this package unless you are sure it is safe to do so."
msgstr ""
-#: ../src/pk-transaction.c:2635
+#: ../src/pk-transaction.c:2679
msgid "Do not install these packages unless you are sure it is safe to do so."
msgstr ""
diff --git a/po/ca at valencia.po b/po/ca at valencia.po
index ee6a0f4..087ee5e 100644
--- a/po/ca at valencia.po
+++ b/po/ca at valencia.po
@@ -2,12 +2,13 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-08-01 10:58+0100\n"
-"PO-Revision-Date: 2011-09-05 15:42+0000\n"
+"POT-Creation-Date: 2011-09-05 16:58+0100\n"
+"PO-Revision-Date: 2010-12-13 12:37+0000\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: Catalan (Valencian) (http://www.transifex.net/projects/p/freedesktop/team/ca@valencia/)\n"
"MIME-Version: 1.0\n"
@@ -284,7 +285,7 @@ msgstr ""
#. TRANSLATORS: the transaction failed in a way we could not expect
#: ../client/pk-console.c:704
-#: ../contrib/command-not-found/pk-command-not-found.c:639
+#: ../contrib/command-not-found/pk-command-not-found.c:634
msgid "The transaction failed"
msgstr ""
@@ -710,154 +711,154 @@ msgid "PackageKit Monitor"
msgstr ""
#. TRANSLATORS: when we are getting data from the daemon
-#: ../contrib/browser-plugin/pk-plugin-install.c:499
+#: ../contrib/browser-plugin/pk-plugin-install.c:503
msgid "Getting package information..."
msgstr ""
#. TRANSLATORS: run an applicaiton
-#: ../contrib/browser-plugin/pk-plugin-install.c:505
+#: ../contrib/browser-plugin/pk-plugin-install.c:509
#, c-format
msgid "Run %s"
msgstr ""
#. TRANSLATORS: show the installed version of a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:511
+#: ../contrib/browser-plugin/pk-plugin-install.c:515
msgid "Installed version"
msgstr ""
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:519
+#: ../contrib/browser-plugin/pk-plugin-install.c:523
#, c-format
msgid "Run version %s now"
msgstr ""
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:525
+#: ../contrib/browser-plugin/pk-plugin-install.c:529
msgid "Run now"
msgstr ""
#. TRANSLATORS: update to a new version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:531
+#: ../contrib/browser-plugin/pk-plugin-install.c:535
#, c-format
msgid "Update to version %s"
msgstr ""
#. TRANSLATORS: To install a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:537
+#: ../contrib/browser-plugin/pk-plugin-install.c:541
#, c-format
msgid "Install %s now"
msgstr ""
#. TRANSLATORS: the version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:540
+#: ../contrib/browser-plugin/pk-plugin-install.c:544
msgid "Version"
msgstr ""
#. TRANSLATORS: noting found, so can't install
-#: ../contrib/browser-plugin/pk-plugin-install.c:545
+#: ../contrib/browser-plugin/pk-plugin-install.c:549
msgid "No packages found for your system"
msgstr ""
#. TRANSLATORS: package is being installed
-#: ../contrib/browser-plugin/pk-plugin-install.c:550
+#: ../contrib/browser-plugin/pk-plugin-install.c:554
msgid "Installing..."
msgstr ""
#. TRANSLATORS: downloading repo data so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:366
+#: ../contrib/command-not-found/pk-command-not-found.c:363
msgid "Downloading details about the software sources."
msgstr ""
#. TRANSLATORS: downloading file lists so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:370
+#: ../contrib/command-not-found/pk-command-not-found.c:367
msgid "Downloading filelists (this may take some time to complete)."
msgstr ""
#. TRANSLATORS: waiting for native lock
-#: ../contrib/command-not-found/pk-command-not-found.c:374
+#: ../contrib/command-not-found/pk-command-not-found.c:371
msgid "Waiting for package manager lock."
msgstr ""
#. TRANSLATORS: loading package cache so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:378
+#: ../contrib/command-not-found/pk-command-not-found.c:375
msgid "Loading list of packages."
msgstr ""
#. TRANSLATORS: we failed to find the package, this shouldn't happen
-#: ../contrib/command-not-found/pk-command-not-found.c:444
+#: ../contrib/command-not-found/pk-command-not-found.c:439
msgid "Failed to search for file"
msgstr ""
#. TRANSLATORS: the transaction failed in a way we could not expect
-#: ../contrib/command-not-found/pk-command-not-found.c:456
+#: ../contrib/command-not-found/pk-command-not-found.c:451
msgid "Getting the list of files failed"
msgstr ""
#. TRANSLATORS: we failed to launch the executable, the error follows
-#: ../contrib/command-not-found/pk-command-not-found.c:602
+#: ../contrib/command-not-found/pk-command-not-found.c:597
msgid "Failed to launch:"
msgstr ""
#. TRANSLATORS: we failed to install the package
-#: ../contrib/command-not-found/pk-command-not-found.c:630
+#: ../contrib/command-not-found/pk-command-not-found.c:625
msgid "Failed to install packages"
msgstr ""
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:729
+#: ../contrib/command-not-found/pk-command-not-found.c:723
msgid "command not found"
msgstr ""
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:747
+#: ../contrib/command-not-found/pk-command-not-found.c:741
msgid "Similar command is:"
msgstr ""
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:761
+#: ../contrib/command-not-found/pk-command-not-found.c:755
msgid "Run similar command:"
msgstr ""
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:775
-#: ../contrib/command-not-found/pk-command-not-found.c:784
+#: ../contrib/command-not-found/pk-command-not-found.c:769
+#: ../contrib/command-not-found/pk-command-not-found.c:778
msgid "Similar commands are:"
msgstr ""
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:791
+#: ../contrib/command-not-found/pk-command-not-found.c:785
msgid "Please choose a command to run"
msgstr ""
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:809
+#: ../contrib/command-not-found/pk-command-not-found.c:803
msgid "The package providing this file is:"
msgstr ""
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:816
+#: ../contrib/command-not-found/pk-command-not-found.c:810
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:843
+#: ../contrib/command-not-found/pk-command-not-found.c:837
msgid "Packages providing this file are:"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:853
+#: ../contrib/command-not-found/pk-command-not-found.c:847
msgid "Suitable packages are:"
msgstr ""
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:862
+#: ../contrib/command-not-found/pk-command-not-found.c:856
msgid "Please choose a package to install"
msgstr ""
@@ -1998,96 +1999,63 @@ msgstr ""
msgid "Upgrade System"
msgstr ""
-#. TRANSLATORS: failed due to DBus security
-#: ../src/pk-main.c:91
-msgid "Startup failed due to security policies on this machine."
-msgstr ""
-
-#. TRANSLATORS: only two ways this can fail...
-#: ../src/pk-main.c:93
-msgid "This can happen for two reasons:"
-msgstr ""
-
-#. TRANSLATORS: only allowed to be owned by root
-#: ../src/pk-main.c:95
-msgid "The correct user is not launching the executable (usually root)"
-msgstr ""
-
-#. TRANSLATORS: or we are installed in a prefix
-#: ../src/pk-main.c:97
-msgid ""
-"The org.freedesktop.PackageKit.conf file is not installed in the system "
-"directory:"
-msgstr ""
-
#. TRANSLATORS: a backend is the system package tool, e.g. yum, apt
-#: ../src/pk-main.c:223
+#: ../src/pk-main.c:148
msgid "Packaging backend to use, e.g. dummy"
msgstr ""
#. TRANSLATORS: if we should run in the background
-#: ../src/pk-main.c:226
+#: ../src/pk-main.c:151
msgid "Daemonize and detach from the terminal"
msgstr ""
#. TRANSLATORS: if we should not monitor how long we are inactive for
-#: ../src/pk-main.c:229
+#: ../src/pk-main.c:154
msgid "Disable the idle timer"
msgstr ""
#. TRANSLATORS: show version
-#: ../src/pk-main.c:232
+#: ../src/pk-main.c:157
msgid "Show version and exit"
msgstr ""
#. TRANSLATORS: exit after we've started up, used for user profiling
-#: ../src/pk-main.c:235
+#: ../src/pk-main.c:160
msgid "Exit after a small delay"
msgstr ""
#. TRANSLATORS: exit straight away, used for automatic profiling
-#: ../src/pk-main.c:238
+#: ../src/pk-main.c:163
msgid "Exit after the engine has loaded"
msgstr ""
#. TRANSLATORS: describing the service that is running
-#: ../src/pk-main.c:253
+#: ../src/pk-main.c:177
msgid "PackageKit service"
msgstr ""
-#. TRANSLATORS: fatal error, dbus is not running
-#: ../src/pk-main.c:298
-msgid "Cannot connect to the system bus"
-msgstr ""
-
-#: ../src/pk-main.c:344
+#: ../src/pk-main.c:249
msgid "Failed to load any of the specified backends:"
msgstr ""
-#. TRANSLATORS: cannot register on system bus, unknown reason -- geeky error
-#. follows
-#: ../src/pk-main.c:358
-msgid "Error trying to start:"
-msgstr ""
-
#. TRANSLATORS: is not GPG signed
-#: ../src/pk-transaction.c:2611 ../src/pk-transaction.c:2618
+#: ../src/pk-transaction.c:2659
msgid "The software is not from a trusted source."
msgstr ""
-#: ../src/pk-transaction.c:2623
+#: ../src/pk-transaction.c:2667
msgid "Do not update this package unless you are sure it is safe to do so."
msgstr ""
-#: ../src/pk-transaction.c:2624
+#: ../src/pk-transaction.c:2668
msgid "Do not update these packages unless you are sure it is safe to do so."
msgstr ""
-#: ../src/pk-transaction.c:2634
+#: ../src/pk-transaction.c:2678
msgid "Do not install this package unless you are sure it is safe to do so."
msgstr ""
-#: ../src/pk-transaction.c:2635
+#: ../src/pk-transaction.c:2679
msgid "Do not install these packages unless you are sure it is safe to do so."
msgstr ""
diff --git a/po/fa_IR.po b/po/fa_IR.po
index b834be9..aac95f4 100644
--- a/po/fa_IR.po
+++ b/po/fa_IR.po
@@ -2,12 +2,13 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-08-01 10:58+0100\n"
-"PO-Revision-Date: 2011-09-05 15:42+0000\n"
+"POT-Creation-Date: 2011-09-05 16:58+0100\n"
+"PO-Revision-Date: 2010-12-13 12:37+0000\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: Persian (Iran) (http://www.transifex.net/projects/p/freedesktop/team/fa_IR/)\n"
"MIME-Version: 1.0\n"
@@ -284,7 +285,7 @@ msgstr ""
#. TRANSLATORS: the transaction failed in a way we could not expect
#: ../client/pk-console.c:704
-#: ../contrib/command-not-found/pk-command-not-found.c:639
+#: ../contrib/command-not-found/pk-command-not-found.c:634
msgid "The transaction failed"
msgstr ""
@@ -710,154 +711,154 @@ msgid "PackageKit Monitor"
msgstr ""
#. TRANSLATORS: when we are getting data from the daemon
-#: ../contrib/browser-plugin/pk-plugin-install.c:499
+#: ../contrib/browser-plugin/pk-plugin-install.c:503
msgid "Getting package information..."
msgstr ""
#. TRANSLATORS: run an applicaiton
-#: ../contrib/browser-plugin/pk-plugin-install.c:505
+#: ../contrib/browser-plugin/pk-plugin-install.c:509
#, c-format
msgid "Run %s"
msgstr ""
#. TRANSLATORS: show the installed version of a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:511
+#: ../contrib/browser-plugin/pk-plugin-install.c:515
msgid "Installed version"
msgstr ""
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:519
+#: ../contrib/browser-plugin/pk-plugin-install.c:523
#, c-format
msgid "Run version %s now"
msgstr ""
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:525
+#: ../contrib/browser-plugin/pk-plugin-install.c:529
msgid "Run now"
msgstr ""
#. TRANSLATORS: update to a new version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:531
+#: ../contrib/browser-plugin/pk-plugin-install.c:535
#, c-format
msgid "Update to version %s"
msgstr ""
#. TRANSLATORS: To install a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:537
+#: ../contrib/browser-plugin/pk-plugin-install.c:541
#, c-format
msgid "Install %s now"
msgstr ""
#. TRANSLATORS: the version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:540
+#: ../contrib/browser-plugin/pk-plugin-install.c:544
msgid "Version"
msgstr ""
#. TRANSLATORS: noting found, so can't install
-#: ../contrib/browser-plugin/pk-plugin-install.c:545
+#: ../contrib/browser-plugin/pk-plugin-install.c:549
msgid "No packages found for your system"
msgstr ""
#. TRANSLATORS: package is being installed
-#: ../contrib/browser-plugin/pk-plugin-install.c:550
+#: ../contrib/browser-plugin/pk-plugin-install.c:554
msgid "Installing..."
msgstr ""
#. TRANSLATORS: downloading repo data so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:366
+#: ../contrib/command-not-found/pk-command-not-found.c:363
msgid "Downloading details about the software sources."
msgstr ""
#. TRANSLATORS: downloading file lists so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:370
+#: ../contrib/command-not-found/pk-command-not-found.c:367
msgid "Downloading filelists (this may take some time to complete)."
msgstr ""
#. TRANSLATORS: waiting for native lock
-#: ../contrib/command-not-found/pk-command-not-found.c:374
+#: ../contrib/command-not-found/pk-command-not-found.c:371
msgid "Waiting for package manager lock."
msgstr ""
#. TRANSLATORS: loading package cache so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:378
+#: ../contrib/command-not-found/pk-command-not-found.c:375
msgid "Loading list of packages."
msgstr ""
#. TRANSLATORS: we failed to find the package, this shouldn't happen
-#: ../contrib/command-not-found/pk-command-not-found.c:444
+#: ../contrib/command-not-found/pk-command-not-found.c:439
msgid "Failed to search for file"
msgstr ""
#. TRANSLATORS: the transaction failed in a way we could not expect
-#: ../contrib/command-not-found/pk-command-not-found.c:456
+#: ../contrib/command-not-found/pk-command-not-found.c:451
msgid "Getting the list of files failed"
msgstr ""
#. TRANSLATORS: we failed to launch the executable, the error follows
-#: ../contrib/command-not-found/pk-command-not-found.c:602
+#: ../contrib/command-not-found/pk-command-not-found.c:597
msgid "Failed to launch:"
msgstr ""
#. TRANSLATORS: we failed to install the package
-#: ../contrib/command-not-found/pk-command-not-found.c:630
+#: ../contrib/command-not-found/pk-command-not-found.c:625
msgid "Failed to install packages"
msgstr ""
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:729
+#: ../contrib/command-not-found/pk-command-not-found.c:723
msgid "command not found"
msgstr ""
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:747
+#: ../contrib/command-not-found/pk-command-not-found.c:741
msgid "Similar command is:"
msgstr ""
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:761
+#: ../contrib/command-not-found/pk-command-not-found.c:755
msgid "Run similar command:"
msgstr ""
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:775
-#: ../contrib/command-not-found/pk-command-not-found.c:784
+#: ../contrib/command-not-found/pk-command-not-found.c:769
+#: ../contrib/command-not-found/pk-command-not-found.c:778
msgid "Similar commands are:"
msgstr ""
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:791
+#: ../contrib/command-not-found/pk-command-not-found.c:785
msgid "Please choose a command to run"
msgstr ""
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:809
+#: ../contrib/command-not-found/pk-command-not-found.c:803
msgid "The package providing this file is:"
msgstr ""
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:816
+#: ../contrib/command-not-found/pk-command-not-found.c:810
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:843
+#: ../contrib/command-not-found/pk-command-not-found.c:837
msgid "Packages providing this file are:"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:853
+#: ../contrib/command-not-found/pk-command-not-found.c:847
msgid "Suitable packages are:"
msgstr ""
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:862
+#: ../contrib/command-not-found/pk-command-not-found.c:856
msgid "Please choose a package to install"
msgstr ""
@@ -1998,96 +1999,63 @@ msgstr ""
msgid "Upgrade System"
msgstr ""
-#. TRANSLATORS: failed due to DBus security
-#: ../src/pk-main.c:91
-msgid "Startup failed due to security policies on this machine."
-msgstr ""
-
-#. TRANSLATORS: only two ways this can fail...
-#: ../src/pk-main.c:93
-msgid "This can happen for two reasons:"
-msgstr ""
-
-#. TRANSLATORS: only allowed to be owned by root
-#: ../src/pk-main.c:95
-msgid "The correct user is not launching the executable (usually root)"
-msgstr ""
-
-#. TRANSLATORS: or we are installed in a prefix
-#: ../src/pk-main.c:97
-msgid ""
-"The org.freedesktop.PackageKit.conf file is not installed in the system "
-"directory:"
-msgstr ""
-
#. TRANSLATORS: a backend is the system package tool, e.g. yum, apt
-#: ../src/pk-main.c:223
+#: ../src/pk-main.c:148
msgid "Packaging backend to use, e.g. dummy"
msgstr ""
#. TRANSLATORS: if we should run in the background
-#: ../src/pk-main.c:226
+#: ../src/pk-main.c:151
msgid "Daemonize and detach from the terminal"
msgstr ""
#. TRANSLATORS: if we should not monitor how long we are inactive for
-#: ../src/pk-main.c:229
+#: ../src/pk-main.c:154
msgid "Disable the idle timer"
msgstr ""
#. TRANSLATORS: show version
-#: ../src/pk-main.c:232
+#: ../src/pk-main.c:157
msgid "Show version and exit"
msgstr ""
#. TRANSLATORS: exit after we've started up, used for user profiling
-#: ../src/pk-main.c:235
+#: ../src/pk-main.c:160
msgid "Exit after a small delay"
msgstr ""
#. TRANSLATORS: exit straight away, used for automatic profiling
-#: ../src/pk-main.c:238
+#: ../src/pk-main.c:163
msgid "Exit after the engine has loaded"
msgstr ""
#. TRANSLATORS: describing the service that is running
-#: ../src/pk-main.c:253
+#: ../src/pk-main.c:177
msgid "PackageKit service"
msgstr ""
-#. TRANSLATORS: fatal error, dbus is not running
-#: ../src/pk-main.c:298
-msgid "Cannot connect to the system bus"
-msgstr ""
-
-#: ../src/pk-main.c:344
+#: ../src/pk-main.c:249
msgid "Failed to load any of the specified backends:"
msgstr ""
-#. TRANSLATORS: cannot register on system bus, unknown reason -- geeky error
-#. follows
-#: ../src/pk-main.c:358
-msgid "Error trying to start:"
-msgstr ""
-
#. TRANSLATORS: is not GPG signed
-#: ../src/pk-transaction.c:2611 ../src/pk-transaction.c:2618
+#: ../src/pk-transaction.c:2659
msgid "The software is not from a trusted source."
msgstr ""
-#: ../src/pk-transaction.c:2623
+#: ../src/pk-transaction.c:2667
msgid "Do not update this package unless you are sure it is safe to do so."
msgstr ""
-#: ../src/pk-transaction.c:2624
+#: ../src/pk-transaction.c:2668
msgid "Do not update these packages unless you are sure it is safe to do so."
msgstr ""
-#: ../src/pk-transaction.c:2634
+#: ../src/pk-transaction.c:2678
msgid "Do not install this package unless you are sure it is safe to do so."
msgstr ""
-#: ../src/pk-transaction.c:2635
+#: ../src/pk-transaction.c:2679
msgid "Do not install these packages unless you are sure it is safe to do so."
msgstr ""
diff --git a/po/id.po b/po/id.po
index 3b7471e..b45222c 100644
--- a/po/id.po
+++ b/po/id.po
@@ -2,14 +2,16 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
-# Richard Hughes <richard at hughsie.com>, 2011
-# Andika Triwidada <andika at gmail.com>, 2011
+# Translators:
+# Andika Triwidada <andika at gmail.com>, 2011.
+# Dichi Al Faridi <dichi at alfaridi.info>, 2010.
+# Richard Hughes <richard at hughsie.com>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-04 10:50+0100\n"
-"PO-Revision-Date: 2011-05-15 14:47+0000\n"
+"POT-Creation-Date: 2011-09-05 16:58+0100\n"
+"PO-Revision-Date: 2011-10-11 04:56+0000\n"
"Last-Translator: andika <andika at gmail.com>\n"
"Language-Team: Indonesian (http://www.transifex.net/projects/p/freedesktop/team/id/)\n"
"MIME-Version: 1.0\n"
@@ -286,7 +288,7 @@ msgstr "Tak ada paket untuk dimutakhirkan."
#. TRANSLATORS: the transaction failed in a way we could not expect
#: ../client/pk-console.c:704
-#: ../contrib/command-not-found/pk-command-not-found.c:639
+#: ../contrib/command-not-found/pk-command-not-found.c:634
msgid "The transaction failed"
msgstr "Transaksi gagal"
@@ -727,159 +729,154 @@ msgid "PackageKit Monitor"
msgstr "PackageKit Monitor"
#. TRANSLATORS: when we are getting data from the daemon
-#: ../contrib/browser-plugin/pk-plugin-install.c:499
+#: ../contrib/browser-plugin/pk-plugin-install.c:503
msgid "Getting package information..."
msgstr "Mengambil informasi paket..."
#. TRANSLATORS: run an applicaiton
-#: ../contrib/browser-plugin/pk-plugin-install.c:505
+#: ../contrib/browser-plugin/pk-plugin-install.c:509
#, c-format
msgid "Run %s"
msgstr "Jalankan %s"
#. TRANSLATORS: show the installed version of a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:511
+#: ../contrib/browser-plugin/pk-plugin-install.c:515
msgid "Installed version"
msgstr "Versi terpasang"
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:519
+#: ../contrib/browser-plugin/pk-plugin-install.c:523
#, c-format
msgid "Run version %s now"
msgstr "Jalankan versi %s sekarang"
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:525
+#: ../contrib/browser-plugin/pk-plugin-install.c:529
msgid "Run now"
msgstr "Jalankan sekarang"
#. TRANSLATORS: update to a new version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:531
+#: ../contrib/browser-plugin/pk-plugin-install.c:535
#, c-format
msgid "Update to version %s"
msgstr "Mutakhirkan ke versi %s"
#. TRANSLATORS: To install a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:537
+#: ../contrib/browser-plugin/pk-plugin-install.c:541
#, c-format
msgid "Install %s now"
msgstr "Pasang %s sekarang"
#. TRANSLATORS: the version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:540
+#: ../contrib/browser-plugin/pk-plugin-install.c:544
msgid "Version"
msgstr "Versi"
#. TRANSLATORS: noting found, so can't install
-#: ../contrib/browser-plugin/pk-plugin-install.c:545
+#: ../contrib/browser-plugin/pk-plugin-install.c:549
msgid "No packages found for your system"
msgstr "Tak ditemukan paket pada sistem Anda"
#. TRANSLATORS: package is being installed
-#: ../contrib/browser-plugin/pk-plugin-install.c:550
+#: ../contrib/browser-plugin/pk-plugin-install.c:554
msgid "Installing..."
msgstr "Memasang..."
#. TRANSLATORS: downloading repo data so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:366
+#: ../contrib/command-not-found/pk-command-not-found.c:363
msgid "Downloading details about the software sources."
msgstr "Mengunduh rincian tentang sumber perangkat lunak."
#. TRANSLATORS: downloading file lists so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:370
+#: ../contrib/command-not-found/pk-command-not-found.c:367
msgid "Downloading filelists (this may take some time to complete)."
msgstr "Mengunduh filelist (mungkin ini makan waktu)."
#. TRANSLATORS: waiting for native lock
-#: ../contrib/command-not-found/pk-command-not-found.c:374
+#: ../contrib/command-not-found/pk-command-not-found.c:371
msgid "Waiting for package manager lock."
msgstr "Menunggu kunci manajer paket."
#. TRANSLATORS: loading package cache so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:378
+#: ../contrib/command-not-found/pk-command-not-found.c:375
msgid "Loading list of packages."
msgstr "Memuat daftar paket."
#. TRANSLATORS: we failed to find the package, this shouldn't happen
-#: ../contrib/command-not-found/pk-command-not-found.c:444
+#: ../contrib/command-not-found/pk-command-not-found.c:439
msgid "Failed to search for file"
msgstr "Gagal mencari berkas"
#. TRANSLATORS: the transaction failed in a way we could not expect
-#: ../contrib/command-not-found/pk-command-not-found.c:456
+#: ../contrib/command-not-found/pk-command-not-found.c:451
msgid "Getting the list of files failed"
msgstr "Gagal mendapat daftar berkas"
#. TRANSLATORS: we failed to launch the executable, the error follows
-#: ../contrib/command-not-found/pk-command-not-found.c:602
+#: ../contrib/command-not-found/pk-command-not-found.c:597
msgid "Failed to launch:"
msgstr "Gagal meluncurkan:"
#. TRANSLATORS: we failed to install the package
-#: ../contrib/command-not-found/pk-command-not-found.c:630
+#: ../contrib/command-not-found/pk-command-not-found.c:625
msgid "Failed to install packages"
msgstr "Gagal memasang paket"
-#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/command-not-found/pk-command-not-found.c:706
-msgid "PackageKit Command Not Found"
-msgstr "Perintah PackageKit Tak Ditemukan"
-
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:723
msgid "command not found"
msgstr "perintah tak ditemukan"
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:759
+#: ../contrib/command-not-found/pk-command-not-found.c:741
msgid "Similar command is:"
msgstr "Perintah serupa adalah:"
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:773
+#: ../contrib/command-not-found/pk-command-not-found.c:755
msgid "Run similar command:"
msgstr "Jalankan perintah serupa:"
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:787
-#: ../contrib/command-not-found/pk-command-not-found.c:796
+#: ../contrib/command-not-found/pk-command-not-found.c:769
+#: ../contrib/command-not-found/pk-command-not-found.c:778
msgid "Similar commands are:"
msgstr "Perintah serupa adalah:"
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:785
msgid "Please choose a command to run"
msgstr "Silakan pilih suatu perintah untuk dijalankan"
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:821
+#: ../contrib/command-not-found/pk-command-not-found.c:803
msgid "The package providing this file is:"
msgstr "Paket yang menyediakan berkas ini adalah:"
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:828
+#: ../contrib/command-not-found/pk-command-not-found.c:810
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr "Pasang paket '%s' untuk menyediakan perintah '%s'?"
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:855
+#: ../contrib/command-not-found/pk-command-not-found.c:837
msgid "Packages providing this file are:"
msgstr "Paket-paket yang menyediakan berkas ini adalah:"
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:865
+#: ../contrib/command-not-found/pk-command-not-found.c:847
msgid "Suitable packages are:"
msgstr "Paket-paket yang cocok adalah:"
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:874
+#: ../contrib/command-not-found/pk-command-not-found.c:856
msgid "Please choose a package to install"
msgstr "Silakan pilih suatu paket untuk dipasang"
@@ -1808,13 +1805,19 @@ msgstr "Paket berikut mesti dipasang ulang:"
msgid "The following packages have to be downgraded:"
msgstr "Paket berikut mesti diturunkan versinya:"
+#. TRANSLATORS: When processing, untrusted and non-verified packages may be
+#. encountered
+#: ../lib/packagekit-glib2/pk-task-text.c:325
+msgid "The following packages are untrusted:"
+msgstr "Paket berikut tak terpercaya:"
+
#. TRANSLATORS: ask the user if the proposed changes are okay
-#: ../lib/packagekit-glib2/pk-task-text.c:380
+#: ../lib/packagekit-glib2/pk-task-text.c:385
msgid "Proceed with changes?"
msgstr "Lanjut terapkan perubahan?"
#. TRANSLATORS: tell the user we didn't do anything
-#: ../lib/packagekit-glib2/pk-task-text.c:385
+#: ../lib/packagekit-glib2/pk-task-text.c:390
msgid "The transaction did not proceed."
msgstr "Transaksi tak dilanjutkan."
@@ -2026,99 +2029,65 @@ msgstr "Memutakhirkan paket"
msgid "Upgrade System"
msgstr "Tingkatkan Sistem"
-#. TRANSLATORS: failed due to DBus security
-#: ../src/pk-main.c:91
-msgid "Startup failed due to security policies on this machine."
-msgstr "Startup gagal karena kebijakan keamanan pada mesin ini."
-
-#. TRANSLATORS: only two ways this can fail...
-#: ../src/pk-main.c:93
-msgid "This can happen for two reasons:"
-msgstr "Ini dapat terjadi karena dua alasan:"
-
-#. TRANSLATORS: only allowed to be owned by root
-#: ../src/pk-main.c:95
-msgid "The correct user is not launching the executable (usually root)"
-msgstr "Yang meluncurkan executable bukan pengguna yang benar (biasanya root)"
-
-#. TRANSLATORS: or we are installed in a prefix
-#: ../src/pk-main.c:97
-msgid ""
-"The org.freedesktop.PackageKit.conf file is not installed in the system "
-"directory:"
-msgstr ""
-"Berkas org.freedesktop.PackageKit.conf tak terpasang di direktori sistem:"
-
#. TRANSLATORS: a backend is the system package tool, e.g. yum, apt
-#: ../src/pk-main.c:223
+#: ../src/pk-main.c:148
msgid "Packaging backend to use, e.g. dummy"
msgstr "Backend pemaketan yang dipakai, mis. dummy"
#. TRANSLATORS: if we should run in the background
-#: ../src/pk-main.c:226
+#: ../src/pk-main.c:151
msgid "Daemonize and detach from the terminal"
msgstr "Daemonkan dan lepas dari terminal"
#. TRANSLATORS: if we should not monitor how long we are inactive for
-#: ../src/pk-main.c:229
+#: ../src/pk-main.c:154
msgid "Disable the idle timer"
msgstr "Matikan pewaktu menganggur"
#. TRANSLATORS: show version
-#: ../src/pk-main.c:232
+#: ../src/pk-main.c:157
msgid "Show version and exit"
msgstr "Tampilkan versi dan keluar"
#. TRANSLATORS: exit after we've started up, used for user profiling
-#: ../src/pk-main.c:235
+#: ../src/pk-main.c:160
msgid "Exit after a small delay"
msgstr "Keluar setelah suatu jeda singkat"
#. TRANSLATORS: exit straight away, used for automatic profiling
-#: ../src/pk-main.c:238
+#: ../src/pk-main.c:163
msgid "Exit after the engine has loaded"
msgstr "Keluar setelah mesin dimuat"
#. TRANSLATORS: describing the service that is running
-#: ../src/pk-main.c:253
+#: ../src/pk-main.c:177
msgid "PackageKit service"
msgstr "Layanan PackageKit"
-#. TRANSLATORS: fatal error, dbus is not running
-#: ../src/pk-main.c:298
-msgid "Cannot connect to the system bus"
-msgstr "Tak bisa menyambung ke bus sistem"
-
-#: ../src/pk-main.c:344
+#: ../src/pk-main.c:249
msgid "Failed to load any of the specified backends:"
msgstr "Gagal memuat sebarang backend yang dinyatakan:"
-#. TRANSLATORS: cannot register on system bus, unknown reason -- geeky error
-#. follows
-#: ../src/pk-main.c:358
-msgid "Error trying to start:"
-msgstr "Galat mencoba memulai:"
-
#. TRANSLATORS: is not GPG signed
-#: ../src/pk-transaction.c:2611 ../src/pk-transaction.c:2618
+#: ../src/pk-transaction.c:2659
msgid "The software is not from a trusted source."
msgstr "Perangkat lunak bukan dari sumber yang terpercaya."
-#: ../src/pk-transaction.c:2623
+#: ../src/pk-transaction.c:2667
msgid "Do not update this package unless you are sure it is safe to do so."
msgstr "Jangan mutakhirkan paket ini kecuali Anda yakin aman untuk dilakukan."
-#: ../src/pk-transaction.c:2624
+#: ../src/pk-transaction.c:2668
msgid "Do not update these packages unless you are sure it is safe to do so."
msgstr ""
"Jangan mutakhirkan paket-paket ini kecuali Anda yakin aman untuk "
"melakukannya."
-#: ../src/pk-transaction.c:2634
+#: ../src/pk-transaction.c:2678
msgid "Do not install this package unless you are sure it is safe to do so."
msgstr "Jangan pasang paket ini kecuali Anda yakin aman untuk dilakukan."
-#: ../src/pk-transaction.c:2635
+#: ../src/pk-transaction.c:2679
msgid "Do not install these packages unless you are sure it is safe to do so."
msgstr ""
"Jangan pasang paket-paket ini kecuali Anda yakin aman untuk melakukannya."
diff --git a/po/kk.po b/po/kk.po
index 13c3f35..ddf165a 100644
--- a/po/kk.po
+++ b/po/kk.po
@@ -2,12 +2,13 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-08-01 10:58+0100\n"
-"PO-Revision-Date: 2011-09-05 15:42+0000\n"
+"POT-Creation-Date: 2011-09-05 16:58+0100\n"
+"PO-Revision-Date: 2010-12-13 12:37+0000\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: Kazakh (http://www.transifex.net/projects/p/freedesktop/team/kk/)\n"
"MIME-Version: 1.0\n"
@@ -284,7 +285,7 @@ msgstr ""
#. TRANSLATORS: the transaction failed in a way we could not expect
#: ../client/pk-console.c:704
-#: ../contrib/command-not-found/pk-command-not-found.c:639
+#: ../contrib/command-not-found/pk-command-not-found.c:634
msgid "The transaction failed"
msgstr ""
@@ -710,154 +711,154 @@ msgid "PackageKit Monitor"
msgstr ""
#. TRANSLATORS: when we are getting data from the daemon
-#: ../contrib/browser-plugin/pk-plugin-install.c:499
+#: ../contrib/browser-plugin/pk-plugin-install.c:503
msgid "Getting package information..."
msgstr ""
#. TRANSLATORS: run an applicaiton
-#: ../contrib/browser-plugin/pk-plugin-install.c:505
+#: ../contrib/browser-plugin/pk-plugin-install.c:509
#, c-format
msgid "Run %s"
msgstr ""
#. TRANSLATORS: show the installed version of a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:511
+#: ../contrib/browser-plugin/pk-plugin-install.c:515
msgid "Installed version"
msgstr ""
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:519
+#: ../contrib/browser-plugin/pk-plugin-install.c:523
#, c-format
msgid "Run version %s now"
msgstr ""
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:525
+#: ../contrib/browser-plugin/pk-plugin-install.c:529
msgid "Run now"
msgstr ""
#. TRANSLATORS: update to a new version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:531
+#: ../contrib/browser-plugin/pk-plugin-install.c:535
#, c-format
msgid "Update to version %s"
msgstr ""
#. TRANSLATORS: To install a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:537
+#: ../contrib/browser-plugin/pk-plugin-install.c:541
#, c-format
msgid "Install %s now"
msgstr ""
#. TRANSLATORS: the version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:540
+#: ../contrib/browser-plugin/pk-plugin-install.c:544
msgid "Version"
msgstr ""
#. TRANSLATORS: noting found, so can't install
-#: ../contrib/browser-plugin/pk-plugin-install.c:545
+#: ../contrib/browser-plugin/pk-plugin-install.c:549
msgid "No packages found for your system"
msgstr ""
#. TRANSLATORS: package is being installed
-#: ../contrib/browser-plugin/pk-plugin-install.c:550
+#: ../contrib/browser-plugin/pk-plugin-install.c:554
msgid "Installing..."
msgstr ""
#. TRANSLATORS: downloading repo data so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:366
+#: ../contrib/command-not-found/pk-command-not-found.c:363
msgid "Downloading details about the software sources."
msgstr ""
#. TRANSLATORS: downloading file lists so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:370
+#: ../contrib/command-not-found/pk-command-not-found.c:367
msgid "Downloading filelists (this may take some time to complete)."
msgstr ""
#. TRANSLATORS: waiting for native lock
-#: ../contrib/command-not-found/pk-command-not-found.c:374
+#: ../contrib/command-not-found/pk-command-not-found.c:371
msgid "Waiting for package manager lock."
msgstr ""
#. TRANSLATORS: loading package cache so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:378
+#: ../contrib/command-not-found/pk-command-not-found.c:375
msgid "Loading list of packages."
msgstr ""
#. TRANSLATORS: we failed to find the package, this shouldn't happen
-#: ../contrib/command-not-found/pk-command-not-found.c:444
+#: ../contrib/command-not-found/pk-command-not-found.c:439
msgid "Failed to search for file"
msgstr ""
#. TRANSLATORS: the transaction failed in a way we could not expect
-#: ../contrib/command-not-found/pk-command-not-found.c:456
+#: ../contrib/command-not-found/pk-command-not-found.c:451
msgid "Getting the list of files failed"
msgstr ""
#. TRANSLATORS: we failed to launch the executable, the error follows
-#: ../contrib/command-not-found/pk-command-not-found.c:602
+#: ../contrib/command-not-found/pk-command-not-found.c:597
msgid "Failed to launch:"
msgstr ""
#. TRANSLATORS: we failed to install the package
-#: ../contrib/command-not-found/pk-command-not-found.c:630
+#: ../contrib/command-not-found/pk-command-not-found.c:625
msgid "Failed to install packages"
msgstr ""
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:729
+#: ../contrib/command-not-found/pk-command-not-found.c:723
msgid "command not found"
msgstr ""
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:747
+#: ../contrib/command-not-found/pk-command-not-found.c:741
msgid "Similar command is:"
msgstr ""
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:761
+#: ../contrib/command-not-found/pk-command-not-found.c:755
msgid "Run similar command:"
msgstr ""
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:775
-#: ../contrib/command-not-found/pk-command-not-found.c:784
+#: ../contrib/command-not-found/pk-command-not-found.c:769
+#: ../contrib/command-not-found/pk-command-not-found.c:778
msgid "Similar commands are:"
msgstr ""
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:791
+#: ../contrib/command-not-found/pk-command-not-found.c:785
msgid "Please choose a command to run"
msgstr ""
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:809
+#: ../contrib/command-not-found/pk-command-not-found.c:803
msgid "The package providing this file is:"
msgstr ""
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:816
+#: ../contrib/command-not-found/pk-command-not-found.c:810
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:843
+#: ../contrib/command-not-found/pk-command-not-found.c:837
msgid "Packages providing this file are:"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:853
+#: ../contrib/command-not-found/pk-command-not-found.c:847
msgid "Suitable packages are:"
msgstr ""
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:862
+#: ../contrib/command-not-found/pk-command-not-found.c:856
msgid "Please choose a package to install"
msgstr ""
@@ -1998,96 +1999,63 @@ msgstr ""
msgid "Upgrade System"
msgstr ""
-#. TRANSLATORS: failed due to DBus security
-#: ../src/pk-main.c:91
-msgid "Startup failed due to security policies on this machine."
-msgstr ""
-
-#. TRANSLATORS: only two ways this can fail...
-#: ../src/pk-main.c:93
-msgid "This can happen for two reasons:"
-msgstr ""
-
-#. TRANSLATORS: only allowed to be owned by root
-#: ../src/pk-main.c:95
-msgid "The correct user is not launching the executable (usually root)"
-msgstr ""
-
-#. TRANSLATORS: or we are installed in a prefix
-#: ../src/pk-main.c:97
-msgid ""
-"The org.freedesktop.PackageKit.conf file is not installed in the system "
-"directory:"
-msgstr ""
-
#. TRANSLATORS: a backend is the system package tool, e.g. yum, apt
-#: ../src/pk-main.c:223
+#: ../src/pk-main.c:148
msgid "Packaging backend to use, e.g. dummy"
msgstr ""
#. TRANSLATORS: if we should run in the background
-#: ../src/pk-main.c:226
+#: ../src/pk-main.c:151
msgid "Daemonize and detach from the terminal"
msgstr ""
#. TRANSLATORS: if we should not monitor how long we are inactive for
-#: ../src/pk-main.c:229
+#: ../src/pk-main.c:154
msgid "Disable the idle timer"
msgstr ""
#. TRANSLATORS: show version
-#: ../src/pk-main.c:232
+#: ../src/pk-main.c:157
msgid "Show version and exit"
msgstr ""
#. TRANSLATORS: exit after we've started up, used for user profiling
-#: ../src/pk-main.c:235
+#: ../src/pk-main.c:160
msgid "Exit after a small delay"
msgstr ""
#. TRANSLATORS: exit straight away, used for automatic profiling
-#: ../src/pk-main.c:238
+#: ../src/pk-main.c:163
msgid "Exit after the engine has loaded"
msgstr ""
#. TRANSLATORS: describing the service that is running
-#: ../src/pk-main.c:253
+#: ../src/pk-main.c:177
msgid "PackageKit service"
msgstr ""
-#. TRANSLATORS: fatal error, dbus is not running
-#: ../src/pk-main.c:298
-msgid "Cannot connect to the system bus"
-msgstr ""
-
-#: ../src/pk-main.c:344
+#: ../src/pk-main.c:249
msgid "Failed to load any of the specified backends:"
msgstr ""
-#. TRANSLATORS: cannot register on system bus, unknown reason -- geeky error
-#. follows
-#: ../src/pk-main.c:358
-msgid "Error trying to start:"
-msgstr ""
-
#. TRANSLATORS: is not GPG signed
-#: ../src/pk-transaction.c:2611 ../src/pk-transaction.c:2618
+#: ../src/pk-transaction.c:2659
msgid "The software is not from a trusted source."
msgstr ""
-#: ../src/pk-transaction.c:2623
+#: ../src/pk-transaction.c:2667
msgid "Do not update this package unless you are sure it is safe to do so."
msgstr ""
-#: ../src/pk-transaction.c:2624
+#: ../src/pk-transaction.c:2668
msgid "Do not update these packages unless you are sure it is safe to do so."
msgstr ""
-#: ../src/pk-transaction.c:2634
+#: ../src/pk-transaction.c:2678
msgid "Do not install this package unless you are sure it is safe to do so."
msgstr ""
-#: ../src/pk-transaction.c:2635
+#: ../src/pk-transaction.c:2679
msgid "Do not install these packages unless you are sure it is safe to do so."
msgstr ""
diff --git a/po/ru.po b/po/ru.po
index 5f6d403..a3e12aa 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -2,16 +2,23 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
-# Yuri Kozlov <yuray at komyakino.ru>, 2011
-# ÐгоÑÑ ÐоÑбÑнов <igor.gorbounov at gmail.com>, 2011
-# Richard Hughes <richard at hughsie.com>, 2011
+# Translators:
+# Alexey Kostyuk <unitoff at gmail.com>, 2009.
+# Ivan Ignatyev <ivan.ignatyev at auditory.ru>, 2008, 2009.
+# Misha Shnurapet <shnurapet at fedoraproject.org>, 2011.
+# Misha Shnurapet <zayzayats at yandex.ru>, 2010.
+# Richard Hughes <richard at hughsie.com>, 2011.
+# Yulia <ypoyarko at redhat.com>, 2009.
+# Yuri Khabarov <madb00blik at gmail.com>, 2011.
+# Yuri Kozlov <yuray at komyakino.ru>, 2011.
+# ÐгоÑÑ ÐоÑбÑнов <igor.gorbounov at gmail.com>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-04 10:50+0100\n"
-"PO-Revision-Date: 2011-05-29 04:35+0000\n"
-"Last-Translator: yuray <yuray at komyakino.ru>\n"
+"POT-Creation-Date: 2011-09-05 16:58+0100\n"
+"PO-Revision-Date: 2011-10-08 12:15+0000\n"
+"Last-Translator: shnurapet <shnurapet at fedoraproject.org>\n"
"Language-Team: Russian (http://www.transifex.net/projects/p/freedesktop/team/ru/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -287,7 +294,7 @@ msgstr "ÐÐµÑ Ð¿Ð°ÐºÐµÑов Ð´Ð»Ñ Ð¾Ð±Ð½Ð¾Ð²Ð»ÐµÐ½Ð¸Ñ."
#. TRANSLATORS: the transaction failed in a way we could not expect
#: ../client/pk-console.c:704
-#: ../contrib/command-not-found/pk-command-not-found.c:639
+#: ../contrib/command-not-found/pk-command-not-found.c:634
msgid "The transaction failed"
msgstr "ÐейÑÑвие не ÑдалоÑÑ"
@@ -726,159 +733,154 @@ msgid "PackageKit Monitor"
msgstr "ÐониÑÐ¾Ñ PackageKit"
#. TRANSLATORS: when we are getting data from the daemon
-#: ../contrib/browser-plugin/pk-plugin-install.c:499
+#: ../contrib/browser-plugin/pk-plugin-install.c:503
msgid "Getting package information..."
msgstr "ÐолÑÑение инÑоÑмаÑии о пакеÑе..."
#. TRANSLATORS: run an applicaiton
-#: ../contrib/browser-plugin/pk-plugin-install.c:505
+#: ../contrib/browser-plugin/pk-plugin-install.c:509
#, c-format
msgid "Run %s"
msgstr "ÐÑполниÑÑ %s"
#. TRANSLATORS: show the installed version of a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:511
+#: ../contrib/browser-plugin/pk-plugin-install.c:515
msgid "Installed version"
msgstr "УÑÑÐ°Ð½Ð¾Ð²Ð»ÐµÐ½Ð½Ð°Ñ Ð²ÐµÑÑиÑ"
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:519
+#: ../contrib/browser-plugin/pk-plugin-install.c:523
#, c-format
msgid "Run version %s now"
msgstr "ÐапÑÑÑиÑÑ Ð²ÐµÑÑÐ¸Ñ %s ÑейÑаÑ"
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:525
+#: ../contrib/browser-plugin/pk-plugin-install.c:529
msgid "Run now"
msgstr "ÐÑполниÑÑ ÑейÑаÑ"
#. TRANSLATORS: update to a new version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:531
+#: ../contrib/browser-plugin/pk-plugin-install.c:535
#, c-format
msgid "Update to version %s"
msgstr "Ðбновление до веÑÑии %s"
#. TRANSLATORS: To install a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:537
+#: ../contrib/browser-plugin/pk-plugin-install.c:541
#, c-format
msgid "Install %s now"
msgstr "УÑÑановиÑÑ %s ÑейÑаÑ"
#. TRANSLATORS: the version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:540
+#: ../contrib/browser-plugin/pk-plugin-install.c:544
msgid "Version"
msgstr "ÐеÑÑиÑ"
#. TRANSLATORS: noting found, so can't install
-#: ../contrib/browser-plugin/pk-plugin-install.c:545
+#: ../contrib/browser-plugin/pk-plugin-install.c:549
msgid "No packages found for your system"
msgstr "ÐÐ»Ñ ÐаÑей ÑиÑÑÐµÐ¼Ñ Ð½Ðµ найдено пакеÑов"
#. TRANSLATORS: package is being installed
-#: ../contrib/browser-plugin/pk-plugin-install.c:550
+#: ../contrib/browser-plugin/pk-plugin-install.c:554
msgid "Installing..."
msgstr "УÑÑановка..."
#. TRANSLATORS: downloading repo data so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:366
+#: ../contrib/command-not-found/pk-command-not-found.c:363
msgid "Downloading details about the software sources."
msgstr "ÐагÑÑзка подÑобноÑÑей об иÑÑоÑникаÑ
пÑогÑамм."
#. TRANSLATORS: downloading file lists so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:370
+#: ../contrib/command-not-found/pk-command-not-found.c:367
msgid "Downloading filelists (this may take some time to complete)."
msgstr "ÐагÑÑзка ÑпиÑка Ñайлов (ÑÑо Ð¼Ð¾Ð¶ÐµÑ Ð·Ð°Ð½ÑÑÑ Ð½ÐµÐºÐ¾ÑоÑое вÑемÑ)"
#. TRANSLATORS: waiting for native lock
-#: ../contrib/command-not-found/pk-command-not-found.c:374
+#: ../contrib/command-not-found/pk-command-not-found.c:371
msgid "Waiting for package manager lock."
msgstr "Ðжидание ÑазблокиÑÐ¾Ð²Ð°Ð½Ð¸Ñ Ð¿Ð°ÐºÐµÑного менеджеÑа."
#. TRANSLATORS: loading package cache so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:378
+#: ../contrib/command-not-found/pk-command-not-found.c:375
msgid "Loading list of packages."
msgstr "ÐагÑÑзка ÑпиÑка пакеÑов"
#. TRANSLATORS: we failed to find the package, this shouldn't happen
-#: ../contrib/command-not-found/pk-command-not-found.c:444
+#: ../contrib/command-not-found/pk-command-not-found.c:439
msgid "Failed to search for file"
msgstr "ÐÑибка пÑи поиÑке Ñайлов"
#. TRANSLATORS: the transaction failed in a way we could not expect
-#: ../contrib/command-not-found/pk-command-not-found.c:456
+#: ../contrib/command-not-found/pk-command-not-found.c:451
msgid "Getting the list of files failed"
msgstr "Ðе ÑдалоÑÑ Ð¿Ð¾Ð»ÑÑиÑÑ ÑпиÑок Ñайлов"
#. TRANSLATORS: we failed to launch the executable, the error follows
-#: ../contrib/command-not-found/pk-command-not-found.c:602
+#: ../contrib/command-not-found/pk-command-not-found.c:597
msgid "Failed to launch:"
msgstr "Ðе ÑдалоÑÑ Ð·Ð°Ð¿ÑÑÑиÑÑ:"
#. TRANSLATORS: we failed to install the package
-#: ../contrib/command-not-found/pk-command-not-found.c:630
+#: ../contrib/command-not-found/pk-command-not-found.c:625
msgid "Failed to install packages"
msgstr "Ðе ÑдалоÑÑ ÑÑÑановиÑÑ Ð¿Ð°ÐºÐµÑÑ"
-#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/command-not-found/pk-command-not-found.c:706
-msgid "PackageKit Command Not Found"
-msgstr "Ðоманда PackageKit не найдена"
-
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:723
msgid "command not found"
msgstr "команда не найдена"
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:759
+#: ../contrib/command-not-found/pk-command-not-found.c:741
msgid "Similar command is:"
msgstr "ÐналогиÑнÑе командÑ:"
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:773
+#: ../contrib/command-not-found/pk-command-not-found.c:755
msgid "Run similar command:"
msgstr "ÐÑполниÑе аналогиÑнÑÑ ÐºÐ¾Ð¼Ð°Ð½Ð´Ñ:"
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:787
-#: ../contrib/command-not-found/pk-command-not-found.c:796
+#: ../contrib/command-not-found/pk-command-not-found.c:769
+#: ../contrib/command-not-found/pk-command-not-found.c:778
msgid "Similar commands are:"
msgstr "ÐналогиÑнÑе командÑ:"
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:785
msgid "Please choose a command to run"
msgstr "ÐожалÑйÑÑа, вÑбеÑиÑе командÑ"
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:821
+#: ../contrib/command-not-found/pk-command-not-found.c:803
msgid "The package providing this file is:"
msgstr "ÐÑÐ¾Ñ Ð¿Ð°ÐºÐµÑ Ð¿ÑедоÑÑавлÑеÑÑÑ ÑÑим Ñайлом:"
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:828
+#: ../contrib/command-not-found/pk-command-not-found.c:810
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr "УÑÑановиÑÑ Ð¿Ð°ÐºÐµÑ '%s' пÑедоÑÑавлÑÑÑий ÐºÐ¾Ð¼Ð°Ð½Ð´Ñ '%s'?"
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:855
+#: ../contrib/command-not-found/pk-command-not-found.c:837
msgid "Packages providing this file are:"
msgstr "ÐакеÑÑ, ÑодеÑжаÑие ÑÑÐ¾Ñ Ñайл:"
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:865
+#: ../contrib/command-not-found/pk-command-not-found.c:847
msgid "Suitable packages are:"
msgstr "ÐодÑ
одÑÑие пакеÑÑ:"
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:874
+#: ../contrib/command-not-found/pk-command-not-found.c:856
msgid "Please choose a package to install"
msgstr "ÐожалÑйÑÑа, вÑбеÑиÑе Ð¿Ð°ÐºÐµÑ Ð´Ð»Ñ ÑÑÑановки:"
@@ -1804,13 +1806,19 @@ msgstr "СледÑÑÑие пакеÑÑ Ð´Ð¾Ð»Ð¶Ð½Ñ Ð±ÑÑÑ Ð¿ÐµÑеÑÑÑан
msgid "The following packages have to be downgraded:"
msgstr "СледÑÑÑие пакеÑÑ ÑледÑÐµÑ Ð¾ÑкаÑиÑÑ:"
+#. TRANSLATORS: When processing, untrusted and non-verified packages may be
+#. encountered
+#: ../lib/packagekit-glib2/pk-task-text.c:325
+msgid "The following packages are untrusted:"
+msgstr "СледÑÑÑие пакеÑÑ Ð¿Ð¾Ð»ÑÑÐµÐ½Ñ Ð¸Ð· недоÑÑовеÑного иÑÑоÑника:"
+
#. TRANSLATORS: ask the user if the proposed changes are okay
-#: ../lib/packagekit-glib2/pk-task-text.c:380
+#: ../lib/packagekit-glib2/pk-task-text.c:385
msgid "Proceed with changes?"
msgstr "ÐбÑабоÑаÑÑ Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ?"
#. TRANSLATORS: tell the user we didn't do anything
-#: ../lib/packagekit-glib2/pk-task-text.c:385
+#: ../lib/packagekit-glib2/pk-task-text.c:390
msgid "The transaction did not proceed."
msgstr "ÐбÑабоÑка запÑоÑа оÑÑановлена."
@@ -2017,100 +2025,65 @@ msgstr "ÐбновиÑÑ Ð¿Ð°ÐºÐµÑÑ"
msgid "Upgrade System"
msgstr "Ðбновление ÑиÑÑемÑ"
-#. TRANSLATORS: failed due to DBus security
-#: ../src/pk-main.c:91
-msgid "Startup failed due to security policies on this machine."
-msgstr "ÐапÑÑк не ÑдалÑÑ Ð¿Ð¾ пÑавилам безопаÑноÑÑи на ÑÑом компÑÑÑеÑе."
-
-#. TRANSLATORS: only two ways this can fail...
-#: ../src/pk-main.c:93
-msgid "This can happen for two reasons:"
-msgstr "ÐÑо Ð¼Ð¾Ð¶ÐµÑ ÑлÑÑиÑÑÑÑ Ð¿Ð¾ двÑм пÑиÑинам:"
-
-#. TRANSLATORS: only allowed to be owned by root
-#: ../src/pk-main.c:95
-msgid "The correct user is not launching the executable (usually root)"
-msgstr ""
-"ÐÑжнÑй полÑзоваÑÐµÐ»Ñ Ð½Ðµ запÑÑÐºÐ°ÐµÑ Ð¸ÑполнÑемÑй Ñайл (обÑÑно пÑивилегиÑованнÑй)"
-
-#. TRANSLATORS: or we are installed in a prefix
-#: ../src/pk-main.c:97
-msgid ""
-"The org.freedesktop.PackageKit.conf file is not installed in the system "
-"directory:"
-msgstr ""
-"Файл org.freedesktop.PackageKit.conf оÑÑÑÑÑÑвÑÐµÑ Ð² ÑиÑÑемном каÑалоге:"
-
#. TRANSLATORS: a backend is the system package tool, e.g. yum, apt
-#: ../src/pk-main.c:223
+#: ../src/pk-main.c:148
msgid "Packaging backend to use, e.g. dummy"
msgstr ""
"ÐÑполÑзоваÑÑ Ð²Ð½ÑÑÑенний инÑеÑÑÐµÐ¹Ñ Ð¿Ð°ÐºÐµÑной ÑиÑÑемÑ, к пÑимеÑÑ, заглÑÑкÑ"
#. TRANSLATORS: if we should run in the background
-#: ../src/pk-main.c:226
+#: ../src/pk-main.c:151
msgid "Daemonize and detach from the terminal"
msgstr "СделаÑÑ ÑлÑжбой и оÑкÑепиÑÑ Ð¾Ñ ÑеÑминала"
#. TRANSLATORS: if we should not monitor how long we are inactive for
-#: ../src/pk-main.c:229
+#: ../src/pk-main.c:154
msgid "Disable the idle timer"
msgstr "ÐÑклÑÑиÑÑ ÑÐ°Ð¹Ð¼ÐµÑ Ð±ÐµÐ·Ð´ÐµÐ¹ÑÑвиÑ"
#. TRANSLATORS: show version
-#: ../src/pk-main.c:232
+#: ../src/pk-main.c:157
msgid "Show version and exit"
msgstr "ÐоказаÑÑ Ð²ÐµÑÑÐ¸Ñ Ð¸ вÑйÑи"
#. TRANSLATORS: exit after we've started up, used for user profiling
-#: ../src/pk-main.c:235
+#: ../src/pk-main.c:160
msgid "Exit after a small delay"
msgstr "ÐÑйÑи поÑле недолгой задеÑжки"
#. TRANSLATORS: exit straight away, used for automatic profiling
-#: ../src/pk-main.c:238
+#: ../src/pk-main.c:163
msgid "Exit after the engine has loaded"
msgstr "ÐÑйÑи поÑле загÑÑзки движка"
#. TRANSLATORS: describing the service that is running
-#: ../src/pk-main.c:253
+#: ../src/pk-main.c:177
msgid "PackageKit service"
msgstr "СлÑжба PackageKit"
-#. TRANSLATORS: fatal error, dbus is not running
-#: ../src/pk-main.c:298
-msgid "Cannot connect to the system bus"
-msgstr "Ðе ÑдалоÑÑ Ð¿Ð¾Ð´ÑоединиÑÑÑÑ Ðº ÑиÑÑемной Ñине"
-
-#: ../src/pk-main.c:344
+#: ../src/pk-main.c:249
msgid "Failed to load any of the specified backends:"
msgstr "Ðе ÑдалоÑÑ Ð·Ð°Ð³ÑÑзиÑÑ Ð¾Ð´Ð½Ñ Ð¸Ð· ÑказаннÑÑ
иÑполниÑелÑнÑÑ
ÑаÑÑей:"
-#. TRANSLATORS: cannot register on system bus, unknown reason -- geeky error
-#. follows
-#: ../src/pk-main.c:358
-msgid "Error trying to start:"
-msgstr "ÐÑибка пÑи попÑÑке запÑÑка:"
-
#. TRANSLATORS: is not GPG signed
-#: ../src/pk-transaction.c:2611 ../src/pk-transaction.c:2618
+#: ../src/pk-transaction.c:2659
msgid "The software is not from a trusted source."
msgstr "ÐÑогÑамма полÑÑена из недовеÑÑемого иÑÑоÑника."
-#: ../src/pk-transaction.c:2623
+#: ../src/pk-transaction.c:2667
msgid "Do not update this package unless you are sure it is safe to do so."
msgstr "Ðе обновлÑйÑе ÑÑÐ¾Ñ Ð¿Ð°ÐºÐµÑ, еÑли не ÑвеÑÐµÐ½Ñ Ð² Ñом, ÑÑо ÑÑо безопаÑно."
-#: ../src/pk-transaction.c:2624
+#: ../src/pk-transaction.c:2668
msgid "Do not update these packages unless you are sure it is safe to do so."
msgstr "Ðе обновлÑйÑе ÑÑи пакеÑÑ, еÑли не ÑвеÑÐµÐ½Ñ Ð² Ñом, ÑÑо ÑÑо безопаÑно."
-#: ../src/pk-transaction.c:2634
+#: ../src/pk-transaction.c:2678
msgid "Do not install this package unless you are sure it is safe to do so."
msgstr ""
"Ðе ÑÑÑанавливайÑе ÑÑÐ¾Ñ Ð¿Ð°ÐºÐµÑ, еÑли не ÑвеÑÐµÐ½Ñ Ð² Ñом, ÑÑо он безопаÑен."
-#: ../src/pk-transaction.c:2635
+#: ../src/pk-transaction.c:2679
msgid "Do not install these packages unless you are sure it is safe to do so."
msgstr ""
"Ðе ÑÑÑанавливайÑе ÑÑи пакеÑÑ, еÑли не ÑвеÑÐµÐ½Ñ Ð² Ñом, ÑÑо они безопаÑнÑ."
diff --git a/po/sk.po b/po/sk.po
index 50fc6dc..2b2e84d 100644
--- a/po/sk.po
+++ b/po/sk.po
@@ -2,15 +2,19 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
-# helix84 <helix84 at centrum.sk>, 2011
-# Richard Hughes <richard at hughsie.com>, 2011
+# Translators:
+# helix84 <helix84 at centrum.sk>, 2011.
+# Ivan Masár <helix84 at centrum.sk>, 2010, 2011.
+# Lubomir Kundrak <lkundrak at redhat.com>, 2008.
+# Pavol Å imo <palo.simo at gmail.com>, 2008.
+# Richard Hughes <richard at hughsie.com>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-04 10:50+0100\n"
-"PO-Revision-Date: 2011-05-04 09:56+0000\n"
-"Last-Translator: hughsie <richard at hughsie.com>\n"
+"POT-Creation-Date: 2011-09-05 16:58+0100\n"
+"PO-Revision-Date: 2011-10-16 20:39+0000\n"
+"Last-Translator: palos <palo.simo at gmail.com>\n"
"Language-Team: Slovak (http://www.transifex.net/projects/p/freedesktop/team/sk/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -139,7 +143,7 @@ msgstr "Podrobnosti o aktualizácii:"
#: ../lib/packagekit-glib2/pk-task-text.c:124
#: ../lib/packagekit-glib2/pk-task-text.c:206
msgid "Package"
-msgstr "BalÃky"
+msgstr "BalÃk"
#. TRANSLATORS: details about the update, any packages that this update
#. updates
@@ -286,7 +290,7 @@ msgstr "Nie sú dostupné aktualizácie žiadnych balÃkov."
#. TRANSLATORS: the transaction failed in a way we could not expect
#: ../client/pk-console.c:704
-#: ../contrib/command-not-found/pk-command-not-found.c:639
+#: ../contrib/command-not-found/pk-command-not-found.c:634
msgid "The transaction failed"
msgstr "Transakcia zlyhala"
@@ -420,14 +424,14 @@ msgstr "NeÄakaÅ¥ na dokonÄenie úloh a skonÄiÅ¥"
#: ../client/pk-console.c:1289
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:525
msgid "Install the packages without asking for confirmation"
-msgstr "InÅ¡talovaÅ¥ balÃky bez potvrdenia"
+msgstr "InÅ¡talovaÅ¥ balÃky bez potvrdzovania"
#. TRANSLATORS: command line argument, this command is not a priority
#: ../client/pk-console.c:1292
msgid "Run the command using idle network bandwidth and also using less power"
msgstr ""
"SpustiÅ¥ prÃkaz tak, aby využÃval len nevuyžitú Å¡Ãrku pásma a tiež menej "
-"napájania"
+"energie"
#. TRANSLATORS: command line argument, just output without fancy formatting
#: ../client/pk-console.c:1295
@@ -448,12 +452,12 @@ msgstr ""
#. TRANSLATORS: command line argument, --help
#: ../client/pk-console.c:1301
msgid "Show help options."
-msgstr ""
+msgstr "ZobraziÅ¥ voľby pomocnÃka."
#. TRANSLATORS: we failed to contact the daemon
#: ../client/pk-console.c:1331
msgid "Failed to parse command line"
-msgstr ""
+msgstr "Nepodarilo sa analyzovaÅ¥ parametre prÃkazového riadka"
#. TRANSLATORS: we failed to contact the daemon
#: ../client/pk-console.c:1341
@@ -593,7 +597,7 @@ msgstr "Voľba â%sâ nie je podporovaná"
#. TRANSLATORS: Generic failure of what they asked to do
#: ../client/pk-console.c:1793
msgid "Command failed"
-msgstr "PrÃkaz neuspel"
+msgstr "PrÃkaz zlyhal"
#. TRANSLATORS: we can exclude certain packages (glibc) when we know they'll
#. exist on the target
@@ -730,159 +734,154 @@ msgid "PackageKit Monitor"
msgstr "Monitor PackageKit"
#. TRANSLATORS: when we are getting data from the daemon
-#: ../contrib/browser-plugin/pk-plugin-install.c:499
+#: ../contrib/browser-plugin/pk-plugin-install.c:503
msgid "Getting package information..."
msgstr "ZÃskavajú sa informácie o balÃku..."
#. TRANSLATORS: run an applicaiton
-#: ../contrib/browser-plugin/pk-plugin-install.c:505
+#: ../contrib/browser-plugin/pk-plugin-install.c:509
#, c-format
msgid "Run %s"
msgstr "Spustiť %s"
#. TRANSLATORS: show the installed version of a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:511
+#: ../contrib/browser-plugin/pk-plugin-install.c:515
msgid "Installed version"
msgstr "Nainštalovaná verzia"
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:519
+#: ../contrib/browser-plugin/pk-plugin-install.c:523
#, c-format
msgid "Run version %s now"
msgstr "Spustiť verziu %s teraz"
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:525
+#: ../contrib/browser-plugin/pk-plugin-install.c:529
msgid "Run now"
msgstr "Spustiť teraz"
#. TRANSLATORS: update to a new version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:531
+#: ../contrib/browser-plugin/pk-plugin-install.c:535
#, c-format
msgid "Update to version %s"
msgstr "Aktualizovať na verziu %s"
#. TRANSLATORS: To install a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:537
+#: ../contrib/browser-plugin/pk-plugin-install.c:541
#, c-format
msgid "Install %s now"
msgstr "Nainštalovať %s teraz"
#. TRANSLATORS: the version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:540
+#: ../contrib/browser-plugin/pk-plugin-install.c:544
msgid "Version"
msgstr "Verzia"
#. TRANSLATORS: noting found, so can't install
-#: ../contrib/browser-plugin/pk-plugin-install.c:545
+#: ../contrib/browser-plugin/pk-plugin-install.c:549
msgid "No packages found for your system"
msgstr "Pre váš systém neboli nájdené žiadne balÃky"
#. TRANSLATORS: package is being installed
-#: ../contrib/browser-plugin/pk-plugin-install.c:550
+#: ../contrib/browser-plugin/pk-plugin-install.c:554
msgid "Installing..."
msgstr "Inštaluje sa..."
#. TRANSLATORS: downloading repo data so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:366
+#: ../contrib/command-not-found/pk-command-not-found.c:363
msgid "Downloading details about the software sources."
msgstr "Sťahujú sa podrobnosti o zdrojoch softvéru."
#. TRANSLATORS: downloading file lists so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:370
+#: ../contrib/command-not-found/pk-command-not-found.c:367
msgid "Downloading filelists (this may take some time to complete)."
msgstr "SÅ¥ahujú sa zoznamy súborov (dokonÄenie môže chvÃľu trvaÅ¥)."
#. TRANSLATORS: waiting for native lock
-#: ../contrib/command-not-found/pk-command-not-found.c:374
+#: ../contrib/command-not-found/pk-command-not-found.c:371
msgid "Waiting for package manager lock."
msgstr "Äaká sa na zámok správcu balÃkov."
#. TRANSLATORS: loading package cache so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:378
+#: ../contrib/command-not-found/pk-command-not-found.c:375
msgid "Loading list of packages."
msgstr "NaÄÃtava sa zoznam balÃkov."
#. TRANSLATORS: we failed to find the package, this shouldn't happen
-#: ../contrib/command-not-found/pk-command-not-found.c:444
+#: ../contrib/command-not-found/pk-command-not-found.c:439
msgid "Failed to search for file"
msgstr "Vyhľadanie súboru zlyhalo"
#. TRANSLATORS: the transaction failed in a way we could not expect
-#: ../contrib/command-not-found/pk-command-not-found.c:456
+#: ../contrib/command-not-found/pk-command-not-found.c:451
msgid "Getting the list of files failed"
msgstr "Nepodarilo sa zÃskaÅ¥ zoznam súborov"
#. TRANSLATORS: we failed to launch the executable, the error follows
-#: ../contrib/command-not-found/pk-command-not-found.c:602
+#: ../contrib/command-not-found/pk-command-not-found.c:597
msgid "Failed to launch:"
msgstr "Spustenie zlyhalo:"
#. TRANSLATORS: we failed to install the package
-#: ../contrib/command-not-found/pk-command-not-found.c:630
+#: ../contrib/command-not-found/pk-command-not-found.c:625
msgid "Failed to install packages"
msgstr "Nepodarilo sa nainÅ¡talovaÅ¥ balÃky"
-#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/command-not-found/pk-command-not-found.c:706
-msgid "PackageKit Command Not Found"
-msgstr "PackageKit prÃkaz nenájdený"
-
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:723
msgid "command not found"
msgstr "prÃkaz nenájdený"
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:759
+#: ../contrib/command-not-found/pk-command-not-found.c:741
msgid "Similar command is:"
msgstr "Podobný prÃkaz je:"
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:773
+#: ../contrib/command-not-found/pk-command-not-found.c:755
msgid "Run similar command:"
msgstr "SpustiÅ¥ podobný prÃkaz:"
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:787
-#: ../contrib/command-not-found/pk-command-not-found.c:796
+#: ../contrib/command-not-found/pk-command-not-found.c:769
+#: ../contrib/command-not-found/pk-command-not-found.c:778
msgid "Similar commands are:"
msgstr "Podobné prÃkazy sú:"
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:785
msgid "Please choose a command to run"
msgstr "ProsÃm, zvoľte prÃkaz, ktorý chcete spustiÅ¥"
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:821
+#: ../contrib/command-not-found/pk-command-not-found.c:803
msgid "The package providing this file is:"
msgstr "BalÃk poskytujúci tento súbor je:"
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:828
+#: ../contrib/command-not-found/pk-command-not-found.c:810
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr "NainÅ¡talovaÅ¥ balÃk â%sâ poskytujúci prÃkaz â%sâ?"
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:855
+#: ../contrib/command-not-found/pk-command-not-found.c:837
msgid "Packages providing this file are:"
msgstr "BalÃky poskytujúce tento súbor sú:"
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:865
+#: ../contrib/command-not-found/pk-command-not-found.c:847
msgid "Suitable packages are:"
msgstr "Vhodné balÃky sú:"
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:874
+#: ../contrib/command-not-found/pk-command-not-found.c:856
msgid "Please choose a package to install"
msgstr "ProsÃm, zvoľte balÃk, ktorý sa má inÅ¡talovaÅ¥"
@@ -927,7 +926,7 @@ msgstr "Inštalátor PackageKit pre debuginfo"
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:554
#, c-format
msgid "ERROR: Specify package names to install."
-msgstr "CHYBA: Zajdajte názvy balÃÄkov, ktoré sa majú inÅ¡talovaÅ¥."
+msgstr "CHYBA: Zajdajte názvy balÃkov, ktoré sa majú inÅ¡talovaÅ¥."
#. TRANSLATORS: we are getting the list of repositories
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:590
@@ -1414,17 +1413,17 @@ msgstr "Bežná"
#. TRANSLATORS: The type of update
#: ../lib/packagekit-glib2/pk-console-shared.c:434
msgid "Important"
-msgstr "Dôležité"
+msgstr "Dôležitá"
#. TRANSLATORS: The type of update
#: ../lib/packagekit-glib2/pk-console-shared.c:438
msgid "Security"
-msgstr "BezpeÄnostné"
+msgstr "BezpeÄnostná"
#. TRANSLATORS: The type of update
#: ../lib/packagekit-glib2/pk-console-shared.c:442
msgid "Bug fix "
-msgstr "Opravy chýb"
+msgstr "Oprava chýb"
#. TRANSLATORS: The type of update
#: ../lib/packagekit-glib2/pk-console-shared.c:446
@@ -1434,7 +1433,7 @@ msgstr "Vylepšenia"
#. TRANSLATORS: The type of update
#: ../lib/packagekit-glib2/pk-console-shared.c:450
msgid "Blocked"
-msgstr "Zablokované"
+msgstr "Zablokovaná"
#. TRANSLATORS: The state of a package
#. TRANSLATORS: The action of the package, in past tense
@@ -1505,7 +1504,7 @@ msgstr "VyÄistené"
#. TRANSLATORS: The action of the package, in past tense
#: ../lib/packagekit-glib2/pk-console-shared.c:540
msgid "Obsoleted"
-msgstr "OZnaÄené ako zastaralé"
+msgstr "OznaÄené ako zastarané"
#. TRANSLATORS: The action of the package, in past tense
#: ../lib/packagekit-glib2/pk-console-shared.c:544
@@ -1635,7 +1634,7 @@ msgstr "PrijÃma sa EULA"
#. TRANSLATORS: The role of the transaction, in present tense
#: ../lib/packagekit-glib2/pk-console-shared.c:674
msgid "Getting upgrades"
-msgstr "ZÃskavajú sa aktualizácie"
+msgstr "ZÃskavajú sa aktualizácie systému"
#. TRANSLATORS: The role of the transaction, in present tense
#: ../lib/packagekit-glib2/pk-console-shared.c:678
@@ -1807,15 +1806,21 @@ msgstr "Nasledujúce balÃky budú musieÅ¥ byÅ¥ preinÅ¡talované:"
#. TRANSLATORS: When processing, we might have to downgrade other dependencies
#: ../lib/packagekit-glib2/pk-task-text.c:320
msgid "The following packages have to be downgraded:"
-msgstr "Bude potrebné nainÅ¡talovaÅ¥ starÅ¡iu verziu nasledovných balÃkov:"
+msgstr "Bude potrebné nainÅ¡talovaÅ¥ starÅ¡iu verziu nasledujúcich balÃkov:"
+
+#. TRANSLATORS: When processing, untrusted and non-verified packages may be
+#. encountered
+#: ../lib/packagekit-glib2/pk-task-text.c:325
+msgid "The following packages are untrusted:"
+msgstr "Nasledujúce balÃky sú nedôveryhodné:"
#. TRANSLATORS: ask the user if the proposed changes are okay
-#: ../lib/packagekit-glib2/pk-task-text.c:380
+#: ../lib/packagekit-glib2/pk-task-text.c:385
msgid "Proceed with changes?"
msgstr "Vykonať zmeny?"
#. TRANSLATORS: tell the user we didn't do anything
-#: ../lib/packagekit-glib2/pk-task-text.c:385
+#: ../lib/packagekit-glib2/pk-task-text.c:390
msgid "The transaction did not proceed."
msgstr "Transakcia neprebehla."
@@ -1850,7 +1855,7 @@ msgid ""
"Authentication is required to change the location used to decompress "
"packages"
msgstr ""
-"Na zmenu adresára, kde sa rozbaľujú balÃky je potrebné overenie totožnosti"
+"Na zmenu adresára, kam sa rozbaľujú balÃky, je potrebné overenie totožnosti"
#: ../policy/org.freedesktop.packagekit.policy.in.h:12
msgid ""
@@ -2028,100 +2033,65 @@ msgstr "AktualizovaÅ¥ balÃky"
msgid "Upgrade System"
msgstr "Aktualizovať systém"
-#. TRANSLATORS: failed due to DBus security
-#: ../src/pk-main.c:91
-msgid "Startup failed due to security policies on this machine."
-msgstr "BezpeÄnostné politky tohto poÄÃtaÄa zabránili spusteniu."
-
-#. TRANSLATORS: only two ways this can fail...
-#: ../src/pk-main.c:93
-msgid "This can happen for two reasons:"
-msgstr "Toto môže nastať z dvoch dôvodov:"
-
-#. TRANSLATORS: only allowed to be owned by root
-#: ../src/pk-main.c:95
-msgid "The correct user is not launching the executable (usually root)"
-msgstr "Program nebol spustený správnym použÃvateľom (obvykle root)"
-
-#. TRANSLATORS: or we are installed in a prefix
-#: ../src/pk-main.c:97
-msgid ""
-"The org.freedesktop.PackageKit.conf file is not installed in the system "
-"directory:"
-msgstr ""
-"Súbor org.freedesktop.PackageKit.conf nie je nainštalovaný v systémovom "
-"prieÄinku:"
-
#. TRANSLATORS: a backend is the system package tool, e.g. yum, apt
-#: ../src/pk-main.c:223
+#: ../src/pk-main.c:148
msgid "Packaging backend to use, e.g. dummy"
msgstr "Rozhranie balÃkového systému, ktoré sa má použiÅ¥, naprÃklad âdummyâ"
#. TRANSLATORS: if we should run in the background
-#: ../src/pk-main.c:226
+#: ../src/pk-main.c:151
msgid "Daemonize and detach from the terminal"
msgstr "Uvoľniť terminál a presunúť sa na pozadie"
#. TRANSLATORS: if we should not monitor how long we are inactive for
-#: ../src/pk-main.c:229
+#: ../src/pk-main.c:154
msgid "Disable the idle timer"
msgstr "Vypnúť poÄÃtadlo Äasu neÄinnosti"
#. TRANSLATORS: show version
-#: ../src/pk-main.c:232
+#: ../src/pk-main.c:157
msgid "Show version and exit"
msgstr "ZobraziÅ¥ verziu a skonÄiÅ¥"
#. TRANSLATORS: exit after we've started up, used for user profiling
-#: ../src/pk-main.c:235
+#: ../src/pk-main.c:160
msgid "Exit after a small delay"
msgstr "SkonÄiÅ¥ po krátkej prestávke"
#. TRANSLATORS: exit straight away, used for automatic profiling
-#: ../src/pk-main.c:238
+#: ../src/pk-main.c:163
msgid "Exit after the engine has loaded"
msgstr "SkonÄiÅ¥ po naÄÃtanà jadra"
#. TRANSLATORS: describing the service that is running
-#: ../src/pk-main.c:253
+#: ../src/pk-main.c:177
msgid "PackageKit service"
msgstr "Služba PackageKit"
-#. TRANSLATORS: fatal error, dbus is not running
-#: ../src/pk-main.c:298
-msgid "Cannot connect to the system bus"
-msgstr "Pokus o pripojenie k systémovej zbernici neuspel"
-
-#: ../src/pk-main.c:344
+#: ../src/pk-main.c:249
msgid "Failed to load any of the specified backends:"
-msgstr ""
-
-#. TRANSLATORS: cannot register on system bus, unknown reason -- geeky error
-#. follows
-#: ../src/pk-main.c:358
-msgid "Error trying to start:"
-msgstr "Chyba pri pokuse o spustenie:"
+msgstr "Nepodarilo sa naÄÃtaÅ¥ žiadne z uvedených rozhranÃ:"
#. TRANSLATORS: is not GPG signed
-#: ../src/pk-transaction.c:2611 ../src/pk-transaction.c:2618
+#: ../src/pk-transaction.c:2659
msgid "The software is not from a trusted source."
msgstr "Tento softvér nepochádza z dôveryhodného zdroja."
-#: ../src/pk-transaction.c:2623
+#: ../src/pk-transaction.c:2667
msgid "Do not update this package unless you are sure it is safe to do so."
msgstr ""
"Neaktualizujte tento balÃk, pokiaľ si nie ste istý, že to je bezpeÄné."
-#: ../src/pk-transaction.c:2624
+#: ../src/pk-transaction.c:2668
msgid "Do not update these packages unless you are sure it is safe to do so."
msgstr ""
"Neaktualizujte tieto balÃky, pokiaľ si nie ste istý, že to je bezpeÄné."
-#: ../src/pk-transaction.c:2634
+#: ../src/pk-transaction.c:2678
msgid "Do not install this package unless you are sure it is safe to do so."
msgstr "NeinÅ¡talujte tento balÃk, pokiaľ si nie ste istý, že to je bezpeÄné."
-#: ../src/pk-transaction.c:2635
+#: ../src/pk-transaction.c:2679
msgid "Do not install these packages unless you are sure it is safe to do so."
msgstr "NeinÅ¡talujte tieto balÃky, pokiaľ si nie ste istý, že to je bezpeÄné."
diff --git a/po/sv.po b/po/sv.po
index 7caf7bd..5bc6511 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -2,14 +2,15 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
-# Daniel Nylander <po at danielnylander.se>, 2011
-# Richard Hughes <richard at hughsie.com>, 2011
+# Translators:
+# Daniel Nylander <po at danielnylander.se>, 2008, 2009, 2010, 2011.
+# Richard Hughes <richard at hughsie.com>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-04 10:50+0100\n"
-"PO-Revision-Date: 2011-06-04 08:24+0000\n"
+"POT-Creation-Date: 2011-09-05 16:58+0100\n"
+"PO-Revision-Date: 2011-10-08 05:32+0000\n"
"Last-Translator: yeager <po at danielnylander.se>\n"
"Language-Team: Swedish (http://www.transifex.net/projects/p/freedesktop/team/sv/)\n"
"MIME-Version: 1.0\n"
@@ -286,7 +287,7 @@ msgstr "Det finns inga paket att uppdatera."
#. TRANSLATORS: the transaction failed in a way we could not expect
#: ../client/pk-console.c:704
-#: ../contrib/command-not-found/pk-command-not-found.c:639
+#: ../contrib/command-not-found/pk-command-not-found.c:634
msgid "The transaction failed"
msgstr "Transaktionen misslyckades"
@@ -724,159 +725,154 @@ msgid "PackageKit Monitor"
msgstr "Ãvervakare för PackageKit"
#. TRANSLATORS: when we are getting data from the daemon
-#: ../contrib/browser-plugin/pk-plugin-install.c:499
+#: ../contrib/browser-plugin/pk-plugin-install.c:503
msgid "Getting package information..."
msgstr "Hämtar paketinformation..."
#. TRANSLATORS: run an applicaiton
-#: ../contrib/browser-plugin/pk-plugin-install.c:505
+#: ../contrib/browser-plugin/pk-plugin-install.c:509
#, c-format
msgid "Run %s"
msgstr "Kör %s"
#. TRANSLATORS: show the installed version of a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:511
+#: ../contrib/browser-plugin/pk-plugin-install.c:515
msgid "Installed version"
msgstr "Installerad version"
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:519
+#: ../contrib/browser-plugin/pk-plugin-install.c:523
#, c-format
msgid "Run version %s now"
msgstr "Kör version %s nu"
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:525
+#: ../contrib/browser-plugin/pk-plugin-install.c:529
msgid "Run now"
msgstr "Kör nu"
#. TRANSLATORS: update to a new version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:531
+#: ../contrib/browser-plugin/pk-plugin-install.c:535
#, c-format
msgid "Update to version %s"
msgstr "Uppdatera till version %s"
#. TRANSLATORS: To install a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:537
+#: ../contrib/browser-plugin/pk-plugin-install.c:541
#, c-format
msgid "Install %s now"
msgstr "Installera %s nu"
#. TRANSLATORS: the version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:540
+#: ../contrib/browser-plugin/pk-plugin-install.c:544
msgid "Version"
msgstr "Version"
#. TRANSLATORS: noting found, so can't install
-#: ../contrib/browser-plugin/pk-plugin-install.c:545
+#: ../contrib/browser-plugin/pk-plugin-install.c:549
msgid "No packages found for your system"
msgstr "Inga paket hittades för ditt system"
#. TRANSLATORS: package is being installed
-#: ../contrib/browser-plugin/pk-plugin-install.c:550
+#: ../contrib/browser-plugin/pk-plugin-install.c:554
msgid "Installing..."
msgstr "Installerar..."
#. TRANSLATORS: downloading repo data so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:366
+#: ../contrib/command-not-found/pk-command-not-found.c:363
msgid "Downloading details about the software sources."
msgstr "Hämtar detaljer om programkällorna."
#. TRANSLATORS: downloading file lists so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:370
+#: ../contrib/command-not-found/pk-command-not-found.c:367
msgid "Downloading filelists (this may take some time to complete)."
msgstr "Hämtar fillistor (detta kan ta lite tid att färdigställa)."
#. TRANSLATORS: waiting for native lock
-#: ../contrib/command-not-found/pk-command-not-found.c:374
+#: ../contrib/command-not-found/pk-command-not-found.c:371
msgid "Waiting for package manager lock."
msgstr "Väntar på låset för pakethanteraren."
#. TRANSLATORS: loading package cache so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:378
+#: ../contrib/command-not-found/pk-command-not-found.c:375
msgid "Loading list of packages."
msgstr "Läser in lista över paket."
#. TRANSLATORS: we failed to find the package, this shouldn't happen
-#: ../contrib/command-not-found/pk-command-not-found.c:444
+#: ../contrib/command-not-found/pk-command-not-found.c:439
msgid "Failed to search for file"
msgstr "Misslyckades med att söka efter filen"
#. TRANSLATORS: the transaction failed in a way we could not expect
-#: ../contrib/command-not-found/pk-command-not-found.c:456
+#: ../contrib/command-not-found/pk-command-not-found.c:451
msgid "Getting the list of files failed"
msgstr "Hämtning av fillistorna misslyckades"
#. TRANSLATORS: we failed to launch the executable, the error follows
-#: ../contrib/command-not-found/pk-command-not-found.c:602
+#: ../contrib/command-not-found/pk-command-not-found.c:597
msgid "Failed to launch:"
msgstr "Misslyckades med att starta:"
#. TRANSLATORS: we failed to install the package
-#: ../contrib/command-not-found/pk-command-not-found.c:630
+#: ../contrib/command-not-found/pk-command-not-found.c:625
msgid "Failed to install packages"
msgstr "Misslyckades med att installera paket"
-#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/command-not-found/pk-command-not-found.c:706
-msgid "PackageKit Command Not Found"
-msgstr "PackageKit - Kommandot hittades inte"
-
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:723
msgid "command not found"
msgstr "kommandot hittades inte"
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:759
+#: ../contrib/command-not-found/pk-command-not-found.c:741
msgid "Similar command is:"
msgstr "Liknande kommando är:"
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:773
+#: ../contrib/command-not-found/pk-command-not-found.c:755
msgid "Run similar command:"
msgstr "Kör liknande command:"
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:787
-#: ../contrib/command-not-found/pk-command-not-found.c:796
+#: ../contrib/command-not-found/pk-command-not-found.c:769
+#: ../contrib/command-not-found/pk-command-not-found.c:778
msgid "Similar commands are:"
msgstr "Liknande kommandon är:"
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:785
msgid "Please choose a command to run"
msgstr "Välj ett kommando att köra"
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:821
+#: ../contrib/command-not-found/pk-command-not-found.c:803
msgid "The package providing this file is:"
msgstr "Paketet som tillhandahåller denna fil är:"
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:828
+#: ../contrib/command-not-found/pk-command-not-found.c:810
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr "Installera paketet \"%s\" för att tillhandahålla kommandot \"%s\"?"
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:855
+#: ../contrib/command-not-found/pk-command-not-found.c:837
msgid "Packages providing this file are:"
msgstr "Paket som tillhandahåller denna fil är:"
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:865
+#: ../contrib/command-not-found/pk-command-not-found.c:847
msgid "Suitable packages are:"
msgstr "Lämpliga paket är:"
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:874
+#: ../contrib/command-not-found/pk-command-not-found.c:856
msgid "Please choose a package to install"
msgstr "Välj ett paket att installera"
@@ -1802,13 +1798,19 @@ msgstr "Följande paket måste installeras om:"
msgid "The following packages have to be downgraded:"
msgstr "Följande paket måste nedgraderas:"
+#. TRANSLATORS: When processing, untrusted and non-verified packages may be
+#. encountered
+#: ../lib/packagekit-glib2/pk-task-text.c:325
+msgid "The following packages are untrusted:"
+msgstr "Följande paket är inte pålitliga:"
+
#. TRANSLATORS: ask the user if the proposed changes are okay
-#: ../lib/packagekit-glib2/pk-task-text.c:380
+#: ../lib/packagekit-glib2/pk-task-text.c:385
msgid "Proceed with changes?"
msgstr "Fortsätt med ändringar?"
#. TRANSLATORS: tell the user we didn't do anything
-#: ../lib/packagekit-glib2/pk-task-text.c:385
+#: ../lib/packagekit-glib2/pk-task-text.c:390
msgid "The transaction did not proceed."
msgstr "Transaktionen fortsatte inte."
@@ -2020,102 +2022,67 @@ msgstr "Uppdatera paket"
msgid "Upgrade System"
msgstr "Uppgradera systemet"
-#. TRANSLATORS: failed due to DBus security
-#: ../src/pk-main.c:91
-msgid "Startup failed due to security policies on this machine."
-msgstr "Uppstart misslyckades på grund av en säkerhetspolicy på denna dator."
-
-#. TRANSLATORS: only two ways this can fail...
-#: ../src/pk-main.c:93
-msgid "This can happen for two reasons:"
-msgstr "Detta kan inträffa av två anledningar:"
-
-#. TRANSLATORS: only allowed to be owned by root
-#: ../src/pk-main.c:95
-msgid "The correct user is not launching the executable (usually root)"
-msgstr ""
-"Den korrekta användaren startar inte den körbara filen (vanligtvis root)"
-
-#. TRANSLATORS: or we are installed in a prefix
-#: ../src/pk-main.c:97
-msgid ""
-"The org.freedesktop.PackageKit.conf file is not installed in the system "
-"directory:"
-msgstr ""
-"Filen org.freedesktop.PackageKit.conf är inte installerad i systemkatalogen:"
-
#. TRANSLATORS: a backend is the system package tool, e.g. yum, apt
-#: ../src/pk-main.c:223
+#: ../src/pk-main.c:148
msgid "Packaging backend to use, e.g. dummy"
msgstr "Paketingsbakände att använda, t.ex. dummy"
#. TRANSLATORS: if we should run in the background
-#: ../src/pk-main.c:226
+#: ../src/pk-main.c:151
msgid "Daemonize and detach from the terminal"
msgstr "Kör som bakgrundsprocess och koppla loss från terminalen"
#. TRANSLATORS: if we should not monitor how long we are inactive for
-#: ../src/pk-main.c:229
+#: ../src/pk-main.c:154
msgid "Disable the idle timer"
msgstr "Inaktivera tidsgräns för inaktivitet"
#. TRANSLATORS: show version
-#: ../src/pk-main.c:232
+#: ../src/pk-main.c:157
msgid "Show version and exit"
msgstr "Visa version och avsluta"
#. TRANSLATORS: exit after we've started up, used for user profiling
-#: ../src/pk-main.c:235
+#: ../src/pk-main.c:160
msgid "Exit after a small delay"
msgstr "Avsluta efter en mindre fördröjning"
#. TRANSLATORS: exit straight away, used for automatic profiling
-#: ../src/pk-main.c:238
+#: ../src/pk-main.c:163
msgid "Exit after the engine has loaded"
msgstr "Avsluta efter att motorn har lästs in"
#. TRANSLATORS: describing the service that is running
-#: ../src/pk-main.c:253
+#: ../src/pk-main.c:177
msgid "PackageKit service"
msgstr "PackageKit-tjänst"
-#. TRANSLATORS: fatal error, dbus is not running
-#: ../src/pk-main.c:298
-msgid "Cannot connect to the system bus"
-msgstr "Kan inte ansluta till systembussen"
-
-#: ../src/pk-main.c:344
+#: ../src/pk-main.c:249
msgid "Failed to load any of the specified backends:"
msgstr "Misslyckades med att läsa in angivna bakändor:"
-#. TRANSLATORS: cannot register on system bus, unknown reason -- geeky error
-#. follows
-#: ../src/pk-main.c:358
-msgid "Error trying to start:"
-msgstr "Fel vid försök att starta:"
-
#. TRANSLATORS: is not GPG signed
-#: ../src/pk-transaction.c:2611 ../src/pk-transaction.c:2618
+#: ../src/pk-transaction.c:2659
msgid "The software is not from a trusted source."
msgstr "Programvaran kommer inte från en pålitlig källa."
-#: ../src/pk-transaction.c:2623
+#: ../src/pk-transaction.c:2667
msgid "Do not update this package unless you are sure it is safe to do so."
msgstr ""
"Uppdatera inte detta paket såvida inte du vet att det är säkert att göra så."
-#: ../src/pk-transaction.c:2624
+#: ../src/pk-transaction.c:2668
msgid "Do not update these packages unless you are sure it is safe to do so."
msgstr ""
"Uppdatera inte dessa paket såvida inte du vet att det är säkert att göra så."
-#: ../src/pk-transaction.c:2634
+#: ../src/pk-transaction.c:2678
msgid "Do not install this package unless you are sure it is safe to do so."
msgstr ""
"Installera inte detta paket såvida inte du vet att det är säkert att göra "
"så."
-#: ../src/pk-transaction.c:2635
+#: ../src/pk-transaction.c:2679
msgid "Do not install these packages unless you are sure it is safe to do so."
msgstr ""
"Installera inte dessa paket såvida inte du vet att det är säkert att göra "
diff --git a/po/wa.po b/po/wa.po
index 8837d33..41b7e6e 100644
--- a/po/wa.po
+++ b/po/wa.po
@@ -2,12 +2,13 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
+# Translators:
msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-08-01 10:58+0100\n"
-"PO-Revision-Date: 2011-09-05 15:41+0000\n"
+"POT-Creation-Date: 2011-09-05 16:58+0100\n"
+"PO-Revision-Date: 2010-12-13 12:37+0000\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: Walloon (http://www.transifex.net/projects/p/freedesktop/team/wa/)\n"
"MIME-Version: 1.0\n"
@@ -284,7 +285,7 @@ msgstr ""
#. TRANSLATORS: the transaction failed in a way we could not expect
#: ../client/pk-console.c:704
-#: ../contrib/command-not-found/pk-command-not-found.c:639
+#: ../contrib/command-not-found/pk-command-not-found.c:634
msgid "The transaction failed"
msgstr ""
@@ -710,154 +711,154 @@ msgid "PackageKit Monitor"
msgstr ""
#. TRANSLATORS: when we are getting data from the daemon
-#: ../contrib/browser-plugin/pk-plugin-install.c:499
+#: ../contrib/browser-plugin/pk-plugin-install.c:503
msgid "Getting package information..."
msgstr ""
#. TRANSLATORS: run an applicaiton
-#: ../contrib/browser-plugin/pk-plugin-install.c:505
+#: ../contrib/browser-plugin/pk-plugin-install.c:509
#, c-format
msgid "Run %s"
msgstr ""
#. TRANSLATORS: show the installed version of a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:511
+#: ../contrib/browser-plugin/pk-plugin-install.c:515
msgid "Installed version"
msgstr ""
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:519
+#: ../contrib/browser-plugin/pk-plugin-install.c:523
#, c-format
msgid "Run version %s now"
msgstr ""
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:525
+#: ../contrib/browser-plugin/pk-plugin-install.c:529
msgid "Run now"
msgstr ""
#. TRANSLATORS: update to a new version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:531
+#: ../contrib/browser-plugin/pk-plugin-install.c:535
#, c-format
msgid "Update to version %s"
msgstr ""
#. TRANSLATORS: To install a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:537
+#: ../contrib/browser-plugin/pk-plugin-install.c:541
#, c-format
msgid "Install %s now"
msgstr ""
#. TRANSLATORS: the version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:540
+#: ../contrib/browser-plugin/pk-plugin-install.c:544
msgid "Version"
msgstr ""
#. TRANSLATORS: noting found, so can't install
-#: ../contrib/browser-plugin/pk-plugin-install.c:545
+#: ../contrib/browser-plugin/pk-plugin-install.c:549
msgid "No packages found for your system"
msgstr ""
#. TRANSLATORS: package is being installed
-#: ../contrib/browser-plugin/pk-plugin-install.c:550
+#: ../contrib/browser-plugin/pk-plugin-install.c:554
msgid "Installing..."
msgstr ""
#. TRANSLATORS: downloading repo data so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:366
+#: ../contrib/command-not-found/pk-command-not-found.c:363
msgid "Downloading details about the software sources."
msgstr ""
#. TRANSLATORS: downloading file lists so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:370
+#: ../contrib/command-not-found/pk-command-not-found.c:367
msgid "Downloading filelists (this may take some time to complete)."
msgstr ""
#. TRANSLATORS: waiting for native lock
-#: ../contrib/command-not-found/pk-command-not-found.c:374
+#: ../contrib/command-not-found/pk-command-not-found.c:371
msgid "Waiting for package manager lock."
msgstr ""
#. TRANSLATORS: loading package cache so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:378
+#: ../contrib/command-not-found/pk-command-not-found.c:375
msgid "Loading list of packages."
msgstr ""
#. TRANSLATORS: we failed to find the package, this shouldn't happen
-#: ../contrib/command-not-found/pk-command-not-found.c:444
+#: ../contrib/command-not-found/pk-command-not-found.c:439
msgid "Failed to search for file"
msgstr ""
#. TRANSLATORS: the transaction failed in a way we could not expect
-#: ../contrib/command-not-found/pk-command-not-found.c:456
+#: ../contrib/command-not-found/pk-command-not-found.c:451
msgid "Getting the list of files failed"
msgstr ""
#. TRANSLATORS: we failed to launch the executable, the error follows
-#: ../contrib/command-not-found/pk-command-not-found.c:602
+#: ../contrib/command-not-found/pk-command-not-found.c:597
msgid "Failed to launch:"
msgstr ""
#. TRANSLATORS: we failed to install the package
-#: ../contrib/command-not-found/pk-command-not-found.c:630
+#: ../contrib/command-not-found/pk-command-not-found.c:625
msgid "Failed to install packages"
msgstr ""
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:729
+#: ../contrib/command-not-found/pk-command-not-found.c:723
msgid "command not found"
msgstr ""
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:747
+#: ../contrib/command-not-found/pk-command-not-found.c:741
msgid "Similar command is:"
msgstr ""
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:761
+#: ../contrib/command-not-found/pk-command-not-found.c:755
msgid "Run similar command:"
msgstr ""
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:775
-#: ../contrib/command-not-found/pk-command-not-found.c:784
+#: ../contrib/command-not-found/pk-command-not-found.c:769
+#: ../contrib/command-not-found/pk-command-not-found.c:778
msgid "Similar commands are:"
msgstr ""
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:791
+#: ../contrib/command-not-found/pk-command-not-found.c:785
msgid "Please choose a command to run"
msgstr ""
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:809
+#: ../contrib/command-not-found/pk-command-not-found.c:803
msgid "The package providing this file is:"
msgstr ""
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:816
+#: ../contrib/command-not-found/pk-command-not-found.c:810
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:843
+#: ../contrib/command-not-found/pk-command-not-found.c:837
msgid "Packages providing this file are:"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:853
+#: ../contrib/command-not-found/pk-command-not-found.c:847
msgid "Suitable packages are:"
msgstr ""
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:862
+#: ../contrib/command-not-found/pk-command-not-found.c:856
msgid "Please choose a package to install"
msgstr ""
@@ -1998,96 +1999,63 @@ msgstr ""
msgid "Upgrade System"
msgstr ""
-#. TRANSLATORS: failed due to DBus security
-#: ../src/pk-main.c:91
-msgid "Startup failed due to security policies on this machine."
-msgstr ""
-
-#. TRANSLATORS: only two ways this can fail...
-#: ../src/pk-main.c:93
-msgid "This can happen for two reasons:"
-msgstr ""
-
-#. TRANSLATORS: only allowed to be owned by root
-#: ../src/pk-main.c:95
-msgid "The correct user is not launching the executable (usually root)"
-msgstr ""
-
-#. TRANSLATORS: or we are installed in a prefix
-#: ../src/pk-main.c:97
-msgid ""
-"The org.freedesktop.PackageKit.conf file is not installed in the system "
-"directory:"
-msgstr ""
-
#. TRANSLATORS: a backend is the system package tool, e.g. yum, apt
-#: ../src/pk-main.c:223
+#: ../src/pk-main.c:148
msgid "Packaging backend to use, e.g. dummy"
msgstr ""
#. TRANSLATORS: if we should run in the background
-#: ../src/pk-main.c:226
+#: ../src/pk-main.c:151
msgid "Daemonize and detach from the terminal"
msgstr ""
#. TRANSLATORS: if we should not monitor how long we are inactive for
-#: ../src/pk-main.c:229
+#: ../src/pk-main.c:154
msgid "Disable the idle timer"
msgstr ""
#. TRANSLATORS: show version
-#: ../src/pk-main.c:232
+#: ../src/pk-main.c:157
msgid "Show version and exit"
msgstr ""
#. TRANSLATORS: exit after we've started up, used for user profiling
-#: ../src/pk-main.c:235
+#: ../src/pk-main.c:160
msgid "Exit after a small delay"
msgstr ""
#. TRANSLATORS: exit straight away, used for automatic profiling
-#: ../src/pk-main.c:238
+#: ../src/pk-main.c:163
msgid "Exit after the engine has loaded"
msgstr ""
#. TRANSLATORS: describing the service that is running
-#: ../src/pk-main.c:253
+#: ../src/pk-main.c:177
msgid "PackageKit service"
msgstr ""
-#. TRANSLATORS: fatal error, dbus is not running
-#: ../src/pk-main.c:298
-msgid "Cannot connect to the system bus"
-msgstr ""
-
-#: ../src/pk-main.c:344
+#: ../src/pk-main.c:249
msgid "Failed to load any of the specified backends:"
msgstr ""
-#. TRANSLATORS: cannot register on system bus, unknown reason -- geeky error
-#. follows
-#: ../src/pk-main.c:358
-msgid "Error trying to start:"
-msgstr ""
-
#. TRANSLATORS: is not GPG signed
-#: ../src/pk-transaction.c:2611 ../src/pk-transaction.c:2618
+#: ../src/pk-transaction.c:2659
msgid "The software is not from a trusted source."
msgstr ""
-#: ../src/pk-transaction.c:2623
+#: ../src/pk-transaction.c:2667
msgid "Do not update this package unless you are sure it is safe to do so."
msgstr ""
-#: ../src/pk-transaction.c:2624
+#: ../src/pk-transaction.c:2668
msgid "Do not update these packages unless you are sure it is safe to do so."
msgstr ""
-#: ../src/pk-transaction.c:2634
+#: ../src/pk-transaction.c:2678
msgid "Do not install this package unless you are sure it is safe to do so."
msgstr ""
-#: ../src/pk-transaction.c:2635
+#: ../src/pk-transaction.c:2679
msgid "Do not install these packages unless you are sure it is safe to do so."
msgstr ""
commit a2861778339cc2348e1b63c4f9b97b36ccf14f03
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Nov 1 11:07:55 2011 +0000
zif: Don't call zif_init() in newer versions of the library
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 3996722..6e7162b 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -1596,8 +1596,10 @@ pk_backend_initialize (PkBackend *backend)
g_list_foreach (mounts, (GFunc) g_object_unref, NULL);
g_list_free (mounts);
+#if !ZIF_CHECK_VERSION(0,2,6)
/* init rpm */
zif_init ();
+#endif
/* TODO: hook up errors */
priv->cancellable = g_cancellable_new ();
commit 546d0f4093466f0f58361e048029b0554dc54675
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Wed Nov 9 18:56:54 2011 +0100
Check if a transaction should be skipped after it has started too.
This allows plugins to skip a transaction *after* the
backend has been initialized and the transaction is about
to begin.
This is very useful in some cases.
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 850284a..11028b8 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -1971,7 +1971,8 @@ pk_transaction_run (PkTransaction *transaction)
/* is an error code set? */
if (pk_backend_get_is_error_set (priv->backend)) {
- pk_transaction_finished_emit (transaction, PK_EXIT_ENUM_FAILED, 0);
+ exit_status = pk_backend_get_exit_code (priv->backend);
+ pk_transaction_finished_emit (transaction, exit_status, 0);
/* do not fail the transaction */
ret = TRUE;
@@ -2066,8 +2067,17 @@ pk_transaction_run (PkTransaction *transaction)
pk_transaction_plugin_phase (transaction,
PK_PLUGIN_PHASE_TRANSACTION_STARTED);
- /* did the plugin finish or abort the transaction */
+ /* check again if we should skip this transaction */
exit_status = pk_backend_get_exit_code (priv->backend);
+ if (exit_status == PK_EXIT_ENUM_SKIP_TRANSACTION) {
+ pk_transaction_finished_emit (transaction, PK_EXIT_ENUM_SUCCESS, 0);
+
+ /* do not fail the transaction */
+ ret = TRUE;
+ goto out;
+ }
+
+ /* did the plugin finish or abort the transaction? */
if (exit_status != PK_EXIT_ENUM_UNKNOWN) {
pk_transaction_finished_emit (transaction, exit_status, 0);
ret = TRUE;
commit 2950196e835cdca98ccf7bb52cc9481b29f5c870
Author: Daniel Nicoletti <dantti85-pk at yahoo.com.br>
Date: Wed Nov 9 12:27:23 2011 -0200
packagekit-qt: Drop packagekit-qt1 which is obsolete in favor of packagekit-qt2
diff --git a/configure.ac b/configure.ac
index aaae6d5..7873d77 100644
--- a/configure.ac
+++ b/configure.ac
@@ -771,11 +771,6 @@ lib/Makefile
lib/packagekit-glib2/pk-version.h
lib/packagekit-glib2/Makefile
lib/packagekit-glib2/packagekit-glib2.pc
-lib/packagekit-qt/Makefile
-lib/packagekit-qt/modules/Makefile
-lib/packagekit-qt/src/Makefile
-lib/packagekit-qt/test/Makefile
-lib/packagekit-qt/packagekit-qt.pc
lib/packagekit-qt2/Makefile
lib/packagekit-qt2/modules/Makefile
lib/packagekit-qt2/modules/packagekit-qt2-config.cmake
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 974bab7..64d28fc 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,10 +1,6 @@
SUBDIRS = python packagekit-glib2
if PK_BUILD_QT
-SUBDIRS += packagekit-qt
-endif
-
-if PK_BUILD_QT
SUBDIRS += packagekit-qt2
endif
diff --git a/lib/packagekit-qt/Doxyfile b/lib/packagekit-qt/Doxyfile
deleted file mode 100644
index 388a083..0000000
--- a/lib/packagekit-qt/Doxyfile
+++ /dev/null
@@ -1,1258 +0,0 @@
-# Doxyfile 1.5.2
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file that
-# follow. The default is UTF-8 which is also the encoding used for all text before
-# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into
-# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of
-# possible encodings.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = QPackageKit
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER = 2.0
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = ../../docs/packagekit-qt
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian,
-# Italian, Japanese, Japanese-en (Japanese with English messages), Korean,
-# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian,
-# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF =
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like the Qt-style comments (thus requiring an
-# explicit @brief command for a brief description.
-
-JAVADOC_AUTOBRIEF = YES
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member
-# documentation.
-
-DETAILS_AT_TOP = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for Java.
-# For instance, namespaces will be presented as packages, qualified scopes
-# will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to
-# include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT = NO
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = YES
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = NO
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = YES
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = NO
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from the
-# version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = ../../lib/packagekit-qt/src
-# This tag can be used to specify the character encoding of the source files that
-# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default
-# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding.
-# See http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py
-
-FILE_PATTERNS =
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = NO
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE =
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS = *private* *proxy* polkitclient* util.*
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the output.
-# The symbol name can be a fully qualified name, a word, or if the wildcard * is used,
-# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test
-
-# Exlude signal wrappers
-EXCLUDE_SYMBOLS =
-EXCLUDE_SYMBOLS += __emit*
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output. If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES (the default)
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES (the default)
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code. Otherwise they will link to the documentstion.
-
-REFERENCES_LINK_SOURCE = NO
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = NO
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = NO
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
-# generated containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
-# probably better off using the HTML help feature.
-
-GENERATE_TREEVIEW = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = YES
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader. This is useful
-# if you want to understand what is going on. On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = NO
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED =
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = YES
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to
-# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to
-# specify the directory where the mscgen tool resides. If left empty the tool is assumed to
-# be found in the default search path.
-
-MSCGEN_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
-# generate a call dependency graph for every global function or class method.
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable call graphs for selected
-# functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will
-# generate a caller dependency graph for every global function or class method.
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable caller graphs for selected
-# functions only using the \callergraph command.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen will always
-# show the root nodes and its direct children regardless of this setting.
-
-DOT_GRAPH_MAX_NODES = 50
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, which results in a white background.
-# Warning: Depending on the platform used, enabling this option may lead to
-# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
-# read).
-
-DOT_TRANSPARENT = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE = NO
diff --git a/lib/packagekit-qt/Makefile.am b/lib/packagekit-qt/Makefile.am
deleted file mode 100644
index dc6fe8a..0000000
--- a/lib/packagekit-qt/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-SUBDIRS = modules src test
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = \
- packagekit-qt.pc \
- $(NULL)
-
-EXTRA_DIST = \
- packagekit-qt.pc.in \
- Doxyfile
-
-
--include $(top_srcdir)/git.mk
diff --git a/lib/packagekit-qt/modules/FindQPackageKit.cmake b/lib/packagekit-qt/modules/FindQPackageKit.cmake
deleted file mode 100644
index 5efc79a..0000000
--- a/lib/packagekit-qt/modules/FindQPackageKit.cmake
+++ /dev/null
@@ -1,40 +0,0 @@
-# - Try to find QPackageKit
-# Once done this will define
-#
-# QPACKAGEKIT_FOUND - system has QPackageKit
-# QPACKAGEKIT_INCLUDE_DIR - the QPackageKit include directory
-# QPACKAGEKIT_LIB - Link these to use QPackageKit
-# QPACKAGEKIT_DEFINITIONS - Compiler switches required for using QPackageKit
-
-# Copyright (c) 2008, Adrien Bustany, <madcat at mymadcat.com>
-#
-# Redistribution and use is allowed according to the terms of the GPLv2+ license.
-
-IF (QPACKAGEKIT_INCLUDE_DIR AND QPACKAGEKIT_LIB)
- SET(QPACKAGEKIT_FIND_QUIETLY TRUE)
-ENDIF (QPACKAGEKIT_INCLUDE_DIR AND QPACKAGEKIT_LIB)
-
-FIND_PATH( QPACKAGEKIT_INCLUDE_DIR PackageKit/packagekit-qt/QPackageKit )
-
-FIND_LIBRARY( QPACKAGEKIT_LIB NAMES packagekit-qt )
-
-IF (QPACKAGEKIT_INCLUDE_DIR AND QPACKAGEKIT_LIB)
- SET(QPACKAGEKIT_FOUND TRUE)
-ELSE (QPACKAGEKIT_INCLUDE_DIR AND QPACKAGEKIT_LIB)
- SET(QPACKAGEKIT_FOUND FALSE)
-ENDIF (QPACKAGEKIT_INCLUDE_DIR AND QPACKAGEKIT_LIB)
-
-SET(QPACKAGEKIT_INCLUDE_DIR ${QPACKAGEKIT_INCLUDE_DIR}/PackageKit/packagekit-qt)
-
-IF (QPACKAGEKIT_FOUND)
- IF (NOT QPACKAGEKIT_FIND_QUIETLY)
- MESSAGE(STATUS "Found QPackageKit: ${QPACKAGEKIT_LIB}")
- ENDIF (NOT QPACKAGEKIT_FIND_QUIETLY)
-ELSE (QPACKAGEKIT_FOUND)
- IF (QPACKAGEKIT_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "Could NOT find QPackageKit")
- ENDIF (QPACKAGEKIT_FIND_REQUIRED)
-ENDIF (QPACKAGEKIT_FOUND)
-
-MARK_AS_ADVANCED(QPACKAGEKIT_INCLUDE_DIR QPACKAGEKIT_LIB)
-
diff --git a/lib/packagekit-qt/modules/Makefile.am b/lib/packagekit-qt/modules/Makefile.am
deleted file mode 100644
index 9a10290..0000000
--- a/lib/packagekit-qt/modules/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-cmakemoduledir = $(datadir)/cmake/Modules
-cmakemodule_DATA = \
- FindQPackageKit.cmake \
- $(NULL)
-
-EXTRA_DIST = \
- $(cmakemodule_DATA)
-
-
--include $(top_srcdir)/git.mk
diff --git a/lib/packagekit-qt/packagekit-qt.pc.in b/lib/packagekit-qt/packagekit-qt.pc.in
deleted file mode 100644
index 5e308aa..0000000
--- a/lib/packagekit-qt/packagekit-qt.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: packagekit-qt
-Description: PackageKit is a system daemon for installing stuff.
-Version: @VERSION@
-Requires: QtCore, QtDBus, QtSql, QtXml
-Libs: -L${libdir} -lpackagekit-qt
-Cflags: -I${includedir}/PackageKit/packagekit-qt
-
diff --git a/lib/packagekit-qt/src/Makefile.am b/lib/packagekit-qt/src/Makefile.am
deleted file mode 100644
index a9d6528..0000000
--- a/lib/packagekit-qt/src/Makefile.am
+++ /dev/null
@@ -1,116 +0,0 @@
-include ${top_srcdir}/moc.mk
-
-.NOTPARALLEL:
-
-NULL =
-
-INCLUDES = \
- $(QTCORE_CFLAGS) \
- $(QTDBUS_CFLAGS) \
- $(QTSQL_CFLAGS) \
- -DLOCALSTATEDIR=\""$(localstatedir)"\" \
- -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
-
-METASOURCES = AUTO
-
-MOCFILES = \
- client.moc \
- clientprivate.moc \
- daemonproxy.moc \
- transactionproxy.moc \
- transaction.moc \
- transactionprivate.moc \
- enum.moc \
- $(NULL)
-
-lib_LTLIBRARIES = \
- libpackagekit-qt.la \
- $(NULL)
-
-libpackagekit_qt_includedir = $(includedir)/PackageKit/packagekit-qt
-
-libpackagekit_qt_include_HEADERS = \
- QPackageKit \
- client.h \
- transaction.h \
- package.h \
- bitfield.h \
- enum.h \
- $(NULL)
-
-libpackagekit_qt_la_SOURCES = \
- QPackageKit \
- common.h \
- client.h \
- client.cpp \
- clientprivate.h \
- clientprivate.cpp \
- daemonproxy.h \
- daemonproxy.cpp \
- transaction.h \
- transaction.cpp \
- transactionprivate.h \
- transactionprivate.cpp \
- transactionproxy.h \
- transactionproxy.cpp \
- package.h \
- package.cpp \
- util.h \
- util.cpp \
- bitfield.h \
- bitfield.cpp \
- enum.h \
- enum.cpp \
- dbus_proxies.stamp \
- $(NULL)
-
-libpackagekit_qt_la_LIBADD = \
- $(QTCORE_LIBS) \
- $(QTDBUS_LIBS) \
- $(QTSQL_LIBS) \
- $(NULL)
-
-libpackagekit_qt_la_CFLAGS = \
- $(WARNINGFLAGS_CPP) \
- $(NULL)
-
-libpackagekit_qt_la_LDFLAGS = \
- -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
- -export-dynamic \
- -no-undefined \
- $(NULL)
-
-CLEANFILES = $(BUILT_SOURCES)
-
-clean-local:
- rm -f *~
- rm -f $(CLEANFILES)
-
-EXTRA_DIST = \
- dbus_proxies.stamp \
- daemonproxy.h \
- daemonproxy.cpp \
- transactionproxy.h \
- transactionproxy.cpp \
- $(NULL)
-
-MAINTAINERCLEANFILES = \
- dbus_proxies.stamp \
- transactionproxy.h \
- transactionproxy.cpp \
- daemonproxy.h \
- daemonproxy.cpp \
- $(NULL)
-
-BUILT_SOURCES= \
- dbus_proxies.stamp \
- $(MOCFILES) \
- $(NULL)
-
-dbus_proxies.stamp: ${top_srcdir}/src/org.freedesktop.PackageKit.xml ${top_srcdir}/src/org.freedesktop.PackageKit.Transaction.xml
- qdbusxml2cpp -c DaemonProxy -p daemonproxy -m -N ${top_srcdir}/src/org.freedesktop.PackageKit.xml
- qdbusxml2cpp -c TransactionProxy -p transactionproxy -m -N ${top_srcdir}/src/org.freedesktop.PackageKit.Transaction.xml
- touch $@
-
-
--include $(top_srcdir)/git.mk
diff --git a/lib/packagekit-qt/src/QPackageKit b/lib/packagekit-qt/src/QPackageKit
deleted file mode 100644
index d92c226..0000000
--- a/lib/packagekit-qt/src/QPackageKit
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "client.h"
-#include "transaction.h"
-#include "package.h"
diff --git a/lib/packagekit-qt/src/bitfield.cpp b/lib/packagekit-qt/src/bitfield.cpp
deleted file mode 100644
index cc1c54e..0000000
--- a/lib/packagekit-qt/src/bitfield.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-#include "bitfield.h"
-
-using namespace PackageKit;
-
-Bitfield::Bitfield () : m_val (0)
-{
-}
-
-Bitfield::Bitfield (qint64 val) : m_val (val)
-{
-}
-
-Bitfield::~Bitfield ()
-{
-}
-
-qint64 Bitfield::operator& (qint64 mask) const
-{
- return m_val & (1 << mask);
-}
-
-qint64 Bitfield::operator&= (qint64 mask)
-{
- m_val &= (1 << mask);
- return m_val;
-}
-
-qint64 Bitfield::operator| (qint64 mask) const
-{
- return m_val | (1 << mask);
-}
-
-qint64 Bitfield::operator|= (qint64 mask)
-{
- m_val |= (1 << mask);
- return m_val;
-}
-
-Bitfield Bitfield::operator& (Bitfield mask) const
-{
- return m_val & mask.m_val;
-}
-
-Bitfield Bitfield::operator&= (Bitfield mask)
-{
- m_val &= mask.m_val;
- return m_val;
-}
-
-Bitfield Bitfield::operator| (Bitfield mask) const
-{
- return m_val | mask.m_val;
-}
-
-Bitfield Bitfield::operator|= (Bitfield mask)
-{
- m_val |= mask.m_val;
- return m_val;
-}
-
-
-Bitfield& Bitfield::operator= (const Bitfield& other)
-{
- if (this == &other)
- return *this;
-
- m_val = other.m_val;
-
- return *this;
-}
diff --git a/lib/packagekit-qt/src/bitfield.h b/lib/packagekit-qt/src/bitfield.h
deleted file mode 100644
index d7483a8..0000000
--- a/lib/packagekit-qt/src/bitfield.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef BITFIELD_H
-#define BITFIELD_H
-
-#include <QtGlobal>
-
-namespace PackageKit {
- class Bitfield
- {
- public:
- Bitfield ();
- Bitfield (qint64 val);
- ~Bitfield ();
-
- qint64 operator& (qint64 mask) const;
- qint64 operator&= (qint64 mask);
- qint64 operator| (qint64 mask) const;
- qint64 operator|= (qint64 mask);
-
- Bitfield operator& (Bitfield mask) const;
- Bitfield operator&= (Bitfield mask);
- Bitfield operator| (Bitfield mask) const;
- Bitfield operator|= (Bitfield mask);
-
- Bitfield& operator= (const Bitfield& other);
-
- private:
- qint64 m_val;
- };
-} // End namespace PackageKit
-
-#endif
diff --git a/lib/packagekit-qt/src/client.cpp b/lib/packagekit-qt/src/client.cpp
deleted file mode 100644
index fa263f8..0000000
--- a/lib/packagekit-qt/src/client.cpp
+++ /dev/null
@@ -1,587 +0,0 @@
-/*
- * This file is part of the QPackageKit project
- * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- * Copyright (C) 2010 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <QtSql>
-
-#include "client.h"
-#include "clientprivate.h"
-
-#include "common.h"
-#include "daemonproxy.h"
-#include "transaction.h"
-#include "transactionprivate.h"
-#include "package.h"
-#include "util.h"
-
-#define CREATE_NEW_TRANSACTION \
- Transaction* t = new Transaction(QString(), this); \
- if (t->tid().isEmpty()) { \
- setLastError(ErrorDaemonUnreachable); \
- return t; \
- } \
-
-#define RUN_TRANSACTION(blurb) \
- Q_D(Client); \
- CREATE_NEW_TRANSACTION \
- t->setHints(d->hints); \
- t->blurb; \
- return t; \
-
-#define PK_DESKTOP_DEFAULT_DATABASE LOCALSTATEDIR "/lib/PackageKit/desktop-files.db"
-
-using namespace PackageKit;
-
-Client* Client::m_instance = 0;
-
-template<class T> Client::DaemonError daemonErrorFromDBusReply (QDBusPendingReply<T> e) {
- return Util::errorFromString (e.error ().name ());
-}
-
-Client* Client::instance()
-{
- if(!m_instance)
- m_instance = new Client(qApp);
-
- return m_instance;
-}
-
-Client::Client(QObject* parent) : QObject(parent), d_ptr(new ClientPrivate(this))
-{
- Q_D(Client);
- d->daemon = new ::DaemonProxy(PK_NAME, PK_PATH, QDBusConnection::systemBus(), this);
-
- d->error = NoError;
-
- connect(d->daemon, SIGNAL(Changed()), this, SIGNAL(changed()));
- connect(d->daemon, SIGNAL(RepoListChanged()), this, SIGNAL(repoListChanged()));
- connect(d->daemon, SIGNAL(RestartSchedule()), this, SIGNAL(restartScheduled()));
- connect(d->daemon, SIGNAL(TransactionListChanged(const QStringList&)), d, SLOT(transactionListChanged(const QStringList&)));
- connect(d->daemon, SIGNAL(UpdatesChanged()), this, SIGNAL(updatesChanged()));
-
- // Set up database for desktop files
- QSqlDatabase db;
- db = QSqlDatabase::addDatabase("QSQLITE");
- db.setDatabaseName (PK_DESKTOP_DEFAULT_DATABASE);
- if (!db.open()) {
- qDebug() << "Failed to initialize the desktop files database";
- }
-}
-
-Client::~Client()
-{
-}
-
-Enum::Roles Client::actions() const
-{
- Q_D(const Client);
- QStringList roles = d->daemon->roles().split(";");
-
- Enum::Roles flags;
- foreach(const QString& role, roles) {
- flags |= (Enum::Role) Util::enumFromString<Enum>(role, "Role", "Role");
- }
- return flags;
-}
-
-QString Client::backendName() const
-{
- Q_D(const Client);
- return d->daemon->backendName();
-}
-
-QString Client::backendDescription() const
-{
- Q_D(const Client);
- return d->daemon->backendDescription();
-}
-
-QString Client::backendAuthor() const
-{
- Q_D(const Client);
- return d->daemon->backendAuthor();
-}
-
-Enum::Filters Client::filters() const
-{
- Q_D(const Client);
- QStringList filters = d->daemon->filters().split(";");
-
- // Adapt a slight difference in the enum
- if(filters.contains("none")) {
- filters[filters.indexOf("none")] = "no-filter";
- }
-
- Enum::Filters flags;
- foreach(const QString& filter, filters) {
- flags |= (Enum::Filter) Util::enumFromString<Enum>(filter, "Filter", "Filter");
- }
- return flags;
-}
-
-Enum::Groups Client::groups() const
-{
- Q_D(const Client);
- QStringList groups = d->daemon->groups().split(";");
-
- Enum::Groups flags;
- foreach(const QString& group, groups) {
- flags.insert((Enum::Group) Util::enumFromString<Enum>(group, "Group", "Group"));
- }
- return flags;
-}
-
-bool Client::locked() const
-{
- Q_D(const Client);
- return d->daemon->locked();
-}
-
-QStringList Client::mimeTypes() const
-{
- Q_D(const Client);
- return d->daemon->mimeTypes().split(";");
-}
-
-Enum::Network Client::networkState() const
-{
- Q_D(const Client);
- QString state = d->daemon->networkState();
- return (Enum::Network) Util::enumFromString<Enum>(state, "Network", "Network");
-}
-
-QString Client::distroId() const
-{
- Q_D(const Client);
- return d->daemon->distroId();
-}
-
-Enum::Authorize Client::canAuthorize(const QString &actionId) const
-{
- Q_D(const Client);
- QString result = d->daemon->CanAuthorize(actionId);
- return (Enum::Authorize) Util::enumFromString<Enum>(result, "Authorize", "Authorize");;
-}
-
-QString Client::getTid() const
-{
- Q_D(const Client);
- return d->daemon->GetTid();
-}
-
-uint Client::getTimeSinceAction(Enum::Role role) const
-{
- Q_D(const Client);
- QString roleName = Util::enumToString<Enum>(role, "Role", "Role");
- return d->daemon->GetTimeSinceAction(roleName);
-}
-
-QStringList Client::getTransactionList() const
-{
- Q_D(const Client);
- return d->daemon->GetTransactionList();
-}
-
-QList<Transaction*> Client::getTransactionObjectList(QObject *parent)
-{
- Q_D(Client);
- return d->transactions(getTransactionList(), parent);
-}
-
-
-QList<Transaction*> Client::getTransactions()
-{
- return getTransactionObjectList(this);
-}
-
-void Client::setHints(const QStringList& hints)
-{
- Q_D(Client);
- d->hints = hints;
-}
-
-void Client::setHints(const QString& hints)
-{
- Q_D(Client);
- d->hints = QStringList() << hints;
-}
-
-bool Client::setProxy(const QString& http_proxy, const QString& ftp_proxy)
-{
- Q_D(Client);
- QDBusPendingReply<> r = d->daemon->SetProxy(http_proxy, NULL, ftp_proxy, NULL, NULL, NULL);
- r.waitForFinished ();
- if (r.isError ()) {
- setLastError (daemonErrorFromDBusReply (r));
- return false;
- } else {
- return true;
- }
-}
-
-bool Client::setProxy(const QString& http_proxy, const QString& https_proxy, const QString& ftp_proxy, const QString& socks_proxy, const QString& no_proxy, const QString& pac)
-{
- Q_D(Client);
- QDBusPendingReply<> r = d->daemon->SetProxy(http_proxy, https_proxy, ftp_proxy, socks_proxy, no_proxy, pac);
- r.waitForFinished ();
- if (r.isError ()) {
- setLastError (daemonErrorFromDBusReply (r));
- return false;
- } else {
- return true;
- }
-}
-
-void Client::stateHasChanged(const QString& reason)
-{
- Q_D(Client);
- d->daemon->StateHasChanged(reason);
-}
-
-void Client::suggestDaemonQuit()
-{
- Q_D(Client);
- d->daemon->SuggestDaemonQuit();
-}
-
-Client::DaemonError Client::getLastError() const
-{
- Q_D(const Client);
- return d->error;
-}
-
-uint Client::versionMajor() const
-{
- Q_D(const Client);
- return d->daemon->versionMajor();
-}
-
-uint Client::versionMinor() const
-{
- Q_D(const Client);
- return d->daemon->versionMinor();
-}
-
-uint Client::versionMicro() const
-{
- Q_D(const Client);
- return d->daemon->versionMicro();
-}
-
-////// Transaction functions
-
-Transaction* Client::acceptEula(EulaInfo info)
-{
- RUN_TRANSACTION(acceptEula(info))
-}
-
-Transaction* Client::downloadPackages(const QList<QSharedPointer<Package> > &packages, bool storeInCache)
-{
- RUN_TRANSACTION(downloadPackages(packages, storeInCache))
-}
-
-Transaction* Client::downloadPackages(QSharedPointer<Package> package, bool storeInCache)
-{
- return downloadPackages(QList<QSharedPointer<Package> >() << package, storeInCache);
-}
-
-Transaction* Client::getDepends(const QList<QSharedPointer<Package> >& packages, Enum::Filters filters, bool recursive)
-{
- RUN_TRANSACTION(getDepends(packages, filters, recursive))
-}
-
-Transaction* Client::getDepends(QSharedPointer<Package> package, Enum::Filters filters, bool recursive)
-{
- return getDepends(QList<QSharedPointer<Package> >() << package, filters, recursive);
-}
-
-Transaction* Client::getDetails(const QList<QSharedPointer<Package> > &packages)
-{
- RUN_TRANSACTION(getDetails(packages))
-}
-
-Transaction* Client::getDetails(QSharedPointer<Package> package)
-{
- return getDetails(QList<QSharedPointer<Package> >() << package);
-}
-
-Transaction* Client::getFiles(const QList<QSharedPointer<Package> >& packages)
-{
- RUN_TRANSACTION(getFiles(packages))
-}
-
-Transaction* Client::getFiles(QSharedPointer<Package> package)
-{
- return getFiles(QList<QSharedPointer<Package> >() << package);
-}
-
-Transaction* Client::getOldTransactions(uint number)
-{
- RUN_TRANSACTION(getOldTransactions(number))
-}
-
-Transaction* Client::getPackages(Enum::Filters filters)
-{
- RUN_TRANSACTION(getPackages(filters))
-}
-
-Transaction* Client::getRepoList(Enum::Filters filters)
-{
- RUN_TRANSACTION(getRepoList(filters))
-}
-
-Transaction* Client::getRequires(const QList<QSharedPointer<Package> >& packages, Enum::Filters filters, bool recursive)
-{
- RUN_TRANSACTION(getRequires(packages, filters, recursive))
-}
-
-Transaction* Client::getRequires(QSharedPointer<Package> package, Enum::Filters filters, bool recursive)
-{
- return getRequires(QList<QSharedPointer<Package> >() << package, filters, recursive);
-}
-
-Transaction* Client::getUpdateDetail(const QList<QSharedPointer<Package> >& packages)
-{
- RUN_TRANSACTION(getUpdateDetail(packages))
-}
-
-Transaction* Client::getUpdateDetail(QSharedPointer<Package> package)
-{
- return getUpdateDetail(QList<QSharedPointer<Package> >() << package);
-}
-
-Transaction* Client::getUpdates(Enum::Filters filters)
-{
- RUN_TRANSACTION(getUpdates(filters))
-}
-
-Transaction* Client::getDistroUpgrades()
-{
- RUN_TRANSACTION(getDistroUpgrades())
-}
-
-Transaction* Client::installFiles(const QStringList& files, bool only_trusted)
-{
- RUN_TRANSACTION(installFiles(files, only_trusted))
-}
-
-Transaction* Client::installFiles(const QString& file, bool only_trusted)
-{
- return installFiles(QStringList() << file, only_trusted);
-}
-
-Transaction* Client::installPackages(bool only_trusted, const QList<QSharedPointer<Package> >& packages)
-{
- RUN_TRANSACTION(installPackages(only_trusted, packages))
-}
-
-Transaction* Client::installPackages(bool only_trusted, QSharedPointer<Package> p)
-{
- return installPackages(only_trusted, QList<QSharedPointer<Package> >() << p);
-}
-
-Transaction* Client::installSignature(Enum::SigType type, const QString& key_id, QSharedPointer<Package> p)
-{
- RUN_TRANSACTION(installSignature(type, key_id, p))
-}
-
-Transaction* Client::refreshCache(bool force)
-{
- RUN_TRANSACTION(refreshCache(force))
-}
-
-Transaction* Client::removePackages(const QList<QSharedPointer<Package> >& packages, bool allow_deps, bool autoremove)
-{
- RUN_TRANSACTION(removePackages(packages, allow_deps, autoremove))
-}
-
-Transaction* Client::removePackages(QSharedPointer<Package> p, bool allow_deps, bool autoremove)
-{
- return removePackages(QList<QSharedPointer<Package> >() << p, allow_deps, autoremove);
-}
-
-Transaction* Client::repoEnable(const QString& repo_id, bool enable)
-{
- RUN_TRANSACTION(repoEnable(repo_id, enable))
-}
-
-Transaction* Client::repoSetData(const QString& repo_id, const QString ¶meter, const QString& value)
-{
- RUN_TRANSACTION(repoSetData(repo_id, parameter, value))
-}
-
-Transaction* Client::resolve(const QStringList& packageNames, Enum::Filters filters)
-{
- RUN_TRANSACTION(resolve(packageNames, filters))
-}
-
-Transaction* Client::resolve(const QString& packageName, Enum::Filters filters)
-{
- return resolve(QStringList() << packageName, filters);
-}
-
-Transaction* Client::rollback(Transaction* oldtrans)
-{
- qWarning("NOT IMPLEMENTED");
- return 0;
-}
-
-Transaction* Client::searchFiles(const QStringList& search, Enum::Filters filters)
-{
- RUN_TRANSACTION(searchFiles(search, filters))
-}
-
-Transaction* Client::searchFiles(const QString& search, Enum::Filters filters)
-{
- return searchFiles(QStringList() << search, filters);
-}
-
-Transaction* Client::searchDetails(const QStringList& search, Enum::Filters filters)
-{
- RUN_TRANSACTION(searchDetails(search, filters))
-}
-
-Transaction* Client::searchDetails(const QString& search, Enum::Filters filters)
-{
- return searchDetails(QStringList() << search, filters);
-}
-
-Transaction* Client::searchGroups(Enum::Groups groups, Enum::Filters filters)
-{
- RUN_TRANSACTION(searchGroups(groups, filters))
-}
-
-Transaction* Client::searchGroups(Enum::Group group, Enum::Filters filters)
-{
- return searchGroups(Enum::Groups() << group, filters);
-}
-
-Transaction* Client::searchNames(const QStringList& search, Enum::Filters filters)
-{
- RUN_TRANSACTION(searchNames(search, filters))
-}
-
-Transaction* Client::searchNames(const QString& search, Enum::Filters filters)
-{
- return searchNames(QStringList() << search, filters);
-}
-
-QSharedPointer<Package> Client::searchFromDesktopFile(const QString& path)
-{
- QSqlDatabase db = QSqlDatabase::database();
- if (!db.isOpen()) {
- qDebug() << "Desktop files database is not open";
- return QSharedPointer<Package> (NULL);
- }
-
- QSqlQuery q(db);
- q.prepare("SELECT package FROM cache WHERE filename = :path");
- q.bindValue(":path", path);
- if(!q.exec()) {
- qDebug() << "Error while running query " << q.executedQuery();
- return QSharedPointer<Package> (NULL);
- }
-
- if (!q.next()) return QSharedPointer<Package> (NULL); // Return NULL if no results
-
- return QSharedPointer<Package> (new Package(q.value(0).toString()));
-
-}
-
-Transaction* Client::simulateInstallFiles(const QStringList& files)
-{
- RUN_TRANSACTION(simulateInstallFiles(files))
-}
-
-Transaction* Client::simulateInstallFiles(const QString& file)
-{
- return simulateInstallFiles(QStringList() << file);
-}
-
-Transaction* Client::simulateInstallPackages(const QList<QSharedPointer<Package> >& packages)
-{
- RUN_TRANSACTION(simulateInstallPackages(packages))
-}
-
-Transaction* Client::simulateInstallPackages(QSharedPointer<Package> package)
-{
- return simulateInstallPackages(QList<QSharedPointer<Package> >() << package);
-}
-
-Transaction* Client::simulateRemovePackages(const QList<QSharedPointer<Package> >& packages, bool autoremove)
-{
- RUN_TRANSACTION(simulateRemovePackages(packages, autoremove))
-}
-
-Transaction* Client::simulateRemovePackages(QSharedPointer<Package> package, bool autoremove)
-{
- return simulateRemovePackages(QList<QSharedPointer<Package> >() << package, autoremove);
-}
-
-Transaction* Client::simulateUpdatePackages(const QList<QSharedPointer<Package> >& packages)
-{
- RUN_TRANSACTION(simulateUpdatePackages(packages))
-}
-
-Transaction* Client::simulateUpdatePackages(QSharedPointer<Package> package)
-{
- return simulateUpdatePackages(QList<QSharedPointer<Package> >() << package);
-}
-
-Transaction* Client::updatePackages(bool only_trusted, const QList<QSharedPointer<Package> >& packages)
-{
- RUN_TRANSACTION(updatePackages(only_trusted, packages))
-}
-
-Transaction* Client::updatePackages(bool only_trusted, QSharedPointer<Package> package)
-{
- return updatePackages(only_trusted, QList<QSharedPointer<Package> >() << package);
-}
-
-Transaction* Client::updateSystem(bool only_trusted)
-{
- RUN_TRANSACTION(updateSystem(only_trusted))
-}
-
-Transaction* Client::whatProvides(Enum::Provides type, const QStringList& search, Enum::Filters filters)
-{
- RUN_TRANSACTION(whatProvides(type, search, filters))
-}
-
-Transaction* Client::whatProvides(Enum::Provides type, const QString& search, Enum::Filters filters)
-{
- return whatProvides(type, QStringList() << search, filters);
-}
-
-void Client::setLastError (DaemonError e)
-{
- Q_D(Client);
- d->error = e;
- emit error (e);
-}
-
-void Client::destroyTransaction(const QString &tid)
-{
- Q_D(Client);
- d->destroyTransaction(tid);
-}
-
-#include "client.moc"
-
diff --git a/lib/packagekit-qt/src/client.h b/lib/packagekit-qt/src/client.h
deleted file mode 100644
index c3de25c..0000000
--- a/lib/packagekit-qt/src/client.h
+++ /dev/null
@@ -1,663 +0,0 @@
-/*
- * This file is part of the QPackageKit project
- * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef CLIENT_H
-#define CLIENT_H
-
-#include <QtCore>
-#include "enum.h"
-
-namespace PackageKit {
-
-class Package;
-class Transaction;
-
-/**
- * \class Client client.h Client
- * \author Adrien Bustany <madcat at mymadcat.com>
- *
- * \brief Base class used to interact with the PackageKit daemon
- *
- * This class holds all the functions enabling the user to interact with the PackageKit daemon.
- * The user should always use this class to initiate transactions.
- *
- * All the function returning a pointer to a Transaction work in an asynchronous way. The returned
- * object can be used to alter the operation's execution, or monitor it's state. The Transaction
- * object will be automatically deleted after it emits the finished() signal.
- *
- * \note This class is a singleton, its constructor is private. Call Client::instance() to get
- * an instance of the Client object
- */
-class ClientPrivate;
-class Client : public QObject
-{
-
- Q_OBJECT
- Q_ENUMS(DaemonError)
-
-public:
- /**
- * \brief Returns an instance of the Client
- *
- * The Client class is a singleton, you can call this method several times,
- * a single Client object will exist.
- */
- static Client* instance();
-
- /**
- * Destructor
- */
- ~Client();
-
- // Daemon functions
-
- /**
- * Returns all the actions supported by the current backend
- */
- Enum::Roles actions() const;
-
- /**
- * The backend name, e.g. "yum".
- */
- QString backendName() const;
-
- /**
- * The backend description, e.g. "Yellow Dog Update Modifier".
- */
- QString backendDescription() const;
-
- /**
- * The backend author, e.g. "Joe Bloggs <joe at blogs.com>"
- */
- QString backendAuthor() const;
-
- /**
- * Returns the filters supported by the current backend
- */
- Enum::Filters filters() const;
-
- /**
- * Returns the groups supported by the current backend
- */
- Enum::Groups groups() const;
-
- /**
- * Set when the backend is locked and native tools would fail.
- */
- bool locked() const;
-
- /**
- * Returns a list containing the MIME types supported by the current backend
- */
- QStringList mimeTypes() const;
-
- /**
- * Returns the current network state
- */
- Enum::Network networkState() const;
-
- /**
- * The distribution identifier in the
- * distro;version;arch form,
- * e.g. "debian;squeeze/sid;x86_64".
- */
- QString distroId() const;
-
- /**
- * Allows a client to find out if it would be allowed to authorize an action.
- * The action ID, e.g. org.freedesktop.packagekit.system-network-proxy-configure
- * specified in \p actionId
- * Returm might be either yes, no or interactive.
- */
- Enum::Authorize canAuthorize(const QString &actionId) const;
-
- /**
- * Returns the time (in seconds) since the specified \p action
- */
- uint getTimeSinceAction(Enum::Role action) const;
-
- /**
- * Returns the list of current transactions
- */
- QStringList getTransactionList() const;
-
- /**
- * Convenience function
- * Returns the list of current transactions objects
- *
- * You must delete these yourself or pass a
- * \p parent for these comming transactions
- */
- QList<Transaction*> getTransactionObjectList(QObject *parent = 0);
-
- /**
- * DEPRECATED
- * Returns the list of current transactions
- * You must delete these yourself or pass a
- * \p parent for these comming transactions
- */
- QList<Transaction*> Q_DECL_DEPRECATED getTransactions();
-
- /**
- * \brief Sets a global hints for all the transactions to be created
- *
- * This method allows the calling session to set transaction \p hints for
- * the package manager which can change as the transaction runs.
- *
- * This method can be sent before the transaction has been run
- * (by using Client::setHints) or whilst it is running
- * (by using Transaction::setHints).
- * There is no limit to the number of times this
- * method can be sent, although some backends may only use the values
- * that were set before the transaction was started.
- *
- * The \p hints can be filled with entries like these
- * ('locale=en_GB.utf8','idle=true','interactive=false').
- *
- * \sa Transaction::setHints
- */
- void setHints(const QString& hints);
- void setHints(const QStringList& hints);
-
- /**
- * Sets a proxy to be used for all the network operations
- */
- bool setProxy(const QString& http_proxy, const QString& ftp_proxy);
- bool setProxy(const QString& http_proxy, const QString& https_proxy, const QString& ftp_proxy, const QString& socks_proxy, const QString& no_proxy, const QString& pac);
-
- /**
- * \brief Tells the daemon that the system state has changed, to make it reload its cache
- *
- * \p reason can be resume or posttrans
- */
- void stateHasChanged(const QString& reason);
-
- /**
- * Asks PackageKit to quit, for example to let a native package manager operate
- */
- void suggestDaemonQuit();
-
- /**
- * Describes a package signature
- * \li \c package is a pointer to the signed package
- * \li \c repoId is the id of the software repository containing the package
- * \li \c keyUrl, \c keyId, \c keyFingerprint and \c keyTimestamp describe the key
- * \li \c type is the signature type
- */
- typedef struct {
- QSharedPointer<Package> package;
- QString repoId;
- QString keyUrl;
- QString keyUserid;
- QString keyId;
- QString keyFingerprint;
- QString keyTimestamp;
- Enum::SigType type;
- } SignatureInfo;
-
- /**
- * Describes an EULA
- * \li \c id is the EULA identifier
- * \li \c package is the package for which an EULA is required
- * \li \c vendorName is the vendor name
- * \li \c licenseAgreement is the EULA text
- */
- typedef struct {
- QString id;
- QSharedPointer<Package> package;
- QString vendorName;
- QString licenseAgreement;
- } EulaInfo;
-
- /**
- * Describes an error at the daemon level (for example, PackageKit crashes or is unreachable)
- *
- * \sa Client::error
- * \sa Transaction::error
- */
- typedef enum {
- NoError = 0,
- UnkownError,
- ErrorFailed,
- ErrorFailedAuth,
- ErrorNoTid,
- ErrorAlreadyTid,
- ErrorRoleUnkown,
- ErrorCannotStartDaemon,
- ErrorInvalidInput,
- ErrorInvalidFile,
- ErrorFunctionNotSupported,
- ErrorDaemonUnreachable,
- /* this always has to be at the end of the list */
- LastDaemonError
- } DaemonError;
-
- /**
- * Returns the last daemon error that was caught
- */
- DaemonError getLastError() const;
-
- /**
- * Describes a software update
- * \li \c package is the package which triggered the update
- * \li \c updates are the packages to be updated
- * \li \c obsoletes lists the packages which will be obsoleted by this update
- * \li \c vendorUrl, \c bugzillaUrl and \c cveUrl are links to webpages describing the update
- * \li \c restart indicates if a restart will be required after this update
- * \li \c updateText describes the update
- * \li \c changelog holds the changelog
- * \li \c state is the category of the update, eg. stable or testing
- * \li \c issued and \c updated indicate the dates at which the update was issued and updated
- */
- typedef struct {
- QSharedPointer<Package> package;
- QList<QSharedPointer<Package> > updates;
- QList<QSharedPointer<Package> > obsoletes;
- QString vendorUrl;
- QString bugzillaUrl;
- QString cveUrl;
- Enum::Restart restart;
- QString updateText;
- QString changelog;
- Enum::UpdateState state;
- QDateTime issued;
- QDateTime updated;
- } UpdateInfo;
-
- /**
- * Returns the major version number.
- */
- uint versionMajor() const;
-
- /**
- * The minor version number.
- */
- uint versionMinor() const;
-
- /**
- * The micro version number.
- */
- uint versionMicro() const;
-
- // Transaction functions
-
- /**
- * DEPRECATED
- * \brief Accepts an EULA
- *
- * The EULA is identified by the EulaInfo structure \p info
- *
- * \note You need to restart the transaction which triggered the EULA manually
- *
- * \sa Transaction::eulaRequired
- */
- Transaction* Q_DECL_DEPRECATED acceptEula(EulaInfo info);
-
- /**
- * DEPRECATED
- * Download the given \p packages to a temp dir, if \p storeInCache is true
- * the download will be stored in the package manager cache
- */
- Transaction* Q_DECL_DEPRECATED downloadPackages(const QList<QSharedPointer<Package> > &packages, bool storeInCache = false);
-
- /**
- * DEPRECATED
- * This is a convenience function
- */
- Transaction* Q_DECL_DEPRECATED downloadPackages(QSharedPointer<Package> package, bool storeInCache = false);
-
- /**
- * DEPRECATED
- * Returns the collection categories
- *
- * \sa Transaction::category
- */
- Transaction* Q_DECL_DEPRECATED getCategories();
-
- /**
- * DEPRECATED
- * \brief Gets the list of dependencies for the given \p packages
- *
- * You can use the \p filters to limit the results to certain packages. The
- * \p recursive flag indicates if the package manager should also fetch the
- * dependencies's dependencies.
- *
- * \sa Transaction::package
- *
- */
- Transaction* Q_DECL_DEPRECATED getDepends(const QList<QSharedPointer<Package> >& packages, Enum::Filters filters, bool recursive);
- Transaction* Q_DECL_DEPRECATED getDepends(QSharedPointer<Package> package, Enum::Filters filters , bool recursive);
-
- /**
- * DEPRECATED
- * Gets more details about the given \p packages
- *
- * \sa Transaction::details
- */
- Transaction* Q_DECL_DEPRECATED getDetails(const QList<QSharedPointer<Package> >& packages);
- Transaction* Q_DECL_DEPRECATED getDetails(QSharedPointer<Package> package);
-
- /**
- * DEPRECATED
- * Gets the files contained in the given \p packages
- *
- * \sa Transaction::files
- */
- Transaction* Q_DECL_DEPRECATED getFiles(const QList<QSharedPointer<Package> >& packages);
- Transaction* Q_DECL_DEPRECATED getFiles(QSharedPointer<Package> packages);
-
- /**
- * DEPRECATED
- * \brief Gets the last \p number finished transactions
- *
- * \note You must delete these transactions yourself
- */
- Transaction* Q_DECL_DEPRECATED getOldTransactions(uint number);
-
- /**
- * DEPRECATED
- * Gets all the packages matching the given \p filters
- *
- * \sa Transaction::package
- */
- Transaction* Q_DECL_DEPRECATED getPackages(Enum::Filters filters = Enum::NoFilter);
-
- /**
- * DEPRECATED
- * Gets the list of software repositories matching the given \p filters
- */
- Transaction* Q_DECL_DEPRECATED getRepoList(Enum::Filters filter = Enum::NoFilter);
-
- /**
- * DEPRECATED
- * \brief Searches for the packages requiring the given \p packages
- *
- * The search can be limited using the \p filters parameter. The recursive flag is used to tell
- * if the package manager should also search for the package requiring the resulting packages.
- */
- Transaction* Q_DECL_DEPRECATED getRequires(const QList<QSharedPointer<Package> >& packages, Enum::Filters filters, bool recursive);
- Transaction* Q_DECL_DEPRECATED getRequires(QSharedPointer<Package> package, Enum::Filters filters, bool recursive);
-
- /**
- * DEPRECATED
- * Retrieves more details about the update for the given \p packages
- */
- Transaction* Q_DECL_DEPRECATED getUpdateDetail(const QList<QSharedPointer<Package> >& packages);
- Transaction* Q_DECL_DEPRECATED getUpdateDetail(QSharedPointer<Package> package);
-
- /**
- * DEPRECATED
- * \p Gets the available updates
- *
- * The \p filters parameters can be used to restrict the updates returned
- */
- Transaction* Q_DECL_DEPRECATED getUpdates(Enum::Filters filters = Enum::NoFilter);
-
- /**
- * DEPRECATED
- * Retrieves the available distribution upgrades
- */
- Transaction* Q_DECL_DEPRECATED getDistroUpgrades();
-
- /**
- * DEPRECATED
- * \brief Installs the local packages \p files
- *
- * \p only_trusted indicate if the packages are signed by a trusted authority
- */
- Transaction* Q_DECL_DEPRECATED installFiles(const QStringList& files, bool only_trusted);
- Transaction* Q_DECL_DEPRECATED installFiles(const QString& file, bool only_trusted);
-
- /**
- * DEPRECATED
- * Install the given \p packages
- *
- * \p only_trusted indicates if we should allow installation of untrusted packages (requires a different authorization)
- */
- Transaction* Q_DECL_DEPRECATED installPackages(bool only_trusted, const QList<QSharedPointer<Package> >& packages);
- Transaction* Q_DECL_DEPRECATED installPackages(bool only_trusted, QSharedPointer<Package> p);
-
- /**
- * DEPRECATED
- * \brief Installs a signature
- *
- * \p type, \p key_id and \p p generally come from the Transaction::repoSignatureRequired
- */
- Transaction* Q_DECL_DEPRECATED installSignature(Enum::SigType type, const QString& key_id, QSharedPointer<Package> p);
-
- /**
- * DEPRECATED
- * Refreshes the package manager's cache
- */
- Transaction* Q_DECL_DEPRECATED refreshCache(bool force);
-
- /**
- * DEPRECATED
- * \brief Removes the given \p packages
- *
- * \p allow_deps if the package manager has the right to remove other packages which depend on the
- * packages to be removed. \p autoremove tells the package manager to remove all the package which
- * won't be needed anymore after the packages are uninstalled.
- */
- Transaction* Q_DECL_DEPRECATED removePackages(const QList<QSharedPointer<Package> >& packages, bool allow_deps, bool autoremove);
- Transaction* Q_DECL_DEPRECATED removePackages(QSharedPointer<Package> p, bool allow_deps, bool autoremove);
-
- /**
- * DEPRECATED
- * Activates or disables a repository
- */
- Transaction* Q_DECL_DEPRECATED repoEnable(const QString& repo_id, bool enable);
-
- /**
- * DEPRECATED
- * Sets a repository's parameter
- */
- Transaction* Q_DECL_DEPRECATED repoSetData(const QString& repo_id, const QString& parameter, const QString& value);
-
- /**
- * DEPRECATED
- * \brief Tries to create a Package object from the package's name
- *
- * The \p filters can be used to restrict the search
- */
- Transaction* Q_DECL_DEPRECATED resolve(const QStringList& packageNames, Enum::Filters filters = Enum::NoFilter);
- Transaction* Q_DECL_DEPRECATED resolve(const QString& packageName, Enum::Filters filters = Enum::NoFilter);
-
- /**
- * DEPRECATED
- * Rolls back the given \p transactions
- */
- Transaction* Q_DECL_DEPRECATED rollback(Transaction* oldtrans);
-
- /**
- * DEPRECATED
- * \brief Search in the packages files
- *
- * \p filters can be used to restrict the returned packages
- */
- Transaction* Q_DECL_DEPRECATED searchFiles(const QStringList& search, Enum::Filters filters = Enum::NoFilter);
- Transaction* Q_DECL_DEPRECATED searchFiles(const QString& search, Enum::Filters filters = Enum::NoFilter);
-
- /**
- * DEPRECATED
- * \brief Search in the packages details
- *
- * \p filters can be used to restrict the returned packages
- */
- Transaction* Q_DECL_DEPRECATED searchDetails(const QStringList& search, Enum::Filters filters = Enum::NoFilter);
- Transaction* Q_DECL_DEPRECATED searchDetails(const QString& search, Enum::Filters filters = Enum::NoFilter);
-
- /**
- * DEPRECATED
- * \brief Lists all the packages in the given \p group
- *
- * \p filters can be used to restrict the returned packages
- */
- Transaction* Q_DECL_DEPRECATED searchGroups(Enum::Groups group, Enum::Filters filters = Enum::NoFilter);
- Transaction* Q_DECL_DEPRECATED searchGroups(Enum::Group group, Enum::Filters filters = Enum::NoFilter);
-
- /**
- * DEPRECATED
- * \brief Search in the packages names
- *
- * \p filters can be used to restrict the returned packages
- */
- Transaction* Q_DECL_DEPRECATED searchNames(const QStringList& search, Enum::Filters filters = Enum::NoFilter);
- Transaction* Q_DECL_DEPRECATED searchNames(const QString& search, Enum::Filters filters = Enum::NoFilter);
-
- /**
- * DEPRECATED
- * \brief Tries to find a package name from a desktop file
- *
- * This function looks into /var/lib/PackageKit/desktop-files.db and searches for the associated package name.
- *
- * \p path the path to the desktop file (as shipped by the package)
- * \return The associated package, or NULL if there's no result
- */
- QSharedPointer<Package> searchFromDesktopFile(const QString& path);
-
- /**
- * DEPRECATED
- * \brief Simulates an installation of \p files.
- *
- * You should call this method before installing \p files
- * \note: This method might emit packages with INSTALLING, REMOVING, UPDATING,
- * REINSTALLING or OBSOLETING status.
- */
- Transaction* Q_DECL_DEPRECATED simulateInstallFiles(const QStringList& files);
- Transaction* Q_DECL_DEPRECATED simulateInstallFiles(const QString& file);
-
- /**
- * DEPRECATED
- * \brief Simulates an installation of \p packages.
- *
- * You should call this method before installing \p packages
- * \note: This method might emit packages with INSTALLING, REMOVING, UPDATING,
- * REINSTALLING or OBSOLETING status.
- */
- Transaction* Q_DECL_DEPRECATED simulateInstallPackages(const QList<QSharedPointer<Package> >& packages);
- Transaction* Q_DECL_DEPRECATED simulateInstallPackages(QSharedPointer<Package> package);
-
- /**
- * DEPRECATED
- * \brief Simulates a removal of \p packages.
- *
- * You should call this method before removing \p packages
- * \note: This method might emit packages with INSTALLING, REMOVING, UPDATING,
- * REINSTALLING or OBSOLETING status.
- */
- Transaction* Q_DECL_DEPRECATED simulateRemovePackages(const QList<QSharedPointer<Package> >& packages, bool autoremove);
- Transaction* Q_DECL_DEPRECATED simulateRemovePackages(QSharedPointer<Package> package, bool autoremove);
-
- /**
- * DEPRECATED
- * \brief Simulates an update of \p packages.
- *
- * You should call this method before updating \p packages
- * \note: This method might emit packages with INSTALLING, REMOVING, UPDATING,
- * REINSTALLING or OBSOLETING status.
- */
- Transaction* Q_DECL_DEPRECATED simulateUpdatePackages(const QList<QSharedPointer<Package> >& packages);
- Transaction* Q_DECL_DEPRECATED simulateUpdatePackages(QSharedPointer<Package> package);
-
- /**
- * DEPRECATED
- * Update the given \p packages
- */
- Transaction* Q_DECL_DEPRECATED updatePackages(bool only_trusted, const QList<QSharedPointer<Package> >& packages);
- Transaction* Q_DECL_DEPRECATED updatePackages(bool only_trusted, QSharedPointer<Package> package);
-
- /**
- * DEPRECATED
- * Updates the whole system
- *
- * \p only_trusted indicates if this transaction is only allowed to install trusted packages
- */
- Transaction* Q_DECL_DEPRECATED updateSystem(bool only_trusted);
-
- /**
- * DEPRECATED
- * Searchs for a package providing a file/a mimetype
- */
- Transaction* Q_DECL_DEPRECATED whatProvides(Enum::Provides type, const QStringList& search, Enum::Filters filters = Enum::NoFilter);
- Transaction* Q_DECL_DEPRECATED whatProvides(Enum::Provides type, const QString& search, Enum::Filters filters = Enum::NoFilter);
-
-Q_SIGNALS:
- /**
- * This signal is emitted when a property on the interface changes.
- */
- void changed();
-
- /**
- * Emitted when the PackageKit daemon sends an error
- */
- void error(PackageKit::Client::DaemonError e);
-
- /**
- * Emitted when the list of repositories changes
- */
- void repoListChanged();
-
- /**
- * Emmitted when a restart is scheduled
- */
- void restartScheduled();
-
- /**
- * \brief Emitted when the current transactions list changes.
- *
- * \note This is mostly useful for monitoring the daemon's state.
- */
- void transactionListChanged(const QList<PackageKit::Transaction*>&);
-
- /**
- * Emitted when new updates are available
- */
- void updatesChanged();
-
-protected:
- /**
- * \brief creates a new transaction path
- * This function register a new DBus path on PackageKit
- * allowing a \c Transaction object to be created,
- * unless you want to know the transaction id
- * before creating the \c Transaction this function
- * is not useful since passing a NULL string (QString())
- * when contructing the \c Transaction object will
- * automatically create this path.
- */
- QString getTid() const;
- ClientPrivate * const d_ptr;
-
-private:
- Q_DECLARE_PRIVATE(Client);
- Client(QObject* parent = 0);
- static Client* m_instance;
- friend class TransactionPrivate;
- friend class Transaction;
-
- void setLastError(DaemonError e);
-
- void destroyTransaction(const QString &tid);
-};
-
-} // End namespace PackageKit
-
-#endif
diff --git a/lib/packagekit-qt/src/clientprivate.cpp b/lib/packagekit-qt/src/clientprivate.cpp
deleted file mode 100644
index ed1fce8..0000000
--- a/lib/packagekit-qt/src/clientprivate.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * This file is part of the QPackageKit project
- * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "clientprivate.h"
-#include "transaction.h"
-#include "transactionprivate.h"
-#include "common.h"
-
-#include <QDBusConnection>
-
-using namespace PackageKit;
-
-ClientPrivate::ClientPrivate(Client* parent)
- : QObject(parent),
- c(parent)
-{
- m_watcher = new QDBusServiceWatcher(PK_NAME,
- QDBusConnection::systemBus(),
- QDBusServiceWatcher::WatchForUnregistration,
- this);
- connect(m_watcher, SIGNAL(serviceUnregistered(const QString &)),
- this, SLOT(serviceUnregistered()));
-}
-
-ClientPrivate::~ClientPrivate()
-{
-}
-
-QList<Transaction*> ClientPrivate::transactions(const QStringList& tids, QObject *parent)
-{
-// qDebug() << "entering transactionListChanged";
- QList<Transaction*> trans;
- foreach(const QString& tid, tids) {
- if(runningTransactions.contains(tid)) {
-// qDebug() << "reusing transaction from pool : " << tid;
- trans.append(runningTransactions.value(tid));
- } else {
-// qDebug() << "external transaction : " << tid;
- Transaction* t = new Transaction(tid, parent);
- trans.append(t);
- runningTransactions.insert(tid, t);
- }
- }
- return trans;
-}
-
-void ClientPrivate::transactionListChanged(const QStringList& tids)
-{
- c->transactionListChanged(transactions(tids, Client::instance()));
-}
-
-void ClientPrivate::serviceUnregistered()
-{
- error = Client::ErrorDaemonUnreachable;
- c->error(error);
-
- foreach (Transaction *t, runningTransactions) {
- t->finished (Enum::ExitFailed, 0);
- t->d_ptr->destroy ();
- }
-
- // We don't have more transactions running
- c->transactionListChanged(QList<Transaction*>());
-}
-
-void ClientPrivate::destroyTransaction(const QString &tid)
-{
-// qDebug() << "removing transaction from pool: " << tid;
-// runningTransactions[tid]->deleteLater();
- runningTransactions.remove(tid);
-}
-
-#include "clientprivate.moc"
diff --git a/lib/packagekit-qt/src/clientprivate.h b/lib/packagekit-qt/src/clientprivate.h
deleted file mode 100644
index c867dc8..0000000
--- a/lib/packagekit-qt/src/clientprivate.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * This file is part of the QPackageKit project
- * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- * Copyright (C) 2010 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef CLIENTPRIVATE_H
-#define CLIENTPRIVATE_H
-
-#include <QtCore>
-#include <QDBusServiceWatcher>
-#include "client.h"
-
-class DaemonProxy;
-
-namespace PackageKit {
-
-class Transaction;
-
-class ClientPrivate : public QObject
-{
- Q_OBJECT
-
-public:
- ~ClientPrivate();
-
- ::DaemonProxy* daemon;
- Client* c;
- QStringList hints;
- QHash<QString, Transaction*> runningTransactions;
- Client::DaemonError error;
-
- QList<Transaction*> transactions(const QStringList &tids, QObject *parent);
- void destroyTransaction(const QString &tid);
-
-public Q_SLOTS:
- void transactionListChanged(const QStringList &tids);
- void serviceUnregistered();
-
-private:
- friend class Client;
- ClientPrivate(Client* parent);
-
- QDBusServiceWatcher *m_watcher;
-};
-
-} // End namespace PackageKit
-
-#endif
diff --git a/lib/packagekit-qt/src/common.h b/lib/packagekit-qt/src/common.h
deleted file mode 100644
index eb5e57b..0000000
--- a/lib/packagekit-qt/src/common.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * This file is part of the QPackageKit project
- * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#define PK_TRANSACTION_INTERFACE "org.freedesktop.PackageKit.Transaction"
-#define PK_NAME "org.freedesktop.PackageKit"
-#define PK_PATH "/org/freedesktop/PackageKit"
-
-#define AUTH_PACKAGE_INSTALL "org.freedesktop.packagekit.package-install"
-#define AUTH_PACKAGE_INSTALL_UNTRUSTED "org.freedesktop.packagekit.package-install-untrusted"
-#define AUTH_SYSTEM_TRUST_SIGNING_KEY "org.freedesktop.packagekit.system-trust-signing-key"
-#define AUTH_PACKAGE_EULA_ACCEPT "org.freedesktop.packagekit.package-eula-accept"
-#define AUTH_PACKAGE_REMOVE "org.freedesktop.packagekit.package-remove"
-#define AUTH_SYSTEM_UPDATE "org.freedesktop.packagekit.system-update"
-#define AUTH_SYSTEM_ROLLBACK "org.freedesktop.packagekit.system-rollback"
-#define AUTH_SYSTEM_SOURCES_CONFIGURE "org.freedesktop.packagekit.system-sources-configure"
-#define AUTH_SYSTEM_SOURCES_REFRESH "org.freedesktop.packagekit.system-sources-refresh"
-#define AUTH_SYSTEM_NETWORK_PROXY_CONFIGURE "org.freedesktop.packagekit.system-network-proxy-configure"
-#define AUTH_CANCEL_FOREIGN "org.freedesktop.packagekit.cancel-foreign"
-
diff --git a/lib/packagekit-qt/src/enum.cpp b/lib/packagekit-qt/src/enum.cpp
deleted file mode 100644
index 989d2c2..0000000
--- a/lib/packagekit-qt/src/enum.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * This file is part of the QPackageKit project
- * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "enum.h"
-#include "enum.moc"
-
diff --git a/lib/packagekit-qt/src/enum.h b/lib/packagekit-qt/src/enum.h
deleted file mode 100644
index f870370..0000000
--- a/lib/packagekit-qt/src/enum.h
+++ /dev/null
@@ -1,621 +0,0 @@
-/*
- * This file is part of the QPackageKit project
- * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- * Copyright (C) 2009-2010 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef ENUM_H
-#define ENUM_H
-
-#include <QtCore>
-#include "bitfield.h"
-
-namespace PackageKit {
-
-/**
-* \class Enum enum.h Enum
-* \author Adrien Bustany <madcat at mymadcat.com>
-*
-* \brief Represents a PackageKit's enums
-*
-* This class represents a PackageKit enums.
-*
-*/
-class Enum : public QObject
-{
- Q_OBJECT
- Q_ENUMS(Role)
- Q_ENUMS(Status)
- Q_ENUMS(Exit)
- Q_ENUMS(Network)
- Q_ENUMS(Filter)
- Q_ENUMS(Restart)
- Q_ENUMS(Message)
- Q_ENUMS(Error)
- Q_ENUMS(Group)
- Q_ENUMS(UpdateState)
- Q_ENUMS(Info)
- Q_ENUMS(DistroUpgrade)
- Q_ENUMS(SigType)
- Q_ENUMS(Provides)
- Q_ENUMS(License)
- Q_ENUMS(MediaType)
- Q_ENUMS(Authorize)
-public:
- /**
- * Lists all the available actions
- * \sa getActions
- */
- typedef enum {
- UnknownRole,
- RoleCancel,
- RoleGetDepends,
- RoleGetDetails,
- RoleGetFiles,
- RoleGetPackages,
- RoleGetRepoList,
- RoleGetRequires,
- RoleGetUpdateDetail,
- RoleGetUpdates,
- RoleInstallFiles,
- RoleInstallPackages,
- RoleInstallSignature,
- RoleRefreshCache,
- RoleRemovePackages,
- RoleRepoEnable,
- RoleRepoSetData,
- RoleResolve,
- RoleRollback,
- RoleSearchDetails,
- RoleSearchFile,
- RoleSearchGroup,
- RoleSearchName,
- RoleUpdatePackages,
- RoleUpdateSystem,
- RoleWhatProvides,
- RoleAcceptEula,
- RoleDownloadPackages,
- RoleGetDistroUpgrades,
- RoleGetCategories,
- RoleGetOldTransactions,
- RoleSimulateInstallFiles,
- RoleSimulateInstallPackages,
- RoleSimulateRemovePackages,
- RoleSimulateUpdatePackages,
- RoleUpgradeSystem, // Since 0.6.11
- /* this always has to be at the end of the list */
- LastRole
- } Role;
- typedef Bitfield Roles;
-
- /**
- * Describes the current state of the transaction
- */
- typedef enum {
- UnknownStatus,
- StatusWait,
- StatusSetup,
- StatusRunning,
- StatusQuery,
- StatusInfo,
- StatusRemove,
- StatusRefreshCache,
- StatusDownload,
- StatusInstall,
- StatusUpdate,
- StatusCleanup,
- StatusObsolete,
- StatusDepResolve,
- StatusSigCheck,
- StatusRollback,
- StatusTestCommit,
- StatusCommit,
- StatusRequest,
- StatusFinished,
- StatusCancel,
- StatusDownloadRepository,
- StatusDownloadPackagelist,
- StatusDownloadFilelist,
- StatusDownloadChangelog,
- StatusDownloadGroup,
- StatusDownloadUpdateinfo,
- StatusRepackaging,
- StatusLoadingCache,
- StatusScanApplications,
- StatusGeneratePackageList,
- StatusWaitingForLock,
- StatusWaitingForAuth,
- StatusScanProcessList,
- StatusCheckExecutableFiles,
- StatusCheckLibraries,
- StatusCopyFiles,
- /* this always has to be at the end of the list */
- LastStatus
- } Status;
-
- /**
- * Describes how the transaction finished
- * \sa Transaction::finished()
- */
- typedef enum {
- UnknownExit,
- ExitSuccess,
- ExitFailed,
- ExitCancelled,
- ExitKeyRequired,
- ExitEulaRequired,
- ExitKilled, /* when we forced the cancel, but had to sigkill */
- ExitMediaChangeRequired,
- ExitNeedUntrusted,
- /* this always has to be at the end of the list */
- LastExit
- } Exit;
-
- /**
- * Describes the current network state
- */
- typedef enum {
- UnknownNetwork,
- NetworkOffline,
- NetworkOnline,
- NetworkWired,
- NetworkWifi,
- NetworkMobile,
- /* this always has to be at the end of the list */
- LastNetwork
- } Network;
-
- /**
- * Describes the different filters
- */
- typedef enum {
- UnknownFilter = 0x0000001,
- NoFilter = 0x0000002,
- FilterInstalled = 0x0000004,
- FilterNotInstalled = 0x0000008,
- FilterDevelopment = 0x0000010,
- FilterNotDevelopment = 0x0000020,
- FilterGui = 0x0000040,
- FilterNotGui = 0x0000080,
- FilterFree = 0x0000100,
- FilterNotFree = 0x0000200,
- FilterVisible = 0x0000400,
- FilterNotVisible = 0x0000800,
- FilterSupported = 0x0001000,
- FilterNotSupported = 0x0002000,
- FilterBasename = 0x0004000,
- FilterNotBasename = 0x0008000,
- FilterNewest = 0x0010000,
- FilterNotNewest = 0x0020000,
- FilterArch = 0x0040000,
- FilterNotArch = 0x0080000,
- FilterSource = 0x0100000,
- FilterNotSource = 0x0200000,
- FilterCollections = 0x0400000,
- FilterNotCollections = 0x0800000,
- FilterApplication = 0x1000000,
- FilterNotApplication = 0x2000000,
- /* this always has to be at the end of the list */
- FilterLast = 0x4000000
- } Filter;
- Q_DECLARE_FLAGS(Filters, Filter)
-
- /**
- * Describes a restart type
- */
- typedef enum {
- UnknownRestart,
- RestartNone,
- RestartApplication,
- RestartSession,
- RestartSystem,
- RestartSecuritySession,
- RestartSecuritySystem,
- /* this always has to be at the end of the list */
- LastRestart
- } Restart;
-
- /**
- * Describes a message's type
- */
- typedef enum {
- UnknownMessage,
- MessageBrokenMirror,
- MessageConnectionRefused,
- MessageParameterInvalid,
- MessagePriorityInvalid,
- MessageBackendError,
- MessageDaemonError,
- MessageCacheBeingRebuilt,
- MessageUntrustedPackage,
- MessageNewerPackageExists,
- MessageCouldNotFindPackage,
- MessageConfigFilesChanged,
- MessagePackageAlreadyInstalled,
- MessageAutoremoveIgnored,
- MessageRepoMetadataDownloadFailed,
- MessageRepoForDevelopersOnly,
- MessageOtherUpdatesHeldBack,
- /* this always has to be at the end of the list */
- LastMessage
- } Message;
-
- /**
- * Lists the different types of error
- */
- typedef enum {
- UnknownError,
- ErrorOom,
- ErrorNoNetwork,
- ErrorNotSupported,
- ErrorInternalError,
- ErrorGpgFailure,
- ErrorPackageIdInvalid,
- ErrorPackageNotInstalled,
- ErrorPackageNotFound,
- ErrorPackageAlreadyInstalled,
- ErrorPackageDownloadFailed,
- ErrorGroupNotFound,
- ErrorGroupListInvalid,
- ErrorDepResolutionFailed,
- ErrorFilterInvalid,
- ErrorCreateThreadFailed,
- ErrorTransactionError,
- ErrorTransactionCancelled,
- ErrorNoCache,
- ErrorRepoNotFound,
- ErrorCannotRemoveSystemPackage,
- ErrorProcessKill,
- ErrorFailedInitialization,
- ErrorFailedFinalise,
- ErrorFailedConfigParsing,
- ErrorCannotCancel,
- ErrorCannotGetLock,
- ErrorNoPackagesToUpdate,
- ErrorCannotWriteRepoConfig,
- ErrorLocalInstallFailed,
- ErrorBadGpgSignature,
- ErrorMissingGpgSignature,
- ErrorCannotInstallSourcePackage,
- ErrorRepoConfigurationError,
- ErrorNoLicenseAgreement,
- ErrorFileConflicts,
- ErrorPackageConflicts,
- ErrorRepoNotAvailable,
- ErrorInvalidPackageFile,
- ErrorPackageInstallBlocked,
- ErrorPackageCorrupt,
- ErrorAllPackagesAlreadyInstalled,
- ErrorFileNotFound,
- ErrorNoMoreMirrorsToTry,
- ErrorNoDistroUpgradeData,
- ErrorIncompatibleArchitecture,
- ErrorNoSpaceOnDevice,
- ErrorMediaChangeRequired,
- ErrorNotAuthorized,
- ErrorUpdateNotFound,
- ErrorCannotInstallRepoUnsigned,
- ErrorCannotUpdateRepoUnsigned,
- ErrorCannotGetFilelist,
- ErrorCannotGetRequires,
- ErrorCannotDisableRepository,
- ErrorRestrictedDownload,
- ErrorPackageFailedToConfigure,
- ErrorPackageFailedToBuild,
- ErrorPackageFailedToInstall,
- ErrorPackageFailedToRemove,
- ErrorUpdateFailedDueToRunningProcess,
- ErrorPackageDatabaseChanged,
- ErrorProvideTypeNotSupported,
- ErrorInstallRootInvalid,
- ErrorCannotFetchSources,
- /* this always has to be at the end of the list */
- LastError
- } Error;
-
- /**
- * Describes the different groups
- */
- typedef enum {
- UnknownGroup,
- GroupAccessibility,
- GroupAccessories,
- GroupAdminTools,
- GroupCommunication,
- GroupDesktopGnome,
- GroupDesktopKde,
- GroupDesktopOther,
- GroupDesktopXfce,
- GroupEducation,
- GroupFonts,
- GroupGames,
- GroupGraphics,
- GroupInternet,
- GroupLegacy,
- GroupLocalization,
- GroupMaps,
- GroupMultimedia,
- GroupNetwork,
- GroupOffice,
- GroupOther,
- GroupPowerManagement,
- GroupProgramming,
- GroupPublishing,
- GroupRepos,
- GroupSecurity,
- GroupServers,
- GroupSystem,
- GroupVirtualization,
- GroupScience,
- GroupDocumentation,
- GroupElectronics,
- GroupCollections,
- GroupVendor,
- GroupNewest,
- /* this always has to be at the end of the list */
- LastGroup
- } Group;
- typedef QSet<Group> Groups;
-
- /**
- * Describes an update's state
- */
- typedef enum {
- UnknownUpdateState,
- UpdateStateStable,
- UpdateStateUnstable,
- UpdateStateTesting,
- /* this always has to be at the end of the list */
- LastUpdateState
- } UpdateState;
-
- /**
- * Describes the state of a package
- */
- typedef enum {
- UnknownInfo,
- InfoInstalled,
- InfoAvailable,
- InfoLow,
- InfoEnhancement,
- InfoNormal,
- InfoBugfix,
- InfoImportant,
- InfoSecurity,
- InfoBlocked,
- InfoDownloading,
- InfoUpdating,
- InfoInstalling,
- InfoRemoving,
- InfoCleanup,
- InfoObsoleting,
- InfoCollectionInstalled,
- InfoCollectionAvailable,
- InfoFinished,
- InfoReinstalling,
- InfoDowngrading,
- InfoPreparing,
- InfoDecompressing,
- /* this always has to be at the end of the list */
- LastInfo
- } Info;
-
- /**
- * Describes an distro upgrade state
- */
- typedef enum {
- UnknownDistroUpgrade,
- DistroUpgradeStable,
- DistroUpgradeUnstable,
- /* this always has to be at the end of the list */
- LastDistroUpgrade
- } DistroUpgrade;
-
- /**
- * Describes a signature type
- */
- typedef enum {
- UnknownSigType,
- SigTypeGpg,
- /* this always has to be at the end of the list */
- LastSigType
- } SigType;
-
-
- /**
- * Enum used to describe a "provides" request
- * \sa whatProvides
- */
- typedef enum {
- UnknownProvides,
- ProvidesAny,
- ProvidesModalias,
- ProvidesCodec,
- ProvidesMimetype,
- ProvidesFont,
- ProvidesHardwareDriver,
- ProvidesPostscriptDriver,
- ProvidesPlasmaService,
- /* this always has to be at the end of the list */
- LastProvides
- } Provides;
-
- /**
- * Describes a package's license
- */
- typedef enum {
- UnknownLicense,
- LicenseGlide,
- LicenseAfl,
- LicenseAmpasBsd,
- LicenseAmazonDsl,
- LicenseAdobe,
- LicenseAgplv1,
- LicenseAgplv3,
- LicenseAsl1Dot0,
- LicenseAsl1Dot1,
- LicenseAsl2Dot0,
- LicenseApsl2Dot0,
- LicenseArtisticClarified,
- LicenseArtistic2Dot0,
- LicenseArl,
- LicenseBittorrent,
- LicenseBoost,
- LicenseBsdWithAdvertising,
- LicenseBsd,
- LicenseCecill,
- LicenseCddl,
- LicenseCpl,
- LicenseCondor,
- LicenseCopyrightOnly,
- LicenseCryptix,
- LicenseCrystalStacker,
- LicenseDoc,
- LicenseWtfpl,
- LicenseEpl,
- LicenseEcos,
- LicenseEfl2Dot0,
- LicenseEu_datagrid,
- LicenseLgplv2WithExceptions,
- LicenseFtl,
- LicenseGiftware,
- LicenseGplv2,
- LicenseGplv2WithExceptions,
- LicenseGplv2PlusWithExceptions,
- LicenseGplv3,
- LicenseGplv3WithExceptions,
- LicenseGplv3PlusWithExceptions,
- LicenseLgplv2,
- LicenseLgplv3,
- LicenseGnuplot,
- LicenseIbm,
- LicenseImatix,
- LicenseImagemagick,
- LicenseImlib2,
- LicenseIjg,
- LicenseIntel_acpi,
- LicenseInterbase,
- LicenseIsc,
- LicenseJabber,
- LicenseJasper,
- LicenseLppl,
- LicenseLibtiff,
- LicenseLpl,
- LicenseMecabIpadic,
- LicenseMit,
- LicenseMitWithAdvertising,
- LicenseMplv1Dot0,
- LicenseMplv1Dot1,
- LicenseNcsa,
- LicenseNgpl,
- LicenseNosl,
- LicenseNetcdf,
- LicenseNetscape,
- LicenseNokia,
- LicenseOpenldap,
- LicenseOpenpbs,
- LicenseOsl1Dot0,
- LicenseOsl1Dot1,
- LicenseOsl2Dot0,
- LicenseOsl3Dot0,
- LicenseOpenssl,
- LicenseOreilly,
- LicensePhorum,
- LicensePhp,
- LicensePublicDomain,
- LicensePython,
- LicenseQpl,
- LicenseRpsl,
- LicenseRuby,
- LicenseSendmail,
- LicenseSleepycat,
- LicenseSlib,
- LicenseSissl,
- LicenseSpl,
- LicenseTcl,
- LicenseUcd,
- LicenseVim,
- LicenseVnlsl,
- LicenseVsl,
- LicenseW3c,
- LicenseWxwidgets,
- LicenseXinetd,
- LicenseZend,
- LicenseZplv1Dot0,
- LicenseZplv2Dot0,
- LicenseZplv2Dot1,
- LicenseZlib,
- LicenseZlibWithAck,
- LicenseCdl,
- LicenseFbsddl,
- LicenseGfdl,
- LicenseIeee,
- LicenseOfsfdl,
- LicenseOpenPublication,
- LicenseCcBy,
- LicenseCcBySa,
- LicenseCcByNd,
- LicenseDsl,
- LicenseFreeArt,
- LicenseOfl,
- LicenseUtopia,
- LicenseArphic,
- LicenseBaekmuk,
- LicenseBitstreamVera,
- LicenseLucida,
- LicenseMplus,
- LicenseStix,
- LicenseXano,
- LicenseVostrom,
- LicenseXerox,
- LicenseRicebsd,
- LicenseQhull,
- /* this always has to be at the end of the list */
- LastLicense
- } License;
-
- /**
- * Describes what kind of media is required
- */
- typedef enum {
- UnknownMediaType,
- MediaTypeCd,
- MediaTypeDvd,
- MediaTypeDisc,
- /* this always has to be at the end of the list */
- LastMediaType
- } MediaType;
-
- /**
- * Describes the authorization result
- */
- typedef enum {
- UnknownAuthorize,
- AuthorizeYes,
- AuthorizeNo,
- AuthorizeInteractive,
- /* this always has to be at the end of the list */
- LastAuthorize
- } Authorize;
-};
-Q_DECLARE_OPERATORS_FOR_FLAGS(Enum::Filters)
-
-} // End namespace PackageKit
-
-#endif
-
diff --git a/lib/packagekit-qt/src/package.cpp b/lib/packagekit-qt/src/package.cpp
deleted file mode 100644
index b256139..0000000
--- a/lib/packagekit-qt/src/package.cpp
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * This file is part of the QPackageKit project
- * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <QtSql>
-
-#include "package.h"
-#include "util.h"
-
-using namespace PackageKit;
-
-////// Details class
-class Package::DetailsPrivate
-{
-public:
- QSharedPointer<Package> package;
- QString license;
- Enum::Group group;
- QString description;
- QString url;
- uint size;
-};
-
-Package::Details::Details(QSharedPointer<Package> p, const QString& license, const QString& group, const QString& detail, const QString& url, qulonglong size) : d_ptr(new DetailsPrivate)
-{
- Q_D(Details);
- d->package = p;
- d->license = license;
- d->group = (Enum::Group)Util::enumFromString<Enum>(group, "Group", "Group");
- d->description = detail;
- d->url = url;
- d->size = size;
-}
-
-Package::Details::~Details()
-{
- delete d_ptr;
-}
-
-QSharedPointer<Package> Package::Details::package() const
-{
- Q_D(const Details);
- return d->package;
-}
-
-QString Package::Details::license() const
-{
- Q_D(const Details);
- return d->license;
-}
-
-Enum::Group Package::Details::group() const
-{
- Q_D(const Details);
- return d->group;
-}
-
-QString Package::Details::description() const
-{
- Q_D(const Details);
- return d->description;
-}
-
-QString Package::Details::url() const
-{
- Q_D(const Details);
- return d->url;
-}
-
-qulonglong Package::Details::size() const
-{
- Q_D(const Details);
- return d->size;
-}
-
-////// Package class
-
-class Package::Private
-{
-public:
- QString id;
- QString name;
- QString version;
- QString arch;
- QString data;
- QString summary;
- Enum::Info info;
- Package::Details* details;
- QString iconPath;
-};
-
-Package::Package(const QString& packageId, Enum::Info info, const QString& summary)
- : d(new Private)
-{
- d->id = packageId;
-
- // Break down the packageId
- QStringList tokens = packageId.split(";");
- if(tokens.size() == 4) {
- d->name = tokens.at(0);
- d->version = tokens.at(1);
- d->arch = tokens.at(2);
- d->data = tokens.at(3);
- }
-
- d->info = info;
- d->summary = summary;
- d->details = NULL;
- d->iconPath = QString ();
-}
-
-Package::~Package()
-{
- if (hasDetails())
- delete d->details;
- delete d;
-}
-
-QString Package::id() const
-{
- return d->id;
-}
-
-QString Package::name() const
-{
- return d->name;
-}
-
-QString Package::version() const
-{
- return d->version;
-}
-
-QString Package::arch() const
-{
- return d->arch;
-}
-
-QString Package::data() const
-{
- return d->data;
-}
-
-QString Package::summary() const
-{
- return d->summary;
-}
-
-Enum::Info Package::info() const
-{
- return d->info;
-}
-
-bool Package::hasDetails() const
-{
- return (d->details != NULL);
-}
-
-Package::Details* Package::details() const
-{
- return d->details;
-}
-
-void Package::setDetails(Package::Details* det)
-{
- d->details = det;
-}
-
-void Package::setInfoSummary(const QString& info, const QString& summary)
-{
- d->info = (Enum::Info)Util::enumFromString<Enum>(info, "Info", "Info");
- d->summary = summary;
-}
-
-QString Package::iconPath ()
-{
- if (d->iconPath.isNull ()) {
- d->iconPath = QString("");
- QSqlDatabase db = QSqlDatabase::database();
- if (!db.isOpen()) {
- qDebug() << "Desktop files database is not open";
- return d->iconPath;
- }
-
- QSqlQuery q(db);
- q.prepare("SELECT filename FROM cache WHERE package = :name");
- q.bindValue(":name", d->name);
- if(q.exec()) {
- if (q.next()) {
- QFile desktopFile (q.value(0).toString());
- if (desktopFile.open (QIODevice::ReadOnly | QIODevice::Text)) {
- while (!desktopFile.atEnd ()) {
- QByteArray line = desktopFile.readLine ().trimmed ();
- if (line.startsWith ("Icon=")) {
- d->iconPath = line.mid (5);
- break;
- }
- }
- desktopFile.close ();
- } else {
- qDebug() << "Cannot open desktop file " << q.value(0).toString ();
- }
- }
- } else {
- qDebug() << "Error while running query " << q.executedQuery();
- }
- }
-
- return d->iconPath;
-}
-
-bool Package::operator==(const Package *package) const
-{
- return d->id == package->id();
-}
diff --git a/lib/packagekit-qt/src/package.h b/lib/packagekit-qt/src/package.h
deleted file mode 100644
index 6528cc9..0000000
--- a/lib/packagekit-qt/src/package.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * This file is part of the QPackageKit project
- * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef PACKAGE_H
-#define PACKAGE_H
-
-#include <QtCore>
-#include "enum.h"
-
-namespace PackageKit {
-
-class Client;
-/**
- * \class Package package.h Package
- * \author Adrien Bustany <madcat at mymadcat.com>
- *
- * \brief Represents a software package
- *
- * This class represents a software package.
- *
- * \note All Package objects should be deleted by the user.
- */
-class Package
-{
-public:
- Package(const QString& packageId, Enum::Info info = Enum::UnknownInfo, const QString& summary = QString());
- /**
- * Destructor
- */
- ~Package();
-
- /**
- * \brief Returns the package ID
- *
- * A PID (package ID) uniquely identifies a package among all software repositories
- */
- QString id() const;
-
- /**
- * Returns the package name, for example vim
- */
- QString name() const;
-
- /**
- * Returns the package version, for example 7.0
- */
- QString version() const;
-
- /**
- * Returns the package's architecture, for example x86_64
- */
- QString arch() const;
-
- /**
- * Holds additionnal data about the package set by the backend
- */
- QString data() const;
-
- /**
- * Returns the package's summary. You can get more details by using Client::getDetails
- */
- QString summary() const;
-
- /**
- * Returns the package's info
- */
- Enum::Info info() const;
-
- /**
- * Holds additional details about a package
- * \sa Client::getDetails
- */
- class DetailsPrivate;
- class Details
- {
- public:
- /**
- * Destructor
- */
- ~Details();
-
- /**
- * Returns the package these details are linked to
- * \return the Package object to which these details are related
- */
- QSharedPointer<Package> package() const;
-
- /**
- * Returns the package's license
- */
- QString license() const;
-
- /**
- * Returns the package's group (for example Multimedia, Editors...)
- */
- Enum::Group group() const;
-
- /**
- * Returns the package's long description
- */
- QString description() const;
-
- /**
- * Returns the software's homepage url
- */
- QString url() const;
-
- /**
- * Returns the package's size
- */
- qulonglong size() const;
-
- protected:
- DetailsPrivate * const d_ptr;
-
- private:
- Q_DECLARE_PRIVATE(Details);
- friend class Package;
- friend class TransactionPrivate;
- Details(QSharedPointer<Package> p, const QString& license, const QString& group, const QString& detail, const QString& url, qulonglong size);
- };
-
- /**
- * Checks weither the package has details or not
- * \sa Client::getDetails
- * \sa Package::details
- */
- bool hasDetails() const;
-
- /**
- * \brief Returns the package's extended details
- *
- * \note The returned value is only valid if hasDetails returned true
- * \return a pointer to a Package::Details class containing the package's details
- * \sa Client::getDetails
- */
- Details* details() const;
-
- /**
- * \brief Returns the path to the package icon, if known
- *
- * \return A QString holding the path to the package icon if known, an empty QString else
- */
- QString iconPath ();
-
- bool operator==(const Package *package) const;
-
-private:
- friend class TransactionPrivate;
- void setDetails(Details* det);
- void setInfoSummary(const QString& info, const QString& summary);
- class Private;
- Private * const d;
-};
-
-} // End namespace PackageKit
-
-#endif
-
diff --git a/lib/packagekit-qt/src/transaction.cpp b/lib/packagekit-qt/src/transaction.cpp
deleted file mode 100644
index a7d1b9f..0000000
--- a/lib/packagekit-qt/src/transaction.cpp
+++ /dev/null
@@ -1,614 +0,0 @@
-/*
- * This file is part of the QPackageKit project
- * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- * Copyright (C) 2010 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "transaction.h"
-#include "transactionprivate.h"
-#include "transactionproxy.h"
-
-#include "clientprivate.h"
-#include "common.h"
-#include "package.h"
-#include "util.h"
-
-#define CHECK_TRANSACTION \
- if (r.isError()) { \
- d->error = daemonErrorFromDBusReply(r); \
- } \
-
-#define RUN_TRANSACTION(blurb) \
- Q_D(Transaction); \
- QDBusPendingReply<> r = d->p->blurb; \
- r.waitForFinished(); \
- CHECK_TRANSACTION \
-
-using namespace PackageKit;
-
-template<class T> Client::DaemonError daemonErrorFromDBusReply(QDBusPendingReply<T> e) {
- return Util::errorFromString(e.error().name());
-}
-
-Transaction::Transaction(const QString &tid, QObject *parent)
- : QObject(parent),
- d_ptr(new TransactionPrivate(this))
-{
- Q_D(Transaction);
-
- d->tid = tid;
- d->oldtrans = FALSE;
- d->p = 0;
-
- // If the user used a null tid
- // he want us to get it
- if (tid.isNull()) {
- d->tid = Client::instance()->getTid();
- }
-
- int retry = 0;
- do {
- delete d->p;
- d->p = new TransactionProxy(PK_NAME, d->tid, QDBusConnection::systemBus(), this);
- if (d->p->lastError().isValid()) {
- qDebug() << "Error, cannot create transaction proxy";
- qDebug() << d->p->lastError();
- QDBusMessage message;
- message = QDBusMessage::createMethodCall("org.freedesktop.DBus",
- "/",
- "org.freedesktop.DBus",
- QLatin1String("StartServiceByName"));
- message << qVariantFromValue(QString("org.freedesktop.PackageKit"));
- message << qVariantFromValue((uint) 0);
- QDBusConnection::sessionBus().call(message, QDBus::BlockWithGui);
- retry++;
- } else {
- retry = 0;
- }
- } while (retry == 1);
-
- if (d->tid.isEmpty()) {
- d->error = Client::ErrorDaemonUnreachable;
- } else {
- d->error = Client::NoError;
- Client::instance()->d_ptr->runningTransactions.insert(d->tid, this);
- setHints(Client::instance()->d_ptr->hints);
- }
-
- connect(d->p, SIGNAL(Changed()),
- this, SIGNAL(changed()));
- connect(d->p, SIGNAL(Category(const QString&, const QString&, const QString&, const QString&, const QString&)),
- this, SIGNAL(category(const QString&, const QString&, const QString&, const QString&, const QString&)));
- connect(d->p, SIGNAL(Destroy()),
- d, SLOT(destroy()));
- connect(d->p, SIGNAL(Details(const QString&, const QString&, const QString&, const QString&, const QString&, qulonglong)),
- d, SLOT(details(const QString&, const QString&, const QString&, const QString&, const QString&, qulonglong)));
- connect(d->p, SIGNAL(DistroUpgrade(const QString&, const QString&, const QString&)),
- d, SLOT(distroUpgrade(const QString&, const QString&, const QString&)));
- connect(d->p, SIGNAL(ErrorCode(const QString&, const QString&)),
- d, SLOT(errorCode(const QString&, const QString&)));
- connect(d->p, SIGNAL(Files(const QString&, const QString&)),
- d, SLOT(files(const QString&, const QString&)));
- connect(d->p, SIGNAL(Finished(const QString&, uint)),
- d, SLOT(finished(const QString&, uint)));
- connect(d->p, SIGNAL(Message(const QString&, const QString&)),
- d, SLOT(message(const QString&, const QString&)));
- connect(d->p, SIGNAL(Package(const QString&, const QString&, const QString&)),
- d, SLOT(package(const QString&, const QString&, const QString&)));
- connect(d->p, SIGNAL(RepoDetail(const QString&, const QString&, bool)),
- this, SIGNAL(repoDetail(const QString&, const QString&, bool)));
- connect(d->p, SIGNAL(RepoSignatureRequired(const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&)),
- d, SLOT(repoSignatureRequired(const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&)));
- connect(d->p, SIGNAL(EulaRequired(const QString&, const QString&, const QString&, const QString&)),
- d, SLOT(eulaRequired(const QString&, const QString&, const QString&, const QString&)));
- connect(d->p, SIGNAL(MediaChangeRequired(const QString&, const QString&, const QString&)), d, SLOT(mediaChangeRequired(const QString&, const QString&, const QString&)));
- connect(d->p, SIGNAL(RequireRestart(const QString&, const QString&)),
- d, SLOT(requireRestart(const QString&, const QString&)));
- connect(d->p, SIGNAL(Transaction(const QString&, const QString&, bool, const QString&, uint, const QString&, uint, const QString&)),
- d, SLOT(transaction(const QString&, const QString&, bool, const QString&, uint, const QString&, uint, const QString&)));
- connect(d->p, SIGNAL(UpdateDetail(const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&)),
- d, SLOT(updateDetail(const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&)));
-
-}
-
-Transaction::Transaction(const QString &tid,
- const QString ×pec,
- bool succeeded,
- const QString &role,
- uint duration,
- const QString &data,
- uint uid,
- const QString &cmdline,
- QObject *parent)
- : QObject(parent),
- d_ptr(new TransactionPrivate(this))
-{
- Q_D(Transaction);
- d->oldtrans = TRUE;
- d->tid = tid;
- d->timespec = QDateTime::fromString(timespec, Qt::ISODate);
- d->succeeded = succeeded;
- d->role = (Enum::Role)Util::enumFromString<Enum>(role, "Role", "Role");
- d->duration = duration;
- d->data = data;
- d->uid = uid;
- d->cmdline = cmdline;
- d->error = Client::NoError;
- d->destroyed = true;
-}
-
-Transaction::~Transaction()
-{
-// qDebug() << "Destroying transaction with tid" << tid();
-}
-
-QString Transaction::tid() const
-{
- Q_D(const Transaction);
- return d->tid;
-}
-
-Client::DaemonError Transaction::error () const
-{
- Q_D(const Transaction);
- return d->error;
-}
-
-bool Transaction::allowCancel() const
-{
- Q_D(const Transaction);
- if (d->destroyed) {
- return false;
- }
- return d->p->allowCancel ();
-}
-
-bool Transaction::callerActive() const
-{
- Q_D(const Transaction);
- if (d->destroyed) {
- return false;
- }
- return d->p->callerActive ();
-}
-
-void Transaction::cancel()
-{
- Q_D(Transaction);
- if (d->destroyed) {
- return;
- }
- QDBusReply<void> r = d->p->Cancel ();
- if (!r.isValid ()) {
- d->error = Util::errorFromString (r.error ().message ());
- }
-}
-
-QSharedPointer<Package> Transaction::lastPackage() const
-{
- Q_D(const Transaction);
- if (d->destroyed) {
- return QSharedPointer<Package>();
- }
- return QSharedPointer<Package> (new Package(d->p->lastPackage ()));
-}
-
-uint Transaction::percentage() const
-{
- Q_D(const Transaction);
- if (d->destroyed) {
- return 0;
- }
- return d->p->percentage ();
-}
-
-uint Transaction::subpercentage() const
-{
- Q_D(const Transaction);
- if (d->destroyed) {
- return 0;
- }
- return d->p->subpercentage ();
-}
-
-uint Transaction::elapsedTime() const
-{
- Q_D(const Transaction);
- if (d->destroyed) {
- return 0;
- }
- return d->p->elapsedTime ();
-}
-
-uint Transaction::remainingTime() const
-{
- Q_D(const Transaction);
- if (d->destroyed) {
- return 0;
- }
- return d->p->remainingTime ();
-}
-
-uint Transaction::speed() const
-{
- Q_D(const Transaction);
- if (d->destroyed) {
- return 0;
- }
- return d->p->speed ();
-}
-
-Enum::Role Transaction::role() const
-{
- Q_D(const Transaction);
- if(d->oldtrans)
- return d->role;
-
- if (d->destroyed) {
- return Enum::UnknownRole;
- }
- return (Enum::Role) Util::enumFromString<Enum>(d->p->role (), "Role", "Role");
-}
-
-void Transaction::setHints(const QStringList &hints)
-{
- Q_D(Transaction);
- if (!d->destroyed) {
- d->p->SetHints(hints);
- }
-}
-
-void Transaction::setHints(const QString &hints)
-{
- setHints(QStringList() << hints);
-}
-
-Enum::Status Transaction::status() const
-{
- Q_D(const Transaction);
- if (d->destroyed) {
- return Enum::UnknownStatus;
- }
- return (Enum::Status) Util::enumFromString<Enum>(d->p->status (), "Status", "Status");
-}
-
-QDateTime Transaction::timespec() const
-{
- Q_D(const Transaction);
- return d->timespec;
-}
-
-bool Transaction::succeeded() const
-{
- Q_D(const Transaction);
- return d->succeeded;
-}
-
-uint Transaction::duration() const
-{
- Q_D(const Transaction);
- return d->duration;
-}
-
-QString Transaction::data() const
-{
- Q_D(const Transaction);
- return d->data;
-}
-
-uint Transaction::uid() const
-{
- Q_D(const Transaction);
- if(d->destroyed) {
- return d->uid;
- }
- return d->p->uid();
-}
-
-QString Transaction::cmdline() const
-{
- Q_D(const Transaction);
- return d->cmdline;
-}
-
-////// Transaction functions
-
-void Transaction::acceptEula(const Client::EulaInfo &info)
-{
- RUN_TRANSACTION(AcceptEula(info.id))
-}
-
-void Transaction::downloadPackages(const QList<QSharedPointer<Package> > &packages, bool storeInCache)
-{
- RUN_TRANSACTION(DownloadPackages(storeInCache, Util::packageListToPids(packages)))
-}
-
-void Transaction::downloadPackages(const QSharedPointer<Package> &package, bool storeInCache)
-{
- downloadPackages(QList<QSharedPointer<Package> >() << package, storeInCache);
-}
-
-void Transaction::getCategories()
-{
- RUN_TRANSACTION(GetCategories())
-}
-
-void Transaction::getDepends(const QList<QSharedPointer<Package> > &packages, Enum::Filters filters, bool recursive)
-{
- RUN_TRANSACTION(GetDepends(Util::filtersToString(filters), Util::packageListToPids(packages), recursive))
-}
-
-void Transaction::getDepends(const QSharedPointer<Package> &package, Enum::Filters filters, bool recursive)
-{
- getDepends(QList<QSharedPointer<Package> >() << package, filters, recursive);
-}
-
-void Transaction::getDetails(const QList<QSharedPointer<Package> > &packages)
-{
- Q_D(Transaction);
- foreach (const QSharedPointer<Package> &package, packages) {
- d->packageMap.insert(package->id(), package);
- }
-
- QDBusPendingReply<> r = d->p->GetDetails(Util::packageListToPids(packages));
- r.waitForFinished ();
-
- CHECK_TRANSACTION
-}
-
-void Transaction::getDetails(const QSharedPointer<Package> &package)
-{
- getDetails(QList<QSharedPointer<Package> >() << package);
-}
-
-void Transaction::getFiles(const QList<QSharedPointer<Package> > &packages)
-{
- RUN_TRANSACTION(GetFiles(Util::packageListToPids(packages)))
-}
-
-void Transaction::getFiles(const QSharedPointer<Package> &package)
-{
- getFiles(QList<QSharedPointer<Package> >() << package);
-}
-
-void Transaction::getOldTransactions(uint number)
-{
- RUN_TRANSACTION(GetOldTransactions(number))
-}
-
-void Transaction::getPackages(Enum::Filters filters)
-{
- RUN_TRANSACTION(GetPackages(Util::filtersToString(filters)))
-}
-
-void Transaction::getRepoList(Enum::Filters filters)
-{
- RUN_TRANSACTION(GetRepoList(Util::filtersToString(filters)))
-}
-
-void Transaction::getRequires(const QList<QSharedPointer<Package> > &packages, Enum::Filters filters, bool recursive)
-{
- RUN_TRANSACTION(GetRequires(Util::filtersToString(filters), Util::packageListToPids(packages), recursive))
-}
-
-void Transaction::getRequires(const QSharedPointer<Package> &package, Enum::Filters filters, bool recursive)
-{
- getRequires(QList<QSharedPointer<Package> >() << package, filters, recursive);
-}
-
-void Transaction::getUpdateDetail(const QList<QSharedPointer<Package> > &packages)
-{
- RUN_TRANSACTION(GetUpdateDetail(Util::packageListToPids(packages)))
-}
-
-void Transaction::getUpdateDetail(const QSharedPointer<Package> &package)
-{
- getUpdateDetail(QList<QSharedPointer<Package> >() << package);
-}
-
-void Transaction::getUpdates(Enum::Filters filters)
-{
- RUN_TRANSACTION(GetUpdates(Util::filtersToString(filters)))
-}
-
-void Transaction::getDistroUpgrades()
-{
- RUN_TRANSACTION(GetDistroUpgrades())
-}
-
-void Transaction::installFiles(const QStringList &files, bool only_trusted)
-{
- RUN_TRANSACTION(InstallFiles(only_trusted, files))
-}
-
-void Transaction::installFiles(const QString &file, bool only_trusted)
-{
- installFiles(QStringList() << file, only_trusted);
-}
-
-void Transaction::installPackages(bool only_trusted, const QList<QSharedPointer<Package> > &packages)
-{
- RUN_TRANSACTION(InstallPackages(only_trusted, Util::packageListToPids(packages)))
-}
-
-void Transaction::installPackages(bool only_trusted, const QSharedPointer<Package> &package)
-{
- installPackages(only_trusted, QList<QSharedPointer<Package> >() << package);
-}
-
-void Transaction::installSignature(Enum::SigType type, const QString &key_id, const QSharedPointer<Package> &package)
-{
- RUN_TRANSACTION(InstallSignature(Util::enumToString<Enum>(type, "SigType", "Signature"), key_id, package->id()))
-}
-
-void Transaction::refreshCache(bool force)
-{
- RUN_TRANSACTION(RefreshCache(force))
-}
-
-void Transaction::removePackages(const QList<QSharedPointer<Package> > &packages, bool allow_deps, bool autoremove)
-{
- RUN_TRANSACTION(RemovePackages(Util::packageListToPids(packages), allow_deps, autoremove))
-}
-
-void Transaction::removePackages(const QSharedPointer<Package> &package, bool allow_deps, bool autoremove)
-{
- removePackages(QList<QSharedPointer<Package> >() << package, allow_deps, autoremove);
-}
-
-void Transaction::repoEnable(const QString &repo_id, bool enable)
-{
- RUN_TRANSACTION(RepoEnable(repo_id, enable))
-}
-
-void Transaction::repoSetData(const QString &repo_id, const QString ¶meter, const QString &value)
-{
- RUN_TRANSACTION(RepoSetData(repo_id, parameter, value))
-}
-
-void Transaction::resolve(const QStringList &packageNames, Enum::Filters filters)
-{
- RUN_TRANSACTION(Resolve(Util::filtersToString(filters), packageNames))
-}
-
-void Transaction::resolve(const QString &packageName, Enum::Filters filters)
-{
- resolve(QStringList() << packageName, filters);
-}
-
-void Transaction::searchFiles(const QStringList &search, Enum::Filters filters)
-{
- RUN_TRANSACTION(SearchFiles(Util::filtersToString(filters), search))
-}
-
-void Transaction::searchFiles(const QString &search, Enum::Filters filters)
-{
- searchFiles(QStringList() << search, filters);
-}
-
-void Transaction::searchDetails(const QStringList &search, Enum::Filters filters)
-{
- RUN_TRANSACTION(SearchDetails(Util::filtersToString(filters), search))
-}
-
-void Transaction::searchDetails(const QString &search, Enum::Filters filters)
-{
- searchDetails(QStringList() << search, filters);
-}
-
-void Transaction::searchGroups(const QStringList &groups, Enum::Filters filters)
-{
- RUN_TRANSACTION(SearchGroups(Util::filtersToString(filters), groups))
-}
-
-void Transaction::searchGroups(const QString &group, Enum::Filters filters)
-{
- searchGroups(QStringList() << group, filters);
-}
-
-void Transaction::searchGroups(Enum::Groups groups, Enum::Filters filters)
-{
- QStringList groupsSL;
- foreach (const Enum::Group group, groups) {
- groupsSL << Util::enumToString<Enum>(group, "Group", "Group");
- }
-
- searchGroups(groupsSL, filters);
-}
-
-void Transaction::searchGroups(Enum::Group group, Enum::Filters filters)
-{
- searchGroups(Enum::Groups() << group, filters);
-}
-
-void Transaction::searchNames(const QStringList &search, Enum::Filters filters)
-{
- RUN_TRANSACTION(SearchNames(Util::filtersToString(filters), search))
-}
-
-void Transaction::searchNames(const QString &search, Enum::Filters filters)
-{
- searchNames(QStringList() << search, filters);
-}
-
-void Transaction::simulateInstallFiles(const QStringList &files)
-{
- RUN_TRANSACTION(SimulateInstallFiles(files))
-}
-
-void Transaction::simulateInstallFiles(const QString &file)
-{
- simulateInstallFiles(QStringList() << file);
-}
-
-void Transaction::simulateInstallPackages(const QList<QSharedPointer<Package> > &packages)
-{
- RUN_TRANSACTION(SimulateInstallPackages(Util::packageListToPids(packages)))
-}
-
-void Transaction::simulateInstallPackages(const QSharedPointer<Package> &package)
-{
- simulateInstallPackages(QList<QSharedPointer<Package> >() << package);
-}
-
-void Transaction::simulateRemovePackages(const QList<QSharedPointer<Package> > &packages, bool autoremove)
-{
- RUN_TRANSACTION(SimulateRemovePackages(Util::packageListToPids(packages), autoremove))
-}
-
-void Transaction::simulateRemovePackages(const QSharedPointer<Package> &package, bool autoremove)
-{
- simulateRemovePackages(QList<QSharedPointer<Package> >() << package, autoremove);
-}
-
-void Transaction::simulateUpdatePackages(const QList<QSharedPointer<Package> > &packages)
-{
- RUN_TRANSACTION(SimulateUpdatePackages(Util::packageListToPids(packages)))
-}
-
-void Transaction::simulateUpdatePackages(const QSharedPointer<Package> &package)
-{
- simulateUpdatePackages(QList<QSharedPointer<Package> >() << package);
-}
-
-void Transaction::updatePackages(bool only_trusted, const QList<QSharedPointer<Package> > &packages)
-{
- RUN_TRANSACTION(UpdatePackages(only_trusted, Util::packageListToPids(packages)))
-}
-
-void Transaction::updatePackages(bool only_trusted, const QSharedPointer<Package> &package)
-{
- updatePackages(only_trusted, QList<QSharedPointer<Package> >() << package);
-}
-
-void Transaction::updateSystem(bool only_trusted)
-{
- RUN_TRANSACTION(UpdateSystem(only_trusted))
-}
-
-void Transaction::whatProvides(Enum::Provides type, const QStringList &search, Enum::Filters filters)
-{
- RUN_TRANSACTION(WhatProvides(Util::filtersToString(filters), Util::enumToString<Enum>(type, "Provides", "Provides"), search))
-}
-
-void Transaction::whatProvides(Enum::Provides type, const QString &search, Enum::Filters filters)
-{
- whatProvides(type, QStringList() << search, filters);
-}
-
-#include "transaction.moc"
diff --git a/lib/packagekit-qt/src/transaction.h b/lib/packagekit-qt/src/transaction.h
deleted file mode 100644
index b49b517..0000000
--- a/lib/packagekit-qt/src/transaction.h
+++ /dev/null
@@ -1,669 +0,0 @@
-/*
- * This file is part of the QPackageKit project
- * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- * Copyright (C) 2010 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef TRANSACTION_H
-#define TRANSACTION_H
-
-#include <QtCore>
-#include "enum.h"
-#include "client.h"
-
-namespace PackageKit {
-
-class ClientPrivate;
-class Package;
-
-/**
- * \class Transaction transaction.h Transaction
- * \author Adrien Bustany \e <madcat at mymadcat.com>
- * \author Daniel Nicoletti \e <dantti85-pk at yahoo.com.br>
- *
- * \brief A transaction represents an occurring action in PackageKit
- *
- * A Transaction is created whenever you do an asynchronous action (for example a Search, Install...).
- * This class allows you to monitor and control the flow of the action.
- *
- * The Transaction will be automatically deleted as soon as it emits the finished() signal.
- *
- * You cannot create a Transaction directly, use the functions in the Client class instead.
- *
- * \sa Client
- */
-class TransactionPrivate;
-class Transaction : public QObject
-{
- Q_OBJECT
-public:
- /**
- * Create a transaction object with transaction id \p tid
- * \note The if \p tid is a NULL string then it will automatically
- * asks PackageKit for a tid
- *
- * The transaction object \b cannot be reused
- * (i.e. simulateInstallPackages then installPackages)
- *
- * \warning after creating the transaction object be sure
- * to verify if it doesn't have any \sa error()
- */
- Transaction(const QString &tid, QObject *parent = 0);
-
- /**
- * Destructor
- */
- ~Transaction();
-
- /**
- * \brief Returns the TID of the Transaction
- *
- * The TID (Transaction ID) uniquely identifies the transaction.
- *
- * \return the TID of the current transaction
- */
- QString tid() const;
-
- /**
- * \brief Returns the error status of the Transaction
- *
- * \return A value from TransactionError describing the state of the transaction
- * or 0 in case of not having an error
- */
- Client::DaemonError error() const;
-
- /**
- * Indicates weither you can cancel the transaction or not
- * i.e. the backend forbids cancelling the transaction while
- * it's installing packages
- *
- * \return true if you are able cancel the transaction, false else
- */
- bool allowCancel() const;
-
- /**
- * Indicates weither the transaction caller is active or not
- *
- * The caller can be inactive if it has quitted before the transaction finished.
- *
- * \return true if the caller is active, false else
- */
- bool callerActive() const;
-
- /**
- * Returns the last package processed by the transaction
- *
- * This is mostly used when getting an already existing Transaction, to
- * display a more complete summary of the transaction.
- *
- * \return the last package processed by the transaction
- * \sa transactionListChanged
- * \sa getTransactionList
- */
- QSharedPointer<Package> lastPackage() const;
-
- /**
- * The percentage complete of the whole transaction.
- * \return percentage, or 101 if not known.
- */
- uint percentage() const;
-
- /**
- * The percentage complete of the individual task, for example, downloading.
- * \return percentage, or 101 if not known.
- */
- uint subpercentage() const;
-
- /**
- * The amount of time elapsed during the transaction in seconds.
- * \return time in seconds.
- */
- uint elapsedTime() const;
-
- /**
- * The estimated time remaining of the transaction in seconds, or 0 if not known.
- * \return time in seconds, or 0 if not known.
- */
- uint remainingTime() const;
-
- /**
- * Returns the estimated speed of the transaction (copying, downloading, etc.)
- * \return speed bits per second, or 0 if not known.
- */
- uint speed() const;
-
- /**
- * Returns information describing the transaction
- * like InstallPackages, SearchName or GetUpdates
- * \return the current role of the transaction
- */
- Enum::Role role() const;
-
- /**
- * \brief Tells the underlying package manager to use the given \p hints
- *
- * This method allows the calling session to set transaction \p hints for
- * the package manager which can change as the transaction runs.
- *
- * This method can be sent before the transaction has been run
- * (by using Client::setHints) or whilst it is running
- * (by using Transaction::setHints).
- * There is no limit to the number of times this
- * method can be sent, although some backends may only use the values
- * that were set before the transaction was started.
- *
- * The \p hints can be filled with entries like these
- * ('locale=en_GB.utf8','idle=true','interactive=false').
- *
- * \sa Client::setHints
- */
- void setHints(const QString &hints);
- void setHints(const QStringList &hints);
-
- /**
- * Returns the current state of the transaction
- * \return a Transaction::Status value describing the status of the transaction
- */
- Enum::Status status() const;
-
- /**
- * Returns the date at which the transaction was created
- * \return a QDateTime object containing the date at which the transaction was created
- * \note This function only returns a real value for old transactions returned by getOldTransactions
- */
- QDateTime timespec() const;
-
- /**
- * Returns weither the trasaction succeded or not
- * \return true if the transaction succeeded, false else
- * \note This function only returns a real value for old transactions returned by getOldTransactions
- */
- bool succeeded() const;
-
- /**
- * Returns the time the transaction took to finish
- * \return the number of milliseconds the transaction took to finish
- * \note This function only returns a real value for old transactions returned by getOldTransactions
- */
- uint duration() const;
-
- /**
- * Returns some data set by the backend to pass additionnal information
- * \return a string set by the backend
- * \note This function only returns a real value for old transactions returned by getOldTransactions
- */
- QString data() const;
-
- /**
- * Returns the UID of the calling process
- * \return the uid of the calling process
- * \note This function only returns a real value for old transactions returned by getOldTransactions
- */
- uint uid() const;
-
- /**
- * Returns the command line for the calling process
- * \return a string of the command line for the calling process
- * \note This function only returns a real value for old transactions returned by getOldTransactions
- */
- QString cmdline() const;
-
- /**
- * \brief Accepts an EULA
- *
- * The EULA is identified by the EulaInfo structure \p info
- *
- * \note You need to restart the transaction which triggered the EULA manually
- *
- * \sa eulaRequired
- */
- void acceptEula(const Client::EulaInfo &info);
-
- /**
- * Download the given \p packages to a temp dir, if \p storeInCache is true
- * the download will be stored in the package manager cache
- */
- void downloadPackages(const QList<QSharedPointer<Package> > &packages, bool storeInCache = false);
-
- /**
- * This is a convenience function
- */
- void downloadPackages(const QSharedPointer<Package> &package, bool storeInCache = false);
-
- /**
- * Returns the collection categories
- *
- * \sa category
- */
- void getCategories();
-
- /**
- * \brief Gets the list of dependencies for the given \p packages
- *
- * You can use the \p filters to limit the results to certain packages. The
- * \p recursive flag indicates if the package manager should also fetch the
- * dependencies's dependencies.
- *
- * \note This method emits \sa package()
- */
- void getDepends(const QList<QSharedPointer<Package> > &packages, Enum::Filters filters, bool recursive);
- void getDepends(const QSharedPointer<Package> &package, Enum::Filters filters , bool recursive);
-
- /**
- * Gets more details about the given \p packages
- *
- * \sa Transaction::details
- * \note This method emits \sa details()
- */
- void getDetails(const QList<QSharedPointer<Package> > &packages);
- void getDetails(const QSharedPointer<Package> &package);
-
- /**
- * Gets the files contained in the given \p packages
- *
- * \note This method emits \sa files()
- */
- void getFiles(const QList<QSharedPointer<Package> > &packages);
- void getFiles(const QSharedPointer<Package> &packages);
-
- /**
- * \brief Gets the last \p number finished transactions
- *
- * \note You must delete these transactions yourself
- * \note This method emits \sa transaction()
- */
- void getOldTransactions(uint number);
-
- /**
- * Gets all the packages matching the given \p filters
- *
- * \note This method emits \sa package()
- */
- void getPackages(Enum::Filters filters = Enum::NoFilter);
-
- /**
- * Gets the list of software repositories matching the given \p filters
- *
- * \note This method emits \sa repository()
- */
- void getRepoList(Enum::Filters filter = Enum::NoFilter);
-
- /**
- * \brief Searches for the packages requiring the given \p packages
- *
- * The search can be limited using the \p filters parameter. The recursive flag is used to tell
- * if the package manager should also search for the package requiring the resulting packages.
- *
- * \note This method emits \sa package()
- */
- void getRequires(const QList<QSharedPointer<Package> > &packages, Enum::Filters filters, bool recursive);
- void getRequires(const QSharedPointer<Package> &package, Enum::Filters filters, bool recursive);
-
- /**
- * Retrieves more details about the update for the given \p packages
- *
- * \note This method emits \sa updateDetail()
- */
- void getUpdateDetail(const QList<QSharedPointer<Package> > &packages);
- void getUpdateDetail(const QSharedPointer<Package> &package);
-
- /**
- * \p Gets the available updates
- *
- * The \p filters parameters can be used to restrict the updates returned
- *
- * \note This method emits \sa package()
- */
- void getUpdates(Enum::Filters filters = Enum::NoFilter);
-
- /**
- * Retrieves the available distribution upgrades
- *
- * \note This method emits \sa distroUpgrade()
- */
- void getDistroUpgrades();
-
- /**
- * \brief Installs the local packages \p files
- *
- * \p only_trusted indicate if the packages are signed by a trusted authority
- *
- * \note This method emits \sa package()
- * and \sa changed()
- */
- void installFiles(const QStringList &files, bool only_trusted);
- void installFiles(const QString &file, bool only_trusted);
-
- /**
- * Install the given \p packages
- *
- * \p only_trusted indicates if we should allow installation of untrusted packages (requires a different authorization)
- *
- * \note This method emits \sa package()
- * and \sa changed()
- */
- void installPackages(bool only_trusted, const QList<QSharedPointer<Package> > &packages);
- void installPackages(bool only_trusted, const QSharedPointer<Package> &package);
-
- /**
- * \brief Installs a signature
- *
- * \p type, \p keyId and \p package generally come from the Transaction::repoSignatureRequired
- */
- void installSignature(Enum::SigType type, const QString &keyId, const QSharedPointer<Package> &package);
-
- /**
- * Refreshes the package manager's cache
- *
- * \note This method emits \sa changed()
- */
- void refreshCache(bool force);
-
- /**
- * \brief Removes the given \p packages
- *
- * \p allow_deps if the package manager has the right to remove other packages which depend on the
- * packages to be removed. \p autoremove tells the package manager to remove all the package which
- * won't be needed anymore after the packages are uninstalled.
- *
- * \note This method emits \sa package()
- * and \sa changed()
- */
- void removePackages(const QList<QSharedPointer<Package> > &packages, bool allow_deps, bool autoremove);
- void removePackages(const QSharedPointer<Package> &package, bool allow_deps, bool autoremove);
-
- /**
- * Activates or disables a repository
- */
- void repoEnable(const QString &repo_id, bool enable);
-
- /**
- * Sets a repository's parameter
- */
- void repoSetData(const QString &repo_id, const QString& parameter, const QString &value);
-
- /**
- * \brief Tries to create a Package object from the package's name
- *
- * The \p filters can be used to restrict the search
- *
- * \note This method emits \sa package()
- */
- void resolve(const QStringList &packageNames, Enum::Filters filters = Enum::NoFilter);
- void resolve(const QString &packageName, Enum::Filters filters = Enum::NoFilter);
-
- /**
- * \brief Search in the packages files
- *
- * \p filters can be used to restrict the returned packages
- *
- * \note This method emits \sa package()
- */
- void searchFiles(const QStringList &search, Enum::Filters filters = Enum::NoFilter);
- void searchFiles(const QString &search, Enum::Filters filters = Enum::NoFilter);
-
- /**
- * \brief Search in the packages details
- *
- * \p filters can be used to restrict the returned packages
- *
- * \note This method emits \sa package()
- */
- void searchDetails(const QStringList &search, Enum::Filters filters = Enum::NoFilter);
- void searchDetails(const QString &search, Enum::Filters filters = Enum::NoFilter);
-
- /**
- * \brief Lists all the packages in the given \p group
- *
- * \p groups is the name of the group that you want, when searching for
- * categories prefix it with '@'
- * \p filters can be used to restrict the returned packages
- *
- * \note This method emits \sa package()
- */
- void searchGroups(const QStringList &groups, Enum::Filters filters = Enum::NoFilter);
- void searchGroups(const QString &group, Enum::Filters filters = Enum::NoFilter);
-
- /**
- * \brief Lists all the packages in the given \p group
- *
- * \p filters can be used to restrict the returned packages
- *
- * \note This method emits \sa package()
- */
- void searchGroups(Enum::Groups group, Enum::Filters filters = Enum::NoFilter);
- void searchGroups(Enum::Group group, Enum::Filters filters = Enum::NoFilter);
-
- /**
- * \brief Search in the packages names
- *
- * \p filters can be used to restrict the returned packages
- *
- * \note This method emits \sa package()
- */
- void searchNames(const QStringList &search, Enum::Filters filters = Enum::NoFilter);
- void searchNames(const QString &search, Enum::Filters filters = Enum::NoFilter);
-
- /**
- * \brief Simulates an installation of \p files.
- *
- * You should call this method before installing \p files
- * \note: This method might emit \sa package()
- * with INSTALLING, REMOVING, UPDATING,
- * REINSTALLING or OBSOLETING status.
- */
- void simulateInstallFiles(const QStringList &files);
- void simulateInstallFiles(const QString &file);
-
- /**
- * \brief Simulates an installation of \p packages.
- *
- * You should call this method before installing \p packages
- * \note: This method might emit \sa package()
- * with INSTALLING, REMOVING, UPDATING,
- * REINSTALLING or OBSOLETING status.
- */
- void simulateInstallPackages(const QList<QSharedPointer<Package> > &packages);
- void simulateInstallPackages(const QSharedPointer<Package> &package);
-
- /**
- * \brief Simulates a removal of \p packages.
- *
- * You should call this method before removing \p packages
- * \note: This method might emit \sa package()
- * with INSTALLING, REMOVING, UPDATING,
- * REINSTALLING or OBSOLETING status.
- */
- void simulateRemovePackages(const QList<QSharedPointer<Package> > &packages, bool autoremove);
- void simulateRemovePackages(const QSharedPointer<Package> &package, bool autoremove);
-
- /**
- * \brief Simulates an update of \p packages.
- *
- * You should call this method before updating \p packages
- * \note: This method might emit \sa package()
- * with INSTALLING, REMOVING, UPDATING,
- * REINSTALLING or OBSOLETING status.
- */
- void simulateUpdatePackages(const QList<QSharedPointer<Package> > &packages);
- void simulateUpdatePackages(const QSharedPointer<Package> &package);
-
- /**
- * Update the given \p packages
- *
- * \note This method emits \sa package()
- * and \sa changed()
- */
- void updatePackages(bool only_trusted, const QList<QSharedPointer<Package> > &packages);
- void updatePackages(bool only_trusted, const QSharedPointer<Package> &package);
-
- /**
- * Updates the whole system
- *
- * \p only_trusted indicates if this transaction is only allowed to install trusted packages
- *
- * \note This method emits \sa package()
- * and \sa changed()
- */
- void updateSystem(bool only_trusted);
-
- /**
- * Searchs for a package providing a file/a mimetype
- *
- * \note This method emits \sa package()
- */
- void whatProvides(Enum::Provides type, const QStringList &search, Enum::Filters filters = Enum::NoFilter);
- void whatProvides(Enum::Provides type, const QString &search, Enum::Filters filters = Enum::NoFilter);
-
-
-public Q_SLOTS:
- /**
- * Cancels the transaction
- */
- void cancel();
-
-Q_SIGNALS:
- /**
- * The transaction has changed one of it's properties
- */
- void changed();
-
- /**
- * \brief Sends a category
- *
- * \li \p parent_id is the id of the parent category. A blank parent means a root category
- * \li \p cat_id is the id of the category
- * \li \p name is the category's name. This name is localized.
- * \li \p summary is the category's summary. It is localized.
- * \li \p icon is the icon identifier eg. server-cfg. If unknown, it is set to icon-missing.
- */
- void category(const QString &parent_id, const QString &cat_id, const QString &name, const QString &summary, const QString &icon);
-
- /**
- * Sends additional details about the \p package
- * \sa getDetails()
- */
- void details(const QSharedPointer<PackageKit::Package> &package);
-
- /**
- * Sent when the transaction has been destroyed and is
- * no longer available for use.
- * \warning the object will get deleted after this method is called
- */
- void destroy ();
-
- /**
- * Emitted when a distribution upgrade is available
- * \sa getDistroUpgrades()
- */
- void distroUpgrade(PackageKit::Enum::DistroUpgrade type, const QString& name, const QString& description);
-
- /**
- * Emitted when an error occurs
- */
- void errorCode(PackageKit::Enum::Error error, const QString& details);
-
- /**
- * Emitted when an EULA agreement prevents the transaction from running
- * \note You will need to relaunch the transaction after accepting the EULA
- * \sa acceptEula()
- */
- void eulaRequired(const PackageKit::Client::EulaInfo &info);
-
- /**
- * Emitted when a different media is required in order to fetch packages
- * which prevents the transaction from running
- * \note You will need to relaunch the transaction after changing the media
- * \sa Transaction::MediaType
- */
- void mediaChangeRequired(PackageKit::Enum::MediaType type, const QString& id, const QString& text);
-
- /**
- * Sends the \p filenames contained in package \p package
- * \sa Client::getFiles
- */
- void files(const QSharedPointer<PackageKit::Package> &package, const QStringList &filenames);
-
- /**
- * Emitted when the transaction finishes
- *
- * \p status describes the exit status, \p runtime is the number of seconds it took to complete the transaction
- */
- void finished(PackageKit::Enum::Exit status, uint runtime);
-
- /**
- * Conveys a message sent from the backend
- *
- * \p type is the type of the \p message
- */
- void message(PackageKit::Enum::Message type, const QString &message);
-
- /**
- * Emitted when the transaction sends a new package
- */
- void package(const QSharedPointer<PackageKit::Package> &package);
-
- /**
- * Sends some additional details about a software repository
- * \sa getRepoList()
- */
- void repoDetail(const QString& repoId, const QString& description, bool enabled);
-
- /**
- * Emitted when the user has to validate a repository's signature
- */
- void repoSignatureRequired(const PackageKit::Client::SignatureInfo &info);
-
- /**
- * Indicates that a restart is required
- * \p package is the package who triggered the restart signal
- */
- void requireRestart(PackageKit::Enum::Restart type, const QSharedPointer<PackageKit::Package> &package);
-
- /**
- * Sends an old transaction
- * \sa Client::getOldTransactions
- */
- void transaction(PackageKit::Transaction *transaction);
-
- /**
- * Sends additionnal details about an update
- * \sa Client::getUpdateDetail
- */
- void updateDetail(const PackageKit::Client::UpdateInfo &info);
-
-protected:
- TransactionPrivate * const d_ptr;
-
-private:
- Q_DECLARE_PRIVATE(Transaction);
- friend class ClientPrivate;
- Transaction(const QString &tid,
- const QString ×pec,
- bool succeeded,
- const QString &role,
- uint duration,
- const QString &data,
- uint uid,
- const QString &cmdline,
- QObject *parent);
-};
-
-} // End namespace PackageKit
-
-#endif
diff --git a/lib/packagekit-qt/src/transactionprivate.cpp b/lib/packagekit-qt/src/transactionprivate.cpp
deleted file mode 100644
index 1adcd88..0000000
--- a/lib/packagekit-qt/src/transactionprivate.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * This file is part of the QPackageKit project
- * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "transactionprivate.h"
-#include "transaction.h"
-#include "package.h"
-#include "util.h"
-
-using namespace PackageKit;
-
-TransactionPrivate::TransactionPrivate(Transaction* parent)
- : QObject(parent),
- p(0),
- t(parent),
- destroyed(false)
-{
-}
-
-TransactionPrivate::~TransactionPrivate()
-{
-}
-
-// Signals mangling
-
-void TransactionPrivate::details(const QString& pid, const QString& license, const QString& group, const QString& detail, const QString& url, qulonglong size)
-{
- QSharedPointer<Package> p = packageMap.value(pid, QSharedPointer<Package> (NULL));
- if(p) {
- packageMap.remove(pid);
- } else {
- p = QSharedPointer<Package> (new Package(pid));
- }
-
- Package::Details* d = new Package::Details(p, license, group, detail, url, size);
- p->setDetails(d);
- t->details(p);
-}
-
-void TransactionPrivate::distroUpgrade(const QString& type, const QString& name, const QString& description)
-{
- t->distroUpgrade((Enum::DistroUpgrade)Util::enumFromString<Enum>(type, "DistroUpgrade", "DistroUpgrade"), name, description);
-}
-
-void TransactionPrivate::errorCode(const QString& error, const QString& details)
-{
- t->errorCode((Enum::Error)Util::enumFromString<Enum>(error, "Error", "Error"), details);
-}
-
-void TransactionPrivate::eulaRequired(const QString& eulaId, const QString& pid, const QString& vendor, const QString& licenseAgreement)
-{
- Client::EulaInfo i;
- i.id = eulaId;
- i.package = QSharedPointer<Package> (new Package(pid));
- i.vendorName = vendor;
- i.licenseAgreement = licenseAgreement;
- t->eulaRequired(i);
-}
-
-void TransactionPrivate::mediaChangeRequired(const QString& mediaType, const QString& mediaId, const QString& mediaText)
-{
- t->mediaChangeRequired((Enum::MediaType)Util::enumFromString<Enum>(mediaType, "MediaType", "Media"), mediaId, mediaText);
-}
-
-void TransactionPrivate::files(const QString& pid, const QString& filenames)
-{
- t->files(QSharedPointer<Package> (new Package(pid)), filenames.split(";"));
-}
-
-void TransactionPrivate::finished(const QString& exitCode, uint runtime)
-{
- int exitValue = Util::enumFromString<Enum>(exitCode, "Exit", "Exit");
- t->finished((Enum::Exit)exitValue, runtime);
-}
-
-void TransactionPrivate::destroy()
-{
- emit t->destroy();
- Client::instance()->destroyTransaction(tid);
-}
-
-void TransactionPrivate::message(const QString& type, const QString& message)
-{
- t->message((Enum::Message)Util::enumFromString<Enum>(type, "Message", "Message"), message);
-}
-
-void TransactionPrivate::package(const QString& info, const QString& pid, const QString& summary)
-{
- t->package(QSharedPointer<Package> (new Package(pid, (Enum::Info)Util::enumFromString<Enum>(info, "Info", "Info"), summary)));
-}
-
-void TransactionPrivate::repoSignatureRequired(const QString& pid, const QString& repoName, const QString& keyUrl, const QString& keyUserid, const QString& keyId, const QString& keyFingerprint, const QString& keyTimestamp, const QString& type)
-{
- Client::SignatureInfo i;
- i.package = QSharedPointer<Package> (new Package(pid));
- i.repoId = repoName;
- i.keyUrl = keyUrl;
- i.keyUserid = keyUserid;
- i.keyId = keyId;
- i.keyFingerprint = keyFingerprint;
- i.keyTimestamp = keyTimestamp;
- i.type = (Enum::SigType)Util::enumFromString<Enum>(type, "SigType", "Signature");
-
- t->repoSignatureRequired(i);
-}
-
-void TransactionPrivate::requireRestart(const QString& type, const QString& pid)
-{
- t->requireRestart((Enum::Restart)Util::enumFromString<Enum>(type, "Restart", "Restart"), QSharedPointer<Package> (new Package(pid)));
-}
-
-void TransactionPrivate::transaction(const QString& oldTid, const QString& timespec, bool succeeded, const QString& role, uint duration, const QString& data, uint uid, const QString& cmdline)
-{
- t->transaction(new Transaction(oldTid, timespec, succeeded, role, duration, data, uid, cmdline, t->parent()));
-}
-
-void TransactionPrivate::updateDetail(const QString& pid, const QString& updates, const QString& obsoletes, const QString& vendorUrl, const QString& bugzillaUrl, const QString& cveUrl, const QString& restart, const QString& updateText, const QString& changelog, const QString& state, const QString& issued, const QString& updated)
-{
- Client::UpdateInfo i;
- i.package = QSharedPointer<Package> (new Package(pid));
- if( !updates.isEmpty() ) {
- foreach(const QString p, updates.split("&")) {
- i.updates.append(QSharedPointer<Package> (new Package(p)));
- }
- }
- if( !obsoletes.isEmpty() ) {
- foreach(const QString p, obsoletes.split("&")) {
- i.obsoletes.append(QSharedPointer<Package> (new Package(p)));
- }
- }
- i.vendorUrl = vendorUrl;
- i.bugzillaUrl = bugzillaUrl;
- i.cveUrl = cveUrl;
- i.restart = (Enum::Restart)Util::enumFromString<Enum>(restart, "Restart", "Restart");
- i.updateText = updateText;
- i.changelog = changelog;
- i.state = (Enum::UpdateState)Util::enumFromString<Enum>(state, "UpdateState", "UpdateState");
- i.issued = QDateTime::fromString(issued, Qt::ISODate);
- i.updated = QDateTime::fromString(updated, Qt::ISODate);
-
- t->updateDetail(i);
-}
-
-#include "transactionprivate.moc"
diff --git a/lib/packagekit-qt/src/transactionprivate.h b/lib/packagekit-qt/src/transactionprivate.h
deleted file mode 100644
index 50e275d..0000000
--- a/lib/packagekit-qt/src/transactionprivate.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * This file is part of the QPackageKit project
- * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef TRANSACTIONPRIVATE_H
-#define TRANSACTIONPRIVATE_H
-
-#include <QtCore>
-#include "enum.h"
-#include "client.h"
-
-class TransactionProxy;
-
-namespace PackageKit {
-
-class Transaction;
-class TransactionPrivate : public QObject
-{
- Q_OBJECT
-
-public:
- ~TransactionPrivate();
- QString tid;
- ::TransactionProxy* p;
- Transaction* t;
-
- // Only used for old transactions
- bool oldtrans;
- QDateTime timespec;
- Enum::Role role;
- bool succeeded;
- uint duration;
- QString data;
- uint uid;
- QString cmdline;
- // used for both old and destroyed transactions
- bool destroyed;
-
- // Used for getDetails
- QHash<QString, QSharedPointer<Package> > packageMap;
-
- Client::DaemonError error;
-
-public Q_SLOTS:
- void details(const QString& pid, const QString& license, const QString& group, const QString& detail, const QString& url, qulonglong size);
- void distroUpgrade(const QString& type, const QString& name, const QString& description);
- void errorCode(const QString& error, const QString& details);
- void eulaRequired(const QString& eulaId, const QString& pid, const QString& vendor, const QString& licenseAgreement);
- void mediaChangeRequired(const QString& mediaType, const QString& mediaId, const QString& mediaText);
- void files(const QString& pid, const QString& filenames);
- void finished(const QString& exitCode, uint runtime);
- void message(const QString& type, const QString& message);
- void package(const QString& info, const QString& pid, const QString& summary);
- void repoSignatureRequired(const QString& pid, const QString& repoName, const QString& keyUrl, const QString& keyUserid, const QString& keyId, const QString& keyFingerprint, const QString& keyTimestamp, const QString& type);
- void requireRestart(const QString& type, const QString& pid);
- void transaction(const QString& oldTid, const QString& timespec, bool succeeded, const QString& role, uint duration, const QString& data, uint uid, const QString& cmdline);
- void updateDetail(const QString& pid, const QString& updates, const QString& obsoletes, const QString& vendorUrl, const QString& bugzillaUrl, const QString& cveUrl, const QString& restart, const QString& updateText, const QString& changelog, const QString& state, const QString& issued, const QString& updated);
- void destroy();
-
-private:
- friend class Transaction;
- friend class Client;
- TransactionPrivate(Transaction* parent);
-};
-
-} // End namespace PackageKit
-
-#endif
diff --git a/lib/packagekit-qt/src/util.cpp b/lib/packagekit-qt/src/util.cpp
deleted file mode 100644
index a687153..0000000
--- a/lib/packagekit-qt/src/util.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * This file is part of the QPackageKit project
- * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "util.h"
-#include "package.h"
-
-using namespace PackageKit;
-
-QStringList Util::packageListToPids(const QList<QSharedPointer<Package> >& packages)
-{
- QStringList pids;
- foreach(QSharedPointer<Package> p, packages)
- pids.append(p->id());
-
- return pids;
-}
-
-QString Util::filtersToString(const QFlags<PackageKit::Enum::Filter>& flags)
-{
- QStringList flagStrings;
- for (int i = Enum::UnknownFilter; i < Enum::FilterLast; i *= 2) {
- if ((Enum::Filter) i & flags) {
- flagStrings.append(Util::enumToString<Enum>((Enum::Filter) i, "Filter", "Filter"));
- }
- }
-
- return flagStrings.join(";");
-}
-
-Client::DaemonError Util::errorFromString (QString errorName)
-{
- if (errorName.startsWith ("org.freedesktop.packagekit.")) {
- return Client::ErrorFailedAuth;
- }
-
- errorName.replace ("org.freedesktop.PackageKit.Transaction.", "");
-
- if (errorName.startsWith ("PermissionDenied") || errorName.startsWith ("RefusedByPolicy")) {
- return Client::ErrorFailedAuth;
- }
-
- if (errorName.startsWith ("PackageIdInvalid") || errorName.startsWith ("SearchInvalid") || errorName.startsWith ("FilterInvalid") || errorName.startsWith ("InvalidProvide") || errorName.startsWith ("InputInvalid")) {
- return Client::ErrorInvalidInput;
- }
-
- if (errorName.startsWith ("PackInvalid") || errorName.startsWith ("NoSuchFile") || errorName.startsWith ("NoSuchDirectory")) {
- return Client::ErrorInvalidFile;
- }
-
- if (errorName.startsWith ("NotSupported")) {
- return Client::ErrorFunctionNotSupported;
- }
-
- return Client::ErrorFailed;
-}
-
-
diff --git a/lib/packagekit-qt/src/util.h b/lib/packagekit-qt/src/util.h
deleted file mode 100644
index ba7d90f..0000000
--- a/lib/packagekit-qt/src/util.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * This file is part of the QPackageKit project
- * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef UTIL_H
-#define UTIL_H
-
-#include <QtCore>
-#include "client.h"
-
-namespace PackageKit {
-
-class Package;
-
-class Util
-{
-
-public:
- /**
- * Converts \p str from the PK naming scheme to the QPackageKit enum naming
- * scheme, prepending \p prefix to the result, and returns the value for enum \p enum
- * For example, enumFromString("get_requires", "Action") == "ActionGetRequires"
- * \return the enum value
- */
- template<class T> static int enumFromString(const QString& str, const char* enumName, const QString& prefix = QString())
- {
- QString realName;
- bool lastWasDash = false;
- QChar buf;
-
- for(int i = 0 ; i < str.length() ; ++i) {
- buf = str[i].toLower();
- if(i == 0 || lastWasDash) {
- buf = buf.toUpper();
- }
-
- lastWasDash = false;
- if(buf.toAscii() == '-') {
- lastWasDash = true;
- } else if(buf.toAscii() == '~') {
- lastWasDash = true;
- realName += "Not";
- } else {
- realName += buf;
- }
- };
-
- if(!prefix.isNull())
- realName = prefix + realName;
-
- // Filter quirk
- if(enumName == QString("Filter")) {
- if(realName == QString("FilterNone"))
- realName = "NoFilter";
-
- if(realName == QString("FilterDevel") || realName == QString("FilterNotDevel"))
- realName += "opment";
- }
-
- // Action quirk
- if(enumName == QString("Action") && realName == QString("ActionUpdatePackage"))
- realName = "ActionUpdatePackages";
-
-
- int id = T::staticMetaObject.indexOfEnumerator(enumName);
- QMetaEnum e = T::staticMetaObject.enumerator(id);
- int enumValue = e.keyToValue(realName.toAscii().data());
-
- if(enumValue == -1) {
- enumValue = e.keyToValue(QString("Unknown").append(enumName).toAscii().data());
- qDebug() << "enumFromString (" << enumName << ") : converted" << str << "to" << QString("Unknown").append(enumName) << ", enum value" << enumValue;
- }
- return enumValue;
- }
-
- template<class T> static QString enumToString(int value, const char* enumName, const QString& prefix = QString())
- {
- int id = T::staticMetaObject.indexOfEnumerator(enumName);
- QMetaEnum e = T::staticMetaObject.enumerator(id);
- if (!e.isValid ()) {
- qDebug () << "Invalid enum " << enumName;
- return QString ();
- }
- QString enumString = e.valueToKey(value);
- if(enumString.isNull()) {
- qDebug() << "Enum key not found while searching for value" << value << "in enum" << enumName;
- return QString ();
- }
-
- // Remove the prefix
- if(!prefix.isNull() && enumString.indexOf(prefix) == 0)
- enumString.remove(0, prefix.length());
-
- QString pkName;
- for(int i = 0 ; i < enumString.length() - 1 ; ++i) {
- pkName += enumString[i];
- if(enumString[i+1].isUpper())
- pkName += QChar('-');
- }
- pkName += enumString[enumString.length() - 1];
-
- if(enumName == QString("Filter")) {
- if(pkName.indexOf("Not-") == 0) {
- pkName = pkName.replace(0, 4, "~");
- }
- if(pkName == "No-Filter")
- pkName = "none";
- if(pkName == "Development")
- pkName = "devel";
- if(pkName == "~Development")
- pkName = "~devel";
- }
-
- return pkName.toLower();
- };
-
- static QStringList packageListToPids(const QList<QSharedPointer<Package> >& packages);
-
- static QString filtersToString(const QFlags<PackageKit::Enum::Filter>& flags);
-
- /*
- * Describes the different errors that might happen on the bus
- *
- * \sa Client::error
- * \sa Transaction::error
- */
- typedef enum {
- NoError = 0,
- ErrorFailed,
- ErrorFailedAuth,
- ErrorNoTid,
- ErrorAlreadyTid,
- ErrorRoleUnkown,
- ErrorCannotStartDaemon,
- ErrorInvalidInput,
- ErrorInvalidFile,
- ErrorNotSupported
- } TransactionError;
-
- static Client::DaemonError errorFromString (QString errorName);
-
-};
-
-} // End namespace PackageKit
-
-#endif
diff --git a/lib/packagekit-qt/test/Makefile.am b/lib/packagekit-qt/test/Makefile.am
deleted file mode 100644
index e8b53c9..0000000
--- a/lib/packagekit-qt/test/Makefile.am
+++ /dev/null
@@ -1,67 +0,0 @@
-include ${top_srcdir}/moc.mk
-
-NULL =
-
-INCLUDES = \
- $(QTCORE_CFLAGS) \
- $(QTGUI_CFLAGS) \
- $(QTDBUS_CFLAGS) \
- $(POLKIT_CFLAGS) \
- $(CPPUNIT_CFLAGS) \
- -I$(top_srcdir)/lib/packagekit-qt/src \
- $(NULL)
-
-METASOURCES = AUTO
-
-if EGG_BUILD_TESTS
-
-PK_QT_LIBS = \
- $(top_builddir)/lib/packagekit-qt/src/libpackagekit-qt.la \
- $(NULL)
-
-check_PROGRAMS = \
- pk-self-test
-
-pk_self_test_SOURCES = \
- daemontest.h \
- daemontest.cpp \
- transactiontest.h \
- transactiontest.cpp \
- main.cpp \
- $(NULL)
-
-$(pk_self_test_OBJECTS) : \
- transactiontest.moc \
- daemontest.moc \
- $(NULL)
-
-pk_self_test_LDADD = \
- $(QTCORE_LIBS) \
- $(QTGUI_LIBS) \
- $(QTDBUS_LIBS) \
- $(POLKIT_LIBS) \
- $(CPPUNIT_LIBS) \
- $(PK_QT_LIBS) \
- $(NULL)
-
-pk_self_test_CFLAGS = -DEGG_TEST $(AM_CFLAGS)
-
-TESTS = pk-self-test
-endif
-
-clean-local:
- rm -f *~
- rm -f *.out
-
-CLEANFILES = $(BUILT_SOURCES)
-
-DISTCLEANFILES = \
- $(NULL)
-
-MAINTAINERCLEANFILES = \
- *~ \
- Makefile.in \
- $(NULL)
-
-
--include $(top_srcdir)/git.mk
diff --git a/lib/packagekit-qt/test/daemontest.cpp b/lib/packagekit-qt/test/daemontest.cpp
deleted file mode 100644
index 6eade57..0000000
--- a/lib/packagekit-qt/test/daemontest.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-#include "daemontest.h"
-
-DaemonTest::DaemonTest(QObject* parent) : QObject(parent)
-{
-}
-
-DaemonTest::~DaemonTest()
-{
-}
-
-void DaemonTest::getActions()
-{
- PackageKit::Enum::Roles act = PackageKit::Client::instance()->actions();
- CPPUNIT_ASSERT(act & PackageKit::Enum::RoleInstallPackages); // Not really a test, but if *that* fails, then things are going badly :)
-}
-
-void DaemonTest::getBackendDetail()
-{
- QString backendName = PackageKit::Client::instance()->backendName();
- CPPUNIT_ASSERT(!backendName.isNull());
-}
-
-void DaemonTest::getFilters()
-{
- PackageKit::Enum::Filters f = PackageKit::Client::instance()->filters();
- CPPUNIT_ASSERT(f & PackageKit::Enum::FilterInstalled); // Not really a test, but if *that* fails, then things are going badly :)
-}
-
-void DaemonTest::getGroups()
-{
- PackageKit::Enum::Groups g = PackageKit::Client::instance()->groups();
- CPPUNIT_ASSERT(g.size() != 1);
-}
-
-void DaemonTest::getTimeSinceAction()
-{
- PackageKit::Client::instance()->getTimeSinceAction(PackageKit::Enum::RoleInstallPackages);
-}
-
-CPPUNIT_TEST_SUITE_REGISTRATION(DaemonTest);
-
-#include "daemontest.moc"
-
diff --git a/lib/packagekit-qt/test/daemontest.h b/lib/packagekit-qt/test/daemontest.h
deleted file mode 100644
index d62e530..0000000
--- a/lib/packagekit-qt/test/daemontest.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef DAEMONTEST_H
-#define DAEMONTEST_H
-
-#include <QObject>
-#include <cppunit/TestFixture.h>
-#include <cppunit/TestSuite.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include "QPackageKit"
-
-class DaemonTest : public QObject, public CppUnit::TestFixture
-{
- Q_OBJECT
-
- CPPUNIT_TEST_SUITE(DaemonTest);
- CPPUNIT_TEST(getBackendDetail);
- CPPUNIT_TEST(getActions);
- CPPUNIT_TEST(getFilters);
- CPPUNIT_TEST(getGroups);
- CPPUNIT_TEST(getTimeSinceAction);
- CPPUNIT_TEST_SUITE_END();
-
-public:
- DaemonTest(QObject* parent = 0);
- ~DaemonTest();
-
- void getActions();
- void getBackendDetail();
- void getFilters();
- void getGroups();
- void getTimeSinceAction();
-};
-
-#endif
diff --git a/lib/packagekit-qt/test/main.cpp b/lib/packagekit-qt/test/main.cpp
deleted file mode 100644
index 600c77c..0000000
--- a/lib/packagekit-qt/test/main.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <QApplication>
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/ui/text/TestRunner.h>
-
-#include "QPackageKit"
-
-int main(int argc, char **argv)
-{
- // Check that we are using the dummy backend for testing (I'm sometimes absent minded)
- QString backendName = PackageKit::Client::instance()->backendName();
- if(backendName != "dummy") {
- qFatal("Please use the dummy backend for testing");
- }
-
- CppUnit::TextUi::TestRunner runner;
- CppUnit::TestFactoryRegistry ®istry = CppUnit::TestFactoryRegistry::getRegistry();
- runner.addTest(registry.makeTest());
- QCoreApplication app(argc, argv);
- runner.run();
- return 0;
-}
diff --git a/lib/packagekit-qt/test/transactiontest.cpp b/lib/packagekit-qt/test/transactiontest.cpp
deleted file mode 100644
index 03fcffc..0000000
--- a/lib/packagekit-qt/test/transactiontest.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-#include "transactiontest.h"
-
-using namespace PackageKit;
-
-TransactionTest::TransactionTest(QObject* parent) : QObject(parent)
-{
- currentPackage = QSharedPointer<Package> (NULL);
- connect (PackageKit::Client::instance(), SIGNAL(error(PackageKit::Client::DaemonError)), this, SLOT(error(PackageKit::Client::DaemonError)));
-}
-
-TransactionTest::~TransactionTest()
-{
-}
-
-void TransactionTest::searchName()
-{
- success = FALSE;
- Transaction* t = PackageKit::Client::instance()->searchNames("vim");
- qDebug() << "searchName";
- QEventLoop el;
- connect(t, SIGNAL(package(QSharedPointer<PackageKit::Package>)), this, SLOT(searchName_cb(QSharedPointer<PackageKit::Package>)));
- connect(t, SIGNAL(finished(PackageKit::Enum::Exit, uint)), &el, SLOT(quit()));
- el.exec();
- CPPUNIT_ASSERT_MESSAGE("searchName", success);
-}
-
-void TransactionTest::searchDesktop()
-{
- success = FALSE;
- QSharedPointer<Package> p = PackageKit::Client::instance()->searchFromDesktopFile("/usr/share/applications/gnome-terminal.desktop");
- qDebug() << "searchDesktop";
- CPPUNIT_ASSERT_MESSAGE("searchDesktop", p);
-}
-
-void TransactionTest::resolveAndInstallAndRemove()
-{
- success = FALSE;
- Client* c = Client::instance();
- Transaction* t = c->resolve("glib2");
- qDebug() << "Resolving";
- QEventLoop el;
- connect(t, SIGNAL(package(QSharedPointer<PackageKit::Package>)), this, SLOT(resolveAndInstallAndRemove_cb(QSharedPointer<PackageKit::Package>)));
- connect(t, SIGNAL(finished(PackageKit::Enum::Exit, uint)), &el, SLOT(quit()));
- el.exec();
- CPPUNIT_ASSERT_MESSAGE("resolve", success);
-
- t = c->installPackages(FALSE, currentPackage);
- CPPUNIT_ASSERT_MESSAGE("installPackages", t != NULL);
- qDebug() << "Installing";
- connect(t, SIGNAL(finished(PackageKit::Enum::Exit, uint)), &el, SLOT(quit()));
- el.exec();
-
- t = c->removePackages(currentPackage, FALSE, FALSE);
- CPPUNIT_ASSERT_MESSAGE("removePackages", t != NULL);
- qDebug() << "Removing";
- connect(t, SIGNAL(finished(PackageKit::Enum::Exit, uint)), &el, SLOT(quit()));
- el.exec();
-}
-
-void TransactionTest::refreshCache()
-{
- Transaction* t = PackageKit::Client::instance()->refreshCache(true);
- qDebug() << "Refreshing cache";
- CPPUNIT_ASSERT_MESSAGE("refreshCache", t != NULL);
- QEventLoop el;
- connect(t, SIGNAL(finished(PackageKit::Enum::Exit, uint)), &el, SLOT(quit()));
- el.exec();
-}
-
-void TransactionTest::getDistroUpgrades()
-{
- success = FALSE;
- Transaction* t = PackageKit::Client::instance()->getDistroUpgrades();
- qDebug() << "Getting distro upgrades";
- CPPUNIT_ASSERT_MESSAGE("getDistroUpgrades", t != NULL);
- QEventLoop el;
- connect(t, SIGNAL(finished(PackageKit::Enum::Exit, uint)), &el, SLOT(quit()));
- connect(t, SIGNAL(distroUpgrade(PackageKit::Enum::DistroUpgrade, const QString&, const QString&)), this, SLOT(getDistroUpgrades_cb()));
- el.exec();
- CPPUNIT_ASSERT_MESSAGE("getDistroUpgrades (not fatal, only means there are no distro upgrades)", success);
-
-}
-
-void TransactionTest::getRepos()
-{
- success = FALSE;
-
- Transaction* t = PackageKit::Client::instance()->getRepoList();
- CPPUNIT_ASSERT_MESSAGE("getRepoList", t != NULL);
- qDebug() << "Getting repos (non filtered)";
- QEventLoop el;
- connect(t, SIGNAL(finished(PackageKit::Enum::Exit, uint)), &el, SLOT(quit()));
- connect(t, SIGNAL(repoDetail(const QString&, const QString&, bool)), this, SLOT(getRepos_cb(const QString&, const QString&, bool)));
- el.exec();
- CPPUNIT_ASSERT_MESSAGE("getRepoList", success);
-
- success = FALSE;
- t = PackageKit::Client::instance()->getRepoList(PackageKit::Enum::FilterNotDevelopment);
- CPPUNIT_ASSERT_MESSAGE("getRepoList (filtered)", t != NULL);
- qDebug() << "Getting repos (filtered)";
- connect(t, SIGNAL(finished(PackageKit::Enum::Exit, uint)), &el, SLOT(quit()));
- connect(t, SIGNAL(repoDetail(const QString&, const QString&, bool)), this, SLOT(getRepos_cb(const QString&, const QString&, bool)));
- el.exec();
- CPPUNIT_ASSERT_MESSAGE("getRepoList (filtered)", success);
-}
-
-void TransactionTest::searchName_cb(QSharedPointer<Package> p)
-{
- qDebug() << "Emitted package: " << p->name ();
- success = TRUE;
-}
-
-void TransactionTest::resolveAndInstallAndRemove_cb(QSharedPointer<Package> p)
-{
- qDebug () << "Emitted package: " << p->name ();
- currentPackage = p;
- success = TRUE;
-}
-
-void TransactionTest::getDistroUpgrades_cb()
-{
- success = TRUE;
-}
-
-void TransactionTest::getRepos_cb(const QString& repoName, const QString& repoDetail, bool enabled)
-{
- qDebug() << "Repository" << repoName << " (" << repoDetail << ") is" << (enabled ? "enabled" : "disabled");
- success = TRUE;
-}
-
-void TransactionTest::error (PackageKit::Client::DaemonError e)
-{
- qDebug() << "Aieeeeee, daemon error!" << e;
-}
-
-CPPUNIT_TEST_SUITE_REGISTRATION(TransactionTest);
-
-#include "transactiontest.moc"
-
diff --git a/lib/packagekit-qt/test/transactiontest.h b/lib/packagekit-qt/test/transactiontest.h
deleted file mode 100644
index 13f2db6..0000000
--- a/lib/packagekit-qt/test/transactiontest.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef TRANSACTIONTEST_H
-#define TRANSACTIONTEST_H
-
-#include <QObject>
-#include <cppunit/TestFixture.h>
-#include <cppunit/TestSuite.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include "QPackageKit"
-
-class TransactionTest : public QObject, public CppUnit::TestFixture
-{
- Q_OBJECT
-
- CPPUNIT_TEST_SUITE(TransactionTest);
- CPPUNIT_TEST(searchName);
- CPPUNIT_TEST(searchDesktop);
- CPPUNIT_TEST(resolveAndInstallAndRemove);
- CPPUNIT_TEST(refreshCache);
- CPPUNIT_TEST(getDistroUpgrades);
- CPPUNIT_TEST(getRepos);
- CPPUNIT_TEST_SUITE_END();
-
-public:
- TransactionTest(QObject* parent = 0);
- ~TransactionTest();
-
- void searchName();
- void searchDesktop();
- void resolveAndInstallAndRemove();
- void refreshCache();
- void getDistroUpgrades();
- void getRepos();
-
-public slots:
- void searchName_cb(QSharedPointer<PackageKit::Package> p);
- void resolveAndInstallAndRemove_cb(QSharedPointer<PackageKit::Package> p);
- void getDistroUpgrades_cb();
- void getRepos_cb(const QString& repoName, const QString& repoDetail, bool enabled);
-
- void error(PackageKit::Client::DaemonError e);
-
-private:
- bool success;
- QSharedPointer<PackageKit::Package> currentPackage;
-
-};
-
-#endif
commit 8312e6dd069c55e3414b0a2bce3287b5456c045f
Merge: 3475699... 02d3d92...
Author: Daniel Nicoletti <dantti85-pk at yahoo.com.br>
Date: Wed Nov 9 12:18:59 2011 -0200
Merge branch 'master' of gitorious.org:packagekit/packagekit
commit 347569986135208a9387026731c11538ddac046d
Author: Daniel Nicoletti <dantti85-pk at yahoo.com.br>
Date: Wed Nov 9 12:18:07 2011 -0200
dummy: Make sure we don't ask for eula or repo signatures while simulating
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index e2d3057..53ce20f 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -911,8 +911,8 @@ pk_backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **p
gboolean has_eula;
/* FIXME: support only_trusted */
-
- if (_use_gpg && !_has_signature) {
+ PkRoleEnum role = pk_backend_get_role (backend);
+ if (role == PK_ROLE_ENUM_UPDATE_PACKAGES && _use_gpg && !_has_signature) {
pk_backend_repo_signature_required (backend, package_ids[0], "updates",
"http://example.com/gpgkey",
"Test Key (Fedora) fedora at example.com",
@@ -926,7 +926,7 @@ pk_backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **p
}
eula_id = "eula_hughsie_dot_com";
has_eula = pk_backend_is_eula_valid (backend, eula_id);
- if (_use_eula && !has_eula) {
+ if (role == PK_ROLE_ENUM_UPDATE_PACKAGES && _use_eula && !has_eula) {
license_agreement = "Narrator: In A.D. 2101, war was beginning.\n"
"Captain: What happen ?\n"
"Mechanic: Somebody set up us the bomb.\n\n"
commit 02d3d92bd84d36c4d495040253f7dce3b63f890a
Author: Pavel Fric <pavelfric at seznam.cz>
Date: Mon Nov 7 09:32:18 2011 +0000
Update Czech translation
Signed-off-by: Richard Hughes <richard at hughsie.com>
diff --git a/po/cs.po b/po/cs.po
index 9f94bd6..c974109 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -1,22 +1,26 @@
-# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
-#
-# fri <pavelfric at seznam.cz>, 2011
-# Richard Hughes <richard at hughsie.com>, 2011
+#
+# Translators:
+# Adam Pribyl <pribyl at lowlevel.cz>, 2008.
+# fri <pavelfric at seznam.cz>, 2011.
+# Richard Hughes <richard at hughsie.com>, 2011.
+# Vojtech Smejkal <smejkalv at gmail.com>, 2008.
+# Pavel Fric <fripohled.blogspot.com>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-04 10:50+0100\n"
-"PO-Revision-Date: 2011-05-04 09:56+0000\n"
-"Last-Translator: hughsie <richard at hughsie.com>\n"
-"Language-Team: Czech (http://www.transifex.net/projects/p/freedesktop/team/cs/)\n"
+"POT-Creation-Date: 2011-09-05 16:58+0100\n"
+"PO-Revision-Date: 2011-10-02 14:47+0200\n"
+"Last-Translator: Pavel Fric <fripohled.blogspot.com>\n"
+"Language-Team: German <kde-i18n-doc at kde.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: cs\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2\n"
+"X-Generator: Lokalize 1.2\n"
#. TRANSLATORS: this is an atomic transaction
#. TRANSLATORS: the role is the point of the transaction, e.g. update-system
@@ -286,7 +290,7 @@ msgstr "Nejsou tu žádné balÃÄky k aktualizaci"
#. TRANSLATORS: the transaction failed in a way we could not expect
#: ../client/pk-console.c:704
-#: ../contrib/command-not-found/pk-command-not-found.c:639
+#: ../contrib/command-not-found/pk-command-not-found.c:634
msgid "The transaction failed"
msgstr "Transakce se nezdaÅila"
@@ -450,12 +454,12 @@ msgstr "NejvÄtÅ¡Ã stáÅà vyrovnávacà pamÄti metadat. PoužÃt -1 pro 'nik
#. TRANSLATORS: command line argument, --help
#: ../client/pk-console.c:1301
msgid "Show help options."
-msgstr ""
+msgstr "Ukázat volby pro nápovÄdu."
#. TRANSLATORS: we failed to contact the daemon
#: ../client/pk-console.c:1331
msgid "Failed to parse command line"
-msgstr ""
+msgstr "NepodaÅilo se zpracovat pÅÃkazový Åádek"
#. TRANSLATORS: we failed to contact the daemon
#: ../client/pk-console.c:1341
@@ -517,8 +521,7 @@ msgstr "Je požadován název balÃÄku, který se má odstranit"
#. where
#: ../client/pk-console.c:1536
msgid "A destination directory and the package names to download are required"
-msgstr ""
-"Jsou požadovány cÃlový adresáŠa názvy balÃÄků, které se majà stáhnout"
+msgstr "Jsou požadovány cÃlový adresáŠa názvy balÃÄků, které se majà stáhnout"
#. TRANSLATORS: the directory does not exist, so we can't continue
#: ../client/pk-console.c:1543
@@ -604,8 +607,7 @@ msgstr "Nastavit název souboru se závislostmi, které majà být vynechány"
#. TRANSLATORS: the output location
#: ../client/pk-generate-pack.c:256
-msgid ""
-"The output file or directory (the current directory is used if omitted)"
+msgid "The output file or directory (the current directory is used if omitted)"
msgstr ""
"Výstupnà soubor nebo adresáŠ(je-li vynecháno, použÃvá se souÄasný adresáÅ)"
@@ -730,159 +732,154 @@ msgid "PackageKit Monitor"
msgstr "Sledovánà PackageKit"
#. TRANSLATORS: when we are getting data from the daemon
-#: ../contrib/browser-plugin/pk-plugin-install.c:499
+#: ../contrib/browser-plugin/pk-plugin-install.c:503
msgid "Getting package information..."
msgstr "ZjiÅ¡Å¥ujà se informace o balÃÄcÃch..."
#. TRANSLATORS: run an applicaiton
-#: ../contrib/browser-plugin/pk-plugin-install.c:505
+#: ../contrib/browser-plugin/pk-plugin-install.c:509
#, c-format
msgid "Run %s"
msgstr "Spustit %s"
#. TRANSLATORS: show the installed version of a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:511
+#: ../contrib/browser-plugin/pk-plugin-install.c:515
msgid "Installed version"
msgstr "Nainstalovaná verze"
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:519
+#: ../contrib/browser-plugin/pk-plugin-install.c:523
#, c-format
msgid "Run version %s now"
msgstr "Spustit verzi %s"
#. TRANSLATORS: run the application now
-#: ../contrib/browser-plugin/pk-plugin-install.c:525
+#: ../contrib/browser-plugin/pk-plugin-install.c:529
msgid "Run now"
msgstr "Spustit nynÃ"
#. TRANSLATORS: update to a new version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:531
+#: ../contrib/browser-plugin/pk-plugin-install.c:535
#, c-format
msgid "Update to version %s"
msgstr "Aktualizovat na verzi %s"
#. TRANSLATORS: To install a package
-#: ../contrib/browser-plugin/pk-plugin-install.c:537
+#: ../contrib/browser-plugin/pk-plugin-install.c:541
#, c-format
msgid "Install %s now"
msgstr "Instalovat nynà %s"
#. TRANSLATORS: the version of the package
-#: ../contrib/browser-plugin/pk-plugin-install.c:540
+#: ../contrib/browser-plugin/pk-plugin-install.c:544
msgid "Version"
msgstr "Verze"
#. TRANSLATORS: noting found, so can't install
-#: ../contrib/browser-plugin/pk-plugin-install.c:545
+#: ../contrib/browser-plugin/pk-plugin-install.c:549
msgid "No packages found for your system"
msgstr "Pro váš systém nebyly nalezeny žádné balÃÄky"
#. TRANSLATORS: package is being installed
-#: ../contrib/browser-plugin/pk-plugin-install.c:550
+#: ../contrib/browser-plugin/pk-plugin-install.c:554
msgid "Installing..."
msgstr "Instaluje se..."
#. TRANSLATORS: downloading repo data so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:366
+#: ../contrib/command-not-found/pk-command-not-found.c:363
msgid "Downloading details about the software sources."
msgstr "Stahujà se podrobnosti ke zdrojům programů."
#. TRANSLATORS: downloading file lists so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:370
+#: ../contrib/command-not-found/pk-command-not-found.c:367
msgid "Downloading filelists (this may take some time to complete)."
msgstr "Stahujà se seznamy souborů (dokonÄenà úkolu může chvÃli trvat)."
#. TRANSLATORS: waiting for native lock
-#: ../contrib/command-not-found/pk-command-not-found.c:374
+#: ../contrib/command-not-found/pk-command-not-found.c:371
msgid "Waiting for package manager lock."
msgstr "Äeká se na zámek správce balÃÄků."
#. TRANSLATORS: loading package cache so we can search
-#: ../contrib/command-not-found/pk-command-not-found.c:378
+#: ../contrib/command-not-found/pk-command-not-found.c:375
msgid "Loading list of packages."
msgstr "Nahráváse seznam balÃÄků."
#. TRANSLATORS: we failed to find the package, this shouldn't happen
-#: ../contrib/command-not-found/pk-command-not-found.c:444
+#: ../contrib/command-not-found/pk-command-not-found.c:439
msgid "Failed to search for file"
msgstr "Nalezenà souboru se nezdaÅilo"
#. TRANSLATORS: the transaction failed in a way we could not expect
-#: ../contrib/command-not-found/pk-command-not-found.c:456
+#: ../contrib/command-not-found/pk-command-not-found.c:451
msgid "Getting the list of files failed"
msgstr "ZÃskánà seznamu souborů se nezdaÅilo"
#. TRANSLATORS: we failed to launch the executable, the error follows
-#: ../contrib/command-not-found/pk-command-not-found.c:602
+#: ../contrib/command-not-found/pk-command-not-found.c:597
msgid "Failed to launch:"
msgstr "NepodaÅilo se spustit:"
#. TRANSLATORS: we failed to install the package
-#: ../contrib/command-not-found/pk-command-not-found.c:630
+#: ../contrib/command-not-found/pk-command-not-found.c:625
msgid "Failed to install packages"
msgstr "NepodaÅilo se nainstalovat balÃÄky"
-#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/command-not-found/pk-command-not-found.c:706
-msgid "PackageKit Command Not Found"
-msgstr "PÅÃkaz pro PackageKit nebyl nalezen"
-
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:723
msgid "command not found"
msgstr "PÅÃkaz nebyl nenalezen."
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:759
+#: ../contrib/command-not-found/pk-command-not-found.c:741
msgid "Similar command is:"
msgstr "Podobný pÅÃkaz je:"
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:773
+#: ../contrib/command-not-found/pk-command-not-found.c:755
msgid "Run similar command:"
msgstr "Spustit podobný pÅÃkaz:"
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:787
-#: ../contrib/command-not-found/pk-command-not-found.c:796
+#: ../contrib/command-not-found/pk-command-not-found.c:769
+#: ../contrib/command-not-found/pk-command-not-found.c:778
msgid "Similar commands are:"
msgstr "Podobné pÅÃkazy jsou:"
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:785
msgid "Please choose a command to run"
msgstr "Vyberte, prosÃm, pÅÃkaz ke spuÅ¡tÄnÃ"
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:821
+#: ../contrib/command-not-found/pk-command-not-found.c:803
msgid "The package providing this file is:"
msgstr "BalÃÄek poskytujÃcà tento soubor je:"
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:828
+#: ../contrib/command-not-found/pk-command-not-found.c:810
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr "Nainstalovat balÃÄek '%s', který poskytuje pÅÃkaz '%s'?"
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:855
+#: ../contrib/command-not-found/pk-command-not-found.c:837
msgid "Packages providing this file are:"
msgstr "BalÃÄky poskytujÃcà tento soubor jsou:"
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:865
+#: ../contrib/command-not-found/pk-command-not-found.c:847
msgid "Suitable packages are:"
msgstr "Vhodn̩ bal̀ky jsou:"
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:874
+#: ../contrib/command-not-found/pk-command-not-found.c:856
msgid "Please choose a package to install"
msgstr "Vyberte, prosÃm, balÃÄek, který se má instalovat"
@@ -1809,13 +1806,19 @@ msgstr "NásledujÃcà balÃky musà být znovu nainstalovány:"
msgid "The following packages have to be downgraded:"
msgstr "NásledujÃcà balÃky musà být vráceny na pÅedchozà verzi:"
+#. TRANSLATORS: When processing, untrusted and non-verified packages may be
+#. encountered
+#: ../lib/packagekit-glib2/pk-task-text.c:325
+msgid "The following packages are untrusted:"
+msgstr "NásledujÃcà balÃÄky jsou nedůvÄryhodné:"
+
#. TRANSLATORS: ask the user if the proposed changes are okay
-#: ../lib/packagekit-glib2/pk-task-text.c:380
+#: ../lib/packagekit-glib2/pk-task-text.c:385
msgid "Proceed with changes?"
msgstr "PokraÄovat se zmÄnami?"
#. TRANSLATORS: tell the user we didn't do anything
-#: ../lib/packagekit-glib2/pk-task-text.c:385
+#: ../lib/packagekit-glib2/pk-task-text.c:390
msgid "The transaction did not proceed."
msgstr "Transakce nemohla dále pokraÄovat."
@@ -1824,7 +1827,7 @@ msgstr "Transakce nemohla dále pokraÄovat."
#. licence agreements.
#. - Change this to 'auth_admin' for environments where users should not
#. be given the option to make legal decisions.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:7
msgid "Accept EULA"
msgstr "PÅijmout licenÄnà smlouvu (EULA)"
@@ -1901,7 +1904,7 @@ msgstr "Pro povýšenà operaÄnÃho systému je vyžadováno oprávnÄnÃ"
#. - Normal users are allowed to cancel their own task without
#. authentication, but a different user id needs the admin password
#. to cancel another users task.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:27
msgid "Cancel foreign task"
msgstr "Zrušit cizà úkol"
@@ -1911,7 +1914,7 @@ msgstr "Zrušit cizà úkol"
#. instance to a LTSP image or a virtual machine.
#. - This could be used to overwrite files not owned by the user using
#. a carefully created package file.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:34
msgid "Change location that packages are installed"
msgstr "ZmÄnit mÃsto, kam jsou balÃÄky instalovány"
@@ -1920,7 +1923,7 @@ msgstr "ZmÄnit mÃsto, kam jsou balÃÄky instalovány"
#. - Normal users require admin authentication to enable or disable
#. software sources as this can be used to enable new updates or
#. install different versions of software.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:40
msgid "Change software source parameters"
msgstr "ZmÄnit parametry zdrojů programů"
@@ -1930,7 +1933,7 @@ msgstr "ZmÄnit parametry zdrojů programů"
#. from signed repositories, as this cannot exploit a system.
#. - Paranoid users (or parents!) can change this to 'auth_admin' or
#. 'auth_admin_keep'.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:47
msgid "Install signed package"
msgstr "Nainstalovat podepsaný balÃk"
@@ -1940,7 +1943,7 @@ msgstr "Nainstalovat podepsaný balÃk"
#. unrecognised packages, as allowing users to do this without a
#. password would be a massive security hole.
#. - This is not retained as each package should be authenticated.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:54
msgid "Install untrusted local file"
msgstr "Nainstalovat mÃstnà nedůvÄryhodný soubor"
@@ -1948,7 +1951,7 @@ msgstr "Nainstalovat mÃstnà nedůvÄryhodný soubor"
#. SECURITY:
#. - Normal users do not require admin authentication to refresh the
#. cache, as this doesn't actually install or remove software.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:59
msgid "Refresh system sources"
msgstr "Obnovit systémové zdroje"
@@ -1959,7 +1962,7 @@ msgstr "Obnovit systémové zdroje"
#. - This should not be set to 'yes' as unprivileged users could then
#. try to rebind drivers in use, for instance security authentication
#. devices.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:67
msgid "Reload a device"
msgstr "Nahrát zaÅÃzenà znovu"
@@ -1972,7 +1975,7 @@ msgstr "Nahrát zaÅÃzenà znovu"
#. admin authentication has been obtained, otherwise packages can still
#. be removed. If this is not possible, change this authentication to
#. 'auth_admin'.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:77
msgid "Remove package"
msgstr "Odstranit balÃÄek"
@@ -1981,7 +1984,7 @@ msgstr "Odstranit balÃÄek"
#. - Normal users require admin authentication to rollback system state
#. as this will change a large number of packages, and could expose the
#. system to previously patched security vulnerabilities.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:83
msgid "Rollback to a previous transaction"
msgstr "Vrátit se k pÅedchozà transakci"
@@ -1989,7 +1992,7 @@ msgstr "Vrátit se k pÅedchozà transakci"
#. SECURITY:
#. - Normal users do not require admin authentication to set the proxy
#. used for downloading packages.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:88
msgid "Set network proxy"
msgstr "Nastavit proxy sÃtÄ"
@@ -1999,7 +2002,7 @@ msgstr "Nastavit proxy sÃtÄ"
#. - This implies adding an explicit trust, and should not be granted
#. without a secure authentication.
#. - This is not kept as each package should be authenticated.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:95
msgid "Trust a key used for signing packages"
msgstr "DůvÄÅovat klÃÄi použitému k podepsánà balÃÄků"
@@ -2010,7 +2013,7 @@ msgstr "DůvÄÅovat klÃÄi použitému k podepsánà balÃÄků"
#. to update the system when unattended.
#. - Changing this to anything other than 'yes' will break unattended
#. updates.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:103
msgid "Update packages"
msgstr "Aktualizovat balÃÄky"
@@ -2019,104 +2022,68 @@ msgstr "Aktualizovat balÃÄky"
#. - Normal users require admin authentication to upgrade the disto as
#. this can make the system unbootable or stop other applications from
#. working.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:109
msgid "Upgrade System"
msgstr "Povýšit systém"
-#. TRANSLATORS: failed due to DBus security
-#: ../src/pk-main.c:91
-msgid "Startup failed due to security policies on this machine."
-msgstr "Chyba pÅi spuÅ¡tÄnà kvůli bezpeÄnostÃm smÄrnicÃm na tomto stroji."
-
-#. TRANSLATORS: only two ways this can fail...
-#: ../src/pk-main.c:93
-msgid "This can happen for two reasons:"
-msgstr "Toto se může stát ze dvou důvodů:"
-
-#. TRANSLATORS: only allowed to be owned by root
-#: ../src/pk-main.c:95
-msgid "The correct user is not launching the executable (usually root)"
-msgstr "Program nenà spuÅ¡tÄn pod správným uživatelem (obvykle superuživatel)"
-
-#. TRANSLATORS: or we are installed in a prefix
-#: ../src/pk-main.c:97
-msgid ""
-"The org.freedesktop.PackageKit.conf file is not installed in the system "
-"directory:"
-msgstr ""
-"Soubor org.freedesktop.PackageKit.conf nenà nainstalován v systémovém "
-"adresáÅi:"
-
#. TRANSLATORS: a backend is the system package tool, e.g. yum, apt
-#: ../src/pk-main.c:223
+#: ../src/pk-main.c:148
msgid "Packaging backend to use, e.g. dummy"
msgstr "BalÃÄkovacà systém, který se má použÃt, napÅ. dummy"
#. TRANSLATORS: if we should run in the background
-#: ../src/pk-main.c:226
+#: ../src/pk-main.c:151
msgid "Daemonize and detach from the terminal"
msgstr "Spustit démona a odpojit od terminálu"
#. TRANSLATORS: if we should not monitor how long we are inactive for
-#: ../src/pk-main.c:229
+#: ../src/pk-main.c:154
msgid "Disable the idle timer"
msgstr "Vypnout nevyužitý ÄasovaÄ"
#. TRANSLATORS: show version
-#: ../src/pk-main.c:232
+#: ../src/pk-main.c:157
msgid "Show version and exit"
msgstr "Ukázat verzi a ukonÄit se"
#. TRANSLATORS: exit after we've started up, used for user profiling
-#: ../src/pk-main.c:235
+#: ../src/pk-main.c:160
msgid "Exit after a small delay"
msgstr "UkonÄit se s krátkým zpoždÄnÃm"
#. TRANSLATORS: exit straight away, used for automatic profiling
-#: ../src/pk-main.c:238
+#: ../src/pk-main.c:163
msgid "Exit after the engine has loaded"
msgstr "UkonÄit se až poté, co se naÄte jádro"
#. TRANSLATORS: describing the service that is running
-#: ../src/pk-main.c:253
+#: ../src/pk-main.c:177
msgid "PackageKit service"
msgstr "Služba PackageKit"
-#. TRANSLATORS: fatal error, dbus is not running
-#: ../src/pk-main.c:298
-msgid "Cannot connect to the system bus"
-msgstr "Nelze se pÅipojit k systémové sbÄrnici"
-
-#: ../src/pk-main.c:344
+#: ../src/pk-main.c:249
msgid "Failed to load any of the specified backends:"
-msgstr ""
-
-#. TRANSLATORS: cannot register on system bus, unknown reason -- geeky error
-#. follows
-#: ../src/pk-main.c:358
-msgid "Error trying to start:"
-msgstr "Chyba pÅi pokusu o spuÅ¡tÄnÃ:"
+msgstr "NepodaÅilo se nahrát kterýkoli z uvedených systémů:"
#. TRANSLATORS: is not GPG signed
-#: ../src/pk-transaction.c:2611 ../src/pk-transaction.c:2618
+#: ../src/pk-transaction.c:2659
msgid "The software is not from a trusted source."
msgstr "Program nenà z důvÄryhodného zdroje."
-#: ../src/pk-transaction.c:2623
+#: ../src/pk-transaction.c:2667
msgid "Do not update this package unless you are sure it is safe to do so."
msgstr "Aktualizujte tento balÃÄek, jen když jste pÅesvÄdÄen, že je bezpeÄný."
-#: ../src/pk-transaction.c:2624
+#: ../src/pk-transaction.c:2668
msgid "Do not update these packages unless you are sure it is safe to do so."
-msgstr ""
-"Aktualizujte tyto balÃÄky, jen když jste pÅesvÄdÄen, že jsou bezpeÄné."
+msgstr "Aktualizujte tyto balÃÄky, jen když jste pÅesvÄdÄen, že jsou bezpeÄné."
-#: ../src/pk-transaction.c:2634
+#: ../src/pk-transaction.c:2678
msgid "Do not install this package unless you are sure it is safe to do so."
msgstr "Instalujte tento balÃÄek, jen když jste pÅesvÄdÄen, že je bezpeÄný."
-#: ../src/pk-transaction.c:2635
+#: ../src/pk-transaction.c:2679
msgid "Do not install these packages unless you are sure it is safe to do so."
msgstr "Instalujte tyto balÃÄky, jen když jste pÅesvÄdÄen, že jsou bezpeÄné."
commit b0be2c246e258446e31bb152b050b9fef7b9f3ab
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Thu Nov 3 18:27:30 2011 +0100
trivial: Finish transaction without error
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 4b61f17..850284a 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -1973,16 +1973,16 @@ pk_transaction_run (PkTransaction *transaction)
if (pk_backend_get_is_error_set (priv->backend)) {
pk_transaction_finished_emit (transaction, PK_EXIT_ENUM_FAILED, 0);
- /* do not fail the tranaction */
+ /* do not fail the transaction */
ret = TRUE;
goto out;
}
/* check if we should skip this transaction */
if (pk_backend_get_exit_code (priv->backend) == PK_EXIT_ENUM_SKIP_TRANSACTION) {
- pk_transaction_finished_emit (transaction, PK_EXIT_ENUM_SKIP_TRANSACTION, 0);
+ pk_transaction_finished_emit (transaction, PK_EXIT_ENUM_SUCCESS, 0);
- /* do not fail the tranaction */
+ /* do not fail the transaction */
ret = TRUE;
goto out;
}
commit a10690abb5a715b4194d8770f25286920f2b54ca
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Thu Nov 3 14:59:01 2011 +0100
Add possibility for backends/plugins to skip transactions
diff --git a/lib/packagekit-glib2/pk-enum.c b/lib/packagekit-glib2/pk-enum.c
index 705a815..918c532 100644
--- a/lib/packagekit-glib2/pk-enum.c
+++ b/lib/packagekit-glib2/pk-enum.c
@@ -45,6 +45,7 @@ static const PkEnumMatch enum_exit[] = {
{PK_EXIT_ENUM_KILLED, "killed"},
{PK_EXIT_ENUM_NEED_UNTRUSTED, "need-untrusted"},
{PK_EXIT_ENUM_CANCELLED_PRIORITY, "cancelled-priority"},
+ {PK_EXIT_ENUM_SKIP_TRANSACTION, "skip-transaction"},
{0, NULL}
};
diff --git a/lib/packagekit-glib2/pk-enum.h b/lib/packagekit-glib2/pk-enum.h
index ea3a26c..bb21756 100644
--- a/lib/packagekit-glib2/pk-enum.h
+++ b/lib/packagekit-glib2/pk-enum.h
@@ -165,6 +165,7 @@ typedef enum {
PK_EXIT_ENUM_MEDIA_CHANGE_REQUIRED,
PK_EXIT_ENUM_NEED_UNTRUSTED,
PK_EXIT_ENUM_CANCELLED_PRIORITY,
+ PK_EXIT_ENUM_SKIP_TRANSACTION,
PK_EXIT_ENUM_LAST
} PkExitEnum;
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index be2e1f9..4b61f17 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -1978,6 +1978,15 @@ pk_transaction_run (PkTransaction *transaction)
goto out;
}
+ /* check if we should skip this transaction */
+ if (pk_backend_get_exit_code (priv->backend) == PK_EXIT_ENUM_SKIP_TRANSACTION) {
+ pk_transaction_finished_emit (transaction, PK_EXIT_ENUM_SKIP_TRANSACTION, 0);
+
+ /* do not fail the tranaction */
+ ret = TRUE;
+ goto out;
+ }
+
/* might have to reset again if we used the backend */
pk_backend_reset (priv->backend);
commit 3ba6c2874da1743f1fcfefc9670792d035d2000d
Author: Daniel Nicoletti <dantti85-pk at yahoo.com.br>
Date: Tue Nov 1 17:36:34 2011 -0200
Fix the role of the EULA transaction
diff --git a/src/pk-backend.c b/src/pk-backend.c
index da8caaf..6be5a98 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -2764,6 +2764,7 @@ pk_backend_accept_eula (PkBackend *backend, const gchar *eula_id)
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
g_return_val_if_fail (eula_id != NULL, FALSE);
+ pk_backend_set_role_internal (backend, PK_ROLE_ENUM_ACCEPT_EULA);
g_debug ("eula_id %s", eula_id);
present = g_hash_table_lookup (backend->priv->eulas, eula_id);
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 313e0bb..be2e1f9 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -2795,6 +2795,7 @@ pk_transaction_accept_eula (PkTransaction *transaction,
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_ACCEPT_EULA);
g_variant_get (params, "(&s)",
&eula_id);
commit e34e7fba8a311a115cf5a8abbaa166df57a26b36
Author: Nils Philippsen <nils at redhat.com>
Date: Thu Oct 27 12:31:10 2011 +0200
smart: don't wrap sys.stdout with codecs.getwriter(...)
PackageKitBaseBackend sets up wrapped sys.stdout, sys.stderr
for us already.
diff --git a/backends/smart/smartBackend.py b/backends/smart/smartBackend.py
index 4dcee92..1695952 100755
--- a/backends/smart/smartBackend.py
+++ b/backends/smart/smartBackend.py
@@ -39,11 +39,6 @@ import locale
pkprogress = PackagekitProgress()
pkpackage = PackagekitPackage()
-try:
- ENCODING = locale.getpreferredencoding()
-except locale.Error:
- ENCODING = "ascii"
-
def needs_cache(func):
""" Load smart's channels, and save the cache when done. """
def cache_wrap(obj, *args, **kwargs):
@@ -156,9 +151,6 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
PackageKitBaseBackend.__init__(self, args)
self._cacheloaded = False
- writer = codecs.getwriter(ENCODING)
- sys.stdout = writer(sys.stdout, errors="replace")
-
self.ctrl = smart.init()
smart.iface.object = PackageKitSmartInterface(self.ctrl, self)
smart.initPlugins()
commit 435cb7f443018e648d99bc61121326a2dccb4dbf
Author: Nils Philippsen <nils at redhat.com>
Date: Wed Oct 26 17:36:34 2011 +0200
aptcc: don't wrap sys.stdout with codecs.getwriter(...)
PackageKitBaseBackend sets up wrapped sys.stdout, sys.stderr for us
already.
diff --git a/backends/aptcc/get-distro-upgrade.py b/backends/aptcc/get-distro-upgrade.py
index 370a304..8c96368 100755
--- a/backends/aptcc/get-distro-upgrade.py
+++ b/backends/aptcc/get-distro-upgrade.py
@@ -47,10 +47,6 @@ try:
except locale.Error:
pklog.debug("Failed to unset LC_ALL")
-# Allows to write unicode to stdout
-import codecs
-sys.stdout = codecs.getwriter(DEFAULT_ENCODING)(sys.stdout)
-
# Required to parse RFC822 time stamps
try:
locale.setlocale(locale.LC_TIME, "C")
commit 31b9a6942a65f8eeeb67c6ea376429e8c5eac43f
Author: Nils Philippsen <nils at redhat.com>
Date: Wed Oct 26 17:33:18 2011 +0200
yum: don't let yum.misc.setup_locale() override stdout codec
Use our own stdout/stderr wrappers, as what codecs.getwriter() supplies
only works for unicode, but not for already encoded data.
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index cb48451..0d7926b 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -3483,7 +3483,7 @@ class PackageKitYumBase(yum.YumBase):
raise PkError(ERROR_FAILED_CONFIG_PARSING, _to_unicode(e))
# setup to use LANG for descriptions
- yum.misc.setup_locale(override_time=True)
+ yum.misc.setup_locale(override_time=True, override_codecs=False)
self.missingGPGKey = None
self.dsCallback = DepSolveCallback(backend)
commit b5a5011f31d6062cd00ee6b02ddf356d691e67e6
Author: Nils Philippsen <nils at redhat.com>
Date: Wed Oct 26 17:31:36 2011 +0200
python: implement and use utf8 stream writer for stdout, stderr
The C-side (glib) really wants stuff to be encoded in UTF-8.
diff --git a/lib/python/packagekit/backend.py b/lib/python/packagekit/backend.py
index 1f0c985..859a98a 100644
--- a/lib/python/packagekit/backend.py
+++ b/lib/python/packagekit/backend.py
@@ -38,8 +38,49 @@ def _to_unicode(txt, encoding='utf-8'):
txt = unicode(txt, encoding, errors='replace')
return txt
+def _to_utf8(txt, errors='replace'):
+ '''convert practically anything to a utf-8-encoded byte string'''
+
+ # convert to unicode object
+ if isinstance(txt, str):
+ txt = txt.decode('utf-8', errors=errors)
+ if not isinstance(txt, basestring):
+ # try to convert non-string objects like exceptions
+ try:
+ # if txt.__unicode__() exists, or txt.__str__() returns ASCII
+ txt = unicode(txt)
+ except UnicodeDecodeError:
+ # if txt.__str__() exists
+ txt = str(txt).decode('utf-8', errors=errors)
+ except:
+ # no __str__(), __unicode__() methods, use representation
+ txt = unicode(repr(txt))
+
+ # return encoded as UTF-8
+ return txt.encode('utf-8', errors=errors)
+
# Classes
+class _UTF8Writer(codecs.StreamWriter):
+
+ encoding = 'utf-8'
+
+ def __init__(self, stream, errors='replace'):
+ codecs.StreamWriter.__init__(self, stream, errors)
+
+ def encode(self, inp, errors='strict'):
+ try:
+ l = len(inp)
+ except TypeError:
+ try:
+ l = len(unicode(inp))
+ except:
+ try:
+ l = len(str(inp))
+ except:
+ l = 1
+ return (_to_utf8(inp, errors=errors), l)
+
class PkError(Exception):
def __init__(self, code, details):
self.code = code
@@ -50,6 +91,10 @@ class PkError(Exception):
class PackageKitBaseBackend:
def __init__(self, cmds):
+ # Make sys.stdout/stderr cope with UTF-8
+ sys.stdout = _UTF8Writer(sys.stdout)
+ sys.stderr = _UTF8Writer(sys.stderr)
+
# Setup a custom exception handler
installExceptionHandler(self)
self.cmds = cmds
commit 213bc568ed4afe101ac18b4847caa1e0f25886cf
Author: Fabio Erculiani <lxnay at sabayon.org>
Date: Fri Oct 21 20:04:17 2011 +0200
entropy: update entropy library path
diff --git a/backends/entropy/entropyBackend.py b/backends/entropy/entropyBackend.py
index 0c82039..d6ce0ed 100755
--- a/backends/entropy/entropyBackend.py
+++ b/backends/entropy/entropyBackend.py
@@ -56,6 +56,7 @@ from packagekit.backend import PackageKitBaseBackend, get_package_id, \
from packagekit.package import PackagekitPackage
sys.path.insert(0, '/usr/lib/entropy/libraries')
+sys.path.insert(0, '/usr/lib/entropy/lib')
from entropy.output import decolorize
from entropy.i18n import _, _LOCALE
from entropy.const import etpConst, const_convert_to_rawstring, \
commit c2d54506b4fa1041004f610ded0e1a3dec13ff78
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Oct 21 17:43:07 2011 +0100
zif: Always show the update metadata if available by using the correct repo
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 4799711..3996722 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -3234,6 +3234,16 @@ pk_backend_get_changelog_text (GPtrArray *changesets)
}
/**
+ * pk_backend_sort_stores_cb:
+ **/
+static gint
+pk_backend_sort_stores_cb (ZifStore **a, ZifStore **b)
+{
+ return g_strcmp0 (zif_store_get_id (*b),
+ zif_store_get_id (*a));
+}
+
+/**
* pk_backend_get_update_detail_thread:
*/
static gboolean
@@ -3275,6 +3285,12 @@ pk_backend_get_update_detail_thread (PkBackend *backend)
goto out;
}
+ /* sort the store array so updates repos are listed first, for
+ * when the exact same package version is present in 'updates'
+ * -and- 'fedora' */
+ g_ptr_array_sort (store_array,
+ (GCompareFunc) pk_backend_sort_stores_cb);
+
/* this section done */
ret = zif_state_done (priv->state, &error);
if (!ret) {
commit e4d490fd0356a7021360e3883c858b70e322217e
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Oct 21 17:24:16 2011 +0100
zif: Ensure the downloading status is set correctly
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 8728ada..4799711 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -1467,12 +1467,10 @@ pk_backend_state_action_changed_cb (ZifState *state,
case ZIF_STATE_ACTION_DOWNLOADING:
/* try to map the ZifStateAction to a PkStatusEnum */
if (zif_package_id_check (action_hint)) {
- status = PK_STATUS_ENUM_DOWNLOAD;
pk_backend_package (backend,
PK_INFO_ENUM_DOWNLOADING,
action_hint,
"");
- break;
}
if (g_strrstr (action_hint, "repomd") != NULL)
status = PK_STATUS_ENUM_DOWNLOAD_REPOSITORY;
@@ -1486,6 +1484,8 @@ pk_backend_state_action_changed_cb (ZifState *state,
status = PK_STATUS_ENUM_DOWNLOAD_GROUP;
else if (g_strrstr (action_hint, "updatinfo") != NULL)
status = PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO;
+ else
+ status = PK_STATUS_ENUM_DOWNLOAD;
break;
case ZIF_STATE_ACTION_CHECKING:
case ZIF_STATE_ACTION_LOADING_REPOS:
commit d603b70be2aedde6593b057582aca43c6346b703
Merge: 2bdb509... 58161e2...
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Fri Oct 21 16:17:13 2011 +0200
Merge branch 'master' of gitorious.org:packagekit/packagekit
commit 2bdb50956217889d7551f931a55deddf49a6270a
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Fri Oct 21 16:07:33 2011 +0200
Make PK compile on GNU Hurd
diff --git a/lib/packagekit-glib2/pk-service-pack.c b/lib/packagekit-glib2/pk-service-pack.c
index 1e43c08..339012e 100644
--- a/lib/packagekit-glib2/pk-service-pack.c
+++ b/lib/packagekit-glib2/pk-service-pack.c
@@ -38,6 +38,7 @@
#include <archive_entry.h>
#endif /* HAVE_ARCHIVE_H */
#include <string.h>
+#include <stdlib.h>
#include <glib.h>
#include <glib/gstdio.h>
@@ -211,12 +212,11 @@ pk_service_pack_extract (const gchar *filename, const gchar *directory, GError *
struct archive_entry *entry;
int r;
int retval;
- gchar *retcwd;
- gchar buf[PATH_MAX];
/* save the PWD as we chdir to extract */
- retcwd = getcwd (buf, PATH_MAX);
- if (retcwd == NULL) {
+ gchar *buf = getcwd (NULL, 0);
+
+ if (buf == NULL) {
g_set_error_literal (error, PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_SETUP,
"failed to get cwd");
goto out;
@@ -273,6 +273,7 @@ out:
retval = chdir (buf);
if (retval != 0)
g_warning ("cannot chdir back!");
+ free (buf);
return ret;
}
@@ -320,7 +321,7 @@ static gchar *
pk_service_pack_create_temporary_directory (const gchar *prefix)
{
gboolean ret;
- gchar *random;
+ gchar *random_str;
gchar *directory = NULL;
/* ensure path does not already exist */
@@ -329,11 +330,11 @@ pk_service_pack_create_temporary_directory (const gchar *prefix)
g_free (directory);
/* get a random path */
- random = pk_service_pack_get_random (prefix, 8);
+ random_str = pk_service_pack_get_random (prefix, 8);
/* ITS4: ignore, the user has no control over the daemon envp */
- directory = g_build_filename (g_get_tmp_dir (), random, NULL);
- g_free (random);
+ directory = g_build_filename (g_get_tmp_dir (), random_str, NULL);
+ g_free (random_str);
ret = g_file_test (directory, G_FILE_TEST_IS_DIR);
} while (ret);
commit 58161e2fe1d421cbd41de2d1c42781393065a340
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Oct 21 12:44:53 2011 +0100
zif: Add an unhandled ZifStateAction mapping
Also convert to a switch so the compiler warns us of this in the future.
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index ed25ee9..8728ada 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -1449,23 +1449,30 @@ pk_backend_status_changed_cb (PkBackend *backend, PkStatusEnum status, gpointer
* pk_backend_state_action_changed_cb:
**/
static void
-pk_backend_state_action_changed_cb (ZifState *state, ZifStateAction action, const gchar *action_hint, PkBackend *backend)
+pk_backend_state_action_changed_cb (ZifState *state,
+ ZifStateAction action,
+ const gchar *action_hint,
+ PkBackend *backend)
{
PkStatusEnum status = PK_STATUS_ENUM_UNKNOWN;
- /* ignore this */
- if (action == ZIF_STATE_ACTION_UNKNOWN)
- goto out;
+ g_debug ("got state %s with hint %s",
+ zif_state_action_to_string (action),
+ action_hint);
- /* try to map the ZifStateAction to a PkStatusEnum */
- if (action == ZIF_STATE_ACTION_DOWNLOADING) {
+ switch (action) {
+ case ZIF_STATE_ACTION_UNKNOWN:
+ /* ignore this */
+ break;
+ case ZIF_STATE_ACTION_DOWNLOADING:
+ /* try to map the ZifStateAction to a PkStatusEnum */
if (zif_package_id_check (action_hint)) {
status = PK_STATUS_ENUM_DOWNLOAD;
pk_backend_package (backend,
PK_INFO_ENUM_DOWNLOADING,
action_hint,
"");
- goto out;
+ break;
}
if (g_strrstr (action_hint, "repomd") != NULL)
status = PK_STATUS_ENUM_DOWNLOAD_REPOSITORY;
@@ -1479,79 +1486,62 @@ pk_backend_state_action_changed_cb (ZifState *state, ZifStateAction action, cons
status = PK_STATUS_ENUM_DOWNLOAD_GROUP;
else if (g_strrstr (action_hint, "updatinfo") != NULL)
status = PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO;
- goto out;
- }
-
- /* general cache loading */
- if (action == ZIF_STATE_ACTION_CHECKING ||
- action == ZIF_STATE_ACTION_LOADING_REPOS ||
+ break;
+ case ZIF_STATE_ACTION_CHECKING:
+ case ZIF_STATE_ACTION_LOADING_REPOS:
+ case ZIF_STATE_ACTION_DECOMPRESSING:
#if ZIF_CHECK_VERSION(0,2,4)
- action == ZIF_STATE_ACTION_LOADING_RPMDB ||
+ case ZIF_STATE_ACTION_LOADING_RPMDB:
#endif
- action == ZIF_STATE_ACTION_DECOMPRESSING) {
+ /* general cache loading */
status = PK_STATUS_ENUM_LOADING_CACHE;
- goto out;
- }
-
- /* package install */
- if (action == ZIF_STATE_ACTION_INSTALLING) {
+ break;
+ case ZIF_STATE_ACTION_INSTALLING:
+ /* package install */
status = PK_STATUS_ENUM_INSTALL;
pk_backend_package (backend,
PK_INFO_ENUM_INSTALLING,
action_hint,
"");
- goto out;
- }
-
- /* package remove */
- if (action == ZIF_STATE_ACTION_REMOVING) {
+ break;
+ case ZIF_STATE_ACTION_REMOVING:
status = PK_STATUS_ENUM_REMOVE;
pk_backend_package (backend,
PK_INFO_ENUM_REMOVING,
action_hint,
"");
- goto out;
- }
-
- /* package update */
- if (action == ZIF_STATE_ACTION_UPDATING) {
+ break;
+ case ZIF_STATE_ACTION_UPDATING:
status = PK_STATUS_ENUM_UPDATE;
pk_backend_package (backend,
PK_INFO_ENUM_UPDATING,
action_hint,
"");
- goto out;
- }
-
- /* package update */
- if (action == ZIF_STATE_ACTION_CLEANING) {
+ break;
+ case ZIF_STATE_ACTION_CLEANING:
status = PK_STATUS_ENUM_CLEANUP;
pk_backend_package (backend,
PK_INFO_ENUM_CLEANUP,
action_hint,
"");
- goto out;
- }
-
- /* rpm test commit */
- if (action == ZIF_STATE_ACTION_TEST_COMMIT) {
+ break;
+ case ZIF_STATE_ACTION_TEST_COMMIT:
status = PK_STATUS_ENUM_TEST_COMMIT;
- goto out;
- }
-
- /* depsolving */
- if (action == ZIF_STATE_ACTION_DEPSOLVING_CONFLICTS ||
- action == ZIF_STATE_ACTION_DEPSOLVING_INSTALL ||
- action == ZIF_STATE_ACTION_DEPSOLVING_REMOVE ||
+ break;
+ case ZIF_STATE_ACTION_DEPSOLVING_CONFLICTS:
+ case ZIF_STATE_ACTION_DEPSOLVING_INSTALL:
+ case ZIF_STATE_ACTION_DEPSOLVING_REMOVE:
+ case ZIF_STATE_ACTION_DEPSOLVING_UPDATE:
#if ZIF_CHECK_VERSION(0,2,4)
- action == ZIF_STATE_ACTION_CHECKING_UPDATES ||
+ case ZIF_STATE_ACTION_CHECKING_UPDATES:
#endif
- action == ZIF_STATE_ACTION_DEPSOLVING_UPDATE) {
status = PK_STATUS_ENUM_DEP_RESOLVE;
- goto out;
+ break;
+ case ZIF_STATE_ACTION_PREPARING:
+ status = PK_STATUS_ENUM_TEST_COMMIT;
+ /* deliberately no "default:" as we want to be notified of
+ * unhandled enums by the compiler */
}
-
-out:
if (status != PK_STATUS_ENUM_UNKNOWN)
pk_backend_set_status (backend, status);
}
commit 1063e6bab45b6fafe78978526196be5b9ebbc2af
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Oct 21 12:22:09 2011 +0100
zif: Do not report packages as installable if they are already installed
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 9e38bbc..ed25ee9 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -416,16 +416,37 @@ out:
static GPtrArray *
pk_backend_filter_package_array (GPtrArray *array, PkBitfield filters)
{
+ GHashTable *hash_installed;
+ gpointer found;
GPtrArray *result = NULL;
guint i;
ZifPackage *package;
+ hash_installed = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);
result = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+ /* do not show a remote package if the same version is installed */
+ for (i=0;i<array->len;i++) {
+ package = g_ptr_array_index (array, i);
+ if (!zif_package_is_installed (package))
+ continue;
+ g_hash_table_insert (hash_installed,
+ (gpointer) zif_package_get_name_version_arch (package),
+ GINT_TO_POINTER (1));
+ }
+
/* pre-result */
for (i=0;i<array->len;i++) {
package = g_ptr_array_index (array, i);
+ /* is installed package existing? */
+ if (!zif_package_is_installed (package)) {
+ found = g_hash_table_lookup (hash_installed,
+ zif_package_get_name_version_arch (package));
+ if (found != NULL)
+ continue;
+ }
+
/* installed */
if (pk_bitfield_contain (filters,
PK_FILTER_ENUM_INSTALLED)) {
@@ -489,6 +510,7 @@ pk_backend_filter_package_array (GPtrArray *array, PkBitfield filters)
if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NEWEST))
zif_package_array_filter_newest (result);
+ g_hash_table_destroy (hash_installed);
return result;
}
commit 32d2bfcaa5c9605a890840c46237f6984277a995
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Oct 21 11:21:59 2011 +0100
trivial: Don't test a struct member for NULL
diff --git a/contrib/gstreamer-plugin/pk-gstreamer-install.c b/contrib/gstreamer-plugin/pk-gstreamer-install.c
index 50f9b35..5f8bbf5 100644
--- a/contrib/gstreamer-plugin/pk-gstreamer-install.c
+++ b/contrib/gstreamer-plugin/pk-gstreamer-install.c
@@ -236,7 +236,7 @@ pk_gst_get_arch_suffix (void)
retval = uname (&buf);
/* did we get valid value? */
- if (retval != 0 || buf.machine == NULL) {
+ if (retval != 0 || buf.machine[0] == '\0') {
g_warning ("PackageKit: cannot get machine type");
goto out;
}
commit 0220821e00334ebfc2d948c5109e221e9f5ac281
Author: Nils Philippsen <nils at redhat.com>
Date: Thu Oct 20 12:05:40 2011 +0200
Add command line option to keep environment
This allows e.g. setting PYTHONPATH to use python modules not in the
system paths. Default if run via run-pk.sh, use e.g. "env -u
./run-pk.sh" if you want the environment cleared.
diff --git a/src/pk-backend-spawn.c b/src/pk-backend-spawn.c
index 1d92ed2..cfe4567 100644
--- a/src/pk-backend-spawn.c
+++ b/src/pk-backend-spawn.c
@@ -717,6 +717,9 @@ static gchar **
pk_backend_spawn_get_envp (PkBackendSpawn *backend_spawn)
{
gchar **envp;
+ gchar **environ;
+ gchar **env_item;
+ gchar **env_item_split;
gchar *proxy_http;
gchar *proxy_https;
gchar *proxy_ftp;
@@ -724,19 +727,41 @@ pk_backend_spawn_get_envp (PkBackendSpawn *backend_spawn)
gchar *no_proxy;
gchar *pac;
gchar *locale;
- gchar *line;
gchar *uri;
gchar *eulas;
gchar *transaction_id = NULL;
const gchar *value;
guint i;
guint cache_age;
- GPtrArray *array;
+ GHashTable *env_table;
+ GHashTableIter env_iter;
+ gchar *env_key;
+ gchar *env_value;
gboolean ret;
PkHintEnum interactive;
PkBackendSpawnPrivate *priv = backend_spawn->priv;
- array = g_ptr_array_new_with_free_func (g_free);
+ gboolean keep_environment =
+ pk_backend_get_keep_environment (backend_spawn->priv->backend);
+
+ env_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+
+ g_debug ("keep_environment: %i", keep_environment);
+
+ if (keep_environment) {
+ /* copy environment if so specified (for debugging) */
+ environ = g_get_environ ();
+ for (env_item = environ; env_item && *env_item; env_item++) {
+ env_item_split = g_strsplit (*env_item, "=", 2);
+
+ if (env_item_split && (g_strv_length (env_item_split) == 2))
+ g_hash_table_replace (env_table, g_strdup (env_item_split[0]),
+ g_strdup (env_item_split[1]));
+
+ g_strfreev (env_item_split);
+ }
+ g_strfreev (environ);
+ }
/* don't do this for all backends as it's a performance penalty */
if (FALSE) {
@@ -744,118 +769,107 @@ pk_backend_spawn_get_envp (PkBackendSpawn *backend_spawn)
g_object_get (priv->backend,
"transaction-id", &transaction_id,
NULL);
- line = g_strdup_printf ("%s=%s", "transaction_id", transaction_id);
- g_ptr_array_add (array, line);
+ g_hash_table_replace (env_table, g_strdup ("transaction_id"),
+ g_strdup (transaction_id));
}
/* accepted eulas */
eulas = pk_backend_get_accepted_eula_string (priv->backend);
- if (eulas != NULL){
- line = g_strdup_printf ("%s=%s", "accepted_eulas", eulas);
- g_ptr_array_add (array, line);
- }
+ if (eulas != NULL)
+ g_hash_table_replace (env_table, g_strdup ("accepted_eulas"), g_strdup (eulas));
/* http_proxy */
proxy_http = pk_backend_get_proxy_http (priv->backend);
if (!pk_strzero (proxy_http)) {
uri = pk_backend_spawn_convert_uri (proxy_http);
- line = g_strdup_printf ("%s=%s", "http_proxy", uri);
- g_ptr_array_add (array, line);
- g_free (uri);
+ g_hash_table_replace (env_table, g_strdup ("http_proxy"), uri);
}
/* https_proxy */
proxy_https = pk_backend_get_proxy_https (priv->backend);
if (!pk_strzero (proxy_https)) {
uri = pk_backend_spawn_convert_uri (proxy_https);
- line = g_strdup_printf ("%s=%s", "https_proxy", uri);
- g_ptr_array_add (array, line);
- g_free (uri);
+ g_hash_table_replace (env_table, g_strdup ("https_proxy"), uri);
}
/* ftp_proxy */
proxy_ftp = pk_backend_get_proxy_ftp (priv->backend);
if (!pk_strzero (proxy_ftp)) {
uri = pk_backend_spawn_convert_uri (proxy_ftp);
- line = g_strdup_printf ("%s=%s", "ftp_proxy", uri);
- g_ptr_array_add (array, line);
- g_free (uri);
+ g_hash_table_replace (env_table, g_strdup ("ftp_proxy"), uri);
}
/* socks_proxy */
proxy_socks = pk_backend_get_proxy_socks (priv->backend);
if (!pk_strzero (proxy_socks)) {
uri = pk_backend_spawn_convert_uri (proxy_socks);
- line = g_strdup_printf ("%s=%s", "socks_proxy", uri);
- g_ptr_array_add (array, line);
- g_free (uri);
+ g_hash_table_replace (env_table, g_strdup ("socks_proxy"), uri);
}
/* no_proxy */
no_proxy = pk_backend_get_no_proxy (priv->backend);
if (!pk_strzero (no_proxy)) {
uri = pk_backend_spawn_convert_uri (no_proxy);
- line = g_strdup_printf ("%s=%s", "no_proxy", uri);
- g_ptr_array_add (array, line);
- g_free (uri);
+ g_hash_table_replace (env_table, g_strdup ("no_proxy"), uri);
}
/* pac */
pac = pk_backend_get_pac (priv->backend);
if (!pk_strzero (pac)) {
uri = pk_backend_spawn_convert_uri (pac);
- line = g_strdup_printf ("%s=%s", "pac", uri);
- g_ptr_array_add (array, line);
- g_free (uri);
+ g_hash_table_replace (env_table, g_strdup ("pac"), uri);
}
/* LANG */
locale = pk_backend_get_locale (priv->backend);
- if (!pk_strzero (locale)) {
- line = g_strdup_printf ("%s=%s", "LANG", locale);
- g_ptr_array_add (array, line);
- }
+ if (!pk_strzero (locale))
+ g_hash_table_replace (env_table, g_strdup ("LANG"), g_strdup (locale));
/* ROOT */
value = pk_backend_get_root (priv->backend);
- if (!pk_strzero (value)) {
- line = g_strdup_printf ("%s=%s", "ROOT", value);
- g_ptr_array_add (array, line);
- }
+ if (!pk_strzero (value))
+ g_hash_table_replace (env_table, g_strdup ("ROOT"), g_strdup (value));
/* NETWORK */
ret = pk_backend_is_online (priv->backend);
- line = g_strdup_printf ("%s=%s", "NETWORK", ret ? "TRUE" : "FALSE");
- g_ptr_array_add (array, line);
+ g_hash_table_replace (env_table, g_strdup ("NETWORK"), g_strdup (ret ? "TRUE" : "FALSE"));
/* BACKGROUND */
ret = pk_backend_use_background (priv->backend);
- line = g_strdup_printf ("%s=%s", "BACKGROUND", ret ? "TRUE" : "FALSE");
- g_ptr_array_add (array, line);
+ g_hash_table_replace (env_table, g_strdup ("BACKGROUND"), g_strdup (ret ? "TRUE" : "FALSE"));
/* INTERACTIVE */
g_object_get (priv->backend,
"interactive", &interactive,
NULL);
- line = g_strdup_printf ("%s=%s", "INTERACTIVE", interactive ? "TRUE" : "FALSE");
- g_ptr_array_add (array, line);
+ g_hash_table_replace (env_table, g_strdup ("INTERACTIVE"), g_strdup (interactive ? "TRUE" : "FALSE"));
/* CACHE_AGE */
cache_age = pk_backend_get_cache_age (priv->backend);
- if (cache_age > 0) {
- line = g_strdup_printf ("%s=%i", "CACHE_AGE", cache_age);
- g_ptr_array_add (array, line);
- }
-
- /* ensure the malicious user can't inject anthing from the session */
- for (i=0; i<array->len; i++) {
- line = g_ptr_array_index (array, i);
- g_strdelimit (line, "\\;{}[]()*?%\n\r\t", '_');
- g_debug ("setting evp '%s'", line);
+ if (cache_age > 0)
+ g_hash_table_replace (env_table, g_strdup ("CACHE_AGE"), g_strdup_printf ("%i", cache_age));
+
+ /* copy hashed environment key/value pairs to envp */
+ envp = g_new0 (gchar *, g_hash_table_size (env_table) + 1);
+ g_hash_table_iter_init (&env_iter, env_table);
+ i = 0;
+ while (g_hash_table_iter_next (&env_iter, (void**)&env_key, (void**)&env_value)) {
+ env_key = g_strdup (env_key);
+ env_value = g_strdup (env_value);
+ if (!keep_environment) {
+ /* ensure malicious users can't inject anything from the session,
+ * unless keeping the environment is specified (used for debugging) */
+ g_strdelimit (env_key, "\\;{}[]()*?%\n\r\t", '_');
+ g_strdelimit (env_value, "\\;{}[]()*?%\n\r\t", '_');
+ }
+ envp[i] = g_strdup_printf ("%s=%s", env_key, env_value);
+ g_debug ("setting envp '%s'", envp[i]);
+ g_free (env_key);
+ g_free (env_value);
+ i++;
}
- envp = pk_ptr_array_to_strv (array);
- g_ptr_array_unref (array);
+ g_hash_table_destroy (env_table);
g_free (proxy_http);
g_free (proxy_https);
diff --git a/src/pk-backend.c b/src/pk-backend.c
index a931e7f..da8caaf 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -95,6 +95,7 @@ struct PkBackendPrivate
gboolean simultaneous;
gboolean use_time;
gboolean use_threads;
+ gboolean keep_environment;
gchar *transaction_id;
gchar *locale;
gchar *frontend_socket;
@@ -2256,6 +2257,29 @@ pk_backend_get_allow_cancel (PkBackend *backend)
}
/**
+ * pk_backend_set_keep_environment:
+ **/
+gboolean
+pk_backend_set_keep_environment (PkBackend *backend, gboolean keep_environment)
+{
+ g_return_val_if_fail (PK_IS_BACKEND(backend), FALSE);
+
+ backend->priv->keep_environment = keep_environment;
+ return TRUE;
+}
+
+/**
+ * pk_backend_get_keep_environment:
+ **/
+gboolean
+pk_backend_get_keep_environment (PkBackend *backend)
+{
+ g_return_val_if_fail (PK_IS_BACKEND(backend), FALSE);
+
+ return backend->priv->keep_environment;
+}
+
+/**
* pk_backend_set_role_internal:
**/
static gboolean
@@ -3736,6 +3760,9 @@ pk_backend_init (PkBackend *backend)
backend->priv->use_threads = pk_conf_get_bool (conf, "UseThreadsInBackend");
g_object_unref (conf);
+ /* initialize keep_environment once */
+ backend->priv->keep_environment = FALSE;
+
pk_backend_reset (backend);
}
diff --git a/src/pk-backend.h b/src/pk-backend.h
index e548d29..d8796f0 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -89,6 +89,8 @@ gboolean pk_backend_set_uid (PkBackend *backend,
guint uid);
gboolean pk_backend_set_cmdline (PkBackend *backend,
const gchar *cmdline);
+gboolean pk_backend_set_keep_environment (PkBackend *backend,
+ gboolean keep_environment);
gchar *pk_backend_get_name (PkBackend *backend)
G_GNUC_WARN_UNUSED_RESULT;
gboolean pk_backend_get_is_finished (PkBackend *backend);
@@ -97,6 +99,8 @@ gchar *pk_backend_get_description (PkBackend *backend)
G_GNUC_WARN_UNUSED_RESULT;
gchar *pk_backend_get_author (PkBackend *backend)
G_GNUC_WARN_UNUSED_RESULT;
+gboolean pk_backend_get_keep_environment (PkBackend *backend);
+
typedef gchar *(*PkBackendGetCompatStringFunc) (PkBackend *backend);
PkBitfield pk_backend_get_groups (PkBackend *backend);
PkBitfield pk_backend_get_filters (PkBackend *backend);
diff --git a/src/pk-main.c b/src/pk-main.c
index 6da41ff..f7fdfc6 100644
--- a/src/pk-main.c
+++ b/src/pk-main.c
@@ -130,6 +130,7 @@ main (int argc, char *argv[])
gboolean use_daemon = FALSE;
gboolean timed_exit = FALSE;
gboolean immediate_exit = FALSE;
+ gboolean keep_environment = FALSE;
gboolean do_logging = FALSE;
gchar *backend_name = NULL;
gchar **backend_names = NULL;
@@ -161,7 +162,10 @@ main (int argc, char *argv[])
{ "immediate-exit", '\0', 0, G_OPTION_ARG_NONE, &immediate_exit,
/* TRANSLATORS: exit straight away, used for automatic profiling */
_("Exit after the engine has loaded"), NULL },
- { NULL}
+ { "keep-environment", '\0', 0, G_OPTION_ARG_NONE, &keep_environment,
+ /* TRANSLATORS: don't unset environment variables, used for debugging */
+ _("Don't clear environment on startup"), NULL },
+ { NULL }
};
setlocale (LC_ALL, "");
@@ -206,7 +210,9 @@ main (int argc, char *argv[])
/* we don't actually need to do this, except it rules out the
* 'it works from the command line but not service activation' bugs */
#ifdef HAVE_CLEARENV
- clearenv ();
+ g_debug ("keep_environment: %i\n", keep_environment);
+ if (!keep_environment)
+ clearenv ();
#endif
/* get values from the config file */
@@ -249,6 +255,8 @@ main (int argc, char *argv[])
goto out;
}
+ pk_backend_set_keep_environment (backend, keep_environment);
+
loop = g_main_loop_new (NULL, FALSE);
/* create a new engine object */
diff --git a/src/run-pk.sh b/src/run-pk.sh
index 41fa514..fa188c4 100755
--- a/src/run-pk.sh
+++ b/src/run-pk.sh
@@ -31,5 +31,5 @@ else
fi
export G_DEBUG=fatal_criticals
killall packagekitd
-./packagekitd --verbose --disable-timer --backend=$BACKEND
+./packagekitd --verbose --disable-timer --keep-environment --backend=$BACKEND
commit 985ff2789e3bc43fc5de4feef2353bfee90fc0fa
Author: Nils Philippsen <nils at redhat.com>
Date: Thu Oct 20 12:28:07 2011 +0200
find uninstalled PackageKitGlib-1.0.gir when building
diff --git a/src/Makefile.am b/src/Makefile.am
index e7bde23..868ac47 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,8 +4,10 @@ AUTOMAKE_OPTIONS = 1.7
if HAVE_INTROSPECTION
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
-INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
-INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \
+ --add-include-path=$(top_builddir)/lib/packagekit-glib2
+INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) \
+ --includedir=$(top_builddir)/lib/packagekit-glib2
endif
SUBDIRS = plugins
commit 548335579287495b6dee170913ed0042edf763a0
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Oct 20 12:29:22 2011 +0100
Use the new g_thread_new() for new versions of GLib
This gives us the thread name in gdb.
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 0e540d7..a931e7f 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -2676,7 +2676,16 @@ pk_backend_thread_create (PkBackend *backend, PkBackendThreadFunc func)
helper->func = func;
/* create a thread */
- backend->priv->thread = g_thread_create (pk_backend_thread_setup, helper, FALSE, NULL);
+#if GLIB_CHECK_VERSION(2,31,0)
+ backend->priv->thread = g_thread_new ("PK-Backend",
+ pk_backend_thread_setup,
+ helper);
+#else
+ backend->priv->thread = g_thread_create (pk_backend_thread_setup,
+ helper,
+ FALSE,
+ NULL);
+#endif
if (backend->priv->thread == NULL) {
g_warning ("failed to create thread");
ret = FALSE;
commit 6b919f05b0d07d9bd2b8566263a0075e522f205c
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Oct 20 12:28:30 2011 +0100
Don't use the deprecated g_thread_supported() in the dameon code
This is fine, as we're using GDBus in all the daemon code now.
diff --git a/src/pk-main.c b/src/pk-main.c
index 96b06b5..6da41ff 100644
--- a/src/pk-main.c
+++ b/src/pk-main.c
@@ -169,8 +169,6 @@ main (int argc, char *argv[])
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
- if (! g_thread_supported ())
- g_thread_init (NULL);
g_type_init ();
/* TRANSLATORS: describing the service that is running */
diff --git a/src/pk-self-test.c b/src/pk-self-test.c
index 0d2f785..3a144a2 100644
--- a/src/pk-self-test.c
+++ b/src/pk-self-test.c
@@ -1619,8 +1619,6 @@ pk_test_transaction_list_func (void)
int
main (int argc, char **argv)
{
- if (! g_thread_supported ())
- g_thread_init (NULL);
g_type_init ();
g_test_init (&argc, &argv, NULL);
diff --git a/src/plugins/pk-self-test.c b/src/plugins/pk-self-test.c
index aaa9c0b..1d98def 100644
--- a/src/plugins/pk-self-test.c
+++ b/src/plugins/pk-self-test.c
@@ -109,8 +109,6 @@ pk_test_proc_func (void)
int
main (int argc, char **argv)
{
- if (! g_thread_supported ())
- g_thread_init (NULL);
g_type_init ();
g_test_init (&argc, &argv, NULL);
commit 5f6fc67a47afad99f5b25be60ed4cb0f4d668f45
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Oct 19 10:14:49 2011 +0100
Move the gtk-module extra files to the PK tarball
Move the GSettings schema and gnome-settings-daemon desktop file to PK as
there's little point splitting them up now.
This also makes it easier for downstream packagers to group the PK and GPK
packages.
Resolves https://bugs.freedesktop.org/show_bug.cgi?id=41966
diff --git a/configure.ac b/configure.ac
index 2a60365..aaae6d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -415,6 +415,9 @@ if test x$enable_gtk_module = xyes; then
else
build_gtk_module=no
fi
+if test x$build_gtk_module = xyes; then
+ GLIB_GSETTINGS
+fi
AM_CONDITIONAL(PK_BUILD_GTK_MODULE, test $build_gtk_module = "yes")
dnl ---------------------------------------------------------------------------
diff --git a/contrib/PackageKit.spec.in b/contrib/PackageKit.spec.in
index 96bc41a..0710cd0 100644
--- a/contrib/PackageKit.spec.in
+++ b/contrib/PackageKit.spec.in
@@ -411,6 +411,8 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%files gtk3-module
%defattr(-,root,root,-)
%{_libdir}/gtk-3.0/modules/*.so
+%{_libdir}/gnome-settings-daemon-3.0/gtk-modules/*.desktop
+%{_datadir}/glib-2.0/schemas/*.gschema.xml
%files command-not-found
%defattr(-,root,root,-)
diff --git a/contrib/gtk-module/Makefile.am b/contrib/gtk-module/Makefile.am
index dab5364..a3f784d 100644
--- a/contrib/gtk-module/Makefile.am
+++ b/contrib/gtk-module/Makefile.am
@@ -8,6 +8,12 @@ libpk_gtk_module_la_LIBADD = $(PK_GTK_MODULE_LIBS)
libpk_gtk_module_la_LDFLAGS = -module -avoid-version
libpk_gtk_module_la_CFLAGS = $(PK_GTK_MODULE_CFLAGS) $(WARNINGFLAGS_C)
+gtkmoduledir = $(libdir)/gnome-settings-daemon-3.0/gtk-modules
+dist_gtkmodule_DATA = pk-gtk-module.desktop
+
+ at GSETTINGS_RULES@
+gsettings_SCHEMAS = org.gnome.setttings-daemon.gtk-modules-packagekit.gschema.xml
+
clean-local:
rm -f *~
@@ -16,6 +22,7 @@ local: all
endif
EXTRA_DIST = \
+ $(gsettings_SCHEMAS) \
README \
GLASS.txt
diff --git a/contrib/gtk-module/org.gnome.setttings-daemon.gtk-modules-packagekit.gschema.xml b/contrib/gtk-module/org.gnome.setttings-daemon.gtk-modules-packagekit.gschema.xml
new file mode 100644
index 0000000..113af61
--- /dev/null
+++ b/contrib/gtk-module/org.gnome.setttings-daemon.gtk-modules-packagekit.gschema.xml
@@ -0,0 +1,12 @@
+<schemalist>
+ <schema id="org.gnome.settings-daemon" path="/org/gnome/settings-daemon/">
+ <child name="gtk-modules" schema="gnome-settings-daemon.gtk-modules"/>
+ </schema>
+ <schema id="gnome-settings-daemon.gtk-modules" path="/org/gnome/settings-daemon/gtk-modules/">
+ <key name="pk-gtk-module" type="b">
+ <default>true</default>
+ <summary>PackageKit GTK+ module for font installation</summary>
+ <description>This key determines if applications should be able to prompt for fonts.</description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/contrib/gtk-module/pk-gtk-module.desktop b/contrib/gtk-module/pk-gtk-module.desktop
new file mode 100644
index 0000000..f13cf0f
--- /dev/null
+++ b/contrib/gtk-module/pk-gtk-module.desktop
@@ -0,0 +1,4 @@
+[GTK Module]
+Name=PackageKit
+Description=PackageKit Font Installer
+X-GTK-Module-Name=pk-gtk-module
commit 92f69696afe4ac0bee382d22d0c2a22e192c8809
Author: Fabio Erculiani <lxnay at sabayon.org>
Date: Sat Oct 15 08:04:46 2011 +0200
python: require at least Python 2.7 (in configure.ac)
diff --git a/configure.ac b/configure.ac
index 7ff9c4a..2a60365 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,7 +82,7 @@ GTK_DOC_CHECK([1.11],[--flavour no-tmpl])
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
-AM_PATH_PYTHON
+AM_PATH_PYTHON([2.7])
PYTHON_PACKAGE_DIR=${pythondir}/packagekit
AC_SUBST(PYTHON_PACKAGE_DIR)
commit 66485ff6ae6b5717ffcdfaedd437c7a629f6db79
Author: Fabio Erculiani <lxnay at sabayon.org>
Date: Sat Oct 15 08:01:47 2011 +0200
python: add initial Python3 compatibility (keeping Python2.7 support)
diff --git a/lib/python/packagekit/backend.py b/lib/python/packagekit/backend.py
index 2f245d1..1f0c985 100644
--- a/lib/python/packagekit/backend.py
+++ b/lib/python/packagekit/backend.py
@@ -19,6 +19,7 @@
#
# This file contain the base classes to implement a PackageKit python backend
#
+from __future__ import print_function
# imports
import sys
@@ -26,7 +27,7 @@ import codecs
import traceback
import os.path
-from enums import *
+from .enums import *
PACKAGE_IDS_DELIM = '&'
FILENAME_DELIM = '|'
diff --git a/lib/python/packagekit/misc.py b/lib/python/packagekit/misc.py
index 213aacc..d193559 100644
--- a/lib/python/packagekit/misc.py
+++ b/lib/python/packagekit/misc.py
@@ -20,11 +20,41 @@
# Tim Lauridsen <timlau at fedoraproject.org>
# Misc classes and funtions
-def _to_unicode( txt, encoding='utf-8'):
- if isinstance(txt, basestring):
- if not isinstance(txt, unicode):
- txt = unicode(txt, encoding, errors='replace')
- return txt
+import sys
+
+def _isunicode(obj):
+ if sys.hexversion >= 0x3000000:
+ return isinstance(obj, str)
+ else:
+ return isinstance(obj, unicode)
+
+def _israwstring(obj):
+ if sys.hexversion >= 0x3000000:
+ return isinstance(obj, bytes)
+ else:
+ return isinstance(obj, str)
+
+def _to_unicode(obj, encoding="utf-8"):
+ # string/unicode support
+ if _isunicode(obj):
+ return obj
+ if not _israwstring(obj):
+ # don't touch non-str, non-unicode objects
+ return obj
+
+ if hasattr(obj, 'decode'):
+ return obj.decode(encoding, errors="replace")
+ else:
+ if sys.hexversion >= 0x3000000:
+ return str(obj, encoding, errors="replace")
+ else:
+ return unicode(obj, encoding, errors="replace")
+
+def _to_rawstring(obj, from_encoding="utf-8"):
+ if _israwstring(obj):
+ return obj
+ return obj.encode(from_encoding, errors="replace")
+
class PackageKitPackage:
'''
@@ -32,15 +62,15 @@ class PackageKitPackage:
'''
def __init__(self, info, package_id, summary):
self.installed = (info == 'installed')
- self.id = str(package_id)
+ self.id = _to_rawstring(package_id)
self.summary = _to_unicode(summary)
n,v,a,r = self.id.split(';')
self.name = n
self.ver = v
self.arch = a
self.repoid = r
- self.summary = unicode(summary)
- self.info = str(info)
+ self.summary = _to_unicode(summary)
+ self.info = _to_rawstring(info)
def __str__(self):
(name, ver, arch, repo) = tuple(self.id.split(";"))
@@ -53,7 +83,7 @@ class PackageKitDistroUpgrade:
'''
def __init__(self, upgrade_type, name, summary):
self.upgrade_type = upgrade_type
- self.name = str(name)
+ self.name = _to_rawstring(name)
self.summary = _to_unicode(summary)
def __str__(self):
@@ -65,11 +95,11 @@ class PackageKitDetails:
container class from values from the Detail signal
'''
def __init__(self, package_id, package_license, group, detail, url, size):
- self.id = str(package_id)
- self.license = str(package_license)
- self.group = str(group)
+ self.id = _to_rawstring(package_id)
+ self.license = _to_rawstring(package_license)
+ self.group = _to_rawstring(group)
self.detail = _to_unicode(detail)
- self.url = str(url)
+ self.url = _to_rawstring(url)
self.size = int(size)
class PackageKitUpdateDetails:
@@ -79,25 +109,25 @@ class PackageKitUpdateDetails:
def __init__(self, package_id, updates, obsoletes, vendor_url, bugzilla_url, \
cve_url, restart, update_text, changelog, state, \
issued, updated):
- self.id = str(package_id)
- self.updates = str(updates)
- self.obsoletes = str(obsoletes)
- self.vendor_url = str(vendor_url)
- self.bugzilla_url = str(bugzilla_url)
- self.cve_url = str(cve_url)
+ self.id = _to_rawstring(package_id)
+ self.updates = _to_rawstring(updates)
+ self.obsoletes = _to_rawstring(obsoletes)
+ self.vendor_url = _to_rawstring(vendor_url)
+ self.bugzilla_url = _to_rawstring(bugzilla_url)
+ self.cve_url = _to_rawstring(cve_url)
self.restart = (restart == 'yes')
self.update_text = _to_unicode(update_text)
self.changelog = _to_unicode(changelog)
- self.state = str(state)
- self.issued = str(issued)
- self.updated = str(updated)
+ self.state = _to_rawstring(state)
+ self.issued = _to_rawstring(issued)
+ self.updated = _to_rawstring(updated)
class PackageKitRepos:
'''
container class from values from the Repos signal
'''
def __init__(self, repo_id, description, enabled):
- self.id = str(repo_id)
+ self.id = _to_rawstring(repo_id)
self.description = _to_unicode(description)
self.enabled = (enabled == 'yes')
@@ -106,19 +136,19 @@ class PackageKitFiles:
container class from values from the Files signal
'''
def __init__(self, package_id, files):
- self.id = str(package_id)
- self.files = str(files)
+ self.id = _to_rawstring(package_id)
+ self.files = _to_rawstring(files)
class PackageKitCategory:
'''
container class from values from the Category signal
'''
def __init__(self, parent_id, cat_id, name, summary, icon):
- self.parent_id = str(parent_id)
- self.cat_id = str(cat_id)
+ self.parent_id = _to_rawstring(parent_id)
+ self.cat_id = _to_rawstring(cat_id)
self.name = _to_unicode(name)
self.summary = _to_unicode(summary)
- self.icon = str(icon)
+ self.icon = _to_rawstring(icon)
class PackageKitMessage:
'''container class from values from the Message signal'''
commit da86722786f63a96a04d51c8f10e49cb095cde9c
Author: Fabio Erculiani <lxnay at sabayon.org>
Date: Sat Oct 15 07:39:46 2011 +0200
python: use print() as function
diff --git a/lib/python/enum-convertor.py b/lib/python/enum-convertor.py
index bb34dcd..16f367d 100644
--- a/lib/python/enum-convertor.py
+++ b/lib/python/enum-convertor.py
@@ -1,4 +1,5 @@
#!/usr/bin/python
+from __future__ import print_function
from re import compile,DOTALL,MULTILINE
import sys
@@ -10,17 +11,17 @@ inp = open(sys.argv[1]).read()
names = {}
-print "# This file was autogenerated from %s by enum-converter.py\n" % sys.argv[1]
-print "class PackageKitEnum:"
+print("# This file was autogenerated from %s by enum-converter.py\n" % sys.argv[1])
+print("class PackageKitEnum:")
for (name,data) in enum.findall(inp):
- print "\t%s = ("%name,
+ print("\t%s = ("%name, end=' ')
for (type,enum,string) in value.findall(data):
- print "\"%s\","%string,
+ print("\"%s\","%string, end=' ')
names["%s_%s"%(type,enum)] = string
- print ")"
+ print(")")
-print "\n# Constants\n"
+print("\n# Constants\n")
for k in sorted(names.keys()):
- print '%s = "%s"'%(k,names[k])
+ print('%s = "%s"'%(k,names[k]))
diff --git a/lib/python/packagekit/backend.py b/lib/python/packagekit/backend.py
index fcf2fc9..2f245d1 100644
--- a/lib/python/packagekit/backend.py
+++ b/lib/python/packagekit/backend.py
@@ -65,28 +65,28 @@ class PackageKitBaseBackend:
try:
self.lang = os.environ['LANG']
except KeyError as e:
- print "Error: No LANG envp"
+ print("Error: No LANG envp")
# try to get NETWORK state
try:
if os.environ['NETWORK'] == 'TRUE':
self.has_network = True
except KeyError as e:
- print "Error: No NETWORK envp"
+ print("Error: No NETWORK envp")
# try to get BACKGROUND state
try:
if os.environ['BACKGROUND'] == 'TRUE':
self.background = True
except KeyError as e:
- print "Error: No BACKGROUND envp"
+ print("Error: No BACKGROUND envp")
# try to get INTERACTIVE state
try:
if os.environ['INTERACTIVE'] == 'TRUE':
self.interactive = True
except KeyError as e:
- print "Error: No INTERACTIVE envp"
+ print("Error: No INTERACTIVE envp")
# try to get CACHE_AGE state
try:
@@ -111,9 +111,9 @@ class PackageKitBaseBackend:
@param percent: Progress percentage (int preferred)
'''
if percent == None:
- print "no-percentage-updates"
+ print("no-percentage-updates")
elif percent == 0 or percent > self.percentage_old:
- print "percentage\t%i" % (percent)
+ print("percentage\t%i" % (percent))
self.percentage_old = percent
sys.stdout.flush()
@@ -122,7 +122,7 @@ class PackageKitBaseBackend:
Write progress speed
@param bps: Progress speed (int, bytes per second)
'''
- print "speed\t%i" % (bps)
+ print("speed\t%i" % (bps))
sys.stdout.flush()
def sub_percentage(self, percent=None):
@@ -131,7 +131,7 @@ class PackageKitBaseBackend:
@param percent: subprogress percentage (int preferred)
'''
if percent == 0 or percent > self.sub_percentage_old:
- print "subpercentage\t%i" % (percent)
+ print("subpercentage\t%i" % (percent))
self.sub_percentage_old = percent
sys.stdout.flush()
@@ -147,7 +147,7 @@ class PackageKitBaseBackend:
self.unLock()
# this should be fast now
- print "error\t%s\t%s" % (err, description)
+ print("error\t%s\t%s" % (err, description))
sys.stdout.flush()
if exit:
# Paradoxically, we don't want to print "finished" to stdout here.
@@ -162,7 +162,7 @@ class PackageKitBaseBackend:
send 'message' signal
@param typ: MESSAGE_BROKEN_MIRROR
'''
- print "message\t%s\t%s" % (typ, msg)
+ print("message\t%s\t%s" % (typ, msg))
sys.stdout.flush()
def package(self, package_id, status, summary):
@@ -172,7 +172,7 @@ class PackageKitBaseBackend:
@param package_id: The package ID name, e.g. openoffice-clipart;2.6.22;ppc64;fedora
@param summary: The package Summary
'''
- print >> sys.stdout, "package\t%s\t%s\t%s" % (status, package_id, summary)
+ print("package\t%s\t%s\t%s" % (status, package_id, summary), file=sys.stdout)
sys.stdout.flush()
def media_change_required(self, mtype, id, text):
@@ -182,7 +182,7 @@ class PackageKitBaseBackend:
@param id: the localised label of the media
@param text: the localised text describing the media
'''
- print >> sys.stdout, "media-change-required\t%s\t%s\t%s" % (mtype, id, text)
+ print("media-change-required\t%s\t%s\t%s" % (mtype, id, text), file=sys.stdout)
sys.stdout.flush()
def distro_upgrade(self, dtype, name, summary):
@@ -192,7 +192,7 @@ class PackageKitBaseBackend:
@param name: The distro name, e.g. "fedora-9"
@param summary: The localised distribution name and description
'''
- print >> sys.stdout, "distro-upgrade\t%s\t%s\t%s" % (dtype, name, summary)
+ print("distro-upgrade\t%s\t%s\t%s" % (dtype, name, summary), file=sys.stdout)
sys.stdout.flush()
def status(self, state):
@@ -200,7 +200,7 @@ class PackageKitBaseBackend:
send 'status' signal
@param state: STATUS_DOWNLOAD, STATUS_INSTALL, STATUS_UPDATE, STATUS_REMOVE, STATUS_WAIT
'''
- print "status\t%s" % (state)
+ print("status\t%s" % (state))
sys.stdout.flush()
def repo_detail(self, repoid, name, state):
@@ -209,7 +209,7 @@ class PackageKitBaseBackend:
@param repoid: The repo id tag
@param state: false is repo is disabled else true.
'''
- print >> sys.stdout, "repo-detail\t%s\t%s\t%s" % (repoid, name, _bool_to_string(state))
+ print("repo-detail\t%s\t%s\t%s" % (repoid, name, _bool_to_string(state)), file=sys.stdout)
sys.stdout.flush()
def data(self, data):
@@ -217,7 +217,7 @@ class PackageKitBaseBackend:
send 'data' signal:
@param data: The current worked on package
'''
- print "data\t%s" % (data)
+ print("data\t%s" % (data))
sys.stdout.flush()
def details(self, package_id, package_license, group, desc, url, bytes):
@@ -230,7 +230,7 @@ class PackageKitBaseBackend:
@param url: The upstream project homepage
@param bytes: The size of the package, in bytes
'''
- print >> sys.stdout, "details\t%s\t%s\t%s\t%s\t%s\t%ld" % (package_id, package_license, group, desc, url, bytes)
+ print("details\t%s\t%s\t%s\t%s\t%s\t%ld" % (package_id, package_license, group, desc, url, bytes), file=sys.stdout)
sys.stdout.flush()
def files(self, package_id, file_list):
@@ -238,7 +238,7 @@ class PackageKitBaseBackend:
Send 'files' signal
@param file_list: List of the files in the package, separated by ';'
'''
- print >> sys.stdout, "files\t%s\t%s" % (package_id, file_list)
+ print("files\t%s\t%s" % (package_id, file_list), file=sys.stdout)
sys.stdout.flush()
def category(self, parent_id, cat_id, name, summary, icon):
@@ -250,14 +250,14 @@ class PackageKitBaseBackend:
summery : a summary of the category in current locale.
icon : an icon name to represent the category
'''
- print >> sys.stdout,"category\t%s\t%s\t%s\t%s\t%s" % (parent_id, cat_id, name, summary, icon)
+ print("category\t%s\t%s\t%s\t%s\t%s" % (parent_id, cat_id, name, summary, icon), file=sys.stdout)
sys.stdout.flush()
def finished(self):
'''
Send 'finished' signal
'''
- print >> sys.stdout, "finished"
+ print("finished", file=sys.stdout)
sys.stdout.flush()
def update_detail(self, package_id, updates, obsoletes, vendor_url, bugzilla_url, cve_url, restart, update_text, changelog, state, issued, updated):
@@ -276,7 +276,7 @@ class PackageKitBaseBackend:
@param issued:
@param updated:
'''
- print >> sys.stdout, "updatedetail\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s" % (package_id, updates, obsoletes, vendor_url, bugzilla_url, cve_url, restart, update_text, changelog, state, issued, updated)
+ print("updatedetail\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s" % (package_id, updates, obsoletes, vendor_url, bugzilla_url, cve_url, restart, update_text, changelog, state, issued, updated), file=sys.stdout)
sys.stdout.flush()
def require_restart(self, restart_type, details):
@@ -285,7 +285,7 @@ class PackageKitBaseBackend:
@param restart_type: RESTART_SYSTEM, RESTART_APPLICATION, RESTART_SESSION
@param details: Optional details about the restart
'''
- print "requirerestart\t%s\t%s" % (restart_type, details)
+ print("requirerestart\t%s\t%s" % (restart_type, details))
sys.stdout.flush()
def allow_cancel(self, allow):
@@ -297,7 +297,7 @@ class PackageKitBaseBackend:
data = 'true'
else:
data = 'false'
- print "allow-cancel\t%s" % (data)
+ print("allow-cancel\t%s" % (data))
sys.stdout.flush()
def repo_signature_required(self, package_id, repo_name, key_url, key_userid, key_id, key_fingerprint, key_timestamp, sig_type):
@@ -312,9 +312,9 @@ class PackageKitBaseBackend:
@param key_timestamp: Key timestamp
@param sig_type: Key type (GPG)
'''
- print "repo-signature-required\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s" % (
+ print("repo-signature-required\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s" % (
package_id, repo_name, key_url, key_userid, key_id, key_fingerprint, key_timestamp, sig_type
- )
+ ))
sys.stdout.flush()
def eula_required(self, eula_id, package_id, vendor_name, license_agreement):
@@ -325,9 +325,9 @@ class PackageKitBaseBackend:
@param vendor_name: Name of the vendor that wrote the EULA
@param license_agreement: The license text
'''
- print "eula-required\t%s\t%s\t%s\t%s" % (
+ print("eula-required\t%s\t%s\t%s\t%s" % (
eula_id, package_id, vendor_name, license_agreement
- )
+ ))
sys.stdout.flush()
#
diff --git a/lib/python/packagekit/filter.py b/lib/python/packagekit/filter.py
index 0eedd15..99d2de8 100644
--- a/lib/python/packagekit/filter.py
+++ b/lib/python/packagekit/filter.py
@@ -19,8 +19,8 @@
# Richard Hughes <richard at hughsie.com>
# imports
-from enums import *
-from package import PackagekitPackage
+from .enums import *
+from .package import PackagekitPackage
class PackagekitFilter(object, PackagekitPackage):
commit 9b16a7cffc77faac3f93b869aa8a1da9c945975f
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Oct 13 09:26:52 2011 +0100
trivial: Add the new GO-I plugin files to the example Fedora spec file
diff --git a/contrib/PackageKit.spec.in b/contrib/PackageKit.spec.in
index a22800b..96bc41a 100644
--- a/contrib/PackageKit.spec.in
+++ b/contrib/PackageKit.spec.in
@@ -340,6 +340,7 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%{_datadir}/dbus-1/system-services/*.service
%{_libdir}/pm-utils/sleep.d/95packagekit
%{_libdir}/packagekit-plugins/*.so
+%{_libdir}/girepository-1.0/PackageKitPlugin-1.0.typelib
%{_datadir}/dbus-1/interfaces/*.xml
%files docs
@@ -430,6 +431,7 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%dir %{_includedir}/PackageKit/packagekit-glib2
%{_includedir}/PackageKit/packagekit-glib*/*.h
%{_datadir}/gir-1.0/PackageKitGlib-1.0.gir
+%{_datadir}/gir-1.0/PackageKitPlugin-1.0.gir
%files qt-devel
%defattr(-,root,root,-)
commit c35870316ef6946d6aa98c7ac507b983b58542dd
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Mon Oct 10 23:30:53 2011 +0200
plugin: Add a few GIR annotations
This removes some introspector warnings
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 036ffbb..0e540d7 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -427,6 +427,8 @@ pk_backend_get_string (PkBackend *backend, const gchar *key)
/**
* pk_backend_get_strv:
+ *
+ * Returns: (transfer none):
**/
gchar **
pk_backend_get_strv (PkBackend *backend, const gchar *key)
@@ -467,6 +469,8 @@ pk_backend_get_bool (PkBackend *backend, const gchar *key)
/**
* pk_backend_get_pointer:
+ *
+ * Returns: (transfer none):
**/
gpointer
pk_backend_get_pointer (PkBackend *backend, const gchar *key)
@@ -2642,6 +2646,8 @@ pk_backend_thread_setup (gpointer thread_data)
/**
* pk_backend_thread_create:
+ *
+ * @func: (scope call):
**/
gboolean
pk_backend_thread_create (PkBackend *backend, PkBackendThreadFunc func)
@@ -2801,6 +2807,8 @@ pk_backend_file_monitor_changed_cb (GFileMonitor *monitor,
/**
* pk_backend_watch_file:
+ *
+ * @func: (scope call):
*/
gboolean
pk_backend_watch_file (PkBackend *backend,
diff --git a/src/pk-conf.c b/src/pk-conf.c
index 97ec220..2fb4bcb 100644
--- a/src/pk-conf.c
+++ b/src/pk-conf.c
@@ -68,6 +68,8 @@ pk_conf_get_string (PkConf *conf, const gchar *key)
/**
* pk_conf_get_strv:
+ *
+ * Returns: (transfer none):
**/
gchar **
pk_conf_get_strv (PkConf *conf, const gchar *key)
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 8ef4862..313e0bb 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -937,6 +937,8 @@ out:
/**
* pk_transaction_get_conf:
+ *
+ * Returns: (transfer none): PkConf of this transaction
**/
PkConf *
pk_transaction_get_conf (PkTransaction *transaction)
@@ -947,6 +949,8 @@ pk_transaction_get_conf (PkTransaction *transaction)
/**
* pk_transaction_get_results:
+ *
+ * Returns: (transfer none): Results of the transaction
**/
PkResults *
pk_transaction_get_results (PkTransaction *transaction)
@@ -957,6 +961,8 @@ pk_transaction_get_results (PkTransaction *transaction)
/**
* pk_transaction_get_package_ids:
+ *
+ * Returns: (transfer none): Cached package-ids
**/
gchar **
pk_transaction_get_package_ids (PkTransaction *transaction)
@@ -979,6 +985,8 @@ pk_transaction_set_package_ids (PkTransaction *transaction,
/**
* pk_transaction_get_values:
+ *
+ * Returns: (transfer none): Cached values
**/
gchar **
pk_transaction_get_values (PkTransaction *transaction)
@@ -989,6 +997,8 @@ pk_transaction_get_values (PkTransaction *transaction)
/**
* pk_transaction_get_full_paths:
+ *
+ * Returns: (transfer none): Cached paths
**/
gchar **
pk_transaction_get_full_paths (PkTransaction *transaction)
commit f8e68369d3f516e2e017188e51872a4455277487
Merge: 5d7d7bd... 7112fb5...
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Mon Oct 10 17:55:14 2011 +0200
Merge branch 'master' of gitorious.org:packagekit/packagekit
commit 5d7d7bd349adc788905bb9256dffbfeadf72cefc
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Mon Oct 10 17:35:06 2011 +0200
Finalize PackageKitPlugin GIR file
diff --git a/src/Makefile.am b/src/Makefile.am
index e6a22e0..e7bde23 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -56,7 +56,6 @@ plugininclude_HEADERS = \
pk-transaction.h
plugininclude_GIRSOURCES = \
- packagekit-plugin.h \
pk-plugin.h \
pk-backend.c \
pk-backend.h \
@@ -217,6 +216,7 @@ CLEANFILES = \
transactions.db
if HAVE_INTROSPECTION
+
# Build dummy library for g-ir-scanner to parse
noinst_LTLIBRARIES = libpkplugins.la
@@ -241,7 +241,7 @@ libpkplugins_la_CFLAGS = \
$(NULL)
PackageKitPlugin-1.0.gir: $(plugininclude_GIRSOURCES)
-PackageKitPlugin_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 PackageKitGlib-1.0 Polkit-1.0
+PackageKitPlugin_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 PackageKitGlib-1.0
PackageKitPlugin_1_0_gir_CFLAGS = $(INCLUDES) \
-DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE \
-DI_KNOW_THE_PACKAGEKIT_PLUGIN_API_IS_SUBJECT_TO_CHANGE
@@ -252,7 +252,7 @@ PackageKitPlugin_1_0_gir_SCANNERFLAGS = --identifier-prefix=Pk \
--add-include-path=$(top_builddir)/lib/packagekit-glib2 \
--library-path=$(top_builddir)/lib/packagekit-glib2 \
--c-include="plugin/packagekit-plugin.h"
-PackageKitPlugin_1_0_gir_LIBS = libpkplugin.la
+PackageKitPlugin_1_0_gir_LIBS = libpkplugins.la
PackageKitPlugin_1_0_gir_FILES = $(plugininclude_GIRSOURCES)
INTROSPECTION_GIRS += PackageKitPlugin-1.0.gir
commit 7112fb5cc34180ec98c6baf6381ddcd7235daffd
Author: Milan Bouchet-Valat <nalimilan at club.fr>
Date: Mon Oct 10 15:07:11 2011 +0200
website: Fix broken link to gdb docs
Signed-off-by: Richard Hughes <richard at hughsie.com>
diff --git a/docs/html/pk-bugs.html b/docs/html/pk-bugs.html
index 131f157..85291fd 100644
--- a/docs/html/pk-bugs.html
+++ b/docs/html/pk-bugs.html
@@ -118,7 +118,7 @@ Then type bt at the prompt and send us all the output that follows.
This will tell us exactly what the program was doing when it crashed.
</p>
<p>
-This <a href="http://sources.redhat.com/gdb/current/onlinedocs/gdb_toc.html">link</a> will
+This <a href="http://www.delorie.com/gnu/docs/gdb/gdb_toc.html">link</a> will
give you more information.
</p>
<p>Back to the <a href="index.html">main page</a></p>
commit 88de9dcae14e5ff9c7a95d4f7e50f6e0b962dcc4
Author: Milan Bouchet-Valat <nalimilan at club.fr>
Date: Mon Oct 10 15:04:07 2011 +0200
website: Improve links to bug trackers
Add a mention of the gnome-PackageKit tracker. Also add a direct
link to file a new bug, since it's not completely obvious from
the list of existing bugs.
Signed-off-by: Richard Hughes <richard at hughsie.com>
diff --git a/docs/html/pk-bugs.html b/docs/html/pk-bugs.html
index 0b9a974..131f157 100644
--- a/docs/html/pk-bugs.html
+++ b/docs/html/pk-bugs.html
@@ -20,12 +20,23 @@
<h1>Reporting Bugs</h1>
<p>
-First, please look at the <a href="http://tinyurl.com/2s4tnt">list of bugs</a>
+First, please look at the <a href="http://tinyurl.com/2s4tnt">list of PackageKit bugs</a>
+and to that of <a href="http://tinyurl.com/3seuqf3">gnome-PackageKit bugs</a>,
so that you are sure the bug you are reporting isn't a duplicate bug that
someone else has fixed or reported.
If not present, then please create a new bug attaching all the information
-to this new bug.
+to this new bug:
</p>
+
+<ul>
+<li>If the bug affects the GNOME GUI, please
+<a href="https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-packagekit">report it here</a>.
+</li>
+<li>On the other hand,
+<a href="https://bugs.freedesktop.org/enter_bug.cgi?product=PackageKit">report it here</a>
+if you suspect it affects the underlying PackageKit backend.</li>
+</ul>
+
<p>
Please do not email individual developers with bug reports, as the volume of
email we get is already huge.
commit 99a8169208bfaba015e1be2e479a976ad87fdba7
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Oct 9 08:29:27 2011 +0100
zif: Refresh the cache rather than just cleaning it for RefreshCache
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 98eb067..9e38bbc 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -4386,20 +4386,14 @@ pk_backend_refresh_cache_thread (PkBackend *backend)
/* set steps */
ret = zif_state_set_steps (priv->state,
NULL,
- 50, /* get stores */
- 50, /* refresh them */
+ 5, /* get stores */
+ 95, /* refresh them */
-1);
g_assert (ret);
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
pk_backend_set_percentage (backend, 0);
- /* don't nuke the metadata */
- if (!force) {
- g_debug ("not supported yet");
- goto out;
- }
-
/* get a store_array of remote stores */
store_array = zif_store_array_new ();
state_local = zif_state_get_child (priv->state);
@@ -4426,17 +4420,29 @@ pk_backend_refresh_cache_thread (PkBackend *backend)
goto out;
}
- /* clean all the repos */
+ /* refresh all the repos */
state_local = zif_state_get_child (priv->state);
zif_state_set_error_handler (priv->state, (ZifStateErrorHandlerCb) pk_backend_error_handler_cb, backend);
- ret = zif_store_array_clean (store_array, state_local, &error);
+ ret = zif_store_array_refresh (store_array, force, state_local, &error);
if (!ret) {
pk_backend_error_code (backend,
pk_backend_convert_error (error),
- "failed to clean: %s", error->message);
+ "failed to refresh: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* this section done */
+ ret = zif_state_done (priv->state, &error);
+ if (!ret) {
+ pk_backend_error_code (backend,
+ PK_ERROR_ENUM_TRANSACTION_CANCELLED,
+ "cancelled: %s",
+ error->message);
g_error_free (error);
goto out;
}
+
out:
pk_backend_finished (backend);
if (store_array != NULL)
commit af4395e63e0bfec6ab9bd8cd6b274341eb7a96cb
Merge: 2316fd6... c25443f...
Author: Duncan Mac-Vicar P <dmacvicar at suse.de>
Date: Mon Oct 10 13:07:53 2011 +0200
Merge branch 'master' of gitorious.org:packagekit/packagekit
commit c25443f52a82bfa896c31b2e03aa80a08ca24c85
Author: Nils Philippsen <nils at redhat.com>
Date: Mon Oct 10 11:35:11 2011 +0200
yum: cope with missing YumBase.run_with_package_names
YumBase.run_with_package_names was introduced in yum 3.2.25, better not
stumble over it if we work with an old version.
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 648564b..cb48451 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -3457,7 +3457,8 @@ class PackageKitYumBase(yum.YumBase):
# YumBase.run_with_package_names is used to record which packages are
# involved in executing a transaction
- self.run_with_package_names.add('PackageKit-yum')
+ if hasattr(self, 'run_with_package_names'):
+ self.run_with_package_names.add('PackageKit-yum')
# load the config file
config = ConfigParser.ConfigParser()
commit d041bb2d725ce21099acd4175999d8eb8af6b838
Author: Fabio Erculiani <lxnay at sabayon.org>
Date: Sun Oct 9 13:06:00 2011 +0200
python: update exception code syntax, make it work with both Python2 and Python3
diff --git a/lib/python/packagekit/backend.py b/lib/python/packagekit/backend.py
index ae7bbad..fcf2fc9 100644
--- a/lib/python/packagekit/backend.py
+++ b/lib/python/packagekit/backend.py
@@ -64,34 +64,34 @@ class PackageKitBaseBackend:
# try to get LANG
try:
self.lang = os.environ['LANG']
- except KeyError, e:
+ except KeyError as e:
print "Error: No LANG envp"
# try to get NETWORK state
try:
if os.environ['NETWORK'] == 'TRUE':
self.has_network = True
- except KeyError, e:
+ except KeyError as e:
print "Error: No NETWORK envp"
# try to get BACKGROUND state
try:
if os.environ['BACKGROUND'] == 'TRUE':
self.background = True
- except KeyError, e:
+ except KeyError as e:
print "Error: No BACKGROUND envp"
# try to get INTERACTIVE state
try:
if os.environ['INTERACTIVE'] == 'TRUE':
self.interactive = True
- except KeyError, e:
+ except KeyError as e:
print "Error: No INTERACTIVE envp"
# try to get CACHE_AGE state
try:
self.cache_age = int(os.environ['CACHE_AGE'])
- except KeyError, e:
+ except KeyError as e:
pass
def doLock(self):
@@ -749,9 +749,9 @@ class PackageKitBaseBackend:
while True:
try:
line = sys.stdin.readline().strip('\n')
- except IOError, e:
+ except IOError as e:
self.error(ERROR_TRANSACTION_CANCELLED, 'could not read from stdin: %s' % str(e))
- except KeyboardInterrupt, e:
+ except KeyboardInterrupt as e:
self.error(ERROR_PROCESS_KILL, 'process was killed by ctrl-c: %s' % str(e))
if not line or line == 'exit':
break
commit de285e72bc7ed2be2c17a3c42906e1a56cad8255
Author: Nils Philippsen <nils at redhat.com>
Date: Fri Oct 7 17:04:00 2011 +0200
yum: add ourselves to YumBase.run_with_package_names
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 74b398d..648564b 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -3455,6 +3455,10 @@ class PackageKitYumBase(yum.YumBase):
def __init__(self, backend):
yum.YumBase.__init__(self)
+ # YumBase.run_with_package_names is used to record which packages are
+ # involved in executing a transaction
+ self.run_with_package_names.add('PackageKit-yum')
+
# load the config file
config = ConfigParser.ConfigParser()
try:
commit baa3788bcb60da69d97bc15087a2921235fe2fd6
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Fri Oct 7 04:42:16 2011 +0200
Fix GIR generator for PK-Plugin
diff --git a/src/Makefile.am b/src/Makefile.am
index 10cb5c5..e6a22e0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -217,8 +217,31 @@ CLEANFILES = \
transactions.db
if HAVE_INTROSPECTION
+# Build dummy library for g-ir-scanner to parse
+noinst_LTLIBRARIES = libpkplugins.la
+
+libpkplugins_la_SOURCES = $(plugininclude_GIRSOURCES) \
+ $(shared_SOURCES)
+
+libpkplugins_la_LIBADD = \
+ $(GLIB_LIBS) \
+ $(GMODULE_LIBS) \
+ $(NETWORK_MANAGER_LIBS) \
+ $(CONNMAN_LIBS) \
+ $(SQLITE_LIBS) \
+ $(PK_GLIB2_LIBS) \
+ $(PYTHON_LIBS) \
+ $(POLKIT_LIBS) \
+ $(GIO_LIBS) \
+ $(ARCHIVE_LIBS) \
+ $(NULL)
+
+libpkplugins_la_CFLAGS = \
+ $(WARNINGFLAGS_C) \
+ $(NULL)
+
PackageKitPlugin-1.0.gir: $(plugininclude_GIRSOURCES)
-PackageKitPlugin_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 PackageKitGlib-1.0
+PackageKitPlugin_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 PackageKitGlib-1.0 Polkit-1.0
PackageKitPlugin_1_0_gir_CFLAGS = $(INCLUDES) \
-DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE \
-DI_KNOW_THE_PACKAGEKIT_PLUGIN_API_IS_SUBJECT_TO_CHANGE
@@ -229,7 +252,7 @@ PackageKitPlugin_1_0_gir_SCANNERFLAGS = --identifier-prefix=Pk \
--add-include-path=$(top_builddir)/lib/packagekit-glib2 \
--library-path=$(top_builddir)/lib/packagekit-glib2 \
--c-include="plugin/packagekit-plugin.h"
-PackageKitPlugin_1_0_gir_LIBS = $(PK_GLIB2_LIBS)
+PackageKitPlugin_1_0_gir_LIBS = libpkplugin.la
PackageKitPlugin_1_0_gir_FILES = $(plugininclude_GIRSOURCES)
INTROSPECTION_GIRS += PackageKitPlugin-1.0.gir
commit 76ed34f767bfa3aac1df08eaa700f891109a8e3a
Author: Fabio Erculiani <lxnay at sabayon.org>
Date: Wed Oct 5 22:39:30 2011 +0200
entropy: add forward compatibility with upcoming API changes
diff --git a/backends/entropy/entropyBackend.py b/backends/entropy/entropyBackend.py
index fe8c609..0c82039 100755
--- a/backends/entropy/entropyBackend.py
+++ b/backends/entropy/entropyBackend.py
@@ -64,7 +64,8 @@ from entropy.client.interfaces import Client
from entropy.core.settings.base import SystemSettings
from entropy.misc import LogFile
from entropy.cache import EntropyCacher
-from entropy.exceptions import SystemDatabaseError
+from entropy.exceptions import SystemDatabaseError, DependenciesNotFound, \
+ DependenciesCollision
from entropy.db.exceptions import Error as EntropyRepositoryError
try:
from entropy.exceptions import DependenciesNotRemovable
@@ -589,18 +590,32 @@ class PackageKitEntropyMixin(object):
if calculate_deps:
self.status(STATUS_DEP_RESOLVE)
empty_deps, deep_deps = False, False
- run_queue, removal_queue, status = self._entropy.get_install_queue(
- matches, empty_deps, deep_deps)
+ try:
+ queue_obj = self._entropy.get_install_queue(
+ matches, empty_deps, deep_deps)
+ if len(queue_obj) == 2:
+ # new api
+ run_queue, removal_queue = queue_obj
+ else:
+ # old api
+ run_queue, removal_queue, status = queue_obj
+ if status == -2:
+ raise DependenciesNotFound(run_queue)
+ elif status == -3:
+ raise DependenciesCollision(run_queue)
+ except DependenciesNotFound as exc:
+ self.error(ERROR_DEP_RESOLUTION_FAILED,
+ "Cannot find the following dependencies: %s" % (
+ ', '.join(sorted(exc.value)),))
+ return
+ except DependenciesCollision:
+ self.error(ERROR_DEP_RESOLUTION_FAILED,
+ "Dependencies collisions, cannot continue")
+ return
+
else:
run_queue = matches
removal_queue = []
- status = 0
-
- if status == -2:
- self.error(ERROR_DEP_RESOLUTION_FAILED,
- "Cannot find the following dependencies: %s" % (
- ', '.join(run_queue),))
- return
self.percentage(0)
self.status(STATUS_DOWNLOAD)
@@ -934,12 +949,26 @@ class PackageKitEntropyBackend(PackageKitBaseBackend, PackageKitEntropyMixin):
empty = False
deep = False
- install, removal, deps_not_f = self._entropy.get_install_queue(matches,
- empty, deep, recursive = recursive)
-
- if deps_not_f == -2:
+ try:
+ queue_obj = self._entropy.get_install_queue(matches,
+ empty, deep, recursive = recursive)
+ if len(queue_obj) == 2:
+ # new api
+ install, removal = queue_obj
+ else:
+ # old api
+ install, removal, status = queue_obj
+ if status == -2:
+ raise DependenciesNotFound(install)
+ elif status == -3:
+ raise DependenciesCollision(install)
+ except DependenciesNotFound as exc:
+ self.error(ERROR_DEP_RESOLUTION_FAILED,
+ "Dependencies not found: %s" % (sorted(exc.value),))
+ return
+ except DependenciesCollision:
self.error(ERROR_DEP_RESOLUTION_FAILED,
- "Dependencies not found: %s" % (sorted(install),))
+ "Dependencies collisions, cannot continue")
return
# transform install into (repo, pkg_id, c_repo) list
commit 921d41521b481eb80fa9656f804306520586599d
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Oct 5 12:55:41 2011 +0100
Require exactly 'y<enter>' or 'yes<enter>' before running a transaction
Resolves https://bugs.freedesktop.org/show_bug.cgi?id=41444
diff --git a/lib/packagekit-glib2/pk-console-shared.c b/lib/packagekit-glib2/pk-console-shared.c
index 07b7513..f8534be 100644
--- a/lib/packagekit-glib2/pk-console-shared.c
+++ b/lib/packagekit-glib2/pk-console-shared.c
@@ -24,6 +24,7 @@
#include <termios.h>
#include <unistd.h>
#include <stdio.h>
+#include <errno.h>
#include <gio/gio.h>
#include <glib/gi18n.h>
#include <packagekit-glib2/pk-client.h>
@@ -66,71 +67,105 @@ pk_console_get_number (const gchar *question, guint maxnum)
return answer;
}
+
/**
- * pk_console_getchar_unbuffered:
+ * pk_readline_unbuffered:
**/
-static gchar
-pk_console_getchar_unbuffered (void)
+static GString *
+pk_readline_unbuffered (const gchar *prompt)
{
- gchar c = '\0';
- struct termios org_opts, new_opts;
- gint res = 0;
-
- /* store old settings */
- res = tcgetattr (STDIN_FILENO, &org_opts);
- if (res != 0)
- g_warning ("failed to set terminal");
-
- /* set new terminal parms */
- memcpy (&new_opts, &org_opts, sizeof(new_opts));
- new_opts.c_lflag &= ~(ICANON | ECHO | ECHOE | ECHOK | ECHONL | ECHOPRT | ECHOKE | ICRNL);
- tcsetattr (STDIN_FILENO, TCSANOW, &new_opts);
- c = getc (stdin);
-
- /* restore old settings */
- res = tcsetattr (STDIN_FILENO, TCSANOW, &org_opts);
- if (res != 0)
- g_warning ("failed to set terminal");
- return c;
+ const gchar *tty_name;
+ FILE *tty;
+ GString *str = NULL;
+ struct termios ts, ots;
+
+ tty_name = ctermid (NULL);
+ if (tty_name == NULL) {
+ g_warning ("Cannot get terminal: %s",
+ strerror (errno));
+ goto out;
+ }
+
+ tty = fopen (tty_name, "r+");
+ if (tty == NULL) {
+ g_warning ("Error opening terminal for the process (`%s'): %s",
+ tty_name, strerror (errno));
+ goto out;
+ }
+
+ fprintf (tty, "%s", prompt);
+ fflush (tty);
+ setbuf (tty, NULL);
+
+ /* taken from polkitagenttextlistener.c */
+ tcgetattr (fileno (tty), &ts);
+ ots = ts;
+ ts.c_lflag &= ~(ECHONL);
+ tcsetattr (fileno (tty), TCSAFLUSH, &ts);
+
+ str = g_string_new (NULL);
+ while (TRUE) {
+ gint c;
+ c = getc (tty);
+ if (c == '\n') {
+ /* ok, done */
+ break;
+ } else if (c == EOF) {
+ g_warning ("Got unexpected EOF.");
+ break;
+ } else {
+ g_string_append_len (str, (const gchar *) &c, 1);
+ }
+ }
+ tcsetattr (fileno (tty), TCSAFLUSH, &ots);
+ putc ('\n', tty);
+
+ fclose (tty);
+out:
+ return str;
}
+
/**
* pk_console_get_prompt:
**/
gboolean
pk_console_get_prompt (const gchar *question, gboolean defaultyes)
{
- gchar answer;
gboolean ret = FALSE;
-
- /* pretty print */
- g_print ("%s", question);
- if (defaultyes)
- g_print (" [Y/n] ");
- else
- g_print (" [N/y] ");
-
- do {
- /* get the unbuffered char */
- answer = pk_console_getchar_unbuffered ();
-
- /* positive */
- if (answer == 'y' || answer == 'Y') {
- ret = TRUE;
+ gboolean valid = FALSE;
+ gchar *prompt;
+ GString *string;
+
+ prompt = g_strdup_printf ("%s %s ",
+ question,
+ defaultyes ? "[Y/n]" : "[N/y]");
+ while (!valid) {
+ string = pk_readline_unbuffered (prompt);
+ if (string == NULL)
break;
+ if (string->len == 0) {
+ if (defaultyes) {
+ valid = TRUE;
+ ret = TRUE;
+ } else {
+ valid = TRUE;
+ ret = FALSE;
+ }
}
- /* negative */
- if (answer == 'n' || answer == 'N')
- break;
-
- /* default choice */
- if (answer == '\n' && defaultyes) {
+ if (strcasecmp (string->str, "y") == 0 ||
+ strcasecmp (string->str, "yes") == 0) {
+ valid = TRUE;
ret = TRUE;
- break;
}
- if (answer == '\n' && !defaultyes)
- break;
- } while (TRUE);
+ if (strcasecmp (string->str, "n") == 0 ||
+ strcasecmp (string->str, "no") == 0) {
+ valid = TRUE;
+ ret = FALSE;
+ }
+ g_string_free (string, TRUE);
+ }
+ g_free (prompt);
return ret;
}
commit a136b1ae5ad784aabec585a37c02c8243efbd1ed
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Thu Sep 29 18:55:32 2011 +0200
Add Introspection support for PK-Plugins
diff --git a/src/Makefile.am b/src/Makefile.am
index d161231..10cb5c5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,13 +1,19 @@
## We require new-style dependency handling.
AUTOMAKE_OPTIONS = 1.7
+if HAVE_INTROSPECTION
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
+INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+endif
+
SUBDIRS = plugins
NULL =
-PK_GLIB2_LIBS = \
- $(top_builddir)/lib/packagekit-glib2/libpackagekit-glib2.la \
- $(NULL)
+PK_GLIB2_LIBS = $(top_builddir)/lib/packagekit-glib2/libpackagekit-glib2.la \
+ $(NULL)
INCLUDES = \
$(GIO_CFLAGS) \
@@ -49,6 +55,17 @@ plugininclude_HEADERS = \
pk-plugin.h \
pk-transaction.h
+plugininclude_GIRSOURCES = \
+ packagekit-plugin.h \
+ pk-plugin.h \
+ pk-backend.c \
+ pk-backend.h \
+ pk-transaction.c \
+ pk-transaction.h \
+ pk-conf.c \
+ pk-conf.h \
+ $(NULL)
+
shared_SOURCES = \
pk-marshal.c \
pk-marshal.h \
@@ -199,4 +216,30 @@ CLEANFILES = \
pk-marshal.h \
transactions.db
+if HAVE_INTROSPECTION
+PackageKitPlugin-1.0.gir: $(plugininclude_GIRSOURCES)
+PackageKitPlugin_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 PackageKitGlib-1.0
+PackageKitPlugin_1_0_gir_CFLAGS = $(INCLUDES) \
+ -DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE \
+ -DI_KNOW_THE_PACKAGEKIT_PLUGIN_API_IS_SUBJECT_TO_CHANGE
+PackageKitPlugin_1_0_gir_SCANNERFLAGS = --identifier-prefix=Pk \
+ --symbol-prefix=pk_ \
+ --warn-all \
+ --add-include-path=$(srcdir) \
+ --add-include-path=$(top_builddir)/lib/packagekit-glib2 \
+ --library-path=$(top_builddir)/lib/packagekit-glib2 \
+ --c-include="plugin/packagekit-plugin.h"
+PackageKitPlugin_1_0_gir_LIBS = $(PK_GLIB2_LIBS)
+PackageKitPlugin_1_0_gir_FILES = $(plugininclude_GIRSOURCES)
+INTROSPECTION_GIRS += PackageKitPlugin-1.0.gir
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES += $(gir_DATA) $(typelib_DATA)
+endif
+
-include $(top_srcdir)/git.mk
diff --git a/src/pk-backend.h b/src/pk-backend.h
index d6d8afa..e567d40 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -241,7 +241,6 @@ gchar *pk_backend_get_proxy_https (PkBackend *backend);
gchar *pk_backend_get_proxy_socks (PkBackend *backend);
gchar *pk_backend_get_no_proxy (PkBackend *backend);
gchar *pk_backend_get_pac (PkBackend *backend);
-gchar *pk_backend_get_proxy_http (PkBackend *backend);
const gchar *pk_backend_get_root (PkBackend *backend);
gchar *pk_backend_get_locale (PkBackend *backend);
gchar *pk_backend_get_frontend_socket (PkBackend *backend);
commit f106ffeeec7e56b58af6b3224bb1c3e74613ffb9
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 28 10:39:10 2011 +0100
zif: Use zif_transaction_commit_full() to be able to install untrusted packages
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index e7c5955..98eb067 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -3502,6 +3502,9 @@ pk_backend_run_transaction (PkBackend *backend, ZifState *state)
ZifPackage *package;
ZifPackageTrustKind trust_kind;
ZifState *state_local;
+#if ZIF_CHECK_VERSION(0,2,5)
+ ZifTransactionFlags flags;
+#endif
/* set steps */
simulate = pk_backend_get_bool (backend, "hint:simulate");
@@ -3673,9 +3676,17 @@ pk_backend_run_transaction (PkBackend *backend, ZifState *state)
/* commit the transaction */
state_local = zif_state_get_child (state);
+#if ZIF_CHECK_VERSION(0,2,5)
+ flags = only_trusted ? 0 : ZIF_TRANSACTION_FLAG_ALLOW_UNTRUSTED;
+ ret = zif_transaction_commit_full (priv->transaction,
+ flags,
+ state_local,
+ &error);
+#else
ret = zif_transaction_commit (priv->transaction,
state_local,
&error);
+#endif
if (!ret) {
pk_backend_error_code (backend,
pk_backend_convert_error (error),
commit 2c3982fa6c4a6efcb503e13e2fbe1f8d647f7704
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Sep 27 10:35:24 2011 +0100
zif: When the transaction has no thing to do, use the correct PK error code enum
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=739985
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 2fdd84b..e7c5955 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -3125,10 +3125,19 @@ pk_backend_get_updates_thread (PkBackend *backend)
state_local = zif_state_get_child (priv->state);
ret = zif_transaction_resolve (priv->transaction, state_local, &error);
if (!ret) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_DEP_RESOLUTION_FAILED,
- "cannot resolve transaction: %s",
- error->message);
+ if (g_error_matches (error,
+ ZIF_TRANSACTION_ERROR,
+ ZIF_TRANSACTION_ERROR_NOTHING_TO_DO)) {
+ pk_backend_error_code (backend,
+ PK_ERROR_ENUM_NO_PACKAGES_TO_UPDATE,
+ "No transaction to process: %s",
+ error->message);
+ } else {
+ pk_backend_error_code (backend,
+ PK_ERROR_ENUM_DEP_RESOLUTION_FAILED,
+ "Cannot resolve transaction: %s",
+ error->message);
+ }
g_error_free (error);
goto out;
}
commit 34c14207fd960ce7fb84cd4a3621c958b9a99ecd
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 26 13:40:01 2011 +0100
zif: Don't try to map error domains that are no longer exported
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 45bb806..2fdd84b 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -217,27 +217,6 @@ pk_backend_convert_error (const GError *error)
default:
error_code = PK_ERROR_ENUM_INTERNAL_ERROR;
}
- } else if (error->domain == ZIF_MD_ERROR) {
- switch (error->code) {
- case ZIF_MD_ERROR_NO_SUPPORT:
- error_code = PK_ERROR_ENUM_NOT_SUPPORTED;
- break;
- case ZIF_MD_ERROR_FAILED_AS_OFFLINE:
- error_code = PK_ERROR_ENUM_NO_NETWORK;
- break;
- case ZIF_MD_ERROR_FAILED_DOWNLOAD:
- error_code = PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED;
- break;
- case ZIF_MD_ERROR_BAD_SQL:
- case ZIF_MD_ERROR_FAILED_TO_LOAD:
- case ZIF_MD_ERROR_FILE_TOO_OLD:
- case ZIF_MD_ERROR_FAILED:
- case ZIF_MD_ERROR_NO_FILENAME:
- error_code = PK_ERROR_ENUM_INTERNAL_ERROR;
- break;
- default:
- error_code = PK_ERROR_ENUM_INTERNAL_ERROR;
- }
} else if (error->domain == ZIF_RELEASE_ERROR) {
switch (error->code) {
case ZIF_RELEASE_ERROR_DOWNLOAD_FAILED:
commit 7eda6783e330f414be34c86268e6a5f1a5d7eba2
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 26 13:39:40 2011 +0100
zif: Don't use zif_package_get_package_id()
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index d868823..45bb806 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -540,7 +540,7 @@ pk_backend_emit_package_array (PkBackend *backend,
for (i=0; i<array->len; i++) {
package = g_ptr_array_index (array, i);
installed = zif_package_is_installed (package);
- package_id = zif_package_get_package_id (package);
+ package_id = zif_package_get_id (package);
/* should be quick as shouldn't be doing any action */
state_loop = zif_state_get_child (state_local);
commit cb2089e1d5ff3919669a7727724d5ecbc20b0b4f
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 26 12:39:37 2011 +0100
zif: include zif-private.h for very new versions of zif
We use ZifString and zif_package_set_, so we need this include.
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 2976f16..d868823 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -25,6 +25,9 @@
#include <string.h>
#include <packagekit-glib2/pk-debug.h>
#include <zif.h>
+#if ZIF_CHECK_VERSION(0,2,5)
+#include <zif-private.h>
+#endif
#define PACKAGE_MEDIA_REPO_FILENAME "/etc/yum.repos.d/packagekit-media.repo"
commit 007afdcca2a6a14ffe5b215391734adf319f5f50
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Sep 25 22:22:04 2011 +0100
yum: add a trivial TODO list
diff --git a/backends/yum/TODO b/backends/yum/TODO
new file mode 100644
index 0000000..1489ac7
--- /dev/null
+++ b/backends/yum/TODO
@@ -0,0 +1,109 @@
+Things TODO, in no particualr order.
+
+* The progressbar does not go up from 0 to 100% in a linear way and
+makes massive jumps from each section.
+The progress steps are defined by StatusPercentageMap which doesn't
+match reality in a lot of cases.
+
+* TS_REPACKAGING = 'repackaging' isn't defined in yum, but in a plugin
+so we have to define it manually. This needs to be defined in yum.
+
+* We have to sprinkle _to_unicode() around the codebase to ensure we
+don't explode when yum gives us strings with non-unicode encoding
+It would be really good to make the methods that return us text data
+to be guaranteed unicode.
+
+* We're hardcoding a list of reboot packages. That's probably bad.
+
+* We have to get the yum lock even to read packages from the rpmdb which
+means we can't do a lot of stuff without showing the user a "waiting for
+lock" status that the designers hate.
+
+* the yumProcess.py sometimes goes of into never-never-land where it's
+stuck downloading a file from a server at 0kb/s
+
+* We don't actually know what exceptions a yum method will throw, and so
+most of the yum code is wrapped with "except Exception, e:" to catch
+things so we don't show the user a backtrace. A lot of these things like
+DivisionByZero are because PK is using different code paths in yum than
+the yum CLI and that causes bad things to happen.
+
+* We don't get a nice error when out of disk space, we just just get
+"exceptions.IOError" at random times.
+
+* We just show metapackages for the groups available to yum and we only
+install and remove the mandatory packages, so if you install @kde, you
+install about 100 packages, and then you remove @kde and delete about 20.
+This probably needs fixing in a cleverer way and i see that the yumdb
+now supports a group_member:
+ http://yum.baseurl.org/wiki/YumDB
+
+* Getting the list of enabled repos means we end up checking the primary
+metadata. We don't want to do that as it really slows down the UI.
+
+* My python knowlegde is pretty crap so there might be some low hanging
+fruit for some speed increases. I've not really profiled yum and this
+probably needs doing.
+
+* Downloading packages to disk using yum is really complex.
+
+* _findPackage is in the hotpath and has to do some pretty insane things
+to make things even acceptable. For instance, going straight to the rpmdb
+for installed packages, or finding the correct repo and searching just
+in that, rather than using the generic yum searching routines.
+Using searchNevra on all the package sacks is about two orders of
+magnitude too slow and we probably want to make yum smarter about not
+searching all the repos when we know the repo it belongs in.
+
+* _installable() is pretty hilarious and there must be a better way of
+doing this.
+
+* The yum CLI and the PK API differ wen getting the updates lists
+leading to bugs like the rawhide-release bug.
+
+* The mediagrabber stuff needs reworking, see RHEL bug
+
+* Resolve needs to support globbing
+
+* We need to self.yumbase.deselectGroup() in _install_packages, which
+probably indicates a bug somewhere in yum core.
+
+* _check_local_file is copied from yum and probably needs to be shared
+somehow.
+
+* We don't handle skip_broken very well. We need to try harder not to
+just fail the transaction and actually do what the user wants.
+
+* We don't support autoremove for RemovePackages()
+
+* We don't support UpgradeSystem()
+
+* Doing GetUpdates() should mean we download all the metadata (filelists
+etc) before returning, so that we don't block with "Downloading
+update details"
+
+* The entire comps functionality is cached in PK as the yum interface is
+two orders of magnitude too slow. It probably needs to be cached in the
+yum layer rather than parsing a multi-megabyte XML comps file on each
+request.
+
+* yum seems to ignore self.yumbase.conf.cache=0 sometimes.
+
+* PK is using some non-public methods in yum, e.g. yumbase._tsInfo and
+we probably need proper public documented methods to set these.
+
+* Don't check for repomd not being contactable in _init() as it involves
+doing network IO and slows down PK.
+
+* Currently we show a message to the user to run yum-complete-transactions
+as root. This needs to be fixed, and yum needs to have some way of
+"doing the right thing" automatically.
+
+* self.preconf is a giant hack in yum, and we've also got to deal with
+prerepoconf which gets fun indeed when using PK with RHN.
+
+* When we use delta packages we don't get any progress reporting in the
+UI. This needs to be exposed in yum.
+
+* Yum raises TypeError when it can't open the rpmdb, it should probably
+do something more sane.
commit 904fa4e4873734f1c3035d570f273776286da26c
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Sep 25 22:16:16 2011 +0100
zif: Add support for the latest status and transaction enum values
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index faf5789..2976f16 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -1481,6 +1481,9 @@ pk_backend_state_action_changed_cb (ZifState *state, ZifStateAction action, cons
/* general cache loading */
if (action == ZIF_STATE_ACTION_CHECKING ||
action == ZIF_STATE_ACTION_LOADING_REPOS ||
+#if ZIF_CHECK_VERSION(0,2,4)
+ action == ZIF_STATE_ACTION_LOADING_RPMDB ||
+#endif
action == ZIF_STATE_ACTION_DECOMPRESSING) {
status = PK_STATUS_ENUM_LOADING_CACHE;
goto out;
@@ -1536,6 +1539,9 @@ pk_backend_state_action_changed_cb (ZifState *state, ZifStateAction action, cons
if (action == ZIF_STATE_ACTION_DEPSOLVING_CONFLICTS ||
action == ZIF_STATE_ACTION_DEPSOLVING_INSTALL ||
action == ZIF_STATE_ACTION_DEPSOLVING_REMOVE ||
+#if ZIF_CHECK_VERSION(0,2,4)
+ action == ZIF_STATE_ACTION_CHECKING_UPDATES ||
+#endif
action == ZIF_STATE_ACTION_DEPSOLVING_UPDATE) {
status = PK_STATUS_ENUM_DEP_RESOLVE;
goto out;
@@ -3473,6 +3479,13 @@ pk_backend_convert_transaction_reason_to_info_enum (ZifTransactionReason reason)
case ZIF_TRANSACTION_REASON_UPDATE_DEPEND:
case ZIF_TRANSACTION_REASON_UPDATE_FOR_CONFLICT:
case ZIF_TRANSACTION_REASON_UPDATE_USER_ACTION:
+#if ZIF_CHECK_VERSION(0,2,4)
+ case ZIF_TRANSACTION_REASON_UPDATE_SYSTEM:
+ case ZIF_TRANSACTION_REASON_DOWNGRADE_USER_ACTION:
+#endif
+#if ZIF_CHECK_VERSION(0,2,5)
+ case ZIF_TRANSACTION_REASON_DOWNGRADE_FOR_DEP:
+#endif
return PK_INFO_ENUM_UPDATING;
default:
return PK_INFO_ENUM_AVAILABLE;
commit 79220bc02a864119c862706e050e0e7bebed57b3
Author: Kevin Kofler <kevin.kofler at chello.at>
Date: Fri Sep 23 11:02:47 2011 +0200
trivial: zif: pass the URL before the title in link lists
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=740414
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 2fc253a..faf5789 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -3361,18 +3361,18 @@ pk_backend_get_update_detail_thread (PkBackend *backend)
switch (zif_update_info_get_kind (info)) {
case ZIF_UPDATE_INFO_KIND_CVE:
g_string_append_printf (string_cve, "%s;%s;",
- zif_update_info_get_title (info),
- zif_update_info_get_url (info));
+ zif_update_info_get_url (info),
+ zif_update_info_get_title (info));
break;
case ZIF_UPDATE_INFO_KIND_BUGZILLA:
g_string_append_printf (string_bugzilla, "%s;%s;",
- zif_update_info_get_title (info),
- zif_update_info_get_url (info));
+ zif_update_info_get_url (info),
+ zif_update_info_get_title (info));
break;
case ZIF_UPDATE_INFO_KIND_VENDOR:
g_string_append_printf (string_vendor, "%s;%s;",
- zif_update_info_get_title (info),
- zif_update_info_get_url (info));
+ zif_update_info_get_url (info),
+ zif_update_info_get_title (info));
break;
default:
break;
commit 03ea59f3b7be8ebb4e5ef0d03fdda579eae6cbdf
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Sep 22 12:16:16 2011 +0100
zif: Do not always ask for untrusted authentication for trusted repos
Packages are only marked ZIF_PACKAGE_TRUST_KIND_PUBKEY after the transaction has
been prepared (and the packages downloaded), and until then the trust is
unknown.
From Zif 0.2.4 (commit 48691cfee89e90b90d469d62f29ac335430970be) they will be
set to either ZIF_PACKAGE_TRUST_KIND_PUBKEY_UNVERIFIED when the repo has public
key support, or ZIF_PACKAGE_TRUST_KIND_NONE if the repo does not.
This allows us to skip the transaction straight to only_trusted=FALSE for
transactions involving untrusted packages after simulate which avoids the double
authentication.
After the packages are downloaded we have either ZIF_PACKAGE_TRUST_KIND_PUBKEY
or ZIF_PACKAGE_TRUST_KIND_NONE and this allows us to fail the transaction in
the normal way prompting a warning dialog like the the yum backend does.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=739983
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 046ad5d..2fc253a 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -3551,13 +3551,16 @@ pk_backend_run_transaction (PkBackend *backend, ZifState *state)
goto out;
}
- /* mark any untrusted packages */
+ /* mark any explicitly-untrusted packages so that the
+ * transaction skips straight to only_trusted=FALSE after
+ * simulate */
install = zif_transaction_get_install (priv->transaction);
untrusted_array = g_ptr_array_new ();
for (i=0; i<install->len; i++) {
package = g_ptr_array_index (install, i);
trust_kind = zif_package_get_trust_kind (package);
- if (trust_kind != ZIF_PACKAGE_TRUST_KIND_PUBKEY) {
+ if (trust_kind == ZIF_PACKAGE_TRUST_KIND_NONE ||
+ trust_kind == ZIF_PACKAGE_TRUST_KIND_UNKNOWN) {
/* TODO: make a proper property */
g_object_set_data (G_OBJECT(package),
"kind",
@@ -3568,8 +3571,9 @@ pk_backend_run_transaction (PkBackend *backend, ZifState *state)
/* ignore the trusted auth step */
pk_backend_message (backend,
PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE,
- "The package %s is untrusted",
- zif_package_get_printable (package));
+ "The package %s has trust %s",
+ zif_package_get_printable (package),
+ zif_package_trust_kind_to_string (trust_kind));
}
}
state_local = zif_state_get_child (state);
commit 6ab9b742bc230bd3ac8a6479ea737e9557ee1843
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Sep 22 11:19:35 2011 +0100
Offset the cache age by 30 minutes
We have to offset the cache age by 30 minutes if possible to account
for the possible delay in running the transaction, for example:
* Update check set to once per 3 days
* GUI starts checking for updates on Monday at 12:00
* Update check completes on Monday at 12:01
* GUI starts checking for updates on Thursday at 12:00 (exactly 3 days later)
* Cache is 2 days 23 hours 59 minutes old
* Backend sees it's not 3 days old, does nothing
Many thanks to Kevin Kofler for finding the problem.
diff --git a/src/pk-backend.c b/src/pk-backend.c
index ef4698c..036ffbb 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -1621,9 +1621,25 @@ pk_backend_get_cache_age (PkBackend *backend)
void
pk_backend_set_cache_age (PkBackend *backend, guint cache_age)
{
+ const guint cache_age_offset = 60 * 30;
+
g_return_if_fail (PK_IS_BACKEND (backend));
g_return_if_fail (backend->priv->locked != FALSE);
+ /* We offset the cache age by 30 minutes if possible to
+ * account for the possible delay in running the transaction,
+ * for example:
+ *
+ * Update check set to once per 3 days
+ * GUI starts checking for updates on Monday at 12:00
+ * Update check completes on Monday at 12:01
+ * GUI starts checking for updates on Thursday at 12:00 (exactly 3 days later)
+ * Cache is 2 days 23 hours 59 minutes old
+ * Backend sees it's not 3 days old, does nothing
+ */
+ if (cache_age > cache_age_offset)
+ cache_age -= cache_age_offset;
+
g_debug ("cache-age changed to %i", cache_age);
backend->priv->cache_age = cache_age;
}
commit 33b3406c2a34905020c077ec5a44579da3776678
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 19 18:17:36 2011 +0100
zif: Enable globbing for Resolve()
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 5605049..046ad5d 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -1259,7 +1259,8 @@ pk_backend_search_thread (PkBackend *backend)
array = zif_store_array_resolve_full (store_array,
search,
ZIF_STORE_RESOLVE_FLAG_USE_ALL |
- ZIF_STORE_RESOLVE_FLAG_PREFER_NATIVE,
+ ZIF_STORE_RESOLVE_FLAG_PREFER_NATIVE |
+ ZIF_STORE_RESOLVE_FLAG_USE_GLOB,
state_local,
&error);
#else
commit 858150969f6dc1c8db9bf89825f1d216780721f8
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 19 18:13:49 2011 +0100
Zif: Save the effective user ID and command line
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 9411c41..5605049 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -286,6 +286,10 @@ pk_backend_transaction_start (PkBackend *backend)
guint lock_delay;
guint lock_retries;
guint pid = 0;
+#if ZIF_CHECK_VERSION(0,2,4)
+ guint uid;
+ gchar *cmdline = NULL;
+#endif
/* only try a finite number of times */
lock_retries = zif_config_get_uint (priv->config, "lock_retries", NULL);
@@ -385,8 +389,21 @@ pk_backend_transaction_start (PkBackend *backend)
g_cancellable_reset (priv->cancellable);
/* start with a new transaction */
+#if ZIF_CHECK_VERSION(0,2,4)
+ g_object_get (backend,
+ "uid", &uid,
+ NULL);
+ zif_transaction_set_euid (priv->transaction, uid);
+ g_object_get (backend,
+ "cmdline", &cmdline,
+ NULL);
+ zif_transaction_set_cmdline (priv->transaction, cmdline);
+#endif
zif_transaction_reset (priv->transaction);
out:
+#if ZIF_CHECK_VERSION(0,2,4)
+ g_free (cmdline);
+#endif
g_free (http_proxy);
return;
}
commit f15e3b9bb1d7c3c8ee92ae09e3cb1d6e3752dbc2
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 19 18:10:54 2011 +0100
Add 'uid' and 'cmdline' properties to PkBackend
This lets the backend grab the properties and save to any tracking audit or history database.
diff --git a/src/pk-backend.c b/src/pk-backend.c
index e4917a0..ef4698c 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -135,6 +135,8 @@ struct PkBackendPrivate
PkStatusEnum status; /* this changes */
PkStore *store;
PkTime *time;
+ guint uid;
+ gchar *cmdline;
};
G_DEFINE_TYPE (PkBackend, pk_backend, G_TYPE_OBJECT)
@@ -173,6 +175,8 @@ enum {
PROP_PERCENTAGE,
PROP_SUBPERCENTAGE,
PROP_REMAINING,
+ PROP_UID,
+ PROP_CMDLINE,
PROP_LAST
};
@@ -811,6 +815,33 @@ pk_backend_set_root (PkBackend *backend, const gchar *root)
}
/**
+ * pk_backend_set_cmdline:
+ **/
+gboolean
+pk_backend_set_cmdline (PkBackend *backend, const gchar *cmdline)
+{
+ g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+
+ g_free (backend->priv->cmdline);
+ backend->priv->cmdline = g_strdup (cmdline);
+ g_debug ("install cmdline now %s", backend->priv->cmdline);
+ return TRUE;
+}
+
+/**
+ * pk_backend_set_uid:
+ **/
+gboolean
+pk_backend_set_uid (PkBackend *backend, guint uid)
+{
+ g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+
+ backend->priv->uid = uid;
+ g_debug ("install uid now %i", backend->priv->uid);
+ return TRUE;
+}
+
+/**
* pk_backend_get_root:
*
* Return value: root to use for installing, or %NULL
@@ -2837,6 +2868,12 @@ pk_backend_get_property (GObject *object, guint prop_id, GValue *value, GParamSp
case PROP_REMAINING:
g_value_set_uint (value, priv->remaining);
break;
+ case PROP_UID:
+ g_value_set_uint (value, priv->uid);
+ break;
+ case PROP_CMDLINE:
+ g_value_set_string (value, priv->cmdline);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -2906,6 +2943,7 @@ pk_backend_finalize (GObject *object)
g_free (backend->priv->no_proxy);
g_free (backend->priv->pac);
g_free (backend->priv->root);
+ g_free (backend->priv->cmdline);
g_free (backend->priv->name);
g_free (backend->priv->locale);
g_free (backend->priv->frontend_socket);
@@ -3007,6 +3045,22 @@ pk_backend_class_init (PkBackendClass *klass)
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_REMAINING, pspec);
+ /**
+ * PkBackend:uid:
+ */
+ pspec = g_param_spec_uint ("uid", NULL, NULL,
+ 0, G_MAXUINT, 0,
+ G_PARAM_READABLE);
+ g_object_class_install_property (object_class, PROP_UID, pspec);
+
+ /**
+ * PkBackend:cmdline:
+ */
+ pspec = g_param_spec_string ("cmdline", NULL, NULL,
+ NULL,
+ G_PARAM_READABLE);
+ g_object_class_install_property (object_class, PROP_CMDLINE, pspec);
+
/* properties */
signals[SIGNAL_STATUS_CHANGED] =
g_signal_new ("status-changed",
diff --git a/src/pk-backend.h b/src/pk-backend.h
index d6d8afa..644f849 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -85,6 +85,10 @@ gboolean pk_backend_set_proxy (PkBackend *backend,
const gchar *pac);
gboolean pk_backend_set_root (PkBackend *backend,
const gchar *root);
+gboolean pk_backend_set_uid (PkBackend *backend,
+ guint uid);
+gboolean pk_backend_set_cmdline (PkBackend *backend,
+ const gchar *cmdline);
gchar *pk_backend_get_name (PkBackend *backend)
G_GNUC_WARN_UNUSED_RESULT;
gboolean pk_backend_get_is_finished (PkBackend *backend);
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 67e4638..8ef4862 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -1773,6 +1773,7 @@ pk_transaction_set_session_state (PkTransaction *transaction,
gchar *no_proxy = NULL;
gchar *pac = NULL;
gchar *root = NULL;
+ gchar *cmdline = NULL;
PkTransactionPrivate *priv = transaction->priv;
/* get session */
@@ -1824,7 +1825,14 @@ pk_transaction_set_session_state (PkTransaction *transaction,
}
g_debug ("using http_proxy=%s, ftp_proxy=%s, root=%s for %i:%s",
proxy_http, proxy_ftp, root, priv->uid, session);
+
+ /* try to set the new uid and cmdline */
+ cmdline = g_strdup_printf ("PackageKit: %s",
+ pk_role_enum_to_string (priv->role));
+ pk_backend_set_uid (priv->backend, priv->uid);
+ pk_backend_set_cmdline (priv->backend, cmdline);
out:
+ g_free (cmdline);
g_free (proxy_http);
g_free (proxy_https);
g_free (proxy_ftp);
commit 490db277d2e36044377c4f151d5706686dccfc97
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 14 15:00:36 2011 +0100
Use the newest filter when resolving for new packages to install
diff --git a/client/pk-console.c b/client/pk-console.c
index e00b944..8e8a0a0 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -860,7 +860,12 @@ pk_console_install_packages (gchar **packages, GError **error)
}
}
- package_ids = pk_console_resolve_packages (PK_CLIENT(task), pk_bitfield_value (PK_FILTER_ENUM_NOT_INSTALLED), packages, &error_local);
+ package_ids = pk_console_resolve_packages (PK_CLIENT(task),
+ pk_bitfield_from_enums (PK_FILTER_ENUM_NOT_INSTALLED,
+ PK_FILTER_ENUM_NEWEST,
+ -1),
+ packages,
+ &error_local);
if (package_ids == NULL) {
/* TRANSLATORS: There was an error getting the list of files for the package. The detailed error follows */
*error = g_error_new (1, 0, _("This tool could not find any available package: %s"), error_local->message);
commit 469d0f3ef952f7cf8dfeb186827072518526bcba
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 14 14:54:06 2011 +0100
trivial: Switch the Fedora spec file example to use the 'auto' backend
diff --git a/contrib/PackageKit.spec.in b/contrib/PackageKit.spec.in
index 22026af..a22800b 100644
--- a/contrib/PackageKit.spec.in
+++ b/contrib/PackageKit.spec.in
@@ -251,7 +251,7 @@ user to restart the computer or remove and re-insert the device.
--enable-smart \
--enable-introspection \
%endif
- --with-default-backend=yum,zif \
+ --with-default-backend=auto \
--disable-local \
--disable-strict \
--disable-tests
commit d650cc58d0fa703220cb61add88ed0dcc7ee6fd8
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 14 14:40:32 2011 +0100
zif: Prefer native packages when resolving user input
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=737596
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 8f35ec6..9411c41 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -1241,7 +1241,8 @@ pk_backend_search_thread (PkBackend *backend)
#if ZIF_CHECK_VERSION(0,2,4)
array = zif_store_array_resolve_full (store_array,
search,
- ZIF_STORE_RESOLVE_FLAG_USE_ALL,
+ ZIF_STORE_RESOLVE_FLAG_USE_ALL |
+ ZIF_STORE_RESOLVE_FLAG_PREFER_NATIVE,
state_local,
&error);
#else
commit 61b51c493c522ab8971fdc18a817cff4b68b8315
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 14 13:45:18 2011 +0100
zif: Use zif_store_array_resolve_full() when possible
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index c143d94..8f35ec6 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -1238,7 +1238,18 @@ pk_backend_search_thread (PkBackend *backend)
/* this is a group */
array = pk_backend_resolve_groups (store_array, search, state_local, &error);
} else {
- array = zif_store_array_resolve (store_array, search, state_local, &error);
+#if ZIF_CHECK_VERSION(0,2,4)
+ array = zif_store_array_resolve_full (store_array,
+ search,
+ ZIF_STORE_RESOLVE_FLAG_USE_ALL,
+ state_local,
+ &error);
+#else
+ array = zif_store_array_resolve (store_array,
+ search,
+ state_local,
+ &error);
+#endif
}
} else if (role == PK_ROLE_ENUM_WHAT_PROVIDES) {
array = pk_backend_what_provides_helper (store_array, search, state_local, &error);
commit c8ea44c20bb42c125c58b9b3aa015816b702318a
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 12 15:04:05 2011 +0200
trivial: change enum now removed
diff --git a/backends/ports/portsBackend.rb b/backends/ports/portsBackend.rb
index 553cbcd..18d03d6 100755
--- a/backends/ports/portsBackend.rb
+++ b/backends/ports/portsBackend.rb
@@ -392,7 +392,7 @@ GROUPS = {
pkg = PkgInfo.new(port.pkgname)
next if pkg.version != version
- license = LICENSE_UNKNOWN
+ license = 'unknown'
portgroup = port.category()
group = GROUPS[portgroup] || GROUP_UNKNOWN
descr_file = File.join($portsdb.ports_dir, port.descr_file)
commit d06e0a363f84f9b306ad57d7b651bd550ef57453
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 12 14:53:49 2011 +0200
update constants from python
diff --git a/backends/ports/ruby_packagekit/enums.rb b/backends/ports/ruby_packagekit/enums.rb
index df63dd6..9543bfd 100644
--- a/backends/ports/ruby_packagekit/enums.rb
+++ b/backends/ports/ruby_packagekit/enums.rb
@@ -1,12 +1,18 @@
# Constants
+AUTHORIZE_INTERACTIVE = "interactive"
+AUTHORIZE_NO = "no"
+AUTHORIZE_UNKNOWN = "unknown"
+AUTHORIZE_YES = "yes"
DISTRO_UPGRADE_STABLE = "stable"
DISTRO_UPGRADE_UNKNOWN = "unknown"
DISTRO_UPGRADE_UNSTABLE = "unstable"
ERROR_ALL_PACKAGES_ALREADY_INSTALLED = "all-packages-already-installed"
ERROR_BAD_GPG_SIGNATURE = "bad-gpg-signature"
+ERROR_CANCELLED_PRIORITY = "cancelled-priority"
ERROR_CANNOT_CANCEL = "cannot-cancel"
ERROR_CANNOT_DISABLE_REPOSITORY = "cannot-disable-repository"
+ERROR_CANNOT_FETCH_SOURCES = "cannot-fetch-sources"
ERROR_CANNOT_GET_FILELIST = "cannot-get-filelist"
ERROR_CANNOT_GET_LOCK = "cannot-get-lock"
ERROR_CANNOT_GET_REQUIRES = "cannot-get-requires"
@@ -27,6 +33,7 @@ ERROR_GPG_FAILURE = "gpg-failure"
ERROR_GROUP_LIST_INVALID = "group-list-invalid"
ERROR_GROUP_NOT_FOUND = "group-not-found"
ERROR_INCOMPATIBLE_ARCHITECTURE = "incompatible-architecture"
+ERROR_INSTALL_ROOT_INVALID = "install-root-invalid"
ERROR_INTERNAL_ERROR = "internal-error"
ERROR_INVALID_PACKAGE_FILE = "invalid-package-file"
ERROR_LOCAL_INSTALL_FAILED = "local-install-failed"
@@ -45,20 +52,29 @@ ERROR_OOM = "out-of-memory"
ERROR_PACKAGE_ALREADY_INSTALLED = "package-already-installed"
ERROR_PACKAGE_CONFLICTS = "package-conflicts"
ERROR_PACKAGE_CORRUPT = "package-corrupt"
+ERROR_PACKAGE_DATABASE_CHANGED = "package-database-changed"
ERROR_PACKAGE_DOWNLOAD_FAILED = "package-download-failed"
+ERROR_PACKAGE_FAILED_TO_BUILD = "package-failed-to-build"
+ERROR_PACKAGE_FAILED_TO_CONFIGURE = "package-failed-to-configure"
+ERROR_PACKAGE_FAILED_TO_INSTALL = "package-failed-to-install"
+ERROR_PACKAGE_FAILED_TO_REMOVE = "package-failed-to-remove"
ERROR_PACKAGE_ID_INVALID = "package-id-invalid"
ERROR_PACKAGE_INSTALL_BLOCKED = "package-install-blocked"
ERROR_PACKAGE_NOT_FOUND = "package-not-found"
ERROR_PACKAGE_NOT_INSTALLED = "package-not-installed"
ERROR_PROCESS_KILL = "process-kill"
+ERROR_PROVIDE_TYPE_NOT_SUPPORTED = "provide-type-not-supported"
ERROR_REPO_CONFIGURATION_ERROR = "repo-configuration-error"
ERROR_REPO_NOT_AVAILABLE = "repo-not-available"
ERROR_REPO_NOT_FOUND = "repo-not-found"
+ERROR_RESTRICTED_DOWNLOAD = "restricted-download"
ERROR_TRANSACTION_CANCELLED = "transaction-cancelled"
ERROR_TRANSACTION_ERROR = "transaction-error"
ERROR_UNKNOWN = "unknown"
+ERROR_UPDATE_FAILED_DUE_TO_RUNNING_PROCESS = "failed-due-to-running-process"
ERROR_UPDATE_NOT_FOUND = "update-not-found"
EXIT_CANCELLED = "cancelled"
+EXIT_CANCELLED_PRIORITY = "cancelled-priority"
EXIT_EULA_REQUIRED = "eula-required"
EXIT_FAILED = "failed"
EXIT_KEY_REQUIRED = "key-required"
@@ -134,6 +150,8 @@ INFO_BUGFIX = "bugfix"
INFO_CLEANUP = "cleanup"
INFO_COLLECTION_AVAILABLE = "collection-available"
INFO_COLLECTION_INSTALLED = "collection-installed"
+INFO_DECOMPRESSING = "decompressing"
+INFO_DOWNGRADING = "downgrading"
INFO_DOWNLOADING = "downloading"
INFO_ENHANCEMENT = "enhancement"
INFO_FINISHED = "finished"
@@ -143,135 +161,14 @@ INFO_INSTALLING = "installing"
INFO_LOW = "low"
INFO_NORMAL = "normal"
INFO_OBSOLETING = "obsoleting"
+INFO_PREPARING = "preparing"
+INFO_REINSTALLING = "reinstalling"
INFO_REMOVING = "removing"
INFO_SECURITY = "security"
+INFO_TRUSTED = "trusted"
INFO_UNKNOWN = "unknown"
+INFO_UNTRUSTED = "untrusted"
INFO_UPDATING = "updating"
-LICENSE_ADOBE = "Adobe"
-LICENSE_AFL = "AFL"
-LICENSE_AGPLV1 = "AGPLv1"
-LICENSE_AGPLV3 = "AGPLv3"
-LICENSE_AMAZON_DSL = "ADSL"
-LICENSE_AMPAS_BSD = "AMPAS BSD"
-LICENSE_APSL_2_DOT_0 = "APSL 2.0"
-LICENSE_ARL = "ARL"
-LICENSE_ARPHIC = "Arphic"
-LICENSE_ARTISTIC_2_DOT_0 = "Artistic 2.0"
-LICENSE_ARTISTIC_CLARIFIED = "Artistic clarified"
-LICENSE_ASL_1_DOT_0 = "ASL 1.0"
-LICENSE_ASL_1_DOT_1 = "ASL 1.1"
-LICENSE_ASL_2_DOT_0 = "ASL 2.0"
-LICENSE_BAEKMUK = "Baekmuk"
-LICENSE_BITSTREAM_VERA = "Bitstream Vera"
-LICENSE_BITTORRENT = "BitTorrent"
-LICENSE_BOOST = "Boost"
-LICENSE_BSD = "BSD"
-LICENSE_BSD_WITH_ADVERTISING = "BSD with advertising"
-LICENSE_CC_BY = "CC-BY"
-LICENSE_CC_BY_ND = "CC-BY-ND"
-LICENSE_CC_BY_SA = "CC-BY-SA"
-LICENSE_CDDL = "CDDL"
-LICENSE_CDL = "CDL"
-LICENSE_CECILL = "CeCILL"
-LICENSE_CONDOR = "Condor"
-LICENSE_COPYRIGHT_ONLY = "Copyright only"
-LICENSE_CPL = "CPL"
-LICENSE_CRYPTIX = "Cryptix"
-LICENSE_CRYSTAL_STACKER = "Crystal Stacker"
-LICENSE_DOC = "DOC"
-LICENSE_DSL = "DSL"
-LICENSE_ECOS = "eCos"
-LICENSE_EFL_2_DOT_0 = "EFL 2.0"
-LICENSE_EPL = "EPL"
-LICENSE_EU_DATAGRID = "EU Datagrid"
-LICENSE_FBSDDL = "FBSDDL"
-LICENSE_FREE_ART = "Free Art"
-LICENSE_FTL = "FTL"
-LICENSE_GFDL = "GFDL"
-LICENSE_GIFTWARE = "Giftware"
-LICENSE_GLIDE = "Glide"
-LICENSE_GNUPLOT = "gnuplot"
-LICENSE_GPLV2 = "GPLv2"
-LICENSE_GPLV2_PLUS_WITH_EXCEPTIONS = "GPLv2+ with exceptions"
-LICENSE_GPLV2_WITH_EXCEPTIONS = "GPLv2 with exceptions"
-LICENSE_GPLV3 = "GPLv3"
-LICENSE_GPLV3_PLUS_WITH_EXCEPTIONS = "GPLv3+ with exceptions"
-LICENSE_GPLV3_WITH_EXCEPTIONS = "GPLv3 with exceptions"
-LICENSE_IBM = "IBM"
-LICENSE_IEEE = "IEEE"
-LICENSE_IJG = "IJG"
-LICENSE_IMAGEMAGICK = "ImageMagick"
-LICENSE_IMATIX = "iMatix"
-LICENSE_IMLIB2 = "Imlib2"
-LICENSE_INTEL_ACPI = "Intel ACPI"
-LICENSE_INTERBASE = "Interbase"
-LICENSE_ISC = "ISC"
-LICENSE_JABBER = "Jabber"
-LICENSE_JASPER = "JasPer"
-LICENSE_LGPLV2 = "LGPLv2"
-LICENSE_LGPLV3 = "LGPLv3"
-LICENSE_LIBTIFF = "libtiff"
-LICENSE_LPL = "LPL"
-LICENSE_LPPL = "LPPL"
-LICENSE_LUCIDA = "Lucida"
-LICENSE_MECAB_IPADIC = "mecab-ipadic"
-LICENSE_MIT = "MIT"
-LICENSE_MIT_WITH_ADVERTISING = "MIT with advertising"
-LICENSE_MPLUS = "mplus"
-LICENSE_MPLV1_DOT_0 = "MPLv1.0"
-LICENSE_MPLV1_DOT_1 = "MPLv1.1"
-LICENSE_NCSA = "NCSA"
-LICENSE_NETCDF = "NetCDF"
-LICENSE_NETSCAPE = "Netscape"
-LICENSE_NGPL = "NGPL"
-LICENSE_NOKIA = "Nokia"
-LICENSE_NOSL = "NOSL"
-LICENSE_OFL = "OFL"
-LICENSE_OFSFDL = "OFSFDL"
-LICENSE_OPENLDAP = "OpenLDAP"
-LICENSE_OPENPBS = "OpenPBS"
-LICENSE_OPENSSL = "OpenSSL"
-LICENSE_OPEN_PUBLICATION = "Open Publication"
-LICENSE_OREILLY = "OReilly"
-LICENSE_OSL_1_DOT_0 = "OSL 1.0"
-LICENSE_OSL_1_DOT_1 = "OSL 1.1"
-LICENSE_OSL_2_DOT_0 = "OSL 2.0"
-LICENSE_OSL_3_DOT_0 = "OSL 3.0"
-LICENSE_PHORUM = "Phorum"
-LICENSE_PHP = "PHP"
-LICENSE_PUBLIC_DOMAIN = "Public Domain"
-LICENSE_PYTHON = "Python"
-LICENSE_QHULL = "Qhull"
-LICENSE_QPL = "QPL"
-LICENSE_RICEBSD = "RiceBSD"
-LICENSE_RPSL = "RPSL"
-LICENSE_RUBY = "Ruby"
-LICENSE_SENDMAIL = "Sendmail"
-LICENSE_SISSL = "SISSL"
-LICENSE_SLEEPYCAT = "Sleepycat"
-LICENSE_SLIB = "SLIB"
-LICENSE_SPL = "SPL"
-LICENSE_STIX = "STIX"
-LICENSE_TCL = "TCL"
-LICENSE_UCD = "UCD"
-LICENSE_UNKNOWN = "unknown"
-LICENSE_UTOPIA = "Utopia"
-LICENSE_VIM = "Vim"
-LICENSE_VNLSL = "VNLSL"
-LICENSE_VOSTROM = "VOSTROM"
-LICENSE_VSL = "VSL"
-LICENSE_W3C = "W3C"
-LICENSE_WTFPL = "WTFPL"
-LICENSE_WXWIDGETS = "wxWidgets"
-LICENSE_XANO = "XANO"
-LICENSE_XEROX = "Xerox License"
-LICENSE_XINETD = "xinetd"
-LICENSE_ZEND = "Zend"
-LICENSE_ZLIB = "zlib"
-LICENSE_ZLIB_WITH_ACK = "zlib with acknowledgement"
-LICENSE_ZPLV1_DOT_0 = "ZPLv1.0"
-LICENSE_ZPLV2_DOT_0 = "ZPLv2.0"
-LICENSE_ZPLV2_DOT_1 = "ZPLv2.1"
MEDIA_TYPE_CD = "cd"
MEDIA_TYPE_DISC = "disc"
MEDIA_TYPE_DVD = "dvd"
@@ -285,9 +182,12 @@ MESSAGE_CONNECTION_REFUSED = "connection-refused"
MESSAGE_COULD_NOT_FIND_PACKAGE = "could-not-find-package"
MESSAGE_DAEMON_ERROR = "daemon-error"
MESSAGE_NEWER_PACKAGE_EXISTS = "newer-package-exists"
+MESSAGE_OTHER_UPDATES_HELD_BACK = "other-updates-held-back"
MESSAGE_PACKAGE_ALREADY_INSTALLED = "package-already-installed"
MESSAGE_PARAMETER_INVALID = "parameter-invalid"
MESSAGE_PRIORITY_INVALID = "priority-invalid"
+MESSAGE_REPO_FOR_DEVELOPERS_ONLY = "repo-for-developers-only"
+MESSAGE_REPO_METADATA_DOWNLOAD_FAILED = "repo-metadata-download-failed"
MESSAGE_UNKNOWN = "unknown"
MESSAGE_UNTRUSTED_PACKAGE = "untrusted-package"
NETWORK_MOBILE = "mobile"
@@ -302,6 +202,10 @@ PROVIDES_FONT = "font"
PROVIDES_HARDWARE_DRIVER = "driver"
PROVIDES_MIMETYPE = "mimetype"
PROVIDES_MODALIAS = "modalias"
+PROVIDES_PLASMA_SERVICE = "plasma-service"
+PROVIDES_POSTSCRIPT_DRIVER = "postscript-driver"
+PROVIDES_PYTHON = "python-module"
+PROVIDES_SHARED_LIB = "shared-library"
PROVIDES_UNKNOWN = "unknown"
RESTART_APPLICATION = "application"
RESTART_NONE = "none"
@@ -337,9 +241,14 @@ ROLE_SEARCH_DETAILS = "search-details"
ROLE_SEARCH_FILE = "search-file"
ROLE_SEARCH_GROUP = "search-group"
ROLE_SEARCH_NAME = "search-name"
+ROLE_SIMULATE_INSTALL_FILES = "simulate-install-files"
+ROLE_SIMULATE_INSTALL_PACKAGES = "simulate-install-packages"
+ROLE_SIMULATE_REMOVE_PACKAGES = "simulate-remove-packages"
+ROLE_SIMULATE_UPDATE_PACKAGES = "simulate-update-packages"
ROLE_UNKNOWN = "unknown"
ROLE_UPDATE_PACKAGES = "update-packages"
ROLE_UPDATE_SYSTEM = "update-system"
+ROLE_UPGRADE_SYSTEM = "upgrade-system"
ROLE_WHAT_PROVIDES = "what-provides"
SIGTYPE_GPG = "gpg"
SIGTYPE_UNKNOWN = "unknown"
@@ -348,6 +257,7 @@ STATUS_CHECK_EXECUTABLE_FILES = "check-executable-files"
STATUS_CHECK_LIBRARIES = "check-libraries"
STATUS_CLEANUP = "cleanup"
STATUS_COMMIT = "commit"
+STATUS_COPY_FILES = "copy-files"
STATUS_DEP_RESOLVE = "dep-resolve"
STATUS_DOWNLOAD = "download"
STATUS_DOWNLOAD_CHANGELOG = "download-changelog"
@@ -383,3 +293,7 @@ UPDATE_STATE_STABLE = "stable"
UPDATE_STATE_TESTING = "testing"
UPDATE_STATE_UNKNOWN = "unknown"
UPDATE_STATE_UNSTABLE = "unstable"
+UPGRADE_KIND_COMPLETE = "complete"
+UPGRADE_KIND_DEFAULT = "default"
+UPGRADE_KIND_MINIMAL = "minimal"
+UPGRADE_KIND_UNKNOWN = "unknown"
commit 428f16d717dcce01828aa96f285f53e25d10249f
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 12 14:48:18 2011 +0200
move base backend to separate file
diff --git a/backends/ports/portsBackend.rb b/backends/ports/portsBackend.rb
index 7e0e545..553cbcd 100755
--- a/backends/ports/portsBackend.rb
+++ b/backends/ports/portsBackend.rb
@@ -25,130 +25,14 @@ require 'open3' # ignores exitcodes
PROGRAM_DIR=File.dirname(File.expand_path($PROGRAM_NAME))
$LOAD_PATH.unshift PROGRAM_DIR
+require 'ruby_packagekit/backend'
require 'ruby_packagekit/enums'
require 'ruby_packagekit/prints'
-PACKAGE_IDS_DELIM = '&'
-FILENAME_DELIM = '|'
-
def init_global
$pkg_arch = PkgConfig::OS_PLATFORM
end
-class PackageKitBaseBackend
-
- def dispatch_command(cmd, args)
- case
- when cmd == 'download-packages'
- directory = args[0]
- package_ids = args[1].split(PACKAGE_IDS_DELIM)
- download_packages(directory, package_ids)
- finished()
- when cmd == 'get-packages'
- filters = args[0]
- get_packages(filters)
- finished()
- when cmd == 'get-repo-list'
- filters = args[0]
- get_repo_list(filters)
- finished()
- when cmd == 'resolve'
- filters = args[0]
- package_ids = args[1].split(PACKAGE_IDS_DELIM)
- resolve(filters, package_ids)
- finished()
- when cmd == 'search-details'
- options = args[0]
- searchterms = args[1]
- search_details(options, searchterms)
- finished()
- when cmd == 'search-file'
- options = args[0]
- searchterms = args[1]
- search_file(options, searchterms)
- finished()
- when cmd == 'search-group'
- options = args[0]
- searchterms = args[1]
- search_group(options, searchterms)
- finished()
- when cmd == 'search-name'
- options = args[0]
- searchterms = args[1]
- search_name(options, searchterms)
- finished()
- when cmd == 'get-depends'
- filters = args[0]
- package_ids = args[1].split(PACKAGE_IDS_DELIM)
- recursive = to_b(args[2])
- get_depends(filters, package_ids, recursive)
- finished()
- when cmd == 'get-details'
- package_ids = args[0].split(PACKAGE_IDS_DELIM)
- get_details(package_ids)
- finished()
- when cmd == 'get-files'
- package_ids = args[0].split(PACKAGE_IDS_DELIM)
- get_files(package_ids)
- finished()
- when cmd == 'get-requires'
- filters = args[0]
- package_ids = args[1].split(PACKAGE_IDS_DELIM)
- recursive = to_b(args[2])
- get_requires(filters, package_ids, recursive)
- finished()
- when cmd == 'get-update-detail'
- package_ids = args[0].split(PACKAGE_IDS_DELIM)
- get_update_detail(package_ids)
- finished()
- when cmd == 'get-updates'
- filters = args[0]
- get_updates(filters)
- finished()
- when cmd == 'install-files'
- only_trusted = to_b(args[0])
- files_to_inst = args[1].split(FILENAME_DELIM)
- install_files(only_trusted, files_to_inst)
- finished()
- when cmd == 'install-packages'
- only_trusted = to_b(args[0])
- package_ids = args[1].split(PACKAGE_IDS_DELIM)
- install_packages(only_trusted, package_ids)
- finished()
- when cmd == 'refresh-cache'
- force = to_b(args[0])
- refresh_cache(force)
- finished()
- when cmd == 'remove-packages'
- allowdeps = to_b(args[0])
- autoremove = to_b(args[1])
- package_ids = args[2].split(PACKAGE_IDS_DELIM)
- remove_packages(allowdeps, autoremove, package_ids)
- finished()
- when cmd == 'update-system'
- only_trusted = to_b(args[0])
- update_system(only_trusted)
- finished()
- else
- errmsg = "command '#{cmd}' is not known"
- error(ERROR_INTERNAL_ERROR, errmsg, exit=false)
- finished()
- end
- end
-
- def dispatcher(args)
- if args.size > 0
- dispatch_command(args[0], args[1..-1])
- else
- $stdin.each_line do |line|
- args = line.chomp.split('\t')
- dispatch_command(args[0], args[1..-1])
- end
- end
- end
-
-end
-
class PackageKitPortsBackend < PackageKitBaseBackend
# maps Ports group to PackageKit group
diff --git a/backends/ports/ruby_packagekit/Makefile.am b/backends/ports/ruby_packagekit/Makefile.am
index 1474f60..ef66604 100644
--- a/backends/ports/ruby_packagekit/Makefile.am
+++ b/backends/ports/ruby_packagekit/Makefile.am
@@ -3,6 +3,7 @@ helperdir = $(datadir)/PackageKit/helpers/ports/ruby_packagekit/
NULL =
dist_helper_DATA = \
+ backend.rb \
enums.rb \
prints.rb \
$(NULL)
diff --git a/backends/ports/ruby_packagekit/backend.rb b/backends/ports/ruby_packagekit/backend.rb
new file mode 100644
index 0000000..422d9ec
--- /dev/null
+++ b/backends/ports/ruby_packagekit/backend.rb
@@ -0,0 +1,138 @@
+# 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.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# Copyright (C) 2009 Anders F Bjorklund <afb at users.sourceforge.net>
+#
+# This file contain the base classes to implement a PackageKit ruby backend
+#
+
+PACKAGE_IDS_DELIM = '&'
+FILENAME_DELIM = '|'
+
+class PackageKitBaseBackend
+
+ def dispatch_command(cmd, args)
+ case
+ when cmd == 'download-packages'
+ directory = args[0]
+ package_ids = args[1].split(PACKAGE_IDS_DELIM)
+ download_packages(directory, package_ids)
+ finished()
+ when cmd == 'get-packages'
+ filters = args[0]
+ get_packages(filters)
+ finished()
+ when cmd == 'get-repo-list'
+ filters = args[0]
+ get_repo_list(filters)
+ finished()
+ when cmd == 'resolve'
+ filters = args[0]
+ package_ids = args[1].split(PACKAGE_IDS_DELIM)
+ resolve(filters, package_ids)
+ finished()
+ when cmd == 'search-details'
+ options = args[0]
+ searchterms = args[1]
+ search_details(options, searchterms)
+ finished()
+ when cmd == 'search-file'
+ options = args[0]
+ searchterms = args[1]
+ search_file(options, searchterms)
+ finished()
+ when cmd == 'search-group'
+ options = args[0]
+ searchterms = args[1]
+ search_group(options, searchterms)
+ finished()
+ when cmd == 'search-name'
+ options = args[0]
+ searchterms = args[1]
+ search_name(options, searchterms)
+ finished()
+ when cmd == 'get-depends'
+ filters = args[0]
+ package_ids = args[1].split(PACKAGE_IDS_DELIM)
+ recursive = to_b(args[2])
+ get_depends(filters, package_ids, recursive)
+ finished()
+ when cmd == 'get-details'
+ package_ids = args[0].split(PACKAGE_IDS_DELIM)
+ get_details(package_ids)
+ finished()
+ when cmd == 'get-files'
+ package_ids = args[0].split(PACKAGE_IDS_DELIM)
+ get_files(package_ids)
+ finished()
+ when cmd == 'get-requires'
+ filters = args[0]
+ package_ids = args[1].split(PACKAGE_IDS_DELIM)
+ recursive = to_b(args[2])
+ get_requires(filters, package_ids, recursive)
+ finished()
+ when cmd == 'get-update-detail'
+ package_ids = args[0].split(PACKAGE_IDS_DELIM)
+ get_update_detail(package_ids)
+ finished()
+ when cmd == 'get-updates'
+ filters = args[0]
+ get_updates(filters)
+ finished()
+ when cmd == 'install-files'
+ only_trusted = to_b(args[0])
+ files_to_inst = args[1].split(FILENAME_DELIM)
+ install_files(only_trusted, files_to_inst)
+ finished()
+ when cmd == 'install-packages'
+ only_trusted = to_b(args[0])
+ package_ids = args[1].split(PACKAGE_IDS_DELIM)
+ install_packages(only_trusted, package_ids)
+ finished()
+ when cmd == 'refresh-cache'
+ force = to_b(args[0])
+ refresh_cache(force)
+ finished()
+ when cmd == 'remove-packages'
+ allowdeps = to_b(args[0])
+ autoremove = to_b(args[1])
+ package_ids = args[2].split(PACKAGE_IDS_DELIM)
+ remove_packages(allowdeps, autoremove, package_ids)
+ finished()
+ when cmd == 'update-system'
+ only_trusted = to_b(args[0])
+ update_system(only_trusted)
+ finished()
+ else
+ errmsg = "command '#{cmd}' is not known"
+ error(ERROR_INTERNAL_ERROR, errmsg, exit=false)
+ finished()
+ end
+ end
+
+ def dispatcher(args)
+ if args.size > 0
+ dispatch_command(args[0], args[1..-1])
+ else
+ $stdin.each_line do |line|
+ args = line.chomp.split('\t')
+ dispatch_command(args[0], args[1..-1])
+ end
+ end
+ end
+
+end
+
commit fff1949eb03b743a148dfd13e342e6ae114570cc
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Fri Sep 9 16:48:55 2011 +0200
smart: make sure that data=installed is honored
diff --git a/backends/smart/smartBackend.py b/backends/smart/smartBackend.py
index 7634775..4dcee92 100755
--- a/backends/smart/smartBackend.py
+++ b/backends/smart/smartBackend.py
@@ -1054,6 +1054,20 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
packagestring = self._string_packageid(packageid)
ratio, results, suggestions = self.ctrl.search(packagestring)
+ # make sure that we get the installed variant if there are two
+ idparts = packageid.split(';')
+ repoid = idparts[3]
+ if repoid.startswith('installed'):
+ for obj in results:
+ if isinstance(obj, smart.cache.Package):
+ if not obj.installed:
+ results.remove(obj)
+ else:
+ results.remove(obj)
+ for pkg in obj.packages:
+ if pkg.installed:
+ results.append(pkg)
+
return (ratio, results, suggestions)
def _channel_is_local(self, channel):
commit 0ffe8a0f1e00bc34f601037e9c20e28c20a98ea9
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Fri Sep 9 13:30:46 2011 +0200
trivial: typo/thinko, upgrade/update confusion
diff --git a/backends/smart/smartBackend.py b/backends/smart/smartBackend.py
index 44f1754..7634775 100755
--- a/backends/smart/smartBackend.py
+++ b/backends/smart/smartBackend.py
@@ -1099,7 +1099,7 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
status = INFO_INSTALLING
elif op == smart.const.REINSTALL:
status = INFO_REINSTALLING
- elif op == smart.const.UPDATE:
+ elif op == smart.const.UPGRADE:
status = INFO_UPDATING
elif op == smart.const.REMOVE:
status = INFO_REMOVING
commit 2737908bd184f14bd444337ed0ef2a7280bae5fb
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Fri Sep 9 09:15:14 2011 +0200
trivial: update feature matrix
diff --git a/docs/html/pk-matrix.html b/docs/html/pk-matrix.html
index 1deeeff..bd4b9fe 100644
--- a/docs/html/pk-matrix.html
+++ b/docs/html/pk-matrix.html
@@ -508,7 +508,7 @@
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- portage -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- ports -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- slapt -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- smart -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- smart -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- urpmi -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- zypp -->
@@ -526,8 +526,8 @@
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- poldek -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- portage -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- ports -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- slapt -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- smart -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- slapt -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- smart -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- urpmi -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- zypp -->
@@ -545,8 +545,8 @@
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- poldek -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- portage -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- ports -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- slapt -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- smart -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- slapt -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- smart -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- urpmi -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- zypp -->
@@ -564,8 +564,8 @@
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- poldek -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- portage -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- ports -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- slapt -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- smart -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- slapt -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- smart -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- urpmi -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- zypp -->
commit 935e512f671c0bd19f84f08f9a8edadcbd20ea97
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Thu Sep 8 20:29:16 2011 +0200
slapt: implement the simulate methods
diff --git a/backends/slapt/pk-backend-slapt.c b/backends/slapt/pk-backend-slapt.c
index 741a4f2..512fb49 100644
--- a/backends/slapt/pk-backend-slapt.c
+++ b/backends/slapt/pk-backend-slapt.c
@@ -102,6 +102,12 @@ static PkBackend *_backend = NULL;
static slapt_rc_config *_config = NULL;
static const gchar *_config_file = "/etc/slapt-get/slapt-getrc";
+/* prototypes */
+static void _show_transaction(PkBackend *backend, slapt_transaction_t *transaction);
+static void _install_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids, gboolean simulate);
+static void _update_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids, gboolean simulate);
+static void _remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove, gboolean simulate);
+
/* CURLOPT_PROGRESSFUNCTION */
static int backend_progress_callback(void *clientp,
double dltotal, double dlnow, double ultotal, double ulnow)
@@ -349,6 +355,42 @@ static const gchar *_get_pkg_description(slapt_pkg_info_t *pkg)
return text;
}
+static void _show_transaction(PkBackend *backend, slapt_transaction_t *tran)
+{
+ slapt_pkg_info_t *pkg;
+ const gchar *package_id;
+ PkInfoEnum state;
+ const char *summary;
+ unsigned int i;
+
+ for (i = 0; i < tran->queue->count; i++) {
+
+ if (tran->queue->pkgs[i]->type == INSTALL) {
+ pkg = tran->queue->pkgs[i]->pkg.i;
+ state = PK_INFO_ENUM_INSTALLING;
+ package_id = _get_string_from_pkg(pkg);
+ summary = _get_pkg_summary(pkg);
+ pk_backend_package (backend, state, package_id, summary);
+ } else if (tran->queue->pkgs[i]->type == UPGRADE) {
+ pkg = tran->queue->pkgs[i]->pkg.u->upgrade;
+ state = PK_INFO_ENUM_UPDATING;
+ package_id = _get_string_from_pkg(pkg);
+ summary = _get_pkg_summary(pkg);
+ pk_backend_package (backend, state, package_id, summary);
+ }
+
+ }
+
+ for (i = 0; i < tran->remove_pkgs->pkg_count; i++) {
+ pkg = tran->remove_pkgs->pkgs[i];
+ state = PK_INFO_ENUM_REMOVING;
+ package_id = _get_string_from_pkg(pkg);
+ summary = _get_pkg_summary(pkg);
+ pk_backend_package (backend, state, package_id, summary);
+ }
+
+}
+
/**
* pk_backend_get_depends:
*/
@@ -690,6 +732,21 @@ pk_backend_get_updates (PkBackend *backend, PkBitfield filters)
void
pk_backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
{
+ _install_packages (backend, only_trusted, package_ids, FALSE);
+}
+
+/**
+ * pk_backend_simulate_install_packages:
+ */
+void
+pk_backend_simulate_install_packages (PkBackend *backend, gchar **package_ids)
+{
+ _install_packages (backend, FALSE, package_ids, TRUE);
+}
+
+static void
+_install_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids, gboolean simulate)
+{
guint i;
guint len;
gchar *pi;
@@ -734,9 +791,13 @@ pk_backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **
slapt_add_install_to_transaction(transaction, pkg);
}
- ret = slapt_handle_transaction(_config, transaction);
- if (ret != 0) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, "install failed");
+ if (simulate) {
+ _show_transaction(backend, transaction);
+ } else {
+ ret = slapt_handle_transaction(_config, transaction);
+ if (ret != 0) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, "install failed");
+ }
}
slapt_free_transaction(transaction);
@@ -825,6 +886,21 @@ pk_backend_resolve (PkBackend *backend, PkBitfield filters, gchar **packages)
void
pk_backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove)
{
+ _remove_packages (backend, package_ids, allow_deps, autoremove, FALSE);
+}
+
+/**
+ * pk_backend_simulate_remove_packages:
+ */
+void
+pk_backend_simulate_remove_packages (PkBackend *backend, gchar **package_ids, gboolean autoremove)
+{
+ _remove_packages (backend, package_ids, TRUE, autoremove, TRUE);
+}
+
+static void
+_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove, gboolean simulate)
+{
guint i;
guint len;
gchar *pi;
@@ -869,9 +945,13 @@ pk_backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean al
slapt_add_remove_to_transaction(transaction, pkg);
}
- ret = slapt_handle_transaction(_config, transaction);
- if (ret != 0) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, "remove failed");
+ if (simulate) {
+ _show_transaction(backend, transaction);
+ } else {
+ ret = slapt_handle_transaction(_config, transaction);
+ if (ret != 0) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, "remove failed");
+ }
}
slapt_free_transaction(transaction);
@@ -1057,6 +1137,21 @@ out:
void
pk_backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
{
+ _update_packages (backend, only_trusted, package_ids, FALSE);
+}
+
+/**
+ * pk_backend_simulate_update_packages:
+ */
+void
+pk_backend_simulate_update_packages (PkBackend *backend, gchar **package_ids)
+{
+ _update_packages (backend, FALSE, package_ids, TRUE);
+}
+
+static void
+_update_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids, gboolean simulate)
+{
guint i;
guint len;
const gchar *package_id;
@@ -1101,9 +1196,13 @@ pk_backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **p
slapt_add_upgrade_to_transaction(transaction, oldpkg, pkg);
}
- ret = slapt_handle_transaction(_config, transaction);
- if (ret != 0) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, "install failed");
+ if (simulate) {
+ _show_transaction(backend, transaction);
+ } else {
+ ret = slapt_handle_transaction(_config, transaction);
+ if (ret != 0) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, "install failed");
+ }
}
slapt_free_transaction(transaction);
commit 79f92190b22e3e3358fff2d933a3cf41abf98c65
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Sep 8 16:00:06 2011 +0100
trivial: Add in the provides data for plasma components
Thanks to Kevin Kofler for providing this.
diff --git a/docs/provides-component-naming.txt b/docs/provides-component-naming.txt
index 9501c66..139fc37 100644
--- a/docs/provides-component-naming.txt
+++ b/docs/provides-component-naming.txt
@@ -31,7 +31,8 @@ POSTSCRIPT_DRIVER:
to underscores.
Example: "postscriptdriver(epson;stylus_d92;)"
-PLASMA_SERVICE: Name of a Plasma service.
+PLASMA_SERVICE: A string in the format of "servicetype-name",
+ e.g. "plasma4(dataengine-weather)".
SHARED_LIB: Name of a shared library
Example: "libpackagekit-glib2.so.14"
commit b5067771536c10c3b083b86d232931f6bd6a7fd2
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Wed Sep 7 22:59:29 2011 +0200
smart: implement the simulate methods
diff --git a/backends/smart/pk-backend-smart.c b/backends/smart/pk-backend-smart.c
index 2e09a0b..9f0643c 100644
--- a/backends/smart/pk-backend-smart.c
+++ b/backends/smart/pk-backend-smart.c
@@ -238,6 +238,18 @@ pk_backend_get_update_detail (PkBackend *backend, gchar **package_ids)
}
/**
+ * pk_backend_simulate_install_packages:
+ */
+void
+pk_backend_simulate_install_packages (PkBackend *backend, gchar **package_ids)
+{
+ gchar *package_ids_temp;
+ package_ids_temp = pk_package_ids_to_string (package_ids);
+ pk_backend_spawn_helper (spawn, BACKEND_FILE, "simulate-install-packages", package_ids_temp, NULL);
+ g_free (package_ids_temp);
+}
+
+/**
* pk_backend_install_packages:
*/
void
@@ -259,6 +271,20 @@ pk_backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **
}
/**
+ * pk_backend_simulate_install_files:
+ */
+void
+pk_backend_simulate_install_files (PkBackend *backend, gchar **full_paths)
+{
+ gchar *package_ids_temp;
+
+ /* send the complete list as stdin */
+ package_ids_temp = g_strjoinv (PK_BACKEND_SPAWN_FILENAME_DELIM, full_paths);
+ pk_backend_spawn_helper (spawn, BACKEND_FILE, "simulate-install-files", package_ids_temp, NULL);
+ g_free (package_ids_temp);
+}
+
+/**
* pk_backend_install_files:
*/
void
@@ -289,6 +315,18 @@ pk_backend_refresh_cache (PkBackend *backend, gboolean force)
}
/**
+ * pk_backend_simulate_remove_packages:
+ */
+void
+pk_backend_simulate_remove_packages (PkBackend *backend, gchar **package_ids, gboolean autoremove)
+{
+ gchar *package_ids_temp;
+ package_ids_temp = pk_package_ids_to_string (package_ids);
+ pk_backend_spawn_helper (spawn, BACKEND_FILE, "simulate-remove-packages", package_ids_temp, NULL);
+ g_free (package_ids_temp);
+}
+
+/**
* pk_backend_remove_packages:
*/
void
@@ -363,6 +401,18 @@ pk_backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
}
/**
+ * pk_backend_simulate_update_packages:
+ */
+void
+pk_backend_simulate_update_packages (PkBackend *backend, gchar **package_ids)
+{
+ gchar *package_ids_temp;
+ package_ids_temp = pk_package_ids_to_string (package_ids);
+ pk_backend_spawn_helper (spawn, BACKEND_FILE, "simulate-update-packages", package_ids_temp, NULL);
+ g_free (package_ids_temp);
+}
+
+/**
* pk_backend_update_packages:
*/
void
diff --git a/backends/smart/smartBackend.py b/backends/smart/smartBackend.py
index 5121efe..44f1754 100755
--- a/backends/smart/smartBackend.py
+++ b/backends/smart/smartBackend.py
@@ -178,8 +178,14 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
def reset(self):
self._package_list = []
- @needs_cache
def install_packages(self, only_trusted, packageids):
+ self._install_packages(only_trusted, packageids)
+
+ def simulate_install_packages(self, packageids):
+ self._install_packages(False, packageids, True)
+
+ @needs_cache
+ def _install_packages(self, only_trusted, packageids, simulate=False):
if only_trusted:
self.error(ERROR_MISSING_GPG_SIGNATURE, "Trusted packages not available.")
return
@@ -210,12 +216,21 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
self.allow_cancel(False)
self.status(STATUS_DEP_RESOLVE)
trans.run()
- self.status(STATUS_INSTALL)
- self._packagesdict = trans.getChangeSet()
- self.ctrl.commitTransaction(trans, confirm=False)
+ if simulate:
+ self._show_changeset(trans.getChangeSet())
+ else:
+ self.status(STATUS_INSTALL)
+ self._packagesdict = trans.getChangeSet()
+ self.ctrl.commitTransaction(trans, confirm=False)
- @needs_cache
def install_files(self, only_trusted, paths):
+ self._install_files(only_trusted, paths)
+
+ def simulate_install_files(self, paths):
+ self._install_files(False, paths, True)
+
+ @needs_cache
+ def _install_files(self, only_trusted, paths, simulate=False):
if only_trusted:
self.error(ERROR_MISSING_GPG_SIGNATURE, "Trusted packages not available.")
return
@@ -236,12 +251,21 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
self.allow_cancel(False)
self.status(STATUS_DEP_RESOLVE)
trans.run()
- self.status(STATUS_INSTALL)
- self._packagesdict = trans.getChangeSet()
- self.ctrl.commitTransaction(trans, confirm=False)
+ if simulate:
+ self._show_changeset(trans.getChangeSet())
+ else:
+ self.status(STATUS_INSTALL)
+ self._packagesdict = trans.getChangeSet()
+ self.ctrl.commitTransaction(trans, confirm=False)
- @needs_cache
def remove_packages(self, allow_deps, autoremove, packageids):
+ self._remove_packages(allow_deps, autoremove, packageids)
+
+ def simulate_remove_packages(self, packageids):
+ self._remove_packages(True, False, packageids, True)
+
+ @needs_cache
+ def _remove_packages(self, allow_deps, autoremove, packageids, simulate=False):
# TODO: use autoremove
packages = []
for packageid in packageids:
@@ -273,12 +297,21 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
self.allow_cancel(False)
self.status(STATUS_DEP_RESOLVE)
trans.run()
- self.status(STATUS_REMOVE)
- self._packagesdict = trans.getChangeSet()
- self.ctrl.commitTransaction(trans, confirm=False)
+ if simulate:
+ self._show_changeset(trans.getChangeSet())
+ else:
+ self.status(STATUS_REMOVE)
+ self._packagesdict = trans.getChangeSet()
+ self.ctrl.commitTransaction(trans, confirm=False)
- @needs_cache
def update_packages(self, only_trusted, packageids):
+ self._update_packages(only_trusted, packageids)
+
+ def simulate_update_packages(self, packageids):
+ self._update_packages(False, packageids, True)
+
+ @needs_cache
+ def _update_packages(self, only_trusted, packageids, simulate=False):
if only_trusted:
self.error(ERROR_MISSING_GPG_SIGNATURE, "Trusted packages not available.")
return
@@ -302,9 +335,12 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
self.allow_cancel(False)
self.status(STATUS_DEP_RESOLVE)
trans.run()
- self.status(STATUS_UPDATE)
- self._packagesdict = trans.getChangeSet()
- self.ctrl.commitTransaction(trans, confirm=False)
+ if simulate:
+ self._show_changeset(trans.getChangeSet())
+ else:
+ self.status(STATUS_UPDATE)
+ self._packagesdict = trans.getChangeSet()
+ self.ctrl.commitTransaction(trans, confirm=False)
@needs_cache
def download_packages(self, directory, packageids):
@@ -1057,6 +1093,20 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
status = INFO_AVAILABLE
self._package_list.append((package, status))
+ def _show_changeset(self, changeset):
+ for (package, op) in changeset.items():
+ if op == smart.const.INSTALL:
+ status = INFO_INSTALLING
+ elif op == smart.const.REINSTALL:
+ status = INFO_REINSTALLING
+ elif op == smart.const.UPDATE:
+ status = INFO_UPDATING
+ elif op == smart.const.REMOVE:
+ status = INFO_REMOVING
+ else:
+ status = INFO_UNKNOWN
+ self._show_package(package, status)
+
def _show_package_list(self):
for package, status in self._package_list:
self._show_package(package, status)
commit 66fd7d6ad44f0019ed281042e4aa047e186ce3f3
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 7 16:34:10 2011 +0100
Remove the implemented checks for the simulate methods
We no longer support falling back to GetRequires for a RemovePackage for instance.
This should fix the crash in backends that don't implement Simulate.
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index dd7b9ff..67e4638 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -4998,8 +4998,7 @@ pk_transaction_simulate_install_packages (PkTransaction *transaction,
/* not implemented yet */
if (!pk_backend_is_implemented (transaction->priv->backend,
- PK_ROLE_ENUM_SIMULATE_INSTALL_PACKAGES) &&
- !pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_GET_DEPENDS)) {
+ PK_ROLE_ENUM_SIMULATE_INSTALL_PACKAGES)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
"SimulateInstallPackages not supported by backend");
pk_transaction_release_tid (transaction);
@@ -5071,8 +5070,7 @@ pk_transaction_simulate_remove_packages (PkTransaction *transaction,
/* not implemented yet */
if (!pk_backend_is_implemented (transaction->priv->backend,
- PK_ROLE_ENUM_SIMULATE_REMOVE_PACKAGES) &&
- !pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_GET_REQUIRES)) {
+ PK_ROLE_ENUM_SIMULATE_REMOVE_PACKAGES)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
"SimulateRemovePackages not supported by backend");
pk_transaction_release_tid (transaction);
@@ -5142,8 +5140,7 @@ pk_transaction_simulate_update_packages (PkTransaction *transaction,
/* not implemented yet */
if (!pk_backend_is_implemented (transaction->priv->backend,
- PK_ROLE_ENUM_SIMULATE_UPDATE_PACKAGES) &&
- !pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_GET_DEPENDS)) {
+ PK_ROLE_ENUM_SIMULATE_UPDATE_PACKAGES)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
"SimulateUpdatePackages not supported by backend");
pk_transaction_release_tid (transaction);
commit 7d616c24aa222d04781e15ba5e6c57f4f3de6351
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 7 16:17:09 2011 +0100
zif: Fix a critical warning when using WhatProvides
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index b632a5c..c143d94 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -1053,11 +1053,8 @@ pk_backend_what_provides_helper (GPtrArray *store_array,
g_assert (ret);
/* resolve all the depends */
- state_local = zif_state_get_child (state);
- zif_state_set_number_steps (state_local, g_strv_length (search));
depend_array = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
for (i=0; search[i] != NULL; i++) {
- state_local = zif_state_get_child (state);
/* parse this depend */
depend = zif_depend_new ();
@@ -1065,11 +1062,6 @@ pk_backend_what_provides_helper (GPtrArray *store_array,
ret = zif_depend_parse_description (depend, search[i], error);
if (!ret)
goto out;
-
- /* this part done */
- ret = zif_state_done (state_local, error);
- if (!ret)
- goto out;
}
/* this part done */
commit df614f9243d05eb7e8dfd49312113051f5df7419
Author: Vincent Untz <vuntz at gnome.org>
Date: Wed Sep 7 11:37:54 2011 +0200
qt: Really do not distribute moc files
https://bugs.freedesktop.org/show_bug.cgi?id=40662
Signed-off-by: Richard Hughes <richard at hughsie.com>
diff --git a/lib/packagekit-qt/src/Makefile.am b/lib/packagekit-qt/src/Makefile.am
index ce6c642..a9d6528 100644
--- a/lib/packagekit-qt/src/Makefile.am
+++ b/lib/packagekit-qt/src/Makefile.am
@@ -62,7 +62,6 @@ libpackagekit_qt_la_SOURCES = \
enum.h \
enum.cpp \
dbus_proxies.stamp \
- $(MOCFILES) \
$(NULL)
libpackagekit_qt_la_LIBADD = \
diff --git a/lib/packagekit-qt2/Makefile.am b/lib/packagekit-qt2/Makefile.am
index 08fdc59..a6501a1 100644
--- a/lib/packagekit-qt2/Makefile.am
+++ b/lib/packagekit-qt2/Makefile.am
@@ -69,7 +69,6 @@ libpackagekit_qt2_la_SOURCES = \
bitfield.cpp \
common.h \
dbus_proxies.stamp \
- $(MOCFILES) \
$(NULL)
libpackagekit_qt2_la_LIBADD = \
commit c52760083ec5388a791078c008056cea4f3abfae
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Tue Sep 6 20:10:54 2011 +0200
slapt: remove the vfuncs table
diff --git a/backends/slapt/pk-backend-slapt.c b/backends/slapt/pk-backend-slapt.c
index 1295f76..741a4f2 100644
--- a/backends/slapt/pk-backend-slapt.c
+++ b/backends/slapt/pk-backend-slapt.c
@@ -121,11 +121,11 @@ double dltotal, double dlnow, double ultotal, double ulnow)
}
/**
- * backend_initialize:
+ * pk_backend_initialize:
* This should only be run once per backend load, i.e. not every transaction
*/
-static void
-backend_initialize (PkBackend *backend)
+void
+pk_backend_initialize (PkBackend *backend)
{
struct category_map *catgroup;
@@ -147,21 +147,21 @@ backend_initialize (PkBackend *backend)
}
/**
- * backend_destroy:
+ * pk_backend_destroy:
* This should only be run once per backend load, i.e. not every transaction
*/
-static void
-backend_destroy (PkBackend *backend)
+void
+pk_backend_destroy (PkBackend *backend)
{
slapt_free_rc_config(_config);
g_hash_table_destroy(_cathash);
}
/**
- * backend_get_groups:
+ * pk_backend_get_groups:
*/
-static PkBitfield
-backend_get_groups (PkBackend *backend)
+PkBitfield
+pk_backend_get_groups (PkBackend *backend)
{
return pk_bitfield_from_enums (
/* PK_GROUP_ENUM_ACCESSIBILITY, */
@@ -202,10 +202,10 @@ backend_get_groups (PkBackend *backend)
}
/**
- * backend_get_filters:
+ * pk_backend_get_filters:
*/
-static PkBitfield
-backend_get_filters (PkBackend *backend)
+PkBitfield
+pk_backend_get_filters (PkBackend *backend)
{
return pk_bitfield_from_enums (
PK_FILTER_ENUM_INSTALLED,
@@ -214,10 +214,10 @@ backend_get_filters (PkBackend *backend)
}
/**
- * backend_get_mime_types:
+ * pk_backend_get_mime_types:
*/
-static gchar *
-backend_get_mime_types (PkBackend *backend)
+gchar *
+pk_backend_get_mime_types (PkBackend *backend)
{
return g_strdup ("application/x-compressed-tar;" /* .tgz */
"application/x-bzip-compressed-tar;" /* .tbz */
@@ -226,10 +226,10 @@ backend_get_mime_types (PkBackend *backend)
}
/**
- * backend_cancel:
+ * pk_backend_cancel:
*/
-static void
-backend_cancel (PkBackend *backend)
+void
+pk_backend_cancel (PkBackend *backend)
{
}
@@ -350,10 +350,10 @@ static const gchar *_get_pkg_description(slapt_pkg_info_t *pkg)
}
/**
- * backend_get_depends:
+ * pk_backend_get_depends:
*/
-static void
-backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
+void
+pk_backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
{
guint i;
guint len;
@@ -425,10 +425,10 @@ backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids
}
/**
- * backend_get_details:
+ * pk_backend_get_details:
*/
-static void
-backend_get_details (PkBackend *backend, gchar **package_ids)
+void
+pk_backend_get_details (PkBackend *backend, gchar **package_ids)
{
guint i;
guint len;
@@ -485,10 +485,10 @@ backend_get_details (PkBackend *backend, gchar **package_ids)
}
/**
- * backend_get_requires:
+ * pk_backend_get_requires:
*/
-static void
-backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
+void
+pk_backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
{
guint i;
guint len;
@@ -553,10 +553,10 @@ backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_id
}
/**
- * backend_get_update_detail:
+ * pk_backend_get_update_detail:
*/
-static void
-backend_get_update_detail (PkBackend *backend, gchar **package_ids)
+void
+pk_backend_get_update_detail (PkBackend *backend, gchar **package_ids)
{
guint i;
guint len;
@@ -628,10 +628,10 @@ backend_get_update_detail (PkBackend *backend, gchar **package_ids)
}
/**
- * backend_get_updates:
+ * pk_backend_get_updates:
*/
-static void
-backend_get_updates (PkBackend *backend, PkBitfield filters)
+void
+pk_backend_get_updates (PkBackend *backend, PkBitfield filters)
{
guint i;
const gchar *package_id;
@@ -685,10 +685,10 @@ backend_get_updates (PkBackend *backend, PkBitfield filters)
}
/**
- * backend_install_packages:
+ * pk_backend_install_packages:
*/
-static void
-backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
+void
+pk_backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
{
guint i;
guint len;
@@ -749,10 +749,10 @@ backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **pac
}
/**
- * backend_refresh_cache:
+ * pk_backend_refresh_cache:
*/
-static void
-backend_refresh_cache (PkBackend *backend, gboolean force)
+void
+pk_backend_refresh_cache (PkBackend *backend, gboolean force)
{
pk_backend_set_allow_cancel (backend, TRUE);
pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
@@ -761,10 +761,10 @@ backend_refresh_cache (PkBackend *backend, gboolean force)
}
/**
- * backend_resolve:
+ * pk_backend_resolve:
*/
-static void
-backend_resolve (PkBackend *backend, PkBitfield filters, gchar **packages)
+void
+pk_backend_resolve (PkBackend *backend, PkBitfield filters, gchar **packages)
{
guint i;
guint len;
@@ -820,10 +820,10 @@ backend_resolve (PkBackend *backend, PkBitfield filters, gchar **packages)
}
/**
- * backend_remove_packages:
+ * pk_backend_remove_packages:
*/
-static void
-backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove)
+void
+pk_backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove)
{
guint i;
guint len;
@@ -884,10 +884,10 @@ backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow
}
/**
- * backend_search_details:
+ * pk_backend_search_details:
*/
-static void
-backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
{
guint i;
gchar *search;
@@ -935,10 +935,10 @@ backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
}
/**
- * backend_search_groups:
+ * pk_backend_search_groups:
*/
-static void
-backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
{
guint i;
gchar *search;
@@ -994,10 +994,10 @@ backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
}
/**
- * backend_search_names:
+ * pk_backend_search_names:
*/
-static void
-backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
{
unsigned int i;
gchar *search;
@@ -1052,10 +1052,10 @@ out:
}
/**
- * backend_update_packages:
+ * pk_backend_update_packages:
*/
-static void
-backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
+void
+pk_backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
{
guint i;
guint len;
@@ -1136,10 +1136,10 @@ static const gchar *_get_source_repoid(slapt_source_t *src)
}
/**
- * backend_get_repo_list:
+ * pk_backend_get_repo_list:
*/
-static void
-backend_get_repo_list (PkBackend *backend, PkBitfield filters)
+void
+pk_backend_get_repo_list (PkBackend *backend, PkBitfield filters)
{
unsigned int i;
slapt_source_t *source;
@@ -1164,10 +1164,10 @@ backend_get_repo_list (PkBackend *backend, PkBitfield filters)
}
/**
- * backend_repo_enable:
+ * pk_backend_repo_enable:
*/
-static void
-backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
+void
+pk_backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
{
unsigned int i;
slapt_source_t *source;
@@ -1192,10 +1192,10 @@ backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
}
/**
- * backend_get_packages:
+ * pk_backend_get_packages:
*/
-static void
-backend_get_packages (PkBackend *backend, PkBitfield filters)
+void
+pk_backend_get_packages (PkBackend *backend, PkBitfield filters)
{
PkFilterEnum list_order[] = {
PK_FILTER_ENUM_INSTALLED,
@@ -1272,10 +1272,10 @@ backend_get_packages (PkBackend *backend, PkBitfield filters)
}
/**
- * backend_download_packages:
+ * pk_backend_download_packages:
*/
-static void
-backend_download_packages (PkBackend *backend, gchar **package_ids, const gchar *directory)
+void
+pk_backend_download_packages (PkBackend *backend, gchar **package_ids, const gchar *directory)
{
guint i;
guint len;
@@ -1332,50 +1332,21 @@ backend_download_packages (PkBackend *backend, gchar **package_ids, const gchar
pk_backend_finished (backend);
}
-/* FIXME: port this away from PK_BACKEND_OPTIONS */
-PK_BACKEND_OPTIONS (
- "Slack", /* description */
- "Anders F Björklund <afb at users.sourceforge.net>", /* author */
- backend_initialize, /* initalize */
- backend_destroy, /* destroy */
- backend_get_groups, /* get_groups */
- backend_get_filters, /* get_filters */
- NULL, /* get_roles */
- backend_get_mime_types, /* get_mime_types */
- backend_cancel, /* cancel */
- backend_download_packages, /* download_packages */
- NULL, /* get_categories */
- backend_get_depends, /* get_depends */
- backend_get_details, /* get_details */
- NULL, /* get_distro_upgrades */
- NULL, /* get_files */
- backend_get_packages, /* get_packages */
- backend_get_repo_list, /* get_repo_list */
- backend_get_requires, /* get_requires */
- backend_get_update_detail, /* get_update_detail */
- backend_get_updates, /* get_updates */
- NULL, /* install_files */
- backend_install_packages, /* install_packages */
- NULL, /* install_signature */
- backend_refresh_cache, /* refresh_cache */
- backend_remove_packages, /* remove_packages */
- backend_repo_enable, /* repo_enable */
- NULL, /* repo_set_data */
- backend_resolve, /* resolve */
- NULL, /* rollback */
- backend_search_details, /* search_details */
- NULL, /* search_files */
- backend_search_groups, /* search_groups */
- backend_search_names, /* search_names */
- backend_update_packages, /* update_packages */
- NULL, /* update_system */
- NULL, /* what_provides */
- NULL, /* simulate_install_files */
- NULL, /* simulate_install_packages */
- NULL, /* simulate_remove_packages */
- NULL, /* simulate_update_packages */
- NULL, /* upgrade_system */
- NULL, /* transaction_start */
- NULL /* transaction_stop */
-);
+/**
+ * pk_backend_get_description:
+ */
+gchar *
+pk_backend_get_description (PkBackend *backend)
+{
+ return g_strdup ("Slack");
+}
+
+/**
+ * pk_backend_get_author:
+ */
+gchar *
+pk_backend_get_author (PkBackend *backend)
+{
+ return g_strdup ("Anders F Björklund <afb at users.sourceforge.net>");
+}
commit 3e9e336cfabe2255e68954cced5d3db589834878
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Tue Sep 6 18:47:16 2011 +0200
trivial: enable smart backend again
diff --git a/contrib/PackageKit.spec.in b/contrib/PackageKit.spec.in
index 4072f6e..22026af 100644
--- a/contrib/PackageKit.spec.in
+++ b/contrib/PackageKit.spec.in
@@ -248,7 +248,7 @@ user to restart the computer or remove and re-insert the device.
--enable-yum \
--enable-zif \
%if 0%{?rhel} == 0
- --disable-smart \
+ --enable-smart \
--enable-introspection \
%endif
--with-default-backend=yum,zif \
@@ -356,9 +356,9 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%if 0%{?rhel} == 0
%files smart
%defattr(-,root,root,-)
-#%{_libdir}/packagekit-backend/libpk_backend_smart.so
-#%dir %{_datadir}/PackageKit/helpers/smart
-#%{_datadir}/PackageKit/helpers/smart/*
+%{_libdir}/packagekit-backend/libpk_backend_smart.so
+%dir %{_datadir}/PackageKit/helpers/smart
+%{_datadir}/PackageKit/helpers/smart/*
%endif
%files yum
commit f2b5bddc4bd84c32589d4ecf38fc6d97cb9d6130
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Tue Sep 6 18:30:18 2011 +0200
ports: remove the vfuncs table
diff --git a/backends/ports/pk-backend-ports.c b/backends/ports/pk-backend-ports.c
index ea51919..1bc42e6 100644
--- a/backends/ports/pk-backend-ports.c
+++ b/backends/ports/pk-backend-ports.c
@@ -26,11 +26,11 @@ static PkBackendSpawn *spawn = 0;
static const gchar* BACKEND_FILE = "portsBackend.rb";
/**
- * backend_initialize:
+ * pk_backend_initialize:
* This should only be run once per backend load, i.e. not every transaction
*/
-static void
-backend_initialize (PkBackend *backend)
+void
+pk_backend_initialize (PkBackend *backend)
{
g_debug ("backend: initialize");
spawn = pk_backend_spawn_new ();
@@ -40,21 +40,21 @@ backend_initialize (PkBackend *backend)
}
/**
- * backend_destroy:
+ * pk_backend_destroy:
* This should only be run once per backend load, i.e. not every transaction
*/
-static void
-backend_destroy (PkBackend *backend)
+void
+pk_backend_destroy (PkBackend *backend)
{
g_debug ("backend: destroy");
g_object_unref (spawn);
}
/**
- * backend_get_groups:
+ * pk_backend_get_groups:
*/
-static PkBitfield
-backend_get_groups (PkBackend *backend)
+PkBitfield
+pk_backend_get_groups (PkBackend *backend)
{
return pk_bitfield_from_enums (
PK_GROUP_ENUM_ACCESSIBILITY,
@@ -95,10 +95,10 @@ backend_get_groups (PkBackend *backend)
}
/**
- * backend_get_filters:
+ * pk_backend_get_filters:
*/
-static PkBitfield
-backend_get_filters (PkBackend *backend)
+PkBitfield
+pk_backend_get_filters (PkBackend *backend)
{
return pk_bitfield_from_enums (
PK_FILTER_ENUM_INSTALLED,
@@ -108,28 +108,28 @@ backend_get_filters (PkBackend *backend)
/**
* pk_backend_get_mime_types:
*/
-static gchar *
-backend_get_mime_types (PkBackend *backend)
+gchar *
+pk_backend_get_mime_types (PkBackend *backend)
{
return g_strdup ("application/x-compressed-tar;" /* .tgz */
"application/x-bzip-compressed-tar" /* .tbz */);
}
/**
- * backend_cancel:
+ * pk_backend_cancel:
*/
-static void
-backend_cancel (PkBackend *backend)
+void
+pk_backend_cancel (PkBackend *backend)
{
/* this feels bad... */
pk_backend_spawn_kill (spawn);
}
/**
- * backend_download_packages:
+ * pk_backend_download_packages:
*/
-static void
-backend_download_packages (PkBackend *backend, gchar **package_ids, const gchar *directory)
+void
+pk_backend_download_packages (PkBackend *backend, gchar **package_ids, const gchar *directory)
{
gchar *package_ids_temp;
@@ -140,10 +140,10 @@ backend_download_packages (PkBackend *backend, gchar **package_ids, const gchar
}
/**
- * backend_get_depends:
+ * pk_backend_get_depends:
*/
-static void
-backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
+void
+pk_backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
{
gchar *filters_text;
gchar *package_ids_temp;
@@ -156,10 +156,10 @@ backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids
}
/**
- * backend_get_details:
+ * pk_backend_get_details:
*/
-static void
-backend_get_details (PkBackend *backend, gchar **package_ids)
+void
+pk_backend_get_details (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -169,10 +169,10 @@ backend_get_details (PkBackend *backend, gchar **package_ids)
}
/**
- * backend_get_files:
+ * pk_backend_get_files:
*/
-static void
-backend_get_files (PkBackend *backend, gchar **package_ids)
+void
+pk_backend_get_files (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -182,10 +182,10 @@ backend_get_files (PkBackend *backend, gchar **package_ids)
}
/**
- * backend_get_update_detail:
+ * pk_backend_get_update_detail:
*/
-static void
-backend_get_update_detail (PkBackend *backend, gchar **package_ids)
+void
+pk_backend_get_update_detail (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -195,10 +195,10 @@ backend_get_update_detail (PkBackend *backend, gchar **package_ids)
}
/**
- * backend_get_updates:
+ * pk_backend_get_updates:
*/
-static void
-backend_get_updates (PkBackend *backend, PkBitfield filters)
+void
+pk_backend_get_updates (PkBackend *backend, PkBitfield filters)
{
gchar *filters_text;
@@ -208,10 +208,10 @@ backend_get_updates (PkBackend *backend, PkBitfield filters)
}
/**
- * backend_install_packages:
+ * pk_backend_install_packages:
*/
-static void
-backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
+void
+pk_backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -222,10 +222,10 @@ backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **pac
}
/**
- * backend_install_files:
+ * pk_backend_install_files:
*/
-static void
-backend_install_files (PkBackend *backend, gboolean only_trusted, gchar **full_paths)
+void
+pk_backend_install_files (PkBackend *backend, gboolean only_trusted, gchar **full_paths)
{
gchar *full_paths_temp;
@@ -236,10 +236,10 @@ backend_install_files (PkBackend *backend, gboolean only_trusted, gchar **full_p
}
/**
- * backend_refresh_cache:
+ * pk_backend_refresh_cache:
*/
-static void
-backend_refresh_cache (PkBackend *backend, gboolean force)
+void
+pk_backend_refresh_cache (PkBackend *backend, gboolean force)
{
/* check network state */
if (!pk_backend_is_online (backend)) {
@@ -252,10 +252,10 @@ backend_refresh_cache (PkBackend *backend, gboolean force)
}
/**
- * backend_remove_packages:
+ * pk_backend_remove_packages:
*/
-static void
-backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove)
+void
+pk_backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove)
{
gchar *package_ids_temp;
@@ -267,8 +267,8 @@ backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow
/**
* pk_backend_resolve:
*/
-static void
-backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
+void
+pk_backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
{
gchar *filters_text;
gchar *package_ids_temp;
@@ -283,8 +283,8 @@ backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
/**
* pk_backend_search_details:
*/
-static void
-backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
{
gchar *filters_text;
gchar *search;
@@ -297,10 +297,10 @@ backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
}
/**
- * backend_search_files:
+ * pk_backend_search_files:
*/
-static void
-backend_search_files (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_files (PkBackend *backend, PkBitfield filters, gchar **values)
{
gchar *filters_text;
gchar *search;
@@ -315,8 +315,8 @@ backend_search_files (PkBackend *backend, PkBitfield filters, gchar **values)
/**
* pk_backend_search_groups:
*/
-static void
-backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
{
gchar *filters_text;
gchar *search;
@@ -329,10 +329,10 @@ backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
}
/**
- * backend_search_names:
+ * pk_backend_search_names:
*/
-static void
-backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
{
gchar *filters_text;
gchar *search;
@@ -345,10 +345,10 @@ backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
}
/**
- * backend_update_packages:
+ * pk_backend_update_packages:
*/
-static void
-backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
+void
+pk_backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -359,10 +359,10 @@ backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **pack
}
/**
- * backend_get_packages:
+ * pk_backend_get_packages:
*/
-static void
-backend_get_packages (PkBackend *backend, PkBitfield filters)
+void
+pk_backend_get_packages (PkBackend *backend, PkBitfield filters)
{
gchar *filters_text;
@@ -374,8 +374,8 @@ backend_get_packages (PkBackend *backend, PkBitfield filters)
/**
* pk_backend_get_repo_list:
*/
-static void
-backend_get_repo_list (PkBackend *backend, PkBitfield filters)
+void
+pk_backend_get_repo_list (PkBackend *backend, PkBitfield filters)
{
gchar *filters_text;
@@ -385,10 +385,10 @@ backend_get_repo_list (PkBackend *backend, PkBitfield filters)
}
/**
- * backend_get_requires:
+ * pk_backend_get_requires:
*/
-static void
-backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
+void
+pk_backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
{
gchar *package_ids_temp;
gchar *filters_text;
@@ -401,58 +401,29 @@ backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_id
}
/**
- * backend_update_system:
+ * pk_backend_update_system:
*/
-static void
-backend_update_system (PkBackend *backend, gboolean only_trusted)
+void
+pk_backend_update_system (PkBackend *backend, gboolean only_trusted)
{
pk_backend_spawn_helper (spawn, BACKEND_FILE, "update-system", pk_backend_bool_to_string (only_trusted), NULL);
}
-/* FIXME: port this away from PK_BACKEND_OPTIONS */
-PK_BACKEND_OPTIONS (
- "Ports", /* description */
- "Anders F Björklund <afb at users.sourceforge.net>", /* author */
- backend_initialize, /* initalize */
- backend_destroy, /* destroy */
- backend_get_groups, /* get_groups */
- backend_get_filters, /* get_filters */
- NULL, /* get_roles */
- backend_get_mime_types, /* get_mime_types */
- backend_cancel, /* cancel */
- backend_download_packages, /* download_packages */
- NULL, /* get_categories */
- backend_get_depends, /* get_depends */
- backend_get_details, /* get_details */
- NULL, /* get_distro_upgrades */
- backend_get_files, /* get_files */
- backend_get_packages, /* get_packages */
- backend_get_repo_list, /* get_repo_list */
- backend_get_requires, /* get_requires */
- backend_get_update_detail, /* get_update_detail */
- backend_get_updates, /* get_updates */
- backend_install_files, /* install_files */
- backend_install_packages, /* install_packages */
- NULL, /* install_signature */
- backend_refresh_cache, /* refresh_cache */
- backend_remove_packages, /* remove_packages */
- NULL, /* repo_enable */
- NULL, /* repo_set_data */
- backend_resolve, /* resolve */
- NULL, /* rollback */
- backend_search_details, /* search_details */
- backend_search_files, /* search_files */
- backend_search_groups, /* search_groups */
- backend_search_names, /* search_names */
- backend_update_packages, /* update_packages */
- backend_update_system, /* update_system */
- NULL, /* what_provides */
- NULL, /* simulate_install_files */
- NULL, /* simulate_install_packages */
- NULL, /* simulate_remove_packages */
- NULL, /* simulate_update_packages */
- NULL, /* upgrade_system */
- NULL, /* transaction_start */
- NULL /* transaction_stop */
-);
+/**
+ * pk_backend_get_description:
+ */
+gchar *
+pk_backend_get_description (PkBackend *backend)
+{
+ return g_strdup ("Ports");
+}
+
+/**
+ * pk_backend_get_author:
+ */
+gchar *
+pk_backend_get_author (PkBackend *backend)
+{
+ return g_strdup ("Anders F Björklund <afb at users.sourceforge.net>");
+}
commit c3f912f334df4c9df67b882deb170435220b146c
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Tue Sep 6 18:16:40 2011 +0200
smart: remove the vfuncs table
diff --git a/backends/smart/pk-backend-smart.c b/backends/smart/pk-backend-smart.c
index 421fa61..2e09a0b 100644
--- a/backends/smart/pk-backend-smart.c
+++ b/backends/smart/pk-backend-smart.c
@@ -28,11 +28,11 @@ static PkBackendSpawn *spawn;
static const gchar* BACKEND_FILE = "smartBackend.py";
/**
- * backend_initialize:
+ * pk_backend_initialize:
* This should only be run once per backend load, i.e. not every transaction
*/
-static void
-backend_initialize (PkBackend *backend)
+void
+pk_backend_initialize (PkBackend *backend)
{
g_debug ("backend: initialize");
spawn = pk_backend_spawn_new ();
@@ -40,21 +40,21 @@ backend_initialize (PkBackend *backend)
}
/**
- * backend_destroy:
+ * pk_backend_destroy:
* This should only be run once per backend load, i.e. not every transaction
*/
-static void
-backend_destroy (PkBackend *backend)
+void
+pk_backend_destroy (PkBackend *backend)
{
g_debug ("backend: destroy");
g_object_unref (spawn);
}
/**
- * backend_get_groups:
+ * pk_backend_get_groups:
*/
-static PkBitfield
-backend_get_groups (PkBackend *backend)
+PkBitfield
+pk_backend_get_groups (PkBackend *backend)
{
return pk_bitfield_from_enums (
PK_GROUP_ENUM_COLLECTIONS,
@@ -90,10 +90,10 @@ backend_get_groups (PkBackend *backend)
}
/**
- * backend_get_filters:
+ * pk_backend_get_filters:
*/
-static PkBitfield
-backend_get_filters (PkBackend *backend)
+PkBitfield
+pk_backend_get_filters (PkBackend *backend)
{
return pk_bitfield_from_enums (
PK_FILTER_ENUM_INSTALLED,
@@ -111,8 +111,8 @@ backend_get_filters (PkBackend *backend)
/**
* pk_backend_get_mime_types:
*/
-static gchar *
-backend_get_mime_types (PkBackend *backend)
+gchar *
+pk_backend_get_mime_types (PkBackend *backend)
{
return g_strdup ("application/x-rpm;"
"application/x-deb;"
@@ -126,18 +126,18 @@ backend_get_mime_types (PkBackend *backend)
/**
* pk_backend_cancel:
*/
-static void
-backend_cancel (PkBackend *backend)
+void
+pk_backend_cancel (PkBackend *backend)
{
/* this feels bad... */
pk_backend_spawn_kill (spawn);
}
/**
- * backend_download_packages:
+ * pk_backend_download_packages:
*/
-static void
-backend_download_packages (PkBackend *backend, gchar **package_ids, const gchar *directory)
+void
+pk_backend_download_packages (PkBackend *backend, gchar **package_ids, const gchar *directory)
{
gchar *package_ids_temp;
@@ -148,10 +148,10 @@ backend_download_packages (PkBackend *backend, gchar **package_ids, const gchar
}
/**
- * backend_get_depends:
+ * pk_backend_get_depends:
*/
-static void
-backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
+void
+pk_backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
{
gchar *filters_text;
gchar *package_ids_temp;
@@ -163,10 +163,10 @@ backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids
}
/**
- * backend_get_details:
+ * pk_backend_get_details:
*/
-static void
-backend_get_details (PkBackend *backend, gchar **package_ids)
+void
+pk_backend_get_details (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
package_ids_temp = pk_package_ids_to_string (package_ids);
@@ -175,10 +175,10 @@ backend_get_details (PkBackend *backend, gchar **package_ids)
}
/**
- * backend_get_files:
+ * pk_backend_get_files:
*/
-static void
-backend_get_files (PkBackend *backend, gchar **package_ids)
+void
+pk_backend_get_files (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
package_ids_temp = pk_package_ids_to_string (package_ids);
@@ -187,10 +187,10 @@ backend_get_files (PkBackend *backend, gchar **package_ids)
}
/**
- * backend_get_requires:
+ * pk_backend_get_requires:
*/
-static void
-backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
+void
+pk_backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
{
gchar *package_ids_temp;
gchar *filters_text;
@@ -202,10 +202,10 @@ backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_id
}
/**
- * backend_get_updates:
+ * pk_backend_get_updates:
*/
-static void
-backend_get_updates (PkBackend *backend, PkBitfield filters)
+void
+pk_backend_get_updates (PkBackend *backend, PkBitfield filters)
{
gchar *filters_text;
filters_text = pk_filter_bitfield_to_string (filters);
@@ -214,10 +214,10 @@ backend_get_updates (PkBackend *backend, PkBitfield filters)
}
/**
- * backend_get_packages:
+ * pk_backend_get_packages:
*/
-static void
-backend_get_packages (PkBackend *backend, PkBitfield filters)
+void
+pk_backend_get_packages (PkBackend *backend, PkBitfield filters)
{
gchar *filters_text;
filters_text = pk_filter_bitfield_to_string (filters);
@@ -226,10 +226,10 @@ backend_get_packages (PkBackend *backend, PkBitfield filters)
}
/**
- * backend_get_update_detail:
+ * pk_backend_get_update_detail:
*/
-static void
-backend_get_update_detail (PkBackend *backend, gchar **package_ids)
+void
+pk_backend_get_update_detail (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
package_ids_temp = pk_package_ids_to_string (package_ids);
@@ -238,10 +238,10 @@ backend_get_update_detail (PkBackend *backend, gchar **package_ids)
}
/**
- * backend_install_packages:
+ * pk_backend_install_packages:
*/
-static void
-backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
+void
+pk_backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -259,10 +259,10 @@ backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **pac
}
/**
- * backend_install_files:
+ * pk_backend_install_files:
*/
-static void
-backend_install_files (PkBackend *backend, gboolean only_trusted, gchar **full_paths)
+void
+pk_backend_install_files (PkBackend *backend, gboolean only_trusted, gchar **full_paths)
{
gchar *full_paths_temp;
@@ -273,10 +273,10 @@ backend_install_files (PkBackend *backend, gboolean only_trusted, gchar **full_p
}
/**
- * backend_refresh_cache:
+ * pk_backend_refresh_cache:
*/
-static void
-backend_refresh_cache (PkBackend *backend, gboolean force)
+void
+pk_backend_refresh_cache (PkBackend *backend, gboolean force)
{
/* check network state */
if (!pk_backend_is_online (backend)) {
@@ -291,8 +291,8 @@ backend_refresh_cache (PkBackend *backend, gboolean force)
/**
* pk_backend_remove_packages:
*/
-static void
-backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove)
+void
+pk_backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove)
{
gchar *package_ids_temp;
@@ -305,8 +305,8 @@ backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow
/**
* pk_backend_search_details:
*/
-static void
-backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
{
gchar *filters_text;
gchar *search;
@@ -320,8 +320,8 @@ backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
/**
* pk_backend_search_files:
*/
-static void
-backend_search_files (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_files (PkBackend *backend, PkBitfield filters, gchar **values)
{
gchar *filters_text;
gchar *search;
@@ -335,8 +335,8 @@ backend_search_files (PkBackend *backend, PkBitfield filters, gchar **values)
/**
* pk_backend_search_groups:
*/
-static void
-backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
{
gchar *filters_text;
gchar *search;
@@ -350,8 +350,8 @@ backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
/**
* pk_backend_search_names:
*/
-static void
-backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
{
gchar *filters_text;
gchar *search;
@@ -365,8 +365,8 @@ backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
/**
* pk_backend_update_packages:
*/
-static void
-backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
+void
+pk_backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -386,8 +386,8 @@ backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **pack
/**
* pk_backend_update_system:
*/
-static void
-backend_update_system (PkBackend *backend, gboolean only_trusted)
+void
+pk_backend_update_system (PkBackend *backend, gboolean only_trusted)
{
pk_backend_spawn_helper (spawn, BACKEND_FILE, "update-system", pk_backend_bool_to_string (only_trusted), NULL);
}
@@ -395,8 +395,8 @@ backend_update_system (PkBackend *backend, gboolean only_trusted)
/**
* pk_backend_resolve:
*/
-static void
-backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
+void
+pk_backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
{
gchar *filters_text;
gchar *package_ids_temp;
@@ -410,8 +410,8 @@ backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
/**
* pk_backend_get_repo_list:
*/
-static void
-backend_get_repo_list (PkBackend *backend, PkBitfield filters)
+void
+pk_backend_get_repo_list (PkBackend *backend, PkBitfield filters)
{
gchar *filters_text;
filters_text = pk_filter_bitfield_to_string (filters);
@@ -422,8 +422,8 @@ backend_get_repo_list (PkBackend *backend, PkBitfield filters)
/**
* pk_backend_repo_enable:
*/
-static void
-backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
+void
+pk_backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
{
if (enabled == TRUE) {
pk_backend_spawn_helper (spawn, BACKEND_FILE, "repo-enable", rid, "true", NULL);
@@ -435,55 +435,27 @@ backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
/**
* pk_backend_repo_set_data:
*/
-static void
-backend_repo_set_data (PkBackend *backend, const gchar *rid, const gchar *parameter, const gchar *value)
+void
+pk_backend_repo_set_data (PkBackend *backend, const gchar *rid, const gchar *parameter, const gchar *value)
{
pk_backend_spawn_helper (spawn, BACKEND_FILE, "repo-set-data", rid, parameter, value, NULL);
}
-/* FIXME: port this away from PK_BACKEND_OPTIONS */
-PK_BACKEND_OPTIONS (
- "SMART", /* description */
- "James Bowes <jbowes at dangerouslyinc.com>", /* author */
- backend_initialize, /* initialize */
- backend_destroy, /* destroy */
- backend_get_groups, /* get_groups */
- backend_get_filters, /* get_filters */
- NULL, /* get_roles */
- backend_get_mime_types, /* get_mime_types */
- backend_cancel, /* cancel */
- backend_download_packages, /* download_packages */
- NULL, /* get_categories */
- backend_get_depends, /* get_depends */
- backend_get_details, /* get_details */
- NULL, /* get_distro_upgrades */
- backend_get_files, /* get_files */
- backend_get_packages, /* get_packages */
- backend_get_repo_list, /* get_repo_list */
- backend_get_requires, /* get_requires */
- backend_get_update_detail, /* get_update_detail */
- backend_get_updates, /* get_updates */
- backend_install_files, /* install_files */
- backend_install_packages, /* install_packages */
- NULL, /* install_signature */
- backend_refresh_cache, /* refresh_cache */
- backend_remove_packages, /* remove_packages */
- backend_repo_enable, /* repo_enable */
- backend_repo_set_data, /* repo_set_data */
- backend_resolve, /* resolve */
- NULL, /* rollback */
- backend_search_details, /* search_details */
- backend_search_files, /* search_files */
- backend_search_groups, /* search_groups */
- backend_search_names, /* search_names */
- backend_update_packages, /* update_packages */
- backend_update_system, /* update_system */
- NULL, /* what_provides */
- NULL, /* simulate_install_files */
- NULL, /* simulate_install_packages */
- NULL, /* simulate_remove_packages */
- NULL, /* simulate_update_packages */
- NULL, /* upgrade_system */
- NULL, /* transaction_start */
- NULL /* transaction_stop */
-);
+/**
+ * pk_backend_get_description:
+ */
+gchar *
+pk_backend_get_description (PkBackend *backend)
+{
+ return g_strdup ("Smart");
+}
+
+/**
+ * pk_backend_get_author:
+ */
+gchar *
+pk_backend_get_author (PkBackend *backend)
+{
+ return g_strdup ("James Bowes <jbowes at dangerouslyinc.com>, "
+ "Anders F Björklund <afb at users.sourceforge.net>");
+}
commit a4df7f5ff6f88435358bc1142992cb47d28ecb38
Author: Fabio Erculiani <lxnay at sabayon.org>
Date: Tue Sep 6 12:57:15 2011 +0200
entropy: drop PK_BACKEND_OPTIONS macro usage
diff --git a/backends/entropy/pk-backend-entropy.c b/backends/entropy/pk-backend-entropy.c
index cee6c65..4d47a74 100644
--- a/backends/entropy/pk-backend-entropy.c
+++ b/backends/entropy/pk-backend-entropy.c
@@ -26,11 +26,11 @@ static PkBackendSpawn *spawn = 0;
static const gchar* BACKEND_FILE = "entropyBackend.py";
/**
- * backend_initialize:
+ * pk_backend_initialize:
* This should only be run once per backend load, i.e. not every transaction
*/
-static void
-backend_initialize (PkBackend *backend)
+void
+pk_backend_initialize (PkBackend *backend)
{
g_debug ("backend: initialize");
spawn = pk_backend_spawn_new ();
@@ -40,21 +40,21 @@ backend_initialize (PkBackend *backend)
}
/**
- * backend_destroy:
+ * pk_backend_destroy:
* This should only be run once per backend load, i.e. not every transaction
*/
-static void
-backend_destroy (PkBackend *backend)
+void
+pk_backend_destroy (PkBackend *backend)
{
g_debug ("backend: destroy");
g_object_unref (spawn);
}
/**
- * backend_get_groups:
+ * pk_backend_get_groups:
*/
-static PkBitfield
-backend_get_groups (PkBackend *backend)
+PkBitfield
+pk_backend_get_groups (PkBackend *backend)
{
return pk_bitfield_from_enums (
PK_GROUP_ENUM_ACCESSIBILITY,
@@ -96,10 +96,10 @@ backend_get_groups (PkBackend *backend)
}
/**
- * backend_get_filters:
+ * pk_backend_get_filters:
*/
-static PkBitfield
-backend_get_filters (PkBackend *backend)
+PkBitfield
+pk_backend_get_filters (PkBackend *backend)
{
return pk_bitfield_from_enums (
PK_FILTER_ENUM_INSTALLED,
@@ -117,10 +117,10 @@ backend_get_filters (PkBackend *backend)
}
/**
- * backend_get_roles:
+ * pk_backend_get_roles:
*/
-static PkBitfield
-backend_get_roles (PkBackend *backend)
+PkBitfield
+pk_backend_get_roles (PkBackend *backend)
{
PkBitfield roles;
roles = pk_bitfield_from_enums (
@@ -160,29 +160,29 @@ backend_get_roles (PkBackend *backend)
}
/**
- * backend_get_mime_types:
+ * pk_backend_get_mime_types:
*/
-static gchar *
-backend_get_mime_types (PkBackend *backend)
+gchar *
+pk_backend_get_mime_types (PkBackend *backend)
{
return g_strdup ("application/entropy-package;application/entropy-webinstall");
}
/**
- * backend_cancel:
+ * pk_backend_cancel:
*/
-static void
-backend_cancel (PkBackend *backend)
+void
+pk_backend_cancel (PkBackend *backend)
{
/* this feels bad... */
pk_backend_spawn_kill (spawn);
}
/**
- * backend_download_packages:
+ * pk_backend_download_packages:
*/
-static void
-backend_download_packages (PkBackend *backend, gchar **package_ids, const gchar *directory)
+void
+pk_backend_download_packages (PkBackend *backend, gchar **package_ids, const gchar *directory)
{
gchar *package_ids_temp;
@@ -193,10 +193,10 @@ backend_download_packages (PkBackend *backend, gchar **package_ids, const gchar
}
/**
- * backend_what_provides:
+ * pk_backend_what_provides:
*/
-static void
-backend_what_provides (PkBackend *backend, PkBitfield filters, PkProvidesEnum provides, const gchar *search)
+void
+pk_backend_what_provides (PkBackend *backend, PkBitfield filters, PkProvidesEnum provides, gchar **search)
{
gchar *filters_text;
const gchar *provides_text;
@@ -209,17 +209,17 @@ backend_what_provides (PkBackend *backend, PkBitfield filters, PkProvidesEnum pr
/**
* pk_backend_get_categories:
*/
-static void
-backend_get_categories (PkBackend *backend)
+void
+pk_backend_get_categories (PkBackend *backend)
{
pk_backend_spawn_helper (spawn, BACKEND_FILE, "get-categories", NULL);
}
/**
- * backend_get_depends:
+ * pk_backend_get_depends:
*/
-static void
-backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
+void
+pk_backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
{
gchar *filters_text;
gchar *package_ids_temp;
@@ -232,10 +232,10 @@ backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids
}
/**
- * backend_get_details:
+ * pk_backend_get_details:
*/
-static void
-backend_get_details (PkBackend *backend, gchar **package_ids)
+void
+pk_backend_get_details (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -245,19 +245,19 @@ backend_get_details (PkBackend *backend, gchar **package_ids)
}
/**
- * backend_get_distro_upgrades:
+ * pk_backend_get_distro_upgrades:
*/
-static void
-backend_get_distro_upgrades (PkBackend *backend)
+void
+pk_backend_get_distro_upgrades (PkBackend *backend)
{
pk_backend_spawn_helper (spawn, BACKEND_FILE, "get-distro-upgrades", NULL);
}
/**
- * backend_get_files:
+ * pk_backend_get_files:
*/
-static void
-backend_get_files (PkBackend *backend, gchar **package_ids)
+void
+pk_backend_get_files (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -267,10 +267,10 @@ backend_get_files (PkBackend *backend, gchar **package_ids)
}
/**
- * backend_get_update_detail:
+ * pk_backend_get_update_detail:
*/
-static void
-backend_get_update_detail (PkBackend *backend, gchar **package_ids)
+void
+pk_backend_get_update_detail (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -280,10 +280,10 @@ backend_get_update_detail (PkBackend *backend, gchar **package_ids)
}
/**
- * backend_get_updates:
+ * pk_backend_get_updates:
*/
-static void
-backend_get_updates (PkBackend *backend, PkBitfield filters)
+void
+pk_backend_get_updates (PkBackend *backend, PkBitfield filters)
{
gchar *filters_text;
@@ -293,10 +293,10 @@ backend_get_updates (PkBackend *backend, PkBitfield filters)
}
/**
- * backend_install_packages:
+ * pk_backend_install_packages:
*/
-static void
-backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
+void
+pk_backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -307,10 +307,10 @@ backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **pac
}
/**
- * backend_install_files:
+ * pk_backend_install_files:
*/
-static void
-backend_install_files (PkBackend *backend, gboolean only_trusted, gchar **full_paths)
+void
+pk_backend_install_files (PkBackend *backend, gboolean only_trusted, gchar **full_paths)
{
gchar *package_ids_temp;
@@ -321,10 +321,10 @@ backend_install_files (PkBackend *backend, gboolean only_trusted, gchar **full_p
}
/**
- * backend_refresh_cache:
+ * pk_backend_refresh_cache:
*/
-static void
-backend_refresh_cache (PkBackend *backend, gboolean force)
+void
+pk_backend_refresh_cache (PkBackend *backend, gboolean force)
{
/* check network state */
if (!pk_backend_is_online (backend)) {
@@ -337,10 +337,10 @@ backend_refresh_cache (PkBackend *backend, gboolean force)
}
/**
- * backend_remove_packages:
+ * pk_backend_remove_packages:
*/
-static void
-backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove)
+void
+pk_backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove)
{
gchar *package_ids_temp;
@@ -352,8 +352,8 @@ backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow
/**
* pk_backend_repo_enable:
*/
-static void
-backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
+void
+pk_backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
{
pk_backend_spawn_helper (spawn, BACKEND_FILE, "repo-enable", rid, pk_backend_bool_to_string (enabled), NULL);
}
@@ -361,8 +361,8 @@ backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
/**
* pk_backend_resolve:
*/
-static void
-backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
+void
+pk_backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
{
gchar *filters_text;
gchar *package_ids_temp;
@@ -377,8 +377,8 @@ backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
/**
* pk_backend_search_details:
*/
-static void
-backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
{
gchar *filters_text;
gchar *search;
@@ -390,10 +390,10 @@ backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
}
/**
- * backend_search_files:
+ * pk_backend_search_files:
*/
-static void
-backend_search_files (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_files (PkBackend *backend, PkBitfield filters, gchar **values)
{
gchar *filters_text;
gchar *search;
@@ -407,8 +407,8 @@ backend_search_files (PkBackend *backend, PkBitfield filters, gchar **values)
/**
* pk_backend_search_groups:
*/
-static void
-backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
{
gchar *filters_text;
gchar *search;
@@ -420,10 +420,10 @@ backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
}
/**
- * backend_search_names:
+ * pk_backend_search_names:
*/
-static void
-backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
{
gchar *filters_text;
gchar *search;
@@ -435,10 +435,10 @@ backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
}
/**
- * backend_update_packages:
+ * pk_backend_update_packages:
*/
-static void
-backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
+void
+pk_backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -449,10 +449,10 @@ backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **pack
}
/**
- * backend_get_packages:
+ * pk_backend_get_packages:
*/
-static void
-backend_get_packages (PkBackend *backend, PkBitfield filters)
+void
+pk_backend_get_packages (PkBackend *backend, PkBitfield filters)
{
gchar *filters_text;
@@ -464,8 +464,8 @@ backend_get_packages (PkBackend *backend, PkBitfield filters)
/**
* pk_backend_get_repo_list:
*/
-static void
-backend_get_repo_list (PkBackend *backend, PkBitfield filters)
+void
+pk_backend_get_repo_list (PkBackend *backend, PkBitfield filters)
{
gchar *filters_text;
@@ -475,10 +475,10 @@ backend_get_repo_list (PkBackend *backend, PkBitfield filters)
}
/**
- * backend_get_requires:
+ * pk_backend_get_requires:
*/
-static void
-backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
+void
+pk_backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
{
gchar *package_ids_temp;
gchar *filters_text;
@@ -491,19 +491,19 @@ backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_id
}
/**
- * backend_update_system:
+ * pk_backend_update_system:
*/
-static void
-backend_update_system (PkBackend *backend, gboolean only_trusted)
+void
+pk_backend_update_system (PkBackend *backend, gboolean only_trusted)
{
pk_backend_spawn_helper (spawn, BACKEND_FILE, "update-system", pk_backend_bool_to_string (only_trusted), NULL);
}
/**
- * backend_simulate_remove_packages:
+ * pk_backend_simulate_remove_packages:
*/
-static void
-backend_simulate_remove_packages (PkBackend *backend, gchar **package_ids, gboolean autoremove)
+void
+pk_backend_simulate_remove_packages (PkBackend *backend, gchar **package_ids, gboolean autoremove)
{
gchar *package_ids_temp;
@@ -514,10 +514,10 @@ backend_simulate_remove_packages (PkBackend *backend, gchar **package_ids, gbool
}
/**
- * backend_simulate_update_packages:
+ * pk_backend_simulate_update_packages:
*/
-static void
-backend_simulate_update_packages (PkBackend *backend, gchar **package_ids)
+void
+pk_backend_simulate_update_packages (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -528,10 +528,10 @@ backend_simulate_update_packages (PkBackend *backend, gchar **package_ids)
}
/**
- * backend_simulate_install_packages:
+ * pk_backend_simulate_install_packages:
*/
-static void
-backend_simulate_install_packages (PkBackend *backend, gchar **package_ids)
+void
+pk_backend_simulate_install_packages (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -542,10 +542,10 @@ backend_simulate_install_packages (PkBackend *backend, gchar **package_ids)
}
/**
- * backend_simulate_install_files:
+ * pk_backend_simulate_install_files:
*/
-static void
-backend_simulate_install_files (PkBackend *backend, gchar **full_paths)
+void
+pk_backend_simulate_install_files (PkBackend *backend, gchar **full_paths)
{
gchar *package_ids_temp;
@@ -555,50 +555,20 @@ backend_simulate_install_files (PkBackend *backend, gchar **full_paths)
g_free (package_ids_temp);
}
-/* FIXME: port this away from PK_BACKEND_OPTIONS */
-PK_BACKEND_OPTIONS (
- "Entropy", /* description */
- "Fabio Erculiani (lxnay) <lxnay at sabayon.org>", /* author */
- backend_initialize, /* initalize */
- backend_destroy, /* destroy */
- backend_get_groups, /* get_groups */
- backend_get_filters, /* get_filters */
- backend_get_roles, /* get_roles */
- backend_get_mime_types, /* get_mime_types */
- backend_cancel, /* cancel */
- backend_download_packages, /* download_packages */
- backend_get_categories, /* get_categories */
- backend_get_depends, /* get_depends */
- backend_get_details, /* get_details */
- backend_get_distro_upgrades, /* get_distro_upgrades */
- backend_get_files, /* get_files */
- backend_get_packages, /* get_packages */
- backend_get_repo_list, /* get_repo_list */
- backend_get_requires, /* get_requires */
- backend_get_update_detail, /* get_update_detail */
- backend_get_updates, /* get_updates */
- backend_install_files, /* install_files */
- backend_install_packages, /* install_packages */
- NULL, /* install_signature */
- backend_refresh_cache, /* refresh_cache */
- backend_remove_packages, /* remove_packages */
- backend_repo_enable, /* repo_enable */
- NULL, /* repo_set_data */
- backend_resolve, /* resolve */
- NULL, /* rollback */
- backend_search_details, /* search_details */
- backend_search_files, /* search_file */
- backend_search_groups, /* search_group */
- backend_search_names, /* search_name */
- backend_update_packages, /* update_packages */
- backend_update_system, /* update_system */
- backend_what_provides, /* what_provides */
- backend_simulate_install_files, /* simulate_install_files */
- backend_simulate_install_packages, /* simulate_install_packages */
- backend_simulate_remove_packages, /* simulate_remove_packages */
- backend_simulate_update_packages, /* simulate_update_packages */
- NULL, /* upgrade_system */
- NULL, /* transaction_start */
- NULL /* transaction_stop */
-);
+/**
+ * pk_backend_get_description:
+ */
+gchar *
+pk_backend_get_description (PkBackend *backend)
+{
+ return g_strdup ("Entropy");
+}
+/**
+ * pk_backend_get_author:
+ */
+gchar *
+pk_backend_get_author (PkBackend *backend)
+{
+ return g_strdup ("Fabio Erculiani (lxnay) <lxnay at sabayon.org>");
+}
commit b6a5fea6583c3863b673b0072f0137ec76c9309a
Author: Fabio Erculiani <lxnay at sabayon.org>
Date: Tue Sep 6 12:55:00 2011 +0200
portage: drop PK_BACKEND_OPTIONS macro usage
diff --git a/backends/portage/pk-backend-portage.c b/backends/portage/pk-backend-portage.c
index 21109a8..ebe8764 100644
--- a/backends/portage/pk-backend-portage.c
+++ b/backends/portage/pk-backend-portage.c
@@ -26,11 +26,11 @@ static PkBackendSpawn *spawn = 0;
static const gchar* BACKEND_FILE = "portageBackend.py";
/**
- * backend_initialize:
+ * pk_backend_initialize:
* This should only be run once per backend load, i.e. not every transaction
*/
-static void
-backend_initialize (PkBackend *backend)
+void
+pk_backend_initialize (PkBackend *backend)
{
g_debug ("backend: initialize");
spawn = pk_backend_spawn_new ();
@@ -40,21 +40,21 @@ backend_initialize (PkBackend *backend)
}
/**
- * backend_destroy:
+ * pk_backend_destroy:
* This should only be run once per backend load, i.e. not every transaction
*/
-static void
-backend_destroy (PkBackend *backend)
+void
+pk_backend_destroy (PkBackend *backend)
{
g_debug ("backend: destroy");
g_object_unref (spawn);
}
/**
- * backend_get_groups:
+ * pk_backend_get_groups:
*/
-static PkBitfield
-backend_get_groups (PkBackend *backend)
+PkBitfield
+pk_backend_get_groups (PkBackend *backend)
{
return pk_bitfield_from_enums (
PK_GROUP_ENUM_ACCESSIBILITY,
@@ -96,10 +96,10 @@ backend_get_groups (PkBackend *backend)
}
/**
- * backend_get_filters:
+ * pk_backend_get_filters:
*/
-static PkBitfield
-backend_get_filters (PkBackend *backend)
+PkBitfield
+pk_backend_get_filters (PkBackend *backend)
{
return pk_bitfield_from_enums (
PK_FILTER_ENUM_INSTALLED,
@@ -117,10 +117,10 @@ backend_get_filters (PkBackend *backend)
}
/**
- * backend_get_roles:
+ * pk_backend_get_roles:
*/
-static PkBitfield
-backend_get_roles (PkBackend *backend)
+PkBitfield
+pk_backend_get_roles (PkBackend *backend)
{
PkBitfield roles;
roles = pk_bitfield_from_enums (
@@ -160,10 +160,10 @@ backend_get_roles (PkBackend *backend)
}
/**
- * backend_cancel:
+ * pk_backend_cancel:
*/
-static void
-backend_cancel (PkBackend *backend)
+void
+pk_backend_cancel (PkBackend *backend)
{
/* this feels bad... */
pk_backend_spawn_kill (spawn);
@@ -172,17 +172,17 @@ backend_cancel (PkBackend *backend)
/**
* pk_backend_get_categories:
*/
-static void
-backend_get_categories (PkBackend *backend)
+void
+pk_backend_get_categories (PkBackend *backend)
{
pk_backend_spawn_helper (spawn, BACKEND_FILE, "get-categories", NULL);
}
/**
- * backend_get_depends:
+ * pk_backend_get_depends:
*/
-static void
-backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
+void
+pk_backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
{
gchar *filters_text;
gchar *package_ids_temp;
@@ -195,10 +195,10 @@ backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids
}
/**
- * backend_get_details:
+ * pk_backend_get_details:
*/
-static void
-backend_get_details (PkBackend *backend, gchar **package_ids)
+void
+pk_backend_get_details (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -208,10 +208,10 @@ backend_get_details (PkBackend *backend, gchar **package_ids)
}
/**
- * backend_get_files:
+ * pk_backend_get_files:
*/
-static void
-backend_get_files (PkBackend *backend, gchar **package_ids)
+void
+pk_backend_get_files (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -221,10 +221,10 @@ backend_get_files (PkBackend *backend, gchar **package_ids)
}
/**
- * backend_get_update_detail:
+ * pk_backend_get_update_detail:
*/
-static void
-backend_get_update_detail (PkBackend *backend, gchar **package_ids)
+void
+pk_backend_get_update_detail (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -234,10 +234,10 @@ backend_get_update_detail (PkBackend *backend, gchar **package_ids)
}
/**
- * backend_get_updates:
+ * pk_backend_get_updates:
*/
-static void
-backend_get_updates (PkBackend *backend, PkBitfield filters)
+void
+pk_backend_get_updates (PkBackend *backend, PkBitfield filters)
{
gchar *filters_text;
@@ -247,10 +247,10 @@ backend_get_updates (PkBackend *backend, PkBitfield filters)
}
/**
- * backend_install_packages:
+ * pk_backend_install_packages:
*/
-static void
-backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
+void
+pk_backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -268,10 +268,10 @@ backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **pac
}
/**
- * backend_refresh_cache:
+ * pk_backend_refresh_cache:
*/
-static void
-backend_refresh_cache (PkBackend *backend, gboolean force)
+void
+pk_backend_refresh_cache (PkBackend *backend, gboolean force)
{
/* check network state */
if (!pk_backend_is_online (backend)) {
@@ -284,10 +284,10 @@ backend_refresh_cache (PkBackend *backend, gboolean force)
}
/**
- * backend_remove_packages:
+ * pk_backend_remove_packages:
*/
-static void
-backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove)
+void
+pk_backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove)
{
gchar *package_ids_temp;
@@ -299,8 +299,8 @@ backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow
/**
* pk_backend_repo_enable:
*/
-static void
-backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
+void
+pk_backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
{
pk_backend_spawn_helper (spawn, BACKEND_FILE, "repo-enable", rid, pk_backend_bool_to_string (enabled), NULL);
}
@@ -308,8 +308,8 @@ backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
/**
* pk_backend_resolve:
*/
-static void
-backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
+void
+pk_backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
{
gchar *filters_text;
gchar *package_ids_temp;
@@ -324,8 +324,8 @@ backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
/**
* pk_backend_search_details:
*/
-static void
-backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
{
gchar *filters_text;
gchar *search;
@@ -339,8 +339,8 @@ backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
/**
* backend_search_files:
*/
-static void
-backend_search_files (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_files (PkBackend *backend, PkBitfield filters, gchar **values)
{
gchar *filters_text;
gchar *search;
@@ -354,8 +354,8 @@ backend_search_files (PkBackend *backend, PkBitfield filters, gchar **values)
/**
* pk_backend_search_groups:
*/
-static void
-backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
{
gchar *filters_text;
gchar *search;
@@ -367,10 +367,10 @@ backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
}
/**
- * backend_search_names:
+ * pk_backend_search_names:
*/
-static void
-backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
+void
+pk_backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
{
gchar *filters_text;
gchar *search;
@@ -382,10 +382,10 @@ backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
}
/**
- * backend_update_packages:
+ * pk_backend_update_packages:
*/
-static void
-backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
+void
+pk_backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -396,10 +396,10 @@ backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **pack
}
/**
- * backend_get_packages:
+ * pk_backend_get_packages:
*/
-static void
-backend_get_packages (PkBackend *backend, PkBitfield filters)
+void
+pk_backend_get_packages (PkBackend *backend, PkBitfield filters)
{
gchar *filters_text;
@@ -411,8 +411,8 @@ backend_get_packages (PkBackend *backend, PkBitfield filters)
/**
* pk_backend_get_repo_list:
*/
-static void
-backend_get_repo_list (PkBackend *backend, PkBitfield filters)
+void
+pk_backend_get_repo_list (PkBackend *backend, PkBitfield filters)
{
gchar *filters_text;
@@ -422,10 +422,10 @@ backend_get_repo_list (PkBackend *backend, PkBitfield filters)
}
/**
- * backend_get_requires:
+ * pk_backend_get_requires:
*/
-static void
-backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
+void
+pk_backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
{
gchar *package_ids_temp;
gchar *filters_text;
@@ -438,19 +438,19 @@ backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_id
}
/**
- * backend_update_system:
+ * pk_backend_update_system:
*/
-static void
-backend_update_system (PkBackend *backend, gboolean only_trusted)
+void
+pk_backend_update_system (PkBackend *backend, gboolean only_trusted)
{
pk_backend_spawn_helper (spawn, BACKEND_FILE, "update-system", pk_backend_bool_to_string (only_trusted), NULL);
}
/**
- * backend_simulate_remove_packages:
+ * pk_backend_simulate_remove_packages:
*/
-static void
-backend_simulate_remove_packages (PkBackend *backend, gchar **package_ids, gboolean autoremove)
+void
+pk_backend_simulate_remove_packages (PkBackend *backend, gchar **package_ids, gboolean autoremove)
{
gchar *package_ids_temp;
@@ -461,10 +461,10 @@ backend_simulate_remove_packages (PkBackend *backend, gchar **package_ids, gbool
}
/**
- * backend_simulate_update_packages:
+ * pk_backend_simulate_update_packages:
*/
-static void
-backend_simulate_update_packages (PkBackend *backend, gchar **package_ids)
+void
+pk_backend_simulate_update_packages (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -475,10 +475,10 @@ backend_simulate_update_packages (PkBackend *backend, gchar **package_ids)
}
/**
- * backend_simulate_install_packages:
+ * pk_backend_simulate_install_packages:
*/
-static void
-backend_simulate_install_packages (PkBackend *backend, gchar **package_ids)
+void
+pk_backend_simulate_install_packages (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -488,50 +488,20 @@ backend_simulate_install_packages (PkBackend *backend, gchar **package_ids)
g_free (package_ids_temp);
}
-/* FIXME: port this away from PK_BACKEND_OPTIONS */
-PK_BACKEND_OPTIONS (
- "Portage", /* description */
- "Mounir Lamouri (volkmar) <mounir.lamouri at gmail.com>, Fabio Erculiani <lxnay at sabayon.org>", /* author */
- backend_initialize, /* initalize */
- backend_destroy, /* destroy */
- backend_get_groups, /* get_groups */
- backend_get_filters, /* get_filters */
- backend_get_roles, /* get_roles */
- NULL, /* get_mime_types */
- backend_cancel, /* cancel */
- NULL, /* download_packages */
- backend_get_categories, /* get_categories */
- backend_get_depends, /* get_depends */
- backend_get_details, /* get_details */
- NULL, /* get_distro_upgrades */
- backend_get_files, /* get_files */
- backend_get_packages, /* get_packages */
- backend_get_repo_list, /* get_repo_list */
- backend_get_requires, /* get_requires */
- backend_get_update_detail, /* get_update_detail */
- backend_get_updates, /* get_updates */
- NULL, /* install_files */
- backend_install_packages, /* install_packages */
- NULL, /* install_signature */
- backend_refresh_cache, /* refresh_cache */
- backend_remove_packages, /* remove_packages */
- backend_repo_enable, /* repo_enable */
- NULL, /* repo_set_data */
- backend_resolve, /* resolve */
- NULL, /* rollback */
- backend_search_details, /* search_details */
- backend_search_files, /* search_file */
- backend_search_groups, /* search_group */
- backend_search_names, /* search_name */
- backend_update_packages, /* update_packages */
- backend_update_system, /* update_system */
- NULL, /* what_provides */
- NULL, /* simulate_install_files */
- backend_simulate_install_packages, /* simulate_install_packages */
- backend_simulate_remove_packages, /* simulate_remove_packages */
- backend_simulate_update_packages, /* simulate_update_packages */
- NULL, /* upgrade_system */
- NULL, /* transaction_start */
- NULL /* transaction_stop */
-);
+/**
+ * pk_backend_get_description:
+ */
+gchar *
+pk_backend_get_description (PkBackend *backend)
+{
+ return g_strdup ("Portage");
+}
+/**
+ * pk_backend_get_author:
+ */
+gchar *
+pk_backend_get_author (PkBackend *backend)
+{
+ return g_strdup ("Mounir Lamouri (volkmar) <mounir.lamouri at gmail.com>, Fabio Erculiani <lxnay at sabayon.org>");
+}
commit d6ae281d6d1fe5cffd14c1acf138593652e2ca13
Author: Matthias Klumpp <matthias at nlinux.org>
Date: Mon Sep 5 23:45:52 2011 +0200
qt2: Remove old Find* macro
diff --git a/lib/packagekit-qt2/modules/FindPackageKitQt2.cmake b/lib/packagekit-qt2/modules/FindPackageKitQt2.cmake
deleted file mode 100644
index b918f47..0000000
--- a/lib/packagekit-qt2/modules/FindPackageKitQt2.cmake
+++ /dev/null
@@ -1,40 +0,0 @@
-# - Try to find PackageKitQt2
-# Once done this will define
-#
-# PACKAGEKIT_QT2_FOUND - system has PackageKitQt2
-# PACKAGEKIT_QT2_INCLUDE_DIR - the PackageKitQt2 include directory
-# PACKAGEKIT_QT2_LIB - Link these to use PackageKitQt2
-# PACKAGEKIT_QT2_DEFINITIONS - Compiler switches required for using PackageKitQt2
-
-# Copyright (c) 2008, Adrien Bustany, <madcat at mymadcat.com>
-#
-# Redistribution and use is allowed according to the terms of the GPLv2+ license.
-
-IF (PACKAGEKIT_QT2_INCLUDE_DIR AND PACKAGEKIT_QT2_LIB)
- SET(PACKAGEKIT_QT2_FIND_QUIETLY TRUE)
-ENDIF (PACKAGEKIT_QT2_INCLUDE_DIR AND PACKAGEKIT_QT2_LIB)
-
-FIND_PATH( PACKAGEKIT_QT2_INCLUDE_DIR PackageKit/packagekit-qt2 )
-
-FIND_LIBRARY( PACKAGEKIT_QT2_LIB NAMES packagekit-qt2 )
-
-IF (PACKAGEKIT_QT2_INCLUDE_DIR AND PACKAGEKIT_QT2_LIB)
- SET(PACKAGEKIT_QT2_FOUND TRUE)
-ELSE (PACKAGEKIT_QT2_INCLUDE_DIR AND PACKAGEKIT_QT2_LIB)
- SET(PACKAGEKIT_QT2_FOUND FALSE)
-ENDIF (PACKAGEKIT_QT2_INCLUDE_DIR AND PACKAGEKIT_QT2_LIB)
-
-SET(PACKAGEKIT_QT2_INCLUDE_DIR ${PACKAGEKIT_QT2_INCLUDE_DIR}/PackageKit/packagekit-qt2)
-
-IF (PACKAGEKIT_QT2_FOUND)
- IF (NOT PACKAGEKIT_QT2_FIND_QUIETLY)
- MESSAGE(STATUS "Found PackageKitQt2: ${PACKAGEKIT_QT2_LIB}")
- ENDIF (NOT PACKAGEKIT_QT2_FIND_QUIETLY)
-ELSE (PACKAGEKIT_QT2_FOUND)
- IF (PACKAGEKIT_QT2_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "Could NOT find PackageKitQt2")
- ENDIF (PACKAGEKIT_QT2_FIND_REQUIRED)
-ENDIF (PACKAGEKIT_QT2_FOUND)
-
-MARK_AS_ADVANCED(PACKAGEKIT_QT2_INCLUDE_DIR PACKAGEKIT_QT2_LIB)
-
diff --git a/lib/packagekit-qt2/modules/packagekit-qt2-config.cmake.in b/lib/packagekit-qt2/modules/packagekit-qt2-config.cmake.in
index 7bb01f6..f4e1538 100644
--- a/lib/packagekit-qt2/modules/packagekit-qt2-config.cmake.in
+++ b/lib/packagekit-qt2/modules/packagekit-qt2-config.cmake.in
@@ -4,10 +4,6 @@
# PACKAGEKIT_QT2_INCLUDE_DIR - the PackageKitQt2 include directory
# PACKAGEKIT_QT2_LIBRARIES - Link these to use PackageKitQt2
-# Copyright (c) 2011, Matthias Klumpp <matthias at tenstral.net>
-#
-# Redistribution and use is allowed according to the terms of the GPLv2+ license.
-
SET(prefix "@prefix@")
SET(exec_prefix "@exec_prefix@")
SET(PACKAGEKIT_QT2_LIBRARIES "@libdir@/libpackagekit-qt2.so" CACHE FILEPATH "Libraries for PackageKit-Qt2")
commit afb8ba04431a4750e1b32ef6cf44be7b1a5eb4d1
Author: Matthias Klumpp <matthias at nlinux.org>
Date: Mon Sep 5 23:44:40 2011 +0200
trivial: Fix typo in component-naming doc
diff --git a/docs/provides-component-naming.txt b/docs/provides-component-naming.txt
index b312daa..9501c66 100644
--- a/docs/provides-component-naming.txt
+++ b/docs/provides-component-naming.txt
@@ -40,4 +40,4 @@ PYTHON: A string in the format of "python<version>(module-name)"
or just the name of the Python module.
If the Python-Version is omitted, the backend will
choose the current default Python version.
- Example: "python2(packagekit"
+ Example: "python2(packagekit)"
commit 0349e0501b33eaaf2c139349f5f2c5034906c978
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 5 16:58:01 2011 +0100
trivial: post release version bump
diff --git a/RELEASE b/RELEASE
index ffd1f6f..7c71e6d 100644
--- a/RELEASE
+++ b/RELEASE
@@ -2,10 +2,10 @@ PackageKit Release Notes
1. Write NEWS entries for PackageKit in the same format as usual.
-git shortlog PACKAGEKIT_0_6_16.. | grep -i -v trivial | grep -v Merge > NEWS.new
+git shortlog PACKAGEKIT_0_7_0.. | grep -i -v trivial | grep -v Merge > NEWS.new
--------------------------------------------------------------------------------
-Version 0.7.0
+Version 0.7.1
~~~~~~~~~~~~~
Released: 2011-xx-xx
@@ -30,8 +30,8 @@ tx pull --all
4. Commit changes in PackageKit git:
-git commit -a -m "Release version 0.7.0"
-git tag -s -f -m "Release 0.7.0" PACKAGEKIT_0_7_0
+git commit -a -m "Release version 0.7.1"
+git tag -s -f -m "Release 0.7.1" PACKAGEKIT_0_7_1
<gpg password>
git push --tags
git push
@@ -57,7 +57,7 @@ tx push --source
10. Send an email to packagekit at lists.freedesktop.org
=================================================
-PackageKit 0.7.0 released!
+PackageKit 0.7.1 released!
Tarballs available here: http://www.packagekit.org/releases/
diff --git a/configure.ac b/configure.ac
index e114d0c..7ff9c4a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
m4_define([pk_major_version], [0])
m4_define([pk_minor_version], [7])
-m4_define([pk_micro_version], [0])
+m4_define([pk_micro_version], [1])
m4_define([pk_version],
[pk_major_version.pk_minor_version.pk_micro_version])
commit dd21ff1f1766a7faa81d3f8802b2fa705be20cd7
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 5 16:54:27 2011 +0100
trivial: update the NEWS file, arggggghh
diff --git a/NEWS b/NEWS
index 1148b63..ab94fbd 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,94 @@
+Version 0.7.0
+~~~~~~~~~~~~~
+Released: 2011-09-05
+
+Notes:
+ - This is the first release of the unstable 0.7.x series.
+ - This code removes a lot of deprecated code and compatibility shims
+ compared to the previous branch.
+ - Highlights of this release is the new transaction plugin interface
+ that allows external projects to add modules for interfacing with
+ PackageKit. This allows projects such as Listaller to interface with
+ PackageKit to install self contained software blobs.
+ See http://listaller.tenstral.net/ for more information.
+ - The daemon code is now using GDBus rather than dbus-glib, but the
+ libpackagekit-glib library is still using the latter. It'll be
+ converted hopefully in time for 0.7.1.
+ - It's probably not a good idea to use releases from this branch for
+ stable distros or enterprise products!
+
+Libraries:
+ - glib: Free the PkProgress' package (Garrett Regier)
+ - glib: Remove the foo_from_text() compatibility defines (Richard Hughes)
+ - python: Remove the native python library (Richard Hughes)
+ - qt2: Use cmake package config instead of Find* module (Matthias Klumpp)
+ - qt: Do not dist the moc files (Richard Hughes)
+
+Backends:
+ - aptcc: Fix crash when long description blow char buffer (Daniel Nicoletti)
+ - aptcc: Fix the size by emitting installed and download size (Daniel Nicoletti)
+ - aptcc: Implement provides-library (Matthias Klumpp)
+ - apt: Remove the python apt backend (Richard Hughes)
+ - dummy: Implement SimulateUpdatePackages and SimulateRemovePackages (Richard Hughes)
+ - entropy: properly account package size when "extra" downloads are available (Fabio Erculiani)
+ - razor: Remove the razor backend, upstream razor is dead (Richard Hughes)
+ - yum: Add a document detailing the yum API we're using (Richard Hughes)
+ - yum: Emit Package(Untrusted) for each package that is untrusted in the transaction (Richard Hughes)
+ - yum: Ignore missing obsoleted updates rather than failing the update (Richard Hughes)
+ - yum: Manually convert the results of GetDetails to unicode. Fixes rh#719916 (Richard Hughes)
+ - yum: Parse the new style .discinfo files for F15 (Chris Lumens)
+ - zif: Emit Message(UntrustedPackage) to sometimes skip the trusted authentication (Richard Hughes)
+ - zif: Emit Package(Untrusted) for each package that is untrusted in the transaction (Richard Hughes)
+ - zif: Fix a fatal error when doing 'pkcon repo-list --filter=~devel' (Richard Hughes)
+ - zif: Use the shared version for newest filtering (Richard Hughes)
+ - zypp: do not install locked (taboo) patches (Ladislav Slezak)
+ - zypp: Do not rebuild the pool on every call causing slowness (bnc#679650) (Duncan Mac-Vicar P)
+ - zypp: Just use the iterator instead of so many temps (Duncan Mac-Vicar P)
+
+New Features:
+ - Add an 'auto' string for the --with-default-backend= configure option (Richard Hughes)
+ - Add an example plugin that saves private state (Richard Hughes)
+ - Add an example to contrib to show how to build an out-of-tree plugin (Richard Hughes)
+ - Add an ItemProgress signal designed to eventually replace SubPercentage (Richard Hughes)
+ - Add an untrusted section header when using console applications (Richard Hughes)
+ - Add a PK_PROVIDES_ENUM_LIBRARY entry (Matthias Klumpp)
+ - Add a "Python" type to PkProvidesEnum and document how the provided components should be named (Matthias Klumpp)
+ - Add a transaction plugin infrastructure to packagekitd (Richard Hughes)
+ - Port the browser-plugin from dbus-glib to GDBus (Richard Hughes)
+ - Convert the daemon to use GDBus rather than dbus-glib (Richard Hughes)
+ - Do not do the compatibility method fallbacks anymore (Richard Hughes)
+ - Don't ship all the valid licences as enums anymore (Richard Hughes)
+ - Install a pkgconfig file so external projects can build plugins (Richard Hughes)
+ - Move the check for libraries in use for security updates functionality to a plugin (Richard Hughes)
+ - Move the checking for running processes before update to a plugin (Richard Hughes)
+ - Move the clearing firmware functionality into a plugin (Richard Hughes)
+ - Move the desktop database rescan functionality into a plugin (Richard Hughes)
+ - Move the pre-transaction.d and post-transaction.d functionality into a plugin (Richard Hughes)
+ - Move the update check for running processes into a plugin (Richard Hughes)
+ - Move the updating of the package list into a plugin (Richard Hughes)
+ - Raise the PolicyKit required version to 0.98 and drop the compat code (Richard Hughes)
+ - Remove PkFileMonitor, we can now use GFileMonitor (Richard Hughes)
+ - Remove the deprecated PK_BACKEND_OPTIONS (Richard Hughes)
+ - Remove the GTK+2 pango module and only support GTK+3 (Richard Hughes)
+ - Remove the HAL integration code (Richard Hughes)
+ - Require a new version of automake, and make configure.in sane again (Richard Hughes)
+ - Use g_bus_watch_name() and remove the homegrown EggDbusMonitor (Richard Hughes)
+
+Bugfixes:
+ - Actually use the value from /etc/login.defs (Richard Hughes)
+ - Fix the browser-plugin build with GTK+ < 2.24 (Frederic Crozat)
+ - Port the gstreamer-plugin from dbus-glib to GDBus (Richard Hughes)
+ - gtk-module: Port from dbus-glib to GDBus (Richard Hughes)
+ - Ignore local packages when calculating the simulate list (Richard Hughes)
+ - Ignore untrusted packages when calculating the simulate list (Richard Hughes)
+ - Make percentage, subpercentage and remaining proper GObject properties on the PkBackend object (Richard Hughes)
+ - Make the lsof plugin code support distros such as Fedora with /lib64 (Richard Hughes)
+ - pk-command-not-found: An ellipsis has three dots, not two (Adam Jackson)
+ - Make lsof use the '-n' option to avoid looking up hostnames (Richard Hughes)
+ - Remove cppunit check as packagekit-qt2 does not use it (Daniel Nicoletti)
+ - Remove the duplicate 'The software is not from a trusted source' (Richard Hughes)
+ - Use g_unix_signal_add_full() which has been renamed in GLib (Denis Washington)
+
Version 0.6.16
~~~~~~~~~~~~~~
Released: 2011-07-04
commit 9e1a014f5b8b4ee582bd341302e1be14ebd8ad4b
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 5 16:52:30 2011 +0100
Release version 0.7.0
diff --git a/RELEASE b/RELEASE
index df4f63d..ffd1f6f 100644
--- a/RELEASE
+++ b/RELEASE
@@ -5,8 +5,8 @@ PackageKit Release Notes
git shortlog PACKAGEKIT_0_6_16.. | grep -i -v trivial | grep -v Merge > NEWS.new
--------------------------------------------------------------------------------
-Version 0.6.17
-~~~~~~~~~~~~~~
+Version 0.7.0
+~~~~~~~~~~~~~
Released: 2011-xx-xx
Notes:
@@ -30,8 +30,8 @@ tx pull --all
4. Commit changes in PackageKit git:
-git commit -a -m "Release version 0.6.17"
-git tag -s -f -m "Release 0.6.17" PACKAGEKIT_0_6_17
+git commit -a -m "Release version 0.7.0"
+git tag -s -f -m "Release 0.7.0" PACKAGEKIT_0_7_0
<gpg password>
git push --tags
git push
@@ -57,7 +57,7 @@ tx push --source
10. Send an email to packagekit at lists.freedesktop.org
=================================================
-PackageKit 0.6.17 released!
+PackageKit 0.7.0 released!
Tarballs available here: http://www.packagekit.org/releases/
diff --git a/configure.ac b/configure.ac
index b8f53bf..e114d0c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,7 +45,7 @@ AC_SUBST(PK_VERSION)
# AGE If libpackagekit can be linked into executables which can be
# built with previous versions of this library. Don't use.
LT_CURRENT=14
-LT_REVISION=8
+LT_REVISION=9
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
diff --git a/docs/html/pk-download.html b/docs/html/pk-download.html
index f8951de..d3396aa 100644
--- a/docs/html/pk-download.html
+++ b/docs/html/pk-download.html
@@ -72,6 +72,19 @@ Releases are normally on the first working Monday of each month.
</p>
<table>
<tr><td><b>Version</b></td><td> </td><td><b>Date</b></td></tr>
+<tr><td>0.7.0</td><td></td><td>2011-09-05</td></tr>
+</table>
+<h3>
+ABI Stable Versions:
+</h3>
+<p>
+These are versions where we will not break ABI, API or localisations.
+Releases are less frequent, usually every few months.
+</p>
+<table>
+<tr><td><b>Version</b></td><td> </td><td><b>Date</b></td></tr>
+<tr><td>0.6.18</td><td></td><td>2011-09-05</td></tr>
+<tr><td>0.6.17</td><td></td><td>2011-08-01</td></tr>
<tr><td>0.6.16</td><td></td><td>2011-07-04</td></tr>
<tr><td>0.6.15</td><td></td><td>2011-06-07</td></tr>
<tr><td>0.6.14</td><td></td><td>2011-05-04</td></tr>
@@ -91,11 +104,12 @@ Releases are normally on the first working Monday of each month.
<tr><td>0.6.0</td><td></td><td>2010-01-04</td></tr>
</table>
<h3>
-ABI Stable Versions:
+Obsolete Versions:
</h3>
<p>
-These are versions where we will not break ABI, API or localisations.
-Releases are less frequent, usually every few months.
+These are versions that used to be the ABI stable releases, but are now
+longer supported.
+There will not be any more releases of these versions.
</p>
<table>
<tr><td><b>Version</b></td><td> </td><td><b>Date</b></td></tr>
@@ -107,17 +121,6 @@ Releases are less frequent, usually every few months.
<tr><td>0.5.2</td><td></td><td>2009-09-07</td></tr>
<tr><td>0.5.1</td><td></td><td>2009-08-03</td></tr>
<tr><td>0.5.0</td><td></td><td>2009-07-06</td></tr>
-</table>
-<h3>
-Obsolete Versions:
-</h3>
-<p>
-These are versions that used to be the ABI stable releases, but are now
-longer supported.
-There will not be any more releases of these versions.
-</p>
-<table>
-<tr><td><b>Version</b></td><td> </td><td><b>Date</b></td></tr>
<tr><td>0.4.9</td><td></td><td>2009-08-03</td></tr>
<tr><td>0.4.8</td><td></td><td>2009-06-01</td></tr>
<tr><td>0.4.7</td><td></td><td>2009-05-05</td></tr>
diff --git a/po/ar.po b/po/ar.po
index 929abe4..71d227c 100644
--- a/po/ar.po
+++ b/po/ar.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-04 10:50+0100\n"
-"PO-Revision-Date: 2011-07-04 15:31+0000\n"
+"POT-Creation-Date: 2011-08-01 10:58+0100\n"
+"PO-Revision-Date: 2011-09-05 15:42+0000\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: Arabic (http://www.transifex.net/projects/p/freedesktop/team/ar/)\n"
"MIME-Version: 1.0\n"
@@ -803,66 +803,61 @@ msgstr ""
msgid "Failed to install packages"
msgstr ""
-#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/command-not-found/pk-command-not-found.c:706
-msgid "PackageKit Command Not Found"
-msgstr ""
-
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:729
msgid "command not found"
msgstr ""
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:759
+#: ../contrib/command-not-found/pk-command-not-found.c:747
msgid "Similar command is:"
msgstr ""
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:773
+#: ../contrib/command-not-found/pk-command-not-found.c:761
msgid "Run similar command:"
msgstr ""
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:787
-#: ../contrib/command-not-found/pk-command-not-found.c:796
+#: ../contrib/command-not-found/pk-command-not-found.c:775
+#: ../contrib/command-not-found/pk-command-not-found.c:784
msgid "Similar commands are:"
msgstr ""
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:791
msgid "Please choose a command to run"
msgstr ""
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:821
+#: ../contrib/command-not-found/pk-command-not-found.c:809
msgid "The package providing this file is:"
msgstr ""
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:828
+#: ../contrib/command-not-found/pk-command-not-found.c:816
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:855
+#: ../contrib/command-not-found/pk-command-not-found.c:843
msgid "Packages providing this file are:"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:865
+#: ../contrib/command-not-found/pk-command-not-found.c:853
msgid "Suitable packages are:"
msgstr ""
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:874
+#: ../contrib/command-not-found/pk-command-not-found.c:862
msgid "Please choose a package to install"
msgstr ""
@@ -1787,13 +1782,19 @@ msgstr ""
msgid "The following packages have to be downgraded:"
msgstr ""
+#. TRANSLATORS: When processing, untrusted and non-verified packages may be
+#. encountered
+#: ../lib/packagekit-glib2/pk-task-text.c:325
+msgid "The following packages are untrusted:"
+msgstr ""
+
#. TRANSLATORS: ask the user if the proposed changes are okay
-#: ../lib/packagekit-glib2/pk-task-text.c:380
+#: ../lib/packagekit-glib2/pk-task-text.c:385
msgid "Proceed with changes?"
msgstr ""
#. TRANSLATORS: tell the user we didn't do anything
-#: ../lib/packagekit-glib2/pk-task-text.c:385
+#: ../lib/packagekit-glib2/pk-task-text.c:390
msgid "The transaction did not proceed."
msgstr ""
diff --git a/po/bg_BG.po b/po/bg_BG.po
index d71d77e..51fbde8 100644
--- a/po/bg_BG.po
+++ b/po/bg_BG.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-04 10:50+0100\n"
-"PO-Revision-Date: 2011-07-04 15:31+0000\n"
+"POT-Creation-Date: 2011-08-01 10:58+0100\n"
+"PO-Revision-Date: 2011-09-05 15:41+0000\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: Bulgarian (Bulgaria) (http://www.transifex.net/projects/p/freedesktop/team/bg_BG/)\n"
"MIME-Version: 1.0\n"
@@ -803,66 +803,61 @@ msgstr ""
msgid "Failed to install packages"
msgstr ""
-#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/command-not-found/pk-command-not-found.c:706
-msgid "PackageKit Command Not Found"
-msgstr ""
-
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:729
msgid "command not found"
msgstr ""
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:759
+#: ../contrib/command-not-found/pk-command-not-found.c:747
msgid "Similar command is:"
msgstr ""
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:773
+#: ../contrib/command-not-found/pk-command-not-found.c:761
msgid "Run similar command:"
msgstr ""
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:787
-#: ../contrib/command-not-found/pk-command-not-found.c:796
+#: ../contrib/command-not-found/pk-command-not-found.c:775
+#: ../contrib/command-not-found/pk-command-not-found.c:784
msgid "Similar commands are:"
msgstr ""
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:791
msgid "Please choose a command to run"
msgstr ""
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:821
+#: ../contrib/command-not-found/pk-command-not-found.c:809
msgid "The package providing this file is:"
msgstr ""
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:828
+#: ../contrib/command-not-found/pk-command-not-found.c:816
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:855
+#: ../contrib/command-not-found/pk-command-not-found.c:843
msgid "Packages providing this file are:"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:865
+#: ../contrib/command-not-found/pk-command-not-found.c:853
msgid "Suitable packages are:"
msgstr ""
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:874
+#: ../contrib/command-not-found/pk-command-not-found.c:862
msgid "Please choose a package to install"
msgstr ""
@@ -1787,13 +1782,19 @@ msgstr ""
msgid "The following packages have to be downgraded:"
msgstr ""
+#. TRANSLATORS: When processing, untrusted and non-verified packages may be
+#. encountered
+#: ../lib/packagekit-glib2/pk-task-text.c:325
+msgid "The following packages are untrusted:"
+msgstr ""
+
#. TRANSLATORS: ask the user if the proposed changes are okay
-#: ../lib/packagekit-glib2/pk-task-text.c:380
+#: ../lib/packagekit-glib2/pk-task-text.c:385
msgid "Proceed with changes?"
msgstr ""
#. TRANSLATORS: tell the user we didn't do anything
-#: ../lib/packagekit-glib2/pk-task-text.c:385
+#: ../lib/packagekit-glib2/pk-task-text.c:390
msgid "The transaction did not proceed."
msgstr ""
diff --git a/po/ca at valencia.po b/po/ca at valencia.po
index 93effbd..ee6a0f4 100644
--- a/po/ca at valencia.po
+++ b/po/ca at valencia.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-04 10:50+0100\n"
-"PO-Revision-Date: 2011-07-04 15:31+0000\n"
+"POT-Creation-Date: 2011-08-01 10:58+0100\n"
+"PO-Revision-Date: 2011-09-05 15:42+0000\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: Catalan (Valencian) (http://www.transifex.net/projects/p/freedesktop/team/ca@valencia/)\n"
"MIME-Version: 1.0\n"
@@ -803,66 +803,61 @@ msgstr ""
msgid "Failed to install packages"
msgstr ""
-#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/command-not-found/pk-command-not-found.c:706
-msgid "PackageKit Command Not Found"
-msgstr ""
-
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:729
msgid "command not found"
msgstr ""
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:759
+#: ../contrib/command-not-found/pk-command-not-found.c:747
msgid "Similar command is:"
msgstr ""
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:773
+#: ../contrib/command-not-found/pk-command-not-found.c:761
msgid "Run similar command:"
msgstr ""
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:787
-#: ../contrib/command-not-found/pk-command-not-found.c:796
+#: ../contrib/command-not-found/pk-command-not-found.c:775
+#: ../contrib/command-not-found/pk-command-not-found.c:784
msgid "Similar commands are:"
msgstr ""
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:791
msgid "Please choose a command to run"
msgstr ""
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:821
+#: ../contrib/command-not-found/pk-command-not-found.c:809
msgid "The package providing this file is:"
msgstr ""
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:828
+#: ../contrib/command-not-found/pk-command-not-found.c:816
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:855
+#: ../contrib/command-not-found/pk-command-not-found.c:843
msgid "Packages providing this file are:"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:865
+#: ../contrib/command-not-found/pk-command-not-found.c:853
msgid "Suitable packages are:"
msgstr ""
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:874
+#: ../contrib/command-not-found/pk-command-not-found.c:862
msgid "Please choose a package to install"
msgstr ""
@@ -1787,13 +1782,19 @@ msgstr ""
msgid "The following packages have to be downgraded:"
msgstr ""
+#. TRANSLATORS: When processing, untrusted and non-verified packages may be
+#. encountered
+#: ../lib/packagekit-glib2/pk-task-text.c:325
+msgid "The following packages are untrusted:"
+msgstr ""
+
#. TRANSLATORS: ask the user if the proposed changes are okay
-#: ../lib/packagekit-glib2/pk-task-text.c:380
+#: ../lib/packagekit-glib2/pk-task-text.c:385
msgid "Proceed with changes?"
msgstr ""
#. TRANSLATORS: tell the user we didn't do anything
-#: ../lib/packagekit-glib2/pk-task-text.c:385
+#: ../lib/packagekit-glib2/pk-task-text.c:390
msgid "The transaction did not proceed."
msgstr ""
diff --git a/po/fa_IR.po b/po/fa_IR.po
index ceda718..b834be9 100644
--- a/po/fa_IR.po
+++ b/po/fa_IR.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-04 10:50+0100\n"
-"PO-Revision-Date: 2011-07-04 15:31+0000\n"
+"POT-Creation-Date: 2011-08-01 10:58+0100\n"
+"PO-Revision-Date: 2011-09-05 15:42+0000\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: Persian (Iran) (http://www.transifex.net/projects/p/freedesktop/team/fa_IR/)\n"
"MIME-Version: 1.0\n"
@@ -803,66 +803,61 @@ msgstr ""
msgid "Failed to install packages"
msgstr ""
-#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/command-not-found/pk-command-not-found.c:706
-msgid "PackageKit Command Not Found"
-msgstr ""
-
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:729
msgid "command not found"
msgstr ""
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:759
+#: ../contrib/command-not-found/pk-command-not-found.c:747
msgid "Similar command is:"
msgstr ""
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:773
+#: ../contrib/command-not-found/pk-command-not-found.c:761
msgid "Run similar command:"
msgstr ""
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:787
-#: ../contrib/command-not-found/pk-command-not-found.c:796
+#: ../contrib/command-not-found/pk-command-not-found.c:775
+#: ../contrib/command-not-found/pk-command-not-found.c:784
msgid "Similar commands are:"
msgstr ""
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:791
msgid "Please choose a command to run"
msgstr ""
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:821
+#: ../contrib/command-not-found/pk-command-not-found.c:809
msgid "The package providing this file is:"
msgstr ""
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:828
+#: ../contrib/command-not-found/pk-command-not-found.c:816
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:855
+#: ../contrib/command-not-found/pk-command-not-found.c:843
msgid "Packages providing this file are:"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:865
+#: ../contrib/command-not-found/pk-command-not-found.c:853
msgid "Suitable packages are:"
msgstr ""
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:874
+#: ../contrib/command-not-found/pk-command-not-found.c:862
msgid "Please choose a package to install"
msgstr ""
@@ -1787,13 +1782,19 @@ msgstr ""
msgid "The following packages have to be downgraded:"
msgstr ""
+#. TRANSLATORS: When processing, untrusted and non-verified packages may be
+#. encountered
+#: ../lib/packagekit-glib2/pk-task-text.c:325
+msgid "The following packages are untrusted:"
+msgstr ""
+
#. TRANSLATORS: ask the user if the proposed changes are okay
-#: ../lib/packagekit-glib2/pk-task-text.c:380
+#: ../lib/packagekit-glib2/pk-task-text.c:385
msgid "Proceed with changes?"
msgstr ""
#. TRANSLATORS: tell the user we didn't do anything
-#: ../lib/packagekit-glib2/pk-task-text.c:385
+#: ../lib/packagekit-glib2/pk-task-text.c:390
msgid "The transaction did not proceed."
msgstr ""
diff --git a/po/ga.po b/po/ga.po
index c7bfc29..6be8822 100644
--- a/po/ga.po
+++ b/po/ga.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-04 10:50+0100\n"
-"PO-Revision-Date: 2011-07-04 15:31+0000\n"
+"POT-Creation-Date: 2011-08-01 10:58+0100\n"
+"PO-Revision-Date: 2011-09-05 15:41+0000\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: Irish (http://www.transifex.net/projects/p/freedesktop/team/ga/)\n"
"MIME-Version: 1.0\n"
@@ -803,66 +803,61 @@ msgstr ""
msgid "Failed to install packages"
msgstr ""
-#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/command-not-found/pk-command-not-found.c:706
-msgid "PackageKit Command Not Found"
-msgstr ""
-
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:729
msgid "command not found"
msgstr ""
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:759
+#: ../contrib/command-not-found/pk-command-not-found.c:747
msgid "Similar command is:"
msgstr ""
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:773
+#: ../contrib/command-not-found/pk-command-not-found.c:761
msgid "Run similar command:"
msgstr ""
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:787
-#: ../contrib/command-not-found/pk-command-not-found.c:796
+#: ../contrib/command-not-found/pk-command-not-found.c:775
+#: ../contrib/command-not-found/pk-command-not-found.c:784
msgid "Similar commands are:"
msgstr ""
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:791
msgid "Please choose a command to run"
msgstr ""
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:821
+#: ../contrib/command-not-found/pk-command-not-found.c:809
msgid "The package providing this file is:"
msgstr ""
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:828
+#: ../contrib/command-not-found/pk-command-not-found.c:816
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:855
+#: ../contrib/command-not-found/pk-command-not-found.c:843
msgid "Packages providing this file are:"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:865
+#: ../contrib/command-not-found/pk-command-not-found.c:853
msgid "Suitable packages are:"
msgstr ""
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:874
+#: ../contrib/command-not-found/pk-command-not-found.c:862
msgid "Please choose a package to install"
msgstr ""
@@ -1787,13 +1782,19 @@ msgstr ""
msgid "The following packages have to be downgraded:"
msgstr ""
+#. TRANSLATORS: When processing, untrusted and non-verified packages may be
+#. encountered
+#: ../lib/packagekit-glib2/pk-task-text.c:325
+msgid "The following packages are untrusted:"
+msgstr ""
+
#. TRANSLATORS: ask the user if the proposed changes are okay
-#: ../lib/packagekit-glib2/pk-task-text.c:380
+#: ../lib/packagekit-glib2/pk-task-text.c:385
msgid "Proceed with changes?"
msgstr ""
#. TRANSLATORS: tell the user we didn't do anything
-#: ../lib/packagekit-glib2/pk-task-text.c:385
+#: ../lib/packagekit-glib2/pk-task-text.c:390
msgid "The transaction did not proceed."
msgstr ""
diff --git a/po/gl.po b/po/gl.po
index 3083726..faf6d7f 100644
--- a/po/gl.po
+++ b/po/gl.po
@@ -2,15 +2,16 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
-# mbouzada <mbouzada at gmail.com>, 2011
+# mbouzada <mbouzada at gmail.com>, 2011.
+# Fran Diéguez <frandieguez at ubuntu.com>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-04 10:50+0100\n"
-"PO-Revision-Date: 2011-05-04 09:56+0000\n"
-"Last-Translator: hughsie <richard at hughsie.com>\n"
-"Language-Team: LANGUAGE <LL at li.org>\n"
+"POT-Creation-Date: 2011-08-01 10:58+0100\n"
+"PO-Revision-Date: 2011-09-05 12:45+0000\n"
+"Last-Translator: frandieguez <frandieguez at ubuntu.com>\n"
+"Language-Team: Galician <proxecto at trasno.net>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -445,12 +446,12 @@ msgstr "A idade máxima para a caché de metadatos. Usar -1 para «nunca»."
#. TRANSLATORS: command line argument, --help
#: ../client/pk-console.c:1301
msgid "Show help options."
-msgstr ""
+msgstr "Mostrar as opcións de axuda."
#. TRANSLATORS: we failed to contact the daemon
#: ../client/pk-console.c:1331
msgid "Failed to parse command line"
-msgstr ""
+msgstr "Produciuse un fallo ao analizar a liña de orde"
#. TRANSLATORS: we failed to contact the daemon
#: ../client/pk-console.c:1341
@@ -823,66 +824,61 @@ msgstr "Produciuse un fallo ao iniciar:"
msgid "Failed to install packages"
msgstr "Produciuse un fallo durante a instalación dos paquetes"
-#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/command-not-found/pk-command-not-found.c:706
-msgid "PackageKit Command Not Found"
-msgstr "Non se atopou a orde PackageKit"
-
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:729
msgid "command not found"
msgstr "non se atopou a orde"
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:759
+#: ../contrib/command-not-found/pk-command-not-found.c:747
msgid "Similar command is:"
msgstr "Unha orde similar é:"
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:773
+#: ../contrib/command-not-found/pk-command-not-found.c:761
msgid "Run similar command:"
msgstr "Executar unha orde similar:"
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:787
-#: ../contrib/command-not-found/pk-command-not-found.c:796
+#: ../contrib/command-not-found/pk-command-not-found.c:775
+#: ../contrib/command-not-found/pk-command-not-found.c:784
msgid "Similar commands are:"
msgstr "As ordes similares son:"
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:791
msgid "Please choose a command to run"
msgstr "Elixa unha orde para executar"
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:821
+#: ../contrib/command-not-found/pk-command-not-found.c:809
msgid "The package providing this file is:"
msgstr "O paquete que fornece este ficheiro é:"
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:828
+#: ../contrib/command-not-found/pk-command-not-found.c:816
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr "Instalar o paquete «%s» para fornecer a orde «%s»?"
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:855
+#: ../contrib/command-not-found/pk-command-not-found.c:843
msgid "Packages providing this file are:"
msgstr "Os paquetes que fornecen este ficheiro son:"
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:865
+#: ../contrib/command-not-found/pk-command-not-found.c:853
msgid "Suitable packages are:"
msgstr "Os posÃbeis paquetes son:"
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:874
+#: ../contrib/command-not-found/pk-command-not-found.c:862
msgid "Please choose a package to install"
msgstr "Elixa un paquete para instalar"
@@ -1808,13 +1804,19 @@ msgstr "Teñen de ser reinstalados os seguintes paquetes:"
msgid "The following packages have to be downgraded:"
msgstr "Teñen de ser revertidos os seguintes paquetes:"
+#. TRANSLATORS: When processing, untrusted and non-verified packages may be
+#. encountered
+#: ../lib/packagekit-glib2/pk-task-text.c:325
+msgid "The following packages are untrusted:"
+msgstr "Os seguintes paquetes non son confiábeis:"
+
#. TRANSLATORS: ask the user if the proposed changes are okay
-#: ../lib/packagekit-glib2/pk-task-text.c:380
+#: ../lib/packagekit-glib2/pk-task-text.c:385
msgid "Proceed with changes?"
msgstr "Proceder a facer as modificacións?"
#. TRANSLATORS: tell the user we didn't do anything
-#: ../lib/packagekit-glib2/pk-task-text.c:385
+#: ../lib/packagekit-glib2/pk-task-text.c:390
msgid "The transaction did not proceed."
msgstr "Non foi posÃbel realizar a transacción."
@@ -2094,7 +2096,7 @@ msgstr "Non se pode conectar ao bus do sistema"
#: ../src/pk-main.c:344
msgid "Failed to load any of the specified backends:"
-msgstr ""
+msgstr "Produciuse un fallo ao cargar algún dos backends especificados:"
#. TRANSLATORS: cannot register on system bus, unknown reason -- geeky error
#. follows
diff --git a/po/kk.po b/po/kk.po
index c8a3033..13c3f35 100644
--- a/po/kk.po
+++ b/po/kk.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-04 10:50+0100\n"
-"PO-Revision-Date: 2011-07-04 15:31+0000\n"
+"POT-Creation-Date: 2011-08-01 10:58+0100\n"
+"PO-Revision-Date: 2011-09-05 15:42+0000\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: Kazakh (http://www.transifex.net/projects/p/freedesktop/team/kk/)\n"
"MIME-Version: 1.0\n"
@@ -803,66 +803,61 @@ msgstr ""
msgid "Failed to install packages"
msgstr ""
-#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/command-not-found/pk-command-not-found.c:706
-msgid "PackageKit Command Not Found"
-msgstr ""
-
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:729
msgid "command not found"
msgstr ""
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:759
+#: ../contrib/command-not-found/pk-command-not-found.c:747
msgid "Similar command is:"
msgstr ""
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:773
+#: ../contrib/command-not-found/pk-command-not-found.c:761
msgid "Run similar command:"
msgstr ""
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:787
-#: ../contrib/command-not-found/pk-command-not-found.c:796
+#: ../contrib/command-not-found/pk-command-not-found.c:775
+#: ../contrib/command-not-found/pk-command-not-found.c:784
msgid "Similar commands are:"
msgstr ""
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:791
msgid "Please choose a command to run"
msgstr ""
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:821
+#: ../contrib/command-not-found/pk-command-not-found.c:809
msgid "The package providing this file is:"
msgstr ""
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:828
+#: ../contrib/command-not-found/pk-command-not-found.c:816
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:855
+#: ../contrib/command-not-found/pk-command-not-found.c:843
msgid "Packages providing this file are:"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:865
+#: ../contrib/command-not-found/pk-command-not-found.c:853
msgid "Suitable packages are:"
msgstr ""
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:874
+#: ../contrib/command-not-found/pk-command-not-found.c:862
msgid "Please choose a package to install"
msgstr ""
@@ -1787,13 +1782,19 @@ msgstr ""
msgid "The following packages have to be downgraded:"
msgstr ""
+#. TRANSLATORS: When processing, untrusted and non-verified packages may be
+#. encountered
+#: ../lib/packagekit-glib2/pk-task-text.c:325
+msgid "The following packages are untrusted:"
+msgstr ""
+
#. TRANSLATORS: ask the user if the proposed changes are okay
-#: ../lib/packagekit-glib2/pk-task-text.c:380
+#: ../lib/packagekit-glib2/pk-task-text.c:385
msgid "Proceed with changes?"
msgstr ""
#. TRANSLATORS: tell the user we didn't do anything
-#: ../lib/packagekit-glib2/pk-task-text.c:385
+#: ../lib/packagekit-glib2/pk-task-text.c:390
msgid "The transaction did not proceed."
msgstr ""
diff --git a/po/pa.po b/po/pa.po
index f3eca5e..f496174 100644
--- a/po/pa.po
+++ b/po/pa.po
@@ -2,14 +2,17 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
-# A S Alam <apreet.alam at gmail.com>, 2011
-# Richard Hughes <richard at hughsie.com>, 2011
+# A S Alam <aalam at users.sf.net>, 2009.
+# Amanpreet Singh Alam <aalam at users.sf.net>, 2008, 2009.
+# Jaswinder Singh <jsingh at redhat.com>, 2009.
+# A S Alam <apreet.alam at gmail.com>, 2011.
+# Richard Hughes <richard at hughsie.com>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-04 10:50+0100\n"
-"PO-Revision-Date: 2011-05-19 02:30+0000\n"
+"POT-Creation-Date: 2011-08-01 10:58+0100\n"
+"PO-Revision-Date: 2011-08-18 01:32+0000\n"
"Last-Translator: aalam <apreet.alam at gmail.com>\n"
"Language-Team: Panjabi (Punjabi) (http://www.transifex.net/projects/p/freedesktop/team/pa/)\n"
"MIME-Version: 1.0\n"
@@ -816,66 +819,61 @@ msgstr "à¨à¨²à¨¾à¨à¨£ ਲਠਫà©à¨²à©à¨¹:"
msgid "Failed to install packages"
msgstr "ਪà©à¨à©à¨ à¨à©°à¨¸à¨à¨¾à¨² à¨à¨°à¨¨ ਲਠਫà©à¨²à©à¨¹"
-#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/command-not-found/pk-command-not-found.c:706
-msgid "PackageKit Command Not Found"
-msgstr "ਪà©à¨à©à¨à¨à¨¿à©±à¨ à¨à¨®à¨¾à¨à¨¡ ਨਹà©à¨ ਲੱà¨à©"
-
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:729
msgid "command not found"
msgstr "à¨à¨®à¨¾à¨à¨¡ ਨਹà©à¨ ਲੱà¨à©"
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:759
+#: ../contrib/command-not-found/pk-command-not-found.c:747
msgid "Similar command is:"
msgstr "ਰਲਦ੠à¨à¨®à¨¾à¨à¨¡ ਹà©:"
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:773
+#: ../contrib/command-not-found/pk-command-not-found.c:761
msgid "Run similar command:"
msgstr "ਰਲਦ੠à¨à¨®à¨¾à¨à¨¡ à¨à¨²à¨¾à¨:"
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:787
-#: ../contrib/command-not-found/pk-command-not-found.c:796
+#: ../contrib/command-not-found/pk-command-not-found.c:775
+#: ../contrib/command-not-found/pk-command-not-found.c:784
msgid "Similar commands are:"
msgstr "ਰਲਦà©à¨à¨ à¨à¨®à¨¾à¨à¨¡à¨¾à¨ ਹਨ:"
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:791
msgid "Please choose a command to run"
msgstr "à¨à¨²à¨¾à¨à¨£ ਲਠà¨à¨®à¨¾à¨à¨¡ ਦ੠à¨à©à¨£ à¨à¨°à© à¨à©"
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:821
+#: ../contrib/command-not-found/pk-command-not-found.c:809
msgid "The package providing this file is:"
msgstr "ਪà©à¨à©à¨ à¨à¨¹ ਫਾà¨à¨² ਦਿੰਦਾ ਹà©:"
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:828
+#: ../contrib/command-not-found/pk-command-not-found.c:816
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr "à¨à¨®à¨¾à¨à¨¡ '%2$s' ਦà©à¨£ ਲਠਪà©à¨à©à¨ '%1$s' à¨à©°à¨¸à¨à¨¾à¨² à¨à¨°à¨¨à¨¾ ਹà©?"
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:855
+#: ../contrib/command-not-found/pk-command-not-found.c:843
msgid "Packages providing this file are:"
msgstr "ਪà©à¨à©à¨ à¨à¨¹ ਫਾà¨à¨² ਦਿੰਦਾ ਹà©:"
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:865
+#: ../contrib/command-not-found/pk-command-not-found.c:853
msgid "Suitable packages are:"
msgstr "ਢà©à©±à¨à¨µà©à¨ ਪà©à¨à©à¨ ਹਨ:"
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:874
+#: ../contrib/command-not-found/pk-command-not-found.c:862
msgid "Please choose a package to install"
msgstr "à¨à©°à¨¸à¨à¨¾à¨² à¨à¨°à¨¨ ਲਠਪà©à¨à©à¨ à¨à©à¨£à© à¨à©"
@@ -1801,13 +1799,19 @@ msgstr "à¨
ੱà¨à© ਦਿੱਤ੠ਪà©à¨à©à¨à¨¾à¨ ਨà©à©° ਮà©à©-
msgid "The following packages have to be downgraded:"
msgstr "à¨
ੱà¨à© ਦਿੱਤ੠ਪà©à¨à©à¨à¨¾à¨ ਨà©à©° ਡਾà¨à¨¨à¨à¨°à©à¨¡ à¨à©à¨¤à¨¾ à¨à¨¾à¨µà©à¨à¨¾:"
+#. TRANSLATORS: When processing, untrusted and non-verified packages may be
+#. encountered
+#: ../lib/packagekit-glib2/pk-task-text.c:325
+msgid "The following packages are untrusted:"
+msgstr "à¨
ੱà¨à© ਦਿੱਤ੠ਪà©à¨à©à¨ à¨à¨°à©à¨¸à©à¨¯à©à¨ ਨਹà©à¨ ਹਨ:"
+
#. TRANSLATORS: ask the user if the proposed changes are okay
-#: ../lib/packagekit-glib2/pk-task-text.c:380
+#: ../lib/packagekit-glib2/pk-task-text.c:385
msgid "Proceed with changes?"
msgstr "ਬਦਲਾà¨
à¨à¨¾à¨°à© ਰੱà¨à¨£à© ਹਨ?"
#. TRANSLATORS: tell the user we didn't do anything
-#: ../lib/packagekit-glib2/pk-task-text.c:385
+#: ../lib/packagekit-glib2/pk-task-text.c:390
msgid "The transaction did not proceed."
msgstr "à¨à¨°à¨¾à¨à¨¸à©à¨à¨¸à¨¼à¨¨ ਪà©à¨°à© ਨਹà©à¨ à¨à©à¨¤à© à¨à¨¾ ਸà¨à©à¥¤"
diff --git a/po/wa.po b/po/wa.po
index e8a09cd..8837d33 100644
--- a/po/wa.po
+++ b/po/wa.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-04 10:50+0100\n"
-"PO-Revision-Date: 2011-07-04 15:31+0000\n"
+"POT-Creation-Date: 2011-08-01 10:58+0100\n"
+"PO-Revision-Date: 2011-09-05 15:41+0000\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: Walloon (http://www.transifex.net/projects/p/freedesktop/team/wa/)\n"
"MIME-Version: 1.0\n"
@@ -803,66 +803,61 @@ msgstr ""
msgid "Failed to install packages"
msgstr ""
-#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/command-not-found/pk-command-not-found.c:706
-msgid "PackageKit Command Not Found"
-msgstr ""
-
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:729
msgid "command not found"
msgstr ""
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:759
+#: ../contrib/command-not-found/pk-command-not-found.c:747
msgid "Similar command is:"
msgstr ""
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:773
+#: ../contrib/command-not-found/pk-command-not-found.c:761
msgid "Run similar command:"
msgstr ""
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:787
-#: ../contrib/command-not-found/pk-command-not-found.c:796
+#: ../contrib/command-not-found/pk-command-not-found.c:775
+#: ../contrib/command-not-found/pk-command-not-found.c:784
msgid "Similar commands are:"
msgstr ""
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:791
msgid "Please choose a command to run"
msgstr ""
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:821
+#: ../contrib/command-not-found/pk-command-not-found.c:809
msgid "The package providing this file is:"
msgstr ""
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:828
+#: ../contrib/command-not-found/pk-command-not-found.c:816
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:855
+#: ../contrib/command-not-found/pk-command-not-found.c:843
msgid "Packages providing this file are:"
msgstr ""
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:865
+#: ../contrib/command-not-found/pk-command-not-found.c:853
msgid "Suitable packages are:"
msgstr ""
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:874
+#: ../contrib/command-not-found/pk-command-not-found.c:862
msgid "Please choose a package to install"
msgstr ""
@@ -1787,13 +1782,19 @@ msgstr ""
msgid "The following packages have to be downgraded:"
msgstr ""
+#. TRANSLATORS: When processing, untrusted and non-verified packages may be
+#. encountered
+#: ../lib/packagekit-glib2/pk-task-text.c:325
+msgid "The following packages are untrusted:"
+msgstr ""
+
#. TRANSLATORS: ask the user if the proposed changes are okay
-#: ../lib/packagekit-glib2/pk-task-text.c:380
+#: ../lib/packagekit-glib2/pk-task-text.c:385
msgid "Proceed with changes?"
msgstr ""
#. TRANSLATORS: tell the user we didn't do anything
-#: ../lib/packagekit-glib2/pk-task-text.c:385
+#: ../lib/packagekit-glib2/pk-task-text.c:390
msgid "The transaction did not proceed."
msgstr ""
diff --git a/po/zh_TW.po b/po/zh_TW.po
index 5ab2290..c031d5b 100644
--- a/po/zh_TW.po
+++ b/po/zh_TW.po
@@ -2,15 +2,16 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
-# Cheng-Chia Tseng <pswo10680 at gmail.com>, 2011
-# Richard Hughes <richard at hughsie.com>, 2011
+# Terry Chuang <tchuang at redhat.com>, 2008, 2009.
+# Cheng-Chia Tseng <pswo10680 at gmail.com>, 2011.
+# Richard Hughes <richard at hughsie.com>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-05-04 10:50+0100\n"
-"PO-Revision-Date: 2011-05-04 09:56+0000\n"
-"Last-Translator: hughsie <richard at hughsie.com>\n"
+"POT-Creation-Date: 2011-08-01 10:58+0100\n"
+"PO-Revision-Date: 2011-08-29 07:54+0000\n"
+"Last-Translator: zerng07 <pswo10680 at gmail.com>\n"
"Language-Team: Chinese (Taiwan) (http://www.transifex.net/projects/p/freedesktop/team/zh_TW/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -377,7 +378,7 @@ msgstr "å¹å¾ç¨å¼æå£äº mid-transactionï¼"
#. TRANSLATORS: This is the header to the --help menu
#: ../client/pk-console.c:1153
msgid "PackageKit Console Interface"
-msgstr "PackageKit 主æ§å°ä»é¢"
+msgstr "PackageKit 主æ§èºä»é¢"
#. these are commands we can use with pkcon
#: ../client/pk-console.c:1155
@@ -436,12 +437,12 @@ msgstr "æ大çä¸ä»è³æå¿«åæéãä½¿ç¨ -1 代表ãæ°¸é ãã"
#. TRANSLATORS: command line argument, --help
#: ../client/pk-console.c:1301
msgid "Show help options."
-msgstr ""
+msgstr "顯示幫å©é¸é
ã"
#. TRANSLATORS: we failed to contact the daemon
#: ../client/pk-console.c:1331
msgid "Failed to parse command line"
-msgstr ""
+msgstr "ç¡æ³è§£ææ令å"
#. TRANSLATORS: we failed to contact the daemon
#: ../client/pk-console.c:1341
@@ -805,66 +806,61 @@ msgstr "åå失æï¼"
msgid "Failed to install packages"
msgstr "å®è£å¥ä»¶å¤±æ"
-#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/command-not-found/pk-command-not-found.c:706
-msgid "PackageKit Command Not Found"
-msgstr "æ¾ä¸å° PackageKit æ令"
-
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:729
msgid "command not found"
msgstr "æ¾ä¸å°æ令"
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:759
+#: ../contrib/command-not-found/pk-command-not-found.c:747
msgid "Similar command is:"
msgstr "ç¸ä¼¼æ令çºï¼"
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:773
+#: ../contrib/command-not-found/pk-command-not-found.c:761
msgid "Run similar command:"
msgstr "å·è¡ç¸ä¼¼æ令ï¼"
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:787
-#: ../contrib/command-not-found/pk-command-not-found.c:796
+#: ../contrib/command-not-found/pk-command-not-found.c:775
+#: ../contrib/command-not-found/pk-command-not-found.c:784
msgid "Similar commands are:"
msgstr "ç¸ä¼¼æ令æï¼"
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:791
msgid "Please choose a command to run"
msgstr "è«é¸æä¸é
æ令ä¾å·è¡"
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:821
+#: ../contrib/command-not-found/pk-command-not-found.c:809
msgid "The package providing this file is:"
msgstr "æä¾æ¤æªæ¡çå¥ä»¶çºï¼"
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:828
+#: ../contrib/command-not-found/pk-command-not-found.c:816
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr "æ¯å¦è¦å®è£ã%sãå¥ä»¶ä»¥æä¾ã%sãæ令ï¼"
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:855
+#: ../contrib/command-not-found/pk-command-not-found.c:843
msgid "Packages providing this file are:"
msgstr "æä¾æ¤æªæ¡çå¥ä»¶æï¼"
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:865
+#: ../contrib/command-not-found/pk-command-not-found.c:853
msgid "Suitable packages are:"
msgstr "åé©çå¥ä»¶æï¼"
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:874
+#: ../contrib/command-not-found/pk-command-not-found.c:862
msgid "Please choose a package to install"
msgstr "è«é¸æ欲å®è£çå¥ä»¶"
@@ -1404,7 +1400,7 @@ msgstr "å®å
¨æ§"
#. TRANSLATORS: The type of update
#: ../lib/packagekit-glib2/pk-console-shared.c:442
msgid "Bug fix "
-msgstr "é¯èª¤ä¿®æ£"
+msgstr "èè²ä¿®æ£"
#. TRANSLATORS: The type of update
#: ../lib/packagekit-glib2/pk-console-shared.c:446
@@ -1789,13 +1785,19 @@ msgstr "ä¸åå¥ä»¶è¦è¢«éæ°å®è£ï¼"
msgid "The following packages have to be downgraded:"
msgstr "ä¸åå¥ä»¶è¦è¢«éç´ï¼"
+#. TRANSLATORS: When processing, untrusted and non-verified packages may be
+#. encountered
+#: ../lib/packagekit-glib2/pk-task-text.c:325
+msgid "The following packages are untrusted:"
+msgstr "ä¸åå¥ä»¶æªåä¿¡ä»»ï¼"
+
#. TRANSLATORS: ask the user if the proposed changes are okay
-#: ../lib/packagekit-glib2/pk-task-text.c:380
+#: ../lib/packagekit-glib2/pk-task-text.c:385
msgid "Proceed with changes?"
msgstr "è¦èçè®æ´åï¼"
#. TRANSLATORS: tell the user we didn't do anything
-#: ../lib/packagekit-glib2/pk-task-text.c:385
+#: ../lib/packagekit-glib2/pk-task-text.c:390
msgid "The transaction did not proceed."
msgstr "該èçäºé
æ²æå·è¡ã"
@@ -2063,7 +2065,7 @@ msgstr "ç¡æ³é£æ¥è³ç³»çµ±å¯æµ"
#: ../src/pk-main.c:344
msgid "Failed to load any of the specified backends:"
-msgstr ""
+msgstr "ç¡æ³è¼å
¥ä»»ä¸åæå®çå¾ç«¯ç¨å¼ï¼"
#. TRANSLATORS: cannot register on system bus, unknown reason -- geeky error
#. follows
commit 06fbfb3c01417019c1739e209120c76426ecea14
Author: Frederic Crozat <fcrozat at suse.com>
Date: Fri Sep 2 13:00:57 2011 +0200
browser-plugin: Fix build with GTK+ < 2.24
diff --git a/contrib/browser-plugin/pk-main.c b/contrib/browser-plugin/pk-main.c
index d22366b..5e67112 100644
--- a/contrib/browser-plugin/pk-main.c
+++ b/contrib/browser-plugin/pk-main.c
@@ -179,7 +179,11 @@ pk_main_create_window (PkPlugin *plugin)
}
/* get parent */
+#if GTK_CHECK_VERSION(2,24,0)
parent = gdk_x11_window_foreign_new_for_display (display, xwindow);
+#else
+ parent = gdk_window_foreign_new (xwindow);
+#endif
if (parent == NULL) {
g_debug ("invalid window given for setup (id %lu)\n", xwindow);
return;
commit 81d91f4217b7ca561fe1b3f89b7523ac324574c6
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Sep 1 10:54:28 2011 +0100
trivial: add a description for POSTSCRIPT_DRIVER to the docs
diff --git a/docs/provides-component-naming.txt b/docs/provides-component-naming.txt
index 37cc273..b312daa 100644
--- a/docs/provides-component-naming.txt
+++ b/docs/provides-component-naming.txt
@@ -12,24 +12,32 @@ In general, the component naming should be "type(component-name)".
Component naming
----------------
-MODALIAS: /!\ Format nor defined (yet)
+MODALIAS: /!\ Format nor defined (yet)
CODEC:
-MIMETYPE: Mimetypes are (valid) mimetypes strings,
- for example "application/x-catalog" or "text/plain".
+MIMETYPE: Mimetypes are (valid) mimetypes strings,
+ for example "application/x-catalog" or "text/plain".
-FONT: A font name, e.g. "Cantarell".
+FONT: A font name, e.g. "Cantarell".
HARDWARE_DRIVER:
POSTSCRIPT_DRIVER:
-
-PLASMA_SERVICE: Name of a Plasma service.
-
-SHARED_LIB: Name of a shared library, e.g. "libpackagekit-glib2.so.14".
-
-PYTHON: A string in the format of "python<version>(module-name)",
- e.g. "python2(packagekit)" or just the name of the Python module.
- If the Python-Version is omitted, the backend will choose the current
- default Python version.
+ A string in the format of "postscriptdriver(mfg;mdl;)"
+ where mfg and mdl are the corresponding
+ IEEE 1284 Device ID keys for the printer model,
+ converted to lower-case and with spaces converted
+ to underscores.
+ Example: "postscriptdriver(epson;stylus_d92;)"
+
+PLASMA_SERVICE: Name of a Plasma service.
+
+SHARED_LIB: Name of a shared library
+ Example: "libpackagekit-glib2.so.14"
+
+PYTHON: A string in the format of "python<version>(module-name)",
+ or just the name of the Python module.
+ If the Python-Version is omitted, the backend will
+ choose the current default Python version.
+ Example: "python2(packagekit"
commit 8b3573d08851b8607e8ffd84c379127a27caa64b
Author: Denis Washington <denisw at online.de>
Date: Wed Aug 31 22:41:20 2011 +0100
Use g_unix_signal_add_full() which has been renamed in the unstable GLib branch
Signed-off-by: Richard Hughes <richard at hughsie.com>
diff --git a/src/pk-main.c b/src/pk-main.c
index 4b1ecb5..96b06b5 100644
--- a/src/pk-main.c
+++ b/src/pk-main.c
@@ -31,7 +31,7 @@
#include <glib/gi18n.h>
#include <packagekit-glib2/pk-debug.h>
-#if GLIB_CHECK_VERSION(2,29,4)
+#if GLIB_CHECK_VERSION(2,29,19)
#include <glib-unix.h>
#endif
@@ -86,7 +86,7 @@ pk_main_quit_cb (PkEngine *engine, GMainLoop *mainloop)
g_main_loop_quit (mainloop);
}
-#if GLIB_CHECK_VERSION(2,29,4)
+#if GLIB_CHECK_VERSION(2,29,19)
/**
* pk_main_sigint_cb:
@@ -185,13 +185,13 @@ main (int argc, char *argv[])
goto exit_program;
}
-#if GLIB_CHECK_VERSION(2,29,4)
+#if GLIB_CHECK_VERSION(2,29,19)
/* do stuff on ctrl-c */
- g_unix_signal_add_watch_full (SIGINT,
- G_PRIORITY_DEFAULT,
- pk_main_sigint_cb,
- loop,
- NULL);
+ g_unix_signal_add_full (G_PRIORITY_DEFAULT,
+ SIGINT,
+ pk_main_sigint_cb,
+ loop,
+ NULL);
#else
signal (SIGINT, pk_main_sigint_handler);
#endif
commit 8bd17abce4b742e52447d1b6f7f873b8262a97fd
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Aug 31 16:52:28 2011 +0100
trivial: fix up the Fedora spec file now we install the cmake files in the right place
diff --git a/contrib/PackageKit.spec.in b/contrib/PackageKit.spec.in
index 154899a..4072f6e 100644
--- a/contrib/PackageKit.spec.in
+++ b/contrib/PackageKit.spec.in
@@ -444,7 +444,7 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
# qt2 new library
%{_includedir}/PackageKit/packagekit-qt2/*
%{_libdir}/pkgconfig/packagekit-qt2.pc
-%{_datadir}/cmake/Modules/FindPackageKitQt2.cmake
+%{_libdir}/cmake/packagekit-qt2/packagekit-qt2*.cmake
%files backend-devel
%defattr(-,root,root,-)
commit 8e5ccae41cbae39f886f0ffef18972d26ff918e9
Author: Matthias Klumpp <matthias at nlinux.org>
Date: Fri Aug 26 21:24:35 2011 +0200
trivial: Add missing files from last commit
Sorry, I forgot to add these files in my last commit...
diff --git a/lib/packagekit-qt2/modules/packagekit-qt2-config-version.cmake.in b/lib/packagekit-qt2/modules/packagekit-qt2-config-version.cmake.in
new file mode 100644
index 0000000..78200a1
--- /dev/null
+++ b/lib/packagekit-qt2/modules/packagekit-qt2-config-version.cmake.in
@@ -0,0 +1,12 @@
+SET(PACKAGE_VERSION @VERSION@)
+IF (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
+ SET(PACKAGE_VERSION_EXACT "true")
+ENDIF (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
+IF (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
+ SET(PACKAGE_VERSION_COMPATIBLE "true")
+ELSE (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
+ SET(PACKAGE_VERSION_UNSUITABLE "true")
+ENDIF (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
+IF (PACKAGE_VERSION_UNSUITABLE)
+ MESSAGE("VERSION CHECK FAILED FOR ${PACKAGE_FIND_NAME}. WANTED ${PACKAGE_FIND_VERSION}, HAVE ${PACKAGE_VERSION}")
+ENDIF(PACKAGE_VERSION_UNSUITABLE)
diff --git a/lib/packagekit-qt2/modules/packagekit-qt2-config.cmake.in b/lib/packagekit-qt2/modules/packagekit-qt2-config.cmake.in
new file mode 100644
index 0000000..7bb01f6
--- /dev/null
+++ b/lib/packagekit-qt2/modules/packagekit-qt2-config.cmake.in
@@ -0,0 +1,15 @@
+# - Config information for PackageKit-Qt2
+# This file defines:
+#
+# PACKAGEKIT_QT2_INCLUDE_DIR - the PackageKitQt2 include directory
+# PACKAGEKIT_QT2_LIBRARIES - Link these to use PackageKitQt2
+
+# Copyright (c) 2011, Matthias Klumpp <matthias at tenstral.net>
+#
+# Redistribution and use is allowed according to the terms of the GPLv2+ license.
+
+SET(prefix "@prefix@")
+SET(exec_prefix "@exec_prefix@")
+SET(PACKAGEKIT_QT2_LIBRARIES "@libdir@/libpackagekit-qt2.so" CACHE FILEPATH "Libraries for PackageKit-Qt2")
+SET(PACKAGEKIT_QT2_INCLUDE_DIR "@includedir@/PackageKit/packagekit-qt2" CACHE PATH "Include path for PackageKit-Qt2")
+SET(PACKAGEKIT_QT2_FOUND "TRUE")
commit 95ff042d5d45478d8faf929cd94cc261c554b1d3
Author: Matthias Klumpp <matthias at nlinux.org>
Date: Fri Aug 26 16:38:27 2011 +0200
qt2: Use cmake package config instead of Find* module
CMake package config is the preferred way for 3rd-party
packages to install package config.
diff --git a/configure.ac b/configure.ac
index 5feaadc..b8f53bf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -646,7 +646,7 @@ if test x$enable_aptcc = xyes; then
AC_MSG_RESULT([yes]),
AC_MSG_FAILURE([need libapt-pkg 0.7 or later]))
- AC_MSG_CHECKING([whether apt supports ddtp])
+ AC_MSG_CHECKING([whether apt supports ddtp])
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <apt-pkg/pkgcache.h>]],
[[pkgCache::DescIterator d;]]),
@@ -775,6 +775,8 @@ lib/packagekit-qt/test/Makefile
lib/packagekit-qt/packagekit-qt.pc
lib/packagekit-qt2/Makefile
lib/packagekit-qt2/modules/Makefile
+lib/packagekit-qt2/modules/packagekit-qt2-config.cmake
+lib/packagekit-qt2/modules/packagekit-qt2-config-version.cmake
lib/packagekit-qt2/packagekit-qt2.pc
lib/python/Makefile
lib/python/packagekit/Makefile
diff --git a/lib/packagekit-qt2/modules/Makefile.am b/lib/packagekit-qt2/modules/Makefile.am
index 4a74f32..655474d 100644
--- a/lib/packagekit-qt2/modules/Makefile.am
+++ b/lib/packagekit-qt2/modules/Makefile.am
@@ -1,9 +1,12 @@
-cmakemoduledir = $(datadir)/cmake/Modules
-cmakemodule_DATA = \
- FindPackageKitQt2.cmake \
+cmakemoduledir = $(libdir)/cmake/packagekit-qt2
+
+cmakemodule_DATA = \
+ packagekit-qt2-config.cmake \
+ packagekit-qt2-config-version.cmake \
$(NULL)
-EXTRA_DIST = \
- $(cmakemodule_DATA)
+EXTRA_DIST = \
+ ${cmakemodule_DATA} \
+ ${NULL}
-include $(top_srcdir)/git.mk
commit faf345a90d27e1481daf51167cc3c28c5806abca
Author: Matthias Klumpp <matthias at nlinux.org>
Date: Thu Aug 25 22:27:24 2011 +0200
Add a "Python" type to PkProvidesEnum and document how the
provided components should be named.
Also renamed the "LIBRARY" type to "SHARED_LIB", as we don't
search for all libraries but only for shared libs.
(This change is possible because there hasn't been a PK release
with this change yet, so this doesn't break existing API)
The component naming shemes are documented in
docs/provides-component-naming.txt. This file is still incomplete
and needs to be extended.
Also, I'm not really happy with it's content (yet).
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index dc35c6a..f30601a 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -525,7 +525,7 @@ backend_what_provides_thread (PkBackend *backend)
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
// We can handle libraries, mimetypes and codecs
- if (provides == PK_PROVIDES_ENUM_LIBRARY ||
+ if (provides == PK_PROVIDES_ENUM_SHARED_LIB ||
provides == PK_PROVIDES_ENUM_MIMETYPE ||
provides == PK_PROVIDES_ENUM_CODEC ||
provides == PK_PROVIDES_ENUM_ANY) {
@@ -543,7 +543,7 @@ backend_what_provides_thread (PkBackend *backend)
vector<string> packages;
vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > output;
- if (provides == PK_PROVIDES_ENUM_LIBRARY) {
+ if (provides == PK_PROVIDES_ENUM_SHARED_LIB) {
m_apt->providesLibrary (output, values);
} else if (provides == PK_PROVIDES_ENUM_MIMETYPE) {
packages = searchMimeType (backend, values, error, _cancel);
diff --git a/docs/provides-component-naming.txt b/docs/provides-component-naming.txt
new file mode 100644
index 0000000..37cc273
--- /dev/null
+++ b/docs/provides-component-naming.txt
@@ -0,0 +1,35 @@
+Package component provides naming
+=================================
+This document describes how the "provides"-strings for packages should
+be formatted for the given PK_PROVIDES types.
+This is needed to ensure cross-distro compatibility on package provides
+naming (the naming of components packages provide), which is used for
+example in pk_client_what_provides_async().
+Valid types of provided components are defined in PkProvidesEnum.
+
+In general, the component naming should be "type(component-name)".
+
+Component naming
+----------------
+
+MODALIAS: /!\ Format nor defined (yet)
+
+CODEC:
+
+MIMETYPE: Mimetypes are (valid) mimetypes strings,
+ for example "application/x-catalog" or "text/plain".
+
+FONT: A font name, e.g. "Cantarell".
+
+HARDWARE_DRIVER:
+
+POSTSCRIPT_DRIVER:
+
+PLASMA_SERVICE: Name of a Plasma service.
+
+SHARED_LIB: Name of a shared library, e.g. "libpackagekit-glib2.so.14".
+
+PYTHON: A string in the format of "python<version>(module-name)",
+ e.g. "python2(packagekit)" or just the name of the Python module.
+ If the Python-Version is omitted, the backend will choose the current
+ default Python version.
diff --git a/lib/packagekit-glib2/pk-enum.c b/lib/packagekit-glib2/pk-enum.c
index 9c7aec4..705a815 100644
--- a/lib/packagekit-glib2/pk-enum.c
+++ b/lib/packagekit-glib2/pk-enum.c
@@ -360,7 +360,8 @@ static const PkEnumMatch enum_provides[] = {
{PK_PROVIDES_ENUM_FONT, "font"},
{PK_PROVIDES_ENUM_POSTSCRIPT_DRIVER, "postscript-driver"},
{PK_PROVIDES_ENUM_PLASMA_SERVICE, "plasma-service"},
- {PK_PROVIDES_ENUM_LIBRARY, "library"},
+ {PK_PROVIDES_ENUM_SHARED_LIB, "shared-library"},
+ {PK_PROVIDES_ENUM_PYTHON, "python-module"},
{0, NULL}
};
diff --git a/lib/packagekit-glib2/pk-enum.h b/lib/packagekit-glib2/pk-enum.h
index df337b6..ea3a26c 100644
--- a/lib/packagekit-glib2/pk-enum.h
+++ b/lib/packagekit-glib2/pk-enum.h
@@ -451,7 +451,7 @@ typedef enum {
/**
* PkProvidesEnum:
*
- * The signature type type
+ * Some component types packages can provide
**/
typedef enum {
PK_PROVIDES_ENUM_UNKNOWN,
@@ -463,7 +463,8 @@ typedef enum {
PK_PROVIDES_ENUM_HARDWARE_DRIVER,
PK_PROVIDES_ENUM_POSTSCRIPT_DRIVER,
PK_PROVIDES_ENUM_PLASMA_SERVICE,
- PK_PROVIDES_ENUM_LIBRARY,
+ PK_PROVIDES_ENUM_SHARED_LIB,
+ PK_PROVIDES_ENUM_PYTHON,
PK_PROVIDES_ENUM_LAST
} PkProvidesEnum;
commit 04b2660b48216eff77eb9815590f12af0a04d360
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Wed Aug 24 14:30:07 2011 -0300
aptcc: Fix crash when long description blow char buffer, remove some mem leaks too
diff --git a/backends/aptcc/apt-utils.cpp b/backends/aptcc/apt-utils.cpp
index 8005b58..546b75a 100644
--- a/backends/aptcc/apt-utils.cpp
+++ b/backends/aptcc/apt-utils.cpp
@@ -26,10 +26,7 @@
#include <fstream>
#include <sys/stat.h>
-static int descrBufferSize = 4096;
-static char *descrBuffer = new char[descrBufferSize];
-
-static char *debParser(string descr);
+static string debParser(string descr);
string get_default_short_description(const pkgCache::VerIterator &ver,
pkgRecords *records)
@@ -113,7 +110,7 @@ string get_default_long_description(const pkgCache::VerIterator &ver,
}
}
-static char *debParser(string descr)
+static string debParser(string descr)
{
// Policy page on package descriptions
// http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description
@@ -158,8 +155,8 @@ static char *debParser(string descr)
removedFullStop = false;
nlpos++;
}
- strcpy(descrBuffer, descr.c_str());
- return descrBuffer;
+
+ return descr;
}
PkGroupEnum
diff --git a/backends/aptcc/apt.cpp b/backends/aptcc/apt.cpp
index a4d0e3d..57cd607 100644
--- a/backends/aptcc/apt.cpp
+++ b/backends/aptcc/apt.cpp
@@ -352,6 +352,7 @@ void aptcc::emit_package(const pkgCache::PkgIterator &pkg,
state,
package_id,
get_short_description(ver, packageRecords).c_str());
+ g_free(package_id);
}
void aptcc::emit_packages(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > &output,
@@ -567,6 +568,7 @@ void aptcc::emit_details(const pkgCache::PkgIterator &pkg, const pkgCache::VerIt
ver.VerStr(),
ver.Arch(),
vf.File().Archive() == NULL ? "" : vf.File().Archive());
+
pk_backend_details(m_backend,
package_id,
"unknown",
@@ -574,6 +576,8 @@ void aptcc::emit_details(const pkgCache::PkgIterator &pkg, const pkgCache::VerIt
get_long_description_parsed(ver, packageRecords).c_str(),
rec.Homepage().c_str(),
size);
+
+ g_free(package_id);
}
// used to emit packages it collects all the needed info
@@ -776,9 +780,9 @@ void aptcc::emit_update_detail(const pkgCache::PkgIterator &pkg, const pkgCache:
string archive = vf.File().Archive() == NULL ? "" : vf.File().Archive();
gchar *package_id;
package_id = pk_package_id_build(pkg.Name(),
- candver.VerStr(),
- candver.Arch(),
- archive.c_str());
+ candver.VerStr(),
+ candver.Arch(),
+ archive.c_str());
PkUpdateStateEnum updateState = PK_UPDATE_STATE_ENUM_UNKNOWN;
if (archive.compare("stable") == 0) {
@@ -813,6 +817,8 @@ void aptcc::emit_update_detail(const pkgCache::PkgIterator &pkg, const pkgCache:
issued.c_str(), //const gchar *issued_text
updated.c_str() //const gchar *updated_text
);
+ g_free(current_package_id);
+ g_free(package_id);
}
void aptcc::get_depends(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > &output,
commit fa92a0897e210afae64326578f6e54859585c0bf
Author: Daniel Nicoletti <dantti85-pk at yahoo.com.br>
Date: Tue Aug 23 12:16:49 2011 -0300
aptcc: Fix the size of the packages by emitting installedSize when installed and download size when available.
diff --git a/backends/aptcc/apt.cpp b/backends/aptcc/apt.cpp
index 03dd9c8..a4d0e3d 100644
--- a/backends/aptcc/apt.cpp
+++ b/backends/aptcc/apt.cpp
@@ -539,33 +539,41 @@ void aptcc::providesLibrary(vector<pair<pkgCache::PkgIterator, pkgCache::VerIter
// used to emit packages it collects all the needed info
void aptcc::emit_details(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &version)
{
- pkgCache::VerIterator ver;
+ pkgCache::VerIterator ver;
if (version.end() == false) {
ver = version;
} else {
ver = find_ver(pkg);
}
- std::string section = ver.Section() == NULL ? "" : ver.Section();
+ std::string section = ver.Section() == NULL ? "" : ver.Section();
- size_t found;
- found = section.find_last_of("/");
- section = section.substr(found + 1);
+ size_t found;
+ found = section.find_last_of("/");
+ section = section.substr(found + 1);
- pkgCache::VerFileIterator vf = ver.FileList();
- pkgRecords::Parser &rec = packageRecords->Lookup(vf);
+ pkgCache::VerFileIterator vf = ver.FileList();
+ pkgRecords::Parser &rec = packageRecords->Lookup(vf);
- gchar *package_id;
- package_id = pk_package_id_build(pkg.Name(),
- ver.VerStr(),
- ver.Arch(),
- vf.File().Archive() == NULL ? "" : vf.File().Archive());
- pk_backend_details(m_backend,
- package_id,
- "unknown",
- get_enum_group(section),
- get_long_description_parsed(ver, packageRecords).c_str(),
- rec.Homepage().c_str(),
- ver->Size);
+ long size;
+ if (pkg->CurrentState == pkgCache::State::Installed && pkg.CurrentVer() == ver) {
+ // if the package is installed emit the installed size
+ size = ver->InstalledSize;
+ } else {
+ size = ver->Size;
+ }
+
+ gchar *package_id;
+ package_id = pk_package_id_build(pkg.Name(),
+ ver.VerStr(),
+ ver.Arch(),
+ vf.File().Archive() == NULL ? "" : vf.File().Archive());
+ pk_backend_details(m_backend,
+ package_id,
+ "unknown",
+ get_enum_group(section),
+ get_long_description_parsed(ver, packageRecords).c_str(),
+ rec.Homepage().c_str(),
+ size);
}
// used to emit packages it collects all the needed info
commit 79fe858f895f0fa37f21ea2a475f7c7f8f210a90
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Aug 22 15:20:31 2011 +0100
Make percentage, subpercentage and remaining proper GObject properties on the PkBackend object
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 045ba57..e4917a0 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -109,9 +109,9 @@ struct PkBackendPrivate
gchar *root;
gpointer file_changed_data;
guint download_files;
- guint last_percentage;
- guint last_remaining;
- guint last_subpercentage;
+ guint percentage;
+ guint remaining;
+ guint subpercentage;
guint signal_error_timeout;
guint signal_finished;
guint speed;
@@ -142,7 +142,6 @@ static gpointer pk_backend_object = NULL;
enum {
SIGNAL_STATUS_CHANGED,
- SIGNAL_PROGRESS_CHANGED,
SIGNAL_DETAILS,
SIGNAL_FILES,
SIGNAL_DISTRO_UPGRADE,
@@ -171,6 +170,9 @@ enum {
PROP_ROLE,
PROP_TRANSACTION_ID,
PROP_SPEED,
+ PROP_PERCENTAGE,
+ PROP_SUBPERCENTAGE,
+ PROP_REMAINING,
PROP_LAST
};
@@ -880,34 +882,6 @@ pk_backend_unlock (PkBackend *backend)
}
/**
- * pk_backend_emit_progress_changed:
- **/
-static gboolean
-pk_backend_emit_progress_changed (PkBackend *backend)
-{
- guint percentage;
- guint subpercentage;
- guint elapsed;
- guint remaining;
-
- g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
-
- percentage = backend->priv->last_percentage;
-
- /* have not ever set any value? */
- if (percentage == PK_BACKEND_PERCENTAGE_DEFAULT)
- percentage = PK_BACKEND_PERCENTAGE_INVALID;
- subpercentage = backend->priv->last_subpercentage;
- elapsed = pk_time_get_elapsed (backend->priv->time);
- remaining = backend->priv->last_remaining;
-
- /* emit */
- g_signal_emit (backend, signals[SIGNAL_PROGRESS_CHANGED], 0,
- percentage, subpercentage, elapsed, remaining);
- return TRUE;
-}
-
-/**
* pk_backend_set_percentage:
**/
gboolean
@@ -925,7 +899,7 @@ pk_backend_set_percentage (PkBackend *backend, guint percentage)
}
/* set the same twice? */
- if (backend->priv->last_percentage == percentage) {
+ if (backend->priv->percentage == percentage) {
g_debug ("duplicate set of %i", percentage);
return FALSE;
}
@@ -939,16 +913,17 @@ pk_backend_set_percentage (PkBackend *backend, guint percentage)
/* check under */
if (percentage < 100 &&
- backend->priv->last_percentage < 100 &&
- percentage < backend->priv->last_percentage) {
+ backend->priv->percentage < 100 &&
+ percentage < backend->priv->percentage) {
pk_backend_message (backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"percentage value is going down to %i from %i",
- percentage, backend->priv->last_percentage);
+ percentage, backend->priv->percentage);
return FALSE;
}
/* save in case we need this from coldplug */
- backend->priv->last_percentage = percentage;
+ backend->priv->percentage = percentage;
+ g_object_notify (G_OBJECT (backend), "percentage");
/* only compute time if we have data */
if (percentage != PK_BACKEND_PERCENTAGE_INVALID) {
@@ -961,11 +936,10 @@ pk_backend_set_percentage (PkBackend *backend, guint percentage)
/* value cached from config file */
if (backend->priv->use_time)
- backend->priv->last_remaining = remaining;
+ backend->priv->remaining = remaining;
+ g_object_notify (G_OBJECT (backend), "remaining");
}
- /* emit the progress changed signal */
- pk_backend_emit_progress_changed (backend);
return TRUE;
}
@@ -1054,7 +1028,7 @@ pk_backend_set_sub_percentage (PkBackend *backend, guint percentage)
}
/* set the same twice? */
- if (backend->priv->last_subpercentage == percentage) {
+ if (backend->priv->subpercentage == percentage) {
g_debug ("duplicate set of %i", percentage);
return FALSE;
}
@@ -1066,10 +1040,10 @@ pk_backend_set_sub_percentage (PkBackend *backend, guint percentage)
}
/* save in case we need this from coldplug */
- backend->priv->last_subpercentage = percentage;
+ backend->priv->subpercentage = percentage;
/* emit the progress changed signal */
- pk_backend_emit_progress_changed (backend);
+ g_object_notify (G_OBJECT (backend), "subpercentage");
return TRUE;
}
@@ -2854,6 +2828,15 @@ pk_backend_get_property (GObject *object, guint prop_id, GValue *value, GParamSp
case PROP_SPEED:
g_value_set_uint (value, priv->speed);
break;
+ case PROP_PERCENTAGE:
+ g_value_set_uint (value, priv->percentage);
+ break;
+ case PROP_SUBPERCENTAGE:
+ g_value_set_uint (value, priv->subpercentage);
+ break;
+ case PROP_REMAINING:
+ g_value_set_uint (value, priv->remaining);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -2890,6 +2873,15 @@ pk_backend_set_property (GObject *object, guint prop_id, const GValue *value, GP
case PROP_SPEED:
priv->speed = g_value_get_uint (value);
break;
+ case PROP_PERCENTAGE:
+ priv->percentage = g_value_get_uint (value);
+ break;
+ case PROP_SUBPERCENTAGE:
+ priv->subpercentage = g_value_get_uint (value);
+ break;
+ case PROP_REMAINING:
+ priv->remaining = g_value_get_uint (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -2987,21 +2979,40 @@ pk_backend_class_init (PkBackendClass *klass)
* PkBackend:speed:
*/
pspec = g_param_spec_uint ("speed", NULL, NULL,
- 0, G_MAXUINT, PK_STATUS_ENUM_UNKNOWN,
+ 0, G_MAXUINT, 0,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_SPEED, pspec);
+ /**
+ * PkBackend:percentage:
+ */
+ pspec = g_param_spec_uint ("percentage", NULL, NULL,
+ 0, G_MAXUINT, 0,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (object_class, PROP_PERCENTAGE, pspec);
+
+ /**
+ * PkBackend:subpercentage:
+ */
+ pspec = g_param_spec_uint ("subpercentage", NULL, NULL,
+ 0, G_MAXUINT, 0,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (object_class, PROP_SUBPERCENTAGE, pspec);
+
+ /**
+ * PkBackend:remaining:
+ */
+ pspec = g_param_spec_uint ("remaining", NULL, NULL,
+ 0, G_MAXUINT, 0,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (object_class, PROP_REMAINING, pspec);
+
/* properties */
signals[SIGNAL_STATUS_CHANGED] =
g_signal_new ("status-changed",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
0, NULL, NULL, g_cclosure_marshal_VOID__UINT,
G_TYPE_NONE, 1, G_TYPE_UINT);
- signals[SIGNAL_PROGRESS_CHANGED] =
- g_signal_new ("progress-changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__UINT_UINT_UINT_UINT,
- G_TYPE_NONE, 4, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
signals[SIGNAL_CHANGE_TRANSACTION_DATA] =
g_signal_new ("change-transaction-data",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
@@ -3137,9 +3148,9 @@ pk_backend_reset (PkBackend *backend)
backend->priv->exit = PK_EXIT_ENUM_UNKNOWN;
backend->priv->role = PK_ROLE_ENUM_UNKNOWN;
backend->priv->transaction_role = PK_ROLE_ENUM_UNKNOWN;
- backend->priv->last_remaining = 0;
- backend->priv->last_percentage = PK_BACKEND_PERCENTAGE_DEFAULT;
- backend->priv->last_subpercentage = PK_BACKEND_PERCENTAGE_INVALID;
+ backend->priv->remaining = 0;
+ backend->priv->percentage = PK_BACKEND_PERCENTAGE_DEFAULT;
+ backend->priv->subpercentage = PK_BACKEND_PERCENTAGE_DEFAULT;
backend->priv->speed = 0;
pk_store_reset (backend->priv->store);
pk_time_reset (backend->priv->time);
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 903bf4f..dd7b9ff 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -73,7 +73,6 @@ static void pk_transaction_dispose (GObject *object);
#define PK_TRANSACTION_UID_INVALID G_MAXUINT
static void pk_transaction_status_changed_cb (PkBackend *backend, PkStatusEnum status, PkTransaction *transaction);
-static void pk_transaction_progress_changed_cb (PkBackend *backend, guint percentage, guint subpercentage, guint elapsed, guint remaining, PkTransaction *transaction);
struct PkTransactionPrivate
{
@@ -148,7 +147,9 @@ struct PkTransactionPrivate
guint signal_finished;
guint signal_message;
guint signal_package;
- guint signal_progress_changed;
+ guint signal_percentage;
+ guint signal_subpercentage;
+ guint signal_remaining;
guint signal_repo_detail;
guint signal_repo_signature_required;
guint signal_eula_required;
@@ -357,10 +358,10 @@ pk_transaction_emit_changed (PkTransaction *transaction)
**/
static void
pk_transaction_progress_changed_emit (PkTransaction *transaction,
- guint percentage,
- guint subpercentage,
- guint elapsed,
- guint remaining)
+ guint percentage,
+ guint subpercentage,
+ guint elapsed,
+ guint remaining)
{
g_return_if_fail (PK_IS_TRANSACTION (transaction));
@@ -1075,7 +1076,11 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
g_signal_handler_disconnect (transaction->priv->backend,
transaction->priv->signal_status_changed);
g_signal_handler_disconnect (transaction->priv->backend,
- transaction->priv->signal_progress_changed);
+ transaction->priv->signal_percentage);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_subpercentage);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_remaining);
g_signal_handler_disconnect (transaction->priv->backend,
transaction->priv->signal_require_restart);
g_signal_handler_disconnect (transaction->priv->backend,
@@ -1310,27 +1315,6 @@ pk_transaction_package_cb (PkBackend *backend,
}
/**
- * pk_transaction_progress_changed_cb:
- **/
-static void
-pk_transaction_progress_changed_cb (PkBackend *backend,
- guint percentage,
- guint subpercentage,
- guint elapsed,
- guint remaining,
- PkTransaction *transaction)
-{
- g_return_if_fail (PK_IS_TRANSACTION (transaction));
- g_return_if_fail (transaction->priv->tid != NULL);
-
- pk_transaction_progress_changed_emit (transaction,
- percentage,
- subpercentage,
- elapsed,
- remaining);
-}
-
-/**
* pk_transaction_repo_detail_cb:
**/
static void
@@ -1867,6 +1851,51 @@ pk_transaction_speed_cb (GObject *object,
}
/**
+ * pk_transaction_percentage_cb:
+ **/
+static void
+pk_transaction_percentage_cb (GObject *object,
+ GParamSpec *pspec,
+ PkTransaction *transaction)
+{
+ g_object_get (object,
+ "percentage", &transaction->priv->percentage,
+ NULL);
+ /* emit */
+ pk_transaction_emit_changed (transaction);
+}
+
+/**
+ * pk_transaction_subpercentage_cb:
+ **/
+static void
+pk_transaction_subpercentage_cb (GObject *object,
+ GParamSpec *pspec,
+ PkTransaction *transaction)
+{
+ g_object_get (object,
+ "subpercentage", &transaction->priv->subpercentage,
+ NULL);
+ /* emit */
+ pk_transaction_emit_changed (transaction);
+}
+
+/**
+ * pk_transaction_remaining_cb:
+ **/
+static void
+pk_transaction_remaining_cb (GObject *object,
+ GParamSpec *pspec,
+ PkTransaction *transaction)
+{
+ g_object_get (object,
+ "remaining", &transaction->priv->remaining_time,
+ NULL);
+ /* emit */
+ pk_transaction_emit_changed (transaction);
+}
+
+/**
* pk_transaction_run:
*/
gboolean
@@ -1965,9 +1994,15 @@ pk_transaction_run (PkTransaction *transaction)
priv->signal_package =
g_signal_connect (priv->backend, "package",
G_CALLBACK (pk_transaction_package_cb), transaction);
- priv->signal_progress_changed =
- g_signal_connect (priv->backend, "progress-changed",
- G_CALLBACK (pk_transaction_progress_changed_cb), transaction);
+ priv->signal_percentage =
+ g_signal_connect (priv->backend, "notify::percentage",
+ G_CALLBACK (pk_transaction_percentage_cb), transaction);
+ priv->signal_subpercentage =
+ g_signal_connect (priv->backend, "notify::subpercentage",
+ G_CALLBACK (pk_transaction_subpercentage_cb), transaction);
+ priv->signal_remaining =
+ g_signal_connect (priv->backend, "notify::remaining",
+ G_CALLBACK (pk_transaction_remaining_cb), transaction);
priv->signal_repo_detail =
g_signal_connect (priv->backend, "repo-detail",
G_CALLBACK (pk_transaction_repo_detail_cb), transaction);
commit 89ae922305d5aeb77a8d3107dcd8a78f23cbcb03
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Aug 22 15:04:45 2011 +0100
trivial: remove the unused pk_backend_get_progress()
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 23386a0..045ba57 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -1417,28 +1417,6 @@ out:
}
/**
- * pk_backend_get_progress:
- **/
-gboolean
-pk_backend_get_progress (PkBackend *backend,
- guint *percentage, guint *subpercentage,
- guint *elapsed, guint *remaining)
-{
- g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
- g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
-
- *percentage = backend->priv->last_percentage;
- /* have not ever set any value? */
- if (*percentage == PK_BACKEND_PERCENTAGE_DEFAULT) {
- *percentage = PK_BACKEND_PERCENTAGE_INVALID;
- }
- *subpercentage = backend->priv->last_subpercentage;
- *elapsed = pk_time_get_elapsed (backend->priv->time);
- *remaining = backend->priv->last_remaining;
- return TRUE;
-}
-
-/**
* pk_backend_require_restart:
**/
gboolean
diff --git a/src/pk-backend.h b/src/pk-backend.h
index fbcf32f..d6d8afa 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -234,11 +234,6 @@ void pk_backend_set_cache_age (PkBackend *backend,
/* get the state */
gboolean pk_backend_get_allow_cancel (PkBackend *backend);
gboolean pk_backend_get_is_error_set (PkBackend *backend);
-gboolean pk_backend_get_progress (PkBackend *backend,
- guint *percentage,
- guint *subpercentage,
- guint *elapsed,
- guint *remaining);
guint pk_backend_get_runtime (PkBackend *backend);
gchar *pk_backend_get_proxy_ftp (PkBackend *backend);
gchar *pk_backend_get_proxy_http (PkBackend *backend);
commit bda3016e0728c15518288834cabf5018da0ea0fb
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Aug 22 12:05:30 2011 +0100
Add an ItemProgress signal designed to eventually replace SubPercentage
Most GUI's try to link the SubPercentage with a package, in order to do sane
per-package completion reports. This is a hacky heuristic that just works around
a deficiency in the public API. The ItemProgress is a new signal that's designed
to be emitted by backends tying the package to the percentage and should make
all the evil hacks go away.
We've not going to drop SubPercentage just yet, as the client code will need
time to convert to the new world order.
diff --git a/lib/packagekit-glib2/pk-client.c b/lib/packagekit-glib2/pk-client.c
index 870b8bf..d5ba0d2 100644
--- a/lib/packagekit-glib2/pk-client.c
+++ b/lib/packagekit-glib2/pk-client.c
@@ -1391,6 +1391,15 @@ pk_client_message_cb (DBusGProxy *proxy, const gchar *message_text, const gchar
}
/**
+ * pk_client_item_progress_cb:
+ */
+static void
+pk_client_item_progress_cb (DBusGProxy *proxy, const gchar *id, guint value, PkClientState *state)
+{
+ pk_progress_set_item_progress (state->progress, id, value);
+}
+
+/**
* pk_client_connect_proxy:
**/
static void
@@ -1439,6 +1448,7 @@ pk_client_connect_proxy (DBusGProxy *proxy, PkClientState *state)
dbus_g_proxy_add_signal (proxy, "MediaChangeRequired",
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
dbus_g_proxy_add_signal (proxy, "Changed", G_TYPE_INVALID);
+ dbus_g_proxy_add_signal (proxy, "ItemProgress", G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INVALID);
/* connect up the signals */
dbus_g_proxy_connect_signal (proxy, "Finished",
@@ -1471,6 +1481,8 @@ pk_client_connect_proxy (DBusGProxy *proxy, PkClientState *state)
G_CALLBACK (pk_client_message_cb), state, NULL);
dbus_g_proxy_connect_signal (proxy, "MediaChangeRequired",
G_CALLBACK (pk_client_media_change_required_cb), state, NULL);
+ dbus_g_proxy_connect_signal (proxy, "ItemProgress",
+ G_CALLBACK (pk_client_item_progress_cb), state, NULL);
dbus_g_proxy_connect_signal (proxy, "Changed",
G_CALLBACK (pk_client_changed_cb), state, NULL);
@@ -4947,6 +4959,9 @@ pk_client_init (PkClient *client)
dbus_g_object_register_marshaller (pk_marshal_VOID__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_INVALID);
+ /* ItemProgress */
+ dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_UINT,
+ G_TYPE_NONE, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INVALID);
/* cache locale */
client->priv->locale = g_strdup (setlocale (LC_MESSAGES, NULL));
diff --git a/lib/packagekit-glib2/pk-progress.c b/lib/packagekit-glib2/pk-progress.c
index 951813b..e098384 100644
--- a/lib/packagekit-glib2/pk-progress.c
+++ b/lib/packagekit-glib2/pk-progress.c
@@ -48,6 +48,8 @@ struct _PkProgressPrivate
gchar *transaction_id;
gint percentage;
gint subpercentage;
+ guint item_progress_value;
+ gchar *item_progress_id;
gboolean allow_cancel;
PkRoleEnum role;
PkStatusEnum status;
@@ -74,6 +76,8 @@ enum {
PROP_SPEED,
PROP_UID,
PROP_PACKAGE,
+ PROP_ITEM_PROGRESS_ID,
+ PROP_ITEM_PROGRESS_VALUE,
PROP_LAST
};
@@ -100,6 +104,12 @@ pk_progress_get_property (GObject *object, guint prop_id, GValue *value, GParamS
case PROP_SUBPERCENTAGE:
g_value_set_int (value, progress->priv->subpercentage);
break;
+ case PROP_ITEM_PROGRESS_VALUE:
+ g_value_set_int (value, progress->priv->item_progress_value);
+ break;
+ case PROP_ITEM_PROGRESS_ID:
+ g_value_set_string (value, progress->priv->item_progress_id);
+ break;
case PROP_ALLOW_CANCEL:
g_value_set_boolean (value, progress->priv->allow_cancel);
break;
@@ -163,6 +173,39 @@ pk_progress_set_package_id (PkProgress *progress, const gchar *package_id)
}
/**
+ * pk_progress_set_item_progress:
+ * @progress: a valid #PkProgress instance
+ *
+ * Since: 0.7.0
+ **/
+gboolean
+pk_progress_set_item_progress (PkProgress *progress,
+ const gchar *package_id,
+ guint percentage)
+{
+ g_return_val_if_fail (PK_IS_PROGRESS (progress), FALSE);
+
+ /* valid? */
+ if (!pk_package_id_check (package_id)) {
+ g_warning ("invalid package_id %s", package_id);
+ return FALSE;
+ }
+
+ /* new value */
+ if (g_strcmp0 (progress->priv->item_progress_id, package_id) != 0) {
+ g_free (progress->priv->item_progress_id);
+ progress->priv->item_progress_id = g_strdup (package_id);
+ g_object_notify (G_OBJECT(progress), "item-progress-id");
+ }
+ if (progress->priv->item_progress_value != percentage) {
+ progress->priv->item_progress_value = percentage;
+ g_object_notify (G_OBJECT(progress), "item-progress-value");
+ }
+
+ return TRUE;
+}
+
+/**
* pk_progress_set_transaction_id:
* @progress: a valid #PkProgress instance
*
@@ -617,6 +660,26 @@ pk_progress_class_init (PkProgressClass *klass)
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_PACKAGE, pspec);
+ /**
+ * PkProgress:item-progress-id:
+ *
+ * Since: 0.7.0
+ */
+ pspec = g_param_spec_string ("item-progress-id", NULL, NULL,
+ NULL,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (object_class, PROP_ITEM_PROGRESS_ID, pspec);
+
+ /**
+ * PkProgress:item-progress-value:
+ *
+ * Since: 0.7.0
+ */
+ pspec = g_param_spec_int ("item-progress-value", NULL, NULL,
+ -1, G_MAXINT, -1,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (object_class, PROP_ITEM_PROGRESS_VALUE, pspec);
+
g_type_class_add_private (klass, sizeof (PkProgressPrivate));
}
@@ -640,6 +703,7 @@ pk_progress_finalize (GObject *object)
if (progress->priv->package != NULL)
g_object_unref (progress->priv->package);
+ g_free (progress->priv->item_progress_id);
g_free (progress->priv->package_id);
g_free (progress->priv->transaction_id);
diff --git a/lib/packagekit-glib2/pk-progress.h b/lib/packagekit-glib2/pk-progress.h
index ff961cb..d0c3b20 100644
--- a/lib/packagekit-glib2/pk-progress.h
+++ b/lib/packagekit-glib2/pk-progress.h
@@ -79,6 +79,7 @@ typedef enum {
PK_PROGRESS_TYPE_SPEED,
PK_PROGRESS_TYPE_UID,
PK_PROGRESS_TYPE_PACKAGE,
+ PK_PROGRESS_TYPE_ITEM_PROGRESS,
PK_PROGRESS_TYPE_INVALID
} PkProgressType;
@@ -88,6 +89,9 @@ typedef void (*PkProgressCallback) (PkProgress *progress,
gboolean pk_progress_set_package_id (PkProgress *progress,
const gchar *package_id);
+gboolean pk_progress_set_item_progress (PkProgress *progress,
+ const gchar *package_id,
+ guint percentage);
gboolean pk_progress_set_transaction_id (PkProgress *progress,
const gchar *package_id);
gboolean pk_progress_set_percentage (PkProgress *progress,
diff --git a/src/org.freedesktop.PackageKit.Transaction.xml b/src/org.freedesktop.PackageKit.Transaction.xml
index 469a337..debeb57 100644
--- a/src/org.freedesktop.PackageKit.Transaction.xml
+++ b/src/org.freedesktop.PackageKit.Transaction.xml
@@ -2508,6 +2508,40 @@
</signal>
<!--*****************************************************************************************-->
+ <signal name="ItemProgress">
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ This signal allows the backend to send infomation about
+ package or repository progress when using Simultanous mode.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ <arg type="s" name="id" direction="out">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ A valid package_id, e.g. <doc:tt>hal;0.1.0;i386;fedora</doc:tt>
+ or a repo_id.
+ </doc:para>
+ <doc:para>
+ A repo_id may only be used when running RefreshCache.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ <arg type="u" name="percentage" direction="out">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ The percentage of this package action is completed.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ </signal>
+
+ <!--*****************************************************************************************-->
<signal name="Changed">
<doc:doc>
<doc:description>
diff --git a/src/pk-backend-spawn.c b/src/pk-backend-spawn.c
index a2bef07..1d92ed2 100644
--- a/src/pk-backend-spawn.c
+++ b/src/pk-backend-spawn.c
@@ -312,6 +312,29 @@ pk_backend_spawn_parse_stdout (PkBackendSpawn *backend_spawn, const gchar *line,
} else {
pk_backend_set_sub_percentage (priv->backend, percentage);
}
+ } else if (g_strcmp0 (command, "item-percentage") == 0) {
+ if (size != 2) {
+ g_set_error (error, 1, 0, "invalid command'%s', size %i", command, size);
+ ret = FALSE;
+ goto out;
+ }
+ if (!pk_package_id_check (sections[1])) {
+ g_set_error (error, 1, 0, "invalid package_id");
+ ret = FALSE;
+ goto out;
+ }
+ ret = pk_strtoint (sections[2], &percentage);
+ if (!ret) {
+ g_set_error (error, 1, 0, "invalid item-percentage value %s", sections[1]);
+ ret = FALSE;
+ } else if (percentage < 0 || percentage > 100) {
+ g_set_error (error, 1, 0, "invalid item-percentage value %i", percentage);
+ ret = FALSE;
+ } else {
+ pk_backend_set_item_progress (priv->backend,
+ sections[1],
+ percentage);
+ }
} else if (g_strcmp0 (command, "error") == 0) {
if (size != 3) {
g_set_error (error, 1, 0, "invalid command'%s', size %i", command, size);
diff --git a/src/pk-backend.c b/src/pk-backend.c
index abc69f9..23386a0 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -159,6 +159,7 @@ enum {
SIGNAL_REPO_DETAIL,
SIGNAL_CATEGORY,
SIGNAL_MEDIA_CHANGE_REQUIRED,
+ SIGNAL_ITEM_PROGRESS,
SIGNAL_LAST
};
@@ -1009,6 +1010,35 @@ pk_backend_get_runtime (PkBackend *backend)
}
/**
+ * pk_backend_set_item_progress:
+ **/
+gboolean
+pk_backend_set_item_progress (PkBackend *backend,
+ const gchar *package_id,
+ guint percentage)
+{
+ g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
+
+ /* have we already set an error? */
+ if (backend->priv->set_error) {
+ g_warning ("already set error, cannot process: item-percentage %i", percentage);
+ return FALSE;
+ }
+
+ /* invalid number? */
+ if (percentage > 100 && percentage != PK_BACKEND_PERCENTAGE_INVALID) {
+ g_debug ("invalid number %i", percentage);
+ return FALSE;
+ }
+
+ /* emit */
+ g_signal_emit (backend, signals[SIGNAL_ITEM_PROGRESS], 0,
+ package_id, percentage);
+ return TRUE;
+}
+
+/**
* pk_backend_set_sub_percentage:
**/
gboolean
@@ -3076,6 +3106,12 @@ pk_backend_class_init (PkBackendClass *klass)
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
0, NULL, NULL, g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
+ signals[SIGNAL_ITEM_PROGRESS] =
+ g_signal_new ("item-progress",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, pk_marshal_VOID__STRING_UINT,
+ G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_UINT);
+
g_type_class_add_private (klass, sizeof (PkBackendPrivate));
}
diff --git a/src/pk-backend.h b/src/pk-backend.h
index 42eee30..fbcf32f 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -211,6 +211,9 @@ gboolean pk_backend_set_allow_cancel (PkBackend *backend,
gboolean allow_cancel);
gboolean pk_backend_set_percentage (PkBackend *backend,
guint percentage);
+gboolean pk_backend_set_item_progress (PkBackend *backend,
+ const gchar *package_id,
+ guint percentage);
gboolean pk_backend_set_sub_percentage (PkBackend *backend,
guint percentage);
gboolean pk_backend_set_speed (PkBackend *backend,
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index a1e3a4e..903bf4f 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -158,6 +158,7 @@ struct PkTransactionPrivate
guint signal_update_detail;
guint signal_category;
guint signal_speed;
+ guint signal_item_progress;
GPtrArray *plugins;
GPtrArray *supported_content_types;
guint registration_id;
@@ -669,6 +670,31 @@ pk_transaction_category_cb (PkBackend *backend,
}
/**
+ * pk_transaction_item_progress_cb:
+ **/
+static void
+pk_transaction_item_progress_cb (PkBackend *backend,
+ const gchar *package_id,
+ guint percentage,
+ PkTransaction *transaction)
+{
+ g_return_if_fail (PK_IS_TRANSACTION (transaction));
+ g_return_if_fail (transaction->priv->tid != NULL);
+
+ /* emit */
+ g_debug ("emitting item-progress %s, %u", package_id, percentage);
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "ItemProgress",
+ g_variant_new ("(su)",
+ package_id,
+ percentage),
+ NULL);
+}
+
+/**
* pk_transaction_distro_upgrade_cb:
**/
static void
@@ -1052,6 +1078,8 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
transaction->priv->signal_progress_changed);
g_signal_handler_disconnect (transaction->priv->backend,
transaction->priv->signal_require_restart);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_item_progress);
/* run the plugins */
pk_transaction_plugin_phase (transaction,
@@ -1964,6 +1992,10 @@ pk_transaction_run (PkTransaction *transaction)
priv->signal_category =
g_signal_connect (priv->backend, "category",
G_CALLBACK (pk_transaction_category_cb), transaction);
+ priv->signal_item_progress =
+ g_signal_connect (priv->backend, "item-progress",
+ G_CALLBACK (pk_transaction_item_progress_cb),
+ transaction);
priv->signal_speed =
g_signal_connect (priv->backend, "notify::speed",
G_CALLBACK (pk_transaction_speed_cb), transaction);
commit 0ccb8672d9a157ba77f9671fb09ab27720675ab2
Author: Garrett Regier <garrettregier at gmail.com>
Date: Mon Aug 22 02:48:02 2011 -0700
Free the PkProgress' package
Signed-off-by: Richard Hughes <richard at hughsie.com>
diff --git a/lib/packagekit-glib2/pk-progress.c b/lib/packagekit-glib2/pk-progress.c
index c00c255..951813b 100644
--- a/lib/packagekit-glib2/pk-progress.c
+++ b/lib/packagekit-glib2/pk-progress.c
@@ -637,6 +637,9 @@ pk_progress_finalize (GObject *object)
{
PkProgress *progress = PK_PROGRESS (object);
+ if (progress->priv->package != NULL)
+ g_object_unref (progress->priv->package);
+
g_free (progress->priv->package_id);
g_free (progress->priv->transaction_id);
commit 4295e147cc7a4769ede8468ee9c3ccefdab16ce8
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Aug 16 12:16:52 2011 +0100
zif: Fix a fatal error when doing 'pkcon repo-list --filter=~devel'
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 7d2f118..b632a5c 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -4477,9 +4477,9 @@ pk_backend_get_repo_list_thread (PkBackend *backend)
/* devel, name, enabled */
ret = zif_state_set_steps (state_loop,
NULL,
- 50, /* is store devel? */
- 50, /* get name */
- 50, /* get enabled */
+ 60, /* is store devel? */
+ 20, /* get name */
+ 20, /* get enabled */
-1);
g_assert (ret);
commit 8864e4b3256ca08006fe6c7f0b7a0cbfe3af967c
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Aug 16 12:16:10 2011 +0100
Remove the duplicate 'The software is not from a trusted source' authentication line when updating
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 2047179..a1e3a4e 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -2595,10 +2595,6 @@ pk_transaction_obtain_authorization (PkTransaction *transaction, gboolean only_t
/* UpdatePackages */
if (priv->role == PK_ROLE_ENUM_UPDATE_PACKAGES) {
- /* TRANSLATORS: is not GPG signed */
- g_string_append (string, g_dgettext (GETTEXT_PACKAGE, N_("The software is not from a trusted source.")));
- g_string_append (string, "\n");
-
/* TRANSLATORS: user has to trust provider -- I know, this sucks */
text = g_dngettext (GETTEXT_PACKAGE,
N_("Do not update this package unless you are sure it is safe to do so."),
commit fe7538feb0877737415dd13a5110b0b14501d490
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Aug 12 13:34:30 2011 +0200
trivial: Fix the daemon self test program
diff --git a/src/Makefile.am b/src/Makefile.am
index 293a20e..d161231 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -56,6 +56,7 @@ shared_SOURCES = \
pk-dbus.h \
pk-transaction.c \
pk-transaction.h \
+ pk-transaction-private.h \
pk-backend.c \
pk-backend.h \
pk-network.c \
diff --git a/src/pk-self-test.c b/src/pk-self-test.c
index c6c597c..0d2f785 100644
--- a/src/pk-self-test.c
+++ b/src/pk-self-test.c
@@ -38,6 +38,7 @@
#include "pk-time.h"
#include "pk-transaction-db.h"
#include "pk-transaction.h"
+#include "pk-transaction-private.h"
#include "pk-transaction-list.h"
#define PK_TRANSACTION_ERROR_INPUT_INVALID 14
@@ -657,100 +658,6 @@ pk_test_engine_emit_repo_list_changed_cb (void)
}
static void
-pk_test_engine_func (void)
-{
- gboolean ret;
- PkEngine *engine;
- PkBackend *backend;
- guint idle;
- gchar *state;
- gdouble elapsed;
-
- backend = pk_backend_new ();
- g_assert (backend != NULL);
-
- notify = pk_notify_new ();
- g_assert (notify != NULL);
-
- /* set the type, as we have no pk-main doing this for us */
- /* set the backend name */
- ret = pk_backend_set_name (backend, "dummy", NULL);
- g_assert (ret);
-
- /* get an engine instance */
- engine = pk_engine_new ();
- g_assert (engine != NULL);
-
- /* connect up signals */
- g_signal_connect (engine, "quit",
- G_CALLBACK (pk_test_engine_quit_cb), NULL);
- g_signal_connect (engine, "changed",
- G_CALLBACK (pk_test_engine_changed_cb), NULL);
- g_signal_connect (engine, "updates-changed",
- G_CALLBACK (pk_test_engine_updates_changed_cb), NULL);
- g_signal_connect (engine, "repo-list-changed",
- G_CALLBACK (pk_test_engine_repo_list_changed_cb), NULL);
- g_signal_connect (engine, "restart-schedule",
- G_CALLBACK (pk_test_engine_restart_schedule_cb), NULL);
-
- /* get idle at startup */
- idle = pk_engine_get_seconds_idle (engine);
- g_assert_cmpint (idle, <, 1);
-
- /* wait 5 seconds */
- _g_test_loop_wait (5000);
-
- /* get idle at idle */
- idle = pk_engine_get_seconds_idle (engine);
- g_assert_cmpint (idle, <, 6);
- g_assert_cmpint (idle, >, 4);
-
- /* get idle after method */
- pk_engine_get_daemon_state (engine, &state, NULL);
- g_free (state);
- idle = pk_engine_get_seconds_idle (engine);
- g_assert_cmpint (idle, <, 1);
-
- /* force test notify updates-changed */
- g_timeout_add (25, (GSourceFunc) pk_test_engine_emit_updates_changed_cb, NULL);
- _g_test_loop_wait (50);
-
- /* force test notify repo-list-changed */
- g_timeout_add (25, (GSourceFunc) pk_test_engine_emit_repo_list_changed_cb, NULL);
- _g_test_loop_wait (50);
-
- /* force test notify wait updates-changed */
- g_test_timer_start ();
- pk_notify_wait_updates_changed (notify, 500);
- _g_test_loop_run_with_timeout (1500);
- elapsed = g_test_timer_elapsed ();
- g_assert_cmpfloat (elapsed, >, 0.4);
- g_assert_cmpfloat (elapsed, <, 0.6);
-
- /* test not locked */
- g_assert (!_locked);
- g_assert (!_restart_schedule);
-
- ret = g_file_set_contents (SBINDIR "/packagekitd", "overwrite", -1, NULL);
- g_assert (ret);
- _g_test_loop_wait (5000);
-
- /* get idle after we touched the binary */
- idle = pk_engine_get_seconds_idle (engine);
- g_assert_cmpint (idle, ==, G_MAXUINT);
- g_assert (_restart_schedule);
- g_assert (!_quit);
-
- /* suggest quit with no transactions (should get quit signal) */
- pk_engine_suggest_daemon_quit (engine, NULL);
- g_assert (_quit);
-
- g_object_unref (backend);
- g_object_unref (notify);
- g_object_unref (engine);
-}
-
-static void
pk_test_notify_func (void)
{
PkNotify *notify;
@@ -1145,6 +1052,16 @@ pk_test_transaction_func (void)
PkTransaction *transaction = NULL;
gboolean ret;
GError *error = NULL;
+ PkBackend *backend;
+
+ backend = pk_backend_new ();
+ /* try to load a valid backend */
+ ret = pk_backend_set_name (backend, "dummy", NULL);
+ g_assert (ret);
+
+ /* lock an valid backend */
+ ret = pk_backend_lock (backend);
+ g_assert (ret);
/* get PkTransaction object */
transaction = pk_transaction_new ();
@@ -1224,6 +1141,7 @@ pk_test_transaction_func (void)
g_clear_error (&error);
g_object_unref (transaction);
+ g_object_unref (backend);
}
static void
@@ -1436,6 +1354,15 @@ pk_test_transaction_list_func (void)
cache = pk_cache_new ();
db = pk_transaction_db_new ();
+ /* try to load a valid backend */
+ backend = pk_backend_new ();
+ ret = pk_backend_set_name (backend, "dummy", NULL);
+ g_assert (ret);
+
+ /* lock an valid backend */
+ ret = pk_backend_lock (backend);
+ g_assert (ret);
+
/* get a transaction list object */
tlist = pk_transaction_list_new ();
g_assert (tlist != NULL);
@@ -1483,15 +1410,6 @@ pk_test_transaction_list_func (void)
ret = pk_transaction_list_create (tlist, tid, ":org.freedesktop.PackageKit", NULL);
g_assert (ret);
- backend = pk_backend_new ();
- /* try to load a valid backend */
- ret = pk_backend_set_name (backend, "dummy", NULL);
- g_assert (ret);
-
- /* lock an valid backend */
- ret = pk_backend_lock (backend);
- g_assert (ret);
-
/* get from db */
transaction = pk_transaction_list_get_transaction (tlist, tid);
g_assert (transaction != NULL);
@@ -1499,7 +1417,7 @@ pk_test_transaction_list_func (void)
G_CALLBACK (pk_test_transaction_list_finished_cb), NULL);
/* this tests the run-on-commit action */
- pk_transaction_get_updates (transaction, "none", NULL);
+ pk_transaction_get_updates (transaction, g_variant_new ("(s)", "none"), NULL);
/* make sure transaction has correct flags */
transaction = pk_transaction_list_get_transaction (tlist, tid);
@@ -1577,19 +1495,25 @@ pk_test_transaction_list_func (void)
/* this starts one action */
array = g_strsplit ("dave", " ", -1);
transaction = pk_transaction_list_get_transaction (tlist, tid_item1);
- pk_transaction_search_details (transaction, "none", array, NULL);
+ pk_transaction_search_details (transaction,
+ g_variant_new ("(s^as)", "none", array),
+ NULL);
g_strfreev (array);
/* this should be chained after the first action completes */
array = g_strsplit ("power", " ", -1);
transaction = pk_transaction_list_get_transaction (tlist, tid_item2);
- pk_transaction_search_names (transaction, "none", array, NULL);
+ pk_transaction_search_names (transaction,
+ g_variant_new ("(s^as)", "none", array),
+ NULL);
g_strfreev (array);
/* this starts be chained after the second action completes */
array = g_strsplit ("paul", " ", -1);
transaction = pk_transaction_list_get_transaction (tlist, tid_item3);
- pk_transaction_search_details (transaction, "none", array, NULL);
+ pk_transaction_search_details (transaction,
+ g_variant_new ("(s^as)", "none", array),
+ NULL);
g_strfreev (array);
/* get transactions (committed, not finished) in progress (all) */
@@ -1720,9 +1644,6 @@ main (int argc, char **argv)
g_test_add_func ("/packagekit/backend", pk_test_backend_func);
g_test_add_func ("/packagekit/backend_spawn", pk_test_backend_spawn_func);
- /* system */
- g_test_add_func ("/packagekit/engine", pk_test_engine_func);
-
return g_test_run ();
}
diff --git a/src/pk-transaction-list.c b/src/pk-transaction-list.c
index 468ccbf..e046cd2 100644
--- a/src/pk-transaction-list.c
+++ b/src/pk-transaction-list.c
@@ -38,6 +38,8 @@
#include <packagekit-glib2/pk-common.h>
#include "pk-conf.h"
+#include "pk-transaction.h"
+#include "pk-transaction-private.h"
#include "pk-transaction-list.h"
static void pk_transaction_list_finalize (GObject *object);
diff --git a/src/pk-transaction-private.h b/src/pk-transaction-private.h
new file mode 100644
index 0000000..5186cfb
--- /dev/null
+++ b/src/pk-transaction-private.h
@@ -0,0 +1,52 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __PK_TRANSACTION_PRIVATE_H
+#define __PK_TRANSACTION_PRIVATE_H
+
+#include <glib-object.h>
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+/* only here for the self test program to use */
+void pk_transaction_get_updates (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context);
+void pk_transaction_search_details (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context);
+void pk_transaction_search_names (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context);
+gboolean pk_transaction_set_sender (PkTransaction *transaction,
+ const gchar *sender);
+gboolean pk_transaction_filter_check (const gchar *filter,
+ GError **error);
+gboolean pk_transaction_strvalidate (const gchar *textr,
+ GError **error);
+gboolean pk_transaction_set_tid (PkTransaction *transaction,
+ const gchar *tid);
+
+
+G_END_DECLS
+
+#endif /* __PK_TRANSACTION_PRIVATE_H */
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index b198d80..2047179 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -60,6 +60,7 @@
#include "pk-syslog.h"
#include "pk-transaction-db.h"
#include "pk-transaction.h"
+#include "pk-transaction-private.h"
#include "pk-transaction-list.h"
static void pk_transaction_finalize (GObject *object);
@@ -3652,7 +3653,7 @@ out:
/**
* pk_transaction_get_updates:
**/
-static void
+void
pk_transaction_get_updates (PkTransaction *transaction,
GVariant *params,
GDBusMethodInvocation *context)
@@ -4375,7 +4376,7 @@ out:
/**
* pk_transaction_search_details:
**/
-static void
+void
pk_transaction_search_details (PkTransaction *transaction,
GVariant *params,
GDBusMethodInvocation *context)
@@ -4583,7 +4584,7 @@ out:
/**
* pk_transaction_search_name:
**/
-static void
+void
pk_transaction_search_names (PkTransaction *transaction,
GVariant *params,
GDBusMethodInvocation *context)
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index f1bc55f..02c7a49 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -95,15 +95,6 @@ void pk_transaction_add_supported_content_type (PkTransaction *transaction,
void pk_transaction_set_plugins (PkTransaction *transaction,
GPtrArray *plugins);
-gboolean pk_transaction_set_sender (PkTransaction *transaction,
- const gchar *sender);
-gboolean pk_transaction_filter_check (const gchar *filter,
- GError **error);
-gboolean pk_transaction_strvalidate (const gchar *textr,
- GError **error);
-gboolean pk_transaction_set_tid (PkTransaction *transaction,
- const gchar *tid);
-
G_END_DECLS
#endif /* __PK_TRANSACTION_H */
commit 3be719a27e2fea4596dd9e30cfcf0c70f28c20bd
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Aug 12 13:32:37 2011 +0200
trivial: The D-Bus connection is unset in the self test program
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index c4615b0..b198d80 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -2684,8 +2684,10 @@ pk_transaction_dbus_return (GDBusMethodInvocation *context, GError *error)
{
/* not set inside the test suite */
if (context == NULL) {
- g_warning ("context null, and error: %s", error->message);
- g_error_free (error);
+ if (error != NULL) {
+ g_warning ("context null, and error: %s", error->message);
+ g_error_free (error);
+ }
return;
}
if (error != NULL)
@@ -5829,14 +5831,16 @@ pk_transaction_dispose (GObject *object)
}
/* send signal to clients that we are about to be destroyed */
- g_debug ("emitting destroy %s", transaction->priv->tid);
- g_dbus_connection_emit_signal (transaction->priv->connection,
- NULL,
- transaction->priv->tid,
- PK_DBUS_INTERFACE_TRANSACTION,
- "Destroy",
- NULL,
- NULL);
+ if (transaction->priv->connection != NULL) {
+ g_debug ("emitting destroy %s", transaction->priv->tid);
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "Destroy",
+ NULL,
+ NULL);
+ }
G_OBJECT_CLASS (pk_transaction_parent_class)->dispose (object);
}
commit cb72d03a68d8ec89fa8e99bc4cdef03a91adf758
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Aug 12 13:31:19 2011 +0200
Setting the plugin list is optional
The self test program does not do this.
diff --git a/src/pk-transaction-list.c b/src/pk-transaction-list.c
index 6e8c01b..468ccbf 100644
--- a/src/pk-transaction-list.c
+++ b/src/pk-transaction-list.c
@@ -468,8 +468,10 @@ pk_transaction_list_create (PkTransactionList *tlist,
G_CALLBACK (pk_transaction_list_transaction_finished_cb), tlist);
/* set plugins */
- pk_transaction_set_plugins (item->transaction,
- tlist->priv->plugins);
+ if (tlist->priv->plugins != NULL) {
+ pk_transaction_set_plugins (item->transaction,
+ tlist->priv->plugins);
+ }
/* set transaction state */
ret = pk_transaction_set_state (item->transaction, PK_TRANSACTION_STATE_NEW);
@@ -948,7 +950,8 @@ pk_transaction_list_finalize (GObject *object)
g_ptr_array_foreach (tlist->priv->array, (GFunc) pk_transaction_list_item_free, NULL);
g_ptr_array_free (tlist->priv->array, TRUE);
g_object_unref (tlist->priv->conf);
- g_ptr_array_unref (tlist->priv->plugins);
+ if (tlist->priv->plugins != NULL)
+ g_ptr_array_unref (tlist->priv->plugins);
G_OBJECT_CLASS (pk_transaction_list_parent_class)->finalize (object);
}
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 6b8fef7..c4615b0 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -858,6 +858,9 @@ pk_transaction_plugin_phase (PkTransaction *transaction,
PkPluginTransactionFunc plugin_func = NULL;
PkPlugin *plugin;
+ if (transaction->priv->plugins == NULL)
+ goto out;
+
switch (phase) {
case PK_PLUGIN_PHASE_TRANSACTION_RUN:
function = "pk_plugin_transaction_run";
@@ -899,6 +902,7 @@ pk_transaction_plugin_phase (PkTransaction *transaction,
g_module_name (plugin->module));
plugin_func (plugin, transaction);
}
+out:
if (!ran_one)
g_debug ("no plugins provided %s", function);
}
@@ -5889,7 +5893,8 @@ pk_transaction_finalize (GObject *object)
// g_object_unref (transaction->priv->authority);
g_object_unref (transaction->priv->cancellable);
#endif
- g_ptr_array_unref (transaction->priv->plugins);
+ if (transaction->priv->plugins != NULL)
+ g_ptr_array_unref (transaction->priv->plugins);
G_OBJECT_CLASS (pk_transaction_parent_class)->finalize (object);
}
commit 71d31481afdcbf191ef9678e860ecc0cb7bc9b75
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Aug 12 01:28:50 2011 +0200
trivial: Remove some dead code from the self test code
diff --git a/src/pk-self-test.c b/src/pk-self-test.c
index ab5bc18..c6c597c 100644
--- a/src/pk-self-test.c
+++ b/src/pk-self-test.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2007-2010 Richard Hughes <richard at hughsie.com>
+ * Copyright (C) 2007-2011 Richard Hughes <richard at hughsie.com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -31,7 +31,6 @@
#include "pk-conf.h"
#include "pk-dbus.h"
#include "pk-engine.h"
-#include "pk-inhibit.h"
#include "pk-notify.h"
#include "pk-spawn.h"
#include "pk-store.h"
@@ -663,7 +662,6 @@ pk_test_engine_func (void)
gboolean ret;
PkEngine *engine;
PkBackend *backend;
- PkInhibit *inhibit;
guint idle;
gchar *state;
gdouble elapsed;
@@ -729,16 +727,6 @@ pk_test_engine_func (void)
g_assert_cmpfloat (elapsed, >, 0.4);
g_assert_cmpfloat (elapsed, <, 0.6);
- /* test locked */
- inhibit = pk_inhibit_new ();
- pk_inhibit_add (inhibit, GUINT_TO_POINTER (999));
- g_assert (_locked);
-
- /* test locked */
- pk_inhibit_remove (inhibit, GUINT_TO_POINTER (999));
- g_assert (!_locked);
- g_object_unref (inhibit);
-
/* test not locked */
g_assert (!_locked);
g_assert (!_restart_schedule);
@@ -763,54 +751,6 @@ pk_test_engine_func (void)
}
static void
-pk_test_inhibit_func (void)
-{
- PkInhibit *inhibit;
- gboolean ret;
-
- inhibit = pk_inhibit_new ();
- g_assert (inhibit != NULL);
-
- /* check we are not inhibited */
- ret = pk_inhibit_locked (inhibit);
- g_assert (!ret);
-
- /* add 123 */
- ret = pk_inhibit_add (inhibit, GUINT_TO_POINTER (123));
- g_assert (ret);
-
- /* check we are inhibited */
- ret = pk_inhibit_locked (inhibit);
- g_assert (ret);
-
- /* add 123 (again) */
- ret = pk_inhibit_add (inhibit, GUINT_TO_POINTER (123));
- g_assert (!ret);
-
- /* add 456 */
- ret = pk_inhibit_add (inhibit, GUINT_TO_POINTER (456));
- g_assert (ret);
-
- /* remove 123" */
- ret = pk_inhibit_remove (inhibit, GUINT_TO_POINTER (123));
- g_assert (ret);
-
- /* check we are still inhibited */
- ret = pk_inhibit_locked (inhibit);
- g_assert (ret);
-
- /* remove 456 */
- ret = pk_inhibit_remove (inhibit, GUINT_TO_POINTER (456));
- g_assert (ret);
-
- /* check we are not inhibited */
- ret = pk_inhibit_locked (inhibit);
- g_assert (!ret);
-
- g_object_unref (inhibit);
-}
-
-static void
pk_test_notify_func (void)
{
PkNotify *notify;
@@ -1771,7 +1711,6 @@ main (int argc, char **argv)
g_test_add_func ("/packagekit/conf", pk_test_conf_func);
g_test_add_func ("/packagekit/cache", pk_test_conf_func);
g_test_add_func ("/packagekit/store", pk_test_store_func);
- g_test_add_func ("/packagekit/inhibit", pk_test_inhibit_func);
g_test_add_func ("/packagekit/spawn", pk_test_spawn_func);
g_test_add_func ("/packagekit/transaction", pk_test_transaction_func);
g_test_add_func ("/packagekit/transaction-list", pk_test_transaction_list_func);
commit 58b2409227b9e59b96227bbcc75b22a5fd3428f3
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Aug 12 01:26:34 2011 +0200
Make the lsof plugin code support distros such as Fedora with /lib64
diff --git a/src/plugins/pk-lsof.c b/src/plugins/pk-lsof.c
index 356e4ca..940af65 100644
--- a/src/plugins/pk-lsof.c
+++ b/src/plugins/pk-lsof.c
@@ -237,7 +237,7 @@ pk_lsof_refresh (PkLsof *lsof)
break;
/* not a system library */
- if (strstr (value, "/lib/") == NULL)
+ if (strstr (value, "/lib") == NULL)
break;
/* not a shared object */
@@ -293,8 +293,8 @@ pk_lsof_get_pids_for_filenames (PkLsof *lsof, gchar **filenames)
for (i=0; filenames[i] != NULL; i++) {
for (j=0; j < list_data->len; j++) {
data = g_ptr_array_index (list_data, j);
- g_debug ("got %s", data->filename);
- if (g_strcmp0 (filenames[i], data->filename) == 0) {
+ if (g_str_has_prefix (filenames[i], data->filename) == 0 ||
+ g_str_has_prefix (data->filename, filenames[i]) == 0) {
pk_lsof_add_pid (pids, data->pid);
}
}
commit 6d3bd0daf1b7209c51f688d069ed3cb3c1e49854
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Aug 12 01:25:45 2011 +0200
plugin: Make lsof use the '-n' option to avoid looking up hostnames
This makes running lsof a couple of orders of magnitude quicker.
diff --git a/src/plugins/pk-lsof.c b/src/plugins/pk-lsof.c
index 80badaa..356e4ca 100644
--- a/src/plugins/pk-lsof.c
+++ b/src/plugins/pk-lsof.c
@@ -193,7 +193,7 @@ pk_lsof_refresh (PkLsof *lsof)
}
/* run lsof to get all data */
- lsof_cmd = g_strconcat (lsof_name, " ", "-Fpfn", NULL);
+ lsof_cmd = g_strjoin (" ", lsof_name, "-Fpfn", "-n", NULL);
ret = g_spawn_command_line_sync (lsof_cmd, &stdout, &stderr, NULL, &error);
if (!ret) {
g_warning ("failed to get pids: %s", error->message);
commit 5d6419ac83883e4d2161032f65d565df8eb007ac
Author: Fabio Erculiani <lxnay at sabayon.org>
Date: Tue Aug 9 12:48:16 2011 +0200
entropy: properly account package size when "extra" downloads are available
diff --git a/backends/entropy/entropyBackend.py b/backends/entropy/entropyBackend.py
index 02b83a7..fe8c609 100755
--- a/backends/entropy/entropyBackend.py
+++ b/backends/entropy/entropyBackend.py
@@ -244,10 +244,28 @@ class PackageKitEntropyMixin(object):
packages, the on-disk size is returned instead.
"""
pkg_id, c_repo = pkg_match
+ size = 0
if c_repo is self._entropy.installed_repository():
- return c_repo.retrieveOnDiskSize(pkg_id)
+ size += c_repo.retrieveOnDiskSize(pkg_id)
else:
- return c_repo.retrieveSize(pkg_id)
+ size += c_repo.retrieveSize(pkg_id)
+
+ supports_extra_download = hasattr(c_repo, "retrieveExtraDownload")
+ if not supports_extra_download:
+ return size
+
+ cl_id = etpConst['system_settings_plugins_ids']['client_plugin']
+ debug = self._settings[cl_id]['misc']['splitdebug']
+ extra_downloads = c_repo.retrieveExtraDownload(pkg_id)
+ for extra_download in extra_downloads:
+ if (not debug) and (extra_download['type'] == "debug") and \
+ (c_repo is not self._entropy.installed_repository()):
+ continue
+ if c_repo is self._entropy.installed_repository():
+ size += extra_download['disksize']
+ else:
+ size += extra_download['size']
+ return size
def _pk_feed_sorted_pkgs(self, pkgs):
"""
commit 5759bd093cb35c3ef0e57370e3ec474438f845bb
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Aug 5 17:17:07 2011 +0100
Add an 'auto' string for the --with-default-backend= configure option
diff --git a/configure.ac b/configure.ac
index e4d5476..5feaadc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -560,7 +560,7 @@ dnl ---------------------------------------------------------------------------
AC_ARG_WITH([default_backend],
AS_HELP_STRING([--with-default-backend=<option>],
[Default backend to use
- alpm,aptcc,box,conary,dummy,entropy,opkg,pisi,portage,ports,slapt,smart,urpmi,yum,zif,zypp (dummy)]))
+ auto,alpm,aptcc,box,conary,dummy,entropy,opkg,pisi,portage,ports,slapt,smart,urpmi,yum,zif,zypp (dummy)]))
# default to a sane option for the installed tool
if test x$with_default_backend = x; then
if test -f /usr/bin/yum ; then
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 697076a..abc69f9 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -506,6 +506,57 @@ pk_backend_build_library_path (PkBackend *backend, const gchar *name)
}
/**
+ * pk_backend_sort_backends_cb:
+ **/
+static gint
+pk_backend_sort_backends_cb (const gchar **store1,
+ const gchar **store2)
+{
+ return g_strcmp0 (*store2, *store1);
+}
+
+/**
+ * pk_backend_get_auto_array:
+ **/
+static GPtrArray *
+pk_backend_get_auto_array (GError **error)
+{
+ const gchar *tmp;
+ GDir *dir = NULL;
+ GPtrArray *array = NULL;
+
+ dir = g_dir_open (LIBDIR "/packagekit-backend", 0, error);
+ if (dir == NULL)
+ goto out;
+ array = g_ptr_array_new_with_free_func (g_free);
+ do {
+ tmp = g_dir_read_name (dir);
+ if (tmp == NULL)
+ break;
+ if (!g_str_has_suffix (tmp, G_MODULE_SUFFIX))
+ continue;
+ if (g_strstr_len (tmp, -1, "pk_backend_dummy"))
+ continue;
+ if (g_strstr_len (tmp, -1, "pk_backend_test"))
+ continue;
+ g_ptr_array_add (array,
+ g_build_filename (LIBDIR,
+ "packagekit-backend",
+ tmp,
+ NULL));
+ } while (1);
+
+ /* need to sort by id predictably */
+ g_ptr_array_sort (array,
+ (GCompareFunc) pk_backend_sort_backends_cb);
+
+out:
+ if (dir != NULL)
+ g_dir_close (dir);
+ return array;
+}
+
+/**
* pk_backend_set_name:
**/
gboolean
@@ -515,6 +566,7 @@ pk_backend_set_name (PkBackend *backend, const gchar *backend_name, GError **err
gchar *path = NULL;
gboolean ret = FALSE;
gpointer func = NULL;
+ GPtrArray *auto_backends = NULL;
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
g_return_val_if_fail (backend_name != NULL, FALSE);
@@ -525,9 +577,26 @@ pk_backend_set_name (PkBackend *backend, const gchar *backend_name, GError **err
goto out;
}
- /* can we load it? */
+ /* deal with auto */
g_debug ("Trying to load : %s", backend_name);
- path = pk_backend_build_library_path (backend, backend_name);
+ if (g_strcmp0 (backend_name, "auto") == 0) {
+ auto_backends = pk_backend_get_auto_array (error);
+ if (auto_backends == NULL)
+ goto out;
+ if (auto_backends->len == 0) {
+ g_set_error (error, 1, 0,
+ "failed to find any files in %s",
+ LIBDIR "/packagekit-backend");
+ goto out;
+ }
+ /* just pick the last to avoid 'dummy' */
+ path = g_strdup (g_ptr_array_index (auto_backends, 0));
+ g_debug ("using backend 'auto'=>'%s'", path);
+ } else {
+ path = pk_backend_build_library_path (backend, backend_name);
+ }
+
+ /* can we load it? */
handle = g_module_open (path, 0);
if (handle == NULL) {
g_set_error (error, 1, 0, "opening module %s failed : %s",
@@ -614,6 +683,8 @@ pk_backend_set_name (PkBackend *backend, const gchar *backend_name, GError **err
backend->priv->name = g_strdup (backend_name);
backend->priv->handle = handle;
out:
+ if (auto_backends != NULL)
+ g_ptr_array_unref (auto_backends);
g_free (path);
return ret;
}
commit b54d06b3f126af05b625efc4fc23d97c9fc48f4c
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Aug 4 15:54:43 2011 +0100
yum: Ignore missing obsoleted updates rather than failing the update
This should fix upgrading packages that both provide a subpackage and obsolete
the very same subpackage as well.
It appears yum also treats this as a non-fatal error, so turn the error into a
message (which is ignored by the frontends by default).
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 02c3ea9..74b398d 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -2344,9 +2344,9 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
except Exception, e:
self.error(ERROR_INTERNAL_ERROR, _format_str(traceback.format_exc()))
if not txmbr:
- self.error(ERROR_TRANSACTION_ERROR, "could not add package update for %s: %s" % (_format_package_id(package_id), pkg), exit=False)
- return
- txmbrs.extend(txmbr)
+ self.message(MESSAGE_COULD_NOT_FIND_PACKAGE, "could not add package update for %s: %s" % (_format_package_id(package_id), pkg))
+ else:
+ txmbrs.extend(txmbr)
except yum.Errors.RepoError, e:
self.error(ERROR_REPO_NOT_AVAILABLE, _to_unicode(e), exit=False)
except Exception, e:
commit f9f250b0d46ee5833fa35117a295e380550d1bf0
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Aug 2 11:22:34 2011 +0100
qt: Do not dist the moc files, as this causes build failures with newer versions of QT
diff --git a/lib/packagekit-qt/src/Makefile.am b/lib/packagekit-qt/src/Makefile.am
index 82b0df3..ce6c642 100644
--- a/lib/packagekit-qt/src/Makefile.am
+++ b/lib/packagekit-qt/src/Makefile.am
@@ -88,12 +88,11 @@ clean-local:
rm -f $(CLEANFILES)
EXTRA_DIST = \
- $(MOCFILES) \
- dbus_proxies.stamp \
+ dbus_proxies.stamp \
daemonproxy.h \
daemonproxy.cpp \
transactionproxy.h \
- transactionproxy.cpp \
+ transactionproxy.cpp \
$(NULL)
MAINTAINERCLEANFILES = \
diff --git a/lib/packagekit-qt2/Makefile.am b/lib/packagekit-qt2/Makefile.am
index cecfa60..08fdc59 100644
--- a/lib/packagekit-qt2/Makefile.am
+++ b/lib/packagekit-qt2/Makefile.am
@@ -95,7 +95,6 @@ clean-local:
rm -f $(CLEANFILES)
EXTRA_DIST = \
- $(MOCFILES) \
dbus_proxies.stamp \
daemonproxy.h \
daemonproxy.cpp \
commit ad275648841ab1e3f7537edb0fbab6efc03373ae
Author: Daniel Nicoletti <dantti85-pk at yahoo.com.br>
Date: Thu Jul 28 21:12:49 2011 -0300
remove cppunit check as packagekit-qt2 does not use it
diff --git a/configure.ac b/configure.ac
index cdf4901..e4d5476 100644
--- a/configure.ac
+++ b/configure.ac
@@ -335,17 +335,6 @@ AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[enable unit test code]),
AM_CONDITIONAL(EGG_BUILD_TESTS, test x$enable_tests = xyes)
if test x$enable_tests = xyes; then
AC_DEFINE(EGG_BUILD_TESTS,1,[Build test code])
-
- # packagekit-qt needs cppunit and QtGui for tests
- if test x$build_qt = xyes; then
- PKG_CHECK_MODULES(CPPUNIT, cppunit)
- AC_SUBST(CPPUNIT_CFLAGS)
- AC_SUBST(CPPUNIT_LIBS)
-
- PKG_CHECK_MODULES(QTGUI, QtGui >= 4.4.0)
- AC_SUBST(QTGUI_CFLAGS)
- AC_SUBST(QTGUI_LIBS)
- fi
fi
dnl ---------------------------------------------------------------------------
commit e0a2907f96a5058eacc28ae946b07215488a4e27
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jul 28 12:50:49 2011 +0100
trivial: Remove some redundant code when filtering the simulate lists
diff --git a/lib/packagekit-glib2/pk-task.c b/lib/packagekit-glib2/pk-task.c
index 700289e..6bddfc8 100644
--- a/lib/packagekit-glib2/pk-task.c
+++ b/lib/packagekit-glib2/pk-task.c
@@ -305,16 +305,10 @@ pk_task_simulate_ready_cb (GObject *source_object, GAsyncResult *res, PkTaskStat
PkResults *results;
PkPackageSack *sack = NULL;
guint length;
- guint idx = 0;
guint i;
- GPtrArray *array = NULL;
GPtrArray *array_messages = NULL;
- PkPackage *item;
- gboolean ret;
- PkInfoEnum info;
PkMessage *message;
PkMessageEnum message_type;
- const gchar *package_id;
/* old results no longer valid */
if (state->results != NULL)
@@ -371,7 +365,7 @@ pk_task_simulate_ready_cb (GObject *source_object, GAsyncResult *res, PkTaskStat
/* get data */
sack = pk_results_get_package_sack (results);
- /* remove all the cleanup and finished packages */
+ /* remove all the packages we want to ignore */
pk_package_sack_remove_by_filter (sack, pk_task_package_filter_cb, state);
/* remove all the original packages from the sack */
@@ -381,43 +375,6 @@ pk_task_simulate_ready_cb (GObject *source_object, GAsyncResult *res, PkTaskStat
pk_package_sack_remove_package_by_id (sack, state->package_ids[i]);
}
- /* remove packages from the array that will not be useful */
- if (state->package_ids != NULL) {
- array = pk_results_get_package_array (results);
- while (idx < array->len) {
- item = g_ptr_array_index (array, idx);
- package_id = pk_package_get_id (item);
- g_object_get (item,
- "info", &info,
- NULL);
-
- /* remove all the cleanup and finished packages */
- if (info == PK_INFO_ENUM_CLEANUP ||
- info == PK_INFO_ENUM_FINISHED) {
- g_debug ("removing %s", package_id);
- g_ptr_array_remove (array, item);
- continue;
- }
-
- /* remove all the original packages */
- ret = FALSE;
- length = g_strv_length (state->package_ids);
- for (i=0; i<length; i++) {
- if (g_strcmp0 (package_id, state->package_ids[i]) == 0) {
- g_debug ("removing %s", package_id);
- g_ptr_array_remove (array, item);
- ret = TRUE;
- break;
- }
- }
- if (ret)
- continue;
-
- /* no removal done */
- idx++;
- }
- }
-
/* no results from simulate */
if (pk_package_sack_get_size (sack) == 0) {
pk_task_do_async_action (state);
@@ -430,8 +387,6 @@ pk_task_simulate_ready_cb (GObject *source_object, GAsyncResult *res, PkTaskStat
/* run the callback */
klass->simulate_question (state->task, state->request, state->results);
out:
- if (array != NULL)
- g_ptr_array_unref (array);
if (array_messages != NULL)
g_ptr_array_unref (array_messages);
if (results != NULL)
commit 13eb70467a69c12f7feed47c7f53ffd8fb0de24e
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jul 28 12:48:54 2011 +0100
Ignore local packages when calculating the simulate list
diff --git a/lib/packagekit-glib2/pk-task.c b/lib/packagekit-glib2/pk-task.c
index 067385b..700289e 100644
--- a/lib/packagekit-glib2/pk-task.c
+++ b/lib/packagekit-glib2/pk-task.c
@@ -289,6 +289,8 @@ pk_task_package_filter_cb (PkPackage *package, gpointer user_data)
info == PK_INFO_ENUM_UNTRUSTED ||
info == PK_INFO_ENUM_FINISHED)
return FALSE;
+ if (g_strcmp0 (pk_package_get_data (package), "local") == 0)
+ return FALSE;
return TRUE;
}
commit 8d823ff9da7c5718207ac2cabf4dfe0e234072b3
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jul 28 12:48:24 2011 +0100
Ignore untrusted packages when calculating the simulate list
diff --git a/lib/packagekit-glib2/pk-task.c b/lib/packagekit-glib2/pk-task.c
index 42f8c97..067385b 100644
--- a/lib/packagekit-glib2/pk-task.c
+++ b/lib/packagekit-glib2/pk-task.c
@@ -286,6 +286,7 @@ pk_task_package_filter_cb (PkPackage *package, gpointer user_data)
PkInfoEnum info;
info = pk_package_get_info (package);
if (info == PK_INFO_ENUM_CLEANUP ||
+ info == PK_INFO_ENUM_UNTRUSTED ||
info == PK_INFO_ENUM_FINISHED)
return FALSE;
return TRUE;
commit 8fbffc243570f2692f5aaa39b153b571cbe4abad
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jul 28 12:06:20 2011 +0100
yum: Emit Package(Untrusted) for each package that is untrusted in the transaction
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 5c2800a..02c3ea9 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -2184,6 +2184,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
self.error(ERROR_MISSING_GPG_SIGNATURE, _to_unicode(e), exit=False)
return
self.message (MESSAGE_UNTRUSTED_PACKAGE, "The package %s is untrusted" % po.name)
+ self._show_package(po, INFO_UNTRUSTED)
except exceptions.IOError, e:
self.error(ERROR_NO_SPACE_ON_DEVICE, "Disk error: %s" % _to_unicode(e))
except Exception, e:
commit ec3f39a80d2ee94e13584e2a5b33c6dd45da2c4f
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jul 28 12:06:04 2011 +0100
zif: Emit Package(Untrusted) for each package that is untrusted in the transaction
This will allow us to show the packages that are unsigned in any UI.
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 74d9b64..7d2f118 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -3468,6 +3468,7 @@ pk_backend_run_transaction (PkBackend *backend, ZifState *state)
gboolean simulate;
GError *error = NULL;
GPtrArray *array_tmp;
+ GPtrArray *untrusted_array = NULL;
GPtrArray *install = NULL;
GPtrArray *simulate_array = NULL;
guint i, j;
@@ -3535,6 +3536,12 @@ pk_backend_run_transaction (PkBackend *backend, ZifState *state)
package = g_ptr_array_index (install, i);
trust_kind = zif_package_get_trust_kind (package);
if (trust_kind != ZIF_PACKAGE_TRUST_KIND_PUBKEY) {
+ /* TODO: make a proper property */
+ g_object_set_data (G_OBJECT(package),
+ "kind",
+ (gpointer)pk_info_enum_to_string (PK_INFO_ENUM_UNTRUSTED));
+ g_ptr_array_add (untrusted_array,
+ package);
/* ignore the trusted auth step */
pk_backend_message (backend,
@@ -3543,6 +3550,10 @@ pk_backend_run_transaction (PkBackend *backend, ZifState *state)
zif_package_get_printable (package));
}
}
+ state_local = zif_state_get_child (state);
+ pk_backend_emit_package_array (backend,
+ untrusted_array,
+ state_local);
/* this section done */
ret = zif_state_done (state, &error);
@@ -3655,6 +3666,8 @@ pk_backend_run_transaction (PkBackend *backend, ZifState *state)
goto out;
}
out:
+ if (untrusted_array != NULL)
+ g_ptr_array_unref (untrusted_array);
if (simulate_array != NULL)
g_ptr_array_unref (simulate_array);
if (install != NULL)
commit 366cd5694e28397e139bff7752ed63a68fc337db
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jul 28 12:02:46 2011 +0100
zif: Emit Message(UntrustedPackage) to sometimes skip the trusted authentication
This means we go straight to the untrusted authentication after the simulate
has completed.
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 7a143d7..74d9b64 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -3481,14 +3481,16 @@ pk_backend_run_transaction (PkBackend *backend, ZifState *state)
if (simulate) {
ret = zif_state_set_steps (state,
NULL,
- 95, /* resolve */
+ 94, /* resolve */
+ 1, /* check trusted */
5, /* print packages */
-1);
} else {
ret = zif_state_set_steps (state,
NULL,
30, /* resolve */
- 30, /* prepare */
+ 1, /* check trusted */
+ 29, /* prepare */
40, /* commit */
-1);
}
@@ -3526,6 +3528,33 @@ pk_backend_run_transaction (PkBackend *backend, ZifState *state)
goto out;
}
+ /* mark any untrusted packages */
+ install = zif_transaction_get_install (priv->transaction);
+ untrusted_array = g_ptr_array_new ();
+ for (i=0; i<install->len; i++) {
+ package = g_ptr_array_index (install, i);
+ trust_kind = zif_package_get_trust_kind (package);
+ if (trust_kind != ZIF_PACKAGE_TRUST_KIND_PUBKEY) {
+
+ /* ignore the trusted auth step */
+ pk_backend_message (backend,
+ PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE,
+ "The package %s is untrusted",
+ zif_package_get_printable (package));
+ }
+ }
+
+ /* this section done */
+ ret = zif_state_done (state, &error);
+ if (!ret) {
+ pk_backend_error_code (backend,
+ PK_ERROR_ENUM_TRANSACTION_CANCELLED,
+ "cancelled: %s",
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+
/* list the packages in the transaction */
if (simulate) {
simulate_array = zif_object_array_new ();
@@ -3576,7 +3605,6 @@ pk_backend_run_transaction (PkBackend *backend, ZifState *state)
/* check if any are not trusted */
only_trusted = pk_backend_get_bool (backend, "only_trusted");
if (only_trusted) {
- install = zif_transaction_get_install (priv->transaction);
for (i=0; i<install->len; i++) {
package = g_ptr_array_index (install, i);
trust_kind = zif_package_get_trust_kind (package);
commit bd0e9628cc623176b26119a0bcc60878cfbd2872
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jul 28 11:56:18 2011 +0100
zif: Use the shared version for newest filtering
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index fdff5ac..7a143d7 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -412,65 +412,6 @@ out:
}
/**
- * pk_backend_filter_package_array_newest:
- *
- * This function needs to scale well, and be fast to process 50,000
- * packages in less than one second. If it looks overcomplicated, it's
- * because it needs to be O(n) not O(n*n).
- **/
-static gboolean
-pk_backend_filter_package_array_newest (GPtrArray *array)
-{
- gchar *key;
- GHashTable *hash;
- gint retval;
- guint i;
- ZifPackage *found;
- ZifPackage *package;
-
- /* as an indexed hash table for speed */
- hash = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- g_object_unref);
-
- for (i=0; i<array->len; i++) {
-
- /* generate enough data to be specific */
- package = g_ptr_array_index (array, i);
- key = g_strdup_printf ("%s-%s-%i",
- zif_package_get_name (package),
- zif_package_get_arch (package),
- zif_package_is_installed (package));
-
- /* we've not already come across this package */
- found = g_hash_table_lookup (hash, key);
- if (found == NULL) {
- g_hash_table_insert (hash, key, g_object_ref (package));
- continue;
- }
-
- /* compare one package vs the other package */
- retval = zif_package_compare (package, found);
-
- /* the package is older than the one we have stored */
- if (retval <= 0) {
- g_free (key);
- g_ptr_array_remove (array, package);
- continue;
- }
-
- /* the package is newer than what we have stored,
- * delete the old store, and add this one */
- g_hash_table_remove (hash, found);
- g_hash_table_insert (hash, key, g_object_ref (package));
- }
-
- g_hash_table_unref (hash);
- return TRUE;
-}
-
-/**
* pk_backend_filter_package_array:
**/
static GPtrArray *
@@ -547,7 +488,7 @@ pk_backend_filter_package_array (GPtrArray *array, PkBitfield filters)
/* do newest filtering */
if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NEWEST))
- pk_backend_filter_package_array_newest (result);
+ zif_package_array_filter_newest (result);
return result;
}
commit 6d953614436d0b2d3faf0087aa0636b055a21286
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jul 28 11:53:36 2011 +0100
Add an untrusted section header when using console applications
diff --git a/lib/packagekit-glib2/pk-task-text.c b/lib/packagekit-glib2/pk-task-text.c
index ae91094..daece3a 100644
--- a/lib/packagekit-glib2/pk-task-text.c
+++ b/lib/packagekit-glib2/pk-task-text.c
@@ -320,6 +320,11 @@ pk_task_text_simulate_question_type_to_string (PkInfoEnum info)
return _("The following packages have to be downgraded:");
}
+ if (info == PK_INFO_ENUM_UNTRUSTED) {
+ /* TRANSLATORS: When processing, untrusted and non-verified packages may be encountered */
+ return _("The following packages are untrusted:");
+ }
+
/* do not show */
return NULL;
}
commit eff456e80014ef8ce5de03a4c5c5941b296cb383
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jul 28 10:11:25 2011 +0100
Do not try to assign a GVariant string with NULL
This won't work until we have 'maybe' types, but that's not possible until we
have https://bugs.freedesktop.org/show_bug.cgi?id=27857 fixed in DBus and then
rolled out to distros.
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 3089c02..6b8fef7 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -515,10 +515,10 @@ pk_transaction_details_cb (PkBackend *backend,
"Details",
g_variant_new ("(ssssst)",
package_id,
- license,
+ license != NULL ? license : "",
group_text,
- description,
- url,
+ description != NULL ? description : "",
+ url != NULL ? url : "",
size),
NULL);
@@ -658,7 +658,7 @@ pk_transaction_category_cb (PkBackend *backend,
cat_id,
name,
summary,
- icon),
+ icon != NULL ? icon : ""),
NULL);
g_free (parent_id);
g_free (cat_id);
@@ -705,7 +705,7 @@ pk_transaction_distro_upgrade_cb (PkBackend *backend,
g_variant_new ("(sss)",
type_text,
name,
- summary),
+ summary != NULL ? summary : ""),
NULL);
g_free (name);
@@ -1331,7 +1331,7 @@ pk_transaction_repo_detail_cb (PkBackend *backend,
"RepoDetail",
g_variant_new ("(ssb)",
repo_id,
- description,
+ description != NULL ? description : "",
enabled),
NULL);
g_free (repo_id);
@@ -1387,11 +1387,11 @@ pk_transaction_repo_signature_required_cb (PkBackend *backend,
g_variant_new ("(ssssssss)",
package_id,
repository_name,
- key_url,
- key_userid,
- key_id,
- key_fingerprint,
- key_timestamp,
+ key_url != NULL ? key_url : "",
+ key_userid != NULL ? key_userid : "",
+ key_id != NULL ? key_id : "",
+ key_fingerprint != NULL ? key_fingerprint : "",
+ key_timestamp != NULL ? key_timestamp : "",
type_text),
NULL);
@@ -1445,8 +1445,8 @@ pk_transaction_eula_required_cb (PkBackend *backend,
g_variant_new ("(ssss)",
eula_id,
package_id,
- vendor_name,
- license_agreement),
+ vendor_name != NULL ? vendor_name : "",
+ license_agreement != NULL ? license_agreement : ""),
NULL);
/* we should mark this transaction so that we finish with a special code */
@@ -1496,7 +1496,7 @@ pk_transaction_media_change_required_cb (PkBackend *backend,
g_variant_new ("(sss)",
media_type_text,
media_id,
- media_text),
+ media_text != NULL ? media_text : ""),
NULL);
/* we should mark this transaction so that we finish with a special code */
@@ -1649,9 +1649,9 @@ pk_transaction_transaction_cb (PkTransactionDb *tdb,
succeeded,
role_text,
duration,
- data,
+ data != NULL ? data : "",
uid,
- cmdline),
+ cmdline != NULL ? cmdline : ""),
NULL);
g_free (tid);
g_free (timespec);
@@ -1715,17 +1715,17 @@ pk_transaction_update_detail_cb (PkBackend *backend,
"UpdateDetail",
g_variant_new ("(ssssssssssss)",
package_id,
- updates,
- obsoletes,
- vendor_url,
- bugzilla_url,
- cve_url,
+ updates != NULL ? updates : "",
+ obsoletes != NULL ? obsoletes : "",
+ vendor_url != NULL ? vendor_url : "",
+ bugzilla_url != NULL ? bugzilla_url : "",
+ cve_url != NULL ? cve_url : "",
restart_text,
- update_text,
- changelog,
+ update_text != NULL ? update_text : "",
+ changelog != NULL ? changelog : "",
state_text,
- issued,
- updated),
+ issued != NULL ? issued : "",
+ updated != NULL ? updated : ""),
NULL);
g_free (package_id);
commit 2316fd605894216930619345e96af4949f9443d8
Author: Duncan Mac-Vicar P <dmacvicar at suse.de>
Date: Tue Jul 26 11:21:37 2011 +0200
dont call build pool inside the loop
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 3a783ad..05cf9e8 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -181,13 +181,12 @@ backend_get_requires_thread (PkBackend *backend)
//pk_backend_set_percentage (backend, 0);
PoolStatusSaver saver;
+ ResPool pool = zypp_build_pool (backend, true);
for (uint i = 0; package_ids[i]; i++) {
sat::Solvable solvable = zypp_get_package_by_id (backend, package_ids[i]);
PoolItem package;
if (solvable.isSystem ()) {
- ResPool pool = zypp_build_pool (backend, true);
-
gboolean found = FALSE;
gchar **id_parts = pk_package_id_split (package_ids[i]);
commit 31923cb948c4fcce9de137f0b33f37c94fa87b5f
Author: Duncan Mac-Vicar P <dmacvicar at suse.de>
Date: Tue Jul 26 11:20:51 2011 +0200
only load repositories once
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index 5363427..09042ec 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -195,8 +195,11 @@ zypp_is_valid_repo (PkBackend *backend, RepoInfo repo)
ResPool
zypp_build_pool (PkBackend *backend, gboolean include_local)
{
+ static gboolean repos_loaded = FALSE;
+
ZYpp::Ptr zypp = get_zypp (backend);
+ // the target is loaded or unloaded on request
if (include_local) {
// FIXME have to wait for fix in zypp (repeated loading of target)
if (sat::Pool::instance().reposFind( sat::Pool::systemRepoAlias() ).solvablesEmpty ())
@@ -214,6 +217,10 @@ zypp_build_pool (PkBackend *backend, gboolean include_local)
}
}
+ // we only load repositories once.
+ if (repos_loaded)
+ return zypp->pool();
+
// Add resolvables from enabled repos
RepoManager manager;
try {
@@ -231,7 +238,9 @@ zypp_build_pool (PkBackend *backend, gboolean include_local)
//FIXME see above, skip already cached repos
if (sat::Pool::instance().reposFind( repo.alias ()) == Repository::noRepository)
manager.loadFromCache (repo);
+
}
+ repos_loaded = true;
} catch (const repo::RepoNoAliasException &ex) {
g_error ("Can't figure an alias to look in cache");
} catch (const repo::RepoNotCachedException &ex) {
commit 170c7911df1eb1d533c0c90fac1c185d772371a2
Author: Duncan Mac-Vicar P <dmacvicar at suse.de>
Date: Mon Jul 25 17:20:28 2011 +0200
refactor the private static data into one structure
diff --git a/backends/zypp/Makefile.am b/backends/zypp/Makefile.am
index fe5fec8..4465910 100644
--- a/backends/zypp/Makefile.am
+++ b/backends/zypp/Makefile.am
@@ -14,7 +14,8 @@ libpk_backend_zypp_la_CPPFLAGS = $(PK_PLUGIN_CFLAGS) $(ZYPP_CFLAGS) -Wno-depreca
EXTRA_DIST = \
zypp-utils.h \
- zypp-events.h
+ zypp-events.h \
+ pk-backend-zypp-private.h
-include $(top_srcdir)/git.mk
diff --git a/backends/zypp/pk-backend-zypp-private.h b/backends/zypp/pk-backend-zypp-private.h
new file mode 100644
index 0000000..fc99660
--- /dev/null
+++ b/backends/zypp/pk-backend-zypp-private.h
@@ -0,0 +1,24 @@
+
+#ifndef PK_BACKEND_ZYPP_PRIVATE_H
+#define PK_BACKEND_ZYPP_PRIVATE_H
+
+#include <map>
+#include <string>
+#include <vector>
+
+class EventDirector;
+
+typedef struct {
+
+ /**
+ * A map to keep track of the EventDirector objects for
+ * each zypp backend that is created.
+ */
+ std::map<PkBackend *, EventDirector *> eventDirectors;
+ std::map<PkBackend *, std::vector<std::string> *> signatures;
+
+ EventDirector *eventDirector;
+
+} PkBackendZYppPrivate;
+
+#endif
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 0710f54..3a783ad 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -27,6 +27,8 @@
#include <unistd.h>
#include <string>
#include <set>
+#include <map>
+#include <list>
#include <glib/gi18n.h>
#include <sys/vfs.h>
@@ -61,12 +63,16 @@
#include <zypp/sat/Solvable.h>
-#include <map>
-#include <list>
+#include "pk-backend-zypp-private.h"
#include "zypp-utils.h"
#include "zypp-events.h"
+using namespace std;
+using namespace zypp;
+
+PkBackendZYppPrivate *priv = 0L;
+
enum PkgSearchType {
SEARCH_TYPE_NAME = 0,
SEARCH_TYPE_DETAILS = 1,
@@ -74,17 +80,6 @@ enum PkgSearchType {
SEARCH_TYPE_RESOLVE = 3
};
-using namespace std;
-using namespace zypp;
-
-/**
- * A map to keep track of the EventDirector objects for
- * each zypp backend that is created.
- */
-static map<PkBackend *, EventDirector *> _eventDirectors;
-
-map<PkBackend *, vector<string> *> _signatures;
-
// helper function to restore the pool status
// after doing operations on it
class PoolStatusSaver : private base::NonCopyable
@@ -129,14 +124,15 @@ pk_backend_get_author (PkBackend *backend)
void
pk_backend_initialize (PkBackend *backend)
{
+ /* create private area */
+ priv = new PkBackendZYppPrivate;
zypp_logging ();
-// disabled get_zypp() - too slow for a dbus timeout after zypper clean -a
g_debug ("zypp_backend_initialize");
EventDirector *eventDirector = new EventDirector (backend);
- _eventDirectors [backend] = eventDirector;
- vector<string> *signature = new vector<string> ();
- _signatures [backend] = signature;
- _updating_self = FALSE;
+ priv->eventDirectors[backend] = eventDirector;
+ vector<string> *signature = new vector<string>();
+ priv->signatures[backend] = signature;
+ //_updating_self = FALSE;
}
/**
@@ -148,13 +144,12 @@ pk_backend_destroy (PkBackend *backend)
{
g_debug ("zypp_backend_destroy");
- delete (_eventDirectors [backend]);
- _eventDirectors.erase (backend);
-
- delete (_signatures[backend]);
- _signatures.erase (backend);
-
+ delete priv->eventDirectors [backend];
+ priv->eventDirectors.erase(backend);
+ delete priv->signatures[backend];
+ priv->signatures.erase(backend);
g_free (_repoName);
+ delete priv;
}
/**
@@ -1202,7 +1197,7 @@ backend_install_signature_thread (PkBackend *backend)
pk_backend_set_status (backend, PK_STATUS_ENUM_SIG_CHECK);
const gchar *key_id = pk_backend_get_string (backend, "key_id");
const gchar *package_id = pk_backend_get_string (backend, "package_id");
- _signatures[backend]->push_back ((string)(key_id));
+ priv->signatures[backend]->push_back ((string)(key_id));
pk_backend_finished (backend);
return TRUE;
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index fa00de9..5363427 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -59,6 +59,7 @@
#define I_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE
#include <packagekit-glib2/packagekit.h>
+#include "pk-backend-zypp-private.h"
#include "zypp-utils.h"
gchar * _repoName;
@@ -68,6 +69,8 @@ using namespace std;
using namespace zypp;
using zypp::filesystem::PathInfo;
+extern PkBackendZYppPrivate *priv;
+
/**
* Initialize Zypp (Factory method)
*/
@@ -487,7 +490,7 @@ zypp_signature_required (PkBackend *backend, const PublicKey &key)
{
gboolean ok = FALSE;
- if (find (_signatures[backend]->begin (), _signatures[backend]->end (), key.id ()) == _signatures[backend]->end ()) {
+ if (find (priv->signatures[backend]->begin (), priv->signatures[backend]->end (), key.id ()) == priv->signatures[backend]->end ()) {
RepoInfo info = zypp_get_Repository (backend, _repoName);
if (info.type () == repo::RepoType::NONE)
pk_backend_error_code (backend, PK_ERROR_ENUM_INTERNAL_ERROR,
@@ -517,7 +520,7 @@ zypp_signature_required (PkBackend *backend, const string &file, const string &i
{
gboolean ok = FALSE;
- if (find (_signatures[backend]->begin (), _signatures[backend]->end (), id) == _signatures[backend]->end ()) {
+ if (find (priv->signatures[backend]->begin (), priv->signatures[backend]->end (), id) == priv->signatures[backend]->end ()) {
RepoInfo info = zypp_get_Repository (backend, _repoName);
if (info.type () == repo::RepoType::NONE)
pk_backend_error_code (backend, PK_ERROR_ENUM_INTERNAL_ERROR,
@@ -547,7 +550,7 @@ zypp_signature_required (PkBackend *backend, const string &file)
{
gboolean ok = FALSE;
- if (find (_signatures[backend]->begin (), _signatures[backend]->end (), file) == _signatures[backend]->end ()) {
+ if (find (priv->signatures[backend]->begin (), priv->signatures[backend]->end (), file) == priv->signatures[backend]->end ()) {
RepoInfo info = zypp_get_Repository (backend, _repoName);
if (info.type () == repo::RepoType::NONE)
pk_backend_error_code (backend, PK_ERROR_ENUM_INTERNAL_ERROR,
diff --git a/backends/zypp/zypp-utils.h b/backends/zypp/zypp-utils.h
index cc803f5..fedef2e 100644
--- a/backends/zypp/zypp-utils.h
+++ b/backends/zypp/zypp-utils.h
@@ -60,11 +60,6 @@ typedef enum {
UPDATE
} PerformType;
-/**
- * A map to store the signatures which were accepted for each backend
- */
-extern std::map<PkBackend *, std::vector<std::string> *> _signatures;
-
/** Used to show/install only an update to ourself. This way if we find a critical bug
* in the way we update packages we will install the fix before any other updates.
*/
commit 1b2db06aab8a5d8475ad02f46f0952e7ad5b503d
Author: Duncan Mac-Vicar P <dmacvicar at suse.de>
Date: Sat Jul 23 03:32:50 2011 +0200
Just use the iterator instead of so many temps
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index a47d719..fa00de9 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -213,10 +213,8 @@ zypp_build_pool (PkBackend *backend, gboolean include_local)
// Add resolvables from enabled repos
RepoManager manager;
- list<RepoInfo> repos;
try {
- repos = list<RepoInfo>(manager.repoBegin(),manager.repoEnd());
- for (list<RepoInfo>::iterator it = repos.begin(); it != repos.end (); it++) {
+ for (RepoManager::RepoConstIterator it = manager.repoBegin(); it != manager.repoEnd(); it++) {
RepoInfo repo (*it);
// skip disabled repos
commit cf65ba285d546e4bbe981d364b0b111fc142bc89
Author: Duncan Mac-Vicar P <dmacvicar at suse.de>
Date: Sat Jul 23 03:31:53 2011 +0200
Do not rebuild the pool on every call to find package by name
causing slowness when getting the update list (bnc#679650)
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index 96841c1..a47d719 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -352,7 +352,7 @@ zypp_get_packages_by_name (PkBackend *backend,
vector<sat::Solvable> &result,
gboolean include_local)
{
- ResPool pool = zypp_build_pool (backend, include_local);
+ ResPool pool(ResPool::instance());
for (ResPool::byIdent_iterator it = pool.byIdentBegin (kind, package_name);
it != pool.byIdentEnd (kind, package_name); it++) {
commit 260cd58da6689115a377aa44381892777e9c7381
Author: Duncan Mac-Vicar P <dmacvicar at suse.de>
Date: Sat Jul 23 03:25:34 2011 +0200
Replace egg-string.h with pk-shared.h functions
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 85b7cbb..0710f54 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -23,6 +23,7 @@
#include <glib.h>
#include <pk-backend.h>
#include <pk-backend-spawn.h>
+#include <pk-shared.h>
#include <unistd.h>
#include <string>
#include <set>
@@ -2179,13 +2180,13 @@ pk_backend_transaction_start (PkBackend *backend)
gchar *pac;
locale = pk_backend_get_locale(backend);
- if (!egg_strzero (locale)) {
+ if (!pk_strzero (locale)) {
setlocale(LC_ALL, locale);
}
/* http_proxy */
proxy_http = pk_backend_get_proxy_http (backend);
- if (!egg_strzero (proxy_http)) {
+ if (!pk_strzero (proxy_http)) {
uri = pk_backend_spawn_convert_uri (proxy_http);
g_setenv ("http_proxy", uri, TRUE);
g_free (uri);
@@ -2193,7 +2194,7 @@ pk_backend_transaction_start (PkBackend *backend)
/* https_proxy */
proxy_https = pk_backend_get_proxy_https (backend);
- if (!egg_strzero (proxy_https)) {
+ if (!pk_strzero (proxy_https)) {
uri = pk_backend_spawn_convert_uri (proxy_https);
g_setenv ("https_proxy", uri, TRUE);
g_free (uri);
@@ -2201,7 +2202,7 @@ pk_backend_transaction_start (PkBackend *backend)
/* ftp_proxy */
proxy_ftp = pk_backend_get_proxy_ftp (backend);
- if (!egg_strzero (proxy_ftp)) {
+ if (!pk_strzero (proxy_ftp)) {
uri = pk_backend_spawn_convert_uri (proxy_ftp);
g_setenv ("ftp_proxy", uri, TRUE);
g_free (uri);
@@ -2209,7 +2210,7 @@ pk_backend_transaction_start (PkBackend *backend)
/* socks_proxy */
proxy_socks = pk_backend_get_proxy_socks (backend);
- if (!egg_strzero (proxy_socks)) {
+ if (!pk_strzero (proxy_socks)) {
uri = pk_backend_spawn_convert_uri (proxy_socks);
g_setenv ("socks_proxy", uri, TRUE);
g_free (uri);
@@ -2217,13 +2218,13 @@ pk_backend_transaction_start (PkBackend *backend)
/* no_proxy */
no_proxy = pk_backend_get_no_proxy (backend);
- if (!egg_strzero (no_proxy)) {
+ if (!pk_strzero (no_proxy)) {
g_setenv ("no_proxy", no_proxy, TRUE);
}
/* pac */
pac = pk_backend_get_pac (backend);
- if (!egg_strzero (pac)) {
+ if (!pk_strzero (pac)) {
uri = pk_backend_spawn_convert_uri (pac);
g_setenv ("pac", uri, TRUE);
g_free (uri);
commit 2daa103ef836ec767daf839da7298f2b94a74988
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Jul 22 09:08:35 2011 +0100
trivial: fix the PackageKit build on Debian by not relying on implicit linking of gio-2.0
diff --git a/configure.ac b/configure.ac
index f822bd9..cdf4901 100644
--- a/configure.ac
+++ b/configure.ac
@@ -408,7 +408,7 @@ dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE(gstreamer_plugin, AS_HELP_STRING([--enable-gstreamer-plugin],[Build gstreamer plugin functionality]),
enable_gstreamer_plugin=$enableval,enable_gstreamer_plugin=yes)
if test x$enable_gstreamer_plugin = xyes; then
- PKG_CHECK_MODULES(PK_GSTREAMER_PLUGIN, gstreamer-0.10 gstreamer-plugins-base-0.10 glib-2.0,
+ PKG_CHECK_MODULES(PK_GSTREAMER_PLUGIN, gstreamer-0.10 gstreamer-plugins-base-0.10 glib-2.0 gio-2.0,
build_gstreamer_plugin=yes, build_gstreamer_plugin=no)
else
build_gstreamer_plugin=no
@@ -421,7 +421,7 @@ dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE(gtk_module, AS_HELP_STRING([--enable-gtk-module],[Build GTK+-3 module functionality]),
enable_gtk_module=$enableval,enable_gtk_module=yes)
if test x$enable_gtk_module = xyes; then
- PKG_CHECK_MODULES(PK_GTK_MODULE, gtk+-3.0 >= 3.0.0 pangoft2 fontconfig,
+ PKG_CHECK_MODULES(PK_GTK_MODULE, gtk+-3.0 >= 3.0.0 pangoft2 fontconfig gio-2.0,
build_gtk_module=yes, build_gtk_module=no)
else
build_gtk_module=no
commit 1f8289d256e07e89d09fc7a0d20c4f3ef9da7bb1
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Jul 20 15:30:47 2011 +0100
Require a new version of automake, and make configure.in sane again
diff --git a/Makefile.am b/Makefile.am
index a440e21..bac22d1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -32,22 +32,15 @@ MAINTAINERCLEANFILES = \
$(srcdir)/ABOUT-NLS \
$(srcdir)/aclocal.m4 \
$(srcdir)/autoscan.log \
- $(srcdir)/compile \
- $(srcdir)/config.guess \
+ $(srcdir)/build-aux \
$(srcdir)/config.rpath \
$(srcdir)/config.h.in \
- $(srcdir)/config.sub \
$(srcdir)/configure.scan \
- $(srcdir)/depcomp \
- $(srcdir)/install-sh \
- $(srcdir)/ltmain.sh \
- $(srcdir)/missing \
$(srcdir)/mkinstalldirs \
$(srcdir)/omf.make \
$(srcdir)/xmldocs.make \
$(srcdir)/gtk-doc.make \
$(srcdir)/ChangeLog \
- $(srcdir)/py-compile \
`find "$(srcdir)" -type f -name Makefile -print` \
`find "$(srcdir)" -type f -name Makefile.in -print` \
`find "$(srcdir)" -type f -name *.pyc -print`
diff --git a/configure.ac b/configure.ac
index 556f2c3..f822bd9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,4 @@
-# Copyright (C) 2007-2009 Richard Hughes <richard at hughsie.com>
-AC_PREREQ(2.63)
+# Copyright (C) 2007-2011 Richard Hughes <richard at hughsie.com>
m4_define([pk_major_version], [0])
m4_define([pk_minor_version], [7])
@@ -7,16 +6,25 @@ m4_define([pk_micro_version], [0])
m4_define([pk_version],
[pk_major_version.pk_minor_version.pk_micro_version])
-AC_INIT([PackageKit],[pk_version],[richard at hughsie.com],[PackageKit])
-AC_CONFIG_SRCDIR(src)
-AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-xz tar-ustar])
+AC_PREREQ(2.63)
+AC_INIT([PackageKit],
+ [pk_version],
+ [richard at hughsie.com],
+ [PackageKit],
+ [http://www.packagekit.org/])
+
AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_SRCDIR([src])
AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_AUX_DIR([build-aux])
-GOBJECT_INTROSPECTION_CHECK([0.9.8])
+AM_INIT_AUTOMAKE([1.11 -Wno-portability no-dist-gzip dist-xz tar-ustar])
+AM_MAINTAINER_MODE([enable])
# enable nice build output on automake1.11
-m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
+AM_SILENT_RULES([yes])
+
+GOBJECT_INTROSPECTION_CHECK([0.9.9])
PK_MAJOR_VERSION=pk_major_version
PK_MINOR_VERSION=pk_minor_version
@@ -57,9 +65,11 @@ AC_PROG_CXX
AC_PROG_INSTALL
AC_SEARCH_LIBS([strerror],[cposix])
AC_HEADER_STDC
-LT_INIT
AM_PROG_CC_C_O
+# Initialize libtool
+LT_INIT
+
# Internationalisation
IT_PROG_INTLTOOL([0.35.0])
GETTEXT_PACKAGE=PackageKit
@@ -68,7 +78,7 @@ AM_GLIB_GNU_GETTEXT
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
# set up gtk-doc
-GTK_DOC_CHECK(1.9)
+GTK_DOC_CHECK([1.11],[--flavour no-tmpl])
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
commit 2b02db28d82bcbe36846183fdf02cd3da68cfba5
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Jul 20 15:16:07 2011 +0100
Raise the PolicyKit required version to 0.98 and drop the compat code
diff --git a/configure.ac b/configure.ac
index f79ef1a..556f2c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -149,7 +149,7 @@ GIO_REQUIRED=2.16.1
DBUS_REQUIRED=1.1.1
DBUS_GLIB_REQUIRED=0.74
NETWORK_MANAGER_REQUIRED=0.6.4
-POLKIT_GOBJECT_REQUIRED=0.92
+POLKIT_GOBJECT_REQUIRED=0.98
QTCORE_REQUIRED=4.4.0
QTDBUS_REQUIRED=4.4.0
QTSQL_REQUIRED=4.4.0
@@ -542,28 +542,9 @@ AC_DEFINE_UNQUOTED(security_framework, "$with_security_framework", [default secu
AC_SUBST(security_framework, "$with_security_framework")
if test x$with_security_framework = xpolkit; then
- # polkit >= 0.97 uses polkit_authority_get_sync() rather than
- # polkit_authority_get
PKG_CHECK_MODULES(POLKIT, \
polkit-backend-1 \
- polkit-gobject-1 >= 0.97,
- has_new_polkit=yes,
- has_new_polkit=no)
- if test x$has_new_polkit = xno; then
- PKG_CHECK_MODULES(POLKIT, \
- polkit-backend-1 \
- polkit-gobject-1 >= $POLKIT_GOBJECT_REQUIRED)
- else
- AC_DEFINE(USE_SECURITY_POLKIT_NEW, 1, [if we should use the new PolicyKit API])
- save_CFLAGS="$CFLAGS"
- save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $POLKIT_CFLAGS"
- LIBS="$LIBS $POLKIT_LIBS"
- # check for symbol, if using a pre-release polkit 0.97
- AC_CHECK_FUNCS(polkit_authority_get_sync)
- CFLAGS="$save_CFLAGS"
- LIBS="$save_LIBS"
- fi
+ polkit-gobject-1 >= $POLKIT_GOBJECT_REQUIRED)
AC_DEFINE(USE_SECURITY_POLKIT, 1, [if we should use PolicyKit])
elif test x$with_security_framework = xdummy; then
AC_DEFINE(USE_SECURITY_DUMMY, 1, [if we should use a dummy security framework])
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 8a3868c..15159c7 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2007-2009 Richard Hughes <richard at hughsie.com>
+ * Copyright (C) 2007-2011 Richard Hughes <richard at hughsie.com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -1723,15 +1723,11 @@ pk_engine_init (PkEngine *engine)
#ifdef USE_SECURITY_POLKIT
/* protect the session SetProxy with a PolicyKit action */
-#if defined(USE_SECURITY_POLKIT_NEW) && defined(HAVE_POLKIT_AUTHORITY_GET_SYNC)
engine->priv->authority = polkit_authority_get_sync (NULL, &error);
if (engine->priv->authority == NULL) {
g_error ("failed to get pokit authority: %s", error->message);
g_error_free (error);
}
-#else
- engine->priv->authority = polkit_authority_get ();
-#endif
#endif
/* set the default proxy */
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 06b0216..3089c02 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2008-2010 Richard Hughes <richard at hughsie.com>
+ * Copyright (C) 2008-2011 Richard Hughes <richard at hughsie.com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -5770,15 +5770,11 @@ pk_transaction_init (PkTransaction *transaction)
transaction->priv->results = pk_results_new ();
transaction->priv->supported_content_types = g_ptr_array_new_with_free_func (g_free);
#ifdef USE_SECURITY_POLKIT
-#if defined(USE_SECURITY_POLKIT_NEW) && defined(HAVE_POLKIT_AUTHORITY_GET_SYNC)
transaction->priv->authority = polkit_authority_get_sync (NULL, &error);
if (transaction->priv->authority == NULL) {
g_error ("failed to get pokit authority: %s", error->message);
g_error_free (error);
}
-#else
- transaction->priv->authority = polkit_authority_get ();
-#endif
transaction->priv->cancellable = g_cancellable_new ();
#endif
commit 13773e44d0d44c2e00a865d4dbab2af328c098bd
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Jul 20 14:53:02 2011 +0100
trivial: add the output of the self test programs to CLEANFILES
diff --git a/lib/packagekit-glib2/Makefile.am b/lib/packagekit-glib2/Makefile.am
index d36083a..acd2aaa 100644
--- a/lib/packagekit-glib2/Makefile.am
+++ b/lib/packagekit-glib2/Makefile.am
@@ -235,7 +235,7 @@ pk-marshal.c: pk-marshal.list
pk-marshal.h: pk-marshal.list
@GLIB_GENMARSHAL@ $< --prefix=pk_marshal --header > $@
-CLEANFILES = $(BUILT_SOURCES) *.a
+CLEANFILES = $(BUILT_SOURCES) *.a *.servicepack
if HAVE_INTROSPECTION
introspection_sources = $(libpackagekit_glib2_la_SOURCES)
diff --git a/src/Makefile.am b/src/Makefile.am
index e66b9eb..293a20e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -191,9 +191,11 @@ EXTRA_DIST = \
clean-local:
rm -f *~
- rm -f transactions.db
- rm -f pk-marshal.c pk-marshal.h
-CLEANFILES = *~ $(BUILT_SOURCES)
+CLEANFILES = \
+ $(BUILT_SOURCES) \
+ pk-marshal.c \
+ pk-marshal.h \
+ transactions.db
-include $(top_srcdir)/git.mk
commit 23f5f29396a4586f6e7ef870d7e1b287ff705fe9
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Jul 20 14:47:01 2011 +0100
trivial: get rid of some spurious dbus/dbus-glib.h includes
diff --git a/contrib/command-not-found/Makefile.am b/contrib/command-not-found/Makefile.am
index 200e526..6451314 100644
--- a/contrib/command-not-found/Makefile.am
+++ b/contrib/command-not-found/Makefile.am
@@ -4,7 +4,6 @@ AUTOMAKE_OPTIONS = 1.7
INCLUDES = \
$(GLIB_CFLAGS) \
$(GIO_CFLAGS) \
- $(DBUS_CFLAGS) \
$(SQLITE_CFLAGS) \
-DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE \
-DG_LOG_DOMAIN=\"PackageKit\" \
@@ -27,7 +26,6 @@ pk_command_not_found_SOURCES = \
pk_command_not_found_LDADD = \
$(GLIB_LIBS) \
$(GIO_LIBS) \
- $(DBUS_LIBS) \
$(PK_GLIB2_LIBS) \
$(NULL)
diff --git a/contrib/command-not-found/pk-command-not-found.c b/contrib/command-not-found/pk-command-not-found.c
index 504fe69..4825377 100644
--- a/contrib/command-not-found/pk-command-not-found.c
+++ b/contrib/command-not-found/pk-command-not-found.c
@@ -28,7 +28,6 @@
#include <unistd.h>
#include <signal.h>
#include <glib/gi18n.h>
-#include <dbus/dbus-glib.h>
#include <packagekit-glib2/packagekit.h>
#include <packagekit-glib2/packagekit-private.h>
@@ -689,7 +688,6 @@ main (int argc, char *argv[])
if (! g_thread_supported ())
g_thread_init (NULL);
- dbus_g_thread_init ();
g_type_init ();
/* don't show debugging, unless VERBOSE is specified */
diff --git a/contrib/debuginfo-install/Makefile.am b/contrib/debuginfo-install/Makefile.am
index d60a37e..83d6e00 100644
--- a/contrib/debuginfo-install/Makefile.am
+++ b/contrib/debuginfo-install/Makefile.am
@@ -18,7 +18,6 @@ endif
INCLUDES = \
$(GLIB_CFLAGS) \
- $(DBUS_CFLAGS) \
$(SQLITE_CFLAGS) \
-DPK_COMPILATION \
-DI_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE \
@@ -39,7 +38,6 @@ pk_debuginfo_install_SOURCES = \
pk_debuginfo_install_LDADD = \
$(GLIB_LIBS) \
- $(DBUS_LIBS) \
$(PK_GLIB2_LIBS) \
$(NULL)
diff --git a/src/Makefile.am b/src/Makefile.am
index c6a1bb9..e66b9eb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -12,7 +12,6 @@ PK_GLIB2_LIBS = \
INCLUDES = \
$(GIO_CFLAGS) \
$(GLIB_CFLAGS) \
- $(DBUS_CFLAGS) \
$(SQLITE_CFLAGS) \
$(POLKIT_CFLAGS) \
$(PYTHON_CFLAGS) \
@@ -119,7 +118,6 @@ packagekitd_LDADD = \
$(GMODULE_LIBS) \
$(NETWORK_MANAGER_LIBS) \
$(CONNMAN_LIBS) \
- $(DBUS_LIBS) \
$(SQLITE_LIBS) \
$(PK_GLIB2_LIBS) \
$(PYTHON_LIBS) \
@@ -163,7 +161,6 @@ pk_self_test_SOURCES = \
pk_self_test_LDADD = \
$(GLIB_LIBS) \
$(GMODULE_LIBS) \
- $(DBUS_LIBS) \
$(SQLITE_LIBS) \
$(NETWORK_MANAGER_LIBS) \
$(CONNMAN_LIBS) \
commit 4d0728b6cb55c26878f673f8e4020378ae7bcd8b
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Jul 20 14:08:26 2011 +0100
gtk-module: Port from dbus-glib to GDBus
diff --git a/configure.ac b/configure.ac
index 41ecc4a..f79ef1a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -411,7 +411,7 @@ dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE(gtk_module, AS_HELP_STRING([--enable-gtk-module],[Build GTK+-3 module functionality]),
enable_gtk_module=$enableval,enable_gtk_module=yes)
if test x$enable_gtk_module = xyes; then
- PKG_CHECK_MODULES(PK_GTK_MODULE, gtk+-3.0 >= 3.0.0 pangoft2 fontconfig dbus-glib-1,
+ PKG_CHECK_MODULES(PK_GTK_MODULE, gtk+-3.0 >= 3.0.0 pangoft2 fontconfig,
build_gtk_module=yes, build_gtk_module=no)
else
build_gtk_module=no
diff --git a/contrib/gtk-module/pk-gtk-module.c b/contrib/gtk-module/pk-gtk-module.c
index b3913c3..8145848 100644
--- a/contrib/gtk-module/pk-gtk-module.c
+++ b/contrib/gtk-module/pk-gtk-module.c
@@ -27,9 +27,9 @@
#include <pango/pango.h>
#include <pango/pangofc-fontmap.h>
#include <pango/pangocairo.h>
-#include <dbus/dbus-glib.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
+#include <gio/gio.h>
/**
* Try guessing the XID of the toplevel window that triggered us
@@ -58,31 +58,29 @@ guess_xid (void)
return xid;
}
-
/**
* Invoke the PackageKit InstallFonts method over D-BUS
**/
static void
-pk_install_fonts_dbus_notify_cb (DBusGProxy *proxy,
- DBusGProxyCall *call,
- gpointer user_data)
+pk_install_fonts_method_finished_cb (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
{
- gboolean ret;
+ GDBusProxy *proxy = G_DBUS_PROXY (source_object);
GError *error = NULL;
+ GVariant *value;
- ret = dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
-
- if (!ret) {
- g_debug ("Did not install fonts: %s", error->message);
- return;
- } else {
- /* XXX Actually get the return value of the method? */
-
- g_debug ("Fonts installed");
+ value = g_dbus_proxy_call_finish (proxy, res, &error);
+ if (value == NULL) {
+ g_warning ("Error occurred during install: %s", error->message);
+ g_error_free (error);
+ goto out;
}
-
+out:
/* XXX Make gtk/pango reload fonts? */
+ if (value != NULL)
+ g_variant_unref (value);
}
static GPtrArray *tags;
@@ -90,12 +88,10 @@ static GPtrArray *tags;
static gboolean
pk_install_fonts_idle_cb (gpointer data G_GNUC_UNUSED)
{
- DBusGConnection *connection;
- DBusGProxy *proxy = NULL;
+ GDBusProxy *proxy = NULL;
guint xid;
gchar **font_tags;
GError *error = NULL;
- DBusGProxyCall *call;
g_return_val_if_fail (tags->len > 0, FALSE);
@@ -107,38 +103,35 @@ pk_install_fonts_idle_cb (gpointer data G_GNUC_UNUSED)
/* try to get the window XID */
xid = guess_xid ();
- /* get bus */
- connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
- if (connection == NULL) {
- g_warning ("Could not connect to session bus: %s\n", error->message);
- g_error_free (error);
- goto out;
- }
-
/* get proxy */
- proxy = dbus_g_proxy_new_for_name (connection,
- "org.freedesktop.PackageKit",
- "/org/freedesktop/PackageKit",
- "org.freedesktop.PackageKit.Modify");
+ proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
+ G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
+ NULL,
+ "org.freedesktop.PackageKit",
+ "/org/freedesktop/PackageKit",
+ "org.freedesktop.PackageKit.Modify",
+ NULL,
+ &error);
if (proxy == NULL) {
- g_warning ("Could not connect to PackageKit session service\n");
+ g_warning ("Error connecting to PK session instance: %s",
+ error->message);
+ g_error_free (error);
goto out;
}
- /* don't timeout, as dbus-glib sets the timeout ~25 seconds */
- dbus_g_proxy_set_default_timeout (proxy, INT_MAX);
-
/* invoke the method */
- call = dbus_g_proxy_begin_call (proxy, "InstallFontconfigResources",
- pk_install_fonts_dbus_notify_cb, NULL, NULL,
- G_TYPE_UINT, xid,
- G_TYPE_STRV, font_tags,
- G_TYPE_STRING, "hide-finished",
- G_TYPE_INVALID);
- if (call == NULL) {
- g_warning ("Could not send method");
- goto out;
- }
+ g_dbus_proxy_call (proxy,
+ "InstallPackageNames",
+ g_variant_new ("(u^a&ss)",
+ xid,
+ font_tags,
+ "hide-finished"),
+ G_DBUS_CALL_FLAGS_NONE,
+ 60 * 60 * 1000, /* 1 hour */
+ NULL,
+ pk_install_fonts_method_finished_cb,
+ NULL);
g_debug ("InstallFontconfigResources method invoked");
@@ -146,7 +139,6 @@ out:
g_strfreev (font_tags);
if (proxy != NULL)
g_object_unref (proxy);
-
return FALSE;
}
commit bbfe95216d47bd3789e67b2868d029d1bb69e184
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Jul 20 14:01:27 2011 +0100
gstreamer-plugin: Port from dbus-glib to GDBus
diff --git a/configure.ac b/configure.ac
index 0b7b55e..41ecc4a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -398,7 +398,7 @@ dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE(gstreamer_plugin, AS_HELP_STRING([--enable-gstreamer-plugin],[Build gstreamer plugin functionality]),
enable_gstreamer_plugin=$enableval,enable_gstreamer_plugin=yes)
if test x$enable_gstreamer_plugin = xyes; then
- PKG_CHECK_MODULES(PK_GSTREAMER_PLUGIN, gstreamer-0.10 gstreamer-plugins-base-0.10 glib-2.0 dbus-glib-1,
+ PKG_CHECK_MODULES(PK_GSTREAMER_PLUGIN, gstreamer-0.10 gstreamer-plugins-base-0.10 glib-2.0,
build_gstreamer_plugin=yes, build_gstreamer_plugin=no)
else
build_gstreamer_plugin=no
diff --git a/contrib/gstreamer-plugin/pk-gstreamer-install.c b/contrib/gstreamer-plugin/pk-gstreamer-install.c
index 2381ff5..50f9b35 100644
--- a/contrib/gstreamer-plugin/pk-gstreamer-install.c
+++ b/contrib/gstreamer-plugin/pk-gstreamer-install.c
@@ -24,7 +24,6 @@
#include <gst/pbutils/install-plugins.h>
#include <string.h>
#include <sys/utsname.h>
-#include <dbus/dbus-glib.h>
#include <packagekit-glib2/packagekit.h>
typedef struct {
@@ -266,9 +265,7 @@ out:
int
main (int argc, gchar **argv)
{
- DBusGConnection *connection;
- DBusGProxy *proxy = NULL;
- gboolean ret;
+ GDBusProxy *proxy = NULL;
GOptionContext *context;
GError *error = NULL;
guint i;
@@ -280,6 +277,7 @@ main (int argc, gchar **argv)
gchar **resources = NULL;
GPtrArray *array = NULL;
gchar *resource;
+ GVariant *value = NULL;
const GOptionEntry options[] = {
{ "transient-for", '\0', 0, G_OPTION_ARG_INT, &xid, "The XID of the parent window", NULL },
@@ -308,21 +306,20 @@ main (int argc, gchar **argv)
/* this is our parent window */
g_message ("PackageKit: xid = %i", xid);
- /* get bus */
- connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
- if (connection == NULL) {
- g_print ("Could not connect to session DBUS: %s\n", error->message);
- g_error_free (error);
- goto out;
- }
-
/* get proxy */
- proxy = dbus_g_proxy_new_for_name (connection,
- "org.freedesktop.PackageKit",
- "/org/freedesktop/PackageKit",
- "org.freedesktop.PackageKit.Modify");
+ proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
+ G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
+ NULL,
+ "org.freedesktop.PackageKit",
+ "/org/freedesktop/PackageKit",
+ "org.freedesktop.PackageKit.Modify",
+ NULL,
+ &error);
if (proxy == NULL) {
- g_print ("Cannot connect to PackageKit session service\n");
+ g_warning ("Cannot connect to PackageKit session service: %s",
+ error->message);
+ g_error_free (error);
goto out;
}
@@ -373,17 +370,18 @@ main (int argc, gchar **argv)
/* convert to a GStrv */
resources = pk_ptr_array_to_strv (array);
- /* don't timeout, as dbus-glib sets the timeout ~25 seconds */
- dbus_g_proxy_set_default_timeout (proxy, INT_MAX);
-
/* invoke the method */
- ret = dbus_g_proxy_call (proxy, "InstallGStreamerResources", &error,
- G_TYPE_UINT, xid,
- G_TYPE_STRV, resources,
- G_TYPE_STRING, "hide-finished",
- G_TYPE_INVALID,
- G_TYPE_INVALID);
- if (!ret) {
+ value = g_dbus_proxy_call_sync (proxy,
+ "InstallGStreamerResources",
+ g_variant_new ("(u^a&ss)",
+ xid,
+ resources,
+ "hide-finished"),
+ G_DBUS_CALL_FLAGS_NONE,
+ 60 * 60 * 1000, /* 1 hour */
+ NULL,
+ &error);
+ if (value == NULL) {
/* use the error string to return a good GStreamer exit code */
retval = GST_INSTALL_PLUGINS_NOT_FOUND;
if (g_strrstr (error->message, "did not agree to search") != NULL)
@@ -399,6 +397,8 @@ main (int argc, gchar **argv)
retval = GST_INSTALL_PLUGINS_SUCCESS;
out:
+ if (value != NULL)
+ g_variant_unref (value);
if (array != NULL)
g_ptr_array_unref (array);
g_strfreev (resources);
commit 6bf6d9f0f65376635f06cba6be6505df23f80626
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Jul 20 13:55:37 2011 +0100
browser-plugin: Port from dbus-glib to GDBus
diff --git a/configure.ac b/configure.ac
index 81968b0..0b7b55e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -360,8 +360,7 @@ if test x$enable_browser_plugin = xyes; then
nspr \
cairo \
pango \
- gtk+-2.0 >= 2.14.0 \
- dbus-glib-1,
+ gtk+-2.0 >= 2.14.0,
build_browser_plugin=yes, build_browser_plugin=no)
if test $build_browser_plugin = "yes"; then
diff --git a/contrib/browser-plugin/Makefile.am b/contrib/browser-plugin/Makefile.am
index bc515b9..0119f3f 100644
--- a/contrib/browser-plugin/Makefile.am
+++ b/contrib/browser-plugin/Makefile.am
@@ -26,8 +26,7 @@ packagekit_plugin_la_SOURCES = \
pk-plugin.h \
pk-plugin-install.c \
pk-plugin-install.h \
- pk-main.c \
- pk-main.h
+ pk-main.c
EXTRA_DIST = \
tests/test.html
diff --git a/contrib/browser-plugin/pk-main.c b/contrib/browser-plugin/pk-main.c
index 4f6fc75..d22366b 100644
--- a/contrib/browser-plugin/pk-main.c
+++ b/contrib/browser-plugin/pk-main.c
@@ -37,7 +37,6 @@
#define __USE_GNU
#include <dlfcn.h>
-#include "pk-main.h"
#include "pk-plugin.h"
#include "pk-plugin-install.h"
@@ -52,55 +51,16 @@ static void pk_main_draw_window (PkPlugin *plugin);
static void pk_main_event_handler (PkPlugin *plugin, XEvent *event);
/**
- * pk_debug_real:
- **/
-void
-pk_debug_real (const gchar *func, const gchar *file, const int line, const gchar *format, ...)
-{
- va_list args;
- gchar *buffer = NULL;
-
- if (g_getenv ("PK_DEBUG") == NULL)
- return;
-
- va_start (args, format);
- g_vasprintf (&buffer, format, args);
- va_end (args);
-
- g_print ("FN:%s FC:%s LN:%i\n\t%s\n", file, func, line, buffer);
-
- g_free (buffer);
-}
-
-/**
- * pk_warning_real:
- **/
-void
-pk_warning_real (const gchar *func, const gchar *file, const int line, const gchar *format, ...)
-{
- va_list args;
- gchar *buffer = NULL;
-
- va_start (args, format);
- g_vasprintf (&buffer, format, args);
- va_end (args);
-
- g_print ("FN:%s FC:%s LN:%i\n!!\t%s\n", file, func, line, buffer);
-
- g_free (buffer);
-}
-
-/**
* pk_main_refresh_cb:
**/
static void
pk_main_refresh_cb (PkPlugin *plugin_, NPP instance)
{
- pk_debug ("pk_main_refresh_cb [%p]", instance);
+ g_debug ("pk_main_refresh_cb [%p]", instance);
/* invalid */
if (plugin_ == NULL) {
- pk_warning ("NULL plugin");
+ g_warning ("NULL plugin");
return;
}
@@ -136,7 +96,7 @@ pk_main_newp (NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc,
gint i;
PkPlugin *plugin;
- pk_debug ("new [%p]", instance);
+ g_debug ("new [%p]", instance);
/* create new content instance */
plugin = PK_PLUGIN (pk_plugin_install_new ());
@@ -165,7 +125,7 @@ pk_main_destroy (NPP instance, NPSavedData **save)
{
PkPlugin *plugin = PK_PLUGIN (instance->pdata);
- pk_debug ("pk_main_destroy [%p]", instance);
+ g_debug ("pk_main_destroy [%p]", instance);
/* free content instance */
g_signal_handlers_disconnect_by_func (plugin, G_CALLBACK (pk_main_refresh_cb), instance);
@@ -214,14 +174,14 @@ pk_main_create_window (PkPlugin *plugin)
// TODO - is it correct? Do we want to translate xdisplay -> GdkDisplay?
display = gdk_display_get_default ();
if (display == NULL) {
- pk_debug ("invalid display returned by gdk_display_get_default ()\n");
+ g_debug ("invalid display returned by gdk_display_get_default ()\n");
return;
}
/* get parent */
parent = gdk_x11_window_foreign_new_for_display (display, xwindow);
if (parent == NULL) {
- pk_debug ("invalid window given for setup (id %lu)\n", xwindow);
+ g_debug ("invalid window given for setup (id %lu)\n", xwindow);
return;
}
@@ -288,7 +248,7 @@ pk_main_draw_window (PkPlugin *plugin)
g_object_get (plugin, "gdk-window", &gdk_window, NULL);
if (gdk_window == NULL) {
- pk_debug ("gdk_window is NULL!");
+ g_debug ("gdk_window is NULL!");
return;
}
@@ -307,7 +267,7 @@ pk_main_event_handler (PkPlugin *plugin, XEvent *event)
XMotionEvent *xme;
XCrossingEvent *xce;
- pk_debug ("pk_main_handle_event [%p]", plugin);
+ g_debug ("pk_main_handle_event [%p]", plugin);
/* find plugin */
if (plugin == NULL)
@@ -320,7 +280,7 @@ pk_main_event_handler (PkPlugin *plugin, XEvent *event)
Display *display;
Window window;
- pk_debug ("Expose [%p]", plugin);
+ g_debug ("Expose [%p]", plugin);
/* get parameters */
g_object_get (plugin, "display", &display, "window", &window, NULL);
@@ -365,7 +325,7 @@ pk_main_set_window (NPP instance, NPWindow* pNPWindow)
NPSetWindowCallbackStruct *ws_info;
Window window;
- pk_debug ("pk_main_set_window [%p]", instance);
+ g_debug ("pk_main_set_window [%p]", instance);
/* find plugin */
plugin = PK_PLUGIN (instance->pdata);
@@ -379,7 +339,7 @@ pk_main_set_window (NPP instance, NPWindow* pNPWindow)
}
/* type */
- pk_debug ("type=%i (NPWindowTypeWindow=%i, NPWindowTypeDrawable=%i)",
+ g_debug ("type=%i (NPWindowTypeWindow=%i, NPWindowTypeDrawable=%i)",
pNPWindow->type, NPWindowTypeWindow, NPWindowTypeDrawable);
g_object_get (plugin,
@@ -393,20 +353,20 @@ pk_main_set_window (NPP instance, NPWindow* pNPWindow)
* id.
*/
if ((Window) (pNPWindow->window) == window) {
- pk_debug ("resize event will come");
+ g_debug ("resize event will come");
goto out;
}
/* do we have a callback struct (WebKit doesn't send this) */
ws_info = (NPSetWindowCallbackStruct *) pNPWindow->ws_info;
if (ws_info == NULL) {
- pk_debug ("no callback struct");
+ g_debug ("no callback struct");
goto out;
}
/* no visual yet */
if (ws_info->visual == NULL) {
- pk_debug ("no visual, so skipping");
+ g_debug ("no visual, so skipping");
goto out;
}
@@ -421,7 +381,7 @@ pk_main_set_window (NPP instance, NPWindow* pNPWindow)
"window", pNPWindow->window,
NULL);
- pk_debug ("x=%i, y=%i, width=%i, height=%i, display=%p, visual=%p, window=%ld",
+ g_debug ("x=%i, y=%i, width=%i, height=%i, display=%p, visual=%p, window=%ld",
pNPWindow->x, pNPWindow->y, pNPWindow->width, pNPWindow->height,
ws_info->display, ws_info->visual, (Window)pNPWindow->window);
@@ -433,7 +393,7 @@ pk_main_set_window (NPP instance, NPWindow* pNPWindow)
/* start plugin */
ret = pk_plugin_start (plugin);
if (!ret)
- pk_warning ("failed to start plugin");
+ g_warning ("failed to start plugin");
}
/* Set-up drawing window */
@@ -484,7 +444,7 @@ NPError NP_GetEntryPoints (NPPluginFuncs *nppfuncs);
NPError
NP_GetEntryPoints (NPPluginFuncs *nppfuncs)
{
- pk_debug ("NP_GetEntryPoints");
+ g_debug ("NP_GetEntryPoints");
nppfuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
nppfuncs->newp = pk_main_newp;
@@ -501,7 +461,7 @@ NP_GetEntryPoints (NPPluginFuncs *nppfuncs)
NPError
NP_Initialize (NPNetscapeFuncs *npnf, NPPluginFuncs *nppfuncs)
{
- pk_debug ("NP_Initialize");
+ g_debug ("NP_Initialize");
if (npnf == NULL)
return NPERR_INVALID_FUNCTABLE_ERROR;
@@ -532,7 +492,7 @@ NP_Initialize (NPNetscapeFuncs *npnf, NPPluginFuncs *nppfuncs)
NPError
NP_Shutdown ()
{
- pk_debug ("NP_Shutdown");
+ g_debug ("NP_Shutdown");
return NPERR_NO_ERROR;
}
@@ -542,8 +502,7 @@ NP_Shutdown ()
char *
NP_GetMIMEDescription (void)
{
- pk_debug ("NP_GetMIMEDescription");
-
+ g_debug ("NP_GetMIMEDescription");
return (gchar*) "application/x-packagekit-plugin:bsc:PackageKit Plugin";
}
diff --git a/contrib/browser-plugin/pk-main.h b/contrib/browser-plugin/pk-main.h
deleted file mode 100644
index c4d8914..0000000
--- a/contrib/browser-plugin/pk-main.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2009 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PK_MAIN_H
-#define __PK_MAIN_H
-
-G_BEGIN_DECLS
-
-#define PK_PLUGIN_INSTALL_MARGIN 5 /* px */
-
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-#define pk_debug(...) pk_debug_real (__func__, __FILE__, __LINE__, __VA_ARGS__)
-#define pk_warning(...) pk_warning_real (__func__, __FILE__, __LINE__, __VA_ARGS__)
-#elif defined(__GNUC__) && __GNUC__ >= 3
-#define pk_debug(...) pk_debug_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
-#define pk_warning(...) pk_warning_real (__FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
-#else
-#define pk_debug(...)
-#define pk_warning(...)
-#endif
-
-void pk_debug_real (const gchar *func,
- const gchar *file,
- int line,
- const gchar *format, ...) __attribute__((format (printf,4,5)));
-void pk_warning_real (const gchar *func,
- const gchar *file,
- int line,
- const gchar *format, ...) __attribute__((format (printf,4,5)));
-
-G_END_DECLS
-
-#endif /* __PK_MAIN_H */
diff --git a/contrib/browser-plugin/pk-plugin-install.c b/contrib/browser-plugin/pk-plugin-install.c
index 26948cf..16e8a25 100644
--- a/contrib/browser-plugin/pk-plugin-install.c
+++ b/contrib/browser-plugin/pk-plugin-install.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2008-2009 Richard Hughes <richard at hughsie.com>
+ * Copyright (C) 2008-2011 Richard Hughes <richard at hughsie.com>
* Copyright (C) 2008 Red Hat, Inc.
*
* Licensed under the GNU General Public License Version 2
@@ -29,13 +29,11 @@
#include <glib/gi18n-lib.h>
#include <gio/gdesktopappinfo.h>
#include <pango/pangocairo.h>
-#include <dbus/dbus-glib.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include <math.h>
#include <packagekit-glib2/packagekit.h>
-#include "pk-main.h"
#include "pk-plugin-install.h"
//#define PK_PLUGIN_INSTALL_USE_DESKTOP_FOR_INSTALLED
@@ -63,8 +61,8 @@ struct PkPluginInstallPrivate
gchar **package_names;
PangoLayout *pango_layout;
PkClient *client;
- DBusGProxy *install_package_proxy;
- DBusGProxyCall *install_package_call;
+ GDBusProxy *session_pk_proxy;
+ GCancellable *cancellable;
gint timeout;
gint current;
gint update_spinner;
@@ -78,7 +76,7 @@ G_DEFINE_TYPE (PkPluginInstall, pk_plugin_install, PK_TYPE_PLUGIN)
static void
pk_plugin_install_clear_layout (PkPluginInstall *self)
{
- pk_debug ("clearing layout");
+ g_debug ("clearing layout");
if (self->priv->pango_layout) {
g_object_unref (self->priv->pango_layout);
@@ -120,7 +118,7 @@ static void
pk_plugin_install_set_status (PkPluginInstall *self, PkPluginInstallPackageStatus status)
{
if (self->priv->status != status) {
- pk_debug ("setting status %u", status);
+ g_debug ("setting status %u", status);
self->priv->status = status;
if (status == INSTALLING) {
@@ -141,7 +139,7 @@ pk_plugin_install_set_status (PkPluginInstall *self, PkPluginInstallPackageStatu
static void
pk_plugin_install_set_available_version (PkPluginInstall *self, const gchar *version)
{
- pk_debug ("setting available version: %s", version);
+ g_debug ("setting available version: %s", version);
g_free (self->priv->available_version);
self->priv->available_version = g_strdup (version);
@@ -153,7 +151,7 @@ pk_plugin_install_set_available_version (PkPluginInstall *self, const gchar *ver
static void
pk_plugin_install_set_available_package_name (PkPluginInstall *self, const gchar *name)
{
- pk_debug ("setting available package name: %s", name);
+ g_debug ("setting available package name: %s", name);
g_free (self->priv->available_package_name);
self->priv->available_package_name = g_strdup (name);
@@ -165,7 +163,7 @@ pk_plugin_install_set_available_package_name (PkPluginInstall *self, const gchar
static void
pk_plugin_install_set_installed_package_name (PkPluginInstall *self, const gchar *name)
{
- pk_debug ("setting installed package name: %s", name);
+ g_debug ("setting installed package name: %s", name);
g_free (self->priv->installed_package_name);
self->priv->installed_package_name = g_strdup (name);
@@ -177,7 +175,7 @@ pk_plugin_install_set_installed_package_name (PkPluginInstall *self, const gchar
static void
pk_plugin_install_set_installed_version (PkPluginInstall *self, const gchar *version)
{
- pk_debug ("setting installed version: %s", version);
+ g_debug ("setting installed version: %s", version);
g_free (self->priv->installed_version);
self->priv->installed_version = g_strdup (version);
@@ -201,7 +199,7 @@ pk_plugin_install_get_best_desktop_file (PkPluginInstall *self)
desktop = pk_desktop_new ();
ret = pk_desktop_open_database (desktop, &error);
if (!ret) {
- pk_warning ("failed to open database: %s", error->message);
+ g_warning ("failed to open database: %s", error->message);
g_error_free (error);
goto out;
}
@@ -209,17 +207,17 @@ pk_plugin_install_get_best_desktop_file (PkPluginInstall *self)
/* get files */
package = self->priv->installed_package_name;
if (package == NULL) {
- pk_warning ("installed_package_name NULL so cannot get desktop file");
+ g_warning ("installed_package_name NULL so cannot get desktop file");
goto out;
}
array = pk_desktop_get_shown_for_package (desktop, package, &error);
if (array == NULL) {
- pk_debug ("no data: %s", error->message);
+ g_debug ("no data: %s", error->message);
g_error_free (error);
goto out;
}
if (array->len == 0) {
- pk_debug ("no matches for %s", package);
+ g_debug ("no matches for %s", package);
goto out;
}
@@ -264,7 +262,9 @@ pk_plugin_install_finished_cb (GObject *object, GAsyncResult *res, PkPluginInsta
/* check error code */
error_code = pk_results_get_error_code (results);
if (error_code != NULL) {
- g_warning ("failed to install: %s, %s", pk_error_enum_to_string (pk_error_get_code (error_code)), pk_error_get_details (error_code));
+ g_warning ("failed to install: %s, %s",
+ pk_error_enum_to_string (pk_error_get_code (error_code)),
+ pk_error_get_details (error_code));
goto out;
}
@@ -449,7 +449,10 @@ pk_plugin_install_set_source_from_rgba (cairo_t *cr, guint32 rgba)
* the window.
**/
static void
-pk_plugin_install_get_style (PangoFontDescription **font_desc, guint32 *foreground, guint32 *background, guint32 *linked)
+pk_plugin_install_get_style (PangoFontDescription **font_desc,
+ guint32 *foreground,
+ guint32 *background,
+ guint32 *linked)
{
GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
GtkStyle *style;
@@ -478,7 +481,10 @@ pk_plugin_install_get_style (PangoFontDescription **font_desc, guint32 *foregrou
* pk_plugin_install_ensure_layout:
**/
static void
-pk_plugin_install_ensure_layout (PkPluginInstall *self, cairo_t *cr, PangoFontDescription *font_desc, guint32 link_color)
+pk_plugin_install_ensure_layout (PkPluginInstall *self,
+ cairo_t *cr,
+ PangoFontDescription *font_desc,
+ guint32 link_color)
{
GString *markup = g_string_new (NULL);
@@ -566,7 +572,7 @@ pk_plugin_install_get_package_icon (PkPluginInstall *self)
/* do we have data? */
if (self->priv->installed_package_name == NULL) {
- pk_debug ("installed_package_name NULL, so cannot get icon");
+ g_debug ("installed_package_name NULL, so cannot get icon");
goto out;
}
@@ -574,12 +580,12 @@ pk_plugin_install_get_package_icon (PkPluginInstall *self)
file = g_key_file_new ();
filename = pk_plugin_install_get_best_desktop_file (self);
if (filename == NULL) {
- pk_debug ("no desktop file");
+ g_debug ("no desktop file");
goto out;
}
ret = g_key_file_load_from_file (file, filename, G_KEY_FILE_NONE, NULL);
if (!ret) {
- pk_warning ("failed to open %s", filename);
+ g_warning ("failed to open %s", filename);
goto out;
}
data = g_key_file_get_string (file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, NULL);
@@ -722,7 +728,7 @@ pk_plugin_install_draw (PkPlugin *plugin, cairo_t *cr)
sep = MAX ((height - 48) / 2, radius);
- pk_debug ("drawing on %ux%u (%ux%u)", x, y, width, height);
+ g_debug ("drawing on %ux%u (%ux%u)", x, y, width, height);
/* get properties */
pk_plugin_install_get_style (&font_desc, &foreground, &background, &linked);
@@ -814,7 +820,7 @@ pk_plugin_install_line_is_terminated (PangoLayoutIter *iter)
GSList *lines = pango_layout_get_lines (pango_layout_iter_get_layout (iter));
GSList *found = g_slist_find (lines, line);
if (!found) {
- pk_warning ("Can't find line in layout line list");
+ g_warning ("Can't find line in layout line list");
return FALSE;
}
@@ -922,20 +928,24 @@ pk_plugin_install_get_link_index (PkPluginInstall *self, gint x, gint y)
* pk_plugin_install_method_finished_cb:
**/
static void
-pk_plugin_install_method_finished_cb (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
+pk_plugin_install_method_finished_cb (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
{
- PkPluginInstall *self = (PkPluginInstall *)user_data;
+ PkPluginInstall *self = PK_PLUGIN_INSTALL (user_data);
+ GDBusProxy *proxy = G_DBUS_PROXY (source_object);
GError *error = NULL;
+ GVariant *value;
- if (!dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID)) {
- pk_warning ("Error occurred during install: %s", error->message);
- g_clear_error (&error);
+ value = g_dbus_proxy_call_finish (proxy, res, &error);
+ if (value == NULL) {
+ g_warning ("Error occurred during install: %s", error->message);
+ g_error_free (error);
+ goto out;
}
-
- g_object_unref (self->priv->install_package_proxy);
- self->priv->install_package_proxy = NULL;
- self->priv->install_package_call = NULL;
-
+out:
+ if (value != NULL)
+ g_variant_unref (value);
pk_plugin_install_recheck (self);
}
@@ -949,25 +959,12 @@ pk_plugin_install_install_package (PkPluginInstall *self, Time event_time)
GdkWindow *window;
guint xid = 0;
gchar **packages;
- DBusGConnection *connection;
if (self->priv->available_package_name == NULL) {
- pk_warning ("No available package to install");
+ g_warning ("No available package to install");
return;
}
- if (self->priv->install_package_call != 0) {
- pk_warning ("Already installing package");
- return;
- }
-
- /* TODO: needs to be on Modify interface */
- connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
- self->priv->install_package_proxy = dbus_g_proxy_new_for_name (connection,
- "org.freedesktop.PackageKit",
- "/org/freedesktop/PackageKit",
- "org.freedesktop.PackageKit.Modify");
-
/* will be NULL when activated not using a keyboard or a mouse */
event = gtk_get_current_event ();
if (event != NULL && event->any.window != NULL) {
@@ -976,18 +973,20 @@ pk_plugin_install_install_package (PkPluginInstall *self, Time event_time)
}
packages = g_strsplit (self->priv->available_package_name, ";", -1);
- self->priv->install_package_call =
- dbus_g_proxy_begin_call_with_timeout (self->priv->install_package_proxy,
- "InstallPackageNames",
- pk_plugin_install_method_finished_cb,
- self,
- (GDestroyNotify) 0,
- 24 * 60 * 1000 * 1000, /* one day */
- G_TYPE_UINT, xid, /* xid */
- G_TYPE_STRV, packages,
- G_TYPE_STRING, "hide-confirm-search,hide-progress,hide-confirm-deps,hide-finished",
- G_TYPE_INVALID,
- G_TYPE_INVALID);
+ g_dbus_proxy_call (self->priv->session_pk_proxy,
+ "InstallPackageNames",
+ g_variant_new ("(u^a&ss)",
+ xid,
+ packages,
+ "hide-confirm-search,"
+ "hide-progress,"
+ "hide-confirm-deps,"
+ "hide-finished"),
+ G_DBUS_CALL_FLAGS_NONE,
+ 60 * 60 * 1000, /* 1 hour */
+ self->priv->cancellable,
+ pk_plugin_install_method_finished_cb,
+ self);
g_strfreev (packages);
pk_plugin_install_set_status (self, INSTALLING);
@@ -1022,7 +1021,7 @@ pk_plugin_install_run_application (PkPluginInstall *self, Time event_time)
GdkAppLaunchContext *context;
if (self->priv->app_info == 0) {
- pk_warning ("Didn't find application to launch");
+ g_warning ("Didn't find application to launch");
return;
}
@@ -1032,7 +1031,7 @@ pk_plugin_install_run_application (PkPluginInstall *self, Time event_time)
context = gdk_app_launch_context_new ();
gdk_app_launch_context_set_timestamp (context, event_time);
if (!g_app_info_launch (self->priv->app_info, NULL, G_APP_LAUNCH_CONTEXT (context), &error)) {
- pk_warning ("%s\n", error->message);
+ g_warning ("%s\n", error->message);
g_clear_error (&error);
return;
}
@@ -1136,10 +1135,8 @@ pk_plugin_install_finalize (GObject *object)
if (self->priv->app_info != NULL)
g_object_unref (self->priv->app_info);
- if (self->priv->install_package_call != NULL) {
- dbus_g_proxy_cancel_call (self->priv->install_package_proxy, self->priv->install_package_call);
- g_object_unref (self->priv->install_package_proxy);
- }
+ g_cancellable_cancel (self->priv->cancellable);
+ g_object_unref (self->priv->session_pk_proxy);
/* remove clients */
g_object_unref (self->priv->client);
@@ -1171,20 +1168,28 @@ pk_plugin_install_class_init (PkPluginInstallClass *klass)
static void
pk_plugin_install_init (PkPluginInstall *self)
{
- self->priv = PK_PLUGIN_INSTALL_GET_PRIVATE (self);
+ GError *error = NULL;
+ self->priv = PK_PLUGIN_INSTALL_GET_PRIVATE (self);
self->priv->status = IN_PROGRESS;
- self->priv->available_version = NULL;
- self->priv->available_package_name = NULL;
- self->priv->installed_version = NULL;
- self->priv->installed_package_name = NULL;
- self->priv->app_info = NULL;
- self->priv->display_name = NULL;
- self->priv->package_names = NULL;
- self->priv->pango_layout = NULL;
- self->priv->install_package_proxy = NULL;
- self->priv->install_package_call = NULL;
self->priv->client = pk_client_new ();
+
+ /* connect early to allow the service to start */
+ self->priv->session_pk_proxy =
+ g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
+ G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
+ NULL,
+ "org.freedesktop.PackageKit",
+ "/org/freedesktop/PackageKit",
+ "org.freedesktop.PackageKit.Modify",
+ self->priv->cancellable,
+ &error);
+ if (self->priv->session_pk_proxy == NULL) {
+ g_warning ("Error connecting to PK session instance: %s",
+ error->message);
+ g_error_free (error);
+ }
}
/**
@@ -1198,32 +1203,3 @@ pk_plugin_install_new (void)
self = g_object_new (PK_TYPE_PLUGIN_INSTALL, NULL);
return PK_PLUGIN_INSTALL (self);
}
-
-/***************************************************************************
- *** MAKE CHECK TESTS ***
- ***************************************************************************/
-#ifdef EGG_TEST
-#include "egg-test.h"
-
-void
-egg_test_plugin_install (EggTest *test)
-{
- PkPluginInstall *self;
-
- if (!egg_test_start (test, "PkPluginInstall"))
- return;
-
- /************************************************************/
- egg_test_title (test, "get an instance");
- self = pk_plugin_install_new ();
- if (self != NULL)
- egg_test_success (test, NULL);
- else
- egg_test_failed (test, NULL);
-
- g_object_unref (self);
-
- egg_test_end (test);
-}
-#endif
-
diff --git a/contrib/browser-plugin/pk-plugin.c b/contrib/browser-plugin/pk-plugin.c
index 6a913ba..eebc93d 100644
--- a/contrib/browser-plugin/pk-plugin.c
+++ b/contrib/browser-plugin/pk-plugin.c
@@ -24,7 +24,6 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#include "pk-main.h"
#include "pk-plugin.h"
#define PK_PLUGIN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_PLUGIN, PkPluginPrivate))
@@ -77,7 +76,7 @@ pk_plugin_set_data (PkPlugin *plugin, const gchar *name, const gchar *value)
g_return_val_if_fail (value != NULL, FALSE);
g_hash_table_insert (plugin->priv->data, g_strdup (name), g_strdup (value));
- pk_debug ("SET: name=%s, value=%s <%p>", name, value, plugin);
+ g_debug ("SET: name=%s, value=%s <%p>", name, value, plugin);
return TRUE;
}
@@ -94,7 +93,7 @@ pk_plugin_get_data (PkPlugin *plugin, const gchar *name)
g_return_val_if_fail (name != NULL, NULL);
value = g_hash_table_lookup (plugin->priv->data, name);
- pk_debug ("GET: name=%s, value=%s <%p>", name, value, plugin);
+ g_debug ("GET: name=%s, value=%s <%p>", name, value, plugin);
return value;
}
@@ -107,11 +106,11 @@ pk_plugin_start (PkPlugin *plugin)
{
PkPluginClass *klass = PK_PLUGIN_GET_CLASS (plugin);
- pk_debug ("start <%p>", plugin);
+ g_debug ("start <%p>", plugin);
/* already started, don't restart */
if (plugin->priv->started) {
- pk_warning ("already started <%p>", plugin);
+ g_warning ("already started <%p>", plugin);
return FALSE;
}
@@ -134,7 +133,7 @@ pk_plugin_draw (PkPlugin *plugin, cairo_t *cr)
if (klass->draw == NULL)
return FALSE;
- pk_debug ("draw on %p <%p>", cr, plugin);
+ g_debug ("draw on %p <%p>", cr, plugin);
return klass->draw (plugin, cr);
}
@@ -151,7 +150,7 @@ pk_plugin_button_press (PkPlugin *plugin, gint x, gint y, Time event_time)
if (klass->button_press == NULL)
return FALSE;
- pk_debug ("button_press %i,%i <%p>", x, y, plugin);
+ g_debug ("button_press %i,%i <%p>", x, y, plugin);
return klass->button_press (plugin, x, y, event_time);
}
@@ -168,7 +167,7 @@ pk_plugin_button_release (PkPlugin *plugin, gint x, gint y, Time event_time)
if (klass->button_release == NULL)
return FALSE;
- pk_debug ("button_release %i,%i <%p>", x, y, plugin);
+ g_debug ("button_release %i,%i <%p>", x, y, plugin);
return klass->button_release (plugin, x, y, event_time);
}
@@ -185,7 +184,7 @@ pk_plugin_motion (PkPlugin *plugin, gint x, gint y)
if (klass->motion == NULL)
return FALSE;
- pk_debug ("motion %i,%i <%p>", x, y, plugin);
+ g_debug ("motion %i,%i <%p>", x, y, plugin);
return klass->motion (plugin, x, y);
}
@@ -202,7 +201,7 @@ pk_plugin_enter (PkPlugin *plugin, gint x, gint y)
if (klass->enter == NULL)
return FALSE;
- pk_debug ("enter %i,%i <%p>", x, y, plugin);
+ g_debug ("enter %i,%i <%p>", x, y, plugin);
return klass->enter (plugin, x, y);
}
@@ -219,7 +218,7 @@ pk_plugin_leave (PkPlugin *plugin, gint x, gint y)
if (klass->leave == NULL)
return FALSE;
- pk_debug ("leave %i,%i <%p>", x, y, plugin);
+ g_debug ("leave %i,%i <%p>", x, y, plugin);
return klass->leave (plugin, x, y);
}
@@ -232,7 +231,7 @@ pk_plugin_request_refresh (PkPlugin *plugin)
{
g_return_val_if_fail (PK_IS_PLUGIN (plugin), FALSE);
- pk_debug ("emit refresh <%p>", plugin);
+ g_debug ("emit refresh <%p>", plugin);
g_signal_emit (plugin, signals [SIGNAL_REFRESH], 0);
return TRUE;
commit 57b70bc1db440a5ff4f4d24d4f401d4fe26077e5
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Jul 15 14:47:53 2011 +0100
Convert the daemon to use GDBus rather than dbus-glib
diff --git a/configure.ac b/configure.ac
index fa74cd0..81968b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -731,8 +731,8 @@ AC_SUBST(PK_YUM_PLUGIN_DIR, "\$(prefix)/lib/yum-plugins")
AC_SUBST(PK_DB_DIR, "\$(localstatedir)/lib/PackageKit")
AC_SUBST(PK_LOG_DIR, "\$(localstatedir)/log")
AC_SUBST(PK_PLUGIN_DIR, "\$(libdir)/packagekit-backend")
-AC_SUBST(PK_PLUGIN_CFLAGS, "-I\$(top_srcdir)/src -I\$(top_srcdir)/lib -DPK_COMPILATION $GLIB_CFLAGS $DBUS_CFLAGS $GMODULE_CFLAGS $GIO_CFLAGS")
-AC_SUBST(PK_PLUGIN_LIBS, "$GLIB_LIBS $DBUS_LIBS $GMODULE_LIBS $GIO_LIBS")
+AC_SUBST(PK_PLUGIN_CFLAGS, "-I\$(top_srcdir)/src -I\$(top_srcdir)/lib -DPK_COMPILATION $GLIB_CFLAGS $GMODULE_CFLAGS $GIO_CFLAGS")
+AC_SUBST(PK_PLUGIN_LIBS, "$GLIB_LIBS $GMODULE_LIBS $GIO_LIBS")
dnl ---------------------------------------------------------------------------
dnl - Makefiles, etc.
diff --git a/contrib/PackageKit.spec.in b/contrib/PackageKit.spec.in
index 76595fc..154899a 100644
--- a/contrib/PackageKit.spec.in
+++ b/contrib/PackageKit.spec.in
@@ -340,6 +340,7 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%{_datadir}/dbus-1/system-services/*.service
%{_libdir}/pm-utils/sleep.d/95packagekit
%{_libdir}/packagekit-plugins/*.so
+%{_datadir}/dbus-1/interfaces/*.xml
%files docs
%defattr(-,root,root,-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 5d57a82..c6a1bb9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -57,7 +57,6 @@ shared_SOURCES = \
pk-dbus.h \
pk-transaction.c \
pk-transaction.h \
- pk-transaction-dbus.h \
pk-backend.c \
pk-backend.h \
pk-network.c \
@@ -142,9 +141,7 @@ endif
BUILT_SOURCES = \
pk-marshal.c \
- pk-marshal.h \
- org.freedesktop.PackageKit.h \
- org.freedesktop.PackageKit.Transaction.h
+ pk-marshal.h
pk-marshal.c: pk-marshal.list
echo "#include \"pk-marshal.h\"" > $@ && \
@@ -153,20 +150,6 @@ pk-marshal.c: pk-marshal.list
pk-marshal.h: pk-marshal.list
glib-genmarshal $< --prefix=pk_marshal --header > $@
-org.freedesktop.PackageKit.h: org.freedesktop.PackageKit.xml
- $(LIBTOOL) --mode=execute dbus-binding-tool \
- --prefix=pk_engine \
- --mode=glib-server \
- --output=org.freedesktop.PackageKit.h \
- $(srcdir)/org.freedesktop.PackageKit.xml
-
-org.freedesktop.PackageKit.Transaction.h: org.freedesktop.PackageKit.Transaction.xml
- $(LIBTOOL) --mode=execute dbus-binding-tool \
- --prefix=pk_transaction \
- --mode=glib-server \
- --output=org.freedesktop.PackageKit.Transaction.h \
- $(srcdir)/org.freedesktop.PackageKit.Transaction.xml
-
if EGG_BUILD_TESTS
check_PROGRAMS = \
@@ -201,11 +184,13 @@ install-data-hook:
mkdir -p $(DESTDIR)$(PK_LOG_DIR); \
fi
-EXTRA_DIST = \
- pk-marshal.list \
+introspectiondir = $(datadir)/dbus-1/interfaces
+dist_introspection_DATA = \
org.freedesktop.PackageKit.xml \
- org.freedesktop.PackageKit.Transaction.xml \
- $(NULL)
+ org.freedesktop.PackageKit.Transaction.xml
+
+EXTRA_DIST = \
+ pk-marshal.list
clean-local:
rm -f *~
diff --git a/src/pk-backend.c b/src/pk-backend.c
index c6aa8bc..697076a 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -2557,7 +2557,7 @@ pk_backend_thread_create (PkBackend *backend, PkBackendThreadFunc func)
return FALSE;
}
- /* DBus-Glib isn't threadsafe */
+ /* backend isn't threadsafe */
if (!backend->priv->use_threads) {
g_warning ("not using threads, so daemon will block");
ret = func (backend);
diff --git a/src/pk-dbus.c b/src/pk-dbus.c
index 875f66c..6ea4bf1 100644
--- a/src/pk-dbus.c
+++ b/src/pk-dbus.c
@@ -24,8 +24,7 @@
#endif
#include <glib.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
+#include <gio/gio.h>
#include "pk-dbus.h"
@@ -33,9 +32,10 @@
struct PkDbusPrivate
{
- DBusGConnection *connection;
- DBusGProxy *proxy_pid;
- DBusGProxy *proxy_session;
+ GDBusConnection *connection;
+ GDBusProxy *proxy_pid;
+ GDBusProxy *proxy_uid;
+ GDBusProxy *proxy_session;
};
static gpointer pk_dbus_object = NULL;
@@ -45,7 +45,7 @@ G_DEFINE_TYPE (PkDbus, pk_dbus, G_TYPE_OBJECT)
/**
* pk_dbus_get_uid:
* @dbus: the #PkDbus instance
- * @sender: the sender, usually got from dbus_g_method_get_dbus()
+ * @sender: the sender
*
* Gets the process UID.
*
@@ -54,9 +54,9 @@ G_DEFINE_TYPE (PkDbus, pk_dbus, G_TYPE_OBJECT)
guint
pk_dbus_get_uid (PkDbus *dbus, const gchar *sender)
{
- guint uid;
- DBusError error;
- DBusConnection *con;
+ GError *error = NULL;
+ guint uid = G_MAXUINT;
+ GVariant *value = NULL;
g_return_val_if_fail (PK_IS_DBUS (dbus), G_MAXUINT);
g_return_val_if_fail (sender != NULL, G_MAXUINT);
@@ -68,15 +68,24 @@ pk_dbus_get_uid (PkDbus *dbus, const gchar *sender)
goto out;
}
- dbus_error_init (&error);
- con = dbus_g_connection_get_connection (dbus->priv->connection);
- uid = dbus_bus_get_unix_user (con, sender, &error);
- if (dbus_error_is_set (&error)) {
- g_warning ("Could not get uid for connection: %s %s", error.name, error.message);
- uid = G_MAXUINT;
+ value = g_dbus_proxy_call_sync (dbus->priv->proxy_uid,
+ "GetConnectionUnixUser",
+ g_variant_new ("(s)",
+ sender),
+ G_DBUS_CALL_FLAGS_NONE,
+ 2000,
+ NULL,
+ &error);
+ if (value == NULL) {
+ g_warning ("Failed to get uid for %s: %s",
+ sender, error->message);
+ g_error_free (error);
goto out;
}
+ g_variant_get (value, "(u)", &uid);
out:
+ if (value != NULL)
+ g_variant_unref (value);
return uid;
}
@@ -92,9 +101,9 @@ out:
guint
pk_dbus_get_pid (PkDbus *dbus, const gchar *sender)
{
- guint pid = G_MAXUINT;
- gboolean ret;
GError *error = NULL;
+ guint pid = G_MAXUINT;
+ GVariant *value = NULL;
g_return_val_if_fail (PK_IS_DBUS (dbus), G_MAXUINT);
g_return_val_if_fail (sender != NULL, G_MAXUINT);
@@ -110,19 +119,25 @@ pk_dbus_get_pid (PkDbus *dbus, const gchar *sender)
if (dbus->priv->proxy_pid == NULL)
goto out;
- /* get pid from DBus (quite slow) - TODO: cache this */
- ret = dbus_g_proxy_call (dbus->priv->proxy_pid,
- "GetConnectionUnixProcessID", &error,
- G_TYPE_STRING, sender,
- G_TYPE_INVALID,
- G_TYPE_UINT, &pid,
- G_TYPE_INVALID);
- if (!ret) {
- g_warning ("failed to get pid: %s", error->message);
+ /* get pid from DBus */
+ value = g_dbus_proxy_call_sync (dbus->priv->proxy_pid,
+ "GetConnectionUnixProcessID",
+ g_variant_new ("(s)",
+ sender),
+ G_DBUS_CALL_FLAGS_NONE,
+ 2000,
+ NULL,
+ &error);
+ if (value == NULL) {
+ g_warning ("Failed to get pid for %s: %s",
+ sender, error->message);
g_error_free (error);
goto out;
}
+ g_variant_get (value, "(u)", &pid);
out:
+ if (value != NULL)
+ g_variant_unref (value);
return pid;
}
@@ -185,10 +200,10 @@ out:
gchar *
pk_dbus_get_session (PkDbus *dbus, const gchar *sender)
{
- gboolean ret;
gchar *session = NULL;
GError *error = NULL;
guint pid;
+ GVariant *value = NULL;
g_return_val_if_fail (PK_IS_DBUS (dbus), NULL);
g_return_val_if_fail (sender != NULL, NULL);
@@ -213,20 +228,25 @@ pk_dbus_get_session (PkDbus *dbus, const gchar *sender)
goto out;
}
- /* get session from ConsoleKit (quite slow) */
- ret = dbus_g_proxy_call (dbus->priv->proxy_session,
- "GetSessionForUnixProcess", &error,
- G_TYPE_UINT, pid,
- G_TYPE_INVALID,
- DBUS_TYPE_G_OBJECT_PATH, &session,
- G_TYPE_INVALID);
- if (!ret) {
- g_warning ("failed to get session for %i: %s", pid, error->message);
+ /* get session from ConsoleKit */
+ value = g_dbus_proxy_call_sync (dbus->priv->proxy_session,
+ "GetSessionForUnixProcess",
+ g_variant_new ("(u)",
+ pid),
+ G_DBUS_CALL_FLAGS_NONE,
+ 2000,
+ NULL,
+ &error);
+ if (value == NULL) {
+ g_warning ("Failed to get session for %s: %s",
+ sender, error->message);
g_error_free (error);
goto out;
}
-
+ g_variant_get (value, "(o)", &session);
out:
+ if (value != NULL)
+ g_variant_unref (value);
return session;
}
@@ -243,6 +263,7 @@ pk_dbus_finalize (GObject *object)
dbus = PK_DBUS (object);
g_object_unref (dbus->priv->proxy_pid);
+ g_object_unref (dbus->priv->proxy_uid);
if (dbus->priv->proxy_session != NULL)
g_object_unref (dbus->priv->proxy_session);
@@ -275,14 +296,35 @@ pk_dbus_init (PkDbus *dbus)
dbus->priv = PK_DBUS_GET_PRIVATE (dbus);
/* use the bus to get the uid */
- dbus->priv->connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);
+ dbus->priv->connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
/* connect to DBus so we can get the pid */
dbus->priv->proxy_pid =
- dbus_g_proxy_new_for_name_owner (dbus->priv->connection,
- "org.freedesktop.DBus",
- "/org/freedesktop/DBus/Bus",
- "org.freedesktop.DBus", &error);
+ g_dbus_proxy_new_sync (dbus->priv->connection,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
+ G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
+ NULL,
+ "org.freedesktop.DBus",
+ "/org/freedesktop/DBus/Bus",
+ "org.freedesktop.DBus",
+ NULL,
+ &error);
+ if (dbus->priv->proxy_pid == NULL) {
+ g_warning ("cannot connect to DBus: %s", error->message);
+ g_error_free (error);
+ }
+
+ /* connect to DBus so we can get the uid */
+ dbus->priv->proxy_uid =
+ g_dbus_proxy_new_sync (dbus->priv->connection,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
+ G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
+ NULL,
+ "org.freedesktop.DBus",
+ "/org/freedesktop/DBus",
+ "org.freedesktop.DBus",
+ NULL,
+ &error);
if (dbus->priv->proxy_pid == NULL) {
g_warning ("cannot connect to DBus: %s", error->message);
g_error_free (error);
@@ -290,10 +332,15 @@ pk_dbus_init (PkDbus *dbus)
/* use ConsoleKit to get the session */
dbus->priv->proxy_session =
- dbus_g_proxy_new_for_name_owner (dbus->priv->connection,
- "org.freedesktop.ConsoleKit",
- "/org/freedesktop/ConsoleKit/Manager",
- "org.freedesktop.ConsoleKit.Manager", &error);
+ g_dbus_proxy_new_sync (dbus->priv->connection,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
+ G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
+ NULL,
+ "org.freedesktop.ConsoleKit",
+ "/org/freedesktop/ConsoleKit/Manager",
+ "org.freedesktop.ConsoleKit.Manager",
+ NULL,
+ &error);
if (dbus->priv->proxy_session == NULL) {
g_warning ("cannot connect to DBus: %s", error->message);
g_error_free (error);
diff --git a/src/pk-engine.c b/src/pk-engine.c
index bbbc1b7..8a3868c 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -37,8 +37,6 @@
#include <glib/gi18n.h>
#include <glib/gstdio.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
#include <packagekit-glib2/pk-version.h>
#ifdef USE_SECURITY_POLKIT
#include <polkit/polkit.h>
@@ -55,7 +53,6 @@
#include "pk-plugin.h"
#include "pk-shared.h"
#include "pk-transaction-db.h"
-#include "pk-transaction-dbus.h"
#include "pk-transaction.h"
#include "pk-transaction-list.h"
@@ -97,36 +94,16 @@ struct PkEnginePrivate
gboolean locked;
PkNetworkEnum network_state;
GPtrArray *plugins;
+ guint owner_id;
+ GDBusNodeInfo *introspection;
+ GDBusConnection *connection;
};
enum {
- SIGNAL_TRANSACTION_LIST_CHANGED,
- SIGNAL_REPO_LIST_CHANGED,
- SIGNAL_RESTART_SCHEDULE,
- SIGNAL_UPDATES_CHANGED,
- SIGNAL_CHANGED,
SIGNAL_QUIT,
SIGNAL_LAST
};
-enum {
- PROP_0,
- PROP_VERSION_MAJOR,
- PROP_VERSION_MINOR,
- PROP_VERSION_MICRO,
- PROP_BACKEND_NAME,
- PROP_BACKEND_DESCRIPTION,
- PROP_BACKEND_AUTHOR,
- PROP_ROLES,
- PROP_GROUPS,
- PROP_FILTERS,
- PROP_MIME_TYPES,
- PROP_LOCKED,
- PROP_NETWORK_STATE,
- PROP_DISTRO_ID,
- PROP_LAST,
-};
-
static guint signals[SIGNAL_LAST] = { 0 };
G_DEFINE_TYPE (PkEngine, pk_engine, G_TYPE_OBJECT)
@@ -179,7 +156,6 @@ pk_engine_error_get_type (void)
static void
pk_engine_reset_timer (PkEngine *engine)
{
- g_debug ("reset timer");
g_timer_reset (engine->priv->timer);
}
@@ -193,15 +169,38 @@ pk_engine_transaction_list_changed_cb (PkTransactionList *tlist, PkEngine *engin
g_return_if_fail (PK_IS_ENGINE (engine));
- transaction_list = pk_transaction_list_get_array (engine->priv->transaction_list);
-
g_debug ("emitting transaction-list-changed");
- g_signal_emit (engine, signals[SIGNAL_TRANSACTION_LIST_CHANGED], 0, transaction_list);
+ transaction_list = pk_transaction_list_get_array (engine->priv->transaction_list);
+ g_dbus_connection_emit_signal (engine->priv->connection,
+ NULL,
+ PK_DBUS_PATH,
+ PK_DBUS_INTERFACE,
+ "TransactionListChanged",
+ g_variant_new ("(^a&s)",
+ transaction_list),
+ NULL);
pk_engine_reset_timer (engine);
-
g_strfreev (transaction_list);
}
+/**
+ * pk_engine_emit_changed:
+ **/
+static void
+pk_engine_emit_changed (PkEngine *engine)
+{
+ g_return_if_fail (PK_IS_ENGINE (engine));
+
+ g_debug ("emitting changed");
+ g_dbus_connection_emit_signal (engine->priv->connection,
+ NULL,
+ PK_DBUS_PATH,
+ PK_DBUS_INTERFACE,
+ "Changed",
+ NULL,
+ NULL);
+}
+
#if 0
/**
* pk_engine_inhibit_locked_cb:
@@ -218,8 +217,7 @@ pk_engine_inhibit_locked_cb (PkInhibit *inhibit, gboolean is_locked, PkEngine *e
engine->priv->locked = is_locked;
/* emit */
- g_debug ("emitting changed");
- g_signal_emit (engine, signals[SIGNAL_CHANGED], 0);
+ pk_engine_emit_changed (engine);
}
#endif
@@ -230,8 +228,15 @@ static void
pk_engine_notify_repo_list_changed_cb (PkNotify *notify, PkEngine *engine)
{
g_return_if_fail (PK_IS_ENGINE (engine));
+
g_debug ("emitting repo-list-changed");
- g_signal_emit (engine, signals[SIGNAL_REPO_LIST_CHANGED], 0);
+ g_dbus_connection_emit_signal (engine->priv->connection,
+ NULL,
+ PK_DBUS_PATH,
+ PK_DBUS_INTERFACE,
+ "RepoListChanged",
+ NULL,
+ NULL);
}
/**
@@ -241,8 +246,15 @@ static void
pk_engine_notify_updates_changed_cb (PkNotify *notify, PkEngine *engine)
{
g_return_if_fail (PK_IS_ENGINE (engine));
+
g_debug ("emitting updates-changed");
- g_signal_emit (engine, signals[SIGNAL_UPDATES_CHANGED], 0);
+ g_dbus_connection_emit_signal (engine->priv->connection,
+ NULL,
+ PK_DBUS_PATH,
+ PK_DBUS_INTERFACE,
+ "UpdatesChanged",
+ NULL,
+ NULL);
}
/**
@@ -258,80 +270,6 @@ pk_engine_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkEngine *engin
}
/**
- * pk_engine_get_tid:
- **/
-void
-pk_engine_get_tid (PkEngine *engine, DBusGMethodInvocation *context)
-{
- gchar *new_tid;
- gboolean ret;
- gchar *sender = NULL;
- GError *error;
- GError *error_local = NULL;
-
- g_return_if_fail (PK_IS_ENGINE (engine));
-
- g_debug ("GetTid method called");
- sender = dbus_g_method_get_sender (context);
- new_tid = pk_transaction_db_generate_id (engine->priv->transaction_db);
-
- ret = pk_transaction_list_create (engine->priv->transaction_list, new_tid, sender, &error_local);
- if (!ret) {
- error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_CANNOT_ALLOCATE_TID, "could not create transaction: %s", error_local->message);
- dbus_g_method_return_error (context, error);
- g_error_free (error_local);
- goto out;
- }
-
- g_debug ("sending tid: '%s'", new_tid);
-
- /* reset the timer */
- pk_engine_reset_timer (engine);
-
- /* return TID */
- dbus_g_method_return (context, new_tid);
-out:
- g_free (new_tid);
- g_free (sender);
-}
-
-/**
- * pk_engine_get_daemon_state:
- **/
-gboolean
-pk_engine_get_daemon_state (PkEngine *engine, gchar **state, GError **error)
-{
- g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);
-
- if (state != NULL)
- *state = pk_transaction_list_get_state (engine->priv->transaction_list);
-
- /* reset the timer */
- pk_engine_reset_timer (engine);
-
- return TRUE;
-}
-
-/**
- * pk_engine_get_transaction_list:
- **/
-gboolean
-pk_engine_get_transaction_list (PkEngine *engine, gchar ***transaction_list, GError **error)
-{
- g_return_val_if_fail (engine != NULL, FALSE);
- g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);
-
- g_debug ("GetTransactionList method called");
- if (transaction_list != NULL)
- *transaction_list = pk_transaction_list_get_array (engine->priv->transaction_list);
-
- /* reset the timer */
- pk_engine_reset_timer (engine);
-
- return TRUE;
-}
-
-/**
* pk_engine_state_changed_cb:
*
* wait a little delay in case we get multiple requests or we need to setup state
@@ -367,79 +305,21 @@ pk_engine_state_changed_cb (gpointer data)
}
/**
- * pk_engine_state_has_changed:
- *
- * This should be called when tools like pup, pirut and yum-cli
- * have finished their transaction, and the update cache may not be valid.
+ * pk_engine_emit_restart_schedule:
**/
-gboolean
-pk_engine_state_has_changed (PkEngine *engine, const gchar *reason, GError **error)
-{
- gboolean is_priority = TRUE;
-
- g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);
-
- /* have we already scheduled priority? */
- if (engine->priv->timeout_priority_id != 0) {
- g_warning ("Already asked to refresh priority state less than %i seconds ago",
- engine->priv->timeout_priority);
- goto out;
- }
-
- /* don't bombard the user 10 seconds after resuming */
- if (g_strcmp0 (reason, "resume") == 0)
- is_priority = FALSE;
-
- /* are we normal, and already scheduled normal? */
- if (!is_priority && engine->priv->timeout_normal_id != 0) {
- g_warning ("Already asked to refresh normal state less than %i seconds ago",
- engine->priv->timeout_normal);
- goto out;
- }
-
- /* are we priority, and already scheduled normal? */
- if (is_priority && engine->priv->timeout_normal_id != 0) {
- /* clear normal, as we are about to schedule a priority */
- g_source_remove (engine->priv->timeout_normal_id);
- engine->priv->timeout_normal_id = 0;
- }
-
- /* wait a little delay in case we get multiple requests */
- if (is_priority) {
- engine->priv->timeout_priority_id = g_timeout_add_seconds (engine->priv->timeout_priority,
- pk_engine_state_changed_cb, engine);
- g_source_set_name_by_id (engine->priv->timeout_priority_id, "[PkEngine] priority");
- } else {
- engine->priv->timeout_normal_id = g_timeout_add_seconds (engine->priv->timeout_normal,
- pk_engine_state_changed_cb, engine);
- g_source_set_name_by_id (engine->priv->timeout_normal_id, "[PkEngine] normal");
- }
-
- /* reset the timer */
- pk_engine_reset_timer (engine);
-out:
- return TRUE;
-}
-
-/**
- * pk_engine_get_time_since_action:
- *
- * @seconds: Number of seconds since the role was called, or zero is unknown
- **/
-gboolean
-pk_engine_get_time_since_action (PkEngine *engine, const gchar *role_text, guint *seconds, GError **error)
+static void
+pk_engine_emit_restart_schedule (PkEngine *engine)
{
- PkRoleEnum role;
-
- g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);
-
- role = pk_role_enum_from_string (role_text);
- *seconds = pk_transaction_db_action_time_since (engine->priv->transaction_db, role);
-
- /* reset the timer */
- pk_engine_reset_timer (engine);
+ g_return_if_fail (PK_IS_ENGINE (engine));
- return TRUE;
+ g_debug ("emitting restart-schedule");
+ g_dbus_connection_emit_signal (engine->priv->connection,
+ NULL,
+ PK_DBUS_PATH,
+ PK_DBUS_INTERFACE,
+ "RestartSchedule",
+ NULL,
+ NULL);
}
/**
@@ -463,8 +343,7 @@ pk_engine_get_seconds_idle (PkEngine *engine)
/* have we been updated? */
if (engine->priv->notify_clients_of_upgrade) {
- g_debug ("emitting restart-schedule because of binary change");
- g_signal_emit (engine, signals[SIGNAL_RESTART_SCHEDULE], 0);
+ pk_engine_emit_restart_schedule (engine);
return G_MAXUINT;
}
@@ -479,34 +358,6 @@ pk_engine_get_seconds_idle (PkEngine *engine)
}
/**
- * pk_engine_suggest_daemon_quit:
- **/
-gboolean
-pk_engine_suggest_daemon_quit (PkEngine *engine, GError **error)
-{
- guint size;
-
- g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);
-
- /* attempt to kill background tasks */
- pk_transaction_list_cancel_background (engine->priv->transaction_list);
-
- /* can we exit straight away */
- size = pk_transaction_list_get_size (engine->priv->transaction_list);
- if (size == 0) {
- g_debug ("emitting quit");
- g_signal_emit (engine, signals[SIGNAL_QUIT], 0);
- return TRUE;
- }
-
- /* This will wait from 0..10 seconds, depending on the status of
- * pk_main_timeout_check_cb() - usually it should be a few seconds
- * after the last transaction */
- engine->priv->shutdown_as_soon_as_possible = TRUE;
- return TRUE;
-}
-
-/**
* pk_engine_set_proxy_internal:
**/
static gboolean
@@ -569,7 +420,7 @@ out:
#ifdef USE_SECURITY_POLKIT
typedef struct {
- DBusGMethodInvocation *context;
+ GDBusMethodInvocation *context;
PkEngine *engine;
gchar *sender;
gchar *value1;
@@ -604,7 +455,7 @@ pk_engine_action_obtain_proxy_authorization_finished_cb (PolkitAuthority *author
error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_CANNOT_SET_PROXY,
"setting the proxy failed, could not check for auth: %s",
error_local->message);
- dbus_g_method_return_error (state->context, error);
+ g_dbus_method_invocation_return_gerror (state->context, error);
g_error_free (error_local);
goto out;
}
@@ -613,14 +464,14 @@ pk_engine_action_obtain_proxy_authorization_finished_cb (PolkitAuthority *author
if (!polkit_authorization_result_get_is_authorized (result)) {
error = g_error_new_literal (PK_ENGINE_ERROR, PK_ENGINE_ERROR_CANNOT_SET_PROXY,
"failed to obtain auth");
- dbus_g_method_return_error (state->context, error);
+ g_dbus_method_invocation_return_gerror (state->context, error);
goto out;
}
/* admin already set value, so silently refuse value */
if (priv->using_hardcoded_proxy) {
g_debug ("cannot override admin set proxy");
- dbus_g_method_return (state->context);
+ g_dbus_method_invocation_return_value (state->context, NULL);
goto out;
}
@@ -635,7 +486,7 @@ pk_engine_action_obtain_proxy_authorization_finished_cb (PolkitAuthority *author
if (!ret) {
error = g_error_new_literal (PK_ENGINE_ERROR, PK_ENGINE_ERROR_CANNOT_SET_PROXY,
"setting the proxy failed");
- dbus_g_method_return_error (state->context, error);
+ g_dbus_method_invocation_return_gerror (state->context, error);
goto out;
}
@@ -648,7 +499,7 @@ pk_engine_action_obtain_proxy_authorization_finished_cb (PolkitAuthority *author
g_debug ("changing PAC proxy to %s for %s", state->value6, state->sender);
/* all okay */
- dbus_g_method_return (state->context);
+ g_dbus_method_invocation_return_value (state->context, NULL);
out:
if (result != NULL)
g_object_unref (result);
@@ -733,7 +584,7 @@ out:
/**
* pk_engine_set_proxy:
**/
-void
+static void
pk_engine_set_proxy (PkEngine *engine,
const gchar *proxy_http,
const gchar *proxy_https,
@@ -741,12 +592,12 @@ pk_engine_set_proxy (PkEngine *engine,
const gchar *proxy_socks,
const gchar *no_proxy,
const gchar *pac,
- DBusGMethodInvocation *context)
+ GDBusMethodInvocation *context)
{
guint len;
GError *error = NULL;
gboolean ret;
- gchar *sender = NULL;
+ const gchar *sender;
#ifdef USE_SECURITY_POLKIT
PolkitSubject *subject;
PkEngineDbusState *state;
@@ -767,7 +618,7 @@ pk_engine_set_proxy (PkEngine *engine,
error = g_error_new_literal (PK_ENGINE_ERROR,
PK_ENGINE_ERROR_CANNOT_SET_PROXY,
"http proxy was too long");
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
goto out;
}
@@ -777,12 +628,12 @@ pk_engine_set_proxy (PkEngine *engine,
error = g_error_new_literal (PK_ENGINE_ERROR,
PK_ENGINE_ERROR_CANNOT_SET_PROXY,
"ftp proxy was too long");
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
goto out;
}
/* save sender */
- sender = dbus_g_method_get_sender (context);
+ sender = g_dbus_method_invocation_get_sender (context);
/* is exactly the same proxy? */
ret = pk_engine_is_proxy_unchanged (engine, sender,
@@ -794,7 +645,7 @@ pk_engine_set_proxy (PkEngine *engine,
pac);
if (ret) {
g_debug ("not changing proxy as the same as before");
- dbus_g_method_return (context);
+ g_dbus_method_invocation_return_value (context, NULL);
goto out;
}
@@ -837,12 +688,12 @@ pk_engine_set_proxy (PkEngine *engine,
error = g_error_new_literal (PK_ENGINE_ERROR,
PK_ENGINE_ERROR_CANNOT_SET_PROXY,
"setting the proxy failed");
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
goto out;
}
/* all okay */
- dbus_g_method_return (context);
+ g_dbus_method_invocation_return_value (context, NULL);
#endif
/* reset the timer */
@@ -852,7 +703,7 @@ pk_engine_set_proxy (PkEngine *engine,
g_object_unref (subject);
#endif
out:
- g_free (sender);
+ return;
}
/**
@@ -921,7 +772,7 @@ pk_engine_action_obtain_root_authorization_finished_cb (PolkitAuthority *authori
PK_ENGINE_ERROR_CANNOT_SET_ROOT,
"could not check for auth: %s",
error_local->message);
- dbus_g_method_return_error (state->context, error);
+ g_dbus_method_invocation_return_gerror (state->context, error);
g_error_free (error_local);
goto out;
}
@@ -931,7 +782,7 @@ pk_engine_action_obtain_root_authorization_finished_cb (PolkitAuthority *authori
error = g_error_new_literal (PK_ENGINE_ERROR,
PK_ENGINE_ERROR_CANNOT_SET_ROOT,
"failed to obtain auth");
- dbus_g_method_return_error (state->context, error);
+ g_dbus_method_invocation_return_gerror (state->context, error);
goto out;
}
@@ -941,7 +792,7 @@ pk_engine_action_obtain_root_authorization_finished_cb (PolkitAuthority *authori
error = g_error_new_literal (PK_ENGINE_ERROR,
PK_ENGINE_ERROR_CANNOT_SET_ROOT,
"setting the root failed");
- dbus_g_method_return_error (state->context, error);
+ g_dbus_method_invocation_return_gerror (state->context, error);
goto out;
}
@@ -949,7 +800,7 @@ pk_engine_action_obtain_root_authorization_finished_cb (PolkitAuthority *authori
g_debug ("changing root to %s for %s", state->value1, state->sender);
/* all okay */
- dbus_g_method_return (state->context);
+ g_dbus_method_invocation_return_value (state->context, NULL);
out:
if (result != NULL)
g_object_unref (result);
@@ -1005,13 +856,15 @@ out:
/**
* pk_engine_set_root:
**/
-void
-pk_engine_set_root (PkEngine *engine, const gchar *root, DBusGMethodInvocation *context)
+static void
+pk_engine_set_root (PkEngine *engine,
+ const gchar *root,
+ GDBusMethodInvocation *context)
{
guint len;
GError *error = NULL;
gboolean ret;
- gchar *sender = NULL;
+ const gchar *sender;
#ifdef USE_SECURITY_POLKIT
PolkitSubject *subject;
PkEngineDbusState *state;
@@ -1029,25 +882,25 @@ pk_engine_set_root (PkEngine *engine, const gchar *root, DBusGMethodInvocation *
len = pk_strlen (root, 1024);
if (len == 1024) {
error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_CANNOT_SET_ROOT, "root was too long: %s", root);
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
goto out;
}
/* check prefix of root */
if (root[0] != '/') {
error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_CANNOT_SET_ROOT, "root is not absolute: %s", root);
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
goto out;
}
/* save sender */
- sender = dbus_g_method_get_sender (context);
+ sender = g_dbus_method_invocation_get_sender (context);
/* is exactly the same root? */
ret = pk_engine_is_root_unchanged (engine, sender, root);
if (ret) {
g_debug ("not changing root as the same as before");
- dbus_g_method_return (context);
+ g_dbus_method_invocation_return_value (context, NULL);
goto out;
}
@@ -1056,10 +909,10 @@ pk_engine_set_root (PkEngine *engine, const gchar *root, DBusGMethodInvocation *
ret = pk_engine_set_root_internal (engine, root, sender);
if (ret) {
g_debug ("using default root, so no need to authenticate");
- dbus_g_method_return (context);
+ g_dbus_method_invocation_return_value (context, NULL);
} else {
error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_CANNOT_SET_ROOT, "%s", "setting the root failed");
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
}
goto out;
}
@@ -1090,12 +943,12 @@ pk_engine_set_root (PkEngine *engine, const gchar *root, DBusGMethodInvocation *
ret = pk_engine_set_root_internal (engine, root, sender);
if (!ret) {
error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_CANNOT_SET_ROOT, "%s", "setting the root failed");
- dbus_g_method_return_error (context, error);
+ g_dbus_method_invocation_return_gerror (context, error);
goto out;
}
/* all okay */
- dbus_g_method_return (context);
+ g_dbus_method_invocation_return_value (context, NULL);
#endif
/* reset the timer */
@@ -1105,29 +958,35 @@ pk_engine_set_root (PkEngine *engine, const gchar *root, DBusGMethodInvocation *
g_object_unref (subject);
#endif
out:
- g_free (sender);
+ return;
}
/**
* pk_engine_can_authorize:
**/
static PkAuthorizeEnum
-pk_engine_can_authorize_action_id (PkEngine *engine, const gchar *action_id, DBusGMethodInvocation *context, GError **error)
+pk_engine_can_authorize_action_id (PkEngine *engine,
+ const gchar *action_id,
+ const gchar *sender,
+ GError **error)
{
#ifdef USE_SECURITY_POLKIT
gboolean ret;
- gchar *sender = NULL;
PkAuthorizeEnum authorize;
PolkitAuthorizationResult *res;
PolkitSubject *subject;
/* check subject */
- sender = dbus_g_method_get_sender (context);
subject = polkit_system_bus_name_new (sender);
/* check authorization (okay being sync as there's no blocking on the user) */
- res = polkit_authority_check_authorization_sync (engine->priv->authority, subject, action_id,
- NULL, POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE, NULL, error);
+ res = polkit_authority_check_authorization_sync (engine->priv->authority,
+ subject,
+ action_id,
+ NULL,
+ POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE,
+ NULL,
+ error);
if (res == NULL) {
authorize = PK_AUTHORIZE_ENUM_UNKNOWN;
goto out;
@@ -1153,7 +1012,6 @@ out:
if (res != NULL)
g_object_unref (res);
g_object_unref (subject);
- g_free (sender);
return authorize;
#else
return PK_AUTHORIZE_ENUM_YES;
@@ -1161,257 +1019,17 @@ out:
}
/**
- * pk_engine_can_authorize:
- **/
-void
-pk_engine_can_authorize (PkEngine *engine, const gchar *action_id, DBusGMethodInvocation *context)
-{
- gboolean ret;
- PkAuthorizeEnum result_enum;
- GError *error;
- GError *error_local = NULL;
-
- g_return_if_fail (PK_IS_ENGINE (engine));
-
- /* check is an action id */
- ret = g_str_has_prefix (action_id, "org.freedesktop.packagekit.");
- if (!ret) {
- error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_CANNOT_CHECK_AUTH,
- "action_id '%s' has the wrong prefix", action_id);
- dbus_g_method_return_error (context, error);
- return;
- }
-
- /* can we do this action? */
- result_enum = pk_engine_can_authorize_action_id (engine, action_id, context, &error_local);
- if (result_enum == PK_AUTHORIZE_ENUM_UNKNOWN) {
- error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_CANNOT_CHECK_AUTH,
- "failed to check authorisation %s: %s", action_id, error_local->message);
- g_error_free (error_local);
- dbus_g_method_return_error (context, error);
- return;
- }
-
- /* all okay */
- dbus_g_method_return (context, pk_authorize_type_enum_to_string (result_enum));
-}
-
-/**
- * pk_engine_get_property:
- **/
-static void
-pk_engine_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- PkEngine *engine = PK_ENGINE(object);
- gchar *tmp = NULL;
-
- switch (prop_id) {
- case PROP_VERSION_MAJOR:
- g_value_set_uint (value, PK_MAJOR_VERSION);
- break;
- case PROP_VERSION_MINOR:
- g_value_set_uint (value, PK_MINOR_VERSION);
- break;
- case PROP_VERSION_MICRO:
- g_value_set_uint (value, PK_MICRO_VERSION);
- break;
- case PROP_BACKEND_NAME:
- g_value_set_string (value, engine->priv->backend_name);
- break;
- case PROP_BACKEND_DESCRIPTION:
- g_value_set_string (value, engine->priv->backend_description);
- break;
- case PROP_BACKEND_AUTHOR:
- g_value_set_string (value, engine->priv->backend_author);
- break;
- case PROP_ROLES:
- tmp = pk_role_bitfield_to_string (engine->priv->roles);
- g_value_set_string (value, tmp);
- break;
- case PROP_GROUPS:
- tmp = pk_group_bitfield_to_string (engine->priv->groups);
- g_value_set_string (value, tmp);
- break;
- case PROP_FILTERS:
- tmp = pk_filter_bitfield_to_string (engine->priv->filters);
- g_value_set_string (value, tmp);
- break;
- case PROP_MIME_TYPES:
- g_value_set_string (value, engine->priv->mime_types);
- break;
- case PROP_LOCKED:
- g_value_set_boolean (value, engine->priv->locked);
- break;
- case PROP_NETWORK_STATE:
- g_value_set_string (value, pk_network_enum_to_string (engine->priv->network_state));
- break;
- case PROP_DISTRO_ID:
- g_value_set_string (value, engine->priv->distro_id);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
- g_free (tmp);
-}
-
-/**
- * pk_engine_set_property:
- **/
-static void
-pk_engine_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/**
* pk_engine_class_init:
* @klass: The PkEngineClass
**/
static void
pk_engine_class_init (PkEngineClass *klass)
{
- GParamSpec *pspec;
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = pk_engine_finalize;
- object_class->get_property = pk_engine_get_property;
- object_class->set_property = pk_engine_set_property;
-
- /**
- * PkEngine:version-major:
- */
- pspec = g_param_spec_uint ("version-major", NULL, NULL,
- 0, G_MAXUINT, 0,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_VERSION_MAJOR, pspec);
-
- /**
- * PkEngine:version-minor:
- */
- pspec = g_param_spec_uint ("version-minor", NULL, NULL,
- 0, G_MAXUINT, 0,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_VERSION_MINOR, pspec);
-
- /**
- * PkEngine:version-micro:
- */
- pspec = g_param_spec_uint ("version-micro", NULL, NULL,
- 0, G_MAXUINT, 0,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_VERSION_MICRO, pspec);
-
- /**
- * PkEngine:backend-name:
- */
- pspec = g_param_spec_string ("backend-name", NULL, NULL,
- NULL,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_BACKEND_NAME, pspec);
-
- /**
- * PkEngine:backend-description:
- */
- pspec = g_param_spec_string ("backend-description", NULL, NULL,
- NULL,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_BACKEND_DESCRIPTION, pspec);
-
- /**
- * PkEngine:backend-author:
- */
- pspec = g_param_spec_string ("backend-author", NULL, NULL,
- NULL,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_BACKEND_AUTHOR, pspec);
-
- /**
- * PkEngine:roles:
- */
- pspec = g_param_spec_string ("roles", NULL, NULL,
- NULL,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_ROLES, pspec);
-
- /**
- * PkEngine:groups:
- */
- pspec = g_param_spec_string ("groups", NULL, NULL,
- NULL,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_GROUPS, pspec);
-
- /**
- * PkEngine:filters:
- */
- pspec = g_param_spec_string ("filters", NULL, NULL,
- NULL,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_FILTERS, pspec);
-
- /**
- * PkEngine:mime-types:
- */
- pspec = g_param_spec_string ("mime-types", NULL, NULL,
- NULL,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_MIME_TYPES, pspec);
-
- /**
- * PkEngine:locked:
- */
- pspec = g_param_spec_boolean ("locked", NULL, NULL,
- FALSE,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_LOCKED, pspec);
-
- /**
- * PkEngine:network-state:
- */
- pspec = g_param_spec_string ("network-state", NULL, NULL,
- NULL,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_NETWORK_STATE, pspec);
-
- /**
- * PkEngine:distro-id:
- */
- pspec = g_param_spec_string ("distro-id", NULL, NULL,
- NULL,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_DISTRO_ID, pspec);
/* signals */
- signals[SIGNAL_TRANSACTION_LIST_CHANGED] =
- g_signal_new ("transaction-list-changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, g_cclosure_marshal_VOID__BOXED,
- G_TYPE_NONE, 1, G_TYPE_STRV);
- signals[SIGNAL_RESTART_SCHEDULE] =
- g_signal_new ("restart-schedule",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals[SIGNAL_REPO_LIST_CHANGED] =
- g_signal_new ("repo-list-changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals[SIGNAL_UPDATES_CHANGED] =
- g_signal_new ("updates-changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- signals[SIGNAL_CHANGED] =
- g_signal_new ("changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
signals[SIGNAL_QUIT] =
g_signal_new ("quit",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
@@ -1468,8 +1086,7 @@ pk_engine_network_state_changed_cb (PkNetwork *network, PkNetworkEnum network_st
engine->priv->network_state = network_state;
/* emit */
- g_debug ("emitting changed");
- g_signal_emit (engine, signals[SIGNAL_CHANGED], 0);
+ pk_engine_emit_changed (engine);
}
@@ -1669,12 +1286,359 @@ out:
}
/**
+ * _g_variant_new_maybe_string:
+ **/
+static GVariant *
+_g_variant_new_maybe_string (const gchar *value)
+{
+ if (value == NULL)
+ return g_variant_new_string ("");
+ return g_variant_new_string (value);
+}
+
+/**
+ * pk_engine_daemon_get_property:
+ **/
+static GVariant *
+pk_engine_daemon_get_property (GDBusConnection *connection_, const gchar *sender,
+ const gchar *object_path, const gchar *interface_name,
+ const gchar *property_name, GError **error,
+ gpointer user_data)
+{
+ gchar *tmp = NULL;
+ GVariant *retval = NULL;
+ PkEngine *engine = PK_ENGINE (user_data);
+
+ /* reset the timer */
+ pk_engine_reset_timer (engine);
+
+ if (g_strcmp0 (property_name, "VersionMajor") == 0) {
+ retval = g_variant_new_uint32 (PK_MAJOR_VERSION);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "VersionMinor") == 0) {
+ retval = g_variant_new_uint32 (PK_MINOR_VERSION);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "VersionMicro") == 0) {
+ retval = g_variant_new_uint32 (PK_MICRO_VERSION);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "BackendName") == 0) {
+ retval = g_variant_new_string (engine->priv->backend_name);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "BackendDescription") == 0) {
+ retval = _g_variant_new_maybe_string (engine->priv->backend_description);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "BackendAuthor") == 0) {
+ retval = _g_variant_new_maybe_string (engine->priv->backend_author);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "Roles") == 0) {
+ tmp = pk_role_bitfield_to_string (engine->priv->roles);
+ retval = g_variant_new_string (tmp);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "Groups") == 0) {
+ tmp = pk_group_bitfield_to_string (engine->priv->groups);
+ retval = g_variant_new_string (tmp);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "Filters") == 0) {
+ tmp = pk_filter_bitfield_to_string (engine->priv->filters);
+ retval = g_variant_new_string (tmp);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "MimeTypes") == 0) {
+ retval = g_variant_new_string (engine->priv->mime_types);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "Locked") == 0) {
+ retval = g_variant_new_boolean (engine->priv->locked);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "NetworkState") == 0) {
+ retval = g_variant_new_string (pk_network_enum_to_string (engine->priv->network_state));
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "DistroId") == 0) {
+ retval = _g_variant_new_maybe_string (engine->priv->distro_id);
+ goto out;
+ }
+ g_critical ("failed to get property %s",
+ property_name);
+out:
+ g_free (tmp);
+ return retval;
+}
+
+/**
+ * pk_engine_daemon_method_call:
+ **/
+static void
+pk_engine_daemon_method_call (GDBusConnection *connection_, const gchar *sender,
+ const gchar *object_path, const gchar *interface_name,
+ const gchar *method_name, GVariant *parameters,
+ GDBusMethodInvocation *invocation, gpointer user_data)
+{
+ gchar *data = NULL;
+ const gchar *tmp = NULL;
+ gboolean ret;
+ GError *error = NULL;
+ guint time_since;
+ GVariant *value = NULL;
+ PkAuthorizeEnum result_enum;
+ PkEngine *engine = PK_ENGINE (user_data);
+ PkRoleEnum role;
+ gchar **transaction_list;
+ gchar **array = NULL;
+ guint size;
+ gboolean is_priority = TRUE;
+
+ g_return_if_fail (PK_IS_ENGINE (engine));
+
+ /* reset the timer */
+ pk_engine_reset_timer (engine);
+
+ if (g_strcmp0 (method_name, "GetTimeSinceAction") == 0) {
+ g_variant_get (parameters, "(&s)", &tmp);
+ role = pk_role_enum_from_string (tmp);
+ time_since = pk_transaction_db_action_time_since (engine->priv->transaction_db,
+ role);
+ value = g_variant_new ("(u)", time_since);
+ g_dbus_method_invocation_return_value (invocation, value);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "GetDaemonState") == 0) {
+ data = pk_transaction_list_get_state (engine->priv->transaction_list);
+ value = g_variant_new ("(s)", data);
+ g_dbus_method_invocation_return_value (invocation, value);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "GetTid") == 0) {
+
+ g_debug ("GetTid method called");
+ data = pk_transaction_db_generate_id (engine->priv->transaction_db);
+ g_assert (data != NULL);
+ ret = pk_transaction_list_create (engine->priv->transaction_list,
+ data, sender, &error);
+ if (!ret) {
+ g_dbus_method_invocation_return_error (invocation,
+ PK_ENGINE_ERROR,
+ PK_ENGINE_ERROR_CANNOT_CHECK_AUTH,
+ "could not create transaction %s: %s",
+ data,
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ g_debug ("sending tid: '%s'", data);
+ value = g_variant_new ("(s)", data);
+ g_dbus_method_invocation_return_value (invocation, value);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "GetTransactionList") == 0) {
+ transaction_list = pk_transaction_list_get_array (engine->priv->transaction_list);
+ value = g_variant_new ("(^a&s)", transaction_list);
+ g_dbus_method_invocation_return_value (invocation, value);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "SuggestDaemonQuit") == 0) {
+
+ /* attempt to kill background tasks */
+ pk_transaction_list_cancel_background (engine->priv->transaction_list);
+
+ /* can we exit straight away */
+ size = pk_transaction_list_get_size (engine->priv->transaction_list);
+ if (size == 0) {
+ g_debug ("emitting quit");
+ g_signal_emit (engine, signals[SIGNAL_QUIT], 0);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ goto out;
+ }
+
+ /* This will wait from 0..10 seconds, depending on the status of
+ * pk_main_timeout_check_cb() - usually it should be a few seconds
+ * after the last transaction */
+ engine->priv->shutdown_as_soon_as_possible = TRUE;
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "StateHasChanged") == 0) {
+
+ /* have we already scheduled priority? */
+ if (engine->priv->timeout_priority_id != 0) {
+ g_debug ("Already asked to refresh priority state less than %i seconds ago",
+ engine->priv->timeout_priority);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ goto out;
+ }
+
+ /* don't bombard the user 10 seconds after resuming */
+ g_variant_get (parameters, "(&s)", &tmp);
+ if (g_strcmp0 (tmp, "resume") == 0)
+ is_priority = FALSE;
+
+ /* are we normal, and already scheduled normal? */
+ if (!is_priority && engine->priv->timeout_normal_id != 0) {
+ g_debug ("Already asked to refresh normal state less than %i seconds ago",
+ engine->priv->timeout_normal);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ goto out;
+ }
+
+ /* are we priority, and already scheduled normal? */
+ if (is_priority && engine->priv->timeout_normal_id != 0) {
+ /* clear normal, as we are about to schedule a priority */
+ g_source_remove (engine->priv->timeout_normal_id);
+ engine->priv->timeout_normal_id = 0;
+ }
+
+ /* wait a little delay in case we get multiple requests */
+ if (is_priority) {
+ engine->priv->timeout_priority_id =
+ g_timeout_add_seconds (engine->priv->timeout_priority,
+ pk_engine_state_changed_cb, engine);
+ g_source_set_name_by_id (engine->priv->timeout_priority_id,
+ "[PkEngine] priority");
+ } else {
+ engine->priv->timeout_normal_id =
+ g_timeout_add_seconds (engine->priv->timeout_normal,
+ pk_engine_state_changed_cb, engine);
+ g_source_set_name_by_id (engine->priv->timeout_normal_id, "[PkEngine] normal");
+ }
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "SetRoot") == 0) {
+ g_variant_get (parameters, "(&s)", &tmp);
+ pk_engine_set_root (engine,
+ tmp,
+ invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "SetProxy") == 0) {
+
+ array = g_new0 (gchar *, 7);
+ g_variant_get (parameters, "(ssssss)",
+ &array[0],
+ &array[1],
+ &array[2],
+ &array[3],
+ &array[4],
+ &array[5]);
+ pk_engine_set_proxy (engine,
+ array[0],
+ array[1],
+ array[2],
+ array[3],
+ array[4],
+ array[5],
+ invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "CanAuthorize") == 0) {
+
+ g_variant_get (parameters, "(&s)", &tmp);
+ result_enum = pk_engine_can_authorize_action_id (engine,
+ tmp,
+ sender,
+ &error);
+ if (result_enum == PK_AUTHORIZE_ENUM_UNKNOWN) {
+ g_dbus_method_invocation_return_error (invocation,
+ PK_ENGINE_ERROR,
+ PK_ENGINE_ERROR_CANNOT_CHECK_AUTH,
+ "failed to check authorisation %s: %s",
+ tmp,
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* all okay */
+ value = g_variant_new ("(s)", pk_authorize_type_enum_to_string (result_enum));
+ g_dbus_method_invocation_return_value (invocation, value);
+ goto out;
+ }
+out:
+ g_strfreev (array);
+ g_free (data);
+}
+
+/**
+ * pk_engine_on_bus_acquired_cb:
+ **/
+static void
+pk_engine_on_bus_acquired_cb (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data)
+{
+ PkEngine *engine = PK_ENGINE (user_data);
+ guint registration_id;
+
+ static const GDBusInterfaceVTable interface_vtable = {
+ pk_engine_daemon_method_call,
+ pk_engine_daemon_get_property,
+ NULL
+ };
+
+ /* save copy for emitting signals */
+ engine->priv->connection = g_object_ref (connection);
+
+ /* register org.freedesktop.PackageKit */
+ registration_id = g_dbus_connection_register_object (connection,
+ PK_DBUS_PATH,
+ engine->priv->introspection->interfaces[0],
+ &interface_vtable,
+ engine, /* user_data */
+ NULL, /* user_data_free_func */
+ NULL); /* GError** */
+ g_assert (registration_id > 0);
+}
+
+
+/**
+ * pk_engine_on_name_acquired_cb:
+ **/
+static void
+pk_engine_on_name_acquired_cb (GDBusConnection *connection_,
+ const gchar *name,
+ gpointer user_data)
+{
+ g_debug ("PkEngine: acquired name: %s", name);
+}
+
+
+/**
+ * pk_engine_on_name_lost_cb:
+ **/
+static void
+pk_engine_on_name_lost_cb (GDBusConnection *connection_,
+ const gchar *name,
+ gpointer user_data)
+{
+ PkEngine *engine = PK_ENGINE (user_data);
+ g_debug ("PkEngine: lost name: %s", name);
+ g_signal_emit (engine, signals[SIGNAL_QUIT], 0);
+}
+
+/**
* pk_engine_init:
**/
static void
pk_engine_init (PkEngine *engine)
{
- DBusGConnection *connection;
gboolean ret;
gchar *filename;
gchar *root;
@@ -1684,12 +1648,20 @@ pk_engine_init (PkEngine *engine)
gchar *proxy_socks;
gchar *no_proxy;
gchar *pac;
-#if defined(USE_SECURITY_POLKIT_NEW) && defined(HAVE_POLKIT_AUTHORITY_GET_SYNC)
GError *error = NULL;
-#endif
engine->priv = PK_ENGINE_GET_PRIVATE (engine);
+ /* load introspection from file */
+ engine->priv->introspection = pk_load_introspection (DATADIR "/dbus-1/interfaces/"
+ PK_DBUS_INTERFACE ".xml",
+ &error);
+ if (engine->priv->introspection == NULL) {
+ g_error ("PkEngine: failed to load daemon introspection: %s",
+ error->message);
+ g_error_free (error);
+ }
+
/* use the config file */
engine->priv->conf = pk_conf_new ();
@@ -1739,11 +1711,6 @@ pk_engine_init (PkEngine *engine)
engine->priv->timeout_priority_id = 0;
engine->priv->timeout_normal_id = 0;
- /* get another connection */
- connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);
- if (connection == NULL)
- g_error ("no connection");
-
/* add the interface */
engine->priv->notify = pk_notify_new ();
g_signal_connect (engine->priv->notify, "repo-list-changed",
@@ -1815,6 +1782,17 @@ pk_engine_init (PkEngine *engine)
/* we use a trasaction db to store old transactions and to do rollbacks */
engine->priv->transaction_db = pk_transaction_db_new ();
+ /* own the object */
+ engine->priv->owner_id =
+ g_bus_own_name (G_BUS_TYPE_SYSTEM,
+ PK_DBUS_SERVICE,
+ G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT |
+ G_BUS_NAME_OWNER_FLAGS_REPLACE,
+ pk_engine_on_bus_acquired_cb,
+ pk_engine_on_name_acquired_cb,
+ pk_engine_on_name_lost_cb,
+ engine, NULL);
+
/* initialize plugins */
pk_engine_plugin_phase (engine,
PK_PLUGIN_PHASE_INIT);
@@ -1856,6 +1834,15 @@ pk_engine_finalize (GObject *object)
engine->priv->timeout_normal_id = 0;
}
+ /* unown */
+ if (engine->priv->owner_id > 0)
+ g_bus_unown_name (engine->priv->owner_id);
+
+ if (engine->priv->introspection != NULL)
+ g_dbus_node_info_unref (engine->priv->introspection);
+ if (engine->priv->connection != NULL)
+ g_object_unref (engine->priv->connection);
+
/* compulsory gobjects */
g_timer_destroy (engine->priv->timer);
g_object_unref (engine->priv->monitor_conf);
diff --git a/src/pk-engine.h b/src/pk-engine.h
index df578ba..266ab30 100644
--- a/src/pk-engine.h
+++ b/src/pk-engine.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2007-2008 Richard Hughes <richard at hughsie.com>
+ * Copyright (C) 2007-2011 Richard Hughes <richard at hughsie.com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -23,7 +23,6 @@
#define __PK_ENGINE_H
#include <glib-object.h>
-#include <dbus/dbus-glib.h>
#define PK_DBUS_SERVICE "org.freedesktop.PackageKit"
#define PK_DBUS_PATH "/org/freedesktop/PackageKit"
@@ -72,42 +71,6 @@ GType pk_engine_error_get_type (void);
GType pk_engine_get_type (void);
PkEngine *pk_engine_new (void);
-/* general */
guint pk_engine_get_seconds_idle (PkEngine *engine);
-/* dbus methods */
-void pk_engine_get_tid (PkEngine *engine,
- DBusGMethodInvocation *context);
-gboolean pk_engine_get_daemon_state (PkEngine *engine,
- gchar **state,
- GError **error);
-gboolean pk_engine_get_time_since_action (PkEngine *engine,
- const gchar *role_text,
- guint *seconds,
- GError **error);
-gboolean pk_engine_get_transaction_list (PkEngine *engine,
- gchar ***transaction_list,
- GError **error);
-gboolean pk_engine_state_has_changed (PkEngine *engine,
- const gchar *reason,
- GError **error);
-gboolean pk_engine_suggest_daemon_quit (PkEngine *engine,
- GError **error);
-void pk_engine_set_proxy (PkEngine *engine,
- const gchar *proxy_http,
- const gchar *proxy_https,
- const gchar *proxy_ftp,
- const gchar *proxy_socks,
- const gchar *no_proxy,
- const gchar *pac,
- DBusGMethodInvocation *context);
-void pk_engine_set_root (PkEngine *engine,
- const gchar *root,
- DBusGMethodInvocation *context);
-void pk_engine_can_authorize (PkEngine *engine,
- const gchar *action_id,
- DBusGMethodInvocation *context);
-
-G_END_DECLS
-
#endif /* __PK_ENGINE_H */
diff --git a/src/pk-main.c b/src/pk-main.c
index 2a2c9fe..4b1ecb5 100644
--- a/src/pk-main.c
+++ b/src/pk-main.c
@@ -29,8 +29,6 @@
#include <locale.h>
#include <glib.h>
#include <glib/gi18n.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
#include <packagekit-glib2/pk-debug.h>
#if GLIB_CHECK_VERSION(2,29,4)
@@ -42,81 +40,11 @@
#include "pk-syslog.h"
#include "pk-transaction.h"
#include "pk-backend.h"
-#include "org.freedesktop.PackageKit.h"
static guint exit_idle_time;
static GMainLoop *loop;
/**
- * pk_object_register:
- * @connection: What we want to register to
- * @object: The GObject we want to register
- *
- * Register org.freedesktop.PackageKit on the system bus.
- * This function MUST be called before DBUS service will work.
- *
- * Return value: success
- **/
-G_GNUC_WARN_UNUSED_RESULT static gboolean
-pk_object_register (DBusGConnection *connection, GObject *object, GError **error)
-{
- DBusGProxy *bus_proxy = NULL;
- guint request_name_result;
- gboolean ret;
- gchar *message;
-
- bus_proxy = dbus_g_proxy_new_for_name (connection,
- DBUS_SERVICE_DBUS,
- DBUS_PATH_DBUS,
- DBUS_INTERFACE_DBUS);
-
- ret = dbus_g_proxy_call (bus_proxy, "RequestName", error,
- G_TYPE_STRING, PK_DBUS_SERVICE,
- G_TYPE_UINT, 0,
- G_TYPE_INVALID,
- G_TYPE_UINT, &request_name_result,
- G_TYPE_INVALID);
-
- /* free the bus_proxy */
- g_object_unref (G_OBJECT (bus_proxy));
-
- /* abort as the DBUS method failed */
- if (!ret) {
- g_clear_error (error);
- message = g_strdup_printf ("%s\n%s\n* %s\n* %s\n* %s '%s'\n",
- /* TRANSLATORS: failed due to DBus security */
- _("Could not request the D-Bus name."),
- /* TRANSLATORS: only two ways this can fail... */
- _("This can happen for three reasons:"),
- /* TRANSLATORS: only allowed to be running once */
- _("The daemon is already running"),
- /* TRANSLATORS: only allowed to be owned by root */
- _("The correct user is not launching the executable (usually root)"),
- /* TRANSLATORS: or we are installed in a prefix */
- _("The org.freedesktop.PackageKit.conf file is not "
- "installed in the system directory:"),
- "/etc/dbus-1/system.d");
- g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_DENIED, "%s", message);
- g_free (message);
- return FALSE;
- }
-
- /* already running */
- if (request_name_result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
- g_set_error (error, PK_ENGINE_ERROR, PK_ENGINE_ERROR_DENIED,
- "Already running on this machine");
- return FALSE;
- }
-
- dbus_g_object_type_install_info (PK_TYPE_ENGINE, &dbus_glib_pk_engine_object_info);
- dbus_g_error_domain_register (PK_ENGINE_ERROR, NULL, PK_ENGINE_TYPE_ERROR);
- dbus_g_error_domain_register (PK_TRANSACTION_ERROR, NULL, PK_TRANSACTION_TYPE_ERROR);
- dbus_g_connection_register_g_object (connection, PK_DBUS_PATH, object);
-
- return TRUE;
-}
-
-/**
* timed_exit_cb:
* @loop: The main loop
*
@@ -196,7 +124,6 @@ pk_main_sigint_handler (int sig)
int
main (int argc, char *argv[])
{
- DBusGConnection *system_connection;
gboolean ret = TRUE;
gboolean disable_timer = FALSE;
gboolean version = FALSE;
@@ -244,7 +171,6 @@ main (int argc, char *argv[])
if (! g_thread_supported ())
g_thread_init (NULL);
- dbus_g_thread_init ();
g_type_init ();
/* TRANSLATORS: describing the service that is running */
@@ -279,15 +205,6 @@ main (int argc, char *argv[])
/* don't let GIO start it's own session bus: http://bugzilla.gnome.org/show_bug.cgi?id=526454 */
setenv ("GIO_USE_VFS", "local", 1);
- /* check dbus connections, exit if not valid */
- system_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
- if (error) {
- /* TRANSLATORS: fatal error, dbus is not running */
- g_print ("%s: %s\n", _("Cannot connect to the system bus"), error->message);
- g_error_free (error);
- goto exit_program;
- }
-
/* we don't actually need to do this, except it rules out the
* 'it works from the command line but not service activation' bugs */
#ifdef HAVE_CLEARENV
@@ -341,24 +258,15 @@ main (int argc, char *argv[])
g_signal_connect (engine, "quit",
G_CALLBACK (pk_main_quit_cb), loop);
- if (!pk_object_register (system_connection, G_OBJECT (engine), &error)) {
- /* TRANSLATORS: cannot register on system bus, unknown reason -- geeky error follows */
- g_print ("%s %s\n", _("Error trying to start:"), error->message);
- g_error_free (error);
- goto out;
- }
-
/* Only timeout and close the mainloop if we have specified it
* on the command line */
if (timed_exit)
g_timeout_add_seconds (20, (GSourceFunc) timed_exit_cb, loop);
- /* only poll every 10 seconds when we are alive */
+ /* only poll when we are alive */
if (exit_idle_time != 0 && !disable_timer) {
timer_id = g_timeout_add_seconds (5, (GSourceFunc) pk_main_timeout_check_cb, engine);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (timer_id, "[PkMain] main poll");
-#endif
}
/* immediatly exit */
diff --git a/src/pk-network-stack-connman.c b/src/pk-network-stack-connman.c
index 44f9cd2..0211382 100644
--- a/src/pk-network-stack-connman.c
+++ b/src/pk-network-stack-connman.c
@@ -25,7 +25,6 @@
#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
-#include <dbus/dbus-glib.h>
#include "pk-network-stack-connman.h"
#include "pk-conf.h"
@@ -36,8 +35,8 @@ struct PkNetworkStackConnmanPrivate
guint watch_id;
PkConf *conf;
gboolean is_enabled;
- DBusGConnection *bus;
- DBusGProxy *proxy;
+ GDBusConnection *bus;
+ GDBusProxy *proxy;
};
G_DEFINE_TYPE (PkNetworkStackConnman, pk_network_stack_connman, PK_TYPE_NETWORK_STACK)
@@ -89,7 +88,7 @@ pk_network_stack_connman_get_connection_type (const GValue *value)
static PkNetworkEnum
pk_network_stack_connman_get_state (PkNetworkStack *nstack)
{
- DBusGProxy *proxy, *proxy_service;
+ GDBusProxy *proxy, *proxy_service;
GError *error = NULL;
GHashTable *hash_manager = NULL;
GHashTable *hash_service = NULL;
@@ -99,13 +98,13 @@ pk_network_stack_connman_get_state (PkNetworkStack *nstack)
gchar *state;
PkNetworkEnum type;
PkNetworkStackConnman *nstack_connman = PK_NETWORK_STACK_CONNMAN (nstack);
- DBusGConnection *connection = nstack_connman->priv->bus;
+ GDBusConnection *connection = nstack_connman->priv->bus;
proxy = nstack_connman->priv->proxy;
proxy_service = NULL;
/* get services */
- dbus_g_proxy_call (proxy, "GetProperties", &error,
+ g_dbus_proxy_call_sync (proxy, "GetProperties", &error,
G_TYPE_INVALID,
dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &hash_manager,
G_TYPE_INVALID);
@@ -132,7 +131,7 @@ pk_network_stack_connman_get_state (PkNetworkStack *nstack)
g_debug ("service path is %s", path);
- proxy_service = dbus_g_proxy_new_for_name (connection,
+ proxy_service = g_dbus_proxy_new_sync (connection,
CONNMAN_DBUS_NAME,
path,
CONNMAN_SERVICE_DBUS_INTERFACE);
@@ -152,7 +151,7 @@ pk_network_stack_connman_get_state (PkNetworkStack *nstack)
/* now proxy_service point to first available service */
/* get connection type for i t*/
- dbus_g_proxy_call (proxy_service, "GetProperties", &error,
+ g_dbus_proxy_call_sync (proxy_service, "GetProperties", &error,
G_TYPE_INVALID,
dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &hash_service,
G_TYPE_INVALID);
@@ -174,14 +173,18 @@ pk_network_stack_connman_get_state (PkNetworkStack *nstack)
* pk_network_stack_connman_state_changed
**/
static void
-pk_network_stack_connman_state_changed (DBusGProxy *proxy, const char *property,
- GValue *value, gpointer user_data)
+pk_network_stack_connman_state_changed (PkNetworkStackConnman *nstack_connman,
+ GVariant *parameters)
{
PkNetworkEnum network_state;
PkNetworkStackConnman *nstack_connman = (PkNetworkStackConnman *) user_data;
g_return_if_fail (PK_IS_NETWORK_STACK_CONNMAN (nstack_connman));
+ /* I can't test this, but I'm guessing this is about right...:
+ * g_variant_get (parameters, "&sv", &property, &value);
+ */
+
if (g_str_equal (property, "State") == TRUE) {
gchar *state;
@@ -193,7 +196,34 @@ pk_network_stack_connman_state_changed (DBusGProxy *proxy, const char *property,
g_debug ("emitting network-state-changed: %s", pk_network_enum_to_string (network_state));
g_signal_emit_by_name (PK_NETWORK_STACK (nstack_connman), "state-changed", network_state);
}
+}
+
+
+/**
+ * pk_network_stack_connman_dbus_signal_cb:
+ **/
+static void
+pk_network_stack_connman_dbus_signal_cb (GDBusProxy *proxy,
+ gchar *sender_name,
+ gchar *signal_name,
+ GVariant *parameters,
+ PkNetworkStackConnman *nstack_connman)
+{
+ PkNetworkEnum state;
+
+ g_return_if_fail (PK_IS_NETWORK_STACK_NM (nstack_connman));
+
+ /* do not use */
+ if (!nstack_connman->priv->is_enabled) {
+ g_debug ("not enabled, so ignoring %s", signal_name);
+ return;
+ }
+ /* don't use parameters, just refresh state */
+ if (g_strcmp0 (signal_name, "PropertyChanged") == 0) {
+ pk_network_stack_connman_state_changed (nstack_connman,
+ parameters);
+ }
}
/**
@@ -243,7 +273,7 @@ static void
pk_network_stack_connman_init (PkNetworkStackConnman *nstack_connman)
{
GError *error = NULL;
- DBusGProxy *proxy;
+ GDBusProxy *proxy;
nstack_connman->priv = PK_NETWORK_STACK_CONNMAN_GET_PRIVATE (nstack_connman);
nstack_connman->priv->conf = pk_conf_new ();
@@ -253,7 +283,7 @@ pk_network_stack_connman_init (PkNetworkStackConnman *nstack_connman)
G_TYPE_VALUE, G_TYPE_INVALID);
/* get system connection */
- nstack_connman->priv->bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+ nstack_connman->priv->bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
if (nstack_connman->priv->bus == NULL) {
g_warning ("Couldn't connect to system bus: %s", error->message);
g_error_free (error);
@@ -270,21 +300,24 @@ pk_network_stack_connman_init (PkNetworkStackConnman *nstack_connman)
nstack_connman,
NULL);
- proxy = dbus_g_proxy_new_for_name_owner (nstack_connman->priv->bus,
- CONNMAN_DBUS_NAME,
- CONNMAN_MANAGER_DBUS_PATH,
- CONNMAN_MANAGER_DBUS_INTERFACE, &error);
- nstack_connman->priv->proxy = proxy;
-
- if (error != NULL) {
+ proxy = g_dbus_proxy_new_sync (nstack_connman->priv->bus,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
+ NULL,
+ CONNMAN_DBUS_NAME,
+ CONNMAN_MANAGER_DBUS_PATH,
+ CONNMAN_MANAGER_DBUS_INTERFACE,
+ NULL,
+ &error);
+ if (proxy == NULL) {
g_warning ("Cannot connect to connman: %s", error->message);
g_error_free (error);
return;
}
- dbus_g_proxy_add_signal (proxy, "PropertyChanged",
- G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID);
- dbus_g_proxy_connect_signal (proxy, "PropertyChanged",
- G_CALLBACK(pk_network_stack_connman_state_changed), nstack_connman, NULL);
+ nstack_connman->priv->proxy = proxy;
+ g_signal_connect (nstack_connman->priv->proxy,
+ "g-signal",
+ G_CALLBACK (pk_network_stack_connman_dbus_signal_cb),
+ nstack_connman);
}
/**
diff --git a/src/pk-network-stack-nm.c b/src/pk-network-stack-nm.c
index d330c8f..b38fe32 100644
--- a/src/pk-network-stack-nm.c
+++ b/src/pk-network-stack-nm.c
@@ -24,7 +24,6 @@
#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
-#include <dbus/dbus-glib.h>
#include <NetworkManager.h>
#include "pk-network-stack-nm.h"
@@ -39,9 +38,9 @@ struct PkNetworkStackNmPrivate
{
guint watch_id;
PkConf *conf;
- DBusGConnection *bus;
+ GDBusConnection *bus;
gboolean is_enabled;
- DBusGProxy *proxy_changed;
+ GDBusProxy *proxy_changed;
};
G_DEFINE_TYPE (PkNetworkStackNm, pk_network_stack_nm, PK_TYPE_NETWORK_STACK)
@@ -54,7 +53,8 @@ G_DEFINE_TYPE (PkNetworkStackNm, pk_network_stack_nm, PK_TYPE_NETWORK_STACK)
* important connection even bridged we should prioritise it
**/
static NMDeviceType
-pk_network_stack_nm_prioritise_connection_type (NMDeviceType type_old, NMDeviceType type_new)
+pk_network_stack_nm_prioritise_connection_type (NMDeviceType type_old,
+ NMDeviceType type_new)
{
NMDeviceType type = type_old;
/* by sheer fluke we can use the enum ordering */
@@ -67,32 +67,36 @@ pk_network_stack_nm_prioritise_connection_type (NMDeviceType type_old, NMDeviceT
* pk_network_stack_nm_get_active_connection_type_for_device:
**/
static NMDeviceType
-pk_network_stack_nm_get_active_connection_type_for_device (PkNetworkStackNm *nstack_nm, const gchar *device)
+pk_network_stack_nm_get_active_connection_type_for_device (PkNetworkStackNm *nstack_nm,
+ const gchar *device)
{
- gboolean ret;
+ GDBusProxy *proxy;
GError *error = NULL;
- DBusGProxy *proxy;
- GValue value = { 0 };
+ GVariant *value = NULL;
NMDeviceType type = NM_DEVICE_TYPE_UNKNOWN;
/* get if the device is default */
- proxy = dbus_g_proxy_new_for_name (nstack_nm->priv->bus, "org.freedesktop.NetworkManager",
- device, "org.freedesktop.DBus.Properties");
- ret = dbus_g_proxy_call (proxy, "Get", &error,
- G_TYPE_STRING, "org.freedesktop.NetworkManager.Device",
- G_TYPE_STRING, "DeviceType",
- G_TYPE_INVALID,
- G_TYPE_VALUE, &value,
- G_TYPE_INVALID);
- if (!ret) {
+ proxy = g_dbus_proxy_new_sync (nstack_nm->priv->bus,
+ G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
+ NULL,
+ "org.freedesktop.NetworkManager",
+ device,
+ "org.freedesktop.NetworkManager.Device",
+ NULL,
+ &error);
+ if (proxy == NULL) {
g_warning ("Error getting DeviceType: %s", error->message);
g_error_free (error);
goto out;
}
- type = g_value_get_uint (&value);
+ value = g_dbus_proxy_get_cached_property (proxy, "DeviceType");
+ type = g_variant_get_uint32 (value);
g_debug ("type: %i", type);
out:
- g_object_unref (proxy);
+ if (proxy != NULL)
+ g_object_unref (proxy);
+ if (value != NULL)
+ g_variant_unref (value);
return type;
}
@@ -100,35 +104,35 @@ out:
* pk_network_stack_nm_get_active_connection_type_for_connection:
**/
static NMDeviceType
-pk_network_stack_nm_get_active_connection_type_for_connection (PkNetworkStackNm *nstack_nm, const gchar *active_connection)
+pk_network_stack_nm_get_active_connection_type_for_connection (PkNetworkStackNm *nstack_nm,
+ const gchar *active_connection)
{
- guint i;
- gboolean ret;
- GError *error = NULL;
- DBusGProxy *proxy;
const gchar *device;
- GValue value_default = { 0 };
- GValue value_devices = { 0 };
gboolean is_default;
- GPtrArray *devices;
- NMDeviceType type_tmp;
+ GDBusProxy *proxy;
+ GError *error = NULL;
+ GVariantIter *iter = NULL;
+ GVariant *value_default = NULL;
+ GVariant *value_devices = NULL;
NMDeviceType type = NM_DEVICE_TYPE_UNKNOWN;
+ NMDeviceType type_tmp;
/* get if the device is default */
- proxy = dbus_g_proxy_new_for_name (nstack_nm->priv->bus, "org.freedesktop.NetworkManager",
- active_connection, "org.freedesktop.DBus.Properties");
- ret = dbus_g_proxy_call (proxy, "Get", &error,
- G_TYPE_STRING, "org.freedesktop.NetworkManager.Connection.Active",
- G_TYPE_STRING, "Default",
- G_TYPE_INVALID,
- G_TYPE_VALUE, &value_default,
- G_TYPE_INVALID);
- if (!ret) {
+ proxy = g_dbus_proxy_new_sync (nstack_nm->priv->bus,
+ G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
+ NULL,
+ "org.freedesktop.NetworkManager",
+ active_connection,
+ "org.freedesktop.NetworkManager.Connection.Active",
+ NULL,
+ &error);
+ if (proxy == NULL) {
g_warning ("Error getting Default: %s", error->message);
g_error_free (error);
goto out;
}
- is_default = g_value_get_boolean (&value_default);
+ value_default = g_dbus_proxy_get_cached_property (proxy, "Default");
+ is_default = g_variant_get_boolean (value_default);
g_debug ("is_default: %i", is_default);
if (!is_default) {
g_debug ("not default, skipping");
@@ -136,32 +140,25 @@ pk_network_stack_nm_get_active_connection_type_for_connection (PkNetworkStackNm
}
/* get the physical devices for the connection */
- ret = dbus_g_proxy_call (proxy, "Get", &error,
- G_TYPE_STRING, "org.freedesktop.NetworkManager.Connection.Active",
- G_TYPE_STRING, "Devices",
- G_TYPE_INVALID,
- G_TYPE_VALUE, &value_devices,
- G_TYPE_INVALID);
- if (!ret) {
- g_warning ("Error getting Devices: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- devices = g_value_get_boxed (&value_devices);
- g_debug ("number of devices: %i", devices->len);
- if (devices->len == 0)
- goto out;
+ value_devices = g_dbus_proxy_get_cached_property (proxy, "Devices");
+ g_variant_get (value_devices, "ao", &iter);
/* find the types of the active connection */
- for (i=0; i<devices->len; i++) {
- device = g_ptr_array_index (devices, i);
- type_tmp = pk_network_stack_nm_get_active_connection_type_for_device (nstack_nm, device);
- type = pk_network_stack_nm_prioritise_connection_type (type, type_tmp);
+ while (g_variant_iter_next (iter, "&o", &device)) {
+ type_tmp = pk_network_stack_nm_get_active_connection_type_for_device (nstack_nm,
+ device);
+ type = pk_network_stack_nm_prioritise_connection_type (type,
+ type_tmp);
}
-
out:
- g_object_unref (proxy);
+ if (iter != NULL)
+ g_variant_iter_free (iter);
+ if (proxy != NULL)
+ g_object_unref (proxy);
+ if (value_devices != NULL)
+ g_variant_unref (value_devices);
+ if (value_default != NULL)
+ g_variant_unref (value_default);
return type;
}
@@ -171,48 +168,45 @@ out:
static NMDeviceType
pk_network_stack_nm_get_active_connection_type (PkNetworkStackNm *nstack_nm)
{
- guint i;
- gboolean ret;
- DBusGProxy *proxy;
- GError *error = NULL;
- GPtrArray *active_connections = NULL;
const gchar *active_connection;
- GValue value = { 0 };
- NMDeviceType type_tmp;
+ GDBusProxy *proxy;
+ GError *error = NULL;
+ GVariantIter *iter = NULL;
+ GVariant *value = NULL;
NMDeviceType type = NM_DEVICE_TYPE_UNKNOWN;
+ NMDeviceType type_tmp;
/* get proxy */
- proxy = dbus_g_proxy_new_for_name (nstack_nm->priv->bus, "org.freedesktop.NetworkManager",
- "/org/freedesktop/NetworkManager",
- "org.freedesktop.DBus.Properties");
- ret = dbus_g_proxy_call (proxy, "Get", &error,
- G_TYPE_STRING, "org.freedesktop.NetworkManager",
- G_TYPE_STRING, "ActiveConnections",
- G_TYPE_INVALID,
- G_TYPE_VALUE, &value,
- G_TYPE_INVALID);
- if (!ret) {
+ proxy = g_dbus_proxy_new_sync (nstack_nm->priv->bus,
+ G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
+ NULL,
+ "org.freedesktop.NetworkManager",
+ "/org/freedesktop/NetworkManager",
+ "org.freedesktop.NetworkManager",
+ NULL,
+ &error);
+ if (proxy == NULL) {
g_warning ("Error getting ActiveConnections: %s", error->message);
g_error_free (error);
goto out;
}
-
- active_connections = g_value_get_boxed (&value);
- g_debug ("active connections: %i", active_connections->len);
- if (active_connections->len == 0)
- goto out;
+ value = g_dbus_proxy_get_cached_property (proxy, "ActiveConnections");
+ g_variant_get (value, "ao", &iter);
/* find the active connection */
- for (i=0; i<active_connections->len; i++) {
- active_connection = g_ptr_array_index (active_connections, i);
- type_tmp = pk_network_stack_nm_get_active_connection_type_for_connection (nstack_nm, active_connection);
+ while (g_variant_iter_next (iter, "&o", &active_connection)) {
+ type_tmp = pk_network_stack_nm_get_active_connection_type_for_connection (nstack_nm,
+ active_connection);
type = pk_network_stack_nm_prioritise_connection_type (type, type_tmp);
}
out:
- g_object_unref (proxy);
- g_ptr_array_foreach (active_connections, (GFunc) g_free, NULL);
- g_ptr_array_free (active_connections, TRUE);
+ if (iter != NULL)
+ g_variant_iter_free (iter);
+ if (proxy != NULL)
+ g_object_unref (proxy);
+ if (value != NULL)
+ g_variant_unref (value);
return type;
}
@@ -258,27 +252,6 @@ pk_network_stack_nm_get_state (PkNetworkStack *nstack)
}
/**
- * pk_network_stack_nm_status_changed_cb:
- */
-static void
-pk_network_stack_nm_status_changed_cb (DBusGProxy *proxy, guint status, PkNetworkStackNm *nstack_nm)
-{
- PkNetworkEnum state;
-
- g_return_if_fail (PK_IS_NETWORK_STACK_NM (nstack_nm));
-
- /* do not use */
- if (!nstack_nm->priv->is_enabled) {
- g_debug ("not enabled, so ignoring");
- return;
- }
-
- state = pk_network_stack_nm_get_state (PK_NETWORK_STACK (nstack_nm));
- g_debug ("emitting network-state-changed: %s", pk_network_enum_to_string (state));
- g_signal_emit_by_name (PK_NETWORK_STACK (nstack_nm), "state-changed", state);
-}
-
-/**
* pk_network_stack_nm_is_enabled:
*
* Return %TRUE on success, %FALSE if we failed to is_enabled or no data
@@ -291,13 +264,13 @@ pk_network_stack_nm_is_enabled (PkNetworkStack *nstack)
}
/**
- * pk_network_stack_connman_appeared_cb:
+ * pk_network_stack_nm_appeared_cb:
**/
static void
-pk_network_stack_connman_appeared_cb (GDBusConnection *connection,
- const gchar *name,
- const gchar *name_owner,
- gpointer user_data)
+pk_network_stack_nm_appeared_cb (GDBusConnection *connection,
+ const gchar *name,
+ const gchar *name_owner,
+ gpointer user_data)
{
gboolean ret;
PkNetworkStackNm *nstack_nm = PK_NETWORK_STACK_NM (user_data);
@@ -307,18 +280,46 @@ pk_network_stack_connman_appeared_cb (GDBusConnection *connection,
}
/**
- * pk_network_stack_connman_vanished_cb:
+ * pk_network_stack_nm_vanished_cb:
**/
static void
-pk_network_stack_connman_vanished_cb (GDBusConnection *connection,
- const gchar *name,
- gpointer user_data)
+pk_network_stack_nm_vanished_cb (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data)
{
PkNetworkStackNm *nstack_nm = PK_NETWORK_STACK_NM (user_data);
nstack_nm->priv->is_enabled = FALSE;
}
/**
+ * pk_network_stack_nm_dbus_signal_cb:
+ **/
+static void
+pk_network_stack_nm_dbus_signal_cb (GDBusProxy *proxy,
+ gchar *sender_name,
+ gchar *signal_name,
+ GVariant *parameters,
+ PkNetworkStackNm *nstack_nm)
+{
+ PkNetworkEnum state;
+
+ g_return_if_fail (PK_IS_NETWORK_STACK_NM (nstack_nm));
+
+ /* do not use */
+ if (!nstack_nm->priv->is_enabled) {
+ g_debug ("not enabled, so ignoring %s", signal_name);
+ return;
+ }
+
+ /* don't use parameters, just refresh state */
+ if (g_strcmp0 (signal_name, "StateChanged") == 0) {
+ state = pk_network_stack_nm_get_state (PK_NETWORK_STACK (nstack_nm));
+ g_debug ("emitting network-state-changed: %s", pk_network_enum_to_string (state));
+ g_signal_emit_by_name (PK_NETWORK_STACK (nstack_nm), "state-changed", state);
+ }
+}
+
+/**
* pk_network_stack_nm_init:
**/
static void
@@ -330,7 +331,7 @@ pk_network_stack_nm_init (PkNetworkStackNm *nstack_nm)
nstack_nm->priv->conf = pk_conf_new ();
/* get system connection */
- nstack_nm->priv->bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+ nstack_nm->priv->bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
if (nstack_nm->priv->bus == NULL) {
g_warning ("Couldn't connect to system bus: %s", error->message);
g_error_free (error);
@@ -341,20 +342,25 @@ pk_network_stack_nm_init (PkNetworkStackNm *nstack_nm)
g_bus_watch_name (G_BUS_TYPE_SYSTEM,
"org.freedesktop.NetworkManager",
G_BUS_NAME_WATCHER_FLAGS_NONE,
- pk_network_stack_connman_appeared_cb,
- pk_network_stack_connman_vanished_cb,
+ pk_network_stack_nm_appeared_cb,
+ pk_network_stack_nm_vanished_cb,
nstack_nm,
NULL);
- /* connect to changed as libnm-glib is teh suck and causes
- * multithreading issues with dbus-glib */
- nstack_nm->priv->proxy_changed = dbus_g_proxy_new_for_name (nstack_nm->priv->bus,
- "org.freedesktop.NetworkManager",
- "/org/freedesktop/NetworkManager",
- "org.freedesktop.NetworkManager");
- dbus_g_proxy_add_signal (nstack_nm->priv->proxy_changed, "StateChanged", G_TYPE_UINT, G_TYPE_INVALID);
- dbus_g_proxy_connect_signal (nstack_nm->priv->proxy_changed, "StateChanged",
- G_CALLBACK (pk_network_stack_nm_status_changed_cb), nstack_nm, NULL);
+ /* connect to changed as libnm-glib is teh suc */
+ nstack_nm->priv->proxy_changed =
+ g_dbus_proxy_new_sync (nstack_nm->priv->bus,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
+ NULL,
+ "org.freedesktop.NetworkManager",
+ "/org/freedesktop/NetworkManager",
+ "org.freedesktop.NetworkManager",
+ NULL,
+ &error);
+ g_signal_connect (nstack_nm->priv->proxy_changed,
+ "g-signal",
+ G_CALLBACK (pk_network_stack_nm_dbus_signal_cb),
+ nstack_nm);
}
/**
@@ -369,10 +375,7 @@ pk_network_stack_nm_finalize (GObject *object)
g_return_if_fail (PK_IS_NETWORK_STACK_NM (object));
nstack_nm = PK_NETWORK_STACK_NM (object);
- g_return_if_fail (nstack_nm->priv != NULL);
- dbus_g_proxy_disconnect_signal (nstack_nm->priv->proxy_changed, "StateChanged",
- G_CALLBACK (pk_network_stack_nm_status_changed_cb), nstack_nm);
g_object_unref (nstack_nm->priv->proxy_changed);
g_object_unref (nstack_nm->priv->conf);
g_bus_unwatch_name (nstack_nm->priv->watch_id);
diff --git a/src/pk-network-stack.h b/src/pk-network-stack.h
index 1f39f1d..a7673f7 100644
--- a/src/pk-network-stack.h
+++ b/src/pk-network-stack.h
@@ -21,7 +21,6 @@
#define __PK_NETWORK_STACK_H__
#include <glib-object.h>
-#include <dbus/dbus-glib.h>
#include <packagekit-glib2/pk-enum.h>
G_BEGIN_DECLS
diff --git a/src/pk-notify.c b/src/pk-notify.c
index fa08b2f..a773948 100644
--- a/src/pk-notify.c
+++ b/src/pk-notify.c
@@ -31,7 +31,6 @@
#include <glib/gi18n.h>
#include <glib.h>
-#include <dbus/dbus-glib.h>
#include "pk-notify.h"
#include "pk-marshal.h"
diff --git a/src/pk-shared.c b/src/pk-shared.c
index cc55726..885b68f 100644
--- a/src/pk-shared.c
+++ b/src/pk-shared.c
@@ -81,6 +81,35 @@ out:
return ret;
}
+
+/**
+ * pk_load_introspection:
+ **/
+GDBusNodeInfo *
+pk_load_introspection (const gchar *filename, GError **error)
+{
+ gboolean ret;
+ gchar *data = NULL;
+ GDBusNodeInfo *info = NULL;
+ GFile *file;
+
+ /* load file */
+ file = g_file_new_for_path (filename);
+ ret = g_file_load_contents (file, NULL, &data,
+ NULL, NULL, error);
+ if (!ret)
+ goto out;
+
+ /* build introspection from XML */
+ info = g_dbus_node_info_new_for_xml (data, error);
+ if (info == NULL)
+ goto out;
+out:
+ g_object_unref (file);
+ g_free (data);
+ return info;
+}
+
/**
* pk_hint_enum_to_string:
**/
diff --git a/src/pk-shared.h b/src/pk-shared.h
index 5e2fcce..dc801fe 100644
--- a/src/pk-shared.h
+++ b/src/pk-shared.h
@@ -23,6 +23,7 @@
#define __PK_SHARED_H
#include <glib.h>
+#include <gio/gio.h>
G_BEGIN_DECLS
@@ -50,6 +51,8 @@ gboolean pk_strtouint (const gchar *text,
guint *value);
gboolean pk_strtouint64 (const gchar *text,
guint64 *value);
+GDBusNodeInfo *pk_load_introspection (const gchar *filename,
+ GError **error);
G_END_DECLS
diff --git a/src/pk-spawn.c b/src/pk-spawn.c
index d5919fb..7fa4ffc 100644
--- a/src/pk-spawn.c
+++ b/src/pk-spawn.c
@@ -39,8 +39,6 @@
#include <fcntl.h>
#include <glib/gi18n.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
#include "pk-spawn.h"
#include "pk-marshal.h"
diff --git a/src/pk-transaction-dbus.h b/src/pk-transaction-dbus.h
deleted file mode 100644
index 0610dc6..0000000
--- a/src/pk-transaction-dbus.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008-2010 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PK_TRANSACTION_DBUS_H
-#define __PK_TRANSACTION_DBUS_H
-
-#include "pk-transaction.h"
-
-G_BEGIN_DECLS
-
-void pk_transaction_accept_eula (PkTransaction *transaction,
- const gchar *eula_id,
- DBusGMethodInvocation *context);
-void pk_transaction_cancel (PkTransaction *transaction,
- DBusGMethodInvocation *context);
-void pk_transaction_download_packages (PkTransaction *transaction,
- gboolean copy_files,
- gchar **package_ids,
- DBusGMethodInvocation *context);
-void pk_transaction_get_categories (PkTransaction *transaction,
- DBusGMethodInvocation *context);
-void pk_transaction_get_depends (PkTransaction *transaction,
- const gchar *filter,
- gchar **package_ids,
- gboolean recursive,
- DBusGMethodInvocation *context);
-void pk_transaction_get_details (PkTransaction *transaction,
- gchar **package_ids,
- DBusGMethodInvocation *context);
-void pk_transaction_get_distro_upgrades (PkTransaction *transaction,
- DBusGMethodInvocation *context);
-void pk_transaction_get_files (PkTransaction *transaction,
- gchar **package_ids,
- DBusGMethodInvocation *context);
-gboolean pk_transaction_get_old_transactions (PkTransaction *transaction,
- guint number,
- GError **error);
-void pk_transaction_get_packages (PkTransaction *transaction,
- const gchar *filter,
- DBusGMethodInvocation *context);
-void pk_transaction_get_repo_list (PkTransaction *transaction,
- const gchar *filter,
- DBusGMethodInvocation *context);
-void pk_transaction_get_requires (PkTransaction *transaction,
- const gchar *filter,
- gchar **package_ids,
- gboolean recursive,
- DBusGMethodInvocation *context);
-void pk_transaction_get_update_detail (PkTransaction *transaction,
- gchar **package_ids,
- DBusGMethodInvocation *context);
-void pk_transaction_get_updates (PkTransaction *transaction,
- const gchar *filter,
- DBusGMethodInvocation *context);
-void pk_transaction_install_files (PkTransaction *transaction,
- gboolean only_trusted,
- gchar **full_paths,
- DBusGMethodInvocation *context);
-void pk_transaction_install_packages (PkTransaction *transaction,
- gboolean only_trusted,
- gchar **package_ids,
- DBusGMethodInvocation *context);
-void pk_transaction_install_signature (PkTransaction *transaction,
- const gchar *sig_type,
- const gchar *key_id,
- const gchar *package_id,
- DBusGMethodInvocation *context);
-void pk_transaction_refresh_cache (PkTransaction *transaction,
- gboolean force,
- DBusGMethodInvocation *context);
-void pk_transaction_remove_packages (PkTransaction *transaction,
- gchar **package_ids,
- gboolean allow_deps,
- gboolean autoremove,
- DBusGMethodInvocation *context);
-void pk_transaction_repo_enable (PkTransaction *transaction,
- const gchar *repo_id,
- gboolean enabled,
- DBusGMethodInvocation *context);
-void pk_transaction_repo_set_data (PkTransaction *transaction,
- const gchar *repo_id,
- const gchar *parameter,
- const gchar *value,
- DBusGMethodInvocation *context);
-void pk_transaction_resolve (PkTransaction *transaction,
- const gchar *filter,
- gchar **packages,
- DBusGMethodInvocation *context);
-void pk_transaction_rollback (PkTransaction *transaction,
- const gchar *transaction_id,
- DBusGMethodInvocation *context);
-void pk_transaction_search_details (PkTransaction *transaction,
- const gchar *filter,
- gchar **values,
- DBusGMethodInvocation *context);
-void pk_transaction_search_files (PkTransaction *transaction,
- const gchar *filter,
- gchar **values,
- DBusGMethodInvocation *context);
-void pk_transaction_search_groups (PkTransaction *transaction,
- const gchar *filter,
- gchar **values,
- DBusGMethodInvocation *context);
-void pk_transaction_search_names (PkTransaction *transaction,
- const gchar *filter,
- gchar **values,
- DBusGMethodInvocation *context);
-void pk_transaction_set_hints (PkTransaction *transaction,
- gchar **hints,
- DBusGMethodInvocation *context);
-void pk_transaction_simulate_install_files (PkTransaction *transaction,
- gchar **full_paths,
- DBusGMethodInvocation *context);
-void pk_transaction_simulate_install_packages (PkTransaction *transaction,
- gchar **package_ids,
- DBusGMethodInvocation *context);
-void pk_transaction_simulate_remove_packages (PkTransaction *transaction,
- gchar **package_ids,
- gboolean autoremove,
- DBusGMethodInvocation *context);
-void pk_transaction_simulate_update_packages (PkTransaction *transaction,
- gchar **package_ids,
- DBusGMethodInvocation *context);
-void pk_transaction_update_packages (PkTransaction *transaction,
- gboolean only_trusted,
- gchar **package_ids,
- DBusGMethodInvocation *context);
-void pk_transaction_update_system (PkTransaction *transaction,
- gboolean only_trusted,
- DBusGMethodInvocation *context);
-void pk_transaction_what_provides (PkTransaction *transaction,
- const gchar *filter,
- const gchar *type,
- gchar **values,
- DBusGMethodInvocation *context);
-void pk_transaction_upgrade_system (PkTransaction *transaction,
- const gchar *distro_id,
- const gchar *upgrade_kind_str,
- DBusGMethodInvocation *context);
-
-gboolean pk_transaction_set_sender (PkTransaction *transaction,
- const gchar *sender);
-gboolean pk_transaction_filter_check (const gchar *filter,
- GError **error);
-gboolean pk_transaction_strvalidate (const gchar *textr,
- GError **error);
-gboolean pk_transaction_set_tid (PkTransaction *transaction,
- const gchar *tid);
-
-G_END_DECLS
-
-#endif /* __PK_TRANSACTION_DBUS_H */
diff --git a/src/pk-transaction-list.c b/src/pk-transaction-list.c
index 633a5c6..6e8c01b 100644
--- a/src/pk-transaction-list.c
+++ b/src/pk-transaction-list.c
@@ -35,14 +35,10 @@
#endif /* HAVE_UNISTD_H */
#include <glib/gi18n.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
#include <packagekit-glib2/pk-common.h>
#include "pk-conf.h"
-#include "pk-transaction-dbus.h"
#include "pk-transaction-list.h"
-#include "org.freedesktop.PackageKit.Transaction.h"
static void pk_transaction_list_finalize (GObject *object);
@@ -348,7 +344,8 @@ out:
* pk_transaction_list_transaction_finished_cb:
**/
static void
-pk_transaction_list_transaction_finished_cb (PkTransaction *transaction, const gchar *exit_text, guint time_ms, PkTransactionList *tlist)
+pk_transaction_list_transaction_finished_cb (PkTransaction *transaction,
+ PkTransactionList *tlist)
{
gboolean ret;
guint timeout;
@@ -440,14 +437,16 @@ pk_transaction_list_get_number_transactions_for_uid (PkTransactionList *tlist, g
* pk_transaction_list_create:
**/
gboolean
-pk_transaction_list_create (PkTransactionList *tlist, const gchar *tid, const gchar *sender, GError **error)
+pk_transaction_list_create (PkTransactionList *tlist,
+ const gchar *tid,
+ const gchar *sender,
+ GError **error)
{
guint count;
guint max_count;
guint timeout;
gboolean ret = FALSE;
PkTransactionItem *item;
- DBusGConnection *connection;
g_return_val_if_fail (PK_IS_TRANSACTION_LIST (tlist), FALSE);
g_return_val_if_fail (tid != NULL, FALSE);
@@ -463,12 +462,6 @@ pk_transaction_list_create (PkTransactionList *tlist, const gchar *tid, const gc
item = g_new0 (PkTransactionItem, 1);
item->list = g_object_ref (tlist);
item->tid = g_strdup (tid);
-
- /* get another connection */
- connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);
- if (connection == NULL)
- g_error ("no connection");
-
item->transaction = pk_transaction_new ();
item->finished_id =
g_signal_connect_after (item->transaction, "finished",
@@ -500,9 +493,7 @@ pk_transaction_list_create (PkTransactionList *tlist, const gchar *tid, const gc
}
/* get the uid for the transaction */
- g_object_get (item->transaction,
- "uid", &item->uid,
- NULL);
+ item->uid = pk_transaction_get_uid (item->transaction);
/* find out the number of transactions this uid already has in progress */
count = pk_transaction_list_get_number_transactions_for_uid (tlist, item->uid);
@@ -521,10 +512,6 @@ pk_transaction_list_create (PkTransactionList *tlist, const gchar *tid, const gc
goto out;
}
- /* put on the bus */
- dbus_g_object_type_install_info (PK_TYPE_TRANSACTION, &dbus_glib_pk_transaction_object_info);
- dbus_g_connection_register_g_object (connection, item->tid, G_OBJECT (item->transaction));
-
/* the client only has a finite amount of time to use the object, else it's destroyed */
timeout = pk_conf_get_int (tlist->priv->conf, "TransactionCreateCommitTimeout");
item->commit_id = g_timeout_add_seconds (timeout, (GSourceFunc) pk_transaction_list_no_commit_cb, item);
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 58f5dfc..06b0216 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -39,9 +39,6 @@
#include <glib/gstdio.h>
#include <glib/gi18n.h>
#include <gio/gio.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
-#include <gio/gio.h>
#include <packagekit-glib2/pk-common.h>
#include <packagekit-glib2/pk-enum.h>
#include <packagekit-glib2/pk-package-id.h>
@@ -62,7 +59,6 @@
#include "pk-shared.h"
#include "pk-syslog.h"
#include "pk-transaction-db.h"
-#include "pk-transaction-dbus.h"
#include "pk-transaction.h"
#include "pk-transaction-list.h"
@@ -163,6 +159,9 @@ struct PkTransactionPrivate
guint signal_speed;
GPtrArray *plugins;
GPtrArray *supported_content_types;
+ guint registration_id;
+ GDBusConnection *connection;
+ GDBusNodeInfo *introspection;
};
typedef enum {
@@ -192,43 +191,10 @@ typedef enum {
} PkTransactionError;
enum {
- SIGNAL_DETAILS,
- SIGNAL_ERROR_CODE,
- SIGNAL_DISTRO_UPGRADE,
- SIGNAL_FILES,
SIGNAL_FINISHED,
- SIGNAL_MESSAGE,
- SIGNAL_PACKAGE,
- SIGNAL_REPO_DETAIL,
- SIGNAL_REPO_SIGNATURE_REQUIRED,
- SIGNAL_EULA_REQUIRED,
- SIGNAL_MEDIA_CHANGE_REQUIRED,
- SIGNAL_REQUIRE_RESTART,
- SIGNAL_TRANSACTION,
- SIGNAL_UPDATE_DETAIL,
- SIGNAL_CATEGORY,
- SIGNAL_DESTROY,
- SIGNAL_CHANGED,
SIGNAL_LAST
};
-enum
-{
- PROP_0,
- PROP_ROLE,
- PROP_STATUS,
- PROP_LAST_PACKAGE,
- PROP_UID,
- PROP_PERCENTAGE,
- PROP_SUBPERCENTAGE,
- PROP_ALLOW_CANCEL,
- PROP_CALLER_ACTIVE,
- PROP_ELAPSED_TIME,
- PROP_REMAINING_TIME,
- PROP_SPEED,
- PROP_LAST
-};
-
static guint signals[SIGNAL_LAST] = { 0 };
G_DEFINE_TYPE (PkTransaction, pk_transaction, G_TYPE_OBJECT)
@@ -367,11 +333,32 @@ pk_transaction_finish_invalidate_caches (PkTransaction *transaction)
return TRUE;
}
+
+/**
+ * pk_transaction_emit_changed:
+ **/
+static void
+pk_transaction_emit_changed (PkTransaction *transaction)
+{
+ g_debug ("emitting changed");
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "Changed",
+ NULL,
+ NULL);
+}
+
/**
* pk_transaction_progress_changed_emit:
**/
static void
-pk_transaction_progress_changed_emit (PkTransaction *transaction, guint percentage, guint subpercentage, guint elapsed, guint remaining)
+pk_transaction_progress_changed_emit (PkTransaction *transaction,
+ guint percentage,
+ guint subpercentage,
+ guint elapsed,
+ guint remaining)
{
g_return_if_fail (PK_IS_TRANSACTION (transaction));
@@ -382,8 +369,7 @@ pk_transaction_progress_changed_emit (PkTransaction *transaction, guint percenta
transaction->priv->remaining_time = remaining;
/* emit */
- g_debug ("emitting changed");
- g_signal_emit (transaction, signals[SIGNAL_CHANGED], 0);
+ pk_transaction_emit_changed (transaction);
}
/**
@@ -403,8 +389,7 @@ pk_transaction_allow_cancel_emit (PkTransaction *transaction, gboolean allow_can
/* TODO: have master property on main interface */
/* emit */
- g_debug ("emitting changed");
- g_signal_emit (transaction, signals[SIGNAL_CHANGED], 0);
+ pk_transaction_emit_changed (transaction);
}
/**
@@ -423,39 +408,63 @@ pk_transaction_status_changed_emit (PkTransaction *transaction, PkStatusEnum sta
transaction->priv->status = status;
/* emit */
- g_debug ("emitting changed");
- g_signal_emit (transaction, signals[SIGNAL_CHANGED], 0);
+ pk_transaction_emit_changed (transaction);
}
/**
* pk_transaction_finished_emit:
**/
static void
-pk_transaction_finished_emit (PkTransaction *transaction, PkExitEnum exit_enum, guint time_ms)
+pk_transaction_finished_emit (PkTransaction *transaction,
+ PkExitEnum exit_enum,
+ guint time_ms)
{
const gchar *exit_text;
exit_text = pk_exit_enum_to_string (exit_enum);
g_debug ("emitting finished '%s', %i", exit_text, time_ms);
- g_signal_emit (transaction, signals[SIGNAL_FINISHED], 0, exit_text, time_ms);
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "Finished",
+ g_variant_new ("(su)",
+ exit_text,
+ time_ms),
+ NULL);
+
+ /* For the transaction list */
+ g_signal_emit (transaction, signals[SIGNAL_FINISHED], 0);
}
/**
* pk_transaction_error_code_emit:
**/
static void
-pk_transaction_error_code_emit (PkTransaction *transaction, PkErrorEnum error_enum, const gchar *details)
+pk_transaction_error_code_emit (PkTransaction *transaction,
+ PkErrorEnum error_enum,
+ const gchar *details)
{
const gchar *text;
text = pk_error_enum_to_string (error_enum);
g_debug ("emitting error-code %s, '%s'", text, details);
- g_signal_emit (transaction, signals[SIGNAL_ERROR_CODE], 0, text, details);
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "ErrorCode",
+ g_variant_new ("(ss)",
+ text,
+ details),
+ NULL);
}
/**
* pk_transaction_allow_cancel_cb:
**/
static void
-pk_transaction_allow_cancel_cb (PkBackend *backend, gboolean allow_cancel, PkTransaction *transaction)
+pk_transaction_allow_cancel_cb (PkBackend *backend,
+ gboolean allow_cancel,
+ PkTransaction *transaction)
{
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
@@ -468,7 +477,9 @@ pk_transaction_allow_cancel_cb (PkBackend *backend, gboolean allow_cancel, PkTra
* pk_transaction_details_cb:
**/
static void
-pk_transaction_details_cb (PkBackend *backend, PkDetails *item, PkTransaction *transaction)
+pk_transaction_details_cb (PkBackend *backend,
+ PkDetails *item,
+ PkTransaction *transaction)
{
const gchar *group_text;
gchar *package_id;
@@ -497,8 +508,19 @@ pk_transaction_details_cb (PkBackend *backend, PkDetails *item, PkTransaction *t
/* emit */
group_text = pk_group_enum_to_string (group);
g_debug ("emitting details");
- g_signal_emit (transaction, signals[SIGNAL_DETAILS], 0, package_id,
- license, group_text, description, url, size);
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "Details",
+ g_variant_new ("(ssssst)",
+ package_id,
+ license,
+ group_text,
+ description,
+ url,
+ size),
+ NULL);
g_free (package_id);
g_free (description);
@@ -510,7 +532,9 @@ pk_transaction_details_cb (PkBackend *backend, PkDetails *item, PkTransaction *t
* pk_transaction_error_code_cb:
**/
static void
-pk_transaction_error_code_cb (PkBackend *backend, PkError *item, PkTransaction *transaction)
+pk_transaction_error_code_cb (PkBackend *backend,
+ PkError *item,
+ PkTransaction *transaction)
{
gchar *details;
PkErrorEnum code;
@@ -543,7 +567,9 @@ pk_transaction_error_code_cb (PkBackend *backend, PkError *item, PkTransaction *
* pk_transaction_files_cb:
**/
static void
-pk_transaction_files_cb (PkBackend *backend, PkFiles *item, PkTransaction *transaction)
+pk_transaction_files_cb (PkBackend *backend,
+ PkFiles *item,
+ PkTransaction *transaction)
{
gchar *filelist = NULL;
guint i;
@@ -577,7 +603,15 @@ pk_transaction_files_cb (PkBackend *backend, PkFiles *item, PkTransaction *trans
/* emit */
filelist = g_strjoinv (";", files);
g_debug ("emitting files %s, %s", package_id, filelist);
- g_signal_emit (transaction, signals[SIGNAL_FILES], 0, package_id, filelist);
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "Files",
+ g_variant_new ("(ss)",
+ package_id,
+ filelist),
+ NULL);
g_free (filelist);
g_free (package_id);
g_strfreev (files);
@@ -587,7 +621,9 @@ pk_transaction_files_cb (PkBackend *backend, PkFiles *item, PkTransaction *trans
* pk_transaction_category_cb:
**/
static void
-pk_transaction_category_cb (PkBackend *backend, PkCategory *item, PkTransaction *transaction)
+pk_transaction_category_cb (PkBackend *backend,
+ PkCategory *item,
+ PkTransaction *transaction)
{
gchar *parent_id;
gchar *cat_id;
@@ -612,8 +648,18 @@ pk_transaction_category_cb (PkBackend *backend, PkCategory *item, PkTransaction
/* emit */
g_debug ("emitting category %s, %s, %s, %s, %s ", parent_id, cat_id, name, summary, icon);
- g_signal_emit (transaction, signals[SIGNAL_CATEGORY], 0, parent_id, cat_id, name, summary, icon);
-
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "Category",
+ g_variant_new ("(sssss)",
+ parent_id,
+ cat_id,
+ name,
+ summary,
+ icon),
+ NULL);
g_free (parent_id);
g_free (cat_id);
g_free (name);
@@ -625,7 +671,9 @@ pk_transaction_category_cb (PkBackend *backend, PkCategory *item, PkTransaction
* pk_transaction_distro_upgrade_cb:
**/
static void
-pk_transaction_distro_upgrade_cb (PkBackend *backend, PkDistroUpgrade *item, PkTransaction *transaction)
+pk_transaction_distro_upgrade_cb (PkBackend *backend,
+ PkDistroUpgrade *item,
+ PkTransaction *transaction)
{
const gchar *type_text;
gchar *name;
@@ -647,8 +695,18 @@ pk_transaction_distro_upgrade_cb (PkBackend *backend, PkDistroUpgrade *item, PkT
/* emit */
type_text = pk_distro_upgrade_enum_to_string (state);
- g_debug ("emitting distro-upgrade %s, %s, %s", type_text, name, summary);
- g_signal_emit (transaction, signals[SIGNAL_DISTRO_UPGRADE], 0, type_text, name, summary);
+ g_debug ("emitting distro-upgrade %s, %s, %s",
+ type_text, name, summary);
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "DistroUpgrade",
+ g_variant_new ("(sss)",
+ type_text,
+ name,
+ summary),
+ NULL);
g_free (name);
g_free (summary);
@@ -778,6 +836,15 @@ pk_transaction_get_state (PkTransaction *transaction)
}
/**
+ * pk_transaction_get_uid:
+ **/
+guint
+pk_transaction_get_uid (PkTransaction *transaction)
+{
+ return transaction->priv->uid;
+}
+
+/**
* pk_transaction_plugin_phase:
**/
static void
@@ -1081,7 +1148,9 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
* pk_transaction_message_cb:
**/
static void
-pk_transaction_message_cb (PkBackend *backend, PkMessage *item, PkTransaction *transaction)
+pk_transaction_message_cb (PkBackend *backend,
+ PkMessage *item,
+ PkTransaction *transaction)
{
const gchar *message_text;
gboolean developer_mode;
@@ -1112,8 +1181,15 @@ pk_transaction_message_cb (PkBackend *backend, PkMessage *item, PkTransaction *t
/* emit */
message_text = pk_message_enum_to_string (type);
g_debug ("emitting message %s, '%s'", message_text, details);
- g_signal_emit (transaction, signals[SIGNAL_MESSAGE], 0, message_text, details);
-
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "Message",
+ g_variant_new ("(ss)",
+ message_text,
+ details),
+ NULL);
g_free (details);
}
@@ -1121,13 +1197,15 @@ pk_transaction_message_cb (PkBackend *backend, PkMessage *item, PkTransaction *t
* pk_transaction_package_cb:
**/
static void
-pk_transaction_package_cb (PkBackend *backend, PkPackage *item, PkTransaction *transaction)
+pk_transaction_package_cb (PkBackend *backend,
+ PkPackage *item,
+ PkTransaction *transaction)
{
const gchar *info_text;
const gchar *role_text;
PkInfoEnum info;
- gchar *package_id = NULL;
- gchar *summary = NULL;
+ const gchar *package_id;
+ const gchar *summary = NULL;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
@@ -1138,22 +1216,17 @@ pk_transaction_package_cb (PkBackend *backend, PkPackage *item, PkTransaction *t
return;
}
- /* we need this in warnings */
- role_text = pk_role_enum_to_string (transaction->priv->role);
-
/* get data */
- g_object_get (item,
- "info", &info,
- "package-id", &package_id,
- "summary", &summary,
- NULL);
/* check the backend is doing the right thing */
+ info = pk_package_get_info (item);
if (transaction->priv->role == PK_ROLE_ENUM_UPDATE_SYSTEM ||
transaction->priv->role == PK_ROLE_ENUM_INSTALL_PACKAGES ||
transaction->priv->role == PK_ROLE_ENUM_UPDATE_PACKAGES) {
if (info == PK_INFO_ENUM_INSTALLED) {
- pk_backend_message (transaction->priv->backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
+ role_text = pk_role_enum_to_string (transaction->priv->role);
+ pk_backend_message (transaction->priv->backend,
+ PK_MESSAGE_ENUM_BACKEND_ERROR,
"%s emitted 'installed' rather than 'installing' "
"- you need to do the package *before* you do the action", role_text);
return;
@@ -1163,6 +1236,7 @@ pk_transaction_package_cb (PkBackend *backend, PkPackage *item, PkTransaction *t
/* check we are respecting the filters */
if (pk_bitfield_contain (transaction->priv->cached_filters, PK_FILTER_ENUM_NOT_INSTALLED)) {
if (info == PK_INFO_ENUM_INSTALLED) {
+ role_text = pk_role_enum_to_string (transaction->priv->role);
pk_backend_message (transaction->priv->backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"%s emitted package that was installed when "
"the ~installed filter is in place", role_text);
@@ -1171,6 +1245,7 @@ pk_transaction_package_cb (PkBackend *backend, PkPackage *item, PkTransaction *t
}
if (pk_bitfield_contain (transaction->priv->cached_filters, PK_FILTER_ENUM_INSTALLED)) {
if (info == PK_INFO_ENUM_AVAILABLE) {
+ role_text = pk_role_enum_to_string (transaction->priv->role);
pk_backend_message (transaction->priv->backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
"%s emitted package that was ~installed when "
"the installed filter is in place", role_text);
@@ -1183,33 +1258,52 @@ pk_transaction_package_cb (PkBackend *backend, PkPackage *item, PkTransaction *t
pk_results_add_package (transaction->priv->results, item);
/* emit */
+ package_id = pk_package_get_id (item);
g_free (transaction->priv->last_package_id);
transaction->priv->last_package_id = g_strdup (package_id);
info_text = pk_info_enum_to_string (info);
+ summary = pk_package_get_summary (item);
g_debug ("emit package %s, %s, %s", info_text, package_id, summary);
- g_signal_emit (transaction, signals[SIGNAL_PACKAGE], 0, info_text, package_id, summary);
- g_free (package_id);
- g_free (summary);
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "Package",
+ g_variant_new ("(sss)",
+ info_text,
+ package_id,
+ summary ? summary : ""),
+ NULL);
}
/**
* pk_transaction_progress_changed_cb:
**/
static void
-pk_transaction_progress_changed_cb (PkBackend *backend, guint percentage, guint subpercentage,
- guint elapsed, guint remaining, PkTransaction *transaction)
+pk_transaction_progress_changed_cb (PkBackend *backend,
+ guint percentage,
+ guint subpercentage,
+ guint elapsed,
+ guint remaining,
+ PkTransaction *transaction)
{
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
- pk_transaction_progress_changed_emit (transaction, percentage, subpercentage, elapsed, remaining);
+ pk_transaction_progress_changed_emit (transaction,
+ percentage,
+ subpercentage,
+ elapsed,
+ remaining);
}
/**
* pk_transaction_repo_detail_cb:
**/
static void
-pk_transaction_repo_detail_cb (PkBackend *backend, PkRepoDetail *item, PkTransaction *transaction)
+pk_transaction_repo_detail_cb (PkBackend *backend,
+ PkRepoDetail *item,
+ PkTransaction *transaction)
{
gchar *repo_id;
gchar *description;
@@ -1230,8 +1324,16 @@ pk_transaction_repo_detail_cb (PkBackend *backend, PkRepoDetail *item, PkTransac
/* emit */
g_debug ("emitting repo-detail %s, %s, %i", repo_id, description, enabled);
- g_signal_emit (transaction, signals[SIGNAL_REPO_DETAIL], 0, repo_id, description, enabled);
-
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "RepoDetail",
+ g_variant_new ("(ssb)",
+ repo_id,
+ description,
+ enabled),
+ NULL);
g_free (repo_id);
g_free (description);
}
@@ -1240,7 +1342,9 @@ pk_transaction_repo_detail_cb (PkBackend *backend, PkRepoDetail *item, PkTransac
* pk_transaction_repo_signature_required_cb:
**/
static void
-pk_transaction_repo_signature_required_cb (PkBackend *backend, PkRepoSignatureRequired *item, PkTransaction *transaction)
+pk_transaction_repo_signature_required_cb (PkBackend *backend,
+ PkRepoSignatureRequired *item,
+ PkTransaction *transaction)
{
const gchar *type_text;
gchar *package_id;
@@ -1273,11 +1377,23 @@ pk_transaction_repo_signature_required_cb (PkBackend *backend, PkRepoSignatureRe
/* emit */
type_text = pk_sig_type_enum_to_string (type);
g_debug ("emitting repo_signature_required %s, %s, %s, %s, %s, %s, %s, %s",
- package_id, repository_name, key_url, key_userid, key_id,
- key_fingerprint, key_timestamp, type_text);
- g_signal_emit (transaction, signals[SIGNAL_REPO_SIGNATURE_REQUIRED], 0,
- package_id, repository_name, key_url, key_userid, key_id,
- key_fingerprint, key_timestamp, type_text);
+ package_id, repository_name, key_url, key_userid, key_id,
+ key_fingerprint, key_timestamp, type_text);
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "RepoSignatureRequired",
+ g_variant_new ("(ssssssss)",
+ package_id,
+ repository_name,
+ key_url,
+ key_userid,
+ key_id,
+ key_fingerprint,
+ key_timestamp,
+ type_text),
+ NULL);
/* we should mark this transaction so that we finish with a special code */
transaction->priv->emit_signature_required = TRUE;
@@ -1295,7 +1411,9 @@ pk_transaction_repo_signature_required_cb (PkBackend *backend, PkRepoSignatureRe
* pk_transaction_eula_required_cb:
**/
static void
-pk_transaction_eula_required_cb (PkBackend *backend, PkEulaRequired *item, PkTransaction *transaction)
+pk_transaction_eula_required_cb (PkBackend *backend,
+ PkEulaRequired *item,
+ PkTransaction *transaction)
{
gchar *eula_id;
gchar *package_id;
@@ -1319,8 +1437,17 @@ pk_transaction_eula_required_cb (PkBackend *backend, PkEulaRequired *item, PkTra
/* emit */
g_debug ("emitting eula-required %s, %s, %s, %s",
eula_id, package_id, vendor_name, license_agreement);
- g_signal_emit (transaction, signals[SIGNAL_EULA_REQUIRED], 0,
- eula_id, package_id, vendor_name, license_agreement);
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "EulaRequired",
+ g_variant_new ("(ssss)",
+ eula_id,
+ package_id,
+ vendor_name,
+ license_agreement),
+ NULL);
/* we should mark this transaction so that we finish with a special code */
transaction->priv->emit_eula_required = TRUE;
@@ -1335,7 +1462,9 @@ pk_transaction_eula_required_cb (PkBackend *backend, PkEulaRequired *item, PkTra
* pk_transaction_media_change_required_cb:
**/
static void
-pk_transaction_media_change_required_cb (PkBackend *backend, PkMediaChangeRequired *item, PkTransaction *transaction)
+pk_transaction_media_change_required_cb (PkBackend *backend,
+ PkMediaChangeRequired *item,
+ PkTransaction *transaction)
{
const gchar *media_type_text;
gchar *media_id;
@@ -1359,8 +1488,16 @@ pk_transaction_media_change_required_cb (PkBackend *backend, PkMediaChangeRequir
media_type_text = pk_media_type_enum_to_string (media_type);
g_debug ("emitting media-change-required %s, %s, %s",
media_type_text, media_id, media_text);
- g_signal_emit (transaction, signals[SIGNAL_MEDIA_CHANGE_REQUIRED], 0,
- media_type_text, media_id, media_text);
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "MediaChangeRequired",
+ g_variant_new ("(sss)",
+ media_type_text,
+ media_id,
+ media_text),
+ NULL);
/* we should mark this transaction so that we finish with a special code */
transaction->priv->emit_media_change_required = TRUE;
@@ -1373,7 +1510,9 @@ pk_transaction_media_change_required_cb (PkBackend *backend, PkMediaChangeRequir
* pk_transaction_require_restart_cb:
**/
static void
-pk_transaction_require_restart_cb (PkBackend *backend, PkRequireRestart *item, PkTransaction *transaction)
+pk_transaction_require_restart_cb (PkBackend *backend,
+ PkRequireRestart *item,
+ PkTransaction *transaction)
{
const gchar *restart_text;
PkRequireRestart *item_tmp;
@@ -1421,8 +1560,15 @@ pk_transaction_require_restart_cb (PkBackend *backend, PkRequireRestart *item, P
/* emit */
g_debug ("emitting require-restart %s, '%s'", restart_text, package_id);
- g_signal_emit (transaction, signals[SIGNAL_REQUIRE_RESTART], 0, restart_text, package_id);
-
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "MediaChangeRequired",
+ g_variant_new ("(ss)",
+ restart_text,
+ package_id),
+ NULL);
g_free (package_id);
}
@@ -1430,7 +1576,9 @@ pk_transaction_require_restart_cb (PkBackend *backend, PkRequireRestart *item, P
* pk_transaction_status_changed_cb:
**/
static void
-pk_transaction_status_changed_cb (PkBackend *backend, PkStatusEnum status, PkTransaction *transaction)
+pk_transaction_status_changed_cb (PkBackend *backend,
+ PkStatusEnum status,
+ PkTransaction *transaction)
{
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
@@ -1441,7 +1589,8 @@ pk_transaction_status_changed_cb (PkBackend *backend, PkStatusEnum status, PkTra
/* have we already been marked as finished? */
if (transaction->priv->finished) {
- g_warning ("Already finished, so can't proxy status %s", pk_status_enum_to_string (status));
+ g_warning ("Already finished, so can't proxy status %s",
+ pk_status_enum_to_string (status));
return;
}
@@ -1452,7 +1601,9 @@ pk_transaction_status_changed_cb (PkBackend *backend, PkStatusEnum status, PkTra
* pk_transaction_transaction_cb:
**/
static void
-pk_transaction_transaction_cb (PkTransactionDb *tdb, PkTransactionPast *item, PkTransaction *transaction)
+pk_transaction_transaction_cb (PkTransactionDb *tdb,
+ PkTransactionPast *item,
+ PkTransaction *transaction)
{
const gchar *role_text;
gchar *tid;
@@ -1487,10 +1638,21 @@ pk_transaction_transaction_cb (PkTransactionDb *tdb, PkTransactionPast *item, Pk
g_debug ("emitting transaction %s, %s, %i, %s, %i, %s, %i, %s",
tid, timespec, succeeded, role_text,
duration, data, uid, cmdline);
- g_signal_emit (transaction, signals[SIGNAL_TRANSACTION], 0,
- tid, timespec, succeeded, role_text,
- duration, data, uid, cmdline);
-
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "Transaction",
+ g_variant_new ("(ssbsusus)",
+ tid,
+ timespec,
+ succeeded,
+ role_text,
+ duration,
+ data,
+ uid,
+ cmdline),
+ NULL);
g_free (tid);
g_free (timespec);
g_free (data);
@@ -1501,7 +1663,9 @@ pk_transaction_transaction_cb (PkTransactionDb *tdb, PkTransactionPast *item, Pk
* pk_transaction_update_detail_cb:
**/
static void
-pk_transaction_update_detail_cb (PkBackend *backend, PkUpdateDetail *item, PkTransaction *transaction)
+pk_transaction_update_detail_cb (PkBackend *backend,
+ PkUpdateDetail *item,
+ PkTransaction *transaction)
{
const gchar *state_text;
const gchar *restart_text;
@@ -1544,10 +1708,25 @@ pk_transaction_update_detail_cb (PkBackend *backend, PkUpdateDetail *item, PkTra
g_debug ("emitting update-detail");
restart_text = pk_restart_enum_to_string (restart);
state_text = pk_update_state_enum_to_string (state);
- g_signal_emit (transaction, signals[SIGNAL_UPDATE_DETAIL], 0,
- package_id, updates, obsoletes, vendor_url,
- bugzilla_url, cve_url, restart_text, update_text,
- changelog, state_text, issued, updated);
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "UpdateDetail",
+ g_variant_new ("(ssssssssssss)",
+ package_id,
+ updates,
+ obsoletes,
+ vendor_url,
+ bugzilla_url,
+ cve_url,
+ restart_text,
+ update_text,
+ changelog,
+ state_text,
+ issued,
+ updated),
+ NULL);
g_free (package_id);
g_free (updates);
@@ -1565,7 +1744,8 @@ pk_transaction_update_detail_cb (PkBackend *backend, PkUpdateDetail *item, PkTra
* pk_transaction_set_session_state:
*/
static gboolean
-pk_transaction_set_session_state (PkTransaction *transaction, GError **error)
+pk_transaction_set_session_state (PkTransaction *transaction,
+ GError **error)
{
gboolean ret = FALSE;
gchar *session = NULL;
@@ -1642,14 +1822,15 @@ out:
* pk_transaction_speed_cb:
**/
static void
-pk_transaction_speed_cb (GObject *object, GParamSpec *pspec, PkTransaction *transaction)
+pk_transaction_speed_cb (GObject *object,
+ GParamSpec *pspec,
+ PkTransaction *transaction)
{
g_object_get (object,
"speed", &transaction->priv->speed,
NULL);
/* emit */
- g_debug ("emitting changed");
- g_signal_emit (transaction, signals[SIGNAL_CHANGED], 0);
+ pk_transaction_emit_changed (transaction);
}
/**
@@ -1886,25 +2067,6 @@ pk_transaction_get_tid (PkTransaction *transaction)
}
/**
- * pk_transaction_set_tid:
- */
-gboolean
-pk_transaction_set_tid (PkTransaction *transaction, const gchar *tid)
-{
- g_return_val_if_fail (PK_IS_TRANSACTION (transaction), FALSE);
- g_return_val_if_fail (tid != NULL, FALSE);
- g_return_val_if_fail (transaction->priv->tid == NULL, FALSE);
-
- if (transaction->priv->tid != NULL) {
- g_warning ("changing a tid -- why?");
- return FALSE;
- }
- g_free (transaction->priv->tid);
- transaction->priv->tid = g_strdup (tid);
- return TRUE;
-}
-
-/**
* pk_transaction_vanished_cb:
**/
static void
@@ -1919,8 +2081,7 @@ pk_transaction_vanished_cb (GDBusConnection *connection,
transaction->priv->caller_active = FALSE;
/* emit */
- g_debug ("emitting changed");
- g_signal_emit (transaction, signals[SIGNAL_CHANGED], 0);
+ pk_transaction_emit_changed (transaction);
}
/**
@@ -2512,40 +2673,10 @@ pk_transaction_get_role (PkTransaction *transaction)
}
/**
- * pk_transaction_verify_sender:
- *
- * Verify caller of this method matches the one that got the Tid
- **/
-static gboolean
-pk_transaction_verify_sender (PkTransaction *transaction, DBusGMethodInvocation *context, GError **error)
-{
- gboolean ret = TRUE;
- gchar *sender = NULL;
-
- g_return_val_if_fail (transaction->priv->sender != NULL, FALSE);
-
- /* not set inside the test suite */
- if (context == NULL)
- goto out;
-
- /* check is the same as the sender that did GetTid */
- sender = dbus_g_method_get_sender (context);
- ret = (g_strcmp0 (transaction->priv->sender, sender) == 0);
- if (!ret) {
- g_set_error (error, PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_REFUSED_BY_POLICY,
- "sender does not match (%s vs %s)", sender, transaction->priv->sender);
- goto out;
- }
-out:
- g_free (sender);
- return ret;
-}
-
-/**
- * pk_transaction_dbus_return_error:
+ * pk_transaction_dbus_return:
**/
static void
-pk_transaction_dbus_return_error (DBusGMethodInvocation *context, GError *error)
+pk_transaction_dbus_return (GDBusMethodInvocation *context, GError *error)
{
/* not set inside the test suite */
if (context == NULL) {
@@ -2553,19 +2684,10 @@ pk_transaction_dbus_return_error (DBusGMethodInvocation *context, GError *error)
g_error_free (error);
return;
}
- dbus_g_method_return_error (context, error);
-}
-
-/**
- * pk_transaction_dbus_return:
- **/
-static void
-pk_transaction_dbus_return (DBusGMethodInvocation *context)
-{
- /* not set inside the test suite */
- if (context == NULL)
- return;
- dbus_g_method_return (context);
+ if (error != NULL)
+ g_dbus_method_invocation_return_gerror (context, error);
+ else
+ g_dbus_method_invocation_return_value (context, NULL);
}
/**
@@ -2573,56 +2695,54 @@ pk_transaction_dbus_return (DBusGMethodInvocation *context)
*
* This should be called when a eula_id needs to be added into an internal db.
**/
-void
-pk_transaction_accept_eula (PkTransaction *transaction, const gchar *eula_id, DBusGMethodInvocation *context)
+static void
+pk_transaction_accept_eula (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
guint idle_id;
+ const gchar *eula_id = NULL;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
- }
+ g_variant_get (params, "(&s)",
+ &eula_id);
/* check for sanity */
ret = pk_transaction_strvalidate (eula_id, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* try to get authorization */
- ret = pk_transaction_obtain_authorization (transaction, FALSE, PK_ROLE_ENUM_ACCEPT_EULA, &error);
+ ret = pk_transaction_obtain_authorization (transaction,
+ FALSE,
+ PK_ROLE_ENUM_ACCEPT_EULA,
+ &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
g_debug ("AcceptEula method called: %s", eula_id);
ret = pk_backend_accept_eula (transaction->priv->backend, eula_id);
if (!ret) {
- error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_INPUT_INVALID,
+ error = g_error_new (PK_TRANSACTION_ERROR,
+ PK_TRANSACTION_ERROR_INPUT_INVALID,
"EULA failed to be added");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* we are done */
idle_id = g_idle_add ((GSourceFunc) pk_transaction_finished_idle_cb, transaction);
g_source_set_name_by_id (idle_id, "[PkTransaction] finished from accept");
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
@@ -2634,8 +2754,9 @@ pk_transaction_cancel_bg (PkTransaction *transaction)
g_debug ("CancelBg method called on %s", transaction->priv->tid);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_CANCEL)) {
- g_warning ("Cancel not yet supported by backend");
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_CANCEL)) {
+ g_warning ("Cancel not supported by backend");
goto out;
}
@@ -2667,12 +2788,14 @@ out:
/**
* pk_transaction_cancel:
**/
-void
-pk_transaction_cancel (PkTransaction *transaction, DBusGMethodInvocation *context)
+static void
+pk_transaction_cancel (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
- gchar *sender = NULL;
+ const gchar *sender;
guint uid;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
@@ -2681,10 +2804,10 @@ pk_transaction_cancel (PkTransaction *transaction, DBusGMethodInvocation *contex
g_debug ("Cancel method called on %s", transaction->priv->tid);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_CANCEL)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_CANCEL)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "Cancel not yet supported by backend");
- pk_transaction_dbus_return_error (context, error);
+ "Cancel not supported by backend");
goto out;
}
@@ -2693,19 +2816,18 @@ pk_transaction_cancel (PkTransaction *transaction, DBusGMethodInvocation *contex
g_debug ("No point trying to cancel a finished transaction, ignoring");
/* return from async with success */
- pk_transaction_dbus_return (context);
+ pk_transaction_dbus_return (context, NULL);
goto out;
}
/* check to see if we have an action */
if (transaction->priv->role == PK_ROLE_ENUM_UNKNOWN) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NO_ROLE, "No role");
- pk_transaction_dbus_return_error (context, error);
goto out;
}
/* first, check the sender -- if it's the same we don't need to check the uid */
- sender = dbus_g_method_get_sender (context);
+ sender = g_dbus_method_invocation_get_sender (context);
ret = (g_strcmp0 (transaction->priv->sender, sender) == 0);
if (ret) {
g_debug ("same sender, no need to check uid");
@@ -2716,7 +2838,6 @@ pk_transaction_cancel (PkTransaction *transaction, DBusGMethodInvocation *contex
if (transaction->priv->uid == PK_TRANSACTION_UID_INVALID) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_CANNOT_CANCEL,
"No context from caller to get UID from");
- pk_transaction_dbus_return_error (context, error);
goto out;
}
@@ -2724,17 +2845,17 @@ pk_transaction_cancel (PkTransaction *transaction, DBusGMethodInvocation *contex
uid = pk_dbus_get_uid (transaction->priv->dbus, sender);
if (uid == PK_TRANSACTION_UID_INVALID) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_INVALID_STATE, "unable to get uid of caller");
- pk_transaction_dbus_return_error (context, error);
goto out;
}
/* check the caller uid with the originator uid */
if (transaction->priv->uid != uid) {
g_debug ("uid does not match (%i vs. %i)", transaction->priv->uid, uid);
- ret = pk_transaction_obtain_authorization (transaction, FALSE, PK_ROLE_ENUM_CANCEL, &error);
+ ret = pk_transaction_obtain_authorization (transaction,
+ FALSE,
+ PK_ROLE_ENUM_CANCEL, &error);
if (!ret) {
- pk_transaction_dbus_return_error (context, error);
- goto out;
+ goto out;
}
}
@@ -2748,7 +2869,7 @@ skip_uid:
pk_transaction_release_tid (transaction);
/* return from async with success */
- pk_transaction_dbus_return (context);
+ pk_transaction_dbus_return (context, NULL);
goto out;
}
@@ -2763,21 +2884,17 @@ skip_uid:
/* actually run the method */
pk_backend_cancel (transaction->priv->backend);
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
out:
- g_free (sender);
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_download_packages:
**/
-void
+static void
pk_transaction_download_packages (PkTransaction *transaction,
- gboolean store_in_cache,
- gchar **package_ids,
- DBusGMethodInvocation *context)
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
@@ -2786,26 +2903,26 @@ pk_transaction_download_packages (PkTransaction *transaction,
gint retval;
guint length;
guint max_length;
+ gboolean store_in_cache;
+ gchar **package_ids = NULL;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
- g_debug ("DownloadPackages method called: %s", package_ids[0]);
+ g_variant_get (params, "(b^a&s)",
+ &store_in_cache,
+ &package_ids);
+
+ package_ids_temp = pk_package_ids_to_string (package_ids);
+ g_debug ("DownloadPackages method called: %s", package_ids_temp);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_DOWNLOAD_PACKAGES)) {
- error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "DownloadPackages not yet supported by backend");
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_DOWNLOAD_PACKAGES)) {
+ error = g_error_new (PK_TRANSACTION_ERROR,
+ PK_TRANSACTION_ERROR_NOT_SUPPORTED,
+ "DownloadPackages not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- goto out;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
goto out;
}
@@ -2813,21 +2930,18 @@ pk_transaction_download_packages (PkTransaction *transaction,
length = g_strv_length (package_ids);
max_length = pk_conf_get_int (transaction->priv->conf, "MaximumPackagesToProcess");
if (length > max_length) {
- error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
+ error = g_error_new (PK_TRANSACTION_ERROR,
+ PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
"Too many packages to process (%i/%i)", length, max_length);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
- package_ids_temp = pk_package_ids_to_string (package_ids);
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID,
"The package id's '%s' are not valid", package_ids_temp);
- g_free (package_ids_temp);
- pk_transaction_dbus_return_error (context, error);
goto out;
}
@@ -2840,7 +2954,6 @@ pk_transaction_download_packages (PkTransaction *transaction,
if (retval != 0) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_DENIED,
"cannot create %s", directory);
- pk_transaction_dbus_return_error (context, error);
goto out;
}
}
@@ -2856,21 +2969,21 @@ pk_transaction_download_packages (PkTransaction *transaction,
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
out:
+ g_free (package_ids_temp);
g_free (directory);
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_get_categories:
**/
-void
-pk_transaction_get_categories (PkTransaction *transaction, DBusGMethodInvocation *context)
+static void
+pk_transaction_get_categories (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
@@ -2881,29 +2994,12 @@ pk_transaction_get_categories (PkTransaction *transaction, DBusGMethodInvocation
g_debug ("GetCategories method called");
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_GET_CATEGORIES)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_GET_CATEGORIES)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "GetCategories not yet supported by backend");
- pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* are we already performing an update? */
- if (pk_transaction_list_role_present (transaction->priv->transaction_list, PK_ROLE_ENUM_GET_CATEGORIES)) {
- error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_TRANSACTION_EXISTS_WITH_ROLE,
- "Already performing get categories");
+ "GetCategories not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_CATEGORIES);
@@ -2914,56 +3010,54 @@ pk_transaction_get_categories (PkTransaction *transaction, DBusGMethodInvocation
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- dbus_g_method_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_get_depends:
**/
-void
-pk_transaction_get_depends (PkTransaction *transaction, const gchar *filter, gchar **package_ids,
- gboolean recursive, DBusGMethodInvocation *context)
+static void
+pk_transaction_get_depends (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
gchar *package_ids_temp;
guint length;
guint max_length;
+ const gchar *filter;
+ gchar **package_ids;
+ gboolean recursive;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(&s^a&sb)",
+ &filter,
+ &package_ids,
+ &recursive);
+
package_ids_temp = pk_package_ids_to_string (package_ids);
g_debug ("GetDepends method called: %s (recursive %i)", package_ids_temp, recursive);
- g_free (package_ids_temp);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_GET_DEPENDS)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_GET_DEPENDS)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "GetDepends not yet supported by backend");
+ "GetDepends not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check the filter */
ret = pk_transaction_filter_check (filter, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check for length sanity */
@@ -2973,20 +3067,16 @@ pk_transaction_get_depends (PkTransaction *transaction, const gchar *filter, gch
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
"Too many packages to process (%i/%i)", length, max_length);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
- package_ids_temp = pk_package_ids_to_string (package_ids);
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID,
"The package id's '%s' are not valid", package_ids_temp);
- g_free (package_ids_temp);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -3001,48 +3091,43 @@ pk_transaction_get_depends (PkTransaction *transaction, const gchar *filter, gch
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_get_details:
**/
-void
-pk_transaction_get_details (PkTransaction *transaction, gchar **package_ids, DBusGMethodInvocation *context)
+static void
+pk_transaction_get_details (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
gchar *package_ids_temp;
guint length;
guint max_length;
+ gchar **package_ids;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(^a&s)",
+ &package_ids);
+
package_ids_temp = pk_package_ids_to_string (package_ids);
g_debug ("GetDetails method called: %s", package_ids_temp);
- g_free (package_ids_temp);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_GET_DETAILS)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_GET_DETAILS)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "GetDetails not yet supported by backend");
+ "GetDetails not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check for length sanity */
@@ -3052,8 +3137,7 @@ pk_transaction_get_details (PkTransaction *transaction, gchar **package_ids, DBu
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
"Too many packages to process (%i/%i)", length, max_length);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check package_ids */
@@ -3064,8 +3148,7 @@ pk_transaction_get_details (PkTransaction *transaction, gchar **package_ids, DBu
"The package id's '%s' are not valid", package_ids_temp);
g_free (package_ids_temp);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -3078,19 +3161,20 @@ pk_transaction_get_details (PkTransaction *transaction, gchar **package_ids, DBu
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ g_free (package_ids_temp);
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_get_distro_upgrades:
**/
-void
-pk_transaction_get_distro_upgrades (PkTransaction *transaction, DBusGMethodInvocation *context)
+static void
+pk_transaction_get_distro_upgrades (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
@@ -3101,20 +3185,12 @@ pk_transaction_get_distro_upgrades (PkTransaction *transaction, DBusGMethodInvoc
g_debug ("GetDistroUpgrades method called");
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_GET_DISTRO_UPGRADES)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_GET_DISTRO_UPGRADES)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "GetDistroUpgrades not yet supported by backend");
+ "GetDistroUpgrades not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -3126,50 +3202,43 @@ pk_transaction_get_distro_upgrades (PkTransaction *transaction, DBusGMethodInvoc
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- if (context != NULL) {
- /* not set inside the test suite */
- dbus_g_method_return (context);
+ goto out;
}
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_get_files:
**/
-void
-pk_transaction_get_files (PkTransaction *transaction, gchar **package_ids, DBusGMethodInvocation *context)
+static void
+pk_transaction_get_files (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
gchar *package_ids_temp;
guint length;
guint max_length;
+ gchar **package_ids;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(^a&s)",
+ &package_ids);
+
package_ids_temp = pk_package_ids_to_string (package_ids);
g_debug ("GetFiles method called: %s", package_ids_temp);
- g_free (package_ids_temp);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_GET_FILES)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_GET_FILES)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "GetFiles not yet supported by backend");
+ "GetFiles not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check for length sanity */
@@ -3179,20 +3248,16 @@ pk_transaction_get_files (PkTransaction *transaction, gchar **package_ids, DBusG
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
"Too many packages to process (%i/%i)", length, max_length);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
- package_ids_temp = pk_package_ids_to_string (package_ids);
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID,
"The package id's '%s' are not valid", package_ids_temp);
- g_free (package_ids_temp);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -3205,51 +3270,47 @@ pk_transaction_get_files (PkTransaction *transaction, gchar **package_ids, DBusG
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ g_free (package_ids_temp);
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_get_packages:
**/
-void
-pk_transaction_get_packages (PkTransaction *transaction, const gchar *filter, DBusGMethodInvocation *context)
+static void
+pk_transaction_get_packages (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
+ const gchar *filter;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(&s)",
+ &filter);
+
g_debug ("GetPackages method called: %s", filter);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_GET_PACKAGES)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_GET_PACKAGES)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "GetPackages not yet supported by backend");
+ "GetPackages not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check the filter */
ret = pk_transaction_filter_check (filter, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -3262,24 +3323,28 @@ pk_transaction_get_packages (PkTransaction *transaction, const gchar *filter, DB
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_get_old_transactions:
**/
-gboolean
-pk_transaction_get_old_transactions (PkTransaction *transaction, guint number, GError **error)
+static void
+pk_transaction_get_old_transactions (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
guint idle_id;
+ guint number;
- g_return_val_if_fail (PK_IS_TRANSACTION (transaction), FALSE);
- g_return_val_if_fail (transaction->priv->tid != NULL, FALSE);
+ g_return_if_fail (PK_IS_TRANSACTION (transaction));
+ g_return_if_fail (transaction->priv->tid != NULL);
+
+ g_variant_get (params, "(u)",
+ &number);
g_debug ("GetOldTransactions method called");
@@ -3288,46 +3353,43 @@ pk_transaction_get_old_transactions (PkTransaction *transaction, guint number, G
idle_id = g_idle_add ((GSourceFunc) pk_transaction_finished_idle_cb, transaction);
g_source_set_name_by_id (idle_id, "[PkTransaction] finished from get-old-transactions");
- return TRUE;
+ pk_transaction_dbus_return (context, NULL);
}
/**
* pk_transaction_get_repo_list:
**/
-void
-pk_transaction_get_repo_list (PkTransaction *transaction, const gchar *filter, DBusGMethodInvocation *context)
+static void
+pk_transaction_get_repo_list (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
+ const gchar *filter;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(&s)",
+ &filter);
+
g_debug ("GetRepoList method called");
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_GET_REPO_LIST)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_GET_REPO_LIST)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "GetRepoList not yet supported by backend");
+ "GetRepoList not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check the filter */
ret = pk_transaction_filter_check (filter, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -3337,60 +3399,58 @@ pk_transaction_get_repo_list (PkTransaction *transaction, const gchar *filter, D
/* try to commit this */
ret = pk_transaction_commit (transaction);
if (!ret) {
- error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
+ error = g_error_new (PK_TRANSACTION_ERROR,
+ PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_get_requires:
**/
-void
-pk_transaction_get_requires (PkTransaction *transaction, const gchar *filter, gchar **package_ids,
- gboolean recursive, DBusGMethodInvocation *context)
+static void
+pk_transaction_get_requires (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
gchar *package_ids_temp;
guint length;
guint max_length;
+ const gchar *filter;
+ gchar **package_ids;
+ gboolean recursive;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(&s^a&sb)",
+ &filter,
+ &package_ids,
+ &recursive);
+
package_ids_temp = pk_package_ids_to_string (package_ids);
g_debug ("GetRequires method called: %s (recursive %i)", package_ids_temp, recursive);
- g_free (package_ids_temp);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_GET_REQUIRES)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_GET_REQUIRES)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "GetRequires not yet supported by backend");
+ "GetRequires not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check the filter */
ret = pk_transaction_filter_check (filter, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check for length sanity */
@@ -3400,20 +3460,16 @@ pk_transaction_get_requires (PkTransaction *transaction, const gchar *filter, gc
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
"Too many packages to process (%i/%i)", length, max_length);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
- package_ids_temp = pk_package_ids_to_string (package_ids);
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID,
"The package id's '%s' are not valid", package_ids_temp);
- g_free (package_ids_temp);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -3428,49 +3484,44 @@ pk_transaction_get_requires (PkTransaction *transaction, const gchar *filter, gc
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ g_free (package_ids_temp);
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_get_update_detail:
**/
-void
-pk_transaction_get_update_detail (PkTransaction *transaction, gchar **package_ids,
- DBusGMethodInvocation *context)
+static void
+pk_transaction_get_update_detail (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
gchar *package_ids_temp;
guint length;
guint max_length;
+ gchar **package_ids;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(^a&s)",
+ &package_ids);
+
package_ids_temp = pk_package_ids_to_string (package_ids);
g_debug ("GetUpdateDetail method called: %s", package_ids_temp);
- g_free (package_ids_temp);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_GET_UPDATE_DETAIL)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_GET_UPDATE_DETAIL)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "GetUpdateDetail not yet supported by backend");
+ "GetUpdateDetail not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check for length sanity */
@@ -3480,20 +3531,16 @@ pk_transaction_get_update_detail (PkTransaction *transaction, gchar **package_id
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
"Too many packages to process (%i/%i)", length, max_length);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
- package_ids_temp = pk_package_ids_to_string (package_ids);
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID,
"The package id's '%s' are not valid", package_ids_temp);
- g_free (package_ids_temp);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -3506,12 +3553,11 @@ pk_transaction_get_update_detail (PkTransaction *transaction, gchar **package_id
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ g_free (package_ids_temp);
+ pk_transaction_dbus_return (context, error);
}
/**
@@ -3553,19 +3599,31 @@ pk_transaction_try_emit_cache (PkTransaction *transaction)
package_array = pk_results_get_package_array (results);
for (i=0; i<package_array->len; i++) {
package = g_ptr_array_index (package_array, i);
- g_signal_emit (transaction, signals[SIGNAL_PACKAGE], 0,
- pk_info_enum_to_string (pk_package_get_info (package)),
- pk_package_get_id (package),
- pk_package_get_summary (package));
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "Package",
+ g_variant_new ("(sss)",
+ pk_info_enum_to_string (pk_package_get_info (package)),
+ pk_package_get_id (package),
+ pk_package_get_summary (package)),
+ NULL);
}
/* messages */
message_array = pk_results_get_message_array (results);
for (i=0; i<message_array->len; i++) {
message = g_ptr_array_index (message_array, i);
- g_signal_emit (transaction, signals[SIGNAL_MESSAGE], 0,
- pk_message_enum_to_string (pk_message_get_kind (message)),
- pk_message_get_details (message));
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "Message",
+ g_variant_new ("(ss)",
+ pk_message_enum_to_string (pk_message_get_kind (message)),
+ pk_message_get_details (message)),
+ NULL);
}
/* success */
@@ -3588,40 +3646,37 @@ out:
/**
* pk_transaction_get_updates:
**/
-void
-pk_transaction_get_updates (PkTransaction *transaction, const gchar *filter, DBusGMethodInvocation *context)
+static void
+pk_transaction_get_updates (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
+ const gchar *filter;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(&s)",
+ &filter);
+
g_debug ("GetUpdates method called");
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_GET_UPDATES)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_GET_UPDATES)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "GetUpdates not yet supported by backend");
+ "GetUpdates not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check the filter */
ret = pk_transaction_filter_check (filter, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -3630,12 +3685,8 @@ pk_transaction_get_updates (PkTransaction *transaction, const gchar *filter, DBu
/* try and reuse cache */
ret = pk_transaction_try_emit_cache (transaction);
- if (ret) {
- /* not set inside the test suite */
- if (context != NULL)
- dbus_g_method_return (context);
- return;
- }
+ if (ret)
+ goto out;
/* try to commit this */
ret = pk_transaction_commit (transaction);
@@ -3643,12 +3694,10 @@ pk_transaction_get_updates (PkTransaction *transaction, const gchar *filter, DBu
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
@@ -3706,9 +3755,10 @@ pk_transaction_is_supported_content_type (PkTransaction *transaction,
/**
* pk_transaction_install_files:
**/
-void
-pk_transaction_install_files (PkTransaction *transaction, gboolean only_trusted,
- gchar **full_paths, DBusGMethodInvocation *context)
+static void
+pk_transaction_install_files (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gchar *full_paths_temp;
gboolean ret;
@@ -3718,28 +3768,25 @@ pk_transaction_install_files (PkTransaction *transaction, gboolean only_trusted,
gchar *content_type = NULL;
guint length;
guint i;
+ gboolean only_trusted;
+ gchar **full_paths;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(b^a&s)",
+ &only_trusted,
+ &full_paths);
+
full_paths_temp = pk_package_ids_to_string (full_paths);
g_debug ("InstallFiles method called: %s (only_trusted %i)", full_paths_temp, only_trusted);
- g_free (full_paths_temp);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_INSTALL_FILES)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_INSTALL_FILES)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "InstallFiles not yet supported by backend");
+ "InstallFiles not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- goto out;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
goto out;
}
@@ -3757,8 +3804,7 @@ pk_transaction_install_files (PkTransaction *transaction, gboolean only_trusted,
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NO_SUCH_FILE,
"No such file %s", full_paths[i]);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- goto out;
+ goto out;
}
/* get content type */
@@ -3767,8 +3813,7 @@ pk_transaction_install_files (PkTransaction *transaction, gboolean only_trusted,
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
"Failed to get content type for file %s", full_paths[i]);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- goto out;
+ goto out;
}
/* supported content type? */
@@ -3777,8 +3822,7 @@ pk_transaction_install_files (PkTransaction *transaction, gboolean only_trusted,
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_MIME_TYPE_NOT_SUPPORTED,
"MIME type '%s' not supported %s", content_type, full_paths[i]);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- goto out;
+ goto out;
}
/* valid */
@@ -3789,8 +3833,7 @@ pk_transaction_install_files (PkTransaction *transaction, gboolean only_trusted,
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_PACK_INVALID, "%s", error_local->message);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- g_error_free (error_local);
+ g_error_free (error_local);
goto out;
}
}
@@ -3800,7 +3843,6 @@ pk_transaction_install_files (PkTransaction *transaction, gboolean only_trusted,
ret = pk_transaction_obtain_authorization (transaction, only_trusted, PK_ROLE_ENUM_INSTALL_FILES, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
goto out;
}
@@ -3808,49 +3850,45 @@ pk_transaction_install_files (PkTransaction *transaction, gboolean only_trusted,
transaction->priv->cached_only_trusted = only_trusted;
transaction->priv->cached_full_paths = g_strdupv (full_paths);
pk_transaction_set_role (transaction, PK_ROLE_ENUM_INSTALL_FILES);
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
out:
+ g_free (full_paths_temp);
g_free (content_type);
- return;
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_install_packages:
**/
-void
-pk_transaction_install_packages (PkTransaction *transaction, gboolean only_trusted,
- gchar **package_ids, DBusGMethodInvocation *context)
+static void
+pk_transaction_install_packages (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
gchar *package_ids_temp;
guint length;
guint max_length;
+ gboolean only_trusted;
+ gchar **package_ids;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(b^a&s)",
+ &only_trusted,
+ &package_ids);
+
package_ids_temp = pk_package_ids_to_string (package_ids);
g_debug ("InstallPackages method called: %s", package_ids_temp);
- g_free (package_ids_temp);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_INSTALL_PACKAGES)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_INSTALL_PACKAGES)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "InstallPackages not yet supported by backend");
+ "InstallPackages not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check for length sanity */
@@ -3860,20 +3898,16 @@ pk_transaction_install_packages (PkTransaction *transaction, gboolean only_trust
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
"Too many packages to process (%i/%i)", length, max_length);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
- package_ids_temp = pk_package_ids_to_string (package_ids);
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID,
"The package id's '%s' are not valid", package_ids_temp);
- g_free (package_ids_temp);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -3885,53 +3919,51 @@ pk_transaction_install_packages (PkTransaction *transaction, gboolean only_trust
ret = pk_transaction_obtain_authorization (transaction, only_trusted, PK_ROLE_ENUM_INSTALL_PACKAGES, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ g_free (package_ids_temp);
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_install_signature:
**/
-void
-pk_transaction_install_signature (PkTransaction *transaction, const gchar *sig_type,
- const gchar *key_id, const gchar *package_id,
- DBusGMethodInvocation *context)
+static void
+pk_transaction_install_signature (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
+ const gchar *sig_type;
+ const gchar *key_id;
+ const gchar *package_id;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(&s&s&s)",
+ &sig_type,
+ &key_id,
+ &package_id);
+
g_debug ("InstallSignature method called: %s, %s", key_id, package_id);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_INSTALL_SIGNATURE)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_INSTALL_SIGNATURE)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "InstallSignature not yet supported by backend");
+ "InstallSignature not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check for sanity */
ret = pk_transaction_strvalidate (key_id, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check package_id (';;;repo-id' is used for the repo key) */
@@ -3940,8 +3972,7 @@ pk_transaction_install_signature (PkTransaction *transaction, const gchar *sig_t
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID,
"The package id '%s' is not valid", package_id);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -3950,46 +3981,45 @@ pk_transaction_install_signature (PkTransaction *transaction, const gchar *sig_t
pk_transaction_set_role (transaction, PK_ROLE_ENUM_INSTALL_SIGNATURE);
/* try to get authorization */
- ret = pk_transaction_obtain_authorization (transaction, FALSE, PK_ROLE_ENUM_INSTALL_SIGNATURE, &error);
+ ret = pk_transaction_obtain_authorization (transaction,
+ FALSE,
+ PK_ROLE_ENUM_INSTALL_SIGNATURE,
+ &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_refresh_cache:
**/
-void
-pk_transaction_refresh_cache (PkTransaction *transaction, gboolean force, DBusGMethodInvocation *context)
+static void
+pk_transaction_refresh_cache (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
+ gboolean force;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(b)",
+ &force);
+
g_debug ("RefreshCache method called: %i", force);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_REFRESH_CACHE)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_REFRESH_CACHE)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "RefreshCache not yet supported by backend");
+ "RefreshCache not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* we unref the update cache if it exists */
@@ -4000,53 +4030,54 @@ pk_transaction_refresh_cache (PkTransaction *transaction, gboolean force, DBusGM
pk_transaction_set_role (transaction, PK_ROLE_ENUM_REFRESH_CACHE);
/* try to get authorization */
- ret = pk_transaction_obtain_authorization (transaction, FALSE, PK_ROLE_ENUM_REFRESH_CACHE, &error);
+ ret = pk_transaction_obtain_authorization (transaction,
+ FALSE,
+ PK_ROLE_ENUM_REFRESH_CACHE,
+ &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_remove_packages:
**/
-void
-pk_transaction_remove_packages (PkTransaction *transaction, gchar **package_ids,
- gboolean allow_deps, gboolean autoremove,
- DBusGMethodInvocation *context)
+static void
+pk_transaction_remove_packages (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
gchar *package_ids_temp;
guint length;
guint max_length;
+ gchar **package_ids;
+ gboolean allow_deps;
+ gboolean autoremove;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(^a&sbb)",
+ &package_ids,
+ &allow_deps,
+ &autoremove);
+
package_ids_temp = pk_package_ids_to_string (package_ids);
- g_debug ("RemovePackages method called: %s, %i, %i", package_ids_temp, allow_deps, autoremove);
- g_free (package_ids_temp);
+ g_debug ("RemovePackages method called: %s, %i, %i",
+ package_ids_temp, allow_deps, autoremove);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_REMOVE_PACKAGES)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_REMOVE_PACKAGES)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "RemovePackages not yet supported by backend");
+ "RemovePackages not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check for length sanity */
@@ -4056,20 +4087,16 @@ pk_transaction_remove_packages (PkTransaction *transaction, gchar **package_ids,
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
"Too many packages to process (%i/%i)", length, max_length);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
- package_ids_temp = pk_package_ids_to_string (package_ids);
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID,
"The package id's '%s' are not valid", package_ids_temp);
- g_free (package_ids_temp);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -4079,55 +4106,55 @@ pk_transaction_remove_packages (PkTransaction *transaction, gchar **package_ids,
pk_transaction_set_role (transaction, PK_ROLE_ENUM_REMOVE_PACKAGES);
/* try to get authorization */
- ret = pk_transaction_obtain_authorization (transaction, FALSE, PK_ROLE_ENUM_REMOVE_PACKAGES, &error);
+ ret = pk_transaction_obtain_authorization (transaction,
+ FALSE,
+ PK_ROLE_ENUM_REMOVE_PACKAGES,
+ &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ g_free (package_ids_temp);
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_repo_enable:
**/
-void
-pk_transaction_repo_enable (PkTransaction *transaction, const gchar *repo_id, gboolean enabled,
- DBusGMethodInvocation *context)
+static void
+pk_transaction_repo_enable (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
+ const gchar *repo_id;
+ gboolean enabled;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(&sb)",
+ &repo_id,
+ &enabled);
+
g_debug ("RepoEnable method called: %s, %i", repo_id, enabled);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_REPO_ENABLE)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_REPO_ENABLE)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "RepoEnable not yet supported by backend");
+ "RepoEnable not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check for sanity */
ret = pk_transaction_strvalidate (repo_id, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -4136,56 +4163,56 @@ pk_transaction_repo_enable (PkTransaction *transaction, const gchar *repo_id, gb
pk_transaction_set_role (transaction, PK_ROLE_ENUM_REPO_ENABLE);
/* try to get authorization */
- ret = pk_transaction_obtain_authorization (transaction, FALSE, PK_ROLE_ENUM_REPO_ENABLE, &error);
+ ret = pk_transaction_obtain_authorization (transaction,
+ FALSE,
+ PK_ROLE_ENUM_REPO_ENABLE, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_repo_set_data:
**/
-void
-pk_transaction_repo_set_data (PkTransaction *transaction, const gchar *repo_id,
- const gchar *parameter, const gchar *value,
- DBusGMethodInvocation *context)
+static void
+pk_transaction_repo_set_data (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
+ const gchar *repo_id;
+ const gchar *parameter;
+ const gchar *value;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
- g_debug ("RepoSetData method called: %s, %s, %s", repo_id, parameter, value);
+ g_variant_get (params, "(&s&s&s)",
+ &repo_id,
+ ¶meter,
+ &value);
+
+ g_debug ("RepoSetData method called: %s, %s, %s",
+ repo_id, parameter, value);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_REPO_SET_DATA)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_REPO_SET_DATA)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "RepoSetData not yet supported by backend");
+ "RepoSetData not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check for sanity */
ret = pk_transaction_strvalidate (repo_id, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -4195,23 +4222,25 @@ pk_transaction_repo_set_data (PkTransaction *transaction, const gchar *repo_id,
pk_transaction_set_role (transaction, PK_ROLE_ENUM_REPO_SET_DATA);
/* try to get authorization */
- ret = pk_transaction_obtain_authorization (transaction, FALSE, PK_ROLE_ENUM_REPO_SET_DATA, &error);
+ ret = pk_transaction_obtain_authorization (transaction,
+ FALSE,
+ PK_ROLE_ENUM_REPO_SET_DATA,
+ &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_resolve:
**/
-void
-pk_transaction_resolve (PkTransaction *transaction, const gchar *filter,
- gchar **packages, DBusGMethodInvocation *context)
+static void
+pk_transaction_resolve (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
@@ -4219,37 +4248,33 @@ pk_transaction_resolve (PkTransaction *transaction, const gchar *filter,
guint i;
guint length;
guint max_length;
+ const gchar *filter;
+ gchar **packages;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(&s^a&s)",
+ &filter,
+ &packages);
+
packages_temp = pk_package_ids_to_string (packages);
g_debug ("Resolve method called: %s, %s", filter, packages_temp);
- g_free (packages_temp);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_RESOLVE)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_RESOLVE)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "Resolve not yet supported by backend");
+ "Resolve not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check the filter */
ret = pk_transaction_filter_check (filter, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check for length sanity */
@@ -4259,8 +4284,7 @@ pk_transaction_resolve (PkTransaction *transaction, const gchar *filter,
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_INPUT_INVALID,
"Too many items to process (%i/%i)", length, max_length);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check each package for sanity */
@@ -4268,8 +4292,7 @@ pk_transaction_resolve (PkTransaction *transaction, const gchar *filter,
ret = pk_transaction_strvalidate (packages[i], &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ return;
}
}
@@ -4284,52 +4307,47 @@ pk_transaction_resolve (PkTransaction *transaction, const gchar *filter,
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ g_free (packages_temp);
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_rollback:
**/
-void
-pk_transaction_rollback (PkTransaction *transaction, const gchar *transaction_id,
- DBusGMethodInvocation *context)
+static void
+pk_transaction_rollback (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
+ const gchar *transaction_id;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(&s)",
+ &transaction_id);
+
g_debug ("Rollback method called: %s", transaction_id);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_ROLLBACK)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_ROLLBACK)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "Rollback not yet supported by backend");
+ "Rollback not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check for sanity */
ret = pk_transaction_strvalidate (transaction_id, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -4337,63 +4355,60 @@ pk_transaction_rollback (PkTransaction *transaction, const gchar *transaction_id
pk_transaction_set_role (transaction, PK_ROLE_ENUM_ROLLBACK);
/* try to get authorization */
- ret = pk_transaction_obtain_authorization (transaction, FALSE, PK_ROLE_ENUM_ROLLBACK, &error);
+ ret = pk_transaction_obtain_authorization (transaction,
+ FALSE,
+ PK_ROLE_ENUM_ROLLBACK, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_search_details:
**/
-void
-pk_transaction_search_details (PkTransaction *transaction, const gchar *filter,
- gchar **values, DBusGMethodInvocation *context)
+static void
+pk_transaction_search_details (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
+ const gchar *filter;
+ gchar **values;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(&s^a&s)",
+ &filter,
+ &values);
+
g_debug ("SearchDetails method called: %s, %s", filter, values[0]);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_SEARCH_DETAILS)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_SEARCH_DETAILS)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "SearchDetails not yet supported by backend");
+ "SearchDetails not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check the search term */
ret = pk_transaction_search_check (values, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check the filter */
ret = pk_transaction_filter_check (filter, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -4407,53 +4422,49 @@ pk_transaction_search_details (PkTransaction *transaction, const gchar *filter,
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_search_files:
**/
-void
-pk_transaction_search_files (PkTransaction *transaction, const gchar *filter,
- gchar **values, DBusGMethodInvocation *context)
+static void
+pk_transaction_search_files (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
guint i;
+ const gchar *filter;
+ gchar **values;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(&s^a&s)",
+ &filter,
+ &values);
+
g_debug ("SearchFiles method called: %s, %s", filter, values[0]);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_SEARCH_FILE)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_SEARCH_FILE)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "SearchFiles not yet supported by backend");
+ "SearchFiles not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check the search term */
ret = pk_transaction_search_check (values, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* when not an absolute path, disallow slashes in search */
@@ -4462,8 +4473,7 @@ pk_transaction_search_files (PkTransaction *transaction, const gchar *filter,
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_SEARCH_PATH_INVALID,
"Invalid search path");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ return;
}
}
@@ -4471,8 +4481,7 @@ pk_transaction_search_files (PkTransaction *transaction, const gchar *filter,
ret = pk_transaction_filter_check (filter, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -4486,53 +4495,49 @@ pk_transaction_search_files (PkTransaction *transaction, const gchar *filter,
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_search_groups:
**/
-void
-pk_transaction_search_groups (PkTransaction *transaction, const gchar *filter,
- gchar **values, DBusGMethodInvocation *context)
+static void
+pk_transaction_search_groups (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
guint i;
+ const gchar *filter;
+ gchar **values;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(&s^a&s)",
+ &filter,
+ &values);
+
g_debug ("SearchGroups method called: %s, %s", filter, values[0]);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_SEARCH_GROUP)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_SEARCH_GROUP)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "SearchGroups not yet supported by backend");
+ "SearchGroups not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check the search term */
ret = pk_transaction_search_check (values, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* do not allow spaces */
@@ -4541,8 +4546,7 @@ pk_transaction_search_groups (PkTransaction *transaction, const gchar *filter,
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_SEARCH_INVALID,
"Invalid search containing spaces");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ return;
}
}
@@ -4550,8 +4554,7 @@ pk_transaction_search_groups (PkTransaction *transaction, const gchar *filter,
ret = pk_transaction_filter_check (filter, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -4565,60 +4568,55 @@ pk_transaction_search_groups (PkTransaction *transaction, const gchar *filter,
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_search_name:
**/
-void
-pk_transaction_search_names (PkTransaction *transaction, const gchar *filter,
- gchar **values, DBusGMethodInvocation *context)
+static void
+pk_transaction_search_names (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
+ const gchar *filter;
+ gchar **values;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(&s^a&s)",
+ &filter,
+ &values);
+
g_debug ("SearchNames method called: %s, %s", filter, values[0]);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_SEARCH_NAME)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_SEARCH_NAME)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "SearchNames not yet supported by backend");
+ "SearchNames not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check the search term */
ret = pk_transaction_search_check (values, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check the filter */
ret = pk_transaction_filter_check (filter, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -4632,12 +4630,10 @@ pk_transaction_search_names (PkTransaction *transaction, const gchar *filter,
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
@@ -4646,7 +4642,10 @@ pk_transaction_search_names (PkTransaction *transaction, const gchar *filter,
* Only return FALSE on error, not invalid parameter name
*/
static gboolean
-pk_transaction_set_hint (PkTransaction *transaction, const gchar *key, const gchar *value, GError **error)
+pk_transaction_set_hint (PkTransaction *transaction,
+ const gchar *key,
+ const gchar *value,
+ GError **error)
{
gboolean ret = TRUE;
PkTransactionPrivate *priv = transaction->priv;
@@ -4759,29 +4758,26 @@ out:
/**
* pk_transaction_set_hints:
*/
-void
-pk_transaction_set_hints (PkTransaction *transaction, gchar **hints, DBusGMethodInvocation *context)
+static void
+pk_transaction_set_hints (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
GError *error = NULL;
gboolean ret;
guint i;
gchar **sections;
gchar *dbg;
+ const gchar **hints = NULL;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
- dbg = g_strjoinv (", ", hints);
- g_debug ("SetHints method called: %s", dbg);
- g_free (dbg);
+ g_variant_get (params, "(^a&s)",
+ &hints);
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
- }
+ dbg = g_strjoinv (", ", (gchar**) hints);
+ g_debug ("SetHints method called: %s", dbg);
/* parse */
for (i=0; hints[i] != NULL; i++) {
@@ -4797,24 +4793,20 @@ pk_transaction_set_hints (PkTransaction *transaction, gchar **hints, DBusGMethod
/* we failed, so abort current list */
if (!ret)
- break;
- }
-
- /* we failed to parse */
- if (!ret) {
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ g_free (dbg);
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_simulate_install_files:
**/
-void
-pk_transaction_simulate_install_files (PkTransaction *transaction, gchar **full_paths, DBusGMethodInvocation *context)
+static void
+pk_transaction_simulate_install_files (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gchar *full_paths_temp;
gboolean ret;
@@ -4824,29 +4816,24 @@ pk_transaction_simulate_install_files (PkTransaction *transaction, gchar **full_
gchar *content_type;
guint length;
guint i;
+ gchar **full_paths;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(^a&s)",
+ &full_paths);
+
full_paths_temp = pk_package_ids_to_string (full_paths);
g_debug ("SimulateInstallFiles method called: %s", full_paths_temp);
- g_free (full_paths_temp);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_SIMULATE_INSTALL_FILES)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_SIMULATE_INSTALL_FILES)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "SimulateInstallFiles not yet supported by backend");
+ "SimulateInstallFiles not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* run the plugins */
@@ -4863,8 +4850,7 @@ pk_transaction_simulate_install_files (PkTransaction *transaction, gchar **full_
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NO_SUCH_FILE,
"No such file %s", full_paths[i]);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* get content type */
@@ -4873,8 +4859,7 @@ pk_transaction_simulate_install_files (PkTransaction *transaction, gchar **full_
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
"Failed to get content type for file %s", full_paths[i]);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* supported content type? */
@@ -4884,8 +4869,7 @@ pk_transaction_simulate_install_files (PkTransaction *transaction, gchar **full_
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_MIME_TYPE_NOT_SUPPORTED,
"MIME type not supported %s", full_paths[i]);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* valid */
@@ -4896,9 +4880,8 @@ pk_transaction_simulate_install_files (PkTransaction *transaction, gchar **full_
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_PACK_INVALID, "%s", error_local->message);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
g_error_free (error_local);
- return;
+ goto out;
}
}
}
@@ -4913,47 +4896,44 @@ pk_transaction_simulate_install_files (PkTransaction *transaction, gchar **full_
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ g_free (full_paths_temp);
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_simulate_install_packages:
**/
-void
-pk_transaction_simulate_install_packages (PkTransaction *transaction, gchar **package_ids, DBusGMethodInvocation *context)
+static void
+pk_transaction_simulate_install_packages (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
gchar *package_ids_temp;
guint length;
guint max_length;
+ gchar **package_ids;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(^a&s)",
+ &package_ids);
+
g_debug ("SimulateInstallPackages method called: %s", package_ids[0]);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_SIMULATE_INSTALL_PACKAGES) &&
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_SIMULATE_INSTALL_PACKAGES) &&
!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_GET_DEPENDS)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "SimulateInstallPackages not yet supported by backend");
+ "SimulateInstallPackages not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check for length sanity */
@@ -4963,8 +4943,7 @@ pk_transaction_simulate_install_packages (PkTransaction *transaction, gchar **pa
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
"Too many packages to process (%i/%i)", length, max_length);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check package_ids */
@@ -4975,8 +4954,7 @@ pk_transaction_simulate_install_packages (PkTransaction *transaction, gchar **pa
"The package id's '%s' are not valid", package_ids_temp);
g_free (package_ids_temp);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -4989,47 +4967,46 @@ pk_transaction_simulate_install_packages (PkTransaction *transaction, gchar **pa
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_simulate_remove_packages:
**/
-void
-pk_transaction_simulate_remove_packages (PkTransaction *transaction, gchar **package_ids, gboolean autoremove, DBusGMethodInvocation *context)
+static void
+pk_transaction_simulate_remove_packages (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
gchar *package_ids_temp;
guint length;
guint max_length;
+ gchar **package_ids;
+ gboolean autoremove;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
- g_debug ("SimulateRemovePackages method called: %s", package_ids[0]);
+ g_variant_get (params, "(^a&sb)",
+ &package_ids,
+ &autoremove);
+
+ package_ids_temp = pk_package_ids_to_string (package_ids);
+ g_debug ("SimulateRemovePackages method called: %s", package_ids_temp);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_SIMULATE_REMOVE_PACKAGES) &&
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_SIMULATE_REMOVE_PACKAGES) &&
!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_GET_REQUIRES)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "SimulateRemovePackages not yet supported by backend");
+ "SimulateRemovePackages not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check for length sanity */
@@ -5039,20 +5016,16 @@ pk_transaction_simulate_remove_packages (PkTransaction *transaction, gchar **pac
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
"Too many packages to process (%i/%i)", length, max_length);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
- package_ids_temp = pk_package_ids_to_string (package_ids);
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID,
"The package id's '%s' are not valid", package_ids_temp);
- g_free (package_ids_temp);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -5066,47 +5039,45 @@ pk_transaction_simulate_remove_packages (PkTransaction *transaction, gchar **pac
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ g_free (package_ids_temp);
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_simulate_update_packages:
**/
-void
-pk_transaction_simulate_update_packages (PkTransaction *transaction, gchar **package_ids, DBusGMethodInvocation *context)
+static void
+pk_transaction_simulate_update_packages (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
gchar *package_ids_temp;
guint length;
guint max_length;
+ gchar **package_ids;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
- g_debug ("SimulateUpdatePackages method called: %s", package_ids[0]);
+ g_variant_get (params, "(^a&s)",
+ &package_ids);
+
+ package_ids_temp = pk_package_ids_to_string (package_ids);
+ g_debug ("SimulateUpdatePackages method called: %s", package_ids_temp);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_SIMULATE_UPDATE_PACKAGES) &&
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_SIMULATE_UPDATE_PACKAGES) &&
!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_GET_DEPENDS)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "SimulateUpdatePackages not yet supported by backend");
+ "SimulateUpdatePackages not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check for length sanity */
@@ -5116,20 +5087,16 @@ pk_transaction_simulate_update_packages (PkTransaction *transaction, gchar **pac
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
"Too many packages to process (%i/%i)", length, max_length);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
- package_ids_temp = pk_package_ids_to_string (package_ids);
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID,
"The package id's '%s' are not valid", package_ids_temp);
- g_free (package_ids_temp);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -5142,48 +5109,45 @@ pk_transaction_simulate_update_packages (PkTransaction *transaction, gchar **pac
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_update_packages:
**/
-void
-pk_transaction_update_packages (PkTransaction *transaction, gboolean only_trusted, gchar **package_ids, DBusGMethodInvocation *context)
+static void
+pk_transaction_update_packages (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
gchar *package_ids_temp;
guint length;
guint max_length;
+ gboolean only_trusted;
+ gchar **package_ids;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(b^a&s)",
+ &only_trusted,
+ &package_ids);
+
package_ids_temp = pk_package_ids_to_string (package_ids);
g_debug ("UpdatePackages method called: %s", package_ids_temp);
- g_free (package_ids_temp);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_UPDATE_PACKAGES)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_UPDATE_PACKAGES)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "UpdatePackages not yet supported by backend");
+ "UpdatePackages not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check for length sanity */
@@ -5193,20 +5157,16 @@ pk_transaction_update_packages (PkTransaction *transaction, gboolean only_truste
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
"Too many packages to process (%i/%i)", length, max_length);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check package_ids */
ret = pk_package_ids_check (package_ids);
if (!ret) {
- package_ids_temp = pk_package_ids_to_string (package_ids);
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID,
"The package id's '%s' are not valid", package_ids_temp);
- g_free (package_ids_temp);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -5218,43 +5178,40 @@ pk_transaction_update_packages (PkTransaction *transaction, gboolean only_truste
ret = pk_transaction_obtain_authorization (transaction, only_trusted, PK_ROLE_ENUM_UPDATE_PACKAGES, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ g_free (package_ids_temp);
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_update_system:
**/
-void
-pk_transaction_update_system (PkTransaction *transaction, gboolean only_trusted, DBusGMethodInvocation *context)
+static void
+pk_transaction_update_system (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
+ gboolean only_trusted;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(b)",
+ &only_trusted);
+
g_debug ("UpdateSystem method called");
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_UPDATE_SYSTEM)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_UPDATE_SYSTEM)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "UpdateSystem not yet supported by backend");
+ "UpdateSystem not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* are we already performing an update? */
@@ -5262,8 +5219,7 @@ pk_transaction_update_system (PkTransaction *transaction, gboolean only_trusted,
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_TRANSACTION_EXISTS_WITH_ROLE,
"Already performing system update");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
transaction->priv->cached_only_trusted = only_trusted;
@@ -5273,61 +5229,58 @@ pk_transaction_update_system (PkTransaction *transaction, gboolean only_trusted,
ret = pk_transaction_obtain_authorization (transaction, only_trusted, PK_ROLE_ENUM_UPDATE_SYSTEM, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_what_provides:
**/
-void
-pk_transaction_what_provides (PkTransaction *transaction, const gchar *filter, const gchar *type,
- gchar **values, DBusGMethodInvocation *context)
+static void
+pk_transaction_what_provides (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
PkProvidesEnum provides;
GError *error = NULL;
+ const gchar *filter;
+ const gchar *type;
+ gchar **values;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
+ g_variant_get (params, "(&s&s^a&s)",
+ &filter,
+ &type,
+ &values);
+
g_debug ("WhatProvides method called: %s, %s", type, values[0]);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_WHAT_PROVIDES)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_WHAT_PROVIDES)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "WhatProvides not yet supported by backend");
+ "WhatProvides not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check the search term */
ret = pk_transaction_search_check (values, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check the filter */
ret = pk_transaction_filter_check (filter, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check provides */
@@ -5336,8 +5289,7 @@ pk_transaction_what_provides (PkTransaction *transaction, const gchar *filter, c
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_INVALID_PROVIDE,
"provide type '%s' not found", type);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -5352,44 +5304,43 @@ pk_transaction_what_provides (PkTransaction *transaction, const gchar *filter, c
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
-
- /* return from async with success */
- pk_transaction_dbus_return (context);
+out:
+ pk_transaction_dbus_return (context, error);
}
/**
* pk_transaction_upgrade_system:
**/
-void
-pk_transaction_upgrade_system (PkTransaction *transaction, const gchar *distro_id, const gchar *upgrade_kind_str, DBusGMethodInvocation *context)
+static void
+pk_transaction_upgrade_system (PkTransaction *transaction,
+ GVariant *params,
+ GDBusMethodInvocation *context)
{
gboolean ret;
GError *error = NULL;
PkUpgradeKindEnum upgrade_kind;
+ const gchar *distro_id;
+ const gchar *upgrade_kind_str;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
- g_debug ("UpgradeSystem method called: %s (%s)", distro_id, upgrade_kind_str);
+ g_variant_get (params, "(&s*s)",
+ &distro_id,
+ &upgrade_kind_str);
+
+ g_debug ("UpgradeSystem method called: %s (%s)",
+ distro_id, upgrade_kind_str);
/* not implemented yet */
- if (!pk_backend_is_implemented (transaction->priv->backend, PK_ROLE_ENUM_UPGRADE_SYSTEM)) {
+ if (!pk_backend_is_implemented (transaction->priv->backend,
+ PK_ROLE_ENUM_UPGRADE_SYSTEM)) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "UpgradeSystem not yet supported by backend");
+ "UpgradeSystem not supported by backend");
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
- }
-
- /* check if the sender is the same */
- ret = pk_transaction_verify_sender (transaction, context, &error);
- if (!ret) {
- /* don't release tid */
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* check upgrade kind */
@@ -5398,8 +5349,7 @@ pk_transaction_upgrade_system (PkTransaction *transaction, const gchar *distro_i
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_INVALID_PROVIDE,
"upgrade kind '%s' not found", upgrade_kind_str);
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
/* save so we can run later */
@@ -5408,15 +5358,329 @@ pk_transaction_upgrade_system (PkTransaction *transaction, const gchar *distro_i
pk_transaction_set_role (transaction, PK_ROLE_ENUM_UPGRADE_SYSTEM);
/* try to get authorization */
- ret = pk_transaction_obtain_authorization (transaction, FALSE, PK_ROLE_ENUM_UPGRADE_SYSTEM, &error);
+ ret = pk_transaction_obtain_authorization (transaction,
+ FALSE,
+ PK_ROLE_ENUM_UPGRADE_SYSTEM, &error);
if (!ret) {
pk_transaction_release_tid (transaction);
- pk_transaction_dbus_return_error (context, error);
- return;
+ goto out;
}
+out:
+ pk_transaction_dbus_return (context, error);
+}
- /* return from async with success */
- pk_transaction_dbus_return (context);
+/**
+ * _g_variant_new_maybe_string:
+ **/
+static GVariant *
+_g_variant_new_maybe_string (const gchar *value)
+{
+ if (value == NULL)
+ return g_variant_new_string ("");
+ return g_variant_new_string (value);
+}
+
+/**
+ * pk_transaction_get_property:
+ **/
+static GVariant *
+pk_transaction_get_property (GDBusConnection *connection_, const gchar *sender,
+ const gchar *object_path, const gchar *interface_name,
+ const gchar *property_name, GError **error,
+ gpointer user_data)
+{
+ GVariant *retval = NULL;
+ PkTransaction *transaction = PK_TRANSACTION (user_data);
+ PkTransactionPrivate *priv = transaction->priv;
+
+ if (g_strcmp0 (property_name, "Role") == 0) {
+ retval = g_variant_new_string (pk_role_enum_to_string (priv->role));
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "Status") == 0) {
+ retval = g_variant_new_string (pk_status_enum_to_string (priv->status));
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "LastPackage") == 0) {
+ retval = _g_variant_new_maybe_string (priv->last_package_id);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "Uid") == 0) {
+ retval = g_variant_new_uint32 (priv->uid);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "Percentage") == 0) {
+ retval = g_variant_new_uint32 (transaction->priv->percentage);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "Subpercentage") == 0) {
+ retval = g_variant_new_uint32 (priv->subpercentage);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "AllowCancel") == 0) {
+ retval = g_variant_new_boolean (priv->allow_cancel);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "CallerActive") == 0) {
+ retval = g_variant_new_boolean (priv->caller_active);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "ElapsedTime") == 0) {
+ retval = g_variant_new_uint32 (priv->elapsed_time);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "RemainingTime") == 0) {
+ retval = g_variant_new_uint32 (priv->remaining_time);
+ goto out;
+ }
+ if (g_strcmp0 (property_name, "Speed") == 0) {
+ retval = g_variant_new_uint32 (priv->speed);
+ goto out;
+ }
+out:
+ return retval;
+}
+
+/**
+ * pk_transaction_method_call:
+ **/
+static void
+pk_transaction_method_call (GDBusConnection *connection_, const gchar *sender,
+ const gchar *object_path, const gchar *interface_name,
+ const gchar *method_name, GVariant *parameters,
+ GDBusMethodInvocation *invocation, gpointer user_data)
+{
+ PkTransaction *transaction = PK_TRANSACTION (user_data);
+ gboolean ret = TRUE;
+
+ g_return_if_fail (transaction->priv->sender != NULL);
+
+ /* check is the same as the sender that did GetTid */
+ ret = (g_strcmp0 (transaction->priv->sender, sender) == 0);
+ if (!ret) {
+ g_dbus_method_invocation_return_error (invocation,
+ PK_TRANSACTION_ERROR,
+ PK_TRANSACTION_ERROR_REFUSED_BY_POLICY,
+ "sender does not match (%s vs %s)",
+ sender,
+ transaction->priv->sender);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "SetHints") == 0) {
+ pk_transaction_set_hints (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "AcceptEula") == 0) {
+ pk_transaction_accept_eula (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "Cancel") == 0) {
+ pk_transaction_cancel (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "DownloadPackages") == 0) {
+ pk_transaction_download_packages (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "GetCategories") == 0) {
+ pk_transaction_get_categories (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "GetDepends") == 0) {
+ pk_transaction_get_depends (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "GetDetails") == 0) {
+ pk_transaction_get_details (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "GetFiles") == 0) {
+ pk_transaction_get_files (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "GetOldTransactions") == 0) {
+ pk_transaction_get_old_transactions (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "GetPackages") == 0) {
+ pk_transaction_get_packages (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "GetRepoList") == 0) {
+ pk_transaction_get_repo_list (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "GetRequires") == 0) {
+ pk_transaction_get_requires (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "GetUpdateDetail") == 0) {
+ pk_transaction_get_update_detail (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "GetUpdates") == 0) {
+ pk_transaction_get_updates (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "GetDistroUpgrades") == 0) {
+ pk_transaction_get_distro_upgrades (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "InstallFiles") == 0) {
+ pk_transaction_install_files (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "InstallPackages") == 0) {
+ pk_transaction_install_packages (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "InstallSignature") == 0) {
+ pk_transaction_install_signature (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "RefreshCache") == 0) {
+ pk_transaction_refresh_cache (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "RemovePackages") == 0) {
+ pk_transaction_remove_packages (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "RepoEnable") == 0) {
+ pk_transaction_repo_enable (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "RepoSetData") == 0) {
+ pk_transaction_repo_set_data (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "Resolve") == 0) {
+ pk_transaction_resolve (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "Rollback") == 0) {
+ pk_transaction_rollback (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "SearchDetails") == 0) {
+ pk_transaction_search_details (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "SearchFiles") == 0) {
+ pk_transaction_search_files (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "SearchGroups") == 0) {
+ pk_transaction_search_groups (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "SearchNames") == 0) {
+ pk_transaction_search_names (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "SimulateInstallFiles") == 0) {
+ pk_transaction_simulate_install_files (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "SimulateInstallPackages") == 0) {
+ pk_transaction_simulate_install_packages (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "SimulateRemovePackages") == 0) {
+ pk_transaction_simulate_remove_packages (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "SimulateUpdatePackages") == 0) {
+ pk_transaction_simulate_update_packages (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "UpdatePackages") == 0) {
+ pk_transaction_update_packages (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "UpdateSystem") == 0) {
+ pk_transaction_update_system (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "WhatProvides") == 0) {
+ pk_transaction_what_provides (transaction, parameters, invocation);
+ goto out;
+ }
+
+ if (g_strcmp0 (method_name, "UpgradeSystem") == 0) {
+ pk_transaction_upgrade_system (transaction, parameters, invocation);
+ goto out;
+ }
+out:
+ return;
+}
+
+/**
+ * pk_transaction_set_tid:
+ */
+gboolean
+pk_transaction_set_tid (PkTransaction *transaction, const gchar *tid)
+{
+ static const GDBusInterfaceVTable interface_vtable = {
+ pk_transaction_method_call,
+ pk_transaction_get_property,
+ NULL
+ };
+
+ g_return_val_if_fail (PK_IS_TRANSACTION (transaction), FALSE);
+ g_return_val_if_fail (tid != NULL, FALSE);
+ g_return_val_if_fail (transaction->priv->tid == NULL, FALSE);
+
+ transaction->priv->tid = g_strdup (tid);
+
+ /* register org.freedesktop.PackageKit.Transaction */
+ transaction->priv->connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
+ g_assert (transaction->priv->connection != NULL);
+ transaction->priv->registration_id =
+ g_dbus_connection_register_object (transaction->priv->connection,
+ tid,
+ transaction->priv->introspection->interfaces[0],
+ &interface_vtable,
+ transaction, /* user_data */
+ NULL, /* user_data_free_func */
+ NULL); /* GError** */
+ g_assert (transaction->priv->registration_id > 0);
+ return TRUE;
}
/**
@@ -5457,256 +5721,19 @@ pk_transaction_setup_mime_types (PkTransaction *transaction)
}
/**
- * pk_transaction_get_property:
- **/
-static void
-pk_transaction_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- PkTransaction *transaction;
-
- transaction = PK_TRANSACTION (object);
-
- switch (prop_id) {
- case PROP_ROLE:
- g_value_set_string (value, pk_role_enum_to_string (transaction->priv->role));
- break;
- case PROP_STATUS:
- g_value_set_string (value, pk_status_enum_to_string (transaction->priv->status));
- break;
- case PROP_LAST_PACKAGE:
- g_value_set_string (value, transaction->priv->last_package_id);
- break;
- case PROP_UID:
- g_value_set_uint (value, transaction->priv->uid);
- break;
- case PROP_PERCENTAGE:
- g_value_set_uint (value, transaction->priv->percentage);
- break;
- case PROP_SUBPERCENTAGE:
- g_value_set_uint (value, transaction->priv->subpercentage);
- break;
- case PROP_ALLOW_CANCEL:
- g_value_set_boolean (value, transaction->priv->allow_cancel);
- break;
- case PROP_CALLER_ACTIVE:
- g_value_set_boolean (value, transaction->priv->caller_active);
- break;
- case PROP_ELAPSED_TIME:
- g_value_set_uint (value, transaction->priv->elapsed_time);
- break;
- case PROP_REMAINING_TIME:
- g_value_set_uint (value, transaction->priv->remaining_time);
- break;
- case PROP_SPEED:
- g_value_set_uint (value, transaction->priv->speed);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/**
* pk_transaction_class_init:
* @klass: The PkTransactionClass
**/
static void
pk_transaction_class_init (PkTransactionClass *klass)
{
- GParamSpec *spec;
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = pk_transaction_dispose;
object_class->finalize = pk_transaction_finalize;
- object_class->get_property = pk_transaction_get_property;
-
- /**
- * PkTransaction:role:
- */
- spec = g_param_spec_string ("role",
- "Role", "The transaction role",
- NULL,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_ROLE, spec);
-
- /**
- * PkTransaction:status:
- */
- spec = g_param_spec_string ("status",
- "Status", "The transaction status",
- NULL,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_STATUS, spec);
-
- /**
- * PkTransaction:last-package:
- */
- spec = g_param_spec_string ("last-package",
- "Last package", "The transaction last package processed",
- NULL,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_LAST_PACKAGE, spec);
-
- /**
- * PkTransaction:uid:
- */
- spec = g_param_spec_uint ("uid",
- "UID", "User ID that created the transaction",
- 0, G_MAXUINT, 0,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_UID, spec);
-
- /**
- * PkTransaction:percentage:
- */
- spec = g_param_spec_uint ("percentage",
- "Percentage", "Percentage transaction complete",
- 0, PK_BACKEND_PERCENTAGE_INVALID, 0,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_PERCENTAGE, spec);
-
- /**
- * PkTransaction:subpercentage:
- */
- spec = g_param_spec_uint ("subpercentage",
- "Sub-percentage", "Percentage sub-transaction complete",
- 0, PK_BACKEND_PERCENTAGE_INVALID, 0,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_SUBPERCENTAGE, spec);
-
- /**
- * PkTransaction:allow-cancel:
- */
- spec = g_param_spec_boolean ("allow-cancel",
- "Allow cancel", "If the transaction can be cancelled",
- FALSE,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_ALLOW_CANCEL, spec);
-
- /**
- * PkTransaction:caller-active:
- */
- spec = g_param_spec_boolean ("caller-active",
- "Caller Active", "If the transaction caller is still active",
- TRUE,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_CALLER_ACTIVE, spec);
-
- /**
- * PkTransaction:elapsed-time:
- */
- spec = g_param_spec_uint ("elapsed-time",
- "Elapsed Time", "The amount of time elapsed during the transaction",
- 0, G_MAXUINT, 0,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_ELAPSED_TIME, spec);
-
- /**
- * PkTransaction:remaining-time:
- */
- spec = g_param_spec_uint ("remaining-time",
- "Remaining Time", "The estimated remaining time of the transaction",
- 0, G_MAXUINT, 0,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_REMAINING_TIME, spec);
-
- /**
- * PkTransaction:speed:
- */
- spec = g_param_spec_uint ("speed",
- "Speed", "The estimated speed of the transaction",
- 0, G_MAXUINT, 0,
- G_PARAM_READABLE);
- g_object_class_install_property (object_class, PROP_SPEED, spec);
-
- signals[SIGNAL_DETAILS] =
- g_signal_new ("details",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_UINT64,
- G_TYPE_NONE, 6, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64);
- signals[SIGNAL_ERROR_CODE] =
- g_signal_new ("error-code",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING,
- G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
- signals[SIGNAL_FILES] =
- g_signal_new ("files",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING,
- G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
- signals[SIGNAL_CATEGORY] =
- g_signal_new ("category",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING,
- G_TYPE_NONE, 5, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
- signals[SIGNAL_DISTRO_UPGRADE] =
- g_signal_new ("distro-upgrade",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING,
- G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+
signals[SIGNAL_FINISHED] =
g_signal_new ("finished",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_UINT,
- G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_UINT);
- signals[SIGNAL_MESSAGE] =
- g_signal_new ("message",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING,
- G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
- signals[SIGNAL_PACKAGE] =
- g_signal_new ("package",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING,
- G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
- signals[SIGNAL_REPO_DETAIL] =
- g_signal_new ("repo-detail",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_BOOL,
- G_TYPE_NONE, 3, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_BOOLEAN);
- signals[SIGNAL_REPO_SIGNATURE_REQUIRED] =
- g_signal_new ("repo-signature-required",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 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[SIGNAL_EULA_REQUIRED] =
- g_signal_new ("eula-required",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_STRING,
- G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
- signals[SIGNAL_MEDIA_CHANGE_REQUIRED] =
- g_signal_new ("media-change-required",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING,
- G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
- signals[SIGNAL_REQUIRE_RESTART] =
- g_signal_new ("require-restart",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING,
- G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
- signals[SIGNAL_TRANSACTION] =
- g_signal_new ("transaction",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_BOOL_STRING_UINT_STRING_UINT_STRING,
- G_TYPE_NONE, 8, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_UINT,
- G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING);
- signals[SIGNAL_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_STRING_STRING_STRING_STRING_STRING,
- G_TYPE_NONE, 12, 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, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
- signals[SIGNAL_DESTROY] =
- g_signal_new ("destroy",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
- signals[SIGNAL_CHANGED] =
- g_signal_new ("changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
@@ -5720,39 +5747,12 @@ pk_transaction_class_init (PkTransactionClass *klass)
static void
pk_transaction_init (PkTransaction *transaction)
{
-#if defined(USE_SECURITY_POLKIT_NEW) && defined(HAVE_POLKIT_AUTHORITY_GET_SYNC)
GError *error = NULL;
-#endif
transaction->priv = PK_TRANSACTION_GET_PRIVATE (transaction);
- transaction->priv->finished = FALSE;
- transaction->priv->waiting_for_auth = FALSE;
transaction->priv->allow_cancel = TRUE;
- transaction->priv->emit_eula_required = FALSE;
- transaction->priv->emit_signature_required = FALSE;
- transaction->priv->emit_media_change_required = FALSE;
transaction->priv->caller_active = TRUE;
- transaction->priv->cached_enabled = FALSE;
transaction->priv->cached_only_trusted = TRUE;
- transaction->priv->cached_key_id = NULL;
- transaction->priv->cached_package_id = NULL;
- transaction->priv->cached_package_ids = NULL;
- transaction->priv->cached_transaction_id = NULL;
- transaction->priv->cached_full_paths = NULL;
transaction->priv->cached_filters = PK_FILTER_ENUM_NONE;
- transaction->priv->cached_values = NULL;
- transaction->priv->cached_repo_id = NULL;
- transaction->priv->cached_parameter = NULL;
- transaction->priv->cached_value = NULL;
- transaction->priv->last_package_id = NULL;
- transaction->priv->tid = NULL;
- transaction->priv->sender = NULL;
- transaction->priv->locale = NULL;
- transaction->priv->frontend_socket = NULL;
- transaction->priv->cache_age = 0;
-#ifdef USE_SECURITY_POLKIT
- transaction->priv->subject = NULL;
-#endif
- transaction->priv->cmdline = NULL;
transaction->priv->uid = PK_TRANSACTION_UID_INVALID;
transaction->priv->role = PK_ROLE_ENUM_UNKNOWN;
transaction->priv->status = PK_STATUS_ENUM_WAIT;
@@ -5760,9 +5760,6 @@ pk_transaction_init (PkTransaction *transaction)
transaction->priv->subpercentage = PK_BACKEND_PERCENTAGE_INVALID;
transaction->priv->background = PK_HINT_ENUM_UNSET;
transaction->priv->state = PK_TRANSACTION_STATE_UNKNOWN;
- transaction->priv->elapsed_time = 0;
- transaction->priv->remaining_time = 0;
- transaction->priv->speed = 0;
transaction->priv->backend = pk_backend_new ();
transaction->priv->cache = pk_cache_new ();
transaction->priv->conf = pk_conf_new ();
@@ -5789,6 +5786,16 @@ pk_transaction_init (PkTransaction *transaction)
g_signal_connect (transaction->priv->transaction_db, "transaction",
G_CALLBACK (pk_transaction_transaction_cb), transaction);
+ /* load introspection from file */
+ transaction->priv->introspection = pk_load_introspection (DATADIR "/dbus-1/interfaces/"
+ PK_DBUS_INTERFACE_TRANSACTION ".xml",
+ &error);
+ if (transaction->priv->introspection == NULL) {
+ g_error ("PkEngine: failed to load transaction introspection: %s",
+ error->message);
+ g_error_free (error);
+ }
+
/* setup supported mime types */
pk_transaction_setup_mime_types (transaction);
}
@@ -5815,9 +5822,21 @@ pk_transaction_dispose (GObject *object)
pk_transaction_finished_emit (transaction, PK_EXIT_ENUM_FAILED, 0);
}
+ if (transaction->priv->registration_id > 0) {
+ g_dbus_connection_unregister_object (transaction->priv->connection,
+ transaction->priv->registration_id);
+ transaction->priv->registration_id = 0;
+ }
+
/* send signal to clients that we are about to be destroyed */
g_debug ("emitting destroy %s", transaction->priv->tid);
- g_signal_emit (transaction, signals[SIGNAL_DESTROY], 0);
+ g_dbus_connection_emit_signal (transaction->priv->connection,
+ NULL,
+ transaction->priv->tid,
+ PK_DBUS_INTERFACE_TRANSACTION,
+ "Destroy",
+ NULL,
+ NULL);
G_OBJECT_CLASS (pk_transaction_parent_class)->dispose (object);
}
@@ -5856,6 +5875,11 @@ pk_transaction_finalize (GObject *object)
g_free (transaction->priv->sender);
g_free (transaction->priv->cmdline);
+ if (transaction->priv->connection != NULL)
+ g_object_unref (transaction->priv->connection);
+ if (transaction->priv->introspection != NULL)
+ g_dbus_node_info_unref (transaction->priv->introspection);
+
g_object_unref (transaction->priv->conf);
g_object_unref (transaction->priv->dbus);
g_object_unref (transaction->priv->cache);
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index ddff2fa..f1bc55f 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -23,7 +23,6 @@
#define __PK_TRANSACTION_H
#include <glib-object.h>
-#include <dbus/dbus-glib.h>
#include <packagekit-glib2/pk-enum.h>
#include <packagekit-glib2/pk-results.h>
@@ -76,6 +75,7 @@ gboolean pk_transaction_run (PkTransaction *transaction)
/* internal status */
void pk_transaction_cancel_bg (PkTransaction *transaction);
PkRoleEnum pk_transaction_get_role (PkTransaction *transaction);
+guint pk_transaction_get_uid (PkTransaction *transaction);
PkConf *pk_transaction_get_conf (PkTransaction *transaction);
PkResults *pk_transaction_get_results (PkTransaction *transaction);
gchar **pk_transaction_get_package_ids (PkTransaction *transaction);
@@ -95,6 +95,15 @@ void pk_transaction_add_supported_content_type (PkTransaction *transaction,
void pk_transaction_set_plugins (PkTransaction *transaction,
GPtrArray *plugins);
+gboolean pk_transaction_set_sender (PkTransaction *transaction,
+ const gchar *sender);
+gboolean pk_transaction_filter_check (const gchar *filter,
+ GError **error);
+gboolean pk_transaction_strvalidate (const gchar *textr,
+ GError **error);
+gboolean pk_transaction_set_tid (PkTransaction *transaction,
+ const gchar *tid);
+
G_END_DECLS
#endif /* __PK_TRANSACTION_H */
commit 8e6785a110a36c5a62c77749848fcaf13b0ebfa6
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Jul 20 10:04:45 2011 +0100
Remove the HAL integration code
diff --git a/src/Makefile.am b/src/Makefile.am
index a1f2553..5d57a82 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -88,8 +88,6 @@ shared_SOURCES = \
pk-sysdep.c \
pk-engine.h \
pk-engine.c \
- pk-inhibit.h \
- pk-inhibit.c \
pk-backend-spawn.h \
pk-backend-spawn.c \
pk-transaction-db.h \
diff --git a/src/pk-backend-spawn.c b/src/pk-backend-spawn.c
index ff2e1c6..a2bef07 100644
--- a/src/pk-backend-spawn.c
+++ b/src/pk-backend-spawn.c
@@ -48,7 +48,6 @@
#include "pk-spawn.h"
#include "pk-shared.h"
#include "pk-time.h"
-#include "pk-inhibit.h"
#include "pk-conf.h"
#define PK_BACKEND_SPAWN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_BACKEND_SPAWN, PkBackendSpawnPrivate))
diff --git a/src/pk-engine.c b/src/pk-engine.c
index adc1d52..bbbc1b7 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -49,7 +49,6 @@
#include "pk-conf.h"
#include "pk-dbus.h"
#include "pk-engine.h"
-#include "pk-inhibit.h"
#include "pk-marshal.h"
#include "pk-network.h"
#include "pk-notify.h"
@@ -74,7 +73,6 @@ struct PkEnginePrivate
PkTransactionDb *transaction_db;
PkCache *cache;
PkBackend *backend;
- PkInhibit *inhibit;
PkNetwork *network;
PkNotify *notify;
PkConf *conf;
@@ -204,6 +202,7 @@ pk_engine_transaction_list_changed_cb (PkTransactionList *tlist, PkEngine *engin
g_strfreev (transaction_list);
}
+#if 0
/**
* pk_engine_inhibit_locked_cb:
**/
@@ -222,6 +221,7 @@ pk_engine_inhibit_locked_cb (PkInhibit *inhibit, gboolean is_locked, PkEngine *e
g_debug ("emitting changed");
g_signal_emit (engine, signals[SIGNAL_CHANGED], 0);
}
+#endif
/**
* pk_engine_notify_repo_list_changed_cb:
@@ -1812,11 +1812,6 @@ pk_engine_init (PkEngine *engine)
pk_transaction_list_set_plugins (engine->priv->transaction_list,
engine->priv->plugins);
-
- engine->priv->inhibit = pk_inhibit_new ();
- g_signal_connect (engine->priv->inhibit, "locked",
- G_CALLBACK (pk_engine_inhibit_locked_cb), engine);
-
/* we use a trasaction db to store old transactions and to do rollbacks */
engine->priv->transaction_db = pk_transaction_db_new ();
@@ -1865,7 +1860,6 @@ pk_engine_finalize (GObject *object)
g_timer_destroy (engine->priv->timer);
g_object_unref (engine->priv->monitor_conf);
g_object_unref (engine->priv->monitor_binary);
- g_object_unref (engine->priv->inhibit);
g_object_unref (engine->priv->transaction_list);
g_object_unref (engine->priv->transaction_db);
g_object_unref (engine->priv->network);
diff --git a/src/pk-inhibit.c b/src/pk-inhibit.c
deleted file mode 100644
index 861a1c4..0000000
--- a/src/pk-inhibit.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-
-#include <glib/gi18n.h>
-#include <glib.h>
-#include <dbus/dbus-glib.h>
-
-#include "pk-inhibit.h"
-
-#define PK_INHIBIT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_INHIBIT, PkInhibitPrivate))
-#define HAL_DBUS_SERVICE "org.freedesktop.Hal"
-#define HAL_DBUS_PATH_COMPUTER "/org/freedesktop/Hal/devices/computer"
-#define HAL_DBUS_INTERFACE_DEVICE "org.freedesktop.Hal.Device"
-#define HAL_DBUS_INTERFACE_PM "org.freedesktop.Hal.Device.SystemPowerManagement"
-
-struct PkInhibitPrivate
-{
- GPtrArray *array;
- gboolean is_locked;
- DBusGProxy *proxy;
-};
-
-enum {
- PK_INHIBIT_LOCKED,
- PK_INHIBIT_LAST_SIGNAL
-};
-
-static gpointer pk_inhibit_object = NULL;
-static guint signals [PK_INHIBIT_LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE (PkInhibit, pk_inhibit, G_TYPE_OBJECT)
-
-/**
- * pk_inhibit_locked:
- **/
-gboolean
-pk_inhibit_locked (PkInhibit *inhibit)
-{
- g_return_val_if_fail (PK_IS_INHIBIT (inhibit), FALSE);
- return inhibit->priv->is_locked;
-}
-
-/**
- * pk_inhibit_lock:
- **/
-G_GNUC_WARN_UNUSED_RESULT static gboolean
-pk_inhibit_lock (PkInhibit *inhibit)
-{
- GError *error = NULL;
- gboolean ret = TRUE;
-
- g_return_val_if_fail (PK_IS_INHIBIT (inhibit), FALSE);
-
- if (inhibit->priv->proxy == NULL) {
- g_debug ("not connected to HAL");
- goto skip_hal;
- }
- if (inhibit->priv->is_locked) {
- g_debug ("already inhibited, not trying again");
- return FALSE;
- }
-
- /* Lock the interface */
- ret = dbus_g_proxy_call (inhibit->priv->proxy, "AcquireInterfaceLock", &error,
- G_TYPE_STRING, HAL_DBUS_INTERFACE_PM,
- G_TYPE_BOOLEAN, FALSE,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
- if (error != NULL) {
- printf ("DEBUG: ERROR: %s\n", error->message);
- g_error_free (error);
- }
-skip_hal:
- if (ret) {
- inhibit->priv->is_locked = TRUE;
- g_debug ("emit lock %i", inhibit->priv->is_locked);
- g_signal_emit (inhibit, signals [PK_INHIBIT_LOCKED], 0, inhibit->priv->is_locked);
- }
-
- return ret;
-}
-
-/**
- * pk_inhibit_unlock:
- **/
-G_GNUC_WARN_UNUSED_RESULT static gboolean
-pk_inhibit_unlock (PkInhibit *inhibit)
-{
- GError *error = NULL;
- gboolean ret = TRUE;
-
- g_return_val_if_fail (PK_IS_INHIBIT (inhibit), FALSE);
-
- if (inhibit->priv->proxy == NULL) {
- g_debug ("not connected to HAL");
- goto skip_hal;
- }
- if (inhibit->priv->is_locked == FALSE) {
- g_debug ("not inhibited, not trying to unlock");
- return FALSE;
- }
-
- /* Lock the interface */
- ret = dbus_g_proxy_call (inhibit->priv->proxy, "ReleaseInterfaceLock", &error,
- G_TYPE_STRING, HAL_DBUS_INTERFACE_PM,
- G_TYPE_BOOLEAN, FALSE,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
- if (error != NULL) {
- printf ("DEBUG: ERROR: %s\n", error->message);
- g_error_free (error);
- }
-skip_hal:
- if (ret) {
- inhibit->priv->is_locked = FALSE;
- g_debug ("emit lock %i", inhibit->priv->is_locked);
- g_signal_emit (inhibit, signals [PK_INHIBIT_LOCKED], 0, inhibit->priv->is_locked);
- }
-
- return ret;
-}
-
-/**
- * pk_inhibit_add:
- **/
-gboolean
-pk_inhibit_add (PkInhibit *inhibit, gpointer data)
-{
- guint i;
- gboolean ret = TRUE;
-
- g_return_val_if_fail (PK_IS_INHIBIT (inhibit), FALSE);
-
- for (i=0; i<inhibit->priv->array->len; i++) {
- if (g_ptr_array_index (inhibit->priv->array, i) == data) {
- g_debug ("trying to add item %p already in array", data);
- return FALSE;
- }
- }
- g_ptr_array_add (inhibit->priv->array, data);
- /* do inhibit */
- if (inhibit->priv->array->len == 1)
- ret = pk_inhibit_lock (inhibit);
- return ret;
-}
-
-/**
- * pk_inhibit_remove:
- **/
-gboolean
-pk_inhibit_remove (PkInhibit *inhibit, gpointer data)
-{
- guint i;
- gboolean ret = TRUE;
-
- g_return_val_if_fail (PK_IS_INHIBIT (inhibit), FALSE);
-
- for (i=0; i<inhibit->priv->array->len; i++) {
- if (g_ptr_array_index (inhibit->priv->array, i) == data) {
- g_ptr_array_remove_index (inhibit->priv->array, i);
- if (inhibit->priv->array->len == 0)
- ret = pk_inhibit_unlock (inhibit);
- return ret;
- }
- }
- g_debug ("cannot find item %p", data);
- return FALSE;
-}
-
-/**
- * pk_inhibit_finalize:
- **/
-static void
-pk_inhibit_finalize (GObject *object)
-{
- PkInhibit *inhibit;
- gboolean ret;
-
- g_return_if_fail (PK_IS_INHIBIT (object));
- inhibit = PK_INHIBIT (object);
-
- /* force an unlock if we are inhibited */
- if (inhibit->priv->is_locked) {
- ret = pk_inhibit_unlock (inhibit);
- if (!ret)
- g_warning ("failed to unock on finalise!");
- }
- /* no need to free the data in the array */
- g_ptr_array_free (inhibit->priv->array, TRUE);
- if (inhibit->priv->proxy != NULL)
- g_object_unref (inhibit->priv->proxy);
-
- G_OBJECT_CLASS (pk_inhibit_parent_class)->finalize (object);
-}
-
-/**
- * pk_inhibit_class_init:
- **/
-static void
-pk_inhibit_class_init (PkInhibitClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = pk_inhibit_finalize;
- signals [PK_INHIBIT_LOCKED] =
- g_signal_new ("locked", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
- G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
- g_type_class_add_private (klass, sizeof (PkInhibitPrivate));
-}
-
-/**
- * pk_inhibit_init:
- *
- * initializes the inhibit class. NOTE: We expect inhibit objects
- * to *NOT* be removed or added during the session.
- * We only control the first inhibit object if there are more than one.
- **/
-static void
-pk_inhibit_init (PkInhibit *inhibit)
-{
- GError *error = NULL;
- DBusGConnection *connection;
-
- inhibit->priv = PK_INHIBIT_GET_PRIVATE (inhibit);
- inhibit->priv->is_locked = FALSE;
- inhibit->priv->array = g_ptr_array_new ();
-
- /* connect to system bus */
- connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
- if (error != NULL) {
- g_warning ("Cannot connect to system bus: %s", error->message);
- g_error_free (error);
- return;
- }
-
- /* use gnome-power-manager for the battery detection */
- inhibit->priv->proxy = dbus_g_proxy_new_for_name_owner (connection,
- HAL_DBUS_SERVICE, HAL_DBUS_PATH_COMPUTER,
- HAL_DBUS_INTERFACE_DEVICE, &error);
- if (error != NULL) {
- g_debug ("Cannot connect to HAL: %s", error->message);
- g_error_free (error);
- }
-
-}
-
-/**
- * pk_inhibit_new:
- * Return value: A new inhibit class instance.
- **/
-PkInhibit *
-pk_inhibit_new (void)
-{
- if (pk_inhibit_object != NULL) {
- g_object_ref (pk_inhibit_object);
- } else {
- pk_inhibit_object = g_object_new (PK_TYPE_INHIBIT, NULL);
- g_object_add_weak_pointer (pk_inhibit_object, &pk_inhibit_object);
- }
- return PK_INHIBIT (pk_inhibit_object);
-}
-
diff --git a/src/pk-inhibit.h b/src/pk-inhibit.h
deleted file mode 100644
index 45f0b5c..0000000
--- a/src/pk-inhibit.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PK_INHIBIT_H
-#define __PK_INHIBIT_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define PK_TYPE_INHIBIT (pk_inhibit_get_type ())
-#define PK_INHIBIT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_INHIBIT, PkInhibit))
-#define PK_INHIBIT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_INHIBIT, PkInhibitClass))
-#define PK_IS_INHIBIT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_INHIBIT))
-#define PK_IS_INHIBIT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_INHIBIT))
-#define PK_INHIBIT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_INHIBIT, PkInhibitClass))
-
-typedef struct PkInhibitPrivate PkInhibitPrivate;
-
-typedef struct
-{
- GObject parent;
- PkInhibitPrivate *priv;
-} PkInhibit;
-
-typedef struct
-{
- GObjectClass parent_class;
-} PkInhibitClass;
-
-GType pk_inhibit_get_type (void);
-PkInhibit *pk_inhibit_new (void);
-
-gboolean pk_inhibit_locked (PkInhibit *inhibit)
- G_GNUC_WARN_UNUSED_RESULT;
-gboolean pk_inhibit_add (PkInhibit *inhibit,
- gpointer data);
-gboolean pk_inhibit_remove (PkInhibit *inhibit,
- gpointer data);
-
-G_END_DECLS
-
-#endif /* __PK_INHIBIT_H */
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index da4c850..58f5dfc 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -56,7 +56,6 @@
#include "pk-cache.h"
#include "pk-conf.h"
#include "pk-dbus.h"
-#include "pk-inhibit.h"
#include "pk-marshal.h"
#include "pk-notify.h"
#include "pk-plugin.h"
@@ -104,7 +103,6 @@ struct PkTransactionPrivate
guint uid;
guint watch_id;
PkBackend *backend;
- PkInhibit *inhibit;
PkCache *cache;
PkConf *conf;
PkNotify *notify;
@@ -402,11 +400,7 @@ pk_transaction_allow_cancel_emit (PkTransaction *transaction, gboolean allow_can
transaction->priv->allow_cancel = allow_cancel;
- /* remove or add the hal inhibit */
- if (allow_cancel)
- pk_inhibit_remove (transaction->priv->inhibit, transaction);
- else
- pk_inhibit_add (transaction->priv->inhibit, transaction);
+ /* TODO: have master property on main interface */
/* emit */
g_debug ("emitting changed");
@@ -1068,7 +1062,7 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
pk_transaction_db_set_finished (transaction->priv->transaction_db, transaction->priv->tid, FALSE, time_ms);
/* remove any inhibit */
- pk_inhibit_remove (transaction->priv->inhibit, transaction);
+ //TODO: on main interface
/* report to syslog */
if (transaction->priv->uid != PK_TRANSACTION_UID_INVALID)
@@ -5773,7 +5767,6 @@ pk_transaction_init (PkTransaction *transaction)
transaction->priv->cache = pk_cache_new ();
transaction->priv->conf = pk_conf_new ();
transaction->priv->notify = pk_notify_new ();
- transaction->priv->inhibit = pk_inhibit_new ();
transaction->priv->transaction_list = pk_transaction_list_new ();
transaction->priv->syslog = pk_syslog_new ();
transaction->priv->dbus = pk_dbus_new ();
@@ -5812,9 +5805,6 @@ pk_transaction_dispose (GObject *object)
transaction = PK_TRANSACTION (object);
- /* remove any inhibit, it's okay to call this function when it's not needed */
- pk_inhibit_remove (transaction->priv->inhibit, transaction);
-
/* were we waiting for the client to authorise */
if (transaction->priv->waiting_for_auth) {
#ifdef USE_SECURITY_POLKIT
@@ -5869,7 +5859,6 @@ pk_transaction_finalize (GObject *object)
g_object_unref (transaction->priv->conf);
g_object_unref (transaction->priv->dbus);
g_object_unref (transaction->priv->cache);
- g_object_unref (transaction->priv->inhibit);
g_object_unref (transaction->priv->backend);
g_object_unref (transaction->priv->transaction_list);
g_object_unref (transaction->priv->transaction_db);
commit 1cd36ae7f895c17c837c17ef4847d88af78624d3
Author: Adam Jackson <ajax at redhat.com>
Date: Tue Jul 19 13:41:30 2011 -0400
pk-command-not-found: An ellipsis has three dots, not two
Signed-off-by: Adam Jackson <ajax at redhat.com>
Signed-off-by: Richard Hughes <richard at hughsie.com>
diff --git a/contrib/command-not-found/pk-command-not-found.c b/contrib/command-not-found/pk-command-not-found.c
index 1eeb89d..504fe69 100644
--- a/contrib/command-not-found/pk-command-not-found.c
+++ b/contrib/command-not-found/pk-command-not-found.c
@@ -382,7 +382,7 @@ pk_cnf_progress_cb (PkProgress *progress, PkProgressType type, gpointer data)
/* print to screen, still one line */
if (text != NULL)
- g_print ("\n * %s.. ", text);
+ g_print ("\n * %s... ", text);
}
/**
commit d4f68acccef08689e40729f048eed70505fe29db
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 19 18:21:46 2011 +0100
trivial: Fix the libpackagekit-glib self tests now PkPackage:package-id isn't directly writable
diff --git a/lib/packagekit-glib2/pk-self-test.c b/lib/packagekit-glib2/pk-self-test.c
index ece2c3c..f35b6e2 100644
--- a/lib/packagekit-glib2/pk-self-test.c
+++ b/lib/packagekit-glib2/pk-self-test.c
@@ -1599,6 +1599,7 @@ pk_test_results_func (void)
PkInfoEnum info;
gchar *package_id;
gchar *summary;
+ GError *error = NULL;
/* get results */
results = pk_results_new ();
@@ -1625,9 +1626,13 @@ pk_test_results_func (void)
item = pk_package_new ();
g_object_set (item,
"info", PK_INFO_ENUM_AVAILABLE,
- "package-id", "gnome-power-manager;0.1.2;i386;fedora",
"summary", "Power manager for GNOME",
NULL);
+ ret = pk_package_set_id (item,
+ "gnome-power-manager;0.1.2;i386;fedora",
+ &error);
+ g_assert_no_error (error);
+ g_assert (ret);
ret = pk_results_add_package (results, item);
g_object_unref (item);
g_assert (ret);
commit 0232e3f096cc87fab3f556cdfd2d2febbf9d93a2
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 19 18:20:55 2011 +0100
trivial: fix the compile of the self tests
diff --git a/lib/packagekit-glib2/pk-self-test.c b/lib/packagekit-glib2/pk-self-test.c
index f1081c6..ece2c3c 100644
--- a/lib/packagekit-glib2/pk-self-test.c
+++ b/lib/packagekit-glib2/pk-self-test.c
@@ -1275,16 +1275,6 @@ pk_test_enum_func (void)
}
}
- /* check we convert all the license bitfield */
- for (i=0; i<PK_LICENSE_ENUM_LAST; i++) {
- string = pk_license_enum_to_string (i);
- if (string == NULL) {
- /* so we get the value of i in the assert text */
- g_assert_cmpint (0, ==, i);
- break;
- }
- }
-
/* check we convert all the media type bitfield */
for (i=0; i<PK_MEDIA_TYPE_ENUM_LAST; i++) {
string = pk_media_type_enum_to_string (i);
commit 1d2e2a8893d346368bbd10eb18387fd8209f7497
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 19 18:20:04 2011 +0100
dummy: Implement SimulateUpdatePackages and SimulateRemovePackages
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 61cfc83..e2d3057 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -1341,6 +1341,27 @@ pk_backend_download_packages (PkBackend *backend, gchar **package_ids, const gch
}
/**
+ * pk_backend_simulate_remove_packages:
+ */
+void
+pk_backend_simulate_remove_packages (PkBackend *backend,
+ gchar **package_ids,
+ gboolean autoremove)
+{
+ pk_backend_remove_packages (backend, package_ids, TRUE, autoremove);
+}
+
+/**
+ * pk_backend_simulate_update_packages:
+ */
+void
+pk_backend_simulate_update_packages (PkBackend *backend,
+ gchar **package_ids)
+{
+ pk_backend_update_packages (backend, FALSE, package_ids);
+}
+
+/**
* pk_backend_simulate_install_packages:
*/
void
commit 63a67d153192b10117b5e5bfb90a8b5ace466a07
Author: Matthias Klumpp <matthias at nlinux.org>
Date: Tue Jul 19 16:21:41 2011 +0200
aptcc: Implement provides-library
aptcc can now search for packages providing
a shared-library.
This function is very limited, as it relies on
package maintainers creating policy-compliant
library packages.
diff --git a/backends/aptcc/apt.cpp b/backends/aptcc/apt.cpp
index 694b098..03dd9c8 100644
--- a/backends/aptcc/apt.cpp
+++ b/backends/aptcc/apt.cpp
@@ -47,6 +47,7 @@
#include <fstream>
#include <dirent.h>
#include <assert.h>
+#include <regex.h>
aptcc::aptcc(PkBackend *backend, bool &cancel)
:
@@ -421,7 +422,8 @@ void aptcc::emitUpdates(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator
}
}
-void aptcc::povidesCodec(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > &output,
+// search packages which provide a codec (specified in "values")
+void aptcc::providesCodec(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > &output,
gchar **values)
{
GstMatcher *matcher = new GstMatcher(values);
@@ -463,6 +465,77 @@ void aptcc::povidesCodec(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterato
delete matcher;
}
+// search packages which provide the libraries specified in "values"
+void aptcc::providesLibrary(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > &output,
+ gchar **values)
+{
+ bool ret = false;
+ // Quick-check for library names
+ for (uint i = 0; i < g_strv_length(values); i++)
+ if (g_str_has_prefix (values[i], "lib")) {
+ ret = true;
+ break;
+ }
+ if (!ret)
+ return;
+
+ const char *libreg_str = "^\\(lib.*\\)\\.so\\.[0-9]*";
+ g_debug ("RegStr: %s", libreg_str);
+ regex_t libreg;
+ if(regcomp(&libreg, libreg_str, 0) != 0) {
+ g_debug("Regex compilation error: ", libreg);
+ return;
+ }
+
+ gchar *value;
+ for (uint i = 0; i < g_strv_length(values); i++) {
+ value = values[i];
+ regmatch_t matches[2];
+ if (regexec(&libreg, value, 2, matches, 0) != REG_NOMATCH) {
+ string libPkgName = string(value, matches[1].rm_so, matches[1].rm_eo - matches[1].rm_so);
+
+ string strvalue = string(value);
+ ssize_t pos = strvalue.find (".so.");
+ if ((pos != string::npos) && (pos > 0)) {
+ // If last char is a number, add a "-" (to be policy-compliant)
+ if (g_ascii_isdigit (libPkgName.at (libPkgName.length () - 1)))
+ libPkgName.append ("-");
+
+ libPkgName.append (strvalue.substr (pos + 4));
+ }
+
+ g_debug ("pkg-name: %s", libPkgName.c_str ());
+
+ for (pkgCache::PkgIterator pkg = packageCache->PkgBegin(); !pkg.end(); ++pkg) {
+ // Ignore packages that exist only due to dependencies.
+ if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
+ continue;
+ }
+
+ // TODO: Ignore virtual packages
+ pkgCache::VerIterator ver = find_ver (pkg);
+ if (ver.end() == true) {
+ ver = find_candidate_ver(pkg);
+ if (ver.end() == true) {
+ continue;
+ }
+ }
+
+ // Make everything lower-case
+ std::transform(libPkgName.begin(), libPkgName.end(), libPkgName.begin(), ::tolower);
+
+ if (g_strcmp0 (pkg.Name (), libPkgName.c_str ()) == 0) {
+ output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
+ }
+ }
+
+ } else {
+ g_debug("libmatcher: Did not match: %s", value);
+ }
+ }
+
+}
+
// used to emit packages it collects all the needed info
void aptcc::emit_details(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &version)
{
diff --git a/backends/aptcc/apt.h b/backends/aptcc/apt.h
index 02d7f91..3751ae2 100644
--- a/backends/aptcc/apt.h
+++ b/backends/aptcc/apt.h
@@ -123,9 +123,15 @@ public:
bool installPackages(pkgCacheFile &Cache);
/**
- * check if the package provides the codec
+ * check which package provides the codec
*/
- void povidesCodec(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > &output,
+ void providesCodec(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > &output,
+ gchar **values);
+
+ /**
+ * check which package provides a shared library
+ */
+ void providesLibrary(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > &output,
gchar **values);
pkgRecords *packageRecords;
diff --git a/backends/aptcc/gstMatcher.cpp b/backends/aptcc/gstMatcher.cpp
index 9f60581..7e5e1d6 100644
--- a/backends/aptcc/gstMatcher.cpp
+++ b/backends/aptcc/gstMatcher.cpp
@@ -43,7 +43,7 @@ GstMatcher::GstMatcher(gchar **values)
for (uint i = 0; i < g_strv_length(values); i++) {
value = values[i];
regmatch_t matches[5];
- if (regexec(&pkre, value, 5, matches, 0) == 0) {
+ if (regexec(&pkre, value, 5, matches, 0) != REG_NOMATCH) {
Match values;
string version, type, data, opt;
@@ -100,7 +100,7 @@ GstMatcher::GstMatcher(gchar **values)
m_matches.push_back(values);
} else {
- g_debug("Did not match: %s", value);
+ g_debug("gstmatcher: Did not match: %s", value);
}
}
regfree(&pkre);
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 07e3cd1..dc35c6a 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -524,7 +524,9 @@ backend_what_provides_thread (PkBackend *backend)
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- if (provides == PK_PROVIDES_ENUM_MIMETYPE ||
+ // We can handle libraries, mimetypes and codecs
+ if (provides == PK_PROVIDES_ENUM_LIBRARY ||
+ provides == PK_PROVIDES_ENUM_MIMETYPE ||
provides == PK_PROVIDES_ENUM_CODEC ||
provides == PK_PROVIDES_ENUM_ANY) {
aptcc *m_apt = new aptcc(backend, _cancel);
@@ -537,30 +539,32 @@ backend_what_provides_thread (PkBackend *backend)
return false;
}
-
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
vector<string> packages;
vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > output;
- if (provides == PK_PROVIDES_ENUM_MIMETYPE) {
+
+ if (provides == PK_PROVIDES_ENUM_LIBRARY) {
+ m_apt->providesLibrary (output, values);
+ } else if (provides == PK_PROVIDES_ENUM_MIMETYPE) {
packages = searchMimeType (backend, values, error, _cancel);
} else if (provides == PK_PROVIDES_ENUM_CODEC) {
- m_apt->povidesCodec(output, values);
+ m_apt->providesCodec (output, values);
} else {
- // any...
+ // PK_PROVIDES_ENUM_ANY, just search for everything a package can provide
+ m_apt->providesLibrary (output, values);
+ m_apt->providesCodec (output, values);
packages = searchMimeType (backend, values, error, _cancel);
- m_apt->povidesCodec(output, values);
}
- for(vector<string>::iterator i = packages.begin();
- i != packages.end(); ++i)
- {
+ for (vector<string>::iterator i = packages.begin();
+ i != packages.end(); ++i) {
if (_cancel) {
break;
}
pkgCache::PkgIterator pkg = m_apt->packageCache->FindPkg(i->c_str());
- if (pkg.end() == true) {
- continue;
- }
+ if (pkg.end() == true) {
+ continue;
+ }
pkgCache::VerIterator ver = m_apt->find_ver(pkg);
if (ver.end() == true) {
continue;
@@ -586,6 +590,7 @@ backend_what_provides_thread (PkBackend *backend)
}
delete m_apt;
+
} else {
provides_text = pk_provides_enum_to_string (provides);
pk_backend_error_code (backend,
commit ebd4283951d222d57a296fe18c7ae08a46d60e80
Author: Chris Lumens <clumens at redhat.com>
Date: Tue Jul 19 09:53:44 2011 +0100
yum: Parse the new style .discinfo files for F15
Signed-off-by: Richard Hughes <richard at hughsie.com>
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 152c841..5c2800a 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -3514,7 +3514,7 @@ class PackageKitYumBase(yum.YumBase):
else:
raise PkError(ERROR_INTERNAL_ERROR, _format_str(traceback.format_exc()))
- def _media_find_root(self, media_id, disc_number=-1):
+ def _media_find_root(self, media_id):
""" returns the root "/media/Fedora Extras" or None """
# search all the disks
@@ -3535,7 +3535,7 @@ class PackageKitYumBase(yum.YumBase):
f.close()
# not enough lines to be a valid .discinfo
- if len(lines) < 4:
+ if len(lines) < 3:
continue
# check this is the right disk
@@ -3543,15 +3543,6 @@ class PackageKitYumBase(yum.YumBase):
if cmp(media_id_tmp, media_id) != 0:
continue
- # disc number can be random things like 'ALL'
- if disc_number != -1:
- disc_number_tmp = 1
- try:
- disc_number_tmp = int(lines[3].strip())
- except ValueError, e:
- pass
- if disc_number_tmp != disc_number:
- continue
return root
# nothing remaining
@@ -3561,7 +3552,7 @@ class PackageKitYumBase(yum.YumBase):
"""
Handle physical media.
"""
- root = self._media_find_root(kwargs["mediaid"], kwargs["discnum"])
+ root = self._media_find_root(kwargs["mediaid"])
if root:
# the actual copying is done by URLGrabber
ug = URLGrabber(checkfunc = kwargs["checkfunc"])
commit 27c7bf7f14ce7d585fcd38b498e26b2aeb8664b0
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jul 18 12:47:24 2011 +0100
Do not do the compatibility fallbacks
Backends should just implement SimulateX() as using a heuristic is buggy.
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 718867a..adc1d52 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -1727,14 +1727,6 @@ pk_engine_init (PkEngine *engine)
/* try to get the distro id */
engine->priv->distro_id = pk_get_distro_id ();
- /* we allow fallback to these legacy methods */
- if (pk_bitfield_contain (engine->priv->roles, PK_ROLE_ENUM_GET_DEPENDS))
- pk_bitfield_add (engine->priv->roles, PK_ROLE_ENUM_SIMULATE_INSTALL_PACKAGES);
- if (pk_bitfield_contain (engine->priv->roles, PK_ROLE_ENUM_GET_REQUIRES))
- pk_bitfield_add (engine->priv->roles, PK_ROLE_ENUM_SIMULATE_REMOVE_PACKAGES);
- if (pk_bitfield_contain (engine->priv->roles, PK_ROLE_ENUM_GET_DEPENDS))
- pk_bitfield_add (engine->priv->roles, PK_ROLE_ENUM_SIMULATE_UPDATE_PACKAGES);
-
engine->priv->timer = g_timer_new ();
/* we save a cache of the latest update lists sowe can do cached responses */
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 7f47470..da4c850 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -1665,9 +1665,7 @@ gboolean
pk_transaction_run (PkTransaction *transaction)
{
gboolean ret;
- guint i;
GError *error = NULL;
- PkBitfield filters;
PkExitEnum exit_status;
PkTransactionPrivate *priv = PK_TRANSACTION_GET_PRIVATE (transaction);
@@ -1866,38 +1864,11 @@ pk_transaction_run (PkTransaction *transaction)
else if (priv->role == PK_ROLE_ENUM_SIMULATE_INSTALL_FILES)
pk_backend_simulate_install_files (priv->backend, priv->cached_full_paths);
else if (priv->role == PK_ROLE_ENUM_SIMULATE_INSTALL_PACKAGES) {
- /* fallback to a method we do have */
- if (pk_backend_is_implemented (priv->backend, PK_ROLE_ENUM_SIMULATE_INSTALL_PACKAGES)) {
- pk_backend_simulate_install_packages (priv->backend, priv->cached_package_ids);
- } else {
- g_warning ("falling back to get depends as simulate install packages isn't implemented");
- /* we need to emit the original packages before we fall back */
- for (i=0; priv->cached_package_ids[i] != NULL; i++)
- pk_backend_package (priv->backend, PK_INFO_ENUM_INSTALLING, priv->cached_package_ids[i], "");
- filters = pk_bitfield_from_enums (PK_FILTER_ENUM_NOT_INSTALLED, PK_FILTER_ENUM_NEWEST, -1);
- pk_backend_get_depends (priv->backend, filters, priv->cached_package_ids, TRUE);
- }
+ pk_backend_simulate_install_packages (priv->backend, priv->cached_package_ids);
} else if (priv->role == PK_ROLE_ENUM_SIMULATE_REMOVE_PACKAGES) {
- /* fallback to a method we do have */
- if (pk_backend_is_implemented (priv->backend, PK_ROLE_ENUM_SIMULATE_REMOVE_PACKAGES)) {
- pk_backend_simulate_remove_packages (priv->backend, priv->cached_package_ids, priv->cached_autoremove);
- } else {
- g_warning ("falling back to get requires as simulate remove packages isn't implemented");
- filters = pk_bitfield_from_enums (PK_FILTER_ENUM_INSTALLED, PK_FILTER_ENUM_NEWEST, -1);
- pk_backend_get_requires (priv->backend, filters, priv->cached_package_ids, TRUE);
- }
+ pk_backend_simulate_remove_packages (priv->backend, priv->cached_package_ids, priv->cached_autoremove);
} else if (priv->role == PK_ROLE_ENUM_SIMULATE_UPDATE_PACKAGES) {
- /* fallback to a method we do have */
- if (pk_backend_is_implemented (priv->backend, PK_ROLE_ENUM_SIMULATE_UPDATE_PACKAGES)) {
- pk_backend_simulate_update_packages (priv->backend, priv->cached_package_ids);
- } else {
- g_warning ("falling back to get depends as simulate update packages isn't implemented");
- /* we need to emit the original packages before we fall back */
- for (i=0; priv->cached_package_ids[i] != NULL; i++)
- pk_backend_package (priv->backend, PK_INFO_ENUM_UPDATING, priv->cached_package_ids[i], "");
- filters = pk_bitfield_from_enums (PK_FILTER_ENUM_NOT_INSTALLED, PK_FILTER_ENUM_NEWEST, -1);
- pk_backend_get_depends (priv->backend, filters, priv->cached_package_ids, TRUE);
- }
+ pk_backend_simulate_update_packages (priv->backend, priv->cached_package_ids);
} else if (priv->role == PK_ROLE_ENUM_UPGRADE_SYSTEM) {
pk_backend_upgrade_system (priv->backend, priv->cached_value, priv->cached_provides);
} else {
commit 09866107f3e258094e336e7dcdcba38c178b29fd
Author: Ladislav Slezak <lslezak at novell.com>
Date: Tue Jul 19 09:05:17 2011 +0200
zypp: do not install locked (taboo) patches
ignore patches in status "taboo" (never install),
fixes https://bugzilla.novell.com/show_bug.cgi?id=627316
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index 68d59da..96841c1 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -730,8 +730,8 @@ zypp_get_patches (PkBackend *backend, set<PoolItem> &patches)
for (ResPoolProxy::const_iterator it = zypp->poolProxy ().byKindBegin<Patch>();
it != zypp->poolProxy ().byKindEnd<Patch>(); it ++) {
- // check if patch is needed
- if((*it)->isNeeded()) {
+ // check if the patch is needed and not set to taboo
+ if((*it)->isNeeded() && !((*it)->candidateObj ().isUnwanted())) {
Patch::constPtr patch = asKind<Patch>((*it)->candidateObj ().resolvable ());
if (_updating_self) {
if (patch->restartSuggested ())
commit 711a8320e6fc314948adb00fbaa80e0543cfff2b
Author: Matthias Klumpp <matthias at nlinux.org>
Date: Mon Jul 18 16:54:43 2011 +0200
Add a PK_PROVIDES_ENUM_LIBRARY entry
This entry can be used to limit search to libraries only.
diff --git a/lib/packagekit-glib2/pk-enum.c b/lib/packagekit-glib2/pk-enum.c
index 4659235..9c7aec4 100644
--- a/lib/packagekit-glib2/pk-enum.c
+++ b/lib/packagekit-glib2/pk-enum.c
@@ -360,6 +360,7 @@ static const PkEnumMatch enum_provides[] = {
{PK_PROVIDES_ENUM_FONT, "font"},
{PK_PROVIDES_ENUM_POSTSCRIPT_DRIVER, "postscript-driver"},
{PK_PROVIDES_ENUM_PLASMA_SERVICE, "plasma-service"},
+ {PK_PROVIDES_ENUM_LIBRARY, "library"},
{0, NULL}
};
diff --git a/lib/packagekit-glib2/pk-enum.h b/lib/packagekit-glib2/pk-enum.h
index 2a2bf0f..df337b6 100644
--- a/lib/packagekit-glib2/pk-enum.h
+++ b/lib/packagekit-glib2/pk-enum.h
@@ -463,6 +463,7 @@ typedef enum {
PK_PROVIDES_ENUM_HARDWARE_DRIVER,
PK_PROVIDES_ENUM_POSTSCRIPT_DRIVER,
PK_PROVIDES_ENUM_PLASMA_SERVICE,
+ PK_PROVIDES_ENUM_LIBRARY,
PK_PROVIDES_ENUM_LAST
} PkProvidesEnum;
commit 0325b003ee2d1662e88aea20c6155c192b960d20
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jul 18 12:43:22 2011 +0100
Don't ship all the valid licences as enums anymore
They really shouldn't be a part of our ABI. Use the text file instead.
diff --git a/backends/yum/licenses.txt b/backends/yum/licenses.txt
index 6a6232c..a7412c1 100644
--- a/backends/yum/licenses.txt
+++ b/backends/yum/licenses.txt
@@ -1,4 +1,5 @@
AAL
+Abstyles
Adobe
ADSL
AFL
@@ -15,11 +16,16 @@ ASL 1.0
ASL 1.1
ASL 2.0
Baekmuk
+Barr
+Beerware
+BeOpen
BitTorrent
Boost
+Borceux
BSD
BSD Protection
BSD with advertising
+BSD with attribution
CATOSL
CC0
CC-BY
@@ -29,19 +35,26 @@ CDL
CeCILL
CeCILL-B
CeCILL-C
+Charter
CNRI
Condor
Copyright only
CPAL
CPL
+Crossword
Crystal Stacker
DOC
+Dotseqn
+DoubleStroke
+DSDP
DSL
dvipdfm
ECL 1.0
ECL 2.0
eCos
EFL 2.0
+eGenix
+Elvish
Entessa
EPL
ERPL
@@ -57,6 +70,7 @@ GFDL
Giftware
GL2PS
Glide
+Glulxe
gnuplot
GPLv1
GPLv2
@@ -86,7 +100,9 @@ Jabber
JasPer
JPython
Knuth
+Latex2e
LBNL BSD
+LDPL
LGPLv2
LGPLv2+
LGPLv2+ or Artistic
@@ -96,6 +112,7 @@ LGPLv3
LGPLv3+
LGPLv3+ with exceptions
LGPLv3 with exceptions
+Lhcyr
Liberation
libtiff
LLGPL
@@ -118,6 +135,7 @@ NCSA
NetCDF
Netscape
Newmat
+Newsletr
NGPL
Nokia
NOSL
@@ -125,6 +143,7 @@ Noweb
OAL
OFL
OFSFDL
+OML
OpenLDAP
OpenPBS
OpenSSL
@@ -149,6 +168,7 @@ Rdisc
RiceBSD
Romio
RPSL
+Rsfs
Ruby
Saxpath
SCEA
@@ -161,7 +181,10 @@ SNIA
SPL
STIX
TCL
+Teeworlds
+Threeparttable
TMate
+TORQUEv1.1
TOSL
TPL
UCD
@@ -172,6 +195,7 @@ VSL
W3C
Wadalab
Webmin
+Wsuipa
WTFPL
wxWidgets
XANO
@@ -179,6 +203,7 @@ Xerox
xinetd
XSkat
YPLv1.1
+Zed
Zend
zlib
zlib with acknowledgement
diff --git a/lib/packagekit-glib2/pk-enum.c b/lib/packagekit-glib2/pk-enum.c
index 724d98c..4659235 100644
--- a/lib/packagekit-glib2/pk-enum.c
+++ b/lib/packagekit-glib2/pk-enum.c
@@ -373,203 +373,6 @@ static const PkEnumMatch enum_network[] = {
{0, NULL}
};
-/* DO NOT ADD ENTRIES MANUALLY... Use pk-refresh-licenses in tools */
-static const PkEnumMatch enum_free_licenses[] = {
- {PK_LICENSE_ENUM_UNKNOWN, "unknown"}, /* fall though value */
- {PK_LICENSE_ENUM_AAL, "AAL"},
- {PK_LICENSE_ENUM_ADOBE, "Adobe"},
- {PK_LICENSE_ENUM_ADSL, "ADSL"},
- {PK_LICENSE_ENUM_AFL, "AFL"},
- {PK_LICENSE_ENUM_AGPLV1, "AGPLv1"},
- {PK_LICENSE_ENUM_AMDPLPA, "AMDPLPA"},
- {PK_LICENSE_ENUM_AML, "AML"},
- {PK_LICENSE_ENUM_AMPAS_BSD, "AMPAS BSD"},
- {PK_LICENSE_ENUM_APSL_2_DOT_0, "APSL 2.0"},
- {PK_LICENSE_ENUM_ARL, "ARL"},
- {PK_LICENSE_ENUM_ARPHIC, "Arphic"},
- {PK_LICENSE_ENUM_ARTISTIC_2_DOT_0, "Artistic 2.0"},
- {PK_LICENSE_ENUM_ARTISTIC_CLARIFIED, "Artistic clarified"},
- {PK_LICENSE_ENUM_ASL_1_DOT_0, "ASL 1.0"},
- {PK_LICENSE_ENUM_ASL_1_DOT_1, "ASL 1.1"},
- {PK_LICENSE_ENUM_ASL_2_DOT_0, "ASL 2.0"},
- {PK_LICENSE_ENUM_BAEKMUK, "Baekmuk"},
- {PK_LICENSE_ENUM_BEOPEN, "BeOpen"},
- {PK_LICENSE_ENUM_BITTORRENT, "BitTorrent"},
- {PK_LICENSE_ENUM_BOOST, "Boost"},
- {PK_LICENSE_ENUM_BSD, "BSD"},
- {PK_LICENSE_ENUM_BSD_PROTECTION, "BSD Protection"},
- {PK_LICENSE_ENUM_BSD_WITH_ADVERTISING, "BSD with advertising"},
- {PK_LICENSE_ENUM_CATOSL, "CATOSL"},
- {PK_LICENSE_ENUM_CC0, "CC0"},
- {PK_LICENSE_ENUM_CC_BY, "CC-BY"},
- {PK_LICENSE_ENUM_CC_BY_SA, "CC-BY-SA"},
- {PK_LICENSE_ENUM_CDDL, "CDDL"},
- {PK_LICENSE_ENUM_CDL, "CDL"},
- {PK_LICENSE_ENUM_CECILL, "CeCILL"},
- {PK_LICENSE_ENUM_CECILL_B, "CeCILL-B"},
- {PK_LICENSE_ENUM_CECILL_C, "CeCILL-C"},
- {PK_LICENSE_ENUM_CNRI, "CNRI"},
- {PK_LICENSE_ENUM_CONDOR, "Condor"},
- {PK_LICENSE_ENUM_COPYRIGHT_ONLY, "Copyright only"},
- {PK_LICENSE_ENUM_CPAL, "CPAL"},
- {PK_LICENSE_ENUM_CPL, "CPL"},
- {PK_LICENSE_ENUM_CRYSTAL_STACKER, "Crystal Stacker"},
- {PK_LICENSE_ENUM_DOC, "DOC"},
- {PK_LICENSE_ENUM_DSL, "DSL"},
- {PK_LICENSE_ENUM_DVIPDFM, "dvipdfm"},
- {PK_LICENSE_ENUM_ECL_1_DOT_0, "ECL 1.0"},
- {PK_LICENSE_ENUM_ECL_2_DOT_0, "ECL 2.0"},
- {PK_LICENSE_ENUM_ECOS, "eCos"},
- {PK_LICENSE_ENUM_EFL_2_DOT_0, "EFL 2.0"},
- {PK_LICENSE_ENUM_ENTESSA, "Entessa"},
- {PK_LICENSE_ENUM_EPL, "EPL"},
- {PK_LICENSE_ENUM_ERPL, "ERPL"},
- {PK_LICENSE_ENUM_EUPL_1_DOT_1, "EUPL 1.1"},
- {PK_LICENSE_ENUM_EUROSYM, "Eurosym"},
- {PK_LICENSE_ENUM_EU_DATAGRID, "EU Datagrid"},
- {PK_LICENSE_ENUM_FAIR, "Fair"},
- {PK_LICENSE_ENUM_FBSDDL, "FBSDDL"},
- {PK_LICENSE_ENUM_FREE_ART, "Free Art"},
- {PK_LICENSE_ENUM_FTL, "FTL"},
- {PK_LICENSE_ENUM_GEOGRATIS, "GeoGratis"},
- {PK_LICENSE_ENUM_GFDL, "GFDL"},
- {PK_LICENSE_ENUM_GIFTWARE, "Giftware"},
- {PK_LICENSE_ENUM_GL2PS, "GL2PS"},
- {PK_LICENSE_ENUM_GLIDE, "Glide"},
- {PK_LICENSE_ENUM_GNUPLOT, "gnuplot"},
- {PK_LICENSE_ENUM_GPLV1, "GPLv1"},
- {PK_LICENSE_ENUM_GPLV2, "GPLv2"},
- {PK_LICENSE_ENUM_GPLV2_OR_ARTISTIC, "GPLv2 or Artistic"},
- {PK_LICENSE_ENUM_GPLV2_PLUS, "GPLv2+"},
- {PK_LICENSE_ENUM_GPLV2_PLUS_OR_ARTISTIC, "GPLv2+ or Artistic"},
- {PK_LICENSE_ENUM_GPLV2_PLUS_WITH_EXCEPTIONS, "GPLv2+ with exceptions"},
- {PK_LICENSE_ENUM_GPLV2_WITH_EXCEPTIONS, "GPLv2 with exceptions"},
- {PK_LICENSE_ENUM_GPLV3, "GPLv3"},
- {PK_LICENSE_ENUM_GPLV3_PLUS, "GPLv3+"},
- {PK_LICENSE_ENUM_GPLV3_PLUS_WITH_EXCEPTIONS, "GPLv3+ with exceptions"},
- {PK_LICENSE_ENUM_GPLV3_WITH_EXCEPTIONS, "GPLv3 with exceptions"},
- {PK_LICENSE_ENUM_GPL_PLUS, "GPL+"},
- {PK_LICENSE_ENUM_GPL_PLUS_OR_ARTISTIC, "GPL+ or Artistic"},
- {PK_LICENSE_ENUM_GPL_PLUS_WITH_EXCEPTIONS, "GPL+ with exceptions"},
- {PK_LICENSE_ENUM_IBM, "IBM"},
- {PK_LICENSE_ENUM_IEEE, "IEEE"},
- {PK_LICENSE_ENUM_IJG, "IJG"},
- {PK_LICENSE_ENUM_IMAGEMAGICK, "ImageMagick"},
- {PK_LICENSE_ENUM_IMATIX, "iMatix"},
- {PK_LICENSE_ENUM_IMLIB2, "Imlib2"},
- {PK_LICENSE_ENUM_INTEL_ACPI, "Intel ACPI"},
- {PK_LICENSE_ENUM_INTERBASE, "Interbase"},
- {PK_LICENSE_ENUM_IPA, "IPA"},
- {PK_LICENSE_ENUM_ISC, "ISC"},
- {PK_LICENSE_ENUM_JABBER, "Jabber"},
- {PK_LICENSE_ENUM_JASPER, "JasPer"},
- {PK_LICENSE_ENUM_JPYTHON, "JPython"},
- {PK_LICENSE_ENUM_KNUTH, "Knuth"},
- {PK_LICENSE_ENUM_LBNL_BSD, "LBNL BSD"},
- {PK_LICENSE_ENUM_LDPL, "LDPL"},
- {PK_LICENSE_ENUM_LGPLV2, "LGPLv2"},
- {PK_LICENSE_ENUM_LGPLV2_PLUS, "LGPLv2+"},
- {PK_LICENSE_ENUM_LGPLV2_PLUS_OR_ARTISTIC, "LGPLv2+ or Artistic"},
- {PK_LICENSE_ENUM_LGPLV2_PLUS_WITH_EXCEPTIONS, "LGPLv2+ with exceptions"},
- {PK_LICENSE_ENUM_LGPLV2_WITH_EXCEPTIONS, "LGPLv2 with exceptions"},
- {PK_LICENSE_ENUM_LGPLV3, "LGPLv3"},
- {PK_LICENSE_ENUM_LGPLV3_PLUS, "LGPLv3+"},
- {PK_LICENSE_ENUM_LGPLV3_PLUS_WITH_EXCEPTIONS, "LGPLv3+ with exceptions"},
- {PK_LICENSE_ENUM_LGPLV3_WITH_EXCEPTIONS, "LGPLv3 with exceptions"},
- {PK_LICENSE_ENUM_LIBERATION, "Liberation"},
- {PK_LICENSE_ENUM_LIBTIFF, "libtiff"},
- {PK_LICENSE_ENUM_LLGPL, "LLGPL"},
- {PK_LICENSE_ENUM_LOGICA, "Logica"},
- {PK_LICENSE_ENUM_LPL, "LPL"},
- {PK_LICENSE_ENUM_LPPL, "LPPL"},
- {PK_LICENSE_ENUM_MECAB_IPADIC, "mecab-ipadic"},
- {PK_LICENSE_ENUM_MIROS, "MirOS"},
- {PK_LICENSE_ENUM_MIT, "MIT"},
- {PK_LICENSE_ENUM_MIT_WITH_ADVERTISING, "MIT with advertising"},
- {PK_LICENSE_ENUM_MOD_MACRO, "mod_macro"},
- {PK_LICENSE_ENUM_MOTOSOTO, "Motosoto"},
- {PK_LICENSE_ENUM_MPLUS, "mplus"},
- {PK_LICENSE_ENUM_MPLV1_DOT_0, "MPLv1.0"},
- {PK_LICENSE_ENUM_MPLV1_DOT_1, "MPLv1.1"},
- {PK_LICENSE_ENUM_MS_PL, "MS-PL"},
- {PK_LICENSE_ENUM_MS_RL, "MS-RL"},
- {PK_LICENSE_ENUM_NAUMEN, "Naumen"},
- {PK_LICENSE_ENUM_NCSA, "NCSA"},
- {PK_LICENSE_ENUM_NETCDF, "NetCDF"},
- {PK_LICENSE_ENUM_NETSCAPE, "Netscape"},
- {PK_LICENSE_ENUM_NEWMAT, "Newmat"},
- {PK_LICENSE_ENUM_NGPL, "NGPL"},
- {PK_LICENSE_ENUM_NOKIA, "Nokia"},
- {PK_LICENSE_ENUM_NOSL, "NOSL"},
- {PK_LICENSE_ENUM_NOWEB, "Noweb"},
- {PK_LICENSE_ENUM_OAL, "OAL"},
- {PK_LICENSE_ENUM_OFL, "OFL"},
- {PK_LICENSE_ENUM_OFSFDL, "OFSFDL"},
- {PK_LICENSE_ENUM_OML, "OML"},
- {PK_LICENSE_ENUM_OPENLDAP, "OpenLDAP"},
- {PK_LICENSE_ENUM_OPENPBS, "OpenPBS"},
- {PK_LICENSE_ENUM_OPENSSL, "OpenSSL"},
- {PK_LICENSE_ENUM_OREILLY, "OReilly"},
- {PK_LICENSE_ENUM_OSL_1_DOT_0, "OSL 1.0"},
- {PK_LICENSE_ENUM_OSL_1_DOT_1, "OSL 1.1"},
- {PK_LICENSE_ENUM_OSL_2_DOT_0, "OSL 2.0"},
- {PK_LICENSE_ENUM_OSL_2_DOT_1, "OSL 2.1"},
- {PK_LICENSE_ENUM_OSL_3_DOT_0, "OSL 3.0"},
- {PK_LICENSE_ENUM_PHORUM, "Phorum"},
- {PK_LICENSE_ENUM_PHP, "PHP"},
- {PK_LICENSE_ENUM_PLEXUS, "Plexus"},
- {PK_LICENSE_ENUM_POSTGRESQL, "PostgreSQL"},
- {PK_LICENSE_ENUM_PSUTILS, "psutils"},
- {PK_LICENSE_ENUM_PTFL, "PTFL"},
- {PK_LICENSE_ENUM_PUBLIC_DOMAIN, "Public Domain"},
- {PK_LICENSE_ENUM_PUBLIC_USE, "Public Use"},
- {PK_LICENSE_ENUM_PYTHON, "Python"},
- {PK_LICENSE_ENUM_QHULL, "Qhull"},
- {PK_LICENSE_ENUM_QPL, "QPL"},
- {PK_LICENSE_ENUM_RDISC, "Rdisc"},
- {PK_LICENSE_ENUM_RICEBSD, "RiceBSD"},
- {PK_LICENSE_ENUM_ROMIO, "Romio"},
- {PK_LICENSE_ENUM_RPSL, "RPSL"},
- {PK_LICENSE_ENUM_RUBY, "Ruby"},
- {PK_LICENSE_ENUM_SAXPATH, "Saxpath"},
- {PK_LICENSE_ENUM_SCEA, "SCEA"},
- {PK_LICENSE_ENUM_SCRIP, "SCRIP"},
- {PK_LICENSE_ENUM_SENDMAIL, "Sendmail"},
- {PK_LICENSE_ENUM_SISSL, "SISSL"},
- {PK_LICENSE_ENUM_SLEEPYCAT, "Sleepycat"},
- {PK_LICENSE_ENUM_SLIB, "SLIB"},
- {PK_LICENSE_ENUM_SNIA, "SNIA"},
- {PK_LICENSE_ENUM_SPL, "SPL"},
- {PK_LICENSE_ENUM_STIX, "STIX"},
- {PK_LICENSE_ENUM_TCL, "TCL"},
- {PK_LICENSE_ENUM_TEEWORLDS, "Teeworlds"},
- {PK_LICENSE_ENUM_TMATE, "TMate"},
- {PK_LICENSE_ENUM_TOSL, "TOSL"},
- {PK_LICENSE_ENUM_TPL, "TPL"},
- {PK_LICENSE_ENUM_UCD, "UCD"},
- {PK_LICENSE_ENUM_VIM, "Vim"},
- {PK_LICENSE_ENUM_VNLSL, "VNLSL"},
- {PK_LICENSE_ENUM_VOSTROM, "VOSTROM"},
- {PK_LICENSE_ENUM_VSL, "VSL"},
- {PK_LICENSE_ENUM_W3C, "W3C"},
- {PK_LICENSE_ENUM_WADALAB, "Wadalab"},
- {PK_LICENSE_ENUM_WEBMIN, "Webmin"},
- {PK_LICENSE_ENUM_WTFPL, "WTFPL"},
- {PK_LICENSE_ENUM_WXWIDGETS, "wxWidgets"},
- {PK_LICENSE_ENUM_XANO, "XANO"},
- {PK_LICENSE_ENUM_XEROX, "Xerox"},
- {PK_LICENSE_ENUM_XINETD, "xinetd"},
- {PK_LICENSE_ENUM_XSKAT, "XSkat"},
- {PK_LICENSE_ENUM_YPLV1_DOT_1, "YPLv1.1"},
- {PK_LICENSE_ENUM_ZEND, "Zend"},
- {PK_LICENSE_ENUM_ZLIB, "zlib"},
- {PK_LICENSE_ENUM_ZLIB_WITH_ACKNOWLEDGEMENT, "zlib with acknowledgement"},
- {PK_LICENSE_ENUM_ZPLV1_DOT_0, "ZPLv1.0"},
- {PK_LICENSE_ENUM_ZPLV2_DOT_0, "ZPLv2.0"},
- {PK_LICENSE_ENUM_ZPLV2_DOT_1, "ZPLv2.1"},
- {0, NULL}
-};
-
static const PkEnumMatch enum_media_type[] = {
{PK_MEDIA_TYPE_ENUM_UNKNOWN, "unknown"}, /* fall though value */
{PK_MEDIA_TYPE_ENUM_CD, "cd"},
@@ -1098,38 +901,6 @@ pk_filter_enum_to_string (PkFilterEnum filter)
}
/**
- * pk_license_enum_from_string:
- * @license: Text describing the enumerated type
- *
- * Converts a text enumerated type to its unsigned integer representation
- *
- * Return value: the enumerated constant value, e.g. PK_SIGTYPE_ENUM_GPG
- *
- * Since: 0.5.0
- **/
-PkLicenseEnum
-pk_license_enum_from_string (const gchar *license)
-{
- return pk_enum_find_value (enum_free_licenses, license);
-}
-
-/**
- * pk_license_enum_to_string:
- * @license: The enumerated type value
- *
- * Converts a enumerated type to its text representation
- *
- * Return value: the enumerated constant value, e.g. "available"
- *
- * Since: 0.5.0
- **/
-const gchar *
-pk_license_enum_to_string (PkLicenseEnum license)
-{
- return pk_enum_find_string (enum_free_licenses, license);
-}
-
-/**
* pk_media_type_enum_from_string:
* @media_type: Text describing the enumerated type
*
diff --git a/lib/packagekit-glib2/pk-enum.h b/lib/packagekit-glib2/pk-enum.h
index d63a9c0..2a2bf0f 100644
--- a/lib/packagekit-glib2/pk-enum.h
+++ b/lib/packagekit-glib2/pk-enum.h
@@ -466,202 +466,6 @@ typedef enum {
PK_PROVIDES_ENUM_LAST
} PkProvidesEnum;
-typedef enum {
- PK_LICENSE_ENUM_UNKNOWN,
- PK_LICENSE_ENUM_AAL,
- PK_LICENSE_ENUM_ADOBE,
- PK_LICENSE_ENUM_ADSL,
- PK_LICENSE_ENUM_AFL,
- PK_LICENSE_ENUM_AGPLV1,
- PK_LICENSE_ENUM_AMDPLPA,
- PK_LICENSE_ENUM_AML,
- PK_LICENSE_ENUM_AMPAS_BSD,
- PK_LICENSE_ENUM_APSL_2_DOT_0,
- PK_LICENSE_ENUM_ARL,
- PK_LICENSE_ENUM_ARPHIC,
- PK_LICENSE_ENUM_ARTISTIC_2_DOT_0,
- PK_LICENSE_ENUM_ARTISTIC_CLARIFIED,
- PK_LICENSE_ENUM_ASL_1_DOT_0,
- PK_LICENSE_ENUM_ASL_1_DOT_1,
- PK_LICENSE_ENUM_ASL_2_DOT_0,
- PK_LICENSE_ENUM_BAEKMUK,
- PK_LICENSE_ENUM_BEOPEN,
- PK_LICENSE_ENUM_BITTORRENT,
- PK_LICENSE_ENUM_BOOST,
- PK_LICENSE_ENUM_BSD,
- PK_LICENSE_ENUM_BSD_PROTECTION,
- PK_LICENSE_ENUM_BSD_WITH_ADVERTISING,
- PK_LICENSE_ENUM_CATOSL,
- PK_LICENSE_ENUM_CC0,
- PK_LICENSE_ENUM_CC_BY,
- PK_LICENSE_ENUM_CC_BY_SA,
- PK_LICENSE_ENUM_CDDL,
- PK_LICENSE_ENUM_CDL,
- PK_LICENSE_ENUM_CECILL,
- PK_LICENSE_ENUM_CECILL_B,
- PK_LICENSE_ENUM_CECILL_C,
- PK_LICENSE_ENUM_CNRI,
- PK_LICENSE_ENUM_CONDOR,
- PK_LICENSE_ENUM_COPYRIGHT_ONLY,
- PK_LICENSE_ENUM_CPAL,
- PK_LICENSE_ENUM_CPL,
- PK_LICENSE_ENUM_CRYSTAL_STACKER,
- PK_LICENSE_ENUM_DOC,
- PK_LICENSE_ENUM_DSL,
- PK_LICENSE_ENUM_DVIPDFM,
- PK_LICENSE_ENUM_ECL_1_DOT_0,
- PK_LICENSE_ENUM_ECL_2_DOT_0,
- PK_LICENSE_ENUM_ECOS,
- PK_LICENSE_ENUM_EFL_2_DOT_0,
- PK_LICENSE_ENUM_ENTESSA,
- PK_LICENSE_ENUM_EPL,
- PK_LICENSE_ENUM_ERPL,
- PK_LICENSE_ENUM_EUPL_1_DOT_1,
- PK_LICENSE_ENUM_EUROSYM,
- PK_LICENSE_ENUM_EU_DATAGRID,
- PK_LICENSE_ENUM_FAIR,
- PK_LICENSE_ENUM_FBSDDL,
- PK_LICENSE_ENUM_FREE_ART,
- PK_LICENSE_ENUM_FTL,
- PK_LICENSE_ENUM_GEOGRATIS,
- PK_LICENSE_ENUM_GFDL,
- PK_LICENSE_ENUM_GIFTWARE,
- PK_LICENSE_ENUM_GL2PS,
- PK_LICENSE_ENUM_GLIDE,
- PK_LICENSE_ENUM_GNUPLOT,
- PK_LICENSE_ENUM_GPLV1,
- PK_LICENSE_ENUM_GPLV2,
- PK_LICENSE_ENUM_GPLV2_OR_ARTISTIC,
- PK_LICENSE_ENUM_GPLV2_PLUS,
- PK_LICENSE_ENUM_GPLV2_PLUS_OR_ARTISTIC,
- PK_LICENSE_ENUM_GPLV2_PLUS_WITH_EXCEPTIONS,
- PK_LICENSE_ENUM_GPLV2_WITH_EXCEPTIONS,
- PK_LICENSE_ENUM_GPLV3,
- PK_LICENSE_ENUM_GPLV3_PLUS,
- PK_LICENSE_ENUM_GPLV3_PLUS_WITH_EXCEPTIONS,
- PK_LICENSE_ENUM_GPLV3_WITH_EXCEPTIONS,
- PK_LICENSE_ENUM_GPL_PLUS,
- PK_LICENSE_ENUM_GPL_PLUS_OR_ARTISTIC,
- PK_LICENSE_ENUM_GPL_PLUS_WITH_EXCEPTIONS,
- PK_LICENSE_ENUM_IBM,
- PK_LICENSE_ENUM_IEEE,
- PK_LICENSE_ENUM_IJG,
- PK_LICENSE_ENUM_IMAGEMAGICK,
- PK_LICENSE_ENUM_IMATIX,
- PK_LICENSE_ENUM_IMLIB2,
- PK_LICENSE_ENUM_INTEL_ACPI,
- PK_LICENSE_ENUM_INTERBASE,
- PK_LICENSE_ENUM_IPA,
- PK_LICENSE_ENUM_ISC,
- PK_LICENSE_ENUM_JABBER,
- PK_LICENSE_ENUM_JASPER,
- PK_LICENSE_ENUM_JPYTHON,
- PK_LICENSE_ENUM_KNUTH,
- PK_LICENSE_ENUM_LBNL_BSD,
- PK_LICENSE_ENUM_LDPL,
- PK_LICENSE_ENUM_LGPLV2,
- PK_LICENSE_ENUM_LGPLV2_PLUS,
- PK_LICENSE_ENUM_LGPLV2_PLUS_OR_ARTISTIC,
- PK_LICENSE_ENUM_LGPLV2_PLUS_WITH_EXCEPTIONS,
- PK_LICENSE_ENUM_LGPLV2_WITH_EXCEPTIONS,
- PK_LICENSE_ENUM_LGPLV3,
- PK_LICENSE_ENUM_LGPLV3_PLUS,
- PK_LICENSE_ENUM_LGPLV3_PLUS_WITH_EXCEPTIONS,
- PK_LICENSE_ENUM_LGPLV3_WITH_EXCEPTIONS,
- PK_LICENSE_ENUM_LIBERATION,
- PK_LICENSE_ENUM_LIBTIFF,
- PK_LICENSE_ENUM_LLGPL,
- PK_LICENSE_ENUM_LOGICA,
- PK_LICENSE_ENUM_LPL,
- PK_LICENSE_ENUM_LPPL,
- PK_LICENSE_ENUM_MECAB_IPADIC,
- PK_LICENSE_ENUM_MIROS,
- PK_LICENSE_ENUM_MIT,
- PK_LICENSE_ENUM_MIT_WITH_ADVERTISING,
- PK_LICENSE_ENUM_MOD_MACRO,
- PK_LICENSE_ENUM_MOTOSOTO,
- PK_LICENSE_ENUM_MPLUS,
- PK_LICENSE_ENUM_MPLV1_DOT_0,
- PK_LICENSE_ENUM_MPLV1_DOT_1,
- PK_LICENSE_ENUM_MS_PL,
- PK_LICENSE_ENUM_MS_RL,
- PK_LICENSE_ENUM_NAUMEN,
- PK_LICENSE_ENUM_NCSA,
- PK_LICENSE_ENUM_NETCDF,
- PK_LICENSE_ENUM_NETSCAPE,
- PK_LICENSE_ENUM_NEWMAT,
- PK_LICENSE_ENUM_NGPL,
- PK_LICENSE_ENUM_NOKIA,
- PK_LICENSE_ENUM_NOSL,
- PK_LICENSE_ENUM_NOWEB,
- PK_LICENSE_ENUM_OAL,
- PK_LICENSE_ENUM_OFL,
- PK_LICENSE_ENUM_OFSFDL,
- PK_LICENSE_ENUM_OML,
- PK_LICENSE_ENUM_OPENLDAP,
- PK_LICENSE_ENUM_OPENPBS,
- PK_LICENSE_ENUM_OPENSSL,
- PK_LICENSE_ENUM_OREILLY,
- PK_LICENSE_ENUM_OSL_1_DOT_0,
- PK_LICENSE_ENUM_OSL_1_DOT_1,
- PK_LICENSE_ENUM_OSL_2_DOT_0,
- PK_LICENSE_ENUM_OSL_2_DOT_1,
- PK_LICENSE_ENUM_OSL_3_DOT_0,
- PK_LICENSE_ENUM_PHORUM,
- PK_LICENSE_ENUM_PHP,
- PK_LICENSE_ENUM_PLEXUS,
- PK_LICENSE_ENUM_POSTGRESQL,
- PK_LICENSE_ENUM_PSUTILS,
- PK_LICENSE_ENUM_PTFL,
- PK_LICENSE_ENUM_PUBLIC_DOMAIN,
- PK_LICENSE_ENUM_PUBLIC_USE,
- PK_LICENSE_ENUM_PYTHON,
- PK_LICENSE_ENUM_QHULL,
- PK_LICENSE_ENUM_QPL,
- PK_LICENSE_ENUM_RDISC,
- PK_LICENSE_ENUM_RICEBSD,
- PK_LICENSE_ENUM_ROMIO,
- PK_LICENSE_ENUM_RPSL,
- PK_LICENSE_ENUM_RUBY,
- PK_LICENSE_ENUM_SAXPATH,
- PK_LICENSE_ENUM_SCEA,
- PK_LICENSE_ENUM_SCRIP,
- PK_LICENSE_ENUM_SENDMAIL,
- PK_LICENSE_ENUM_SISSL,
- PK_LICENSE_ENUM_SLEEPYCAT,
- PK_LICENSE_ENUM_SLIB,
- PK_LICENSE_ENUM_SNIA,
- PK_LICENSE_ENUM_SPL,
- PK_LICENSE_ENUM_STIX,
- PK_LICENSE_ENUM_TCL,
- PK_LICENSE_ENUM_TEEWORLDS,
- PK_LICENSE_ENUM_TMATE,
- PK_LICENSE_ENUM_TOSL,
- PK_LICENSE_ENUM_TPL,
- PK_LICENSE_ENUM_UCD,
- PK_LICENSE_ENUM_VIM,
- PK_LICENSE_ENUM_VNLSL,
- PK_LICENSE_ENUM_VOSTROM,
- PK_LICENSE_ENUM_VSL,
- PK_LICENSE_ENUM_W3C,
- PK_LICENSE_ENUM_WADALAB,
- PK_LICENSE_ENUM_WEBMIN,
- PK_LICENSE_ENUM_WTFPL,
- PK_LICENSE_ENUM_WXWIDGETS,
- PK_LICENSE_ENUM_XANO,
- PK_LICENSE_ENUM_XEROX,
- PK_LICENSE_ENUM_XINETD,
- PK_LICENSE_ENUM_XSKAT,
- PK_LICENSE_ENUM_YPLV1_DOT_1,
- PK_LICENSE_ENUM_ZEND,
- PK_LICENSE_ENUM_ZLIB,
- PK_LICENSE_ENUM_ZLIB_WITH_ACKNOWLEDGEMENT,
- PK_LICENSE_ENUM_ZPLV1_DOT_0,
- PK_LICENSE_ENUM_ZPLV2_DOT_0,
- PK_LICENSE_ENUM_ZPLV2_DOT_1,
- PK_LICENSE_ENUM_LAST
-} PkLicenseEnum;
-
/**
* PkMediaTypeEnum:
*
@@ -749,9 +553,6 @@ const gchar *pk_filter_enum_to_string (PkFilterEnum filter);
PkProvidesEnum pk_provides_enum_from_string (const gchar *provides);
const gchar *pk_provides_enum_to_string (PkProvidesEnum provides);
-PkLicenseEnum pk_license_enum_from_string (const gchar *license);
-const gchar *pk_license_enum_to_string (PkLicenseEnum license);
-
PkDistroUpgradeEnum pk_distro_upgrade_enum_from_string (const gchar *upgrade);
const gchar *pk_distro_upgrade_enum_to_string (PkDistroUpgradeEnum upgrade);
diff --git a/lib/python/packagekit/package.py b/lib/python/packagekit/package.py
index d10d9e4..27e9d5a 100644
--- a/lib/python/packagekit/package.py
+++ b/lib/python/packagekit/package.py
@@ -53,6 +53,8 @@ class PackagekitPackage:
'''
groups = license_field.split(" and ")
+ f = open('/usr/share/PackageKit/helpers/yum/licenses.txt', 'r')
+ free_licenses = f.readlines()
if len(groups) == 0:
return False
@@ -72,7 +74,7 @@ class PackagekitPackage:
if len(license) < 1:
continue
- if license in PackageKitEnum.free_licenses:
+ if license in free_licenses:
one_free_group = True
group_is_free = True
break
diff --git a/tools/pk-refresh-licenses.c b/tools/pk-refresh-licenses.c
index 969e415..8ccf4b9 100644
--- a/tools/pk-refresh-licenses.c
+++ b/tools/pk-refresh-licenses.c
@@ -124,8 +124,6 @@ main (int argc, char *argv[])
gint shortname = -1;
GPtrArray *data = NULL;
gboolean is_col;
- GString *string_h = NULL;
- GString *string_c = NULL;
GString *string_txt = NULL;
PkRefreshLicenseItem *item;
PkRefreshLicenseItem *item_tmp;
@@ -264,48 +262,10 @@ skip:
g_ptr_array_sort (data, pk_refresh_licenses_compare_func);
/* process data, and output to header file */
- string_h = g_string_new ("automatically geneated, do not edit\n\n");
- string_c = g_string_new ("automatically geneated, do not edit\n\n");
string_txt = g_string_new (NULL);
for (i=0; i<data->len; i++) {
- gchar *tabs;
- guint len;
- gint no_tabs;
item = g_ptr_array_index (data, i);
-
- /* trivial */
- g_string_append_printf (string_h, "\t%s,\n", item->enum_name);
-
- /* 5 tabs, each tab = 8 chars */
- len = strlen (item->enum_name) + 2; /* for the { and , */
- no_tabs = (gint) ceilf (5.0f - ((gfloat) len / 8.0f));
- if (no_tabs > 0)
- tabs = g_strnfill (no_tabs, '\t');
- else
- tabs = g_strdup (" ");
-
- /* need to tab properly */
- g_string_append_printf (string_c, "\t{%s,%s\"%s\"},\n", item->enum_name, tabs, item->full_name);
g_string_append_printf (string_txt, "%s\n", item->full_name);
- g_free (tabs);
- }
- g_string_append (string_c, "\n");
- g_string_append (string_h, "\n");
-
- /* set h contents */
- ret = g_file_set_contents ("./pk-enum.h.tmp", string_h->str, -1, &error);
- if (!ret) {
- g_warning ("failed to set contents: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* set c contents */
- ret = g_file_set_contents ("./pk-enum.c.tmp", string_c->str, -1, &error);
- if (!ret) {
- g_warning ("failed to set contents: %s", error->message);
- g_error_free (error);
- goto out;
}
/* set c contents */
@@ -318,10 +278,6 @@ skip:
retval = EXIT_SUCCESS;
out:
- if (string_h != NULL)
- g_string_free (string_h, TRUE);
- if (string_c != NULL)
- g_string_free (string_c, TRUE);
if (string_txt != NULL)
g_string_free (string_txt, TRUE);
if (data != NULL)
commit f049c447d7d6c9687fc1d4db6215818a3eea53b6
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Jul 15 13:47:34 2011 +0100
trivial: remove some #ifdef code that is always TRUE
diff --git a/client/egg-string.c b/client/egg-string.c
deleted file mode 120000
index 6ad7909..0000000
--- a/client/egg-string.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/egg-string.c
\ No newline at end of file
diff --git a/client/egg-string.h b/client/egg-string.h
deleted file mode 120000
index d7e801b..0000000
--- a/client/egg-string.h
+++ /dev/null
@@ -1 +0,0 @@
-../src/egg-string.h
\ No newline at end of file
diff --git a/contrib/browser-plugin/pk-plugin-install.c b/contrib/browser-plugin/pk-plugin-install.c
index f854f28..26948cf 100644
--- a/contrib/browser-plugin/pk-plugin-install.c
+++ b/contrib/browser-plugin/pk-plugin-install.c
@@ -125,9 +125,7 @@ pk_plugin_install_set_status (PkPluginInstall *self, PkPluginInstallPackageStatu
if (status == INSTALLING) {
self->priv->timeout = g_timeout_add (80, spinner_timeout, self);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (self->priv->timeout, "[PkPluginInstall] spinner");
-#endif
}
else if (self->priv->timeout) {
g_source_remove (self->priv->timeout);
diff --git a/contrib/command-not-found/pk-command-not-found.c b/contrib/command-not-found/pk-command-not-found.c
index e10b15c..1eeb89d 100644
--- a/contrib/command-not-found/pk-command-not-found.c
+++ b/contrib/command-not-found/pk-command-not-found.c
@@ -427,9 +427,7 @@ pk_cnf_find_available (const gchar *cmd, guint max_search_time)
cancel_id = g_timeout_add (max_search_time,
(GSourceFunc) pk_cnf_cancel_cb,
cancellable);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (cancel_id, "[PkCommandNotFound] cancel");
-#endif
/* do search */
filters = pk_bitfield_from_enums (PK_FILTER_ENUM_NOT_INSTALLED,
diff --git a/contrib/gtk-module/pk-gtk-module.c b/contrib/gtk-module/pk-gtk-module.c
index b615972..b3913c3 100644
--- a/contrib/gtk-module/pk-gtk-module.c
+++ b/contrib/gtk-module/pk-gtk-module.c
@@ -157,9 +157,7 @@ queue_install_fonts_tag (const char *tag)
if (tags == NULL) {
tags = g_ptr_array_new ();
idle_id = g_idle_add (pk_install_fonts_idle_cb, NULL);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (idle_id, "[PkGtkModule] install fonts");
-#endif
}
g_ptr_array_add (tags, (gpointer) g_strdup (tag));
diff --git a/lib/packagekit-glib2/pk-control.c b/lib/packagekit-glib2/pk-control.c
index 5c3a04c..885327e 100644
--- a/lib/packagekit-glib2/pk-control.c
+++ b/lib/packagekit-glib2/pk-control.c
@@ -1944,10 +1944,8 @@ pk_control_transaction_list_changed_cb (DBusGProxy *proxy, gchar **transaction_i
g_debug ("emit transaction-list-changed (when idle)");
control->priv->transaction_list_changed_id =
g_idle_add ((GSourceFunc) pk_control_transaction_list_changed_idle_cb, store);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (control->priv->transaction_list_changed_id,
"[PkControl] transaction-list-changed");
-#endif
}
/**
@@ -1985,10 +1983,8 @@ pk_control_restart_schedule_cb (DBusGProxy *proxy, PkControl *control)
g_debug ("emit restart-schedule (when idle)");
store->control->priv->restart_schedule_id =
g_idle_add ((GSourceFunc) pk_control_restart_schedule_idle_cb, store);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (store->control->priv->restart_schedule_id,
"[PkControl] restart-schedule");
-#endif
}
/**
@@ -2026,10 +2022,8 @@ pk_control_updates_changed_cb (DBusGProxy *proxy, PkControl *control)
g_debug ("emit updates-changed (when idle)");
control->priv->updates_changed_id =
g_idle_add ((GSourceFunc) pk_control_updates_changed_idle_cb, store);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (control->priv->updates_changed_id,
"[PkControl] updates-changed");
-#endif
}
/**
@@ -2067,10 +2061,8 @@ pk_control_repo_list_changed_cb (DBusGProxy *proxy, PkControl *control)
g_debug ("emit repo-list-changed (when idle)");
control->priv->repo_list_changed_id =
g_idle_add ((GSourceFunc) pk_control_repo_list_changed_idle_cb, store);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (control->priv->repo_list_changed_id,
"[PkControl] repo-list-changed");
-#endif
}
/**
diff --git a/lib/packagekit-glib2/pk-progress-bar.c b/lib/packagekit-glib2/pk-progress-bar.c
index c1c9aeb..bce680a 100644
--- a/lib/packagekit-glib2/pk-progress-bar.c
+++ b/lib/packagekit-glib2/pk-progress-bar.c
@@ -151,9 +151,7 @@ pk_progress_bar_draw_pulse_bar (PkProgressBar *self)
self->priv->pulse_state.move_forward = TRUE;
self->priv->timer_id = g_timeout_add (PK_PROGRESS_BAR_PULSE_TIMEOUT,
(GSourceFunc) pk_progress_bar_pulse_bar, self);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (self->priv->timer_id, "[PkProgressBar] pulse");
-#endif
}
}
diff --git a/lib/packagekit-glib2/pk-task.c b/lib/packagekit-glib2/pk-task.c
index 61db97d..42f8c97 100644
--- a/lib/packagekit-glib2/pk-task.c
+++ b/lib/packagekit-glib2/pk-task.c
@@ -716,9 +716,7 @@ pk_task_user_accepted (PkTask *task, guint request)
}
idle_id = g_idle_add ((GSourceFunc) pk_task_user_accepted_idle_cb, state);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (idle_id, "[PkTask] user-accept");
-#endif
return TRUE;
}
@@ -768,9 +766,7 @@ pk_task_user_declined (PkTask *task, guint request)
}
idle_id = g_idle_add ((GSourceFunc) pk_task_user_declined_idle_cb, state);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (idle_id, "[PkTask] user-declined");
-#endif
return TRUE;
}
diff --git a/src/pk-backend-spawn.c b/src/pk-backend-spawn.c
index 73c5241..ff2e1c6 100644
--- a/src/pk-backend-spawn.c
+++ b/src/pk-backend-spawn.c
@@ -145,9 +145,7 @@ pk_backend_spawn_start_kill_timer (PkBackendSpawn *backend_spawn)
/* close down the dispatcher if it is still open after this much time */
priv->kill_id = g_timeout_add_seconds (timeout, (GSourceFunc) pk_backend_spawn_exit_timeout_cb, backend_spawn);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (priv->kill_id, "[PkBackendSpawn] exit");
-#endif
}
/**
diff --git a/src/pk-backend.c b/src/pk-backend.c
index e636399..c6aa8bc 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -2065,9 +2065,7 @@ pk_backend_error_code (PkBackend *backend, PkErrorEnum error_code, const gchar *
/* we only allow a short time to send finished after error_code */
backend->priv->signal_error_timeout = g_timeout_add (PK_BACKEND_FINISHED_ERROR_TIMEOUT,
pk_backend_error_timeout_delay_cb, backend);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (backend->priv->signal_error_timeout, "[PkBackend] error-code");
-#endif
/* some error codes have a different exit code */
need_untrusted = pk_backend_error_code_is_need_untrusted (error_code);
@@ -2411,9 +2409,7 @@ pk_backend_finished (PkBackend *backend)
g_debug ("adding finished %p to timeout loop", backend);
backend->priv->signal_finished = g_timeout_add (PK_BACKEND_FINISHED_TIMEOUT_GRACE,
pk_backend_finished_delay, backend);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (backend->priv->signal_finished, "[PkBackend] finished");
-#endif
return TRUE;
}
@@ -2435,9 +2431,7 @@ pk_backend_thread_finished (PkBackend *backend)
{
guint idle_id;
idle_id = g_idle_add ((GSourceFunc) pk_backend_thread_finished_cb, backend);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (idle_id, "[PkBackend] finished");
-#endif
}
/**
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 6541ac7..718867a 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -408,15 +408,11 @@ pk_engine_state_has_changed (PkEngine *engine, const gchar *reason, GError **err
if (is_priority) {
engine->priv->timeout_priority_id = g_timeout_add_seconds (engine->priv->timeout_priority,
pk_engine_state_changed_cb, engine);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (engine->priv->timeout_priority_id, "[PkEngine] priority");
-#endif
} else {
engine->priv->timeout_normal_id = g_timeout_add_seconds (engine->priv->timeout_normal,
pk_engine_state_changed_cb, engine);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (engine->priv->timeout_normal_id, "[PkEngine] normal");
-#endif
}
/* reset the timer */
diff --git a/src/pk-notify.c b/src/pk-notify.c
index 46884cb..fa08b2f 100644
--- a/src/pk-notify.c
+++ b/src/pk-notify.c
@@ -109,9 +109,7 @@ pk_notify_wait_updates_changed (PkNotify *notify, guint timeout)
/* schedule */
notify->priv->timeout_id = g_timeout_add (timeout, pk_notify_finished_updates_changed_cb, notify);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (notify->priv->timeout_id, "[PkNotify] updates-changed");
-#endif
return TRUE;
}
diff --git a/src/pk-spawn.c b/src/pk-spawn.c
index 2a6acfb..d5919fb 100644
--- a/src/pk-spawn.c
+++ b/src/pk-spawn.c
@@ -378,9 +378,7 @@ pk_spawn_kill (PkSpawn *spawn)
/* the program might not be able to handle SIGQUIT, give it a few seconds and then SIGKILL it */
if (spawn->priv->allow_sigkill) {
spawn->priv->kill_id = g_timeout_add (PK_SPAWN_SIGKILL_DELAY, (GSourceFunc) pk_spawn_sigkill_cb, spawn);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (spawn->priv->kill_id, "[PkSpawn] sigkill");
-#endif
}
return TRUE;
}
@@ -653,9 +651,7 @@ pk_spawn_argv (PkSpawn *spawn, gchar **argv, gchar **envp, GError **error)
/* poll quickly */
spawn->priv->poll_id = g_timeout_add (PK_SPAWN_POLL_DELAY, (GSourceFunc) pk_spawn_check_child, spawn);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (spawn->priv->poll_id, "[PkSpawn] main poll");
-#endif
return TRUE;
}
diff --git a/src/pk-transaction-db.c b/src/pk-transaction-db.c
index 97b8e95..8ae7bfd 100644
--- a/src/pk-transaction-db.c
+++ b/src/pk-transaction-db.c
@@ -560,9 +560,7 @@ pk_transaction_db_generate_id (PkTransactionDb *tdb)
tdb->priv->database_save_id =
g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)
pk_transaction_db_defer_write_job_count_cb, tdb, NULL);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (tdb->priv->database_save_id, "[PkTransactionDb] save");
-#endif
}
/* make the tid */
diff --git a/src/pk-transaction-list.c b/src/pk-transaction-list.c
index f4c1191..633a5c6 100644
--- a/src/pk-transaction-list.c
+++ b/src/pk-transaction-list.c
@@ -308,9 +308,7 @@ pk_transaction_list_run_item (PkTransactionList *tlist, PkTransactionItem *item)
/* add this idle, so that we don't have a deep out-of-order callchain */
item->idle_id = g_idle_add ((GSourceFunc) pk_transaction_list_run_idle_cb, item);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (item->idle_id, "[PkTransactionList] run");
-#endif
}
/**
@@ -392,9 +390,7 @@ pk_transaction_list_transaction_finished_cb (PkTransaction *transaction, const g
/* give the client a few seconds to still query the runner */
timeout = pk_conf_get_int (tlist->priv->conf, "TransactionKeepFinishedTimeout");
item->remove_id = g_timeout_add_seconds (timeout, (GSourceFunc) pk_transaction_list_remove_item_cb, item);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (item->remove_id, "[PkTransactionList] remove");
-#endif
/* do the next transaction now if we have another queued */
item = pk_transaction_list_get_next_item (tlist);
@@ -532,9 +528,7 @@ pk_transaction_list_create (PkTransactionList *tlist, const gchar *tid, const gc
/* the client only has a finite amount of time to use the object, else it's destroyed */
timeout = pk_conf_get_int (tlist->priv->conf, "TransactionCreateCommitTimeout");
item->commit_id = g_timeout_add_seconds (timeout, (GSourceFunc) pk_transaction_list_no_commit_cb, item);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (item->commit_id, "[PkTransactionList] commit");
-#endif
g_debug ("adding transaction %p, item %p", item->transaction, item);
g_ptr_array_add (tlist->priv->array, item);
@@ -891,9 +885,7 @@ pk_transaction_list_wedge_check1 (PkTransactionList *tlist)
/* we have to do this twice, as we might idle add inbetween a transition */
g_warning ("list is consistent, scheduling another check");
tlist->priv->unwedge2_id = g_timeout_add (500, (GSourceFunc) pk_transaction_list_wedge_check2, tlist);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (tlist->priv->unwedge2_id, "[PkTransactionList] wedge-check");
-#endif
}
/* always repeat */
@@ -943,9 +935,7 @@ pk_transaction_list_init (PkTransactionList *tlist)
tlist->priv->unwedge2_id = 0;
tlist->priv->unwedge1_id = g_timeout_add_seconds (PK_TRANSACTION_WEDGE_CHECK,
(GSourceFunc) pk_transaction_list_wedge_check1, tlist);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (tlist->priv->unwedge1_id, "[PkTransactionList] wedge-check (main)");
-#endif
}
/**
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 192a2d2..7f47470 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -2654,9 +2654,7 @@ pk_transaction_accept_eula (PkTransaction *transaction, const gchar *eula_id, DB
/* we are done */
idle_id = g_idle_add ((GSourceFunc) pk_transaction_finished_idle_cb, transaction);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (idle_id, "[PkTransaction] finished from accept");
-#endif
/* return from async with success */
pk_transaction_dbus_return (context);
@@ -3323,9 +3321,7 @@ pk_transaction_get_old_transactions (PkTransaction *transaction, guint number, G
pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_OLD_TRANSACTIONS);
pk_transaction_db_get_list (transaction->priv->transaction_db, number);
idle_id = g_idle_add ((GSourceFunc) pk_transaction_finished_idle_cb, transaction);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (idle_id, "[PkTransaction] finished from get-old-transactions");
-#endif
return TRUE;
}
@@ -3615,10 +3611,7 @@ pk_transaction_try_emit_cache (PkTransaction *transaction)
/* we are done */
idle_id = g_idle_add ((GSourceFunc) pk_transaction_finished_idle_cb, transaction);
-#if GLIB_CHECK_VERSION(2,25,8)
g_source_set_name_by_id (idle_id, "[PkTransaction] try-emit-cache");
-#endif
-
out:
if (package_array != NULL)
g_ptr_array_unref (package_array);
commit 6bb439e39d270ebdaf8345e03048b5861e7d30b4
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jul 14 22:43:54 2011 +0100
trivial: disable the smart backend until it compiles
diff --git a/contrib/PackageKit.spec.in b/contrib/PackageKit.spec.in
index c09ce28..76595fc 100644
--- a/contrib/PackageKit.spec.in
+++ b/contrib/PackageKit.spec.in
@@ -248,12 +248,11 @@ user to restart the computer or remove and re-insert the device.
--enable-yum \
--enable-zif \
%if 0%{?rhel} == 0
- --enable-smart \
+ --disable-smart \
--enable-introspection \
%endif
--with-default-backend=yum,zif \
--disable-local \
- --disable-ruck \
--disable-strict \
--disable-tests
@@ -356,9 +355,9 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%if 0%{?rhel} == 0
%files smart
%defattr(-,root,root,-)
-%{_libdir}/packagekit-backend/libpk_backend_smart.so
-%dir %{_datadir}/PackageKit/helpers/smart
-%{_datadir}/PackageKit/helpers/smart/*
+#%{_libdir}/packagekit-backend/libpk_backend_smart.so
+#%dir %{_datadir}/PackageKit/helpers/smart
+#%{_datadir}/PackageKit/helpers/smart/*
%endif
%files yum
commit 19a0a0f48b3dcd024899bdb40bcbfafc474e6575
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Jul 13 10:48:35 2011 +0100
trivial: Remove egg-string and move the shared stuff to pk-shared
diff --git a/contrib/command-not-found/Makefile.am b/contrib/command-not-found/Makefile.am
index 69930ff..200e526 100644
--- a/contrib/command-not-found/Makefile.am
+++ b/contrib/command-not-found/Makefile.am
@@ -21,8 +21,6 @@ PK_GLIB2_LIBS = \
$(NULL)
pk_command_not_found_SOURCES = \
- egg-string.c \
- egg-string.h \
pk-command-not-found.c \
$(NULL)
diff --git a/contrib/command-not-found/egg-string.c b/contrib/command-not-found/egg-string.c
deleted file mode 120000
index da9b4c3..0000000
--- a/contrib/command-not-found/egg-string.c
+++ /dev/null
@@ -1 +0,0 @@
-../../src/egg-string.c
\ No newline at end of file
diff --git a/contrib/command-not-found/egg-string.h b/contrib/command-not-found/egg-string.h
deleted file mode 120000
index 6186dac..0000000
--- a/contrib/command-not-found/egg-string.h
+++ /dev/null
@@ -1 +0,0 @@
-../../src/egg-string.h
\ No newline at end of file
diff --git a/contrib/command-not-found/pk-command-not-found.c b/contrib/command-not-found/pk-command-not-found.c
index 8ec959d..e10b15c 100644
--- a/contrib/command-not-found/pk-command-not-found.c
+++ b/contrib/command-not-found/pk-command-not-found.c
@@ -32,8 +32,6 @@
#include <packagekit-glib2/packagekit.h>
#include <packagekit-glib2/packagekit-private.h>
-#include "egg-string.h"
-
#define PK_MAX_PATH_LEN 1023
typedef enum {
@@ -717,7 +715,7 @@ main (int argc, char *argv[])
cancellable = g_cancellable_new ();
/* get length */
- len = egg_strlen (argv[1], 1024);
+ len = strlen (argv[1]);
if (len < 1) {
retval = EXIT_COMMAND_NOT_FOUND;
goto out;
diff --git a/src/Makefile.am b/src/Makefile.am
index 2a5b7b1..a1f2553 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -51,8 +51,6 @@ plugininclude_HEADERS = \
pk-transaction.h
shared_SOURCES = \
- egg-string.c \
- egg-string.h \
pk-marshal.c \
pk-marshal.h \
pk-dbus.c \
diff --git a/src/egg-string.c b/src/egg-string.c
deleted file mode 100644
index b9041a5..0000000
--- a/src/egg-string.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007-2008 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-/**
- * SECTION:pk-common
- * @short_description: Common utility functions for PackageKit
- *
- * This file contains functions that may be useful.
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <string.h>
-#include <sys/types.h>
-#include <sys/utsname.h>
-#include <sys/stat.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif /* HAVE_UNISTD_H */
-
-#include <glib.h>
-
-#include "egg-string.h"
-
-/**
- * egg_strtoint:
- * @text: The text the convert
- * @value: The return numeric return value
- *
- * Converts a string into a signed integer value in a safe way.
- *
- * Return value: %TRUE if the string was converted correctly
- **/
-gboolean
-egg_strtoint (const gchar *text, gint *value)
-{
- gchar *endptr = NULL;
- gint64 value_raw;
-
- /* invalid */
- if (text == NULL)
- return FALSE;
-
- /* parse */
- value_raw = g_ascii_strtoll (text, &endptr, 10);
-
- /* parsing error */
- if (endptr == text)
- return FALSE;
-
- /* out of range */
- if (value_raw > G_MAXINT || value_raw < G_MININT)
- return FALSE;
-
- /* cast back down to value */
- *value = (gint) value_raw;
- return TRUE;
-}
-
-/**
- * egg_strtouint64:
- * @text: The text the convert
- * @value: The return numeric return value
- *
- * Converts a string into a unsigned integer value in a safe way.
- *
- * Return value: %TRUE if the string was converted correctly
- **/
-gboolean
-egg_strtouint64 (const gchar *text, guint64 *value)
-{
- gchar *endptr = NULL;
-
- /* invalid */
- if (text == NULL)
- return FALSE;
-
- /* parse */
- *value = g_ascii_strtoull (text, &endptr, 10);
- if (endptr == text)
- return FALSE;
-
- return TRUE;
-}
-
-/**
- * egg_strtouint:
- * @text: The text the convert
- * @value: The return numeric return value
- *
- * Converts a string into a unsigned integer value in a safe way.
- *
- * Return value: %TRUE if the string was converted correctly
- **/
-gboolean
-egg_strtouint (const gchar *text, guint *value)
-{
- gboolean ret;
- guint64 value_raw;
-
- ret = egg_strtouint64 (text, &value_raw);
- if (!ret)
- return FALSE;
-
- /* out of range */
- if (value_raw > G_MAXUINT)
- return FALSE;
-
- /* cast back down to value */
- *value = (guint) value_raw;
- return TRUE;
-}
-
-/**
- * egg_strzero:
- * @text: The text to check
- *
- * This function is a much safer way of doing "if (strlen (text) == 0))"
- * as it does not rely on text being NULL terminated. It's also much
- * quicker as it only checks the first byte rather than scanning the whole
- * string just to verify it's not zero length.
- *
- * Return value: %TRUE if the string was converted correctly
- **/
-gboolean
-egg_strzero (const gchar *text)
-{
- if (text == NULL)
- return TRUE;
- if (text[0] == '\0')
- return TRUE;
- return FALSE;
-}
-
-/**
- * egg_strlen:
- * @text: The text to check
- * @len: The maximum length of the string
- *
- * This function is a much safer way of doing strlen as it checks for NULL and
- * a stupidly long string.
- *
- * Return value: the length of the string, or len if the string is too long.
- **/
-guint
-egg_strlen (const gchar *text, guint len)
-{
- guint i;
-
- /* common case */
- if (text == NULL || text[0] == '\0')
- return 0;
-
- /* only count up to len */
- for (i=1; i<len; i++) {
- if (text[i] == '\0')
- break;
- }
- return i;
-}
-
-/**
- * egg_strvequal:
- * @id1: the first item of text to test
- * @id2: the second item of text to test
- *
- * This function will check to see if the GStrv arrays are string equal
- *
- * Return value: %TRUE if the arrays are the same, or are both %NULL
- **/
-gboolean
-egg_strvequal (gchar **id1, gchar **id2)
-{
- guint i;
- guint length1;
- guint length2;
-
- if (id1 == NULL && id2 == NULL)
- return TRUE;
-
- if (id1 == NULL || id2 == NULL) {
- g_debug ("GStrv compare invalid '%p' and '%p'", id1, id2);
- return FALSE;
- }
-
- /* check different sizes */
- length1 = g_strv_length (id1);
- length2 = g_strv_length (id2);
- if (length1 != length2)
- return FALSE;
-
- /* text equal each one */
- for (i=0; i<length1; i++) {
- if (g_strcmp0 (id1[i], id2[i]) != 0)
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- * egg_strreplace:
- * @text: The input text to make safe
- * @find: What to search for
- * @replace: What to replace with
- *
- * Replaces chars in the text with a replacement.
- * The %find and %replace variables to not have to be of the same length
- *
- * Return value: the new string (copied)
- **/
-gchar *
-egg_strreplace (const gchar *text, const gchar *find, const gchar *replace)
-{
- gchar **array;
- gchar *retval;
-
- /* common case, not found */
- if (g_strstr_len (text, -1, find) == NULL) {
- return g_strdup (text);
- }
-
- /* split apart and rejoin with new delimiter */
- array = g_strsplit (text, find, 0);
- retval = g_strjoinv (replace, array);
- g_strfreev (array);
- return retval;
-}
-
diff --git a/src/egg-string.h b/src/egg-string.h
deleted file mode 100644
index e28be4b..0000000
--- a/src/egg-string.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007-2008 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __EGG_STRING_H
-#define __EGG_STRING_H
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-guint egg_strlen (const gchar *text,
- guint len)
- G_GNUC_WARN_UNUSED_RESULT;
-gboolean egg_strzero (const gchar *text)
- G_GNUC_WARN_UNUSED_RESULT;
-gboolean egg_strvequal (gchar **id1,
- gchar **id2)
- G_GNUC_WARN_UNUSED_RESULT;
-gboolean egg_strtoint (const gchar *text,
- gint *value);
-gboolean egg_strtouint (const gchar *text,
- guint *value);
-gboolean egg_strtouint64 (const gchar *text,
- guint64 *value);
-gchar *egg_strreplace (const gchar *text,
- const gchar *find,
- const gchar *replace);
-void egg_string_test (gpointer user_data);
-
-G_END_DECLS
-
-#endif /* __EGG_STRING_H */
diff --git a/src/pk-backend-spawn.c b/src/pk-backend-spawn.c
index 73d3197..73c5241 100644
--- a/src/pk-backend-spawn.c
+++ b/src/pk-backend-spawn.c
@@ -42,8 +42,6 @@
#include <packagekit-glib2/pk-common.h>
#include <packagekit-glib2/pk-package-id.h>
-#include "egg-string.h"
-
#include "pk-backend.h"
#include "pk-backend-spawn.h"
#include "pk-marshal.h"
@@ -291,7 +289,7 @@ pk_backend_spawn_parse_stdout (PkBackendSpawn *backend_spawn, const gchar *line,
ret = FALSE;
goto out;
}
- ret = egg_strtoint (sections[1], &percentage);
+ ret = pk_strtoint (sections[1], &percentage);
if (!ret) {
g_set_error (error, 1, 0, "invalid percentage value %s", sections[1]);
ret = FALSE;
@@ -307,7 +305,7 @@ pk_backend_spawn_parse_stdout (PkBackendSpawn *backend_spawn, const gchar *line,
ret = FALSE;
goto out;
}
- ret = egg_strtoint (sections[1], &percentage);
+ ret = pk_strtoint (sections[1], &percentage);
if (!ret) {
g_set_error (error, 1, 0, "invalid subpercentage value %s", sections[1]);
ret = FALSE;
@@ -401,7 +399,7 @@ pk_backend_spawn_parse_stdout (PkBackendSpawn *backend_spawn, const gchar *line,
ret = FALSE;
goto out;
}
- ret = egg_strtouint64 (sections[1], &speed);
+ ret = pk_strtouint64 (sections[1], &speed);
if (!ret) {
g_set_error (error, 1, 0,
"failed to parse speed: '%s'",
@@ -446,12 +444,12 @@ pk_backend_spawn_parse_stdout (PkBackendSpawn *backend_spawn, const gchar *line,
ret = FALSE;
goto out;
}
- if (egg_strzero (sections[1])) {
+ if (pk_strzero (sections[1])) {
g_set_error (error, 1, 0, "package_id blank, and hence ignored: '%s'", sections[1]);
ret = FALSE;
goto out;
}
- if (egg_strzero (sections[2])) {
+ if (pk_strzero (sections[2])) {
g_set_error (error, 1, 0, "repository name blank, and hence ignored: '%s'", sections[2]);
ret = FALSE;
goto out;
@@ -471,19 +469,19 @@ pk_backend_spawn_parse_stdout (PkBackendSpawn *backend_spawn, const gchar *line,
goto out;
}
- if (egg_strzero (sections[1])) {
+ if (pk_strzero (sections[1])) {
g_set_error (error, 1, 0, "eula_id blank, and hence ignored: '%s'", sections[1]);
ret = FALSE;
goto out;
}
- if (egg_strzero (sections[2])) {
+ if (pk_strzero (sections[2])) {
g_set_error (error, 1, 0, "package_id blank, and hence ignored: '%s'", sections[2]);
ret = FALSE;
goto out;
}
- if (egg_strzero (sections[4])) {
+ if (pk_strzero (sections[4])) {
g_set_error (error, 1, 0, "agreement name blank, and hence ignored: '%s'", sections[4]);
ret = FALSE;
goto out;
@@ -538,17 +536,17 @@ pk_backend_spawn_parse_stdout (PkBackendSpawn *backend_spawn, const gchar *line,
ret = FALSE;
goto out;
}
- if (egg_strzero (sections[2])) {
+ if (pk_strzero (sections[2])) {
g_set_error_literal (error, 1, 0, "cat_id cannot not blank");
ret = FALSE;
goto out;
}
- if (egg_strzero (sections[3])) {
+ if (pk_strzero (sections[3])) {
g_set_error_literal (error, 1, 0, "name cannot not blank");
ret = FALSE;
goto out;
}
- if (egg_strzero (sections[5])) {
+ if (pk_strzero (sections[5])) {
g_set_error_literal (error, 1, 0, "icon cannot not blank");
ret = FALSE;
goto out;
@@ -739,7 +737,7 @@ pk_backend_spawn_get_envp (PkBackendSpawn *backend_spawn)
/* http_proxy */
proxy_http = pk_backend_get_proxy_http (priv->backend);
- if (!egg_strzero (proxy_http)) {
+ if (!pk_strzero (proxy_http)) {
uri = pk_backend_spawn_convert_uri (proxy_http);
line = g_strdup_printf ("%s=%s", "http_proxy", uri);
g_ptr_array_add (array, line);
@@ -748,7 +746,7 @@ pk_backend_spawn_get_envp (PkBackendSpawn *backend_spawn)
/* https_proxy */
proxy_https = pk_backend_get_proxy_https (priv->backend);
- if (!egg_strzero (proxy_https)) {
+ if (!pk_strzero (proxy_https)) {
uri = pk_backend_spawn_convert_uri (proxy_https);
line = g_strdup_printf ("%s=%s", "https_proxy", uri);
g_ptr_array_add (array, line);
@@ -757,7 +755,7 @@ pk_backend_spawn_get_envp (PkBackendSpawn *backend_spawn)
/* ftp_proxy */
proxy_ftp = pk_backend_get_proxy_ftp (priv->backend);
- if (!egg_strzero (proxy_ftp)) {
+ if (!pk_strzero (proxy_ftp)) {
uri = pk_backend_spawn_convert_uri (proxy_ftp);
line = g_strdup_printf ("%s=%s", "ftp_proxy", uri);
g_ptr_array_add (array, line);
@@ -766,7 +764,7 @@ pk_backend_spawn_get_envp (PkBackendSpawn *backend_spawn)
/* socks_proxy */
proxy_socks = pk_backend_get_proxy_socks (priv->backend);
- if (!egg_strzero (proxy_socks)) {
+ if (!pk_strzero (proxy_socks)) {
uri = pk_backend_spawn_convert_uri (proxy_socks);
line = g_strdup_printf ("%s=%s", "socks_proxy", uri);
g_ptr_array_add (array, line);
@@ -775,7 +773,7 @@ pk_backend_spawn_get_envp (PkBackendSpawn *backend_spawn)
/* no_proxy */
no_proxy = pk_backend_get_no_proxy (priv->backend);
- if (!egg_strzero (no_proxy)) {
+ if (!pk_strzero (no_proxy)) {
uri = pk_backend_spawn_convert_uri (no_proxy);
line = g_strdup_printf ("%s=%s", "no_proxy", uri);
g_ptr_array_add (array, line);
@@ -784,7 +782,7 @@ pk_backend_spawn_get_envp (PkBackendSpawn *backend_spawn)
/* pac */
pac = pk_backend_get_pac (priv->backend);
- if (!egg_strzero (pac)) {
+ if (!pk_strzero (pac)) {
uri = pk_backend_spawn_convert_uri (pac);
line = g_strdup_printf ("%s=%s", "pac", uri);
g_ptr_array_add (array, line);
@@ -793,14 +791,14 @@ pk_backend_spawn_get_envp (PkBackendSpawn *backend_spawn)
/* LANG */
locale = pk_backend_get_locale (priv->backend);
- if (!egg_strzero (locale)) {
+ if (!pk_strzero (locale)) {
line = g_strdup_printf ("%s=%s", "LANG", locale);
g_ptr_array_add (array, line);
}
/* ROOT */
value = pk_backend_get_root (priv->backend);
- if (!egg_strzero (value)) {
+ if (!pk_strzero (value)) {
line = g_strdup_printf ("%s=%s", "ROOT", value);
g_ptr_array_add (array, line);
}
diff --git a/src/pk-backend.c b/src/pk-backend.c
index a1508c0..e636399 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -35,8 +35,6 @@
#include <packagekit-glib2/pk-results.h>
#include <packagekit-glib2/pk-common.h>
-#include "egg-string.h"
-
#include "pk-conf.h"
#include "pk-network.h"
#include "pk-marshal.h"
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 4138377..6541ac7 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -44,8 +44,6 @@
#include <polkit/polkit.h>
#endif
-#include "egg-string.h"
-
#include "pk-backend.h"
#include "pk-cache.h"
#include "pk-conf.h"
@@ -768,7 +766,7 @@ pk_engine_set_proxy (PkEngine *engine,
g_debug ("SetProxy method called: %s, %s", proxy_http, proxy_ftp);
/* check length of http */
- len = egg_strlen (proxy_http, 1024);
+ len = pk_strlen (proxy_http, 1024);
if (len == 1024) {
error = g_error_new_literal (PK_ENGINE_ERROR,
PK_ENGINE_ERROR_CANNOT_SET_PROXY,
@@ -778,7 +776,7 @@ pk_engine_set_proxy (PkEngine *engine,
}
/* check length of ftp */
- len = egg_strlen (proxy_ftp, 1024);
+ len = pk_strlen (proxy_ftp, 1024);
if (len == 1024) {
error = g_error_new_literal (PK_ENGINE_ERROR,
PK_ENGINE_ERROR_CANNOT_SET_PROXY,
@@ -1032,7 +1030,7 @@ pk_engine_set_root (PkEngine *engine, const gchar *root, DBusGMethodInvocation *
g_debug ("SetRoot method called: %s", root);
/* check length of root */
- len = egg_strlen (root, 1024);
+ len = pk_strlen (root, 1024);
if (len == 1024) {
error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_CANNOT_SET_ROOT, "root was too long: %s", root);
dbus_g_method_return_error (context, error);
diff --git a/src/pk-network-stack-unix.c b/src/pk-network-stack-unix.c
index d0c0e9a..21a1788 100644
--- a/src/pk-network-stack-unix.c
+++ b/src/pk-network-stack-unix.c
@@ -37,8 +37,6 @@
#include <glib-object.h>
#include <gio/gio.h>
-#include "egg-string.h"
-
#include "pk-network-stack-unix.h"
#include "pk-marshal.h"
#include "pk-conf.h"
@@ -67,7 +65,7 @@ pk_network_stack_unix_is_valid (const gchar *line)
guint number_sections;
/* empty line */
- if (egg_strzero (line))
+ if (line == NULL || line[0] == '\0')
goto out;
/* tab delimited */
diff --git a/src/pk-shared.c b/src/pk-shared.c
index 99a9998..cc55726 100644
--- a/src/pk-shared.c
+++ b/src/pk-shared.c
@@ -110,3 +110,141 @@ pk_hint_enum_from_string (const gchar *hint)
return PK_HINT_ENUM_UNSET;
return PK_HINT_ENUM_UNSET;
}
+
+
+/**
+ * pk_strtoint:
+ * @text: The text the convert
+ * @value: The return numeric return value
+ *
+ * Converts a string into a signed integer value in a safe way.
+ *
+ * Return value: %TRUE if the string was converted correctly
+ **/
+gboolean
+pk_strtoint (const gchar *text, gint *value)
+{
+ gchar *endptr = NULL;
+ gint64 value_raw;
+
+ /* invalid */
+ if (text == NULL)
+ return FALSE;
+
+ /* parse */
+ value_raw = g_ascii_strtoll (text, &endptr, 10);
+
+ /* parsing error */
+ if (endptr == text)
+ return FALSE;
+
+ /* out of range */
+ if (value_raw > G_MAXINT || value_raw < G_MININT)
+ return FALSE;
+
+ /* cast back down to value */
+ *value = (gint) value_raw;
+ return TRUE;
+}
+
+/**
+ * pk_strtouint64:
+ * @text: The text the convert
+ * @value: The return numeric return value
+ *
+ * Converts a string into a unsigned integer value in a safe way.
+ *
+ * Return value: %TRUE if the string was converted correctly
+ **/
+gboolean
+pk_strtouint64 (const gchar *text, guint64 *value)
+{
+ gchar *endptr = NULL;
+
+ /* invalid */
+ if (text == NULL)
+ return FALSE;
+
+ /* parse */
+ *value = g_ascii_strtoull (text, &endptr, 10);
+ if (endptr == text)
+ return FALSE;
+
+ return TRUE;
+}
+
+/**
+ * pk_strtouint:
+ * @text: The text the convert
+ * @value: The return numeric return value
+ *
+ * Converts a string into a unsigned integer value in a safe way.
+ *
+ * Return value: %TRUE if the string was converted correctly
+ **/
+gboolean
+pk_strtouint (const gchar *text, guint *value)
+{
+ gboolean ret;
+ guint64 value_raw;
+
+ ret = pk_strtouint64 (text, &value_raw);
+ if (!ret)
+ return FALSE;
+
+ /* out of range */
+ if (value_raw > G_MAXUINT)
+ return FALSE;
+
+ /* cast back down to value */
+ *value = (guint) value_raw;
+ return TRUE;
+}
+
+/**
+ * pk_strzero:
+ * @text: The text to check
+ *
+ * This function is a much safer way of doing "if (strlen (text) == 0))"
+ * as it does not rely on text being NULL terminated. It's also much
+ * quicker as it only checks the first byte rather than scanning the whole
+ * string just to verify it's not zero length.
+ *
+ * Return value: %TRUE if the string was converted correctly
+ **/
+gboolean
+pk_strzero (const gchar *text)
+{
+ if (text == NULL)
+ return TRUE;
+ if (text[0] == '\0')
+ return TRUE;
+ return FALSE;
+}
+
+/**
+ * pk_strlen:
+ * @text: The text to check
+ * @len: The maximum length of the string
+ *
+ * This function is a much safer way of doing strlen as it checks for NULL and
+ * a stupidly long string.
+ *
+ * Return value: the length of the string, or len if the string is too long.
+ **/
+guint
+pk_strlen (const gchar *text, guint len)
+{
+ guint i;
+
+ /* common case */
+ if (text == NULL || text[0] == '\0')
+ return 0;
+
+ /* only count up to len */
+ for (i=1; i<len; i++) {
+ if (text[i] == '\0')
+ break;
+ }
+ return i;
+}
diff --git a/src/pk-shared.h b/src/pk-shared.h
index 4048580..5e2fcce 100644
--- a/src/pk-shared.h
+++ b/src/pk-shared.h
@@ -37,7 +37,19 @@ typedef enum {
gboolean pk_directory_remove_contents (const gchar *directory);
const gchar *pk_hint_enum_to_string (PkHintEnum hint);
-PkHintEnum pk_hint_enum_from_string (const gchar *hint);
+PkHintEnum pk_hint_enum_from_string (const gchar *hint);
+
+guint pk_strlen (const gchar *text,
+ guint len)
+ G_GNUC_WARN_UNUSED_RESULT;
+gboolean pk_strzero (const gchar *text)
+ G_GNUC_WARN_UNUSED_RESULT;
+gboolean pk_strtoint (const gchar *text,
+ gint *value);
+gboolean pk_strtouint (const gchar *text,
+ guint *value);
+gboolean pk_strtouint64 (const gchar *text,
+ guint64 *value);
G_END_DECLS
diff --git a/src/pk-spawn.c b/src/pk-spawn.c
index 6e26f53..2a6acfb 100644
--- a/src/pk-spawn.c
+++ b/src/pk-spawn.c
@@ -42,10 +42,9 @@
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
-#include "egg-string.h"
-
#include "pk-spawn.h"
#include "pk-marshal.h"
+#include "pk-shared.h"
#include "pk-conf.h"
#include "pk-sysdep.h"
@@ -125,7 +124,7 @@ pk_spawn_emit_whole_lines (PkSpawn *spawn, GString *string)
guint bytes_processed;
/* if nothing then don't emit */
- if (egg_strzero (string->str))
+ if (pk_strzero (string->str))
return FALSE;
/* split into lines - the last line may be incomplete */
@@ -484,6 +483,39 @@ out:
}
/**
+ * pk_strvequal:
+ **/
+static gboolean
+pk_strvequal (gchar **id1, gchar **id2)
+{
+ guint i;
+ guint length1;
+ guint length2;
+
+ if (id1 == NULL && id2 == NULL)
+ return TRUE;
+
+ if (id1 == NULL || id2 == NULL) {
+ g_debug ("GStrv compare invalid '%p' and '%p'", id1, id2);
+ return FALSE;
+ }
+
+ /* check different sizes */
+ length1 = g_strv_length (id1);
+ length2 = g_strv_length (id2);
+ if (length1 != length2)
+ return FALSE;
+
+ /* text equal each one */
+ for (i=0; i<length1; i++) {
+ if (g_strcmp0 (id1[i], id2[i]) != 0)
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/**
* pk_spawn_argv:
* @argv: Can be generated using g_strsplit (command, " ", 0)
* if there are no spaces in the filename
@@ -527,7 +559,7 @@ pk_spawn_argv (PkSpawn *spawn, gchar **argv, gchar **envp, GError **error)
if (spawn->priv->stdin_fd != -1) {
if (g_strcmp0 (spawn->priv->last_argv0, argv[0]) != 0) {
g_debug ("argv did not match, not reusing");
- } else if (!egg_strvequal (spawn->priv->last_envp, envp)) {
+ } else if (!pk_strvequal (spawn->priv->last_envp, envp)) {
g_debug ("envp did not match, not reusing");
} else {
/* join with tabs, as spaces could be in file name */
diff --git a/src/pk-store.c b/src/pk-store.c
index cd3204a..7ff5b76 100644
--- a/src/pk-store.c
+++ b/src/pk-store.c
@@ -25,8 +25,6 @@
#include <glib.h>
-#include "egg-string.h"
-
#include "pk-store.h"
#define PK_STORE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_STORE, PkStorePrivate))
diff --git a/src/pk-transaction-db.c b/src/pk-transaction-db.c
index a3d179d..97b8e95 100644
--- a/src/pk-transaction-db.c
+++ b/src/pk-transaction-db.c
@@ -39,7 +39,7 @@
#include <packagekit-glib2/pk-results.h>
#include <packagekit-glib2/pk-common.h>
-#include "egg-string.h"
+#include "pk-shared.h"
#include "pk-transaction-db.h"
@@ -97,7 +97,7 @@ pk_transaction_sqlite_transaction_cb (void *data, gint argc, gchar **argv, gchar
col = col_name[i];
value = argv[i];
if (g_strcmp0 (col, "succeeded") == 0) {
- ret = egg_strtouint (value, &temp);
+ ret = pk_strtouint (value, &temp);
if (!ret)
g_warning ("failed to parse succeeded: %s", value);
if (temp == 1)
@@ -120,11 +120,11 @@ pk_transaction_sqlite_transaction_cb (void *data, gint argc, gchar **argv, gchar
if (value != NULL)
g_object_set (item, "data", value, NULL);
} else if (g_strcmp0 (col, "uid") == 0) {
- ret = egg_strtouint (value, &temp);
+ ret = pk_strtouint (value, &temp);
if (ret)
g_object_set (item, "uid", temp, NULL);
} else if (g_strcmp0 (col, "duration") == 0) {
- ret = egg_strtouint (value, &temp);
+ ret = pk_strtouint (value, &temp);
if (!ret) {
g_warning ("failed to parse duration: %s", value);
} else if (temp > 60*60*12) {
@@ -478,7 +478,7 @@ pk_transaction_sqlite_job_id_cb (void *data, gint argc, gchar **argv, gchar **co
g_warning ("wrong number of replies: %i", argc);
goto out;
}
- egg_strtouint (argv[0], &tdb->priv->job_count);
+ pk_strtouint (argv[0], &tdb->priv->job_count);
out:
return 0;
}
@@ -921,7 +921,7 @@ pk_transaction_db_init (PkTransactionDb *tdb)
/* get the old job count from the text file (this is a legacy file) */
ret = g_file_get_contents (PK_TRANSACTION_DB_ID_FILE_OBSOLETE, &text, NULL, NULL);
if (ret)
- egg_strtouint (text, &tdb->priv->job_count);
+ pk_strtouint (text, &tdb->priv->job_count);
g_free (text);
/* save job id */
diff --git a/src/pk-transaction-list.c b/src/pk-transaction-list.c
index a237878..f4c1191 100644
--- a/src/pk-transaction-list.c
+++ b/src/pk-transaction-list.c
@@ -39,8 +39,6 @@
#include <dbus/dbus-glib-lowlevel.h>
#include <packagekit-glib2/pk-common.h>
-#include "egg-string.h"
-
#include "pk-conf.h"
#include "pk-transaction-dbus.h"
#include "pk-transaction-list.h"
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index b8ce96f..192a2d2 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -52,8 +52,6 @@
#include <polkit/polkit.h>
#endif
-#include "egg-string.h"
-
#include "pk-backend.h"
#include "pk-cache.h"
#include "pk-conf.h"
@@ -1030,7 +1028,7 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
/* save to database */
packages = pk_transaction_package_list_to_string (array);
- if (!egg_strzero (packages))
+ if (!pk_strzero (packages))
pk_transaction_db_set_data (transaction->priv->transaction_db, transaction->priv->tid, packages);
/* report to syslog */
@@ -2117,7 +2115,7 @@ pk_transaction_strvalidate (const gchar *text, GError **error)
guint length;
/* maximum size is 1024 */
- length = egg_strlen (text, 1024);
+ length = pk_strlen (text, 1024);
if (length > 1024) {
g_set_error (error, PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_INPUT_INVALID,
"Invalid input passed to daemon: input too long: %u", length);
@@ -2144,7 +2142,7 @@ pk_transaction_search_check_item (const gchar *values, GError **error)
gboolean ret;
/* limit to a 1k chunk */
- size = egg_strlen (values, 1024);
+ size = pk_strlen (values, 1024);
if (values == NULL) {
g_set_error_literal (error, PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_SEARCH_INVALID,
@@ -2210,7 +2208,7 @@ pk_transaction_filter_check (const gchar *filter, GError **error)
g_return_val_if_fail (error != NULL, FALSE);
/* is zero? */
- if (egg_strzero (filter)) {
+ if (pk_strzero (filter)) {
g_set_error_literal (error, PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_INPUT_INVALID,
"filter zero length");
goto out;
@@ -2226,7 +2224,7 @@ pk_transaction_filter_check (const gchar *filter, GError **error)
length = g_strv_length (sections);
for (i=0; i<length; i++) {
/* only one wrong part is enough to fail the filter */
- if (egg_strzero (sections[i])) {
+ if (pk_strzero (sections[i])) {
ret = FALSE;
g_set_error (error, PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_INPUT_INVALID,
"Single empty section of filter: %s", filter);
@@ -4777,7 +4775,7 @@ pk_transaction_set_hint (PkTransaction *transaction, const gchar *key, const gch
/* cache-age=<time-in-seconds> */
if (g_strcmp0 (key, "cache-age") == 0) {
- ret = egg_strtouint (value, &priv->cache_age);
+ ret = pk_strtouint (value, &priv->cache_age);
if (!ret) {
priv->cache_age = G_MAXUINT;
g_set_error (error, PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
diff --git a/src/plugins/pk-proc.c b/src/plugins/pk-proc.c
index fe12cf9..11690fc 100644
--- a/src/plugins/pk-proc.c
+++ b/src/plugins/pk-proc.c
@@ -95,10 +95,10 @@ out:
}
/**
- * egg_strtoint:
+ * pk_strtoint:
**/
static gboolean
-egg_strtoint (const gchar *text, gint *value)
+pk_strtoint (const gchar *text, gint *value)
{
gchar *endptr = NULL;
gint64 value_raw;
@@ -175,7 +175,7 @@ pk_proc_refresh_add_file (PkProc *proc, const gchar *pid_text, const gchar *path
}
/* parse PID */
- ret = egg_strtoint (pid_text, &pid);
+ ret = pk_strtoint (pid_text, &pid);
if (!ret)
goto out;
@@ -192,7 +192,7 @@ pk_proc_refresh_add_file (PkProc *proc, const gchar *pid_text, const gchar *path
goto out;
/* parse UID */
- ret = egg_strtoint (contents, &uid);
+ ret = pk_strtoint (contents, &uid);
if (!ret)
goto out;
commit 4b74f496ad4d4e2243caae9a841450aa59350489
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Jul 13 09:51:24 2011 +0100
Remove PkFileMonitor, we can now use GFileMonitor
diff --git a/src/Makefile.am b/src/Makefile.am
index a1d0703..2a5b7b1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -88,8 +88,6 @@ shared_SOURCES = \
pk-spawn.h \
pk-sysdep.h \
pk-sysdep.c \
- pk-file-monitor.h \
- pk-file-monitor.c \
pk-engine.h \
pk-engine.c \
pk-inhibit.h \
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 53fe435..a1508c0 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -45,7 +45,6 @@
#include "pk-store.h"
#include "pk-shared.h"
#include "pk-time.h"
-#include "pk-file-monitor.h"
#include "pk-notify.h"
#define PK_BACKEND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_BACKEND, PkBackendPrivate))
@@ -129,7 +128,7 @@ struct PkBackendPrivate
PkBitfield roles;
PkConf *conf;
PkExitEnum exit;
- PkFileMonitor *file_monitor;
+ GFileMonitor *monitor;
PkPackage *last_package;
PkNetwork *network;
PkResults *results;
@@ -2694,12 +2693,32 @@ out:
}
/**
+ * pk_backend_file_monitor_changed_cb:
+ **/
+static void
+pk_backend_file_monitor_changed_cb (GFileMonitor *monitor,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event_type,
+ PkBackend *backend)
+{
+ g_return_if_fail (PK_IS_BACKEND (backend));
+ g_debug ("config file changed");
+ backend->priv->file_changed_func (backend, backend->priv->file_changed_data);
+}
+
+/**
* pk_backend_watch_file:
*/
gboolean
-pk_backend_watch_file (PkBackend *backend, const gchar *filename, PkBackendFileChanged func, gpointer data)
+pk_backend_watch_file (PkBackend *backend,
+ const gchar *filename,
+ PkBackendFileChanged func,
+ gpointer data)
{
- gboolean ret;
+ gboolean ret = FALSE;
+ GError *error = NULL;
+ GFile *file = NULL;
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
g_return_val_if_fail (filename != NULL, FALSE);
@@ -2707,27 +2726,33 @@ pk_backend_watch_file (PkBackend *backend, const gchar *filename, PkBackendFileC
if (backend->priv->file_changed_func != NULL) {
g_warning ("already set");
- return FALSE;
+ goto out;
}
- ret = pk_file_monitor_set_file (backend->priv->file_monitor, filename);;
- /* if we set it up, set the function callback */
- if (ret) {
- backend->priv->file_changed_func = func;
- backend->priv->file_changed_data = data;
+ /* monitor config files for changes */
+ file = g_file_new_for_path (filename);
+ backend->priv->monitor = g_file_monitor_file (file,
+ G_FILE_MONITOR_NONE,
+ NULL,
+ &error);
+ if (backend->priv->monitor == NULL) {
+ g_warning ("Failed to set watch on %s: %s",
+ filename,
+ error->message);
+ g_error_free (error);
+ goto out;
}
- return ret;
-}
-/**
- * pk_backend_file_monitor_changed_cb:
- **/
-static void
-pk_backend_file_monitor_changed_cb (PkFileMonitor *file_monitor, PkBackend *backend)
-{
- g_return_if_fail (PK_IS_BACKEND (backend));
- g_debug ("config file changed");
- backend->priv->file_changed_func (backend, backend->priv->file_changed_data);
+ /* success */
+ ret = TRUE;
+ g_signal_connect (backend->priv->monitor, "changed",
+ G_CALLBACK (pk_backend_file_monitor_changed_cb), backend);
+ backend->priv->file_changed_func = func;
+ backend->priv->file_changed_data = data;
+out:
+ if (file != NULL)
+ g_object_unref (file);
+ return ret;
}
/**
@@ -3047,6 +3072,12 @@ pk_backend_reset (PkBackend *backend)
g_object_unref (backend->priv->results);
backend->priv->results = pk_results_new ();
+ /* clear monitor */
+ if (backend->priv->monitor != NULL) {
+ g_object_unref (backend->priv->monitor);
+ backend->priv->monitor = NULL;
+ }
+
return TRUE;
}
@@ -3517,24 +3548,6 @@ pk_backend_init (PkBackend *backend)
PkConf *conf;
backend->priv = PK_BACKEND_GET_PRIVATE (backend);
- backend->priv->handle = NULL;
- backend->priv->name = NULL;
- backend->priv->locale = NULL;
- backend->priv->frontend_socket = NULL;
- backend->priv->cache_age = 0;
- backend->priv->transaction_id = NULL;
- backend->priv->root = NULL;
- backend->priv->file_changed_func = NULL;
- backend->priv->file_changed_data = NULL;
- backend->priv->last_package = NULL;
- backend->priv->locked = FALSE;
- backend->priv->use_threads = FALSE;
- backend->priv->signal_finished = 0;
- backend->priv->speed = 0;
- backend->priv->signal_error_timeout = 0;
- backend->priv->during_initialize = FALSE;
- backend->priv->simultaneous = FALSE;
- backend->priv->roles = 0;
backend->priv->conf = pk_conf_new ();
backend->priv->results = pk_results_new ();
backend->priv->store = pk_store_new ();
@@ -3542,11 +3555,6 @@ pk_backend_init (PkBackend *backend)
backend->priv->network = pk_network_new ();
backend->priv->eulas = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- /* monitor config files for changes */
- backend->priv->file_monitor = pk_file_monitor_new ();
- g_signal_connect (backend->priv->file_monitor, "file-changed",
- G_CALLBACK (pk_backend_file_monitor_changed_cb), backend);
-
/* do we use time estimation? */
conf = pk_conf_new ();
backend->priv->use_time = pk_conf_get_bool (conf, "UseRemainingTimeEstimation");
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 5034b46..4138377 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -51,7 +51,6 @@
#include "pk-conf.h"
#include "pk-dbus.h"
#include "pk-engine.h"
-#include "pk-file-monitor.h"
#include "pk-inhibit.h"
#include "pk-marshal.h"
#include "pk-network.h"
@@ -82,8 +81,8 @@ struct PkEnginePrivate
PkNotify *notify;
PkConf *conf;
PkDbus *dbus;
- PkFileMonitor *file_monitor_conf;
- PkFileMonitor *file_monitor_binary;
+ GFileMonitor *monitor_conf;
+ GFileMonitor *monitor_binary;
PkBitfield roles;
PkBitfield groups;
PkBitfield filters;
@@ -1434,7 +1433,11 @@ pk_engine_class_init (PkEngineClass *klass)
* A config file has changed, we need to reload the daemon
**/
static void
-pk_engine_conf_file_changed_cb (PkFileMonitor *file_monitor, PkEngine *engine)
+pk_engine_conf_file_changed_cb (GFileMonitor *file_monitor,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event_type,
+ PkEngine *engine)
{
g_return_if_fail (PK_IS_ENGINE (engine));
g_debug ("setting shutdown_as_soon_as_possible TRUE");
@@ -1445,7 +1448,11 @@ pk_engine_conf_file_changed_cb (PkFileMonitor *file_monitor, PkEngine *engine)
* pk_engine_binary_file_changed_cb:
**/
static void
-pk_engine_binary_file_changed_cb (PkFileMonitor *file_monitor, PkEngine *engine)
+pk_engine_binary_file_changed_cb (GFileMonitor *file_monitor,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event_type,
+ PkEngine *engine)
{
g_return_if_fail (PK_IS_ENGINE (engine));
g_debug ("setting notify_clients_of_upgrade TRUE");
@@ -1616,6 +1623,58 @@ pk_engine_plugin_phase (PkEngine *engine,
}
/**
+ * pk_engine_setup_file_monitors:
+ **/
+static void
+pk_engine_setup_file_monitors (PkEngine *engine)
+{
+ GError *error = NULL;
+ GFile *file_conf = NULL;
+ GFile *file_binary = NULL;
+ gchar *filename = NULL;
+
+ /* monitor the binary file for changes */
+ file_binary = g_file_new_for_path (LIBEXECDIR "/packagekitd");
+ engine->priv->monitor_binary = g_file_monitor_file (file_binary,
+ G_FILE_MONITOR_NONE,
+ NULL,
+ &error);
+ if (engine->priv->monitor_binary == NULL) {
+ g_warning ("Failed to set watch on %s: %s",
+ LIBEXECDIR "/packagekitd",
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+ g_signal_connect (engine->priv->monitor_binary, "changed",
+ G_CALLBACK (pk_engine_binary_file_changed_cb), engine);
+
+ /* monitor config file for changes */
+ filename = pk_conf_get_filename ();
+ g_debug ("setting config file watch on %s", filename);
+ file_conf = g_file_new_for_path (filename);
+ engine->priv->monitor_conf = g_file_monitor_file (file_conf,
+ G_FILE_MONITOR_NONE,
+ NULL,
+ &error);
+ if (engine->priv->monitor_conf == NULL) {
+ g_warning ("Failed to set watch on %s: %s",
+ filename,
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+ g_signal_connect (engine->priv->monitor_conf, "changed",
+ G_CALLBACK (pk_engine_conf_file_changed_cb), engine);
+out:
+ g_free (filename);
+ if (file_conf != NULL)
+ g_object_unref (file_conf);
+ if (file_binary != NULL)
+ g_object_unref (file_binary);
+}
+
+/**
* pk_engine_init:
**/
static void
@@ -1636,14 +1695,6 @@ pk_engine_init (PkEngine *engine)
#endif
engine->priv = PK_ENGINE_GET_PRIVATE (engine);
- engine->priv->notify_clients_of_upgrade = FALSE;
- engine->priv->shutdown_as_soon_as_possible = FALSE;
- engine->priv->mime_types = NULL;
- engine->priv->backend_name = NULL;
- engine->priv->backend_description = NULL;
- engine->priv->backend_author = NULL;
- engine->priv->locked = FALSE;
- engine->priv->distro_id = NULL;
/* use the config file */
engine->priv->conf = pk_conf_new ();
@@ -1714,13 +1765,8 @@ pk_engine_init (PkEngine *engine)
g_signal_connect (engine->priv->notify, "updates-changed",
G_CALLBACK (pk_engine_notify_updates_changed_cb), engine);
- /* monitor the config file for changes */
- engine->priv->file_monitor_conf = pk_file_monitor_new ();
- filename = pk_conf_get_filename ();
- pk_file_monitor_set_file (engine->priv->file_monitor_conf, filename);
- g_signal_connect (engine->priv->file_monitor_conf, "file-changed",
- G_CALLBACK (pk_engine_conf_file_changed_cb), engine);
- g_free (filename);
+ /* setup file watches */
+ pk_engine_setup_file_monitors (engine);
#ifdef USE_SECURITY_POLKIT
/* protect the session SetProxy with a PolicyKit action */
@@ -1735,12 +1781,6 @@ pk_engine_init (PkEngine *engine)
#endif
#endif
- /* monitor the binary file for changes */
- engine->priv->file_monitor_binary = pk_file_monitor_new ();
- pk_file_monitor_set_file (engine->priv->file_monitor_binary, SBINDIR "/packagekitd");
- g_signal_connect (engine->priv->file_monitor_binary, "file-changed",
- G_CALLBACK (pk_engine_binary_file_changed_cb), engine);
-
/* set the default proxy */
proxy_http = pk_conf_get_string (engine->priv->conf, "ProxyHTTP");
proxy_https = pk_conf_get_string (engine->priv->conf, "ProxyHTTPS");
@@ -1837,8 +1877,8 @@ pk_engine_finalize (GObject *object)
/* compulsory gobjects */
g_timer_destroy (engine->priv->timer);
- g_object_unref (engine->priv->file_monitor_conf);
- g_object_unref (engine->priv->file_monitor_binary);
+ g_object_unref (engine->priv->monitor_conf);
+ g_object_unref (engine->priv->monitor_binary);
g_object_unref (engine->priv->inhibit);
g_object_unref (engine->priv->transaction_list);
g_object_unref (engine->priv->transaction_db);
diff --git a/src/pk-file-monitor.c b/src/pk-file-monitor.c
deleted file mode 100644
index c7b3552..0000000
--- a/src/pk-file-monitor.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <errno.h>
-#include <signal.h>
-
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif /* HAVE_UNISTD_H */
-
-#include <glib/gi18n.h>
-#include <gio/gio.h>
-
-#include "pk-conf.h"
-#include "pk-file-monitor.h"
-
-static void pk_file_monitor_finalize (GObject *object);
-
-#define PK_FILE_MONITOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_FILE_MONITOR, PkFileMonitorPrivate))
-#define PK_FILE_MONITOR_RATE_LIMIT 1000
-
-struct PkFileMonitorPrivate
-{
- GString *stdout_buf;
- GFileMonitor *monitor;
- GFile *file;
-};
-
-enum {
- PK_FILE_MONITOR_CHANGED,
- PK_FILE_MONITOR_LAST_SIGNAL
-};
-
-static guint signals [PK_FILE_MONITOR_LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE (PkFileMonitor, pk_file_monitor, G_TYPE_OBJECT)
-
-/**
- * pk_file_monitor_class_init:
- * @klass: The PkFileMonitorClass
- **/
-static void
-pk_file_monitor_class_init (PkFileMonitorClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = pk_file_monitor_finalize;
-
- signals [PK_FILE_MONITOR_CHANGED] =
- g_signal_new ("file-changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- g_type_class_add_private (klass, sizeof (PkFileMonitorPrivate));
-}
-
-/**
- * pk_file_monitor_monitor_changed:
- * @file_monitor: This class instance
- **/
-static void
-pk_file_monitor_monitor_changed (GFileMonitor *monitor, GFile *file, GFile *other_file,
- GFileMonitorEvent event_type, PkFileMonitor *file_monitor)
-{
- g_debug ("emit: file-changed");
- g_signal_emit (file_monitor, signals [PK_FILE_MONITOR_CHANGED], 0);
-}
-
-/**
- * pk_file_monitor_set_file:
- **/
-gboolean
-pk_file_monitor_set_file (PkFileMonitor *file_monitor, const gchar *filename)
-{
- GError *error = NULL;
-
- if (file_monitor->priv->file != NULL) {
- g_warning ("already set file monitor, so can't set %s", filename);
- return FALSE;
- }
-
- /* use a GFile */
- file_monitor->priv->file = g_file_new_for_path (filename);
-
- /* watch this */
- file_monitor->priv->monitor = g_file_monitor_file (file_monitor->priv->file, G_FILE_MONITOR_NONE, NULL, &error);
- if (file_monitor->priv->monitor == NULL) {
- g_warning ("failed to setup watch: %s", error->message);
- g_error_free (error);
- return FALSE;
- }
-
- /* we should get notified of changes */
- g_debug ("watching for changes: %s", filename);
- g_file_monitor_set_rate_limit (file_monitor->priv->monitor, PK_FILE_MONITOR_RATE_LIMIT);
- g_signal_connect (file_monitor->priv->monitor, "changed",
- G_CALLBACK (pk_file_monitor_monitor_changed), file_monitor);
- return TRUE;
-}
-
-/**
- * pk_file_monitor_init:
- * @file_monitor: This class instance
- **/
-static void
-pk_file_monitor_init (PkFileMonitor *file_monitor)
-{
- file_monitor->priv = PK_FILE_MONITOR_GET_PRIVATE (file_monitor);
- file_monitor->priv->file = NULL;
- file_monitor->priv->monitor = NULL;
-}
-
-/**
- * pk_file_monitor_finalize:
- * @object: The object to finalize
- **/
-static void
-pk_file_monitor_finalize (GObject *object)
-{
- PkFileMonitor *file_monitor;
-
- g_return_if_fail (PK_IS_FILE_MONITOR (object));
-
- file_monitor = PK_FILE_MONITOR (object);
- g_return_if_fail (file_monitor->priv != NULL);
-
- /* we might not have called pk_file_monitor_set_file */
- if (file_monitor->priv->monitor != NULL) {
- g_file_monitor_cancel (file_monitor->priv->monitor);
- g_object_unref (file_monitor->priv->monitor);
- }
- if (file_monitor->priv->file != NULL) {
- g_object_unref (file_monitor->priv->file);
- }
-
- G_OBJECT_CLASS (pk_file_monitor_parent_class)->finalize (object);
-}
-
-/**
- * pk_file_monitor_new:
- *
- * Return value: a new PkFileMonitor object.
- **/
-PkFileMonitor *
-pk_file_monitor_new (void)
-{
- PkFileMonitor *file_monitor;
- file_monitor = g_object_new (PK_TYPE_FILE_MONITOR, NULL);
- return PK_FILE_MONITOR (file_monitor);
-}
-
diff --git a/src/pk-file-monitor.h b/src/pk-file-monitor.h
deleted file mode 100644
index f8b6044..0000000
--- a/src/pk-file-monitor.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PK_FILE_MONITOR_H
-#define __PK_FILE_MONITOR_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define PK_TYPE_FILE_MONITOR (pk_file_monitor_get_type ())
-#define PK_FILE_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_FILE_MONITOR, PkFileMonitor))
-#define PK_FILE_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_FILE_MONITOR, PkFileMonitorClass))
-#define PK_IS_FILE_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_FILE_MONITOR))
-#define PK_IS_FILE_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_FILE_MONITOR))
-#define PK_FILE_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_FILE_MONITOR, PkFileMonitorClass))
-
-typedef struct PkFileMonitorPrivate PkFileMonitorPrivate;
-
-typedef struct
-{
- GObject parent;
- PkFileMonitorPrivate *priv;
-} PkFileMonitor;
-
-typedef struct
-{
- GObjectClass parent_class;
-} PkFileMonitorClass;
-
-GType pk_file_monitor_get_type (void);
-gboolean pk_file_monitor_set_file (PkFileMonitor *file_monitor,
- const gchar *filename);
-PkFileMonitor *pk_file_monitor_new (void);
-
-G_END_DECLS
-
-#endif /* __PK_FILE_MONITOR_H */
-
diff --git a/src/pk-network-stack-unix.c b/src/pk-network-stack-unix.c
index 54b9f65..d0c0e9a 100644
--- a/src/pk-network-stack-unix.c
+++ b/src/pk-network-stack-unix.c
@@ -35,19 +35,19 @@
#include <glib.h>
#include <glib-object.h>
+#include <gio/gio.h>
#include "egg-string.h"
#include "pk-network-stack-unix.h"
#include "pk-marshal.h"
#include "pk-conf.h"
-#include "pk-file-monitor.h"
struct PkNetworkStackUnixPrivate
{
PkConf *conf;
PkNetworkEnum state_old;
- PkFileMonitor *file_monitor;
+ GFileMonitor *monitor;
gboolean is_enabled;
};
@@ -168,7 +168,11 @@ out:
* pk_network_stack_unix_file_monitor_changed_cb:
**/
static void
-pk_network_stack_unix_file_monitor_changed_cb (PkFileMonitor *file_monitor, PkNetworkStackUnix *nstack_unix)
+pk_network_stack_unix_file_monitor_changed_cb (GFileMonitor *monitor,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event_type,
+ PkNetworkStackUnix *nstack_unix)
{
PkNetworkEnum state;
@@ -211,18 +215,33 @@ pk_network_stack_unix_is_enabled (PkNetworkStack *nstack)
static void
pk_network_stack_unix_init (PkNetworkStackUnix *nstack_unix)
{
+ GError *error = NULL;
+ GFile *file;
+
nstack_unix->priv = PK_NETWORK_STACK_UNIX_GET_PRIVATE (nstack_unix);
nstack_unix->priv->state_old = PK_NETWORK_ENUM_UNKNOWN;
nstack_unix->priv->conf = pk_conf_new ();
/* do we use this code? */
- nstack_unix->priv->is_enabled = pk_conf_get_bool (nstack_unix->priv->conf, "UseNetworkHeuristic");
-
- /* monitor the config file for changes */
- nstack_unix->priv->file_monitor = pk_file_monitor_new ();
- pk_file_monitor_set_file (nstack_unix->priv->file_monitor, PK_NETWORK_PROC_ROUTE);
- g_signal_connect (nstack_unix->priv->file_monitor, "file-changed",
- G_CALLBACK (pk_network_stack_unix_file_monitor_changed_cb), nstack_unix);
+ nstack_unix->priv->is_enabled = pk_conf_get_bool (nstack_unix->priv->conf,
+ "UseNetworkHeuristic");
+
+ /* monitor the route file for changes */
+ file = g_file_new_for_path (PK_NETWORK_PROC_ROUTE);
+ nstack_unix->priv->monitor = g_file_monitor_file (file,
+ G_FILE_MONITOR_NONE,
+ NULL,
+ &error);
+ if (nstack_unix->priv->monitor == NULL) {
+ g_warning ("Failed to set watch on %s: %s",
+ PK_NETWORK_PROC_ROUTE,
+ error->message);
+ g_error_free (error);
+ } else {
+ g_signal_connect (nstack_unix->priv->monitor, "changed",
+ G_CALLBACK (pk_network_stack_unix_file_monitor_changed_cb), nstack_unix);
+ }
+ g_object_unref (file);
}
/**
@@ -240,7 +259,7 @@ pk_network_stack_unix_finalize (GObject *object)
g_return_if_fail (nstack_unix->priv != NULL);
g_object_unref (nstack_unix->priv->conf);
- g_object_unref (nstack_unix->priv->file_monitor);
+ g_object_unref (nstack_unix->priv->monitor);
G_OBJECT_CLASS (pk_network_stack_unix_parent_class)->finalize (object);
}
diff --git a/src/pk-self-test.c b/src/pk-self-test.c
index 2e5c950..ab5bc18 100644
--- a/src/pk-self-test.c
+++ b/src/pk-self-test.c
@@ -31,7 +31,6 @@
#include "pk-conf.h"
#include "pk-dbus.h"
#include "pk-engine.h"
-#include "pk-file-monitor.h"
#include "pk-inhibit.h"
#include "pk-notify.h"
#include "pk-spawn.h"
@@ -764,17 +763,6 @@ pk_test_engine_func (void)
}
static void
-pk_test_file_monitor_func (void)
-{
- PkFileMonitor *file_monitor;
-
- /* get a file_monitor */
- file_monitor = pk_file_monitor_new ();
- g_assert (file_monitor != NULL);
- g_object_unref (file_monitor);
-}
-
-static void
pk_test_inhibit_func (void)
{
PkInhibit *inhibit;
@@ -1777,7 +1765,6 @@ main (int argc, char **argv)
#endif
/* components */
- g_test_add_func ("/packagekit/file-monitor", pk_test_file_monitor_func);
g_test_add_func ("/packagekit/time", pk_test_time_func);
g_test_add_func ("/packagekit/dbus", pk_test_dbus_func);
g_test_add_func ("/packagekit/syslog", pk_test_dbus_func);
commit 4b69f158f83f8a5555f7b669208d44eff8212208
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 12 18:56:48 2011 +0100
Remove the deprecated PK_BACKEND_OPTIONS
diff --git a/src/pk-backend.h b/src/pk-backend.h
index e08ed29..42eee30 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -479,63 +479,6 @@ typedef struct {
gpointer padding[7];
} PkBackendDesc;
-/* this is deprecated */
-#define PK_BACKEND_OPTIONS(description, author, initialize, destroy, get_groups, get_filters, get_roles, \
- get_mime_types, cancel, download_packages, get_categories, get_depends, \
- get_details, get_distro_upgrades, get_files, get_packages, get_repo_list, \
- get_requires, get_update_detail, get_updates, install_files, \
- install_packages, install_signature, refresh_cache, remove_packages, \
- repo_enable, repo_set_data, resolve, rollback, search_details, search_file, \
- search_group, search_name, update_packages, update_system, what_provides, \
- simulate_install_files, simulate_install_packages, simulate_remove_packages, \
- simulate_update_packages, upgrade_system, transaction_start, transaction_stop ) \
- G_MODULE_EXPORT const PkBackendDesc pk_backend_desc = { \
- description, \
- author, \
- initialize, \
- destroy, \
- get_groups, \
- get_filters, \
- get_roles, \
- get_mime_types, \
- cancel, \
- download_packages, \
- get_categories, \
- get_depends, \
- get_details, \
- get_distro_upgrades, \
- get_files, \
- get_packages, \
- get_repo_list, \
- get_requires, \
- get_update_detail, \
- get_updates, \
- install_files, \
- install_packages, \
- install_signature, \
- refresh_cache, \
- remove_packages, \
- repo_enable, \
- repo_set_data, \
- resolve, \
- rollback, \
- search_details, \
- search_file, \
- search_group, \
- search_name, \
- update_packages, \
- update_system, \
- what_provides, \
- simulate_install_files, \
- simulate_install_packages, \
- simulate_remove_packages, \
- simulate_update_packages, \
- upgrade_system, \
- transaction_start, \
- transaction_stop, \
- {0} \
- }
-
G_END_DECLS
#endif /* __PK_BACKEND_H */
commit 98a729ffeb57864cff02abd5b1f93d3815910b1e
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 12 18:50:16 2011 +0100
trivial: fix up the self test compile
diff --git a/src/pk-self-test.c b/src/pk-self-test.c
index d481081..2e5c950 100644
--- a/src/pk-self-test.c
+++ b/src/pk-self-test.c
@@ -1777,7 +1777,6 @@ main (int argc, char **argv)
#endif
/* components */
- g_test_add_func ("/packagekit/notify", pk_test_proc_func);
g_test_add_func ("/packagekit/file-monitor", pk_test_file_monitor_func);
g_test_add_func ("/packagekit/time", pk_test_time_func);
g_test_add_func ("/packagekit/dbus", pk_test_dbus_func);
commit ffe931200ccdd2cc4c18f8631d51e326056e9109
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 12 18:47:49 2011 +0100
Use g_bus_watch_name() and remove the homegrown EggDbusMonitor
diff --git a/configure.ac b/configure.ac
index a288ed8..fa74cd0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -144,7 +144,7 @@ AM_GLIB_GNU_GETTEXT
dnl ---------------------------------------------------------------------------
dnl - Library dependencies
dnl ---------------------------------------------------------------------------
-GLIB_REQUIRED=2.22.0
+GLIB_REQUIRED=2.26.0
GIO_REQUIRED=2.16.1
DBUS_REQUIRED=1.1.1
DBUS_GLIB_REQUIRED=0.74
diff --git a/src/Makefile.am b/src/Makefile.am
index 535f23e..a1d0703 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -53,8 +53,6 @@ plugininclude_HEADERS = \
shared_SOURCES = \
egg-string.c \
egg-string.h \
- egg-dbus-monitor.c \
- egg-dbus-monitor.h \
pk-marshal.c \
pk-marshal.h \
pk-dbus.c \
diff --git a/src/egg-dbus-monitor.c b/src/egg-dbus-monitor.c
deleted file mode 100644
index bca665e..0000000
--- a/src/egg-dbus-monitor.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2006-2008 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <glib.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
-#include <dbus/dbus.h>
-
-#include "egg-dbus-monitor.h"
-
-static void egg_dbus_monitor_finalize (GObject *object);
-
-#define EGG_DBUS_MONITOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), EGG_TYPE_DBUS_MONITOR, EggDbusMonitorPrivate))
-
-struct EggDbusMonitorPrivate
-{
- EggDbusMonitorType bus_type;
- gchar *service;
- DBusGProxy *proxy;
- DBusGConnection *connection;
- const gchar *unique_name;
-};
-
-enum {
- EGG_DBUS_MONITOR_CONNECTION_CHANGED,
- EGG_DBUS_MONITOR_CONNECTION_REPLACED,
- EGG_DBUS_MONITOR_LAST_SIGNAL
-};
-
-static guint signals [EGG_DBUS_MONITOR_LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE (EggDbusMonitor, egg_dbus_monitor, G_TYPE_OBJECT)
-
-/**
- * egg_dbus_monitor_name_owner_changed_cb:
- **/
-static void
-egg_dbus_monitor_name_owner_changed_cb (DBusGProxy *proxy, const gchar *name,
- const gchar *prev, const gchar *new,
- EggDbusMonitor *monitor)
-{
- guint new_len;
- guint prev_len;
-
- g_return_if_fail (EGG_IS_DBUS_MONITOR (monitor));
- if (monitor->priv->proxy == NULL)
- return;
-
- /* not us */
- if (strcmp (name, monitor->priv->service) != 0)
- return;
-
- /* ITS4: ignore, not used for allocation */
- new_len = strlen (new);
- /* ITS4: ignore, not used for allocation */
- prev_len = strlen (prev);
-
- /* something --> nothing */
- if (prev_len != 0 && new_len == 0) {
- g_signal_emit (monitor, signals [EGG_DBUS_MONITOR_CONNECTION_CHANGED], 0, FALSE);
- return;
- }
-
- /* nothing --> something */
- if (prev_len == 0 && new_len != 0) {
- g_signal_emit (monitor, signals [EGG_DBUS_MONITOR_CONNECTION_CHANGED], 0, TRUE);
- return;
- }
-
- /* something --> something (we've replaced the old process) */
- if (prev_len != 0 && new_len != 0) {
- /* only send this to the prev client */
- if (strcmp (monitor->priv->unique_name, prev) == 0)
- g_signal_emit (monitor, signals [EGG_DBUS_MONITOR_CONNECTION_REPLACED], 0);
- return;
- }
-}
-
-/**
- * egg_dbus_monitor_assign:
- * @monitor: This class instance
- * @bus_type: The bus type, either EGG_DBUS_MONITOR_SESSION or EGG_DBUS_MONITOR_SYSTEM
- * @service: The EGG_DBUS_MONITOR service name
- * Return value: success
- *
- * Emits connection-changed(TRUE) if connection is alive - this means you
- * have to connect up the callback before this function is called.
- **/
-gboolean
-egg_dbus_monitor_assign (EggDbusMonitor *monitor, EggDbusMonitorType bus_type, const gchar *service)
-{
- GError *error = NULL;
- gboolean connected;
- DBusConnection *conn;
-
- g_return_val_if_fail (EGG_IS_DBUS_MONITOR (monitor), FALSE);
- g_return_val_if_fail (service != NULL, FALSE);
-
- if (monitor->priv->proxy != NULL) {
- g_warning ("already assigned!");
- return FALSE;
- }
-
- monitor->priv->service = g_strdup (service);
- monitor->priv->bus_type = bus_type;
-
- /* connect to correct bus */
- if (bus_type == EGG_DBUS_MONITOR_SESSION)
- monitor->priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
- else
- monitor->priv->connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
- if (error != NULL) {
- g_warning ("Cannot connect to bus: %s", error->message);
- g_error_free (error);
- return FALSE;
- }
- monitor->priv->proxy = dbus_g_proxy_new_for_name_owner (monitor->priv->connection,
- DBUS_SERVICE_DBUS,
- DBUS_PATH_DBUS,
- DBUS_INTERFACE_DBUS,
- &error);
- if (error != NULL) {
- g_warning ("Cannot connect to DBUS: %s", error->message);
- g_error_free (error);
- return FALSE;
- }
- dbus_g_proxy_add_signal (monitor->priv->proxy, "NameOwnerChanged",
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
- dbus_g_proxy_connect_signal (monitor->priv->proxy, "NameOwnerChanged",
- G_CALLBACK (egg_dbus_monitor_name_owner_changed_cb),
- monitor, NULL);
-
- /* coldplug */
- connected = egg_dbus_monitor_is_connected (monitor);
- if (connected)
- g_signal_emit (monitor, signals [EGG_DBUS_MONITOR_CONNECTION_CHANGED], 0, TRUE);
-
- /* save this for the replaced check */
- conn = dbus_g_connection_get_connection (monitor->priv->connection);
- monitor->priv->unique_name = dbus_bus_get_unique_name (conn);
- return TRUE;
-}
-
-/**
- * egg_dbus_monitor_is_connected:
- * @monitor: This class instance
- * Return value: if we are connected to a valid watch
- **/
-gboolean
-egg_dbus_monitor_is_connected (EggDbusMonitor *monitor)
-{
- DBusError error;
- DBusConnection *conn;
- gboolean ret;
- g_return_val_if_fail (EGG_IS_DBUS_MONITOR (monitor), FALSE);
-
- /* get raw connection */
- conn = dbus_g_connection_get_connection (monitor->priv->connection);
- dbus_error_init (&error);
- ret = dbus_bus_name_has_owner (conn, monitor->priv->service, &error);
- if (dbus_error_is_set (&error)) {
- g_debug ("error: %s", error.message);
- dbus_error_free (&error);
- }
-
- return ret;
-}
-
-/**
- * egg_dbus_monitor_reset
- * @monitor: This class instance
- * Return value: if we reset correctly
- **/
-gboolean
-egg_dbus_monitor_reset (EggDbusMonitor *monitor)
-{
- g_return_val_if_fail (EGG_IS_DBUS_MONITOR (monitor), FALSE);
- if (monitor->priv->proxy != NULL) {
- g_debug ("not already assigned!");
- return FALSE;
- }
- if (monitor->priv->proxy != NULL) {
- g_object_unref (monitor->priv->proxy);
- monitor->priv->proxy = NULL;
- }
- g_free (monitor->priv->service);
- monitor->priv->service = NULL;
- return TRUE;
-}
-
-/**
- * egg_dbus_monitor_class_init:
- * @klass: The EggDbusMonitorClass
- **/
-static void
-egg_dbus_monitor_class_init (EggDbusMonitorClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = egg_dbus_monitor_finalize;
- g_type_class_add_private (klass, sizeof (EggDbusMonitorPrivate));
- signals [EGG_DBUS_MONITOR_CONNECTION_CHANGED] =
- g_signal_new ("connection-changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggDbusMonitorClass, connection_changed),
- NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
- G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
- signals [EGG_DBUS_MONITOR_CONNECTION_REPLACED] =
- g_signal_new ("connection-replaced",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggDbusMonitorClass, connection_replaced),
- NULL, NULL, g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-/**
- * egg_dbus_monitor_init:
- * @monitor: This class instance
- **/
-static void
-egg_dbus_monitor_init (EggDbusMonitor *monitor)
-{
- monitor->priv = EGG_DBUS_MONITOR_GET_PRIVATE (monitor);
- monitor->priv->service = NULL;
- monitor->priv->bus_type = EGG_DBUS_MONITOR_SESSION;
- monitor->priv->proxy = NULL;
-}
-
-/**
- * egg_dbus_monitor_finalize:
- * @object: The object to finalize
- **/
-static void
-egg_dbus_monitor_finalize (GObject *object)
-{
- EggDbusMonitor *monitor;
-
- g_return_if_fail (EGG_IS_DBUS_MONITOR (object));
-
- monitor = EGG_DBUS_MONITOR (object);
-
- g_return_if_fail (monitor->priv != NULL);
-
- g_free (monitor->priv->service);
- if (monitor->priv->proxy != NULL)
- g_object_unref (monitor->priv->proxy);
-
- G_OBJECT_CLASS (egg_dbus_monitor_parent_class)->finalize (object);
-}
-
-/**
- * egg_dbus_monitor_new:
- *
- * Return value: a new EggDbusMonitor object.
- **/
-EggDbusMonitor *
-egg_dbus_monitor_new (void)
-{
- EggDbusMonitor *monitor;
- monitor = g_object_new (EGG_TYPE_DBUS_MONITOR, NULL);
- return EGG_DBUS_MONITOR (monitor);
-}
-
diff --git a/src/egg-dbus-monitor.h b/src/egg-dbus-monitor.h
deleted file mode 100644
index 4e78a76..0000000
--- a/src/egg-dbus-monitor.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __EGG_DBUS_MONITOR_H
-#define __EGG_DBUS_MONITOR_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define EGG_TYPE_DBUS_MONITOR (egg_dbus_monitor_get_type ())
-#define EGG_DBUS_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EGG_TYPE_DBUS_MONITOR, EggDbusMonitor))
-#define EGG_DBUS_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EGG_TYPE_DBUS_MONITOR, EggDbusMonitorClass))
-#define EGG_IS_DBUS_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EGG_TYPE_DBUS_MONITOR))
-#define EGG_IS_DBUS_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EGG_TYPE_DBUS_MONITOR))
-#define EGG_DBUS_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EGG_TYPE_DBUS_MONITOR, EggDbusMonitorClass))
-#define EGG_DBUS_MONITOR_ERROR (egg_dbus_monitor_error_quark ())
-#define EGG_DBUS_MONITOR_TYPE_ERROR (egg_dbus_monitor_error_get_type ())
-
-typedef struct EggDbusMonitorPrivate EggDbusMonitorPrivate;
-
-typedef struct
-{
- GObject parent;
- EggDbusMonitorPrivate *priv;
-} EggDbusMonitor;
-
-typedef struct
-{
- GObjectClass parent_class;
- void (* connection_changed) (EggDbusMonitor *watch,
- gboolean connected);
- void (* connection_replaced) (EggDbusMonitor *watch);
-} EggDbusMonitorClass;
-
-typedef enum {
- EGG_DBUS_MONITOR_SESSION,
- EGG_DBUS_MONITOR_SYSTEM
-} EggDbusMonitorType;
-
-GType egg_dbus_monitor_get_type (void);
-EggDbusMonitor *egg_dbus_monitor_new (void);
-gboolean egg_dbus_monitor_reset (EggDbusMonitor *monitor);
-gboolean egg_dbus_monitor_assign (EggDbusMonitor *monitor,
- EggDbusMonitorType bus_type,
- const gchar *service);
-gboolean egg_dbus_monitor_is_connected (EggDbusMonitor *monitor);
-
-G_END_DECLS
-
-#endif /* __EGG_DBUS_MONITOR_H */
-
diff --git a/src/pk-main.c b/src/pk-main.c
index 12b26f6..2a2c9fe 100644
--- a/src/pk-main.c
+++ b/src/pk-main.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2007-2008 Richard Hughes <richard at hughsie.com>
+ * Copyright (C) 2007-2011 Richard Hughes <richard at hughsie.com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -37,8 +37,6 @@
#include <glib-unix.h>
#endif
-#include "egg-dbus-monitor.h"
-
#include "pk-conf.h"
#include "pk-engine.h"
#include "pk-syslog.h"
@@ -84,13 +82,14 @@ pk_object_register (DBusGConnection *connection, GObject *object, GError **error
/* abort as the DBUS method failed */
if (!ret) {
- g_warning ("RequestName failed!");
g_clear_error (error);
- message = g_strdup_printf ("%s\n%s\n* %s\n* %s '%s'\n",
+ message = g_strdup_printf ("%s\n%s\n* %s\n* %s\n* %s '%s'\n",
/* TRANSLATORS: failed due to DBus security */
- _("Startup failed due to security policies on this machine."),
+ _("Could not request the D-Bus name."),
/* TRANSLATORS: only two ways this can fail... */
- _("This can happen for two reasons:"),
+ _("This can happen for three reasons:"),
+ /* TRANSLATORS: only allowed to be running once */
+ _("The daemon is already running"),
/* TRANSLATORS: only allowed to be owned by root */
_("The correct user is not launching the executable (usually root)"),
/* TRANSLATORS: or we are installed in a prefix */
@@ -198,8 +197,7 @@ int
main (int argc, char *argv[])
{
DBusGConnection *system_connection;
- EggDbusMonitor *monitor;
- gboolean ret;
+ gboolean ret = TRUE;
gboolean disable_timer = FALSE;
gboolean version = FALSE;
gboolean use_daemon = FALSE;
@@ -261,16 +259,6 @@ main (int argc, char *argv[])
goto exit_program;
}
- /* check if an instance is already running */
- monitor = egg_dbus_monitor_new ();
- egg_dbus_monitor_assign (monitor, EGG_DBUS_MONITOR_SYSTEM, PK_DBUS_SERVICE);
- ret = egg_dbus_monitor_is_connected (monitor);
- g_object_unref (monitor);
- if (ret) {
- g_print ("Already running service which provides %s\n", PK_DBUS_SERVICE);
- goto exit_program;
- }
-
#if GLIB_CHECK_VERSION(2,29,4)
/* do stuff on ctrl-c */
g_unix_signal_add_watch_full (SIGINT,
diff --git a/src/pk-network-stack-connman.c b/src/pk-network-stack-connman.c
index 90df93e..44f9cd2 100644
--- a/src/pk-network-stack-connman.c
+++ b/src/pk-network-stack-connman.c
@@ -24,17 +24,16 @@
#include <glib.h>
#include <glib-object.h>
+#include <gio/gio.h>
#include <dbus/dbus-glib.h>
-#include "egg-dbus-monitor.h"
-
#include "pk-network-stack-connman.h"
#include "pk-conf.h"
#include "pk-marshal.h"
struct PkNetworkStackConnmanPrivate
{
- EggDbusMonitor *dbus_monitor;
+ guint watch_id;
PkConf *conf;
gboolean is_enabled;
DBusGConnection *bus;
@@ -210,6 +209,34 @@ pk_network_stack_connman_is_enabled (PkNetworkStack *nstack)
}
/**
+ * pk_network_stack_connman_appeared_cb:
+ **/
+static void
+pk_network_stack_connman_appeared_cb (GDBusConnection *connection,
+ const gchar *name,
+ const gchar *name_owner,
+ gpointer user_data)
+{
+ gboolean ret;
+ PkNetworkStackConnman *nstack_connman = PK_NETWORK_STACK_CONNMAN (user_data);
+ ret = pk_conf_get_bool (nstack_connman->priv->conf,
+ "UseNetworkConnman");
+ nstack_connman->priv->is_enabled = ret;
+}
+
+/**
+ * pk_network_stack_connman_vanished_cb:
+ **/
+static void
+pk_network_stack_connman_vanished_cb (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data)
+{
+ PkNetworkStackConnman *nstack_connman = PK_NETWORK_STACK_CONNMAN (user_data);
+ nstack_connman->priv->is_enabled = FALSE;
+}
+
+/**
* pk_network_stack_connman_init:
**/
static void
@@ -217,15 +244,10 @@ pk_network_stack_connman_init (PkNetworkStackConnman *nstack_connman)
{
GError *error = NULL;
DBusGProxy *proxy;
- gboolean service_alive;
nstack_connman->priv = PK_NETWORK_STACK_CONNMAN_GET_PRIVATE (nstack_connman);
nstack_connman->priv->conf = pk_conf_new ();
- /* do we use this code? */
- nstack_connman->priv->is_enabled = pk_conf_get_bool (nstack_connman->priv->conf, "UseNetworkConnman");
- nstack_connman->priv->proxy = NULL;
-
dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_BOXED,
G_TYPE_NONE, G_TYPE_STRING,
G_TYPE_VALUE, G_TYPE_INVALID);
@@ -239,15 +261,14 @@ pk_network_stack_connman_init (PkNetworkStackConnman *nstack_connman)
}
/* check if ConnMan is on the bus */
- nstack_connman->priv->dbus_monitor = egg_dbus_monitor_new ();
- egg_dbus_monitor_assign (nstack_connman->priv->dbus_monitor, EGG_DBUS_MONITOR_SYSTEM, CONNMAN_DBUS_NAME);
- service_alive = egg_dbus_monitor_is_connected (nstack_connman->priv->dbus_monitor);
-
- /* ConnMan isn't up, so we can't use it */
- if (nstack_connman->priv->is_enabled && !service_alive) {
- g_warning ("UseNetworkConnman true, but %s not up", CONNMAN_DBUS_NAME);
- nstack_connman->priv->is_enabled = FALSE;
- }
+ nstack_connman->priv->watch_id =
+ g_bus_watch_name (G_BUS_TYPE_SYSTEM,
+ CONNMAN_DBUS_NAME,
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ pk_network_stack_connman_appeared_cb,
+ pk_network_stack_connman_vanished_cb,
+ nstack_connman,
+ NULL);
proxy = dbus_g_proxy_new_for_name_owner (nstack_connman->priv->bus,
CONNMAN_DBUS_NAME,
@@ -280,7 +301,7 @@ pk_network_stack_connman_finalize (GObject *object)
nstack_connman = PK_NETWORK_STACK_CONNMAN (object);
g_return_if_fail (nstack_connman->priv != NULL);
- g_object_unref (nstack_connman->priv->dbus_monitor);
+ g_bus_unwatch_name (nstack_connman->priv->watch_id);
g_object_unref (nstack_connman->priv->conf);
if (nstack_connman->priv->proxy != NULL)
g_object_unref (nstack_connman->priv->proxy);
diff --git a/src/pk-network-stack-nm.c b/src/pk-network-stack-nm.c
index 209bfb3..d330c8f 100644
--- a/src/pk-network-stack-nm.c
+++ b/src/pk-network-stack-nm.c
@@ -23,11 +23,10 @@
#include <glib.h>
#include <glib-object.h>
+#include <gio/gio.h>
#include <dbus/dbus-glib.h>
#include <NetworkManager.h>
-#include "egg-dbus-monitor.h"
-
#include "pk-network-stack-nm.h"
#include "pk-conf.h"
#include "pk-marshal.h"
@@ -38,7 +37,7 @@
struct PkNetworkStackNmPrivate
{
- EggDbusMonitor *dbus_monitor;
+ guint watch_id;
PkConf *conf;
DBusGConnection *bus;
gboolean is_enabled;
@@ -292,20 +291,44 @@ pk_network_stack_nm_is_enabled (PkNetworkStack *nstack)
}
/**
+ * pk_network_stack_connman_appeared_cb:
+ **/
+static void
+pk_network_stack_connman_appeared_cb (GDBusConnection *connection,
+ const gchar *name,
+ const gchar *name_owner,
+ gpointer user_data)
+{
+ gboolean ret;
+ PkNetworkStackNm *nstack_nm = PK_NETWORK_STACK_NM (user_data);
+ ret = pk_conf_get_bool (nstack_nm->priv->conf,
+ "UseNetworkManager");
+ nstack_nm->priv->is_enabled = ret;
+}
+
+/**
+ * pk_network_stack_connman_vanished_cb:
+ **/
+static void
+pk_network_stack_connman_vanished_cb (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data)
+{
+ PkNetworkStackNm *nstack_nm = PK_NETWORK_STACK_NM (user_data);
+ nstack_nm->priv->is_enabled = FALSE;
+}
+
+/**
* pk_network_stack_nm_init:
**/
static void
pk_network_stack_nm_init (PkNetworkStackNm *nstack_nm)
{
GError *error = NULL;
- gboolean service_alive;
nstack_nm->priv = PK_NETWORK_STACK_NM_GET_PRIVATE (nstack_nm);
nstack_nm->priv->conf = pk_conf_new ();
- /* do we use this code? */
- nstack_nm->priv->is_enabled = pk_conf_get_bool (nstack_nm->priv->conf, "UseNetworkManager");
-
/* get system connection */
nstack_nm->priv->bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
if (nstack_nm->priv->bus == NULL) {
@@ -314,11 +337,17 @@ pk_network_stack_nm_init (PkNetworkStackNm *nstack_nm)
}
/* check if NM is on the bus */
- nstack_nm->priv->dbus_monitor = egg_dbus_monitor_new ();
- egg_dbus_monitor_assign (nstack_nm->priv->dbus_monitor, EGG_DBUS_MONITOR_SYSTEM, "org.freedesktop.NetworkManager");
- service_alive = egg_dbus_monitor_is_connected (nstack_nm->priv->dbus_monitor);
-
- /* connect to changed as libnm-glib is teh suck and causes multithreading issues with dbus-glib */
+ nstack_nm->priv->watch_id =
+ g_bus_watch_name (G_BUS_TYPE_SYSTEM,
+ "org.freedesktop.NetworkManager",
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ pk_network_stack_connman_appeared_cb,
+ pk_network_stack_connman_vanished_cb,
+ nstack_nm,
+ NULL);
+
+ /* connect to changed as libnm-glib is teh suck and causes
+ * multithreading issues with dbus-glib */
nstack_nm->priv->proxy_changed = dbus_g_proxy_new_for_name (nstack_nm->priv->bus,
"org.freedesktop.NetworkManager",
"/org/freedesktop/NetworkManager",
@@ -326,12 +355,6 @@ pk_network_stack_nm_init (PkNetworkStackNm *nstack_nm)
dbus_g_proxy_add_signal (nstack_nm->priv->proxy_changed, "StateChanged", G_TYPE_UINT, G_TYPE_INVALID);
dbus_g_proxy_connect_signal (nstack_nm->priv->proxy_changed, "StateChanged",
G_CALLBACK (pk_network_stack_nm_status_changed_cb), nstack_nm, NULL);
-
- /* NetworkManager isn't up, so we can't use it */
- if (nstack_nm->priv->is_enabled && !service_alive) {
- g_warning ("UseNetworkManager true, but org.freedesktop.NetworkManager not up");
- nstack_nm->priv->is_enabled = FALSE;
- }
}
/**
@@ -352,7 +375,7 @@ pk_network_stack_nm_finalize (GObject *object)
G_CALLBACK (pk_network_stack_nm_status_changed_cb), nstack_nm);
g_object_unref (nstack_nm->priv->proxy_changed);
g_object_unref (nstack_nm->priv->conf);
- g_object_unref (nstack_nm->priv->dbus_monitor);
+ g_bus_unwatch_name (nstack_nm->priv->watch_id);
G_OBJECT_CLASS (pk_network_stack_nm_parent_class)->finalize (object);
}
diff --git a/src/pk-network.c b/src/pk-network.c
index e5c5f17..2976900 100644
--- a/src/pk-network.c
+++ b/src/pk-network.c
@@ -35,7 +35,6 @@
#include <glib/gi18n.h>
-#include "egg-dbus-monitor.h"
#include "pk-network.h"
#include "pk-network-stack.h"
#include "pk-network-stack-unix.h"
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index a1f5839..b8ce96f 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -38,6 +38,7 @@
#include <glib/gstdio.h>
#include <glib/gi18n.h>
+#include <gio/gio.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
#include <gio/gio.h>
@@ -52,7 +53,6 @@
#endif
#include "egg-string.h"
-#include "egg-dbus-monitor.h"
#include "pk-backend.h"
#include "pk-cache.h"
@@ -104,7 +104,7 @@ struct PkTransactionPrivate
gchar *frontend_socket;
guint cache_age;
guint uid;
- EggDbusMonitor *monitor;
+ guint watch_id;
PkBackend *backend;
PkInhibit *inhibit;
PkCache *cache;
@@ -473,27 +473,6 @@ pk_transaction_allow_cancel_cb (PkBackend *backend, gboolean allow_cancel, PkTra
}
/**
- * pk_transaction_caller_active_changed_cb:
- **/
-static void
-pk_transaction_caller_active_changed_cb (EggDbusMonitor *egg_dbus_monitor, gboolean caller_active, PkTransaction *transaction)
-{
- g_return_if_fail (PK_IS_TRANSACTION (transaction));
- g_return_if_fail (transaction->priv->tid != NULL);
-
- /* already set */
- if (transaction->priv->caller_active == caller_active)
- return;
-
- /* save as a property */
- transaction->priv->caller_active = caller_active;
-
- /* emit */
- g_debug ("emitting changed");
- g_signal_emit (transaction, signals[SIGNAL_CHANGED], 0);
-}
-
-/**
* pk_transaction_details_cb:
**/
static void
@@ -1963,6 +1942,25 @@ pk_transaction_set_tid (PkTransaction *transaction, const gchar *tid)
}
/**
+ * pk_transaction_vanished_cb:
+ **/
+static void
+pk_transaction_vanished_cb (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data)
+{
+ PkTransaction *transaction = PK_TRANSACTION (user_data);
+
+ g_return_if_fail (PK_IS_TRANSACTION (transaction));
+
+ transaction->priv->caller_active = FALSE;
+
+ /* emit */
+ g_debug ("emitting changed");
+ g_signal_emit (transaction, signals[SIGNAL_CHANGED], 0);
+}
+
+/**
* pk_transaction_set_sender:
*/
gboolean
@@ -1974,7 +1972,15 @@ pk_transaction_set_sender (PkTransaction *transaction, const gchar *sender)
g_debug ("setting sender to %s", sender);
transaction->priv->sender = g_strdup (sender);
- egg_dbus_monitor_assign (transaction->priv->monitor, EGG_DBUS_MONITOR_SYSTEM, sender);
+
+ transaction->priv->watch_id =
+ g_bus_watch_name (G_BUS_TYPE_SYSTEM,
+ sender,
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ NULL,
+ pk_transaction_vanished_cb,
+ transaction,
+ NULL);
/* we get the UID for all callers as we need to know when to cancel */
#ifdef USE_SECURITY_POLKIT
@@ -5828,10 +5834,6 @@ pk_transaction_init (PkTransaction *transaction)
g_signal_connect (transaction->priv->transaction_db, "transaction",
G_CALLBACK (pk_transaction_transaction_cb), transaction);
- transaction->priv->monitor = egg_dbus_monitor_new ();
- g_signal_connect (transaction->priv->monitor, "connection-changed",
- G_CALLBACK (pk_transaction_caller_active_changed_cb), transaction);
-
/* setup supported mime types */
pk_transaction_setup_mime_types (transaction);
}
@@ -5884,6 +5886,8 @@ pk_transaction_finalize (GObject *object)
if (transaction->priv->subject != NULL)
g_object_unref (transaction->priv->subject);
#endif
+ if (transaction->priv->watch_id > 0)
+ g_bus_unwatch_name (transaction->priv->watch_id);
g_free (transaction->priv->last_package_id);
g_free (transaction->priv->locale);
g_free (transaction->priv->frontend_socket);
@@ -5905,7 +5909,6 @@ pk_transaction_finalize (GObject *object)
g_object_unref (transaction->priv->cache);
g_object_unref (transaction->priv->inhibit);
g_object_unref (transaction->priv->backend);
- g_object_unref (transaction->priv->monitor);
g_object_unref (transaction->priv->transaction_list);
g_object_unref (transaction->priv->transaction_db);
g_object_unref (transaction->priv->notify);
commit 789264ffa8250fb6b6f4d94e82802aa560152ec0
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 12 17:34:05 2011 +0100
Remove the GTK+2 pango module and only support GTK+3
diff --git a/configure.ac b/configure.ac
index 54d2f92..a288ed8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -409,27 +409,15 @@ AM_CONDITIONAL(PK_BUILD_GSTREAMER_PLUGIN, test $build_gstreamer_plugin = "yes")
dnl ---------------------------------------------------------------------------
dnl - Able to build GTK module
dnl ---------------------------------------------------------------------------
-AC_ARG_ENABLE(gtk_module, AS_HELP_STRING([--enable-gtk-module],[Build GTK module functionality]),
+AC_ARG_ENABLE(gtk_module, AS_HELP_STRING([--enable-gtk-module],[Build GTK+-3 module functionality]),
enable_gtk_module=$enableval,enable_gtk_module=yes)
if test x$enable_gtk_module = xyes; then
- PKG_CHECK_MODULES(PK_GTK_MODULE_GTK2, gtk+-2.0 >= 2.14.0 pangoft2 fontconfig dbus-glib-1,
- build_gtk_module_gtk2=yes, build_gtk_module_gtk2=no)
- PKG_CHECK_MODULES(PK_GTK_MODULE_GTK3, gtk+-3.0 >= 2.91.0 pangoft2 fontconfig dbus-glib-1,
- build_gtk_module_gtk3=yes, build_gtk_module_gtk3=no)
- # if either are true, visit the gtk-module directory
- if test $build_gtk_module_gtk2 = "yes" -o $build_gtk_module_gtk3 = "yes"; then
- build_gtk_module=yes
- else
- build_gtk_module=no
- fi
+ PKG_CHECK_MODULES(PK_GTK_MODULE, gtk+-3.0 >= 3.0.0 pangoft2 fontconfig dbus-glib-1,
+ build_gtk_module=yes, build_gtk_module=no)
else
build_gtk_module=no
- build_gtk_module_gtk2=no
- build_gtk_module_gtk3=no
fi
AM_CONDITIONAL(PK_BUILD_GTK_MODULE, test $build_gtk_module = "yes")
-AM_CONDITIONAL(PK_BUILD_GTK_MODULE_GTK2, test $build_gtk_module_gtk2 = "yes")
-AM_CONDITIONAL(PK_BUILD_GTK_MODULE_GTK3, test $build_gtk_module_gtk3 = "yes")
dnl ---------------------------------------------------------------------------
dnl - Able to build BASH command-not-found functionality
@@ -764,8 +752,6 @@ contrib/Makefile
contrib/browser-plugin/Makefile
contrib/gstreamer-plugin/Makefile
contrib/gtk-module/Makefile
-contrib/gtk-module/gtk-2.0/Makefile
-contrib/gtk-module/gtk-3.0/Makefile
contrib/yum-packagekit/Makefile
contrib/command-not-found/Makefile
contrib/cron/Makefile
@@ -839,8 +825,7 @@ echo "
Networking stacks: ${networking_apis}
Browser plugin: ${build_browser_plugin}
GStreamer plugin: ${build_gstreamer_plugin}
- Pango module (GTK2): ${build_gtk_module_gtk2}
- Pango module (GTK3): ${build_gtk_module_gtk3}
+ Pango module (GTK+3): ${build_gtk_module}
gobject-introspection: ${found_introspection}
BASH Command not found: ${build_command_not_found}
Cron scripts: ${build_cron}
diff --git a/contrib/PackageKit.spec.in b/contrib/PackageKit.spec.in
index 897034f..c09ce28 100644
--- a/contrib/PackageKit.spec.in
+++ b/contrib/PackageKit.spec.in
@@ -54,6 +54,9 @@ BuildRequires: zif-devel >= 0.1.3
Obsoletes: PackageKit-udev-helper < %{version}-%{release}
Obsoletes: udev-packagekit < %{version}-%{release}
+# No more GTK+-2 plugin
+Obsoletes: PackageKit-gtk-module < %{version}-%{release}
+
%description
PackageKit is a D-Bus abstraction layer that allows the session user
to manage packages in a secure way using a cross-distro,
@@ -206,16 +209,6 @@ Provides: codeina = 0.10.1-10
The PackageKit GStreamer plugin allows any Gstreamer application to install
codecs from configured repositories using PackageKit.
-%package gtk-module
-Summary: Install fonts automatically using PackageKit
-Group: Development/Libraries
-Requires: pango
-Requires: PackageKit-glib = %{version}-%{release}
-
-%description gtk-module
-The PackageKit GTK2+ module allows any Pango application to install
-fonts from configured repositories using PackageKit.
-
%package gtk3-module
Summary: Install fonts automatically using PackageKit
Group: Development/Libraries
@@ -273,7 +266,7 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/libpackagekit*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/packagekit-backend/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/packagekit-plugins/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/mozilla/plugins/packagekit-plugin.la
-rm -f $RPM_BUILD_ROOT%{_libdir}/gtk-?.0/modules/*.la
+rm -f $RPM_BUILD_ROOT%{_libdir}/gtk-3.0/modules/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/polkit-1/extensions/libpackagekit-action-lookup.la
touch $RPM_BUILD_ROOT%{_localstatedir}/cache/PackageKit/groups.sqlite
@@ -414,10 +407,6 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%{_libexecdir}/pk-gstreamer-install
%{_libexecdir}/gst-install-plugins-helper
-%files gtk-module
-%defattr(-,root,root,-)
-%{_libdir}/gtk-2.0/modules/*.so
-
%files gtk3-module
%defattr(-,root,root,-)
%{_libdir}/gtk-3.0/modules/*.so
diff --git a/contrib/gtk-module/Makefile.am b/contrib/gtk-module/Makefile.am
index 4a264db..dab5364 100644
--- a/contrib/gtk-module/Makefile.am
+++ b/contrib/gtk-module/Makefile.am
@@ -1,11 +1,18 @@
-SUBDIRS =
+if PK_BUILD_GTK_MODULE
+APP = gedit --new-window GLASS.txt
-if PK_BUILD_GTK_MODULE_GTK2
-SUBDIRS += gtk-2.0
-endif
+moduledir = $(LIBDIR)/gtk-3.0/modules
+module_LTLIBRARIES = libpk-gtk-module.la
+libpk_gtk_module_la_SOURCES = pk-gtk-module.c
+libpk_gtk_module_la_LIBADD = $(PK_GTK_MODULE_LIBS)
+libpk_gtk_module_la_LDFLAGS = -module -avoid-version
+libpk_gtk_module_la_CFLAGS = $(PK_GTK_MODULE_CFLAGS) $(WARNINGFLAGS_C)
+
+clean-local:
+ rm -f *~
-if PK_BUILD_GTK_MODULE_GTK3
-SUBDIRS += gtk-3.0
+local: all
+ GTK_MODULES="$$GTK_MODULES:$$PWD/.libs/libpk-gtk-module.so" $(APP)
endif
EXTRA_DIST = \
diff --git a/contrib/gtk-module/gtk-2.0/Makefile.am b/contrib/gtk-module/gtk-2.0/Makefile.am
deleted file mode 100644
index 6bee7c8..0000000
--- a/contrib/gtk-module/gtk-2.0/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-moduledir = $(LIBDIR)/gtk-2.0/modules
-module_LTLIBRARIES = libpk-gtk-module.la
-libpk_gtk_module_la_SOURCES = ../pk-gtk-module.c
-libpk_gtk_module_la_LIBADD = $(PK_GTK_MODULE_GTK2_LIBS)
-libpk_gtk_module_la_LDFLAGS = -module -avoid-version
-libpk_gtk_module_la_CFLAGS = $(PK_GTK_MODULE_GTK2_CFLAGS) $(WARNINGFLAGS_C)
-
-clean-local:
- rm -f *~
-
-
--include $(top_srcdir)/git.mk
diff --git a/contrib/gtk-module/gtk-3.0/Makefile.am b/contrib/gtk-module/gtk-3.0/Makefile.am
deleted file mode 100644
index 6599b5f..0000000
--- a/contrib/gtk-module/gtk-3.0/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-NULL =
-APP = gedit --new-window GLASS.txt
-
-moduledir = $(LIBDIR)/gtk-3.0/modules
-module_LTLIBRARIES = libpk-gtk-module.la
-libpk_gtk_module_la_SOURCES = ../pk-gtk-module.c
-libpk_gtk_module_la_LIBADD = $(PK_GTK_MODULE_GTK3_LIBS)
-libpk_gtk_module_la_LDFLAGS = -module -avoid-version
-libpk_gtk_module_la_CFLAGS = $(PK_GTK_MODULE_GTK3_CFLAGS) $(WARNINGFLAGS_C)
-
-clean-local:
- rm -f *~
-
-local: all
- GTK_MODULES="$$GTK_MODULES:$$PWD/.libs/libpk-gtk-module.so" $(APP)
-
-
--include $(top_srcdir)/git.mk
commit 920311f22ac419334586334eeb6f47e7d1113770
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 12 17:21:04 2011 +0100
glib: Remove the foo_from_text() compatibility defines
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 8662e6d..fdff5ac 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -2618,7 +2618,7 @@ pk_backend_get_details_thread (PkBackend *backend)
error->message);
g_clear_error (&error);
}
- group = pk_group_enum_from_text (group_str);
+ group = pk_group_enum_from_string (group_str);
/* this section done */
ret = zif_state_done (state_loop, &error);
diff --git a/lib/packagekit-glib2/pk-enum.h b/lib/packagekit-glib2/pk-enum.h
index 52bea6e..d63a9c0 100644
--- a/lib/packagekit-glib2/pk-enum.h
+++ b/lib/packagekit-glib2/pk-enum.h
@@ -30,42 +30,6 @@
G_BEGIN_DECLS
-/* These are compatibility enums so we can break API in the future */
-#define pk_sig_type_enum_from_text pk_sig_type_enum_from_string
-#define pk_sig_type_enum_to_text pk_sig_type_enum_to_string
-#define pk_distro_upgrade_enum_from_text pk_distro_upgrade_enum_from_string
-#define pk_distro_upgrade_enum_to_text pk_distro_upgrade_enum_to_string
-#define pk_provides_enum_from_text pk_provides_enum_from_string
-#define pk_provides_enum_to_text pk_provides_enum_to_string
-#define pk_info_enum_from_text pk_info_enum_from_string
-#define pk_info_enum_to_text pk_info_enum_to_string
-#define pk_exit_enum_from_text pk_exit_enum_from_string
-#define pk_exit_enum_to_text pk_exit_enum_to_string
-#define pk_network_enum_from_text pk_network_enum_from_string
-#define pk_network_enum_to_text pk_network_enum_to_string
-#define pk_status_enum_from_text pk_status_enum_from_string
-#define pk_status_enum_to_text pk_status_enum_to_string
-#define pk_role_enum_from_text pk_role_enum_from_string
-#define pk_role_enum_to_text pk_role_enum_to_string
-#define pk_error_enum_from_text pk_error_enum_from_string
-#define pk_error_enum_to_text pk_error_enum_to_string
-#define pk_restart_enum_from_text pk_restart_enum_from_string
-#define pk_restart_enum_to_text pk_restart_enum_to_string
-#define pk_message_enum_from_text pk_message_enum_from_string
-#define pk_message_enum_to_text pk_message_enum_to_string
-#define pk_group_enum_from_text pk_group_enum_from_string
-#define pk_group_enum_to_text pk_group_enum_to_string
-#define pk_update_state_enum_from_text pk_update_state_enum_from_string
-#define pk_update_state_enum_to_text pk_update_state_enum_to_string
-#define pk_filter_enum_from_text pk_filter_enum_from_string
-#define pk_filter_enum_to_text pk_filter_enum_to_string
-#define pk_license_enum_from_text pk_license_enum_from_string
-#define pk_license_enum_to_text pk_license_enum_to_string
-#define pk_media_type_enum_from_text pk_media_type_enum_from_string
-#define pk_media_type_enum_to_text pk_media_type_enum_to_string
-#define pk_authorize_type_enum_from_text pk_authorize_type_enum_from_string
-#define pk_authorize_type_enum_to_text pk_authorize_type_enum_to_string
-
/**
* PkEnumMatch:
*
commit 996d5488dc7951875dcbe1034ef489084686af8a
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 12 17:19:21 2011 +0100
razor: Remove the razor backend, upstream razor is dead
Razor could have been so great, but alas, it's dead.
diff --git a/backends/Makefile.am b/backends/Makefile.am
index 7665dcc..82340d0 100644
--- a/backends/Makefile.am
+++ b/backends/Makefile.am
@@ -28,10 +28,6 @@ if BACKEND_TYPE_OPKG
SUBDIRS += opkg
endif
-if BACKEND_TYPE_RAZOR
-SUBDIRS += razor
-endif
-
if BACKEND_TYPE_SLAPT
SUBDIRS += slapt
endif
diff --git a/backends/razor/Makefile.am b/backends/razor/Makefile.am
deleted file mode 100644
index 4a8d972..0000000
--- a/backends/razor/Makefile.am
+++ /dev/null
@@ -1,13 +0,0 @@
-INCLUDES = \
- -DG_LOG_DOMAIN=\"PackageKit-Razor\"
-
-plugindir = $(PK_PLUGIN_DIR)
-plugin_LTLIBRARIES = libpk_backend_razor.la
-libpk_backend_razor_la_SOURCES = pk-backend-razor.c
-libpk_backend_razor_la_LIBADD = $(PK_PLUGIN_LIBS) $(RAZOR_LIBS)
-
-libpk_backend_razor_la_LDFLAGS = -module -avoid-version
-libpk_backend_razor_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(RAZOR_CFLAGS) $(WARNINGFLAGS_C)
-
-
--include $(top_srcdir)/git.mk
diff --git a/backends/razor/pk-backend-razor.c b/backends/razor/pk-backend-razor.c
deleted file mode 100644
index 4625ff8..0000000
--- a/backends/razor/pk-backend-razor.c
+++ /dev/null
@@ -1,439 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <gmodule.h>
-#include <glib.h>
-#include <string.h>
-#include <pk-backend.h>
-#include <pk-backend-internal.h>
-
-#include <razor/razor.h>
-
-static struct razor_set *set = NULL;
-static const char *repo_filename = "/home/hughsie/Code/razor/src/system.repo";
-static const char *system_details = "/home/hughsie/Code/razor/src/system-details.repo";
-
-typedef enum {
- PK_RAZOR_SEARCH_TYPE_NAME,
- PK_RAZOR_SEARCH_TYPE_SUMMARY
-} PkRazorSearchType;
-
-/**
- * backend_initialize:
- */
-static void
-backend_initialize (PkBackend *backend)
-{
- set = razor_set_open (repo_filename);
- razor_set_open_details (set, system_details);
-}
-
-/**
- * backend_destroy:
- */
-static void
-backend_destroy (PkBackend *backend)
-{
- razor_set_destroy (set);
-}
-
-/**
- * pk_razor_filter_devel:
- */
-static gboolean
-pk_razor_filter_devel (const gchar *name)
-{
- if (g_str_has_suffix (name, "-debuginfo"))
- return TRUE;
- if (g_str_has_suffix (name, "-devel"))
- return TRUE;
- if (g_str_has_suffix (name, "-libs"))
- return TRUE;
- return FALSE;
-}
-
-/**
- * pk_razor_emit_package:
- */
-static gboolean
-pk_razor_emit_package (PkBackend *backend, const gchar *name, const gchar *version, const gchar *arch, const gchar *summary)
-{
- PkBitfield filters;
- gchar *package_id;
- gboolean ret;
-
- filters = pk_backend_get_uint (backend, "filters");
-
- if (pk_bitfield_contain (filters, PK_FILTER_ENUM_DEVELOPMENT)) {
- ret = pk_razor_filter_devel (name);
- if (!ret)
- return FALSE;
- }
- if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_DEVELOPMENT)) {
- ret = pk_razor_filter_devel (name);
- if (ret)
- return FALSE;
- }
-
- package_id = pk_package_id_build (name, version, arch, "installed");
- pk_backend_package (backend, PK_INFO_ENUM_INSTALLED, package_id, summary);
- g_free (package_id);
- return TRUE;
-}
-
-static gboolean
-backend_resolve_thread (PkBackend *backend)
-{
- guint i;
- guint length;
- struct razor_package_iterator *pi;
- struct razor_package *package;
- const gchar *name, *version, *arch, *summary;
- gchar **package_ids;
-
- package_ids = pk_backend_get_strv (backend, "package_ids");
- length = g_strv_length (package_ids);
-
- pi = razor_package_iterator_create (set);
- while (razor_package_iterator_next (pi, &package,
- RAZOR_DETAIL_NAME, &name,
- RAZOR_DETAIL_VERSION, &version,
- RAZOR_DETAIL_ARCH, &arch,
- RAZOR_DETAIL_SUMMARY, &summary,
- RAZOR_DETAIL_LAST)) {
- for (i=0; i<length; i++) {
- if (g_strcmp0 (name, package_ids[i]) == 0) {
- pk_razor_emit_package (backend, name, version, arch, summary);
- }
- }
- }
-
- razor_package_iterator_destroy (pi);
- pk_backend_finished (backend);
- return TRUE;
-}
-
-/**
- * backend_resolve:
- */
-static void
-backend_resolve (PkBackend *backend, PkBitfield filters, gchar **packages)
-{
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID);
- pk_backend_thread_create (backend, backend_resolve_thread);
-}
-
-/**
- * backend_get_details:
- */
-static gboolean
-backend_get_details_thread (PkBackend *backend)
-{
- guint i;
- guint length;
- struct razor_package_iterator *pi;
- struct razor_package *package;
- const gchar *name, *version, *arch, *summary, *description, *url, *license;
- gchar *package_id;
- gchar **package_ids;
- PkPackageId *id;
-
- package_ids = pk_backend_get_strv (backend, "package_ids");
- length = g_strv_length (package_ids);
-
- pi = razor_package_iterator_create (set);
- while (razor_package_iterator_next (pi, &package,
- RAZOR_DETAIL_NAME, &name,
- RAZOR_DETAIL_VERSION, &version,
- RAZOR_DETAIL_ARCH, &arch,
- RAZOR_DETAIL_LAST)) {
- for (i=0; i<length; i++) {
- /* TODO: we should cache this */
- id = pk_package_id_new_from_string (package_ids[i]);
- if (g_strcmp0 (name, id->name) == 0) {
- package_id = pk_package_id_build (name, version, arch, "installed");
- razor_package_get_details (set, package,
- RAZOR_DETAIL_SUMMARY, &summary,
- RAZOR_DETAIL_DESCRIPTION, &description,
- RAZOR_DETAIL_URL, &url,
- RAZOR_DETAIL_LICENSE, &license,
- RAZOR_DETAIL_LAST);
- pk_backend_details (backend, package_ids[i], license, PK_GROUP_ENUM_UNKNOWN, description, url, 0);
- g_free (package_id);
- }
- pk_package_id_free (id);
- }
- }
-
- razor_package_iterator_destroy (pi);
- pk_backend_finished (backend);
- return TRUE;
-}
-
-static void
-backend_get_details (PkBackend *backend, gchar **package_ids)
-{
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID);
- pk_backend_thread_create (backend, backend_get_details_thread);
-}
-
-/**
- * backend_resolve_package_id:
- */
-static struct razor_package *
-backend_resolve_package_id (const PkPackageId *id)
-{
- struct razor_package_iterator *pi;
- struct razor_package *package;
- struct razor_package *package_retval = NULL;
- const gchar *name, *version, *arch;
-
- pi = razor_package_iterator_create (set);
- while (razor_package_iterator_next (pi, &package,
- RAZOR_DETAIL_NAME, &name,
- RAZOR_DETAIL_VERSION, &version,
- RAZOR_DETAIL_ARCH, &arch,
- RAZOR_DETAIL_LAST)) {
- if (g_strcmp0 (name, id->name) == 0) {
- package_retval = package;
- break;
- }
- }
- razor_package_iterator_destroy (pi);
- return package_retval;
-}
-
-/**
- * backend_get_files:
- */
-static void
-backend_get_files (PkBackend *backend, gchar **package_ids)
-{
- guint i;
- guint length;
- const gchar *package_id;
- struct razor_package *package;
- PkPackageId *id;
-
- length = g_strv_length (package_ids);
- for (i=0; i<length; i++) {
- package_id = package_ids[i];
- id = pk_package_id_new_from_string (package_id);
- /* TODO: we need to get this list! */
- package = backend_resolve_package_id (id);
- razor_set_list_package_files (set, package);
- pk_backend_files (backend, package_id, "/usr/bin/dave;/usr/share/brian");
- pk_package_id_free (id);
- }
- pk_backend_finished (backend);
-}
-
-static gboolean
-backend_get_packages_thread (PkBackend *backend)
-{
- struct razor_package_iterator *pi;
- struct razor_package *package;
- const gchar *name, *version, *arch, *summary;
-
- pi = razor_package_iterator_create (set);
- while (razor_package_iterator_next (pi, &package,
- RAZOR_DETAIL_NAME, &name,
- RAZOR_DETAIL_VERSION, &version,
- RAZOR_DETAIL_ARCH, &arch,
- RAZOR_DETAIL_SUMMARY, &summary,
- RAZOR_DETAIL_LAST)) {
- pk_razor_emit_package (backend, name, version, arch, summary);
- }
-
- razor_package_iterator_destroy (pi);
- pk_backend_finished (backend);
- return TRUE;
-}
-
-/**
- * backend_get_packages:
- */
-static void
-backend_get_packages (PkBackend *backend, PkBitfield filters)
-{
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID);
- pk_backend_thread_create (backend, backend_get_packages_thread);
-}
-
-/**
- * pk_str_case_contains:
- */
-static gboolean
-pk_str_case_contains (const gchar *haystack, const gchar *needle)
-{
- gint ret;
- guint i;
- guint haystack_length;
- guint needle_length;
-
- haystack_length = egg_strlen (haystack, 1024);
- needle_length = egg_strlen (needle, 1024);
-
- /* needle longer than haystack */
- if (needle_length > haystack_length) {
- return FALSE;
- }
-
- /* search case insensitive */
- for (i=0; i<haystack_length - needle_length; i++) {
- ret = g_ascii_strncasecmp (haystack+i, needle, needle_length);
- if (ret == 0) {
- return TRUE;
- }
- }
- return FALSE;
-}
-
-/**
- * backend_search_thread:
- */
-static gboolean
-backend_search_thread (PkBackend *backend)
-{
- struct razor_package_iterator *pi;
- struct razor_package *package;
- const gchar *name, *version, *arch, *summary, *description;
- PkRazorSearchType type;
- gboolean found;
- const gchar *search;
-
- type = pk_backend_get_uint (backend, "search-type");
- search = pk_backend_get_string (backend, "search");
-
- pi = razor_package_iterator_create (set);
- while (razor_package_iterator_next (pi, &package,
- RAZOR_DETAIL_NAME, &name,
- RAZOR_DETAIL_VERSION, &version,
- RAZOR_DETAIL_ARCH, &arch,
- RAZOR_DETAIL_SUMMARY, &summary,
- RAZOR_DETAIL_DESCRIPTION, &description,
- RAZOR_DETAIL_LAST)) {
-
- /* find in the name */
- found = pk_str_case_contains (name, search);
- if (found) {
- pk_razor_emit_package (backend, name, version, arch, summary);
-
- /* look in summary and description if we are searching by description */
- } else if (type == PK_RAZOR_SEARCH_TYPE_SUMMARY) {
- found = pk_str_case_contains (summary, search);
- if (!found) {
- found = pk_str_case_contains (description, search);
- }
- if (found) {
- pk_razor_emit_package (backend, name, version, arch, summary);
- }
- }
- }
-
- razor_package_iterator_destroy (pi);
- pk_backend_finished (backend);
- return TRUE;
-}
-
-/**
- * backend_search_name:
- */
-static void
-backend_search_name (PkBackend *backend, PkBitfield filters, const gchar *search)
-{
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID);
- pk_backend_set_uint (backend, "search-type", PK_RAZOR_SEARCH_TYPE_NAME);
- pk_backend_thread_create (backend, backend_search_thread);
-}
-
-/**
- * backend_search_description:
- */
-static void
-backend_search_description (PkBackend *backend, PkBitfield filters, const gchar *search)
-{
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID);
- pk_backend_set_uint (backend, "search-type", PK_RAZOR_SEARCH_TYPE_SUMMARY);
- pk_backend_thread_create (backend, backend_search_thread);
-}
-
-/**
- * backend_get_filters:
- */
-static PkBitfield
-backend_get_filters (PkBackend *backend)
-{
- return pk_bitfield_from_enums (PK_FILTER_ENUM_DEVELOPMENT, -1);
-}
-
-/* FIXME: port this away from PK_BACKEND_OPTIONS */
-PK_BACKEND_OPTIONS (
- "razor", /* description */
- "Richard Hughes <richard at hughsie.com>", /* author */
- backend_initialize, /* initalize */
- backend_destroy, /* destroy */
- NULL, /* get_groups */
- backend_get_filters, /* get_filters */
- NULL, /* get_roles */
- NULL, /* get_mime_types */
- NULL, /* cancel */
- NULL, /* download_packages */
- NULL, /* get_categories */
- NULL, /* get_depends */
- backend_get_details, /* get_details */
- NULL, /* get_distro_upgrades */
- backend_get_files, /* get_files */
- backend_get_packages, /* get_packages */
- NULL, /* get_repo_list */
- NULL, /* get_requires */
- NULL, /* get_update_detail */
- NULL, /* get_updates */
- NULL, /* install_files */
- NULL, /* install_packages */
- NULL, /* install_signature */
- NULL, /* refresh_cache */
- NULL, /* remove_packages */
- NULL, /* repo_enable */
- NULL, /* repo_set_data */
- backend_resolve, /* resolve */
- NULL, /* rollback */
- backend_search_description, /* search_details */
- NULL, /* search_file */
- NULL, /* search_group */
- backend_search_name, /* search_name */
- NULL, /* update_packages */
- NULL, /* update_system */
- NULL, /* what_provides */
- NULL, /* simulate_install_files */
- NULL, /* simulate_install_packages */
- NULL, /* simulate_remove_packages */
- NULL, /* simulate_update_packages */
- NULL, /* upgrade_system */
- NULL, /* transaction_start */
- NULL /* transaction_stop */
-);
-
diff --git a/configure.ac b/configure.ac
index cda925f..54d2f92 100644
--- a/configure.ac
+++ b/configure.ac
@@ -490,7 +490,6 @@ AC_ARG_ENABLE(pisi, AS_HELP_STRING([--enable-pisi],[use the PiSi backend]),enabl
AC_ARG_ENABLE(poldek, AS_HELP_STRING([--enable-poldek],[use the poldek backend]),enable_poldek=$enableval,enable_poldek=no)
AC_ARG_ENABLE(portage, AS_HELP_STRING([--enable-portage],[use the portage backend]),enable_portage=$enableval,enable_portage=no)
AC_ARG_ENABLE(ports, AS_HELP_STRING([--enable-ports],[use the ports backend]),enable_ports=$enableval,enable_ports=no)
-AC_ARG_ENABLE(razor, AS_HELP_STRING([--enable-razor],[use the razor backend]),enable_razor=$enableval,enable_razor=no)
AC_ARG_ENABLE(slapt, AS_HELP_STRING([--enable-slapt],[use the slapt backend]),enable_slapt=$enableval,enable_slapt=no)
AC_ARG_ENABLE(smart, AS_HELP_STRING([--enable-smart],[use the SMART backend]),enable_smart=$enableval,enable_smart=no)
AC_ARG_ENABLE(urpmi, AS_HELP_STRING([--enable-urpmi],[use the URPMI backend]),enable_urpmi=$enableval,enable_urpmi=no)
@@ -510,7 +509,6 @@ AM_CONDITIONAL(BACKEND_TYPE_PISI, [test x$enable_pisi = xyes])
AM_CONDITIONAL(BACKEND_TYPE_POLDEK, [test x$enable_poldek = xyes])
AM_CONDITIONAL(BACKEND_TYPE_PORTAGE, [test x$enable_portage = xyes])
AM_CONDITIONAL(BACKEND_TYPE_PORTS, [test x$enable_ports = xyes])
-AM_CONDITIONAL(BACKEND_TYPE_RAZOR, [test x$enable_razor = xyes])
AM_CONDITIONAL(BACKEND_TYPE_SLAPT, [test x$enable_slapt = xyes])
AM_CONDITIONAL(BACKEND_TYPE_SMART, [test x$enable_smart = xyes])
AM_CONDITIONAL(BACKEND_TYPE_URPMI, [test x$enable_urpmi = xyes])
@@ -595,7 +593,7 @@ dnl ---------------------------------------------------------------------------
AC_ARG_WITH([default_backend],
AS_HELP_STRING([--with-default-backend=<option>],
[Default backend to use
- alpm,aptcc,box,conary,dummy,entropy,opkg,pisi,portage,ports,razor,slapt,smart,urpmi,yum,zif,zypp (dummy)]))
+ alpm,aptcc,box,conary,dummy,entropy,opkg,pisi,portage,ports,slapt,smart,urpmi,yum,zif,zypp (dummy)]))
# default to a sane option for the installed tool
if test x$with_default_backend = x; then
if test -f /usr/bin/yum ; then
@@ -616,8 +614,6 @@ if test x$with_default_backend = x; then
with_default_backend=smart
elif test -f /usr/bin/pisi ; then
with_default_backend=pisi
- elif test -f /usr/bin/razor ; then
- with_default_backend=razor
elif test -f /usr/bin/poldek ; then
with_default_backend=poldek
elif test -f /usr/bin/urpmq ; then
@@ -722,10 +718,6 @@ if test x$enable_zypp = xyes; then
PKG_CHECK_MODULES(ZYPP, libzypp >= 6.16.0)
fi
-if test x$enable_razor = xyes; then
- PKG_CHECK_MODULES(RAZOR, razor >= 0.1)
-fi
-
if test x$enable_slapt = xyes; then
with_default_backend=dummy
AC_CHECK_HEADER([slapt.h],
@@ -796,7 +788,6 @@ backends/urpmi/Makefile
backends/urpmi/helpers/Makefile
backends/urpmi/helpers/perl_packagekit/Makefile
backends/urpmi/helpers/urpmi_backend/Makefile
-backends/razor/Makefile
backends/yum/Makefile
backends/zif/Makefile
backends/pisi/Makefile
@@ -866,7 +857,6 @@ echo "
dummy backend: ${enable_dummy}
Entropy backend: ${enable_entropy}
OPKG backend: ${enable_opkg}
- Razor backend: ${enable_razor}
PiSi backend: ${enable_pisi}
poldek backend: ${enable_poldek}
Portage backend: ${enable_portage}
commit 0c811a55414684f3f2dd5e3f2a1672c2fcce3a98
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 12 17:16:13 2011 +0100
apt: Remove the python apt backend, and leave the aptcc backend
It's been more than a year since the last commit, and it's limping along.
I think aptcc is much better maintained these days.
diff --git a/backends/Makefile.am b/backends/Makefile.am
index 050b737..7665dcc 100644
--- a/backends/Makefile.am
+++ b/backends/Makefile.am
@@ -4,10 +4,6 @@ if BACKEND_TYPE_ALPM
SUBDIRS += alpm
endif
-if BACKEND_TYPE_APT
-SUBDIRS += apt
-endif
-
if BACKEND_TYPE_APTCC
SUBDIRS += aptcc
endif
diff --git a/backends/apt/20packagekit b/backends/apt/20packagekit
deleted file mode 100644
index 0c6bfb7..0000000
--- a/backends/apt/20packagekit
+++ /dev/null
@@ -1,12 +0,0 @@
-// THIS FILE IS USED TO INFORM PACKAGEKIT
-// THAT THE UPDATES MIGHT HAVE CHANGED
-// Whenever the dpkg is called we might have different updates
-// i.e. a user removes a package that had an update
-DPkg::Post-Invoke {
-"/usr/bin/test -e /usr/share/dbus-1/system-services/org.freedesktop.PackageKit.service && /usr/bin/test -S /var/run/dbus/system_bus_socket && /usr/bin/dbus-send --print-reply --system --dest=org.freedesktop.PackageKit --type=method_call /org/freedesktop/PackageKit org.freedesktop.PackageKit.StateHasChanged string:'cache-update' > /dev/null; /bin/echo > /dev/null";
-};
-
-// When the apt cache is updated (i.e. apt-cache update)
-APT::Update::Post-Invoke-Success {
-"/usr/bin/test -e /usr/share/dbus-1/system-services/org.freedesktop.PackageKit.service && /usr/bin/test -S /var/run/dbus/system_bus_socket && /usr/bin/dbus-send --print-reply --system --dest=org.freedesktop.PackageKit --type=method_call /org/freedesktop/PackageKit org.freedesktop.PackageKit.StateHasChanged string:'cache-update' > /dev/null; /bin/echo > /dev/null";
-};
diff --git a/backends/apt/HACKING.apt b/backends/apt/HACKING.apt
deleted file mode 100644
index 239700f..0000000
--- a/backends/apt/HACKING.apt
+++ /dev/null
@@ -1,5 +0,0 @@
-The backend can be tested by running it as root from the source code and using
-
- sudo python aptBackend.py --debug
-
-Use the --help command line switch for more details.
diff --git a/backends/apt/Makefile.am b/backends/apt/Makefile.am
deleted file mode 100644
index 14e913d..0000000
--- a/backends/apt/Makefile.am
+++ /dev/null
@@ -1,37 +0,0 @@
-INCLUDES = \
- -DG_LOG_DOMAIN=\"PackageKit-Apt\"
-
-plugindir = $(PK_PLUGIN_DIR)
-plugin_LTLIBRARIES = libpk_backend_apt.la
-libpk_backend_apt_la_SOURCES = pk-backend-apt.c
-libpk_backend_apt_la_LIBADD = $(PK_PLUGIN_LIBS)
-libpk_backend_apt_la_LDFLAGS = -module -avoid-version
-libpk_backend_apt_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
-
-aptconfdir = ${SYSCONFDIR}/apt/apt.conf.d
-aptconf_DATA = 20packagekit
-
-helperdir = $(datadir)/PackageKit/helpers/apt
-dist_helper_DATA = \
- aptBackend.py \
- $(NULL)
-
-sbin_SCRIPTS = \
- update-packagekit-app-data \
- $(NULL)
-
-EXTRA_DIST = \
- 20packagekit \
- update-packagekit-app-data \
- README.apt \
- TODO.apt \
- $(NULL)
-
-install-data-hook:
- chmod a+rx $(DESTDIR)$(helperdir)/*.py
-
-clean-local :
- rm -f *~
- rm -f *.pyc
-
--include $(top_srcdir)/git.mk
diff --git a/backends/apt/README.apt b/backends/apt/README.apt
deleted file mode 100644
index beee1e8..0000000
--- a/backends/apt/README.apt
+++ /dev/null
@@ -1,23 +0,0 @@
-The name of this backend is apt
-
-It supports the Advanced Packaging Tool used by Debian and its derivates. The
-implementation was done in Python. The communication between the daemon and
-the backend process happens via stdin and stdout, it is a so called spawned
-backend using a dispatcher to allow the execution of several commands in a row.
-
-To provide a tremendously fast search function a Xapian database is used.
-It is provided by Enrico Zini's apt-xapian-index. Debtags will be used to
-enhance the quality of the search results further.
-
-A list of implemented functions are listed in the PackageKit FAQ:
-
-http://www.packagekit.org/pk-faq.html
-
-You can find packages for Ubuntu here:
-
-https://www.launchpad.net/~packagekit/+ppa
-
-Packages for Debian Unstable will be provided soon.
-
-Feel free to send comments or bug reports to the PackageKit mailing list
-or to the author.
diff --git a/backends/apt/TODO.apt b/backends/apt/TODO.apt
deleted file mode 100644
index affc71b..0000000
--- a/backends/apt/TODO.apt
+++ /dev/null
@@ -1,27 +0,0 @@
-ISSUES:
-
- * Support delayed or hidden debconf questions
-
-Unresolved issues can be discussed at the following wiki page:
-http://wiki.debian.org/PackageKit
-
-
-TODO:
-
- * Implement all open backend methods. A list of implemented backend methods
- can be found in PackageKit FAQ or in pk-backend-apt.c.
-
- * Blacklist packages requiring input on the terminal and try to change
- the Debian policy in the long run. Way of automation?
-
- * Allow to reinject debtags into the search results to get
- similar software which not matches on the search terms
-
- * Index file list and add properties for package name and section to
- the xapian database to also make use of it in search group and
- search name (do we want this?)
-
- * Test and think about packages from cdroms
-
- * Talk to Sebastian Dröge about his new codec search implementation using
- debtags
diff --git a/backends/apt/aptBackend.py b/backends/apt/aptBackend.py
deleted file mode 100755
index 4cfb2bf..0000000
--- a/backends/apt/aptBackend.py
+++ /dev/null
@@ -1,2245 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-"""
-Provides an apt backend to PackageKit
-
-Copyright (C) 2007 Ali Sabil <ali.sabil at gmail.com>
-Copyright (C) 2007 Tom Parker <palfrey at tevp.net>
-Copyright (C) 2008-2009 Sebastian Heinlein <glatzor at ubuntu.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.
-"""
-
-__author__ = "Sebastian Heinlein <devel at glatzor.de>"
-
-import datetime
-import errno
-import fcntl
-import gdbm
-import httplib
-import locale
-import logging
-import logging.handlers
-import optparse
-import os
-import pty
-import re
-import signal
-import socket
-import stat
-import string
-import subprocess
-import sys
-import time
-
-import apt
-import apt.debfile
-import apt_pkg
-
-from packagekit.backend import *
-from packagekit.progress import *
-from packagekit.package import *
-from packagekit.enums import *
-
-logging.basicConfig(format="%(levelname)s:%(message)s")
-pklog = logging.getLogger("PackageKitBackend")
-pklog.setLevel(logging.NOTSET)
-
-try:
- _syslog = logging.handlers.SysLogHandler("/dev/log",
- logging.handlers.SysLogHandler.LOG_DAEMON)
- formatter = logging.Formatter('PackageKit: %(levelname)s: %(message)s')
- _syslog.setFormatter(formatter)
- pklog.addHandler(_syslog)
-except:
- pass
-
-# Xapian database is optionally used to speed up package description search
-XAPIAN_DB_PATH = os.environ.get("AXI_DB_PATH", "/var/lib/apt-xapian-index")
-XAPIAN_DB = XAPIAN_DB_PATH + "/index"
-XAPIAN_DB_VALUES = XAPIAN_DB_PATH + "/values"
-XAPIAN_SUPPORT = False
-try:
- import xapian
-except ImportError:
- pass
-else:
- if os.access(XAPIAN_DB, os.R_OK):
- pklog.debug("Use XAPIAN for the search")
- XAPIAN_SUPPORT = True
-
-# SoftwareProperties is required to proivde information about repositories
-try:
- import softwareproperties.SoftwareProperties
-except ImportError:
- REPOS_SUPPORT = False
-else:
- REPOS_SUPPORT = True
-
-# Check if update-manager-core is installed to get aware of the
-# latest distro releases
-try:
- from UpdateManager.Core.MetaRelease import MetaReleaseCore
-except ImportError:
- META_RELEASE_SUPPORT = False
-else:
- META_RELEASE_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")
-# Avoid questions from the maintainer scripts as far as possible
-os.putenv("DEBIAN_FRONTEND", "noninteractive")
-os.putenv("APT_LISTCHANGES_FRONTEND", "none")
-
-# Map Debian sections to the PackageKit group name space
-SECTION_GROUP_MAP = {
- "admin" : GROUP_ADMIN_TOOLS,
- "base" : GROUP_SYSTEM,
- "comm" : GROUP_COMMUNICATION,
- "devel" : GROUP_PROGRAMMING,
- "doc" : GROUP_DOCUMENTATION,
- "editors" : GROUP_PUBLISHING,
- "electronics" : GROUP_ELECTRONICS,
- "embedded" : GROUP_SYSTEM,
- "games" : GROUP_GAMES,
- "gnome" : GROUP_DESKTOP_GNOME,
- "graphics" : GROUP_GRAPHICS,
- "hamradio" : GROUP_COMMUNICATION,
- "interpreters" : GROUP_PROGRAMMING,
- "kde" : GROUP_DESKTOP_KDE,
- "libdevel" : GROUP_PROGRAMMING,
- "libs" : GROUP_SYSTEM,
- "mail" : GROUP_INTERNET,
- "math" : GROUP_SCIENCE,
- "misc" : GROUP_OTHER,
- "net" : GROUP_NETWORK,
- "news" : GROUP_INTERNET,
- "oldlibs" : GROUP_LEGACY,
- "otherosfs" : GROUP_SYSTEM,
- "perl" : GROUP_PROGRAMMING,
- "python" : GROUP_PROGRAMMING,
- "science" : GROUP_SCIENCE,
- "shells" : GROUP_SYSTEM,
- "sound" : GROUP_MULTIMEDIA,
- "tex" : GROUP_PUBLISHING,
- "text" : GROUP_PUBLISHING,
- "utils" : GROUP_ACCESSORIES,
- "web" : GROUP_INTERNET,
- "x11" : GROUP_DESKTOP_OTHER,
- "unknown" : GROUP_UNKNOWN,
- "alien" : GROUP_UNKNOWN,
- "translations" : GROUP_LOCALIZATION,
- "metapackages" : GROUP_COLLECTIONS }
-
-# Regular expressions to detect bug numbers in changelogs according to the
-# Debian Policy Chapter 4.4. For details see the footnote 16:
-# http://www.debian.org/doc/debian-policy/footnotes.html#f16
-MATCH_BUG_CLOSES_DEBIAN=r"closes:\s*(?:bug)?\#?\s?\d+(?:,\s*(?:bug)?\#?\s?\d+)*"
-MATCH_BUG_NUMBERS=r"\#?\s?(\d+)"
-# URL pointing to a bug in the Debian bug tracker
-HREF_BUG_DEBIAN="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s"
-
-MATCH_BUG_CLOSES_UBUNTU = r"lp:\s+\#\d+(?:,\s*\#\d+)*"
-HREF_BUG_UBUNTU = "https://bugs.launchpad.net/bugs/%s"
-
-# Regular expression to find cve references
-MATCH_CVE="CVE-\d{4}-\d{4}"
-HREF_CVE="http://web.nvd.nist.gov/view/vuln/detail?vulnId=%s"
-
-SYNAPTIC_PIN_FILE = "/var/lib/synaptic/preferences"
-
-DEFAULT_ENCODING = "UTF-8"
-
-# Required to get translated descriptions
-try:
- locale.setlocale(locale.LC_ALL, "")
-except locale.Error:
- pklog.debug("Failed to unset LC_ALL")
-
-# Allows to write unicode to stdout
-import codecs
-sys.stdout = codecs.getwriter(DEFAULT_ENCODING)(sys.stdout)
-
-# Required to parse RFC822 time stamps
-try:
- locale.setlocale(locale.LC_TIME, "C")
-except locale.Error:
- pklog.debug("Failed to unset LC_TIME")
-
-def lock_cache(func):
- """Lock the system package cache before excuting the decorated function and
- release the lock afterwards.
- """
- def _locked_cache(*args, **kwargs):
- backend = args[0]
- backend.status(STATUS_WAITING_FOR_LOCK)
- while True:
- try:
- # see if the lock for the download dir can be acquired
- # (work around bug in python-apt/apps that call _fetchArchives)
- lockfile = apt_pkg.Config.FindDir("Dir::Cache::Archives") + \
- "lock"
- lock = apt_pkg.GetLock(lockfile)
- if lock < 0:
- raise SystemError("failed to lock '%s'" % lockfile)
- else:
- os.close(lock)
- # then lock the main package system
- apt_pkg.PkgSystemLock()
- except SystemError:
- time.sleep(3)
- else:
- break
- try:
- func(*args, **kwargs)
- finally:
- backend._unlock_cache()
- return _locked_cache
-
-
-class PKError(Exception):
- pass
-
-class PackageManagerFailedPKError(PKError):
- def __init__(self, msg, pkg, output):
- self.message = msg
- self.package = pkg
- self.output = output
-
-class InstallTimeOutPKError(PKError):
- pass
-
-
-class DpkgInstallProgress(apt.progress.InstallProgress):
- """
- Class to initiate and monitor installation of local package files with dpkg
- """
- #FIXME: Use the merged DpkgInstallProgress of python-apt
- def recover(self):
- """
- Run "dpkg --configure -a"
- """
- cmd = ["/usr/bin/dpkg", "--status-fd", str(self.writefd),
- "--root", apt_pkg.Config["Dir"],
- "--force-confdef", "--force-confold",
- "--configure", "-a"]
- self.run(cmd)
-
- def install(self, filenames):
- """
- Install the given package using a dpkg command line call
- """
- cmd = ["/usr/bin/dpkg", "--force-confdef", "--force-confold",
- "--status-fd", str(self.writefd),
- "--root", apt_pkg.Config["Dir"], "-i"]
- cmd.extend(map(lambda f: str(f), filenames))
- self.run(cmd)
-
- def run(self, cmd):
- """
- Run and monitor a dpkg command line call
- """
- pklog.debug("Executing: %s" % cmd)
- (self.master_fd, slave) = pty.openpty()
- fcntl.fcntl(self.master_fd, fcntl.F_SETFL, os.O_NONBLOCK)
- p = subprocess.Popen(cmd, stdout=slave, stdin=slave)
- self.child_pid = p.pid
- res = self.waitChild()
- return res
-
- def updateInterface(self):
- """
- Process status messages from dpkg
- """
- if self.statusfd == None:
- return
- try:
- while not self.read.endswith("\n"):
- self.read += os.read(self.statusfd.fileno(), 1)
- except OSError, (error_no, error_str):
- # resource temporarly unavailable is ignored
- if error_no not in [errno.EAGAIN, errno.EWOULDBLOCK]:
- pklog.warn(error_str)
- if self.read.endswith("\n"):
- statusl = string.split(self.read, ":")
- if len(statusl) < 3:
- pklog.warn("got garbage from dpkg: '%s'" % self.read)
- self.read = ""
- status = statusl[2].strip()
- pkg = statusl[1].strip()
- #print status
- if status == "error":
- self.error(pkg, format_string(status))
- elif status == "conffile-prompt":
- # we get a string like this:
- # 'current-conffile' 'new-conffile' useredited distedited
- match = re.search(".+conffile-prompt : '(.+)' '(.+)'",
- self.read)
- self.conffile(match.group(1), match.group(2))
- else:
- pklog.debug("Dpkg status: %s" % status)
- self.status = status
- self.read = ""
-
-
-class PackageKitOpProgress(apt.progress.OpProgress):
- """
- Handle the cache opening process
- """
- def __init__(self, backend, prange=(0,100), progress=True):
- self._backend = backend
- apt.progress.OpProgress.__init__(self)
- self.steps = []
- for v in [0.12, 0.25, 0.50, 0.75, 1.00]:
- s = prange[0] + (prange[1] - prange[0]) * v
- self.steps.append(s)
- self.pstart = float(prange[0])
- self.pend = self.steps.pop(0)
- self.pprev = None
- self.show_progress = progress
-
- # OpProgress callbacks
- def update(self, percent):
- progress = int(self.pstart + percent / 100 * (self.pend - self.pstart))
- if self.show_progress == True and self.pprev < progress:
- self._backend.percentage(progress)
- self.pprev = progress
-
- def done(self):
- self.pstart = self.pend
- try:
- self.pend = self.steps.pop(0)
- except:
- pklog.warning("An additional step to open the cache is required")
-
-
-class PackageKitFetchProgress(apt.progress.FetchProgress):
- """
- Handle the package download process
- """
- def __init__(self, backend, prange=(0,100), status=STATUS_DOWNLOAD):
- self._backend = backend
- apt.progress.FetchProgress.__init__(self)
- self.start_progress = prange[0]
- self.end_progress = prange[1]
- self.last_progress = None
- self.last_sub_progress = None
- self.status = status
- self.package_states = {}
-
- def pulse_items(self, items):
- apt.progress.FetchProgress.pulse(self)
- progress = int(self.start_progress + self.percent/100 * \
- (self.end_progress - self.start_progress))
- # A backwards running progress is reported as a not available progress
- if self.last_progress > progress:
- self._backend.percentage()
- else:
- self._backend.percentage(progress)
- self.last_progress = progress
- for item in items:
- uri, desc, shortdesc, file_size, partial_size = item
- try:
- pkg = self._backend._cache[shortdesc]
- except KeyError:
- pass
- else:
- self._backend._emit_package(pkg, INFO_DOWNLOADING, True)
- sub_progress = partial_size * 100 / file_size
- if sub_progress > self.last_sub_progress:
- self._last_sub_progress = sub_progress
- self._backend.sub_percentage(sub_progress)
- return True
-
- def updateStatus(self, uri, descr, pkg_name, status):
- """Callback for a fetcher status update."""
- # Emit a Package signal for the currently processed package
- try:
- pkg = self._backend._cache[pkg_name]
- except KeyError:
- pass
- else:
- if not pkg_name in self.package_states or \
- self.package_states[pkg_name] != status:
- if status == 0:
- info = INFO_FINISHED
- else:
- info = INFO_DOWNLOADING
- self.package_states[pkg_name] = status
- self._backend._emit_package(pkg, info, True)
-
- def start(self):
- self._backend.status(self.status)
- self._backend.allow_cancel(True)
-
- def stop(self):
- self._backend.percentage(self.end_progress)
- self._backend.allow_cancel(False)
-
- def mediaChange(self, medium, drive):
- #FIXME: Perhaps use hal to show a nicer drive name
- self._backend.media_change_required(MEDIA_TYPE_DISC, medium, drive)
- # FIXME: We cannot call sys.exit() here. APT module would procduce
- # a backend error message otherwise. This way the backend
- # sends another error message in the FetchFailedError handling
- # later, but this one will be skipped by the daemon
- self._backend.error(ERROR_MEDIA_CHANGE_REQUIRED,
- "Insert the CDROM or DVD labeled '%s' "
- "into drive '%s'" % (medium, drive),
- exit=False)
- return False
-
-
-class PackageKitInstallProgress(apt.progress.InstallProgress):
- """
- Handle the installation and removal process. Bits taken from
- DistUpgradeViewNonInteractive.
- """
- def __init__(self, backend, prange=(0,100)):
- apt.progress.InstallProgress.__init__(self)
- self._backend = backend
- self.pstart = prange[0]
- self.pend = prange[1]
- self.pprev = None
- self.last_activity = None
- self.conffile_prompts = set()
- # insanly long timeout to be able to kill hanging maintainer scripts
- self.timeout = 10 * 60
- self.start_time = None
- self.output = ""
- self.master_fd = None
- self.child_pid = None
- self.last_pkg = None
-
- def statusChange(self, pkg_name, percent, status):
- self.last_activity = time.time()
- progress = self.pstart + percent/100 * (self.pend - self.pstart)
- if self.pprev < progress:
- self._backend.percentage(int(progress))
- self.pprev = progress
- # Emit a Package signal for the currently processed package
- if pkg_name != self.last_pkg and self._backend._cache.has_key(pkg_name):
- pkg = self._backend._cache[pkg_name]
- if pkg.markedInstall or pkg.markedReinstall:
- self._backend._emit_package(pkg, INFO_INSTALLING, True)
- elif pkg.markedDelete:
- self._backend._emit_package(pkg, INFO_REMOVING, False)
- elif pkg.markedUpgrade:
- self._backend._emit_package(pkg, INFO_UPDATING, True)
- elif pkg.markedDowngrade:
- self._backend._emit_package(pkg, INFO_DOWNGRADING, True)
- self.last_pkg = pkg_name
- pklog.debug("APT status: %s" % status)
-
- def startUpdate(self):
- # The apt system lock was set by _lock_cache() before
- self._backend._unlock_cache()
- self._backend.status(STATUS_COMMIT)
- self.last_activity = time.time()
- self.start_time = time.time()
-
- def fork(self):
- pklog.debug("fork()")
- (pid, self.master_fd) = pty.fork()
- if pid != 0:
- fcntl.fcntl(self.master_fd, fcntl.F_SETFL, os.O_NONBLOCK)
- return pid
-
- def updateInterface(self):
- apt.progress.InstallProgress.updateInterface(self)
- # Collect the output from the package manager
- try:
- out = os.read(self.master_fd, 512)
- self.output = self.output + out
- pklog.debug("APT out: %s " % out)
- except OSError:
- pass
- # catch a time out by sending crtl+c
- if self.last_activity + self.timeout < time.time():
- pklog.critical("no activity for %s time sending ctrl-c" \
- % self.timeout)
- os.write(self.master_fd, chr(3))
- #FIXME: include this into the normal install progress and add
- # correct package information
- raise InstallTimeOutPKError(self.output)
-
- def conffile(self, current, new):
- pklog.warning("Config file prompt: '%s' (sending no)" % current)
- self.conffile_prompts.add(new)
-
- def error(self, pkg, msg):
- raise PackageManagerFailedPKError(pkg, msg, self.output)
-
- def finishUpdate(self):
- pklog.debug("finishUpdate()")
- if self.conffile_prompts:
- self._backend.message(MESSAGE_CONFIG_FILES_CHANGED,
- "The following conffile prompts were found "
- "and need investigation: %s" % \
- "\n".join(self.conffile_prompts))
- # Check for required restarts
- if os.path.exists("/var/run/reboot-required") and \
- os.path.getmtime("/var/run/reboot-required") > self.start_time:
- self._backend.require_restart(RESTART_SYSTEM, "")
-
-
-class PackageKitDpkgInstallProgress(DpkgInstallProgress,
- PackageKitInstallProgress):
- """
- Class to integrate the progress of core dpkg operations into PackageKit
- """
- def run(self, filenames):
- return DpkgInstallProgress.run(self, filenames)
-
- def updateInterface(self):
- DpkgInstallProgress.updateInterface(self)
- try:
- out = os.read(self.master_fd, 512)
- self.output += out
- if out != "": pklog.debug("Dpkg out: %s" % out)
- except OSError:
- pass
- # we timed out, send ctrl-c
- if self.last_activity + self.timeout < time.time():
- pklog.critical("no activity for %s time sending "
- "ctrl-c" % self.timeout)
- os.write(self.master_fd, chr(3))
- raise InstallTimeOutPKError(self.output)
-
-
-if REPOS_SUPPORT == True:
- class PackageKitSoftwareProperties(softwareproperties.SoftwareProperties.SoftwareProperties):
- """
- Helper class to fix a siily bug in python-software-properties
- """
- def set_modified_sourceslist(self):
- self.save_sourceslist()
-
-
-class PackageKitAptBackend(PackageKitBaseBackend):
- """
- PackageKit backend for apt
- """
- def __init__(self, args):
- pklog.info("Initializing APT backend")
- signal.signal(signal.SIGQUIT, self._sigquit)
- self._cache = None
- self._last_cache_refresh = None
- apt_pkg.InitConfig()
- apt_pkg.Config.Set("DPkg::Options::", '--force-confdef')
- apt_pkg.Config.Set("DPkg::Options::", '--force-confold')
- PackageKitBaseBackend.__init__(self, args)
- self._open_cache(progress=False)
-
- # Methods ( client -> engine -> backend )
-
- def search_file(self, filters, filenames):
- """Search for files in packages.
-
- Works only for installed file if apt-file isn't installed.
- """
- pklog.info("Searching for file: %s" % filenames)
- self.status(STATUS_QUERY)
- self.percentage(None)
- self._check_init(progress=False)
- self.allow_cancel(True)
-
- result_names = set()
- # Optionally make use of apt-file's Contents cache to search for not
- # installed files. But still search for installed files additionally
- # to make sure that we provide up-to-date results
- if os.path.exists("/usr/bin/apt-file") and \
- FILTER_INSTALLED not in filters:
- #FIXME: Make use of rapt-file on Debian if the network is available
- #FIXME: Show a warning to the user if the apt-file cache is several
- # weeks old
- pklog.debug("Using apt-file")
- filenames_regex = []
- for filename in filenames:
- if filename.startswith("/"):
- pattern = "^%s$" % filename[1:].replace("/", "\/")
- else:
- pattern = "\/%s$" % filename
- filenames_regex.append(pattern)
- cmd = ["/usr/bin/apt-file", "--regexp", "--non-interactive",
- "--package-only", "find", "|".join(filenames_regex)]
- pklog.debug("Calling: %s" % cmd)
- apt_file = subprocess.Popen(cmd, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- stdout, stderr = apt_file.communicate()
- if apt_file.returncode == 0:
- #FIXME: Actually we should check if the file is part of the
- # candidate, e.g. if unstable and experimental are
- # enabled and a file would only be part of the
- # experimental version
- result_names.update(stdout.split())
- self._emit_visible_packages_by_name(filters, result_names)
- else:
- self.error(ERROR_INTERNAL_ERROR,
- format_string("%s %s" % (stdout, stderr)))
- # Search for installed files
- filenames_regex = []
- for filename in filenames:
- if filename.startswith("/"):
- pattern = "^%s$" % filename.replace("/", "\/")
- else:
- pattern = ".*\/%s$" % filename
- filenames_regex.append(pattern)
- files_pattern = re.compile("|".join(filenames_regex))
- for pkg in self._cache:
- if pkg.name in result_names:
- continue
- for installed_file in self._get_installed_files(pkg):
- if files_pattern.match(installed_file):
- self._emit_visible_package(filters, pkg)
- break
-
- def search_group(self, filters, groups):
- """
- Implement the apt2-search-group functionality
- """
- pklog.info("Searching for groups: %s" % groups)
- self.status(STATUS_QUERY)
- self.percentage(None)
- self._check_init(progress=False)
- self.allow_cancel(True)
-
- for pkg in self._cache:
- if self._get_package_group(pkg) in groups:
- self._emit_visible_package(filters, pkg)
-
- def search_name(self, filters, values):
- """
- Implement the apt2-search-name functionality
- """
- def matches(searches, text):
- for search in searches:
- if not search in text:
- return False
- return True
- pklog.info("Searching for package name: %s" % values)
- self.status(STATUS_QUERY)
- self.percentage(None)
- self._check_init(progress=False)
- self.allow_cancel(True)
-
- for pkg_name in self._cache.keys():
- if matches(values, pkg_name):
- self._emit_all_visible_pkg_versions(filters,
- self._cache[pkg_name])
-
- def search_details(self, filters, values):
- """
- Implement the apt2-search-details functionality
- """
- pklog.info("Searching for package details: %s" % values)
- self.status(STATUS_QUERY)
- self.percentage(None)
- self._check_init(progress=False)
- self.allow_cancel(True)
- results = []
-
- if XAPIAN_SUPPORT == True:
- search_flags = (xapian.QueryParser.FLAG_BOOLEAN |
- xapian.QueryParser.FLAG_PHRASE |
- xapian.QueryParser.FLAG_LOVEHATE |
- xapian.QueryParser.FLAG_BOOLEAN_ANY_CASE)
- pklog.debug("Performing xapian db based search")
- db = xapian.Database(XAPIAN_DB)
- parser = xapian.QueryParser()
- parser.set_default_op(xapian.Query.OP_AND)
- query = parser.parse_query(u" ".join(values), search_flags)
- enquire = xapian.Enquire(db)
- enquire.set_query(query)
- matches = enquire.get_mset(0, 1000)
- for pkg_name in (match[xapian.MSET_DOCUMENT].get_data() \
- for match in enquire.get_mset(0,1000)):
- if pkg_name in self._cache:
- self._emit_visible_package(filters, self._cache[pkg_name])
- else:
- def matches(searches, text):
- for search in searches:
- if not search in text:
- return False
- return True
- pklog.debug("Performing apt cache based search")
- values = [val.lower() for val in values]
- for pkg in self._cache:
- txt = pkg.name
- try:
- txt += pkg.candidate.raw_description.lower()
- txt += pkg.candidate._translated_records.long_desc.lower()
- except AttributeError:
- pass
- if matches(values, txt.decode(DEFAULT_ENCODING, "replace")):
- self._emit_visible_package(filters, pkg)
-
- def get_distro_upgrades(self):
- """
- Implement the {backend}-get-distro-upgrades functionality
- """
- pklog.info("Get distro upgrades")
- self.status(STATUS_INFO)
- self.allow_cancel(False)
- self.percentage(None)
-
- if META_RELEASE_SUPPORT == False:
- if self._cache.has_key("update-manager-core") and \
- self._cache["update-manager-core"].isInstalled == False:
- self.error(ERROR_INTERNAL_ERROR,
- "Please install the package update-manager-core to "
- "get notified of the latest distribution releases.")
- else:
- self.error(ERROR_INTERNAL_ERROR,
- "Please make sure that update-manager-core is"
- "correctly installed.")
- return
-
- #FIXME Evil to start the download during init
- meta_release = MetaReleaseCore(False, False)
- #FIXME: should use a lock
- while meta_release.downloading:
- time.sleep(1)
- #FIXME: Add support for description
- if meta_release.new_dist != None:
- self.distro_upgrade("stable",
- "%s %s" % (meta_release.new_dist.name,
- meta_release.new_dist.version),
- "The latest stable release")
-
- def get_updates(self, filters):
- """
- Implement the {backend}-get-update functionality.
-
- Only report updates which can be installed safely: Which can depend
- on the installation of additional packages but which don't require
- the removal of already installed packages or block any other update.
- """
- def succeeds_security_update(pkg):
- """
- Return True if an update succeeds a previous security update
-
- An example would be a package with version 1.1 in the security
- archive and 1.1.1 in the archive of proposed updates or the
- same version in both archives.
- """
- for version in pkg.versions:
- # Only check versions between the installed and the candidate
- if pkg.installed and \
- apt_pkg.VersionCompare(version.version,
- pkg.installed.version) <= 0 and \
- apt_pkg.VersionCompare(version.version,
- pkg.candidate.version) > 0:
- continue
- for origin in version.origins:
- if origin.origin in ["Debian", "Ubuntu"] and \
- (origin.archive.endswith("-security") or \
- origin.label == "Debian-Security") and \
- origin.trusted:
- return True
- return False
- #FIXME: Implment the basename filter
- pklog.info("Get updates")
- self.status(STATUS_QUERY)
- self.allow_cancel(True)
- self.percentage(None)
- self._check_init(progress=False)
- # Start with a safe upgrade
- self._cache.upgrade()
- upgrades_safe = self._cache.getChanges()
- resolver = apt.cache.ProblemResolver(self._cache)
- for upgrade in upgrades_safe:
- resolver.clear(upgrade)
- resolver.protect(upgrade)
- # Search for upgrades which are not already part of the safe upgrade
- # but would only require the installation of additional packages
- for pkg in self._cache:
- if not pkg.isUpgradable:
- continue
- # This may occur on pinned packages which have been updated to
- # later version than the pinned one
- if not pkg.candidateOrigin:
- continue
- pklog.debug("Checking upgrade of %s" % pkg.name)
- if not pkg in upgrades_safe:
- # Check if the upgrade would require the removal of an already
- # installed package. If this is the case it will be skipped
- resolver.clear(pkg)
- resolver.protect(pkg)
- resolver.install_protect()
- try:
- resolver.resolve()
- except:
- self._emit_package(pkg, INFO_BLOCKED, force_candidate=True)
- resolver.clear(pkg)
- self._cache.clear()
- continue
- if self._cache.delete_count:
- self._emit_package(pkg, INFO_BLOCKED, force_candidate=True)
- resolver.clear(pkg)
- self._cache.clear()
- continue
- # The update can be safely installed
- info = INFO_NORMAL
- # Detect the nature of the upgrade (e.g. security, enhancement)
- archive = pkg.candidateOrigin[0].archive
- origin = pkg.candidateOrigin[0].origin
- trusted = pkg.candidateOrigin[0].trusted
- label = pkg.candidateOrigin[0].label
- if origin in ["Debian", "Ubuntu"] and trusted == True:
- if archive.endswith("-security") or \
- label == "Debian-Security":
- info = INFO_SECURITY
- elif succeeds_security_update(pkg):
- pklog.debug("Update of %s succeeds a security update. "
- "Raising its priority." % pkg.name)
- info = INFO_SECURITY
- elif archive.endswith("-backports"):
- info = INFO_ENHANCEMENT
- elif archive.endswith("-updates"):
- info = INFO_BUGFIX
- if origin in ["Backports.org archive"] and trusted == True:
- info = INFO_ENHANCEMENT
- self._emit_package(pkg, info, force_candidate=True)
- self._cache.clear()
-
- def get_update_detail(self, pkg_ids):
- """
- Implement the {backend}-get-update-details functionality
- """
- def get_bug_urls(changelog):
- """
- Create a list of urls pointing to closed bugs in the changelog
- """
- urls = []
- for r in re.findall(MATCH_BUG_CLOSES_DEBIAN, changelog,
- re.IGNORECASE | re.MULTILINE):
- urls.extend([HREF_BUG_DEBIAN % bug for bug in \
- re.findall(MATCH_BUG_NUMBERS, r)])
- for r in re.findall(MATCH_BUG_CLOSES_UBUNTU, changelog,
- re.IGNORECASE | re.MULTILINE):
- urls.extend([HREF_BUG_UBUNTU % bug for bug in \
- re.findall(MATCH_BUG_NUMBERS, r)])
- return urls
-
- def get_cve_urls(changelog):
- """
- Create a list of urls pointing to cves referred in the changelog
- """
- return map(lambda c: HREF_CVE % c,
- re.findall(MATCH_CVE, changelog, re.MULTILINE))
-
- pklog.info("Get update details of %s" % pkg_ids)
- self.status(STATUS_DOWNLOAD_CHANGELOG)
- self.percentage(0)
- self.allow_cancel(True)
- self._check_init(None)
- total = len(pkg_ids)
- count = 1
- for pkg_id in pkg_ids:
- self.percentage(count * 100 / total)
- count += 1
- pkg = self._get_package_by_id(pkg_id)
- # FIXME add some real data
- if pkg.installed.origins:
- installed_origin = pkg.installed.origins[0].label
- else:
- installed_origin = ""
- updates = "%s;%s;%s;%s" % (pkg.name, pkg.installed.version,
- pkg.installed.architecture,
- installed_origin)
- obsoletes = ""
- vendor_url = ""
- restart = "none"
- update_text = u""
- state = ""
- issued = ""
- updated = ""
- #FIXME: make this more configurable. E.g. a dbus update requires
- # a reboot on Ubuntu but not on Debian
- if pkg.name.startswith("linux-image-") or \
- pkg.name in ["libc6", "dbus"]:
- restart == RESTART_SYSTEM
- changelog_raw = pkg.getChangelog()
- # The internal download error string of python-apt ist not
- # provided as unicode object
- if not isinstance(changelog_raw, unicode):
- changelog_raw = changelog_raw.decode(DEFAULT_ENCODING)
- # Convert the changelog to markdown syntax
- changelog = u""
- for line in changelog_raw.split("\n"):
- if line == "":
- changelog += " \n"
- else:
- changelog += u" %s \n" % line
- if line.startswith(pkg.candidate.source_name):
- match = re.match(r"(?P<source>.+) \((?P<version>.*)\) "
- "(?P<dist>.+); urgency=(?P<urgency>.+)",
- line)
- update_text += u"%s\n%s\n\n" % (match.group("version"),
- "=" * \
- len(match.group("version")))
- elif line.startswith(" "):
- update_text += u" %s \n" % line
- elif line.startswith(" --"):
- #FIXME: Add %z for the time zone - requires Python 2.6
- update_text += u" \n"
- match = re.match("^ -- (?P<maintainer>.+) (?P<mail><.+>) "
- "(?P<date>.+) (?P<offset>[-\+][0-9]+)$",
- line)
- date = datetime.datetime.strptime(match.group("date"),
- "%a, %d %b %Y %H:%M:%S")
-
- issued = date.isoformat()
- if not updated:
- updated = date.isoformat()
- if issued == updated:
- updated = ""
- bugzilla_url = ";;".join(get_bug_urls(changelog))
- cve_url = ";;".join(get_cve_urls(changelog))
- self.update_detail(pkg_id, updates, obsoletes, vendor_url,
- bugzilla_url, cve_url, restart,
- format_string(update_text),
- format_string(changelog),
- state, issued, updated)
-
- def get_details(self, pkg_ids):
- """
- Implement the {backend}-get-details functionality
- """
- pklog.info("Get details of %s" % pkg_ids)
- self.status(STATUS_INFO)
- self.percentage(None)
- self.allow_cancel(True)
- self._check_init(progress=False)
- for pkg_id in pkg_ids:
- pkg = self._get_package_by_id(pkg_id)
- #FIXME: We need more fine grained license information!
- candidate = pkg.candidateOrigin
- if candidate != None and \
- candidate[0].component in ["main", "universe"] and \
- candidate[0].origin in ["Debian", "Ubuntu"]:
- license = "free"
- else:
- license = "unknown"
- group = self._get_package_group(pkg)
- self.details(pkg_id, license, group,
- format_string(pkg.description),
- pkg.homepage.decode(DEFAULT_ENCODING),
- pkg.packageSize)
-
- @lock_cache
- def update_system(self, only_trusted):
- """
- Implement the {backend}-update-system functionality
- """
- pklog.info("Upgrading system")
- self.status(STATUS_UPDATE)
- self.allow_cancel(False)
- self.percentage(0)
- self._check_init(prange=(0,5))
- # Start with protecting all safe upgrades
- self._cache.upgrade()
- upgrades_safe = self._cache.getChanges()
- resolver = apt.cache.ProblemResolver(self._cache)
- for upgrade in upgrades_safe:
- resolver.clear(upgrade)
- resolver.protect(upgrade)
- # Search for upgrades which are not already part of the safe upgrade
- # but would only require the installation of additional packages
- for pkg in self._cache:
- if not pkg.isUpgradable or pkg in upgrades_safe:
- continue
- pklog.debug("Checking upgrade of %s" % pkg.name)
- resolver.clear(pkg)
- resolver.protect(pkg)
- resolver.install_protect()
- try:
- resolver.resolve()
- except:
- resolver.clear(pkg)
- self._cache.clear()
- continue
- if self._cache.delete_count:
- resolver.clear(pkg)
- self._cache.clear()
- continue
- resolver.install_protect()
- resolver.resolve()
- self._check_trusted(only_trusted)
- self._commit_changes()
-
- @lock_cache
- def remove_packages(self, allow_deps, auto_remove, ids):
- """
- Implement the {backend}-remove functionality
- """
- pklog.info("Removing package(s): id %s" % ids)
- self.status(STATUS_REMOVE)
- self.allow_cancel(False)
- self.percentage(0)
- self._check_init(prange=(0,10))
- if auto_remove:
- auto_removables = [pkg.name for pkg in self._cache \
- if pkg.isAutoRemovable]
- pkgs = self._mark_for_removal(ids)
- # Error out if the installation would the installation or upgrade of
- # other packages
- if self._cache.install_count:
- installed = [pkg.name for pkg in self._cache.getChanges() if \
- pkg.markedInstall or pkg.markedUpgrade]
- self.error(ERROR_DEP_RESOLUTION_FAILED,
- "The following packages would have to upgraded or "
- "installed and so block the removal: "
- "%s" % " ".join(installed))
- # Check if the removal would remove further packages
- if not allow_deps and self._cache.delete_count != len(ids):
- dependencies = [pkg.name for pkg in self._cache.getChanges() \
- if pkg.name not in pkgs]
- self.error(ERROR_DEP_RESOLUTION_FAILED,
- "The following packages would have also to be removed: "
- "%s" % " ".join(dependencies))
- # Check for no longer required dependencies which should be removed too
- if auto_remove:
- for pkg in self._cache:
- if pkg.isAutoRemovable and pkg.name not in auto_removables:
- pkg.markDelete(False)
- #FIXME: Should support only_trusted
- self._commit_changes(fetch_range=(10,10), install_range=(10,90))
- self._open_cache(prange=(90,99))
- for p in pkgs:
- if self._cache.has_key(p) and self._cache[p].isInstalled:
- self.error(ERROR_PACKAGE_FAILED_TO_INSTALL,
- "%s is still installed" % p)
- self.percentage(100)
-
- def simulate_remove_packages(self, ids):
- """Emit the change required for the removal of the given packages."""
- pklog.info("Simulating removal of package with id %s" % ids)
- self.status(STATUS_DEP_RESOLVE)
- self.allow_cancel(True)
- self.percentage(None)
- self._check_init(progress=False)
- pkgs = self._mark_for_removal(ids)
- self._emit_changes(pkgs)
-
- def _mark_for_removal(self, ids):
- """Resolve the given package ids and mark the packages for removal."""
- pkgs = []
- action_group = self._cache.actiongroup()
- resolver = apt.cache.ProblemResolver(self._cache)
- for id in ids:
- version = self._get_version_by_id(id)
- pkg = version.package
- if not pkg.isInstalled:
- self.error(ERROR_PACKAGE_NOT_INSTALLED,
- "Package %s isn't installed" % pkg.name)
- if pkg.installed != version:
- self.error(ERROR_PACKAGE_NOT_INSTALLED,
- "Version %s of %s isn't installed" % \
- (version.version, pkg.name))
- if pkg.essential == True:
- self.error(ERROR_CANNOT_REMOVE_SYSTEM_PACKAGE,
- "Package %s cannot be removed." % pkg.name)
- pkgs.append(pkg.name[:])
- pkg.markDelete(False, False)
- resolver.clear(pkg)
- resolver.protect(pkg)
- resolver.remove(pkg)
- try:
- resolver.resolve()
- except SystemError, error:
- broken = [pkg.name for pkg in self._cache if pkg.is_inst_broken]
- self.error(ERROR_DEP_RESOLUTION_FAILED,
- "The following packages would break and so block the "
- "removal: %s" % " ".join(broken))
- action_group.release()
- return pkgs
-
- def get_repo_list(self, filters):
- """
- Implement the {backend}-get-repo-list functionality
-
- FIXME: should we use the abstration of software-properties or provide
- low level access using pure aptsources?
- """
- pklog.info("Getting repository list: %s" % filters)
- self.status(STATUS_INFO)
- self.allow_cancel(False)
- self.percentage(0)
- if REPOS_SUPPORT == False:
- if self._cache.has_key("python-software-properties") and \
- self._cache["python-software-properties"].isInstalled == False:
- self.error(ERROR_INTERNAL_ERROR,
- "Please install the package "
- "python-software-properties to handle repositories")
- else:
- self.error(ERROR_INTERNAL_ERROR,
- "Please make sure that python-software-properties is"
- "correctly installed.")
- repos = PackageKitSoftwareProperties()
- # Emit distro components as virtual repositories
- for comp in repos.distro.source_template.components:
- repo_id = "%s_comp_%s" % (repos.distro.id, comp.name)
- description = "%s %s - %s (%s)" % (repos.distro.id,
- repos.distro.release,
- comp.get_description(),
- comp.name)
- #FIXME: There is no inconsitent state in PackageKit
- enabled = repos.get_comp_download_state(comp)[0]
- if not FILTER_DEVELOPMENT in filters:
- self.repo_detail(repo_id,
- description.decode(DEFAULT_ENCODING),
- enabled)
- # Emit distro's virtual update repositories
- for template in repos.distro.source_template.children:
- repo_id = "%s_child_%s" % (repos.distro.id, template.name)
- description = "%s %s - %s (%s)" % (repos.distro.id,
- repos.distro.release,
- template.description,
- template.name)
- #FIXME: There is no inconsitent state in PackageKit
- enabled = repos.get_comp_child_state(template)[0]
- if not FILTER_DEVELOPMENT in filters:
- self.repo_detail(repo_id,
- description.decode(DEFAULT_ENCODING),
- enabled)
- # Emit distro's cdrom sources
- for source in repos.get_cdrom_sources():
- if FILTER_NOT_DEVELOPMENT in filters and \
- source.type in ("deb-src", "rpm-src"):
- continue
- enabled = not source.disabled
- # Remove markups from the description
- description = re.sub(r"</?b>", "", repos.render_source(source))
- repo_id = "cdrom_%s_%s" % (source.uri, source.dist)
- repo_id.join(map(lambda c: "_%s" % c, source.comps))
- self.repo_detail(repo_id, description.decode(DEFAULT_ENCODING),
- enabled)
- # Emit distro's virtual source code repositoriy
- if not FILTER_NOT_DEVELOPMENT in filters:
- repo_id = "%s_source" % repos.distro.id
- enabled = repos.get_source_code_state() or False
- #FIXME: no translation :(
- description = "%s %s - Source code" % (repos.distro.id,
- repos.distro.release)
- self.repo_detail(repo_id, description.decode(DEFAULT_ENCODING),
- enabled)
- # Emit third party repositories
- for source in repos.get_isv_sources():
- if FILTER_NOT_DEVELOPMENT in filters and \
- source.type in ("deb-src", "rpm-src"):
- continue
- enabled = not source.disabled
- # Remove markups from the description
- description = re.sub(r"</?b>", "", repos.render_source(source))
- repo_id = "isv_%s_%s" % (source.uri, source.dist)
- repo_id.join(map(lambda c: "_%s" % c, source.comps))
- self.repo_detail(repo_id, description.decode(DEFAULT_ENCODING),
- enabled)
-
- def repo_enable(self, repo_id, enable):
- """
- Implement the {backend}-repo-enable functionality
-
- FIXME: should we use the abstration of software-properties or provide
- low level access using pure aptsources?
- """
- pklog.info("Enabling repository: %s %s" % (repo_id, enable))
- self.status(STATUS_RUNNING)
- self.allow_cancel(False)
- self.percentage(0)
- if REPOS_SUPPORT == False:
- if self._cache.has_key("python-software-properties") and \
- self._cache["python-software-properties"].isInstalled == False:
- self.error(ERROR_INTERNAL_ERROR,
- "Please install the package "
- "python-software-properties to handle repositories")
- else:
- self.error(ERROR_INTERNAL_ERROR,
- "Please make sure that python-software-properties is"
- "correctly installed.")
- return
- repos = PackageKitSoftwareProperties()
-
- found = False
- # Check if the repo_id matches a distro component, e.g. main
- if repo_id.startswith("%s_comp_" % repos.distro.id):
- for comp in repos.distro.source_template.components:
- if repo_id == "%s_comp_%s" % (repos.distro.id, comp.name):
- if enable == repos.get_comp_download_state(comp)[0]:
- pklog.debug("Repository is already enabled")
- pass
- if enable == True:
- repos.enable_component(comp.name)
- else:
- repos.disable_component(comp.name)
- found = True
- break
- # Check if the repo_id matches a distro child repository, e.g. hardy-updates
- elif repo_id.startswith("%s_child_" % repos.distro.id):
- for template in repos.distro.source_template.children:
- if repo_id == "%s_child_%s" % (repos.distro.id, template.name):
- if enable == repos.get_comp_child_state(template)[0]:
- pklog.debug("Repository is already enabled")
- pass
- elif enable == True:
- repos.enable_child_source(template)
- else:
- repos.disable_child_source(template)
- found = True
- break
- # Check if the repo_id matches a cdrom repository
- elif repo_id.startswith("cdrom_"):
- for source in repos.get_isv_sources():
- source_id = "cdrom_%s_%s" % (source.uri, source.dist)
- source_id.join(map(lambda c: "_%s" % c, source.comps))
- if repo_id == source_id:
- if source.disabled == enable:
- source.disabled = not enable
- repos.save_sourceslist()
- else:
- pklog.debug("Repository is already enabled")
- found = True
- break
- # Check if the repo_id matches an isv repository
- elif repo_id.startswith("isv_"):
- for source in repos.get_isv_sources():
- source_id = "isv_%s_%s" % (source.uri, source.dist)
- source_id.join(map(lambda c: "_%s" % c, source.comps))
- if repo_id == source_id:
- if source.disabled == enable:
- source.disabled = not enable
- repos.save_sourceslist()
- else:
- pklog.debug("Repository is already enabled")
- found = True
- break
- if found == False:
- self.error(ERROR_REPO_NOT_AVAILABLE,
- "The repository of the id %s isn't available" % repo_id)
-
- @lock_cache
- def update_packages(self, only_trusted, ids):
- """
- Implement the {backend}-update functionality
- """
- pklog.info("Updating package with id %s" % ids)
- self.status(STATUS_UPDATE)
- self.allow_cancel(False)
- self.percentage(0)
- self._check_init(prange=(0,10))
- pkgs = self._mark_for_upgrade(ids)
- # Error out if the updates would require the removal of already
- # installed packages
- if self._cache.delete_count:
- deleted = [pkg.name for pkg in self._cache.getChanges() if \
- pkg.markedDelete]
- self.error(ERROR_DEP_RESOLUTION_FAILED,
- "The following packages block the update: "
- "%s" % " ".join(deleted))
- self._check_trusted(only_trusted)
- self._commit_changes()
- self._open_cache(prange=(90,100))
- self.percentage(100)
- pklog.debug("Checking success of operation")
- for p in pkgs:
- if not self._cache.has_key(p) or not self._cache[p].isInstalled \
- or self._cache[p].isUpgradable:
- self.error(ERROR_PACKAGE_FAILED_TO_INSTALL,
- "%s was not updated" % p)
- pklog.debug("Sending success signal")
-
- def simulate_update_packages(self, ids):
- """Emit the changes required for the upgrade of the given packages."""
- pklog.info("Simulating update of package with id %s" % ids)
- self.status(STATUS_DEP_RESOLVE)
- self.allow_cancel(True)
- self.percentage(None)
- self._check_init(progress=False)
- pkgs = self._mark_for_upgrade(ids)
- self._emit_changes(pkgs)
-
- def _mark_for_upgrade(self, ids):
- """Resolve the given package ids and mark the packages for upgrade."""
- pkgs = []
- ac = self._cache.actiongroup()
- resolver = apt.cache.ProblemResolver(self._cache)
- for id in ids:
- version = self._get_version_by_id(id)
- pkg = version.package
- if not pkg.isInstalled:
- self.error(ERROR_PACKAGE_NOT_INSTALLED,
- "%s isn't installed" % pkg.name)
- # Check if the specified version is an update
- if apt_pkg.VersionCompare(pkg.installed.version,
- version.version) >= 0:
- self.error(ERROR_UPDATE_NOT_FOUND,
- "The version %s of %s isn't an update to the "
- "current %s" % (version.version, pkg.name,
- pkg.installed.version))
- pkg.candidate = version
- pkgs.append(pkg.name[:])
- # Actually should be fixed in python-apt
- auto = not self._cache._depcache.IsAutoInstalled(pkg._pkg)
- pkg.markInstall(False, True, auto)
- resolver.clear(pkg)
- resolver.protect(pkg)
- try:
- resolver.resolve()
- except SystemError, error:
- broken = [pkg.name for pkg in self._cache if pkg.is_inst_broken]
- self.error(ERROR_DEP_RESOLUTION_FAILED,
- "The following packages block the installation: "
- "%s" % " ".join(broken))
- ac.release()
- return pkgs
-
- def download_packages(self, dest, ids):
- """
- Implement the {backend}-download-packages functionality
- """
- def get_download_details(ids):
- """Calculate the start and end point of a package download
- progress.
- """
- total = 0
- downloaded = 0
- versions = []
- # Check if all ids are vaild and calculate the total download size
- for id in ids:
- pkg_ver = self._get_pkg_version_by_id(id)
- if not pkg_ver.downloadable:
- self.error(ERROR_PACKAGE_DOWNLOAD_FAILED,
- "package %s isn't downloadable" % id)
- total += pkg_ver.size
- versions.append((id, pkg_ver))
- for id, ver in versions:
- start = downloaded * 100 / total
- end = start + ver.size * 100 / total
- yield id, ver, start, end
- downloaded += ver.size
- pklog.info("Downloading packages: %s" % ids)
- self.status(STATUS_DOWNLOAD)
- self.allow_cancel(True)
- self.percentage(0)
- # Check the destination directory
- if not os.path.isdir(dest) or not os.access(dest, os.W_OK):
- self.error(ERROR_INTERNAL_ERROR,
- "The directory '%s' is not writable" % dest)
- # Setup the fetcher
- self._check_init(prange=(0,10))
- # Start the download
- for id, ver, start, end in get_download_details(ids):
- progress = PackageKitFetchProgress(self, prange=(start, end))
- self._emit_pkg_version(ver, INFO_DOWNLOADING)
- try:
- ver.fetch_binary(dest, progress)
- except Exception, error:
- self.error(ERROR_PACKAGE_DOWNLOAD_FAILED,
- format_string(error.message))
- else:
- self.files(id, os.path.join(dest,
- os.path.basename(ver.filename)))
- self._emit_pkg_version(ver, INFO_FINISHED)
- self.percentage(100)
-
- @lock_cache
- def install_packages(self, only_trusted, ids):
- """
- Implement the {backend}-install functionality
- """
- pklog.info("Installing package with id %s" % ids)
- self.status(STATUS_INSTALL)
- self.allow_cancel(False)
- self.percentage(0)
- self._check_init(prange=(0,10))
- pkgs = self._mark_for_installation(ids)
- # Error out if the installation would require the removal of already
- # installed packages
- if self._cache.delete_count:
- deleted = [pkg.name for pkg in self._cache.getChanges() if \
- pkg.markedDelete]
- self.error(ERROR_DEP_RESOLUTION_FAILED,
- "The following packages block the update: "
- "%s" % " ".join(deleted))
- self._check_trusted(only_trusted)
- self._commit_changes()
- self._open_cache(prange=(90,100))
- self.percentage(100)
- pklog.debug("Checking success of operation")
- for p in pkgs:
- if not self._cache.has_key(p) or not self._cache[p].isInstalled:
- self.error(ERROR_PACKAGE_FAILED_TO_INSTALL,
- "%s was not installed" % p)
-
- def simulate_install_packages(self, ids):
- """Emit the changes required for the installation of the given
- packages.
- """
- pklog.info("Simulating installing package with id %s" % ids)
- self.status(STATUS_DEP_RESOLVE)
- self.allow_cancel(True)
- self.percentage(None)
- self._check_init(progress=False)
- pkgs = self._mark_for_installation(ids)
- self._emit_changes(pkgs)
-
- def _mark_for_installation(self, ids):
- """Resolve the given package ids and mark the packages for
- installation.
- """
- pkgs = []
- ac = self._cache.actiongroup()
- resolver = apt.cache.ProblemResolver(self._cache)
- for id in ids:
- version = self._get_version_by_id(id)
- pkg = version.package
- pkg.candidate = version
- if pkg.installed == version:
- self.error(ERROR_PACKAGE_ALREADY_INSTALLED,
- "Package %s is already installed" % pkg.name)
- pkgs.append(pkg.name[:])
- pkg.markInstall(False, True, True)
- resolver.clear(pkg)
- resolver.protect(pkg)
- try:
- resolver.resolve()
- except SystemError, error:
- broken = [pkg.name for pkg in self._cache if pkg.is_inst_broken]
- self.error(ERROR_DEP_RESOLUTION_FAILED,
- "The following packages block the installation: "
- "%s" % " ".join(broken))
- ac.release()
- return pkgs
-
- @lock_cache
- def install_files(self, only_trusted, inst_files):
- """
- Implement install-files for the apt backend
- Install local Debian package files
- """
- pklog.info("Installing package files: %s" % inst_files)
- self.status(STATUS_INSTALL)
- self.allow_cancel(False)
- self.percentage(0)
- self._check_init(prange=(0,10))
- packages = []
- # Collect all dependencies which need to be installed
- self.status(STATUS_DEP_RESOLVE)
- for path in inst_files:
- deb = apt.debfile.DebPackage(path, self._cache)
- packages.append(deb)
- if not deb.check():
- self.error(ERROR_LOCAL_INSTALL_FAILED,
- format_string(deb._failureString))
- (install, remove, unauthenticated) = deb.required_changes
- pklog.debug("Changes: Install %s, Remove %s, Unauthenticated "
- "%s" % (install, remove, unauthenticated))
- if len(remove) > 0:
- self.error(ERROR_DEP_RESOLUTION_FAILED,
- "Remove the following packages "
- "before: %s" % remove)
- if deb.compare_to_version_in_cache() == \
- apt.debfile.VERSION_OUTDATED:
- self.message(MESSAGE_NEWER_PACKAGE_EXISTS,
- "There is a later version of %s "
- "available in the repositories." % deb.pkgname)
- if self._cache.getChanges():
- self._check_trusted(only_trusted)
- self._commit_changes((10,25), (25,50))
- # Install the Debian package files
- d = PackageKitDpkgInstallProgress(self)
- try:
- d.startUpdate()
- d.install([inst.encode(DEFAULT_ENCODING) for inst in inst_files])
- d.finishUpdate()
- except InstallTimeOutPKError, e:
- self._recover()
- #FIXME: should provide more information
- msg = "Transaction was cancelled since the installation " \
- "of a package hung.\n" \
- "This can be caused by maintainer scripts which " \
- "require input on the terminal:\n%s" % e.message
- self.error(ERROR_INTERNAL_ERROR, format_string(msg))
- except PackageManagerFailedPKError, e:
- self._recover()
- self.error(ERROR_INTERNAL_ERROR,
- format_string("%s\n%s" % (e.message, e.output)))
- except Exception, e:
- self._recover()
- self.error(ERROR_INTERNAL_ERROR, format_string(e.message))
- self.percentage(100)
-
- def simulate_install_files(self, inst_files):
- """Emit the change required for the installation of the given package
- files.
- """
- pklog.info("Simulating installation of the package files: "
- "%s" % inst_files)
- self.status(STATUS_DEP_RESOLVE)
- self.allow_cancel(True)
- self.percentage(None)
- self._check_init(progress=False)
- pkgs = []
- for path in inst_files:
- deb = apt.debfile.DebPackage(path, self._cache)
- pkgs.append(deb.pkgname)
- if not deb.check():
- self.error(ERROR_LOCAL_INSTALL_FAILED,
- format_string(deb._failureString))
- self._emit_changes(pkgs)
-
- @lock_cache
- def refresh_cache(self, force):
- """
- Implement the {backend}-refresh_cache functionality
- """
- # TODO: use force ?
- pklog.info("Refresh cache")
- self.status(STATUS_REFRESH_CACHE)
- self.last_action_time = time.time()
- self.allow_cancel(False);
- self.percentage(0)
- self._check_init((0,10))
- progress = PackageKitFetchProgress(self, prange=(10,95),
- status=STATUS_DOWNLOAD_REPOSITORY)
- try:
- ret = self._cache.update(progress)
- except Exception, error:
- # FIXME: Unluckily python-apt doesn't provide a real good error
- # reporting. We only receive a failure string.
- # FIXME: Doesn't detect if all downloads failed - bug in python-apt
- self.message(MESSAGE_REPO_METADATA_DOWNLOAD_FAILED,
- format_string(error.message))
- self._open_cache(prange=(95,100))
- self.percentage(100)
-
- def get_packages(self, filters):
- """
- Implement the apt2-get-packages functionality
- """
- pklog.info("Get all packages")
- self.status(STATUS_QUERY)
- self.percentage(None)
- self._check_init(progress=False)
- self.allow_cancel(True)
-
- for pkg in self._cache:
- if self._is_package_visible(pkg, filters):
- self._emit_package(pkg)
-
- def resolve(self, filters, names):
- """
- Implement the apt2-resolve functionality
- """
- pklog.info("Resolve")
- self.status(STATUS_QUERY)
- self.percentage(None)
- self._check_init(progress=False)
- self.allow_cancel(False)
-
- for name_raw in names:
- #FIXME: Python-apt doesn't allow unicode as key. See #542965
- name = str(name_raw)
- if self._cache.has_key(name):
- self._emit_visible_package(filters, self._cache[name])
- else:
- self.error(ERROR_PACKAGE_NOT_FOUND,
- "Package name %s could not be resolved" % name)
-
- def get_depends(self, filters, ids, recursive):
- """Emit all dependencies of the given package ids.
-
- Doesn't support recursive dependency resolution.
- """
- def emit_blocked_dependency(base_dependency, pkg=None,
- filters=""):
- """Send a blocked package signal for the given
- apt.package.BaseDependency.
- """
- if FILTER_INSTALLED in filters:
- return
- if pkg:
- summary = pkg.summary
- try:
- filters.remove(FILTER_NOT_INSTALLED)
- except ValueError:
- pass
- if not self._is_package_visible(pkg, filters):
- return
- else:
- summary = u""
- if base_dependency.relation:
- version = "%s%s" % (base_dependency.relation,
- base_dependency.version)
- else:
- version = base_dependency.version
- self.package("%s;%s;;" % (base_dependency.name, version),
- INFO_BLOCKED, unicode(summary, DEFAULT_ENCODING))
-
- def check_dependency(pkg, base_dep):
- """Check if the given apt.package.Package can satisfy the
- BaseDepenendcy and emit the corresponding package signals.
- """
- if not self._is_package_visible(pkg, filters):
- return
- if base_dep.version:
- satisfied = False
- # Sort the version list to check the installed
- # and candidate before the other ones
- ver_list = list(pkg.versions)
- if pkg.installed:
- ver_list.remove(pkg.installed)
- ver_list.insert(0, pkg.installed)
- if pkg.candidate:
- ver_list.remove(pkg.candidate)
- ver_list.insert(0, pkg.candidate)
- for dep_ver in ver_list:
- if apt_pkg.CheckDep(dep_ver.version,
- base_dep.relation,
- base_dep.version):
- self._emit_pkg_version(dep_ver)
- satisfied = True
- break
- if not satisfied:
- emit_blocked_dependency(base_dep, pkg, filters)
- else:
- self._emit_package(pkg)
-
- # Setup the transaction
- pklog.info("Get depends (%s,%s,%s)" % (filter, ids, recursive))
- self.status(STATUS_QUERY)
- self.percentage(None)
- self._check_init(progress=False)
- self.allow_cancel(True)
-
- dependency_types = ["PreDepends", "Depends"]
- if apt_pkg.Config["APT::Install-Recommends"]:
- dependency_types.append("Recommends")
- for id in ids:
- version = self._get_version_by_id(id)
- for dependency in version.get_dependencies(*dependency_types):
- # Walk through all or_dependencies
- for base_dep in dependency.or_dependencies:
- if self._cache.isVirtualPackage(base_dep.name):
- # Check each proivider of a virtual package
- for provider in \
- self._cache.getProvidingPackages(base_dep.name):
- check_dependency(provider, base_dep)
- elif base_dep.name in self._cache:
- check_dependency(self._cache[base_dep.name], base_dep)
- else:
- # The dependency does not exist
- emit_blocked_dependency(base_dep, filters=filters)
-
- def get_requires(self, filters, ids, recursive):
- """Emit all packages which depend on the given ids.
-
- Recursive searching is not supported.
- """
- pklog.info("Get requires (%s,%s,%s)" % (filter, ids, recursive))
- self.status(STATUS_DEP_RESOLVE)
- self.percentage(None)
- self._check_init(progress=False)
- self.allow_cancel(True)
- for id in ids:
- version = self._get_version_by_id(id)
- provided = [pro[0] for pro in version._cand.ProvidesList]
- for pkg in self._cache:
- if not self._is_package_visible(pkg, filters):
- continue
- if pkg.isInstalled:
- pkg_ver = pkg.installed
- elif pkg.candidate:
- pkg_ver = pkg.candidate
- for dependency in pkg_ver.dependencies:
- satisfied = False
- for base_dep in dependency.or_dependencies:
- if version.package.name == base_dep.name or \
- base_dep.name in provided:
- satisfied = True
- break
- if satisfied:
- self._emit_package(pkg)
- break
-
- def what_provides(self, filters, provides_type, search):
- def get_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.error(ERROR_INTERNAL_ERROR,
- "Please install the package "
- "app-install data for a list of "
- "applications that can handle files of "
- "the given type")
- else:
- self.error(ERROR_INTERNAL_ERROR,
- "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
- try:
- db = gdbm.open(path)
- except:
- self.error(ERROR_INTERNAL_ERROR,
- "The list of applications that can handle "
- "files of the given type cannot be opened.\n"
- "Try to reinstall the package "
- "app-install-data.")
- else:
- return db
- def extract_gstreamer_request(search):
- # The search term from PackageKit daemon:
- # gstreamer0.10(urisource-foobar)
- # gstreamer0.10(decoder-audio/x-wma)(wmaversion=3)
- match = re.match("^gstreamer(?P<version>[0-9\.]+)"
- "\((?P<kind>.+?)-(?P<data>.+?)\)"
- "(\((?P<opt>.*)\))?",
- search)
- caps = None
- if not match:
- self.error(ERROR_INTERNAL_ERROR,
- "The search term is invalid: %s" % search)
- if match.group("opt"):
- caps_str = "%s, %s" % (match.group("data"), match.group("opt"))
- # gst.Caps.__init__ cannot handle unicode instances
- caps = gst.Caps(str(caps_str))
- record = GSTREAMER_RECORD_MAP[match.group("kind")]
- return match.group("version"), record, match.group("data"), caps
- self.status(STATUS_QUERY)
- self.percentage(None)
- self._check_init(progress=False)
- self.allow_cancel(False)
- if provides_type == PROVIDES_CODEC:
- # Search for privided gstreamer plugins using the package
- # metadata
- import gst
- GSTREAMER_RECORD_MAP = {"encoder": "Gstreamer-Encoders",
- "decoder": "Gstreamer-Decoders",
- "urisource": "Gstreamer-Uri-Sources",
- "urisink": "Gstreamer-Uri-Sinks",
- "element": "Gstreamer-Elements"}
- for pkg in self._cache:
- if pkg.installed:
- version = pkg.installed
- elif pkg.candidate:
- version = pkg.candidate
- else:
- continue
- if not "Gstreamer-Version" in version.record:
- continue
- gst_version, gst_record, gst_data, gst_caps = \
- extract_gstreamer_request(search)
- if version.record["Gstreamer-Version"] != gst_version:
- continue
- if gst_caps:
- try:
- pkg_caps = gst.Caps(version.record[gst_record])
- except KeyError:
- continue
- if gst_caps.intersect(pkg_caps):
- self._emit_visible_package(filters, pkg)
- else:
- try:
- elements = version.record[gst_record]
- except KeyError:
- continue
- if gst_data in elements:
- self._emit_visible_package(filters, pkg)
-
- elif provides_type == PROVIDES_MIMETYPE:
- # Emit packages that contain an application that can handle
- # the given mime type
- handlers = set()
- db = get_mapping_db("/var/lib/PackageKit/mime-map.gdbm")
- if db == None:
- return
- if db.has_key(search):
- pklog.debug("Mime type is registered: %s" % db[search])
- # 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.error(ERROR_NOT_SUPPORTED,
- "This function is not implemented in this backend")
-
- def get_files(self, package_ids):
- """
- Emit the Files signal which includes the files included in a package
- Apt only supports this for installed packages
- """
- self.status(STATUS_INFO)
- for id in package_ids:
- pkg = self._get_package_by_id(id)
- files = string.join(self._get_installed_files(pkg), ";")
- self.files(id, files)
-
- # Helpers
-
- def _unlock_cache(self):
- """
- Unlock the system package cache
- """
- try:
- apt_pkg.PkgSystemUnLock()
- except SystemError:
- return False
- return True
-
- def _open_cache(self, prange=(0,100), progress=True):
- """
- (Re)Open the APT cache
- """
- pklog.debug("Open APT cache")
- self.status(STATUS_LOADING_CACHE)
- try:
- self._cache = apt.Cache(PackageKitOpProgress(self, prange,
- progress))
- except:
- self.error(ERROR_NO_CACHE, "Package cache could not be opened")
- if self._cache.broken_count > 0:
- self.error(ERROR_DEP_RESOLUTION_FAILED,
- "There are broken dependecies on your system. "
- "Please use an advanced package manage e.g. "
- "Synaptic or aptitude to resolve this situation.")
- self._last_cache_refresh = time.time()
-
- def _recover(self, prange=(95,100)):
- """
- Try to recover from a package manager failure
- """
- self.status(STATUS_CLEANUP)
- self.percentage(None)
- try:
- d = PackageKitDpkgInstallProgress(self)
- d.startUpdate()
- d.recover()
- d.finishUpdate()
- except:
- pass
- self._open_cache(prange)
-
- def _check_trusted(self, only_trusted):
- """Check if only trusted packages are allowed and fail if
- untrusted packages would be installed in this case.
- """
- untrusted = []
- if only_trusted:
- for pkg in self._cache:
- if (pkg.markedInstall or pkg.markedUpgrade or
- pkg.markedDowngrade or pkg.markedReinstall):
- trusted = False
- for origin in pkg.candidate.origins:
- trusted |= origin.trusted
- if not trusted:
- untrusted.append(pkg.name)
- if untrusted:
- self.error(ERROR_MISSING_GPG_SIGNATURE, " ".join(untrusted))
-
- def _commit_changes(self, fetch_range=(5,50), install_range=(50,90)):
- """
- Commit changes to the cache and handle errors
- """
- try:
- self._cache.commit(PackageKitFetchProgress(self, fetch_range),
- PackageKitInstallProgress(self, install_range))
- except apt.cache.FetchFailedException, err:
- self._open_cache(prange=(95,100))
- pklog.critical(format_string(err.message))
- self.error(ERROR_PACKAGE_DOWNLOAD_FAILED,
- format_string(err.message))
- except apt.cache.FetchCancelledException:
- self._open_cache(prange=(95,100))
- except InstallTimeOutPKError, err:
- self._recover()
- self._open_cache(prange=(95,100))
- #FIXME: should provide more information
- msg = "Transaction was cancelled since the installation " \
- "of a package hung.\n" \
- "This can be caused by maintainer scripts which " \
- "require input on the terminal:\n%s" % err.message
- self.error(ERROR_INTERNAL_ERROR, format_string(msg))
- except PackageManagerFailedPKError, err:
- self._recover()
- self.error(ERROR_INTERNAL_ERROR,
- format_string("%s\n%s" % (err.message, err.output)))
- else:
- return True
- return False
-
- def _get_id_from_version(self, version):
- """Return the package id of an apt.package.Version instance."""
- if version.origins:
- origin = version.origins[0].label
- else:
- origin = ""
- id = "%s;%s;%s;%s" % (version.package.name, version.version,
- version.architecture, origin)
- return id
-
- def _check_init(self, prange=(0,10), progress=True):
- """
- Check if the backend was initialized well and try to recover from
- a broken setup
- """
- pklog.debug("Checking apt cache and xapian database")
- pkg_cache = os.path.join(apt_pkg.Config["Dir"],
- apt_pkg.Config["Dir::Cache"],
- apt_pkg.Config["Dir::Cache::pkgcache"])
- src_cache = os.path.join(apt_pkg.Config["Dir"],
- apt_pkg.Config["Dir::Cache"],
- apt_pkg.Config["Dir::Cache::srcpkgcache"])
- # Check if the cache instance is of the coorect class type, contains
- # any broken packages and if the dpkg status or apt cache files have
- # been changed since the last refresh
- if not isinstance(self._cache, apt.cache.Cache) or \
- (self._cache.broken_count > 0) or \
- (os.stat(apt_pkg.Config["Dir::State::status"])[stat.ST_MTIME] > \
- self._last_cache_refresh) or \
- (os.stat(pkg_cache)[stat.ST_MTIME] > self._last_cache_refresh) or \
- (os.stat(src_cache)[stat.ST_MTIME] > self._last_cache_refresh):
- pklog.debug("Reloading the cache is required")
- self._open_cache(prange, progress)
- else:
- pass
- # Read the pin file of Synaptic if available
- self._cache._depcache.ReadPinFile()
- if os.path.exists(SYNAPTIC_PIN_FILE):
- self._cache._depcache.ReadPinFile(SYNAPTIC_PIN_FILE)
- # Reset the depcache
- self._cache.clear()
-
- def _emit_package(self, pkg, info=None, force_candidate=False):
- """
- Send the Package signal for a given apt package
- """
- if (not pkg.isInstalled or force_candidate) and pkg.candidate:
- self._emit_pkg_version(pkg.candidate, info)
- elif pkg.isInstalled:
- self._emit_pkg_version(pkg.installed, info)
- else:
- pklog.debug("Package %s hasn't got any version." % pkg.name)
-
- def _emit_pkg_version(self, version, info=None):
- """Emit the Package signal of the given apt.package.Version."""
- id = self._get_id_from_version(version)
- section = version.section.split("/")[-1]
- if not info:
- if version == version.package.installed:
- if section == "metapackages":
- info = INFO_COLLECTION_INSTALLED
- else:
- info = INFO_INSTALLED
- else:
- if section == "metapackages":
- info = INFO_COLLECTION_AVAILABLE
- else:
- info = INFO_AVAILABLE
- self.package(id, info, unicode(version.summary, DEFAULT_ENCODING))
-
- def _emit_all_visible_pkg_versions(self, filters, pkg):
- """Emit all available versions of a package."""
- if self._is_package_visible(pkg, filters):
- if FILTER_NEWEST in filters:
- if pkg.candidate:
- self._emit_pkg_version(pkg.candidate)
- elif pkg.installed:
- self._emit_pkg_version(pkg.installed)
- else:
- for version in pkg.versions:
- self._emit_pkg_version(version)
-
- def _emit_visible_package(self, filters, pkg, info=None):
- """
- Filter and emit a package
- """
- if self._is_package_visible(pkg, filters):
- self._emit_package(pkg, info)
-
- 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_raw in pkgs:
- #FIXME: Python-apt doesn't allow unicode as key. See #542965
- name = str(name_raw)
- if self._cache.has_key(name) and \
- self._is_package_visible(self._cache[name], filters):
- self._emit_package(self._cache[name], info)
-
- def _emit_changes(self, ignore_pkgs=[]):
- """Emit all changed packages."""
- for pkg in self._cache:
- if pkg.name in ignore_pkgs:
- continue
- if pkg.markedDelete:
- self._emit_package(pkg, INFO_REMOVING, False)
- elif pkg.markedInstall:
- self._emit_package(pkg, INFO_INSTALLING, True)
- elif pkg.markedUpgrade:
- self._emit_package(pkg, INFO_UPDATING, True)
- elif pkg.markedDowngrade:
- self._emit_package(pkg, INFO_DOWNGRADING, True)
- elif pkg.markedReinstall:
- self._emit_package(pkg, INFO_REINSTALLING, True)
-
- def _is_package_visible(self, pkg, filters):
- """
- Return True if the package should be shown in the user interface
- """
- if filters == [FILTER_NONE]:
- return True
- for filter in filters:
- if (filter == FILTER_INSTALLED and not pkg.isInstalled) or \
- (filter == FILTER_NOT_INSTALLED and pkg.isInstalled) or \
- (filter == FILTER_SUPPORTED and not \
- self._is_package_supported(pkg)) or \
- (filter == FILTER_NOT_SUPPORTED and \
- self._is_package_supported(pkg)) or \
- (filter == FILTER_FREE and not self._is_package_free(pkg)) or \
- (filter == FILTER_NOT_FREE and \
- not self._is_package_not_free(pkg)) or \
- (filter == FILTER_GUI and not self._has_package_gui(pkg)) or \
- (filter == FILTER_NOT_GUI and self._has_package_gui(pkg)) or \
- (filter == FILTER_COLLECTIONS and not \
- self._is_package_collection(pkg)) or \
- (filter == FILTER_NOT_COLLECTIONS and \
- self._is_package_collection(pkg)) or\
- (filter == FILTER_DEVELOPMENT and not \
- self._is_package_devel(pkg)) or \
- (filter == FILTER_NOT_DEVELOPMENT and \
- self._is_package_devel(pkg)):
- return False
- return True
-
- def _is_package_not_free(self, pkg):
- """
- Return True if we can be sure that the package's license isn't any
- free one
- """
- candidate = pkg.candidateOrigin
- return candidate != None and \
- ((candidate[0].origin == "Ubuntu" and \
- candidate[0].component in ["multiverse", "restricted"]) or \
- (candidate[0].origin == "Debian" and \
- candidate[0].component in ["contrib", "non-free"])) and \
- candidate[0].trusted == True
-
- def _is_package_collection(self, pkg):
- """
- Return True if the package is a metapackge
- """
- section = pkg.section.split("/")[-1]
- return section == "metapackages"
-
- def _is_package_free(self, pkg):
- """
- Return True if we can be sure that the package has got a free license
- """
- candidate = pkg.candidateOrigin
- return candidate != None and \
- ((candidate[0].origin == "Ubuntu" and \
- candidate[0].component in ["main", "universe"]) or \
- (candidate[0].origin == "Debian" and \
- candidate[0].component == "main")) and\
- candidate[0].trusted == True
-
- def _has_package_gui(self, pkg):
- #FIXME: should go to a modified Package class
- #FIXME: take application data into account. perhaps checking for
- # property in the xapian database
- return pkg.section.split('/')[-1].lower() in ['x11', 'gnome', 'kde']
-
- def _is_package_devel(self, pkg):
- #FIXME: should go to a modified Package class
- return pkg.name.endswith("-dev") or pkg.name.endswith("-dbg") or \
- pkg.section.split('/')[-1].lower() in ['devel', 'libdevel']
-
- def _is_package_supported(self, pkg):
- candidate = pkg.candidateOrigin[0]
- return candidate != None and \
- candidate[0].origin == "Ubuntu" and \
- candidate[0].component in ["main", "restricted"] and \
- candidate[0].trusted == True
-
- def _get_pkg_version_by_id(self, id):
- """
- Return a package version matching the given package id or None.
- """
- name_raw, version, arch, data = id.split(";", 4)
- #FIXME: Python-apt doesn't allow unicode as key. See #542965
- name = str(name_raw)
- if self._cache.has_key(name):
- for pkg_ver in self._cache[name].versions:
- if pkg_ver.version == version and \
- pkg_ver.architecture == arch:
- return pkg_ver
- return None
-
- def _get_package_by_id(self, id):
- """Return the apt.package.Package corresponding to the given
- package id.
-
- If the package isn't available error out.
- """
- version = self._get_version_by_id(id)
- return version.package
-
- def _get_version_by_id(self, id):
- """Return the apt.package.Version corresponding to the given
- package id.
-
- If the version isn't available error out.
- """
- name, version_string, arch, data = id.split(";", 4)
- try:
- pkg = self._cache[name]
- except:
- self.error(ERROR_PACKAGE_NOT_FOUND,
- "There isn't any package named %s" % name)
- #FIXME:This requires a not yet released fix in python-apt
- try:
- version = pkg.versions[version_string]
- except:
- self.error(ERROR_PACKAGE_NOT_FOUND,
- "There isn't any verion %s of %s" % (version_string,
- name))
- if version.architecture != arch:
- self.error(ERROR_PACKAGE_NOT_FOUND,
- "Version %s of %s isn't available for architecture "
- "%s" % (pkg.name, version.version, arch))
- return version
-
- def _get_installed_files(self, pkg):
- """
- Return the list of unicode names of the files which have
- been installed by the package
-
- This method should be obsolete by the apt.package.Package.installedFiles
- attribute as soon as the consolidate branch of python-apt gets merged
- """
- path = os.path.join(apt_pkg.Config["Dir"],
- "var/lib/dpkg/info/%s.list" % pkg.name)
- try:
- list = open(path)
- files = list.read().decode().split("\n")
- list.close()
- except:
- return []
- return files
-
- def _get_package_group(self, pkg):
- """
- Return the packagekit group corresponding to the package's section
- """
- section = pkg.section.split("/")[-1]
- if SECTION_GROUP_MAP.has_key(section):
- return SECTION_GROUP_MAP[section]
- else:
- pklog.debug("Unkown package section %s of %s" % (pkg.section,
- pkg.name))
- return GROUP_UNKNOWN
-
- def _sigquit(self, signum, frame):
- self._unlock_cache()
- sys.exit(1)
-
-def debug_exception(type, value, tb):
- """
- Provides an interactive debugging session on unhandled exceptions
- See http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65287
- """
- if hasattr(sys, 'ps1') or not sys.stderr.isatty() or \
- not sys.stdin.isatty() or not sys.stdout.isatty() or type==SyntaxError:
- # Calls the default handler in interactive mode, if output is·
- # redirected or on syntax errors
- sys.__excepthook__(type, value, tb)
- else:
- import traceback, pdb
- traceback.print_exception(type, value, tb)
- print
- pdb.pm()
-
-def run(args, single=False):
- """
- Start the apt backend
- """
- backend = PackageKitAptBackend("")
- if single == True:
- backend.dispatch_command(args[0], args[1:])
- else:
- backend.dispatcher(args)
-
-def main():
- parser = optparse.OptionParser(description="APT backend for PackageKit")
- parser.add_option("-r", "--root",
- action="store", type="string", dest="root",
- help="Use the given directory as the system root "
- "(Only needed by developers)")
- parser.add_option("-p", "--profile",
- action="store", type="string", dest="profile",
- help="Store profiling stats in the given file "
- "(Only needed by developers)")
- parser.add_option("-d", "--debug",
- action="store_true", dest="debug",
- help="Show a lot of additional information and drop to "
- "a debugging console on unhandled exceptions "
- "(Only needed by developers)")
- parser.add_option("-s", "--single",
- action="store_true", dest="single",
- help="Only perform one command and don't listen on stdin "
- "(Only needed by developers)")
- (options, args) = parser.parse_args()
- if options.debug:
- pklog.setLevel(logging.DEBUG)
- sys.excepthook = debug_exception
-
- if options.root:
- config = apt_pkg.Config
- config.Set("Dir", options.root)
- config.Set("Dir::State::status",
- os.path.join(options.root, "/var/lib/dpkg/status"))
-
- if options.profile:
- import hotshot
- prof = hotshot.Profile(options.profile)
- prof.runcall(run, args, options.single)
- prof.close()
- else:
- run(args, options.single)
-
-if __name__ == '__main__':
- main()
-
-# vim: ts=4 et sts=4
diff --git a/backends/apt/data/Packages b/backends/apt/data/Packages
deleted file mode 100644
index b696056..0000000
--- a/backends/apt/data/Packages
+++ /dev/null
@@ -1,71 +0,0 @@
-Package: xterm
-Priority: optional
-Section: x11
-Installed-Size: 1112
-Maintainer: Debian X Strike Force <debian-x at lists.debian.org>
-Architecture: i386
-Version: 237-1
-Provides: x-terminal-emulator
-Suggests: xfonts-cyrillic
-Filename: pool/main/x/xterm/xterm_235-1_i386.deb
-Size: 466530
-MD5sum: ec97de9afffcbc5932dddfa9090f6fbe
-SHA1: 7aedb7fc5dd906ad35246cf7442e250311aa2130
-SHA256: 517f01858734b253584c28bb9951acbb6a082d1274c6ec6c079f7567bf067d71
-Description: X terminal emulator
- xterm is a terminal emulator for the X Window System. It provides DEC VT102
- and Tektronix 4014 compatible terminals for programs that cannot use the
- window system directly. This version implements ISO/ANSI colors and most of
- the control sequences used by DEC VT220 terminals.
- .
- This package provides four commands: xterm, which is the traditional
- terminal emulator; uxterm, which is a wrapper around xterm that is
- intelligent about locale settings (especially those which use the UTF-8
- character encoding), but which requires the luit program from the x11-utils
- package; koi8rxterm, a wrapper similar to uxterm for locales that use the
- KOI8-R character set; and lxterm, a simple wrapper that chooses which of the
- previous commands to execute based on the user's locale settings.
- .
- A complete list of control sequences supported by the X terminal emulator
- is provided in /usr/share/doc/xterm.
- .
- The xterm program uses bitmap images provided by the xbitmaps package.
- .
- Those interested in using koi8rxterm will likely want to install the
- xfonts-cyrillic package as well.
-Homepage: http://invisible-island.net/xterm/xterm.html
-Tag: implemented-in::c, interface::x11, role::program, scope::utility, uitoolkit::athena, x11::application, x11::terminal
-Task: desktop
-
-Package: synaptic
-Priority: optional
-Section: admin
-Installed-Size: 5812
-Maintainer: Michael Vogt <mvo at debian.org>
-Architecture: i386
-Version: 0.62.1
-Replaces: gsynaptic
-Provides: gsynaptic
-Depends: xterm
-Suggests: dwww
-Conflicts: gsynaptic, menu (<< 2.1.11)
-Filename: pool/main/s/synaptic/synaptic_0.62.1_i386.deb
-Size: 2094122
-MD5sum: 91b86003eea53002e0c2a0ea50596e37
-SHA1: e533c3345911d5c8471b54a8a7b51ae52e59982b
-SHA256: a399168d801efa1616d7b1178b4c3eda70c612716374411708d05956f3c99874
-Description: Graphical package manager
- Synaptic is a graphical package management tool based on GTK+ and APT.
- Synaptic enables you to install, upgrade and remove software packages in
- a user friendly way.
- .
- Besides these basic functions the following features are provided:
- * Search and filter the list of available packages
- * Perform smart system upgrades
- * Fix broken package dependencies
- * Edit the list of used repositories (sources.list)
- * Download the latest changelog of a package
- * Configure packages through the debconf system
- * Browse all available documentation related to a package (dwww is required)
-Tag: admin::package-management, implemented-in::c++, interface::x11, role::program, scope::application, suite::debian, uitoolkit::gtk, works-with::software:package, x11::application
-
diff --git a/backends/apt/data/status b/backends/apt/data/status
deleted file mode 100644
index 2bba0ae..0000000
--- a/backends/apt/data/status
+++ /dev/null
@@ -1,38 +0,0 @@
-Package: xterm
-Status: install ok installed
-Priority: optional
-Section: x11
-Installed-Size: 1112
-Maintainer: Debian X Strike Force <debian-x at lists.debian.org>
-Architecture: i386
-Version: 235-1
-Provides: x-terminal-emulator
-Suggests: xfonts-cyrillic
-Conffiles:
- /etc/X11/app-defaults/KOI8RXTerm dd942bff017ee9cfc2bb97bbdd7378b6
- /etc/X11/app-defaults/UXTerm 952670ddfbb90d0a7c36e87e7a796595
- /etc/X11/app-defaults/XTerm ec0c680b99b0f69f8d5d3318bd1a862e
- /etc/X11/app-defaults/XTerm-color 657eb990e33aeddb17c7e2185321878c
-Description: X terminal emulator
- xterm is a terminal emulator for the X Window System. It provides DEC VT102
- and Tektronix 4014 compatible terminals for programs that cannot use the
- window system directly. This version implements ISO/ANSI colors and most of
- the control sequences used by DEC VT220 terminals.
- .
- This package provides four commands: xterm, which is the traditional
- terminal emulator; uxterm, which is a wrapper around xterm that is
- intelligent about locale settings (especially those which use the UTF-8
- character encoding), but which requires the luit program from the x11-utils
- package; koi8rxterm, a wrapper similar to uxterm for locales that use the
- KOI8-R character set; and lxterm, a simple wrapper that chooses which of the
- previous commands to execute based on the user's locale settings.
- .
- A complete list of control sequences supported by the X terminal emulator
- is provided in /usr/share/doc/xterm.
- .
- The xterm program uses bitmap images provided by the xbitmaps package.
- .
- Those interested in using koi8rxterm will likely want to install the
- xfonts-cyrillic package as well.
-Homepage: http://invisible-island.net/xterm/xterm.html
-
diff --git a/backends/apt/data/xterm.list b/backends/apt/data/xterm.list
deleted file mode 100644
index 4afffb9..0000000
--- a/backends/apt/data/xterm.list
+++ /dev/null
@@ -1,49 +0,0 @@
-/.
-/usr
-/usr/bin
-/usr/bin/koi8rxterm
-/usr/bin/lxterm
-/usr/bin/resize
-/usr/bin/uxterm
-/usr/bin/xterm
-/usr/share
-/usr/share/man
-/usr/share/man/man1
-/usr/share/man/man1/lxterm.1.gz
-/usr/share/man/man1/uxterm.1.gz
-/usr/share/man/man1/xterm.1.gz
-/usr/share/man/man1/koi8rxterm.1.gz
-/usr/share/man/man1/resize.1.gz
-/usr/share/lintian
-/usr/share/lintian/overrides
-/usr/share/lintian/overrides/xterm
-/usr/share/doc
-/usr/share/doc/xterm
-/usr/share/doc/xterm/ctlseqs.txt.gz
-/usr/share/doc/xterm/xterm.termcap.gz
-/usr/share/doc/xterm/xterm.log.html
-/usr/share/doc/xterm/xterm.faq.html
-/usr/share/doc/xterm/xterm.faq.gz
-/usr/share/doc/xterm/changelog.Debian.gz
-/usr/share/doc/xterm/README.Debian
-/usr/share/doc/xterm/copyright
-/usr/share/doc/xterm/README.i18n.gz
-/usr/share/doc/xterm/ctlseqs.ms.gz
-/usr/share/doc/xterm/xterm.terminfo.gz
-/usr/share/doc-base
-/usr/share/doc-base/xterm-ctlseqs
-/usr/share/doc-base/xterm-faq
-/usr/share/menu
-/usr/share/menu/xterm
-/usr/share/pixmaps
-/usr/share/pixmaps/xterm-color_32x32.xpm
-/usr/share/pixmaps/xterm-color_48x48.xpm
-/usr/share/pixmaps/xterm_32x32.xpm
-/usr/share/pixmaps/xterm_48x48.xpm
-/etc
-/etc/X11
-/etc/X11/app-defaults
-/etc/X11/app-defaults/KOI8RXTerm
-/etc/X11/app-defaults/UXTerm
-/etc/X11/app-defaults/XTerm
-/etc/X11/app-defaults/XTerm-color
diff --git a/backends/apt/hotshot-analyze.py b/backends/apt/hotshot-analyze.py
deleted file mode 100755
index 733442c..0000000
--- a/backends/apt/hotshot-analyze.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-"""
-Provides an apt backend to PackageKit
-
-Copyright (C) 2008 Sebastian Heinlein <glatzor at ubuntu.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.
-"""
-
-__author__ = "Sebastian Heinlein <devel at glatzor.de>"
-
-import hotshot
-import hotshot.stats
-import optparse
-import sys
-
-def main():
- parser = optparse.OptionParser(usage="hotshot-analyze.py "
- "PATH_TO_STATS_FILE",
- description="Statistics analyzer for the "
- "HotShot Python profiler")
- (options, args) = parser.parse_args()
- if len(args) != 1:
- parser.print_help()
- sys.exit(1)
-
- stats = hotshot.stats.load(args[0])
- stats.strip_dirs()
- stats.sort_stats('time', 'calls')
- stats.print_stats(20)
-
-if __name__ == "__main__":
- main()
diff --git a/backends/apt/packagekit b/backends/apt/packagekit
deleted file mode 120000
index 2e8d949..0000000
--- a/backends/apt/packagekit
+++ /dev/null
@@ -1 +0,0 @@
-../../lib/python/packagekit
\ No newline at end of file
diff --git a/backends/apt/pk-backend-apt.c b/backends/apt/pk-backend-apt.c
deleted file mode 100644
index 6508bf3..0000000
--- a/backends/apt/pk-backend-apt.c
+++ /dev/null
@@ -1,598 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007-2008 Richard Hughes <richard at hughsie.com>
- * Copyright (C) 2008-2009 Sebastian Heinlein <glatzor at ubuntu.com>
- * Copyright (C) 2007 Ali Sabil <ali.sabil at gmail.com>
- * Copyright (C) 2007 Tom Parker <palfrey at tevp.net>
- *
- * 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <pk-backend.h>
-#include <pk-backend-spawn.h>
-#include <string.h>
-
-static PkBackendSpawn *spawn;
-
-/**
- * backend_stderr_cb:
- */
-static gboolean
-backend_stderr_cb (PkBackend *backend, const gchar *output)
-{
- // APT is a little bit chatty on stderr
- if (strstr (output, "W:") != NULL)
- return FALSE;
- if (strstr (output, "E:") != NULL)
- return FALSE;
- // There have been a lot of API changes in python-apt recently
- if (strstr (output, "DeprecationWarning") != NULL)
- return FALSE;
- return TRUE;
-}
-
-/**
- * backend_initialize:
- * This should only be run once per backend load, i.e. not every transaction
- */
-static void
-backend_initialize (PkBackend *backend)
-{
- g_debug ("backend: initialize");
- spawn = pk_backend_spawn_new ();
- pk_backend_spawn_set_filter_stderr (spawn, backend_stderr_cb);
- pk_backend_spawn_set_name (spawn, "apt");
-}
-
-/**
- * backend_destroy:
- * This should only be run once per backend load, i.e. not every transaction
- */
-static void
-backend_destroy (PkBackend *backend)
-{
- g_debug ("backend: destroy");
- g_object_unref (spawn);
-}
-
-/**
- * backend_get_mime_types:
- */
-static gchar *
-backend_get_mime_types (PkBackend *backend)
-{
- return g_strdup ("application/x-deb");
-}
-
-/**
- * pk_backend_cancel:
- */
-static void
-backend_cancel (PkBackend *backend)
-{
- /* this feels bad... */
- pk_backend_spawn_kill (spawn);
-}
-
-/**
- * backend_download_packages:
- */
-static void
-backend_download_packages (PkBackend *backend, gchar **package_ids, const gchar *directory)
-{
- gchar *package_ids_temp;
-
- /* send the complete list as stdin */
- package_ids_temp = pk_package_ids_to_string (package_ids);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "download-packages", directory, package_ids_temp, NULL);
- g_free (package_ids_temp);
-}
-
-/**
- * backend_get_depends:
- */
-static void
-backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
-{
- gchar *filters_text;
- gchar *package_ids_temp;
- package_ids_temp = pk_package_ids_to_string (package_ids);
- filters_text = pk_filter_bitfield_to_string (filters);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "get-depends", filters_text, package_ids_temp, pk_backend_bool_to_string (recursive), NULL);
- g_free (filters_text);
- g_free (package_ids_temp);
-}
-
-/**
- * backend_get_details:
- */
-static void
-backend_get_details (PkBackend *backend, gchar **package_ids)
-{
- gchar *package_ids_temp;
- package_ids_temp = pk_package_ids_to_string (package_ids);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "get-details", package_ids_temp, NULL);
- g_free (package_ids_temp);
-}
-
-#ifdef HAVE_PYTHON_META_RELEASE
-/**
- * backend_get_distro_upgrades:
- */
-static void
-backend_get_distro_upgrades (PkBackend *backend)
-{
- pk_backend_spawn_helper (spawn, "aptBackend.py", "get-distro-upgrades", NULL);
-}
-#endif /* HAVE_PYTHON_META_RELEASE */
-
-/**
- * backend_get_files:
- */
-static void
-backend_get_files (PkBackend *backend, gchar **package_ids)
-{
- gchar *package_ids_temp;
- package_ids_temp = pk_package_ids_to_string (package_ids);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "get-files", package_ids_temp, NULL);
- g_free (package_ids_temp);
-}
-
-/**
- * backend_get_requires:
- */
-static void
-backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
-{
- gchar *package_ids_temp;
- gchar *filters_text;
- package_ids_temp = pk_package_ids_to_string (package_ids);
- filters_text = pk_filter_bitfield_to_string (filters);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "get-requires", filters_text, package_ids_temp, pk_backend_bool_to_string (recursive), NULL);
- g_free (filters_text);
- g_free (package_ids_temp);
-}
-
-/**
- * backend_get_updates:
- */
-static void
-backend_get_updates (PkBackend *backend, PkBitfield filters)
-{
- gchar *filters_text;
- filters_text = pk_filter_bitfield_to_string (filters);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "get-updates", filters_text, NULL);
- g_free (filters_text);
-}
-
-/**
- * backend_get_packages:
- */
-static void
-backend_get_packages (PkBackend *backend, PkBitfield filters)
-{
- gchar *filters_text;
- filters_text = pk_filter_bitfield_to_string (filters);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "get-packages", filters_text, NULL);
- g_free (filters_text);
-}
-
-/**
- * backend_get_update_detail:
- */
-static void
-backend_get_update_detail (PkBackend *backend, gchar **package_ids)
-{
- gchar *package_ids_temp;
- package_ids_temp = pk_package_ids_to_string (package_ids);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "get-update-detail", package_ids_temp, NULL);
- g_free (package_ids_temp);
-}
-
- /**
- * backend_simulate_install_files:
- */
-static void
-backend_simulate_install_files (PkBackend *backend, gchar **full_paths)
-{
- gchar *package_ids_temp;
-
- /* send the complete list as stdin */
- package_ids_temp = g_strjoinv (PK_BACKEND_SPAWN_FILENAME_DELIM, full_paths);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "simulate-install-files", package_ids_temp, NULL);
- g_free (package_ids_temp);
-}
-
-/**
- * backend_simulate_install_packages:
- */
-static void
-backend_simulate_install_packages (PkBackend *backend, gchar **package_ids)
-{
- gchar *package_ids_temp;
-
- /* send the complete list as stdin */
- package_ids_temp = pk_package_ids_to_string (package_ids);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "simulate-install-packages", package_ids_temp, NULL);
- g_free (package_ids_temp);
-}
-
-/**
- * backend_simulate_remove_packages:
- */
-static void
-backend_simulate_remove_packages (PkBackend *backend, gchar **package_ids, gboolean autoremove)
-{
- gchar *package_ids_temp;
-
- /* send the complete list as stdin */
- package_ids_temp = pk_package_ids_to_string (package_ids);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "simulate-remove-packages", package_ids_temp, NULL);
- g_free (package_ids_temp);
-}
-
-/**
- * backend_simulate_update_packages:
- */
-static void
-backend_simulate_update_packages (PkBackend *backend, gchar **package_ids)
-{
- gchar *package_ids_temp;
-
- /* send the complete list as stdin */
- package_ids_temp = pk_package_ids_to_string (package_ids);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "simulate-update-packages", package_ids_temp, NULL);
- g_free (package_ids_temp);
-}
-
-/**
- * backend_install_packages:
- */
-static void
-backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
-{
- gchar *package_ids_temp;
-
- /* send the complete list as stdin */
- package_ids_temp = pk_package_ids_to_string (package_ids);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "install-packages", pk_backend_bool_to_string (only_trusted), package_ids_temp, NULL);
- g_free (package_ids_temp);
-}
-
-/**
- * backend_install_files:
- */
-static void
-backend_install_files (PkBackend *backend, gboolean only_trusted, gchar **full_paths)
-{
- gchar *package_ids_temp;
-
- /* send the complete list as stdin */
- package_ids_temp = g_strjoinv (PK_BACKEND_SPAWN_FILENAME_DELIM, full_paths);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "install-files", pk_backend_bool_to_string (only_trusted), package_ids_temp, NULL);
- g_free (package_ids_temp);
-}
-
-/**
- * backend_install_signature:
- *
-FIXME: Not implemented
-
-static void
-backend_install_signature (PkBackend *backend, PkSigTypeEnum type,
- const gchar *key_id, const gchar *package_id)
-{
- const gchar *type_text;
-
- type_text = pk_sig_type_enum_to_string (type);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "install-signature", type_text, key_id, package_id, NULL);
-} */
-
-/**
- * backend_refresh_cache:
- */
-static void
-backend_refresh_cache (PkBackend *backend, gboolean force)
-{
- pk_backend_spawn_helper (spawn, "aptBackend.py", "refresh-cache", pk_backend_bool_to_string (force), NULL);
-}
-
-/**
- * pk_backend_remove_packages:
- */
-static void
-backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove)
-{
- gchar *package_ids_temp;
-
- /* send the complete list as stdin */
- package_ids_temp = pk_package_ids_to_string (package_ids);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "remove-packages", pk_backend_bool_to_string (allow_deps), pk_backend_bool_to_string (autoremove), package_ids_temp, NULL);
- g_free (package_ids_temp);
-}
-
-/**
- * pk_backend_search_details:
- */
-static void
-backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
-{
- gchar *filters_text;
- gchar *search;
- filters_text = pk_filter_bitfield_to_string (filters);
- search = g_strjoinv ("&", values);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "search-details", filters_text, search, NULL);
- g_free (filters_text);
- g_free (search);
-}
-
-/**
- * pk_backend_search_file:
- */
-static void
-backend_search_file (PkBackend *backend, PkBitfield filters, gchar **values)
-{
- gchar *filters_text;
- gchar *search;
- filters_text = pk_filter_bitfield_to_string (filters);
- search = g_strjoinv ("&", values);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "search-file", filters_text, search, NULL);
- g_free (filters_text);
- g_free (search);
-}
-
-/**
- * pk_backend_search_group:
- */
-static void
-backend_search_group (PkBackend *backend, PkBitfield filters, gchar **values)
-{
- gchar *filters_text;
- gchar *search;
- filters_text = pk_filter_bitfield_to_string (filters);
- search = g_strjoinv ("&", values);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "search-group", filters_text, search, NULL);
- g_free (filters_text);
- g_free (search);
-}
-
-/**
- * pk_backend_search_name:
- */
-static void
-backend_search_name (PkBackend *backend, PkBitfield filters, gchar **values)
-{
- gchar *filters_text;
- gchar *search;
- filters_text = pk_filter_bitfield_to_string (filters);
- search = g_strjoinv ("&", values);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "search-name", filters_text, search, NULL);
- g_free (filters_text);
- g_free (search);
-}
-
-/**
- * pk_backend_update_packages:
- */
-static void
-backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
-{
- gchar *package_ids_temp;
-
- /* send the complete list as stdin */
- package_ids_temp = pk_package_ids_to_string (package_ids);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "update-packages", pk_backend_bool_to_string (only_trusted), package_ids_temp, NULL);
- g_free (package_ids_temp);
-}
-
-/**
- * pk_backend_update_system:
- */
-static void
-backend_update_system (PkBackend *backend, gboolean only_trusted)
-{
- pk_backend_spawn_helper (spawn, "aptBackend.py", "update-system", pk_backend_bool_to_string (only_trusted), NULL);
-}
-
-/**
- * pk_backend_resolve:
- */
-static void
-backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
-{
- gchar *filters_text;
- gchar *package_ids_temp;
- filters_text = pk_filter_bitfield_to_string (filters);
- package_ids_temp = pk_package_ids_to_string (package_ids);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "resolve", filters_text, package_ids_temp, NULL);
- g_free (filters_text);
- g_free (package_ids_temp);
-}
-
-#ifdef HAVE_PYTHON_SOFTWARE_PROPERTIES
-/**
- * pk_backend_get_repo_list:
- */
-static void
-backend_get_repo_list (PkBackend *backend, PkBitfield filters)
-{
- gchar *filters_text;
- filters_text = pk_filter_bitfield_to_string (filters);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "get-repo-list", filters_text, NULL);
- g_free (filters_text);
-}
-
-/**
- * pk_backend_repo_enable:
- */
-static void
-backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
-{
- if (enabled == TRUE) {
- pk_backend_spawn_helper (spawn, "aptBackend.py", "repo-enable", rid, "true", NULL);
- } else {
- pk_backend_spawn_helper (spawn, "aptBackend.py", "repo-enable", rid, "false", NULL);
- }
-}
-
-/**
- * pk_backend_repo_set_data:
- *
-FIXME: Not implemented
-
-static void
-backend_repo_set_data (PkBackend *backend, const gchar *rid, const gchar *parameter, const gchar *value)
-{
- pk_backend_spawn_helper (spawn, "aptBackend.py", "repo-set-data", rid, parameter, value, NULL);
-}
-*/
-#endif /* HAVE_PYTHON_SOFTWARE_PROPERTIES */
-
-/**
- * backend_what_provides:
- */
-static void
-backend_what_provides (PkBackend *backend, PkBitfield filters, PkProvidesEnum provides, const gchar *search)
-{
- gchar *filters_text;
- const gchar *provides_text;
- provides_text = pk_provides_enum_to_string (provides);
- filters_text = pk_filter_bitfield_to_string (filters);
- pk_backend_spawn_helper (spawn, "aptBackend.py", "what-provides", filters_text, provides_text, search, NULL);
- g_free (filters_text);
-}
-
-/**
- * pk_backend_get_categories:
- *
-FIXME: Not implemented
-static void
-backend_get_categories (PkBackend *backend)
-{
- pk_backend_spawn_helper (spawn, "aptBackend.py", "get-categories", NULL);
-} */
-
-/**
- * backend_get_groups:
- */
-static PkBitfield
-backend_get_groups (PkBackend *backend)
-{
- return pk_bitfield_from_enums (
- PK_GROUP_ENUM_ACCESSORIES,
- PK_GROUP_ENUM_ADMIN_TOOLS,
- PK_GROUP_ENUM_COMMUNICATION,
- PK_GROUP_ENUM_DOCUMENTATION,
- PK_GROUP_ENUM_DESKTOP_GNOME,
- PK_GROUP_ENUM_DESKTOP_KDE,
- PK_GROUP_ENUM_DESKTOP_OTHER,
- PK_GROUP_ENUM_ELECTRONICS,
- PK_GROUP_ENUM_GAMES,
- PK_GROUP_ENUM_GRAPHICS,
- PK_GROUP_ENUM_INTERNET,
- 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_PUBLISHING,
- PK_GROUP_ENUM_SCIENCE,
- PK_GROUP_ENUM_SYSTEM,
- PK_GROUP_ENUM_UNKNOWN,
- PK_GROUP_ENUM_COLLECTIONS,
- -1);
-}
-
-/**
- * backend_get_filters:
- */
-static PkBitfield
-backend_get_filters (PkBackend *backend)
-{
- return pk_bitfield_from_enums (
- PK_FILTER_ENUM_GUI,
- PK_FILTER_ENUM_INSTALLED,
- PK_FILTER_ENUM_DEVELOPMENT,
- PK_FILTER_ENUM_SUPPORTED,
- PK_FILTER_ENUM_FREE,
- PK_FILTER_ENUM_COLLECTIONS,
- -1);
-}
-
-/* FIXME: port this away from PK_BACKEND_OPTIONS */
-PK_BACKEND_OPTIONS (
- "Apt", /* description */
- "Sebastian Heinlein <glatzor at ubuntu.com>", /* author */
- backend_initialize, /* initalize */
- backend_destroy, /* destroy */
- backend_get_groups, /* get_groups */
- backend_get_filters, /* get_filters */
- NULL, /* get_roles */
- backend_get_mime_types, /* get_mime_types */
- backend_cancel, /* cancel */
- backend_download_packages, /* download_packages */
- NULL, /* get_categories */
- backend_get_depends, /* get_depends */
- backend_get_details, /* get_details */
-#ifdef HAVE_PYTHON_META_RELEASE
- backend_get_distro_upgrades, /* get_distro_upgrades */
-#else
- NULL, /* get_distro_upgrades */
-#endif /* HAVE_PYTHON_META_RELEASE */
- backend_get_files, /* get_files */
- backend_get_packages, /* get_packages */
-#ifdef HAVE_PYTHON_SOFTWARE_PROPERTIES
- backend_get_repo_list, /* get_repo_list */
-#else
- NULL, /* get_repo_list */
-#endif /* HAVE_PYTHON_SOFTWARE_PROPERTIES */
- backend_get_requires, /* get_requires */
- backend_get_update_detail, /* get_update_detail */
- backend_get_updates, /* get_updates */
- backend_install_files, /* install_files */
- backend_install_packages, /* install_packages */
- NULL, /* install_signature */
- backend_refresh_cache, /* refresh_cache */
- backend_remove_packages, /* remove_packages */
-#ifdef HAVE_PYTHON_SOFTWARE_PROPERTIES
- backend_repo_enable, /* repo_enable */
-#else
- NULL, /* repo_enable */
-#endif /* HAVE_PYTHON_SOFTWARE_PROPERTIES */
- NULL, /* repo_set_data */
- backend_resolve, /* resolve */
- NULL, /* rollback */
- backend_search_details, /* search_details */
- backend_search_file, /* search_file */
- backend_search_group, /* search_group */
- backend_search_name, /* search_name */
- backend_update_packages, /* update_packages */
- backend_update_system, /* update_system */
- backend_what_provides, /* what_provides */
- backend_simulate_install_files, /* simulate_install_files */
- backend_simulate_install_packages, /* simulate_install_packages */
- backend_simulate_remove_packages, /* simulate_remove_packages */
- backend_simulate_update_packages, /* simulate_update_packages */
- NULL, /* upgrade_system */
- NULL, /* transaction_start */
- NULL /* transaction_stop */
-);
-
-
diff --git a/backends/apt/profiler.py b/backends/apt/profiler.py
deleted file mode 100644
index bc09f9e..0000000
--- a/backends/apt/profiler.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env python
-# 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-# Copyright (C) 2008
-# Sebastian Heinlein <sebi at glatzor.de>
-
-"""
-Allows to start the apt2 backend in a profling mode
-"""
-
-__author__ = "Sebastian Heinlein <devel at glatzor.de>"
-
-
-import hotshot
-import sys
-
-from aptDBUSBackend import main
-
-if len(sys.argv) == 2:
- profile = sys.argv[1]
-else:
- profile = "profile"
-
-prof = hotshot.Profile(profile)
-print prof.runcall(main)
-prof.close()
diff --git a/backends/apt/test.sh b/backends/apt/test.sh
deleted file mode 100755
index f6eca2e..0000000
--- a/backends/apt/test.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-nosetests $@ --with-coverage --cover-package=aptDBUSBackend --pdb tests.py
diff --git a/backends/apt/tests.py b/backends/apt/tests.py
deleted file mode 100755
index 70accd1..0000000
--- a/backends/apt/tests.py
+++ /dev/null
@@ -1,155 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-"""
-Provides unit test of the apt backend of PackageKit
-
-Copyright (C) 2008 Sebastian Heinlein <glatzor at ubuntu.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.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-Licensed under the GNU General Public License Version 2
-"""
-
-__author__ = "Sebastian Heinlein <devel at glatzor.de>"
-
-import threading
-import time
-import os
-import shutil
-import sys
-import tempfile
-import unittest
-
-import apt
-import apt_pkg
-import mox
-import nose.tools
-
-from aptDBUSBackend import PackageKitAptBackend
-from packagekit.enums import *
-
-TEMPDIR = tempfile.mkdtemp(prefix="apt-backend-test")
-
-class AptBackendTestCase(mox.MoxTestBase):
- """Test suite for the APT backend"""
-
- def setUp(self):
- """Create a mox factory and a backend instance"""
- mox.MoxTestBase.setUp(self)
- self.backend = PackageKitAptBackend(None, None)
- for cb in ["Package", "Finished"]:
- self.mox.StubOutWithMock(self.backend, cb)
-
- @nose.tools.timed(10)
- def test_00_Init(self):
- """Test the initialization"""
- self.mox.ReplayAll()
- self.backend.Init()
- while threading.activeCount() > 1:
- time.sleep(0.1)
- binary = os.path.join(TEMPDIR,
- apt_pkg.Config["Dir::Cache"],
- apt_pkg.Config["Dir::Cache::pkgcache"])
- source = os.path.join(TEMPDIR,
- apt_pkg.Config["Dir::Cache"],
- apt_pkg.Config["Dir::Cache::srcpkgcache"])
- self.assertTrue(os.path.exists(source))
- self.assertTrue(os.path.exists(binary))
- pkg = self.backend._cache["xterm"]
- self.assertEqual(pkg.candidateVersion, "235-1")
-
- @nose.tools.timed(10)
- def test_01_Refresh(self):
- """Test the Refresh of the cache method"""
- self.backend.Finished(EXIT_SUCCESS)
- self.mox.ReplayAll()
- self.backend.doRefreshCache(False)
- while threading.activeCount() > 1:
- time.sleep(0.1)
- self.assertEqual(self.backend._cache["xterm"].candidateVersion, "237-1")
- self.assertTrue(self.backend._cache.has_key("synaptic"))
-
- @nose.tools.timed(10)
- def test_20_SearchName(self):
- """Test the doSearchName method"""
- self.backend.Package(INFO_INSTALLED, "xterm;235-1;i386;",
- "X terminal emulator")
- self.backend.Finished(EXIT_SUCCESS)
- self.mox.ReplayAll()
- self.backend.doSearchName(FILTER_NONE, "xterm")
- while threading.activeCount() > 1:
- time.sleep(0.1)
-
- @nose.tools.timed(10)
- def test_20_SearchFile(self):
- """Test the doSearchFile method"""
- self.backend.Package(INFO_INSTALLED, "xterm;235-1;i386;",
- "X terminal emulator")
- self.backend.Finished(EXIT_SUCCESS)
- self.mox.ReplayAll()
- self.backend.doSearchFile(FILTER_NONE, "bin/xterm")
- while threading.activeCount() > 1:
- time.sleep(0.1)
-
- @nose.tools.timed(10)
- def test_20_GetUpdates(self):
- """Test the doGetUpdates method"""
- self.backend.Package(INFO_NORMAL, "xterm;237-1;i386;",
- "X terminal emulator")
- self.backend.Finished(EXIT_SUCCESS)
- self.mox.ReplayAll()
- self.backend.doGetUpdates(FILTER_NONE)
- while threading.activeCount() > 1:
- time.sleep(0.1)
-
-
-def setup():
- """Create a temporary and very simple chroot for apt"""
- apt_pkg.InitConfig()
- config = apt_pkg.Config
- config.Set("Dir::Etc::sourcelist",
- os.path.join(TEMPDIR, "etc/apt/sources.list"))
- config.Set("Dir::Etc::sourceparts", "")
- config.Set("Dir", TEMPDIR)
- config.Set("Dir::State::status",
- os.path.join(TEMPDIR, "var/lib/dpkg/status"))
- os.makedirs(os.path.join(TEMPDIR, "var/lib/apt/lists/partial"))
- os.makedirs(os.path.join(TEMPDIR, "var/cache/apt/archives/partial"))
- os.makedirs(os.path.join(TEMPDIR, "var/lib/dpkg/info"))
- os.makedirs(os.path.join(TEMPDIR, "etc/apt"))
- os.makedirs(os.path.join(TEMPDIR, "repo"))
- shutil.copy("data/Packages", os.path.join(TEMPDIR, "repo/Packages"))
- shutil.copy("data/status", os.path.join(TEMPDIR, "var/lib/dpkg/status"))
- shutil.copy("data/xterm.list", os.path.join(TEMPDIR,
- "var/lib/dpkg/info/xterm.list"))
- sources = open(os.path.join(TEMPDIR, "etc/apt/sources.list"), "w")
- sources.write("deb file://%s/repo/ ./\n" % TEMPDIR)
- sources.close()
-
-
-def teardown():
- """Clear up temporary files"""
- if os.path.exists(TEMPDIR):
- shutil.rmtree(TEMPDIR)
-
-def usage():
- print "ERROR: Run ./test.sh instead"
- sys.exit(1)
-
-if __name__ == "__main__":
- usage()
-
-# vim: ts=4 et sts=4
diff --git a/backends/apt/update-packagekit-app-data b/backends/apt/update-packagekit-app-data
deleted file mode 100755
index b0e6a57..0000000
--- a/backends/apt/update-packagekit-app-data
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env python
-# update-packagekit-app-data - Generate a cache of mime type and codec handlers
-# Authors: Michael Vogt <mvo at ubuntu.com>
-# Sebastian Heinlein <devel at glatzor.de>
-
-import sys
-import glob
-import os
-import os.path
-import re
-import sys
-
-from optparse import OptionParser
-
-import gdbm
-
-try:
- import xdg.DesktopEntry
-except ImportError, e:
- print "WARNING: can not import xdg.DesktopEntry, aborting"
- sys.exit(0)
-
-def generate_mime_map(desktop_dir, cache_dir):
- dicts = { 'mime':{}, 'codec':{} }
-
- def record_provider(de, cp, defield,dictname):
- try:
- keys = de.get(defield, list=True)
- except keyError:
- return
- if not keys: return
- dict = dicts[dictname]
- for key in keys:
- # gst-caps support
- if dictname == 'codec' and ',' in key:
- key = key.split(",")[0]
- try:
- l = dict[key]
- except KeyError:
- l = []; dict[key] = l
- l.append(cp)
-
- for fn in glob.glob(os.path.join(desktop_dir, 'desktop/*.desktop')):
- try:
- de = xdg.DesktopEntry.DesktopEntry(fn)
- except Exception, e:
- print >>sys.stderr, "bad .desktop file: %s: %s" % (fn, e)
- try:
- component = de.get('X-AppInstall-Section')
- package = de.get('X-AppInstall-Package')
- except KeyError:
- continue
- cp = component+"/"+package
- record_provider(de, cp, 'MimeType','mime')
- record_provider(de, cp, 'X-AppInstall-Codecs','codec')
-
- for (dictname, dict) in dicts.iteritems():
- g = gdbm.open(os.path.join(cache_dir,
- dictname+"-map.gdbm"),
- 'nfu')
- for (key,l) in dict.iteritems():
- g[key] = ' '.join(l)
- g.sync()
- g.close()
-
-def main():
- parser = OptionParser()
- parser.add_option ("-d", "--desktop-dir", action="store",
- dest="desktop_dir",
- default="/usr/share/app-install",
- help="Directory that contains the desktop files "
- "of the applications")
- parser.add_option ("-c", "--cache-dir", action="store",
- dest="cache_dir",
- default="/var/lib/PackageKit",
- help="Directory where the data should be cached in")
- (options, args) = parser.parse_args()
- for path in (options.desktop_dir, options.cache_dir):
- if not os.path.isdir(path):
- print "%s is not a valid directory" % path
- sys.exit(1)
- print "Generating mime/codec maps..."
- generate_mime_map(options.desktop_dir, options.cache_dir)
-
-if __name__ == "__main__":
- main()
diff --git a/configure.ac b/configure.ac
index 68d11e4..cda925f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -480,7 +480,6 @@ AM_CONDITIONAL(PK_BUILD_PM_UTILS, test $build_pm_utils = "yes")
# backends
AC_ARG_ENABLE(alpm, AS_HELP_STRING([--enable-alpm],[use the ALPM backend]),enable_alpm=$enableval,enable_alpm=no)
-AC_ARG_ENABLE(apt, AS_HELP_STRING([--enable-apt],[use the APT backend]),enable_apt=$enableval,enable_apt=no)
AC_ARG_ENABLE(aptcc, AS_HELP_STRING([--enable-aptcc],[use the APTcc backend]),enable_aptcc=$enableval,enable_aptcc=no)
AC_ARG_ENABLE(box, AS_HELP_STRING([--enable-box],[use the BOX backend]),enable_box=$enableval,enable_box=no)
AC_ARG_ENABLE(conary, AS_HELP_STRING([--enable-conary],[use the CONARY backend]),enable_conary=$enableval,enable_conary=no)
@@ -501,7 +500,6 @@ AC_ARG_ENABLE(zypp, AS_HELP_STRING([--enable-zypp],[use the Zypp backend]),enabl
# export to Makefile.am's
AM_CONDITIONAL(BACKEND_TYPE_ALPM, [test x$enable_alpm = xyes])
-AM_CONDITIONAL(BACKEND_TYPE_APT, [test x$enable_apt = xyes])
AM_CONDITIONAL(BACKEND_TYPE_APTCC, [test x$enable_aptcc = xyes])
AM_CONDITIONAL(BACKEND_TYPE_BOX, [test x$enable_box = xyes])
AM_CONDITIONAL(BACKEND_TYPE_CONARY, [test x$enable_conary = xyes])
@@ -597,7 +595,7 @@ dnl ---------------------------------------------------------------------------
AC_ARG_WITH([default_backend],
AS_HELP_STRING([--with-default-backend=<option>],
[Default backend to use
- alpm,apt,aptcc,box,conary,dummy,entropy,opkg,pisi,portage,ports,razor,slapt,smart,urpmi,yum,zif,zypp (dummy)]))
+ alpm,aptcc,box,conary,dummy,entropy,opkg,pisi,portage,ports,razor,slapt,smart,urpmi,yum,zif,zypp (dummy)]))
# default to a sane option for the installed tool
if test x$with_default_backend = x; then
if test -f /usr/bin/yum ; then
@@ -607,7 +605,7 @@ if test x$with_default_backend = x; then
elif test -f /usr/lib/libalpm.so; then
with_default_backend=alpm
elif test -f /usr/bin/apt-get ; then
- with_default_backend=apt
+ with_default_backend=aptcc
elif test -f /usr/bin/conary ; then
with_default_backend=conary
elif test -f /usr/bin/box-repos ; then
@@ -657,18 +655,6 @@ if test x$enable_zif = xyes; then
fi
AM_CONDITIONAL(PK_BUILD_ZIF, test $build_zif = "yes")
-if test x$enable_apt = xyes; then
- PY_CHECK_MOD([apt_pkg],,,AC_MSG_ERROR([Apt backend needs python-apt]))
- PY_CHECK_MOD([UpdateManager.Core.MetaRelease],,
- AC_DEFINE(HAVE_PYTHON_META_RELEASE, 1,
- "Meta release is available"),
- AC_MSG_WARN([Distro upgrade notification not supported]))
- PY_CHECK_MOD([softwareproperties.SoftwareProperties],,
- AC_DEFINE(HAVE_PYTHON_SOFTWARE_PROPERTIES, 1,
- "Python software properties is available"),
- AC_MSG_WARN([Repository handling not supported]))
-fi
-
if test x$enable_aptcc = xyes; then
dnl Use C++
AC_LANG([C++])
@@ -796,7 +782,6 @@ contrib/device-rebind/Makefile
contrib/pm-utils/Makefile
backends/Makefile
backends/alpm/Makefile
-backends/apt/Makefile
backends/aptcc/Makefile
backends/box/Makefile
backends/conary/Makefile
@@ -875,7 +860,6 @@ echo "
Backends:
ALPM backend: ${enable_alpm}
- APT backend: ${enable_apt}
APTcc backend: ${enable_aptcc}
BOX backend: ${enable_box}
CONARY backend: ${enable_conary}
commit b416e5ded6fbf2973095b49e17b61598e689039a
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 12 17:10:35 2011 +0100
python: Remove the native python library
It's bitrotted as it's unused, and soon we'll have the GIR auto-generated binding.
diff --git a/lib/python/packagekit/Makefile.am b/lib/python/packagekit/Makefile.am
index 09c91cb..4afd4aa 100644
--- a/lib/python/packagekit/Makefile.am
+++ b/lib/python/packagekit/Makefile.am
@@ -9,16 +9,11 @@ packagekitpythondir = ${PYTHON_PACKAGE_DIR}
packagekitpython_PYTHON = \
__init__.py \
backend.py \
- frontend.py \
enums.py \
- pkexceptions.py \
- pkdbus.py \
progress.py \
package.py \
- client.py \
filter.py \
- misc.py \
- $(NULL)
+ misc.py
MAINTAINERCLEANFILES = \
*.pyc
diff --git a/lib/python/packagekit/client.py b/lib/python/packagekit/client.py
deleted file mode 100644
index b051fd3..0000000
--- a/lib/python/packagekit/client.py
+++ /dev/null
@@ -1,481 +0,0 @@
-#!/usr/bin/python
-'''
-The module provides a client to the PackageKit DBus interface. It allows to
-perform basic package manipulation tasks in a cross distribution way, e.g.
-to search for packages, install packages or codecs.
-'''
-# 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# (c) 2008
-# Canonical Ltd.
-# Aidan Skinner <aidan at skinner.me.uk>
-# Martin Pitt <martin.pitt at ubuntu.com>
-# Tim Lauridsen <timlau at fedoraproject.org>
-# Sebastian Heinlein <devel at glatzor.de>
-
-import locale
-import os
-
-import dbus
-import dbus.mainloop.glib
-dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
-import gobject
-
-from enums import *
-from misc import *
-
-__api_version__ = '0.1.2'
-
-class PackageKitError(Exception):
- '''PackageKit error.
-
- This class mainly wraps a PackageKit "error enum". See
- http://www.packagekit.org/pk-reference.html#introduction-errors for details
- and possible values.
- '''
- def __init__(self, code, details=None):
- self.code = code
- self.details = details
-
- def __str__(self):
- return "%s: %s" % (self.code, self.details)
-
-class PackageKitTransaction:
- '''
- This class represents a PackageKit transaction. It allows asynchronous and
- synchronous processing
- '''
- def __init__(self, tid, iface):
- self.tid = tid
- self._error_code = None
- self._error_details = None
- self._exit_status = None
- self._allow_cancel = False
- self._method = None
- self._exit_handler = None
- self.messages = []
- self.result = []
- # Connect the signal handlers to the DBus iface
- self._iface = iface
- for sig, cb in [('Finished', self._on_finished),
- ('ErrorCode', self._on_error),
- ('StatusChanged', self._on_status),
- ('AllowCancel', self._on_allow_cancel),
- ('Package', self._on_package),
- ('Details', self._on_details),
- ('Category', self._on_category),
- ('UpdateDetail', self._on_update_detail),
- ('DistroUpgrade', self._on_distro_upgrade),
- ('Message', self._on_message),
- ('RepoDetail', self._on_repo_detail)]:
- self._iface.connect_to_signal(sig, cb)
- self._main_loop = gobject.MainLoop()
-
- def connect_to_signal(self, sig, cb):
- '''Connect to a signal of the transaction's DBus interface'''
- return self._iface.connect_to_signal(sig, cb)
-
- def _on_package(self, i, id, summary):
- '''Callback for Package signal'''
- self.result.append(PackageKitPackage(i, id, summary))
-
- def _on_distro_upgrade(self, typ, name, summary):
- '''Callback for DistroUpgrade signal'''
- self.result.append(PackageKitDistroUpgrade(typ, name, summary))
-
- def _on_details(self, id, license, group, detail, url, size):
- '''Callback for Details signal'''
- self.result.append(PackageKitDetails(id, license, group, detail,
- url, size))
-
- def _on_category(self, parent_id, cat_id, name, summary, icon):
- '''Callback for Category signal'''
- self.result.append(PackageKitCategory(parent_id, cat_id, name,
- summary, icon))
-
- def _on_update_detail(self, id, updates, obsoletes, vendor_url,
- bugzilla_url, cve_url, restart, update_text,
- changelog, state, issued, updated):
- '''Callback for UpdateDetail signal'''
- self.result.append(PackageKitUpdateDetails(id, updates, obsoletes,
- vendor_url, bugzilla_url,
- cve_url, restart,
- update_text, changelog,
- state, issued, updated))
- def _on_repo_detail(self, id, description, enabled):
- '''Callback for RepoDetail signal'''
- self.result.append(PackageKitRepos(id, description, enabled))
-
- def _on_files(self, id, files):
- '''Callback for Files signal'''
- self.result.append(PackageKitFiles(id, files))
-
- def _on_status(self, status):
- '''Callback for StatusChanged signal'''
- self._status = status
-
- def _on_allow_cancel(self, allow):
- '''Callback for AllowCancel signal'''
- self._allow_cancel = allow
-
- def _on_error(self, code, details):
- '''Callback for ErrorCode signal'''
- self._error_code = code
- self._error_details = details
-
- def _on_message(self, code, details):
- '''Callback for Message signal'''
- self.messages.append(PackageKitMessage(code, details))
-
- def _on_finished(self, exit, runtime):
- '''Callback for Finished signal'''
- self._exit = exit
- self._main_loop.quit()
- if self._exit_handler:
- self._exit_handler(self, exit, runtime)
-
- def set_method(self, method, *args):
- '''Setup the method of the DBus interface which should be handled'''
- self._method = self._iface.get_dbus_method(method)
- self._args = args
-
- def run(self):
- '''Start processing the transaction'''
- # avoid blocking the user interface
- context = gobject.main_context_default()
- while context.pending():
- context.iteration()
- polkit_auth_wrapper(self._method, *self._args)
- if not self._exit_handler:
- self._main_loop.run()
- if self._error_code:
- raise PackageKitError(self._error_code, self._error_details)
- return self.result
-
- def set_locale(self, code):
- '''Set the language to the given locale code'''
- return self._iface.SetHints(['locale=%s' % code])
-
- def cancel(self):
- '''Cancel the transaction'''
- return self._iface.Cancel()
-
- def get_status(self):
- '''Get the status of the transaction'''
- return self._status
-
- def get_progress(self):
- '''Get the progress of the transaction'''
- return self._iface.GetProgress()
-
- def get_finished_state(self):
- '''Return the finished status'''
- return self._finished_status
-
- def is_caller_active(self):
- '''
- This method allows us to find if the original caller of the method is
- still connected to the session bus. This is usually an indication that
- the client can handle it's own error handling and EULA callbacks rather
- than another program taking over.
- '''
- return self._iface.IsCallerActive()
-
- def get_error(self):
- '''Returns the PackageKitError of a failed transaction'''
- if self._error_code:
- return PackageKitError(self._error_code, self._error_details)
- else:
- return None
-
-class PackageKitClient:
- '''PackageKit client wrapper class.
-
- This exclusively uses synchonous calls. Functions which take a long time
- (install/remove packages) have callbacks for progress feedback.
- '''
- def __init__(self, main_loop=None):
- '''Initialize a PackageKit client.
-
- If main_loop is None, this sets up its own gobject.MainLoop(),
- otherwise it attaches to the specified one.
- '''
- self.pk_control = None
- self.bus = dbus.SystemBus()
- self._locale = locale.getdefaultlocale()[0]
-
- def suggest_daemon_quit(self):
- '''Ask the PackageKit daemon to shutdown.'''
- try:
- self.pk_control.SuggestDaemonQuit()
- except (AttributeError, dbus.DBusException), e:
- # not initialized, or daemon timed out
- pass
-
- def resolve(self, names, filters=FILTER_NONE, exit_handler=None):
- '''Resolve package names'''
- names_list = self._to_list(names)
- return self._run_transaction("Resolve", [filters, names_list],
- exit_handler)
-
- def get_details(self, packages, exit_handler=None):
- '''Get details about the given packages'''
- package_ids = self._to_package_id_list(packages)
- return self._run_transaction("GetDetails", [package_ids],
- exit_handler)
-
- def search_name(self, search, filters=FILTER_NONE, exit_handler=None):
- '''Search for packages by name'''
- return self._run_transaction("SearchName", [filters, search],
- exit_handler)
-
- def search_group(self, search, filters=FILTER_NONE, exit_handler=None):
- '''Search for packages by their group'''
- return self._run_transaction("SearchGroup", [filters, search],
- exit_handler)
-
- def search_details(self, search, filters=FILTER_NONE, exit_handler=None):
- '''Search for packages by their details'''
- return self._run_transaction("SearchDetails", [filters, search],
- exit_handler)
-
- def search_file(self, search, filters=FILTER_NONE, exit_handler=None):
- '''Search for packages by their files'''
- return self._run_transaction("SearchFiles", [filters, search],
- exit_handler)
-
- def install_packages(self, packages, only_trusted=True, exit_handler=None):
- '''Install the packages of the given package ids'''
- package_ids = self._to_package_id_list(packages)
- return self._run_transaction("InstallPackages",
- [only_trusted, package_ids], exit_handler)
-
- def update_packages(self, packages, exit_handler=None):
- '''Update the packages of the given package ids'''
- package_ids = self._to_package_id_list(packages)
- return self._run_transaction("UpdatePackages", [package_ids],
- exit_handler)
-
- def remove_packages(self, packages, allow_deps=False, auto_remove=True,
- exit_handler=None):
- '''Remove the packages of the given package ids'''
- package_ids = self._to_package_id_list(packages)
- return self._run_transaction("RemovePackages",
- [package_ids, allow_deps, auto_remove],
- exit_handler)
-
- def refresh_cache(self, force=False, exit_handler=None):
- '''
- Refresh the cache, i.e. download new metadata from a
- remote URL so that package lists are up to date. This action
- may take a few minutes and should be done when the session and
- system are idle.
- '''
- return self._run_transaction("RefreshCache", (force,), exit_handler)
-
- def get_repo_list(self, filters=FILTER_NONE, exit_handler=None):
- '''Get the repositories'''
- return self._run_transaction("GetRepoList", (filters,), exit_handler)
-
- def repo_enable(self, repo_id, enabled):
- '''
- Enable the repository specified.
- repo_id is a repository identifier, e.g. fedora-development-debuginfo
- enabled true if enabled, false if disabled
- '''
- return self._run_transaction("RepoEnable", (repo_id, enabled),
- exit_handler)
-
- def get_updates(self, filters=FILTER_NONE, exit_handler=None):
- '''
- This method should return a list of packages that are installed and
- are upgradable.
-
- It should only return the newest update for each installed package.
- '''
- return self._run_transaction("GetUpdates", [filters], exit_handler)
-
- def get_categories(self, exit_handler=None):
- '''Return available software categories'''
- return self._run_transaction("GetCategories", [], exit_handler)
-
- def get_packages(self, filters=FILTER_NONE, exit_handler=None):
- '''Return all packages'''
- return self._run_transaction("GetPackages", [filters], exit_handler)
-
- def update_system(self, exit_handler=None):
- '''Update the system'''
- return self._run_transaction("UpdateSystem", [], exit_handler)
-
- def download_packages(self, packages, exit_handler=None):
- '''Download package files'''
- package_ids = self._to_package_id_list(packages)
- return self._run_transaction("DownloadPackages", [package_ids], exit_handler)
-
- def get_depends(self, packages, filters=FILTER_NONE, recursive=False,
- exit_handler=None):
- '''Search for dependencies for packages'''
- package_ids = self._to_package_id_list(packages)
- return self._run_transaction("GetDepends",
- [filters, package_ids, recursive],
- exit_handler)
-
- def get_files(self, packages, exit_handler=None):
- '''Get files of the given packages'''
- package_ids = self._to_package_id_list(packages)
- return self._run_transaction("GetFiles", [package_ids], exit_handler)
-
- def get_requires(self, packages, filters=FILTER_NONE, recursive=False,
- exit_handler=None):
- '''Search for requirements for packages'''
- package_ids = self._to_package_id_list(packages)
- return self._run_transaction("GetRequires",
- [filters, package_ids, recursive],
- exit_handler)
-
- def get_update_detail(self, packages, exit_handler=None):
- '''Get details for updates'''
- package_ids = self._to_package_id_list(packages)
- return self._run_transaction("GetUpdateDetail", [package_ids],
- exit_handler)
-
- def get_distro_upgrades(self, exit_handler=None):
- '''Query for later distribution releases'''
- return self._run_transaction("GetDistroUpgrades", [],
- exit_handler)
-
- def install_files(self, only_trusted, files, exit_handler=None):
- '''Install the given local packages'''
- return self._run_transaction("InstallFiles", [only_trusted, files],
- exit_handler)
-
- def install_signature(self, sig_type, key_id, package_id,
- exit_handler=None):
- '''Install packages signing keys used to validate packages'''
- return self._run_transaction("InstallSignature",
- [sig_type, key_id, package_id],
- exit_handler)
-
- def set_repo_data(self, repo_id, parameter, value, exit_handler=None):
- '''Change custom parameter of a repository'''
- return self._run_transaction("RepoSetData",
- [repo_id, parameter, value],
- exit_handler)
-
- def rollback(self, transaction_id, exit_handler=None):
- '''Roll back to a previous transaction'''
- return self._run_transaction("Rollback", [transaction_id],
- exit_handler)
-
- def what_provides(self, filters, enum, search, exit_handler=None):
- '''Search for packages that provide the supplied attributes'''
- return self._run_transaction("WhatProvides", [filters, enum, search],
- exit_handler)
-
- def set_locale(self, code):
- '''Set the language of the client'''
- self._locale = code
-
- def accept_eula(self, eula_id, exit_handler=None):
- '''Accept the given end user licence aggreement'''
- return self._run_transaction("AcceptEula", [eula_id], exit_handler)
-
- #
- # Internal helper functions
- #
- def _to_list(self, obj):
- '''convert obj to list'''
- if not isinstance(obj, list):
- obj = [obj]
- return obj
-
- def _to_package_id_list(self, obj):
- '''convert to list of package ids'''
- ids = []
- if not isinstance(obj, list):
- obj = [obj]
- for o in obj:
- if isinstance(o, PackageKitPackage):
- ids.append(o.id)
- elif isinstance(o, str) and len(o.split(";")) == 4:
- ids.append(o)
- else:
- raise Exception("Wrong Type: %s has to be a PackageKit id "
- "string or a PackageKitPackage instance" % o)
- return ids
-
- def _run_transaction(self, method_name, args, exit_handler):
- '''Run the given method in a new transaction'''
- try:
- tid = self.pk_control.GetTid()
- except (AttributeError, dbus.DBusException), e:
- if self.pk_control == None or (hasattr(e, '_dbus_error_name') and \
- e._dbus_error_name == 'org.freedesktop.DBus.Error.ServiceUnknown'):
- # first initialization (lazy) or timeout
- self.pk_control = dbus.Interface(self.bus.get_object(
- 'org.freedesktop.PackageKit',
- '/org/freedesktop/PackageKit',
- False), 'org.freedesktop.PackageKit')
- tid = self.pk_control.GetTid()
- else:
- raise
- iface = dbus.Interface(self.bus.get_object('org.freedesktop.PackageKit',
- tid, False),
- 'org.freedesktop.PackageKit.Transaction')
- trans = PackageKitTransaction(tid, iface)
- if self._locale:
- trans.set_locale(self._locale)
- trans.set_method(method_name, *args)
- if exit_handler:
- trans._exit_handler = exit_handler
- return trans
- else:
- return trans.run()
-
-#### PolicyKit authentication borrowed wrapper ##
-class PermissionDeniedByPolicy(dbus.DBusException):
- _dbus_error_name = 'org.freedesktop.PackageKit.Transaction.RefusedByPolicy'
-
-def polkit_auth_wrapper(fn, *args, **kwargs):
- '''Function call wrapper for PolicyKit authentication.
-
- Call fn(*args, **kwargs). If it fails with a PermissionDeniedByPolicy
- and the caller can authenticate to get the missing privilege, the PolicyKit
- authentication agent is called, and the function call is attempted again.
- '''
- try:
- return fn(*args, **kwargs)
- except dbus.DBusException, e:
- if e._dbus_error_name == PermissionDeniedByPolicy._dbus_error_name:
- # last words in message are privilege and auth result
- (priv, auth_result) = e.message.split()[-2:]
- if auth_result.startswith('auth_'):
- pk_auth = dbus.SessionBus().get_object(
- 'org.freedesktop.PolicyKit.AuthenticationAgent', '/',
- 'org.gnome.PolicyKit.AuthorizationManager.SingleInstance')
- # TODO: provide xid
- res = pk_auth.ObtainAuthorization(priv, dbus.UInt32(0),
- dbus.UInt32(os.getpid()), timeout=300)
- print res
- if res:
- return fn(*args, **kwargs)
- raise PermissionDeniedByPolicy(priv + ' ' + auth_result)
- else:
- raise
-
-if __name__ == '__main__':
- pass
diff --git a/lib/python/packagekit/frontend.py b/lib/python/packagekit/frontend.py
deleted file mode 100644
index 3af0aa5..0000000
--- a/lib/python/packagekit/frontend.py
+++ /dev/null
@@ -1,628 +0,0 @@
-# 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-# Copyright (C) 2007
-# Tim Lauridsen <timlau at fedoraproject.org>
-# Tom Parker <palfrey at tevp.net>
-# Thomas Liu <tliu at redhat.com>
-# Robin Norwood <rnorwood at redhat.com>
-
-import dbus
-import os
-from dbus.mainloop.glib import DBusGMainLoop
-import gobject
-from enums import PackageKitEnum
-from pkdbus import PackageKitDbusInterface, dbusException
-from pkexceptions import PackageKitException, PackageKitNotStarted
-from pkexceptions import PackageKitAccessDenied, PackageKitTransactionFailure
-from pkexceptions import PackageKitBackendFailure
-
-class PackageKit(PackageKitDbusInterface):
- def __init__(self):
- self.loop = gobject.MainLoop()
- PackageKitDbusInterface.__init__(self,
- 'org.freedesktop.PackageKit',
- 'org.freedesktop.PackageKit',
- '/org/freedesktop/PackageKit')
-
- def tid(self):
- return self.pk_iface.GetTid()
-
- def get_iface(self):
- DBusGMainLoop(set_as_default=True)
- interface = 'org.freedesktop.PackageKit.Transaction'
- bus = dbus.SystemBus()
- bus.add_signal_receiver(self.catchall_signal_handler, interface_keyword='dbus_interface', member_keyword='member', dbus_interface=interface)
- return dbus.Interface(bus.get_object('org.freedesktop.PackageKit', self.tid()), interface)
-
- def job_id(func):
- """
- Decorator for the dbus calls.
- Append async=True to the args if you want the call to be asynchronous.
- """
- def wrapper(*args, **kwargs):
- self = args[0]
- jid = polkit_auth_wrapper(func, *args)
- if jid == -1:
- raise PackageKitTransactionFailure
- elif not 'async' in kwargs.keys() and jid == None:
- self.run()
- else:
- return jid
- return wrapper
-
- def run(self):
- self.loop.run()
-
- def catchall_signal_handler(self, *args, **kwargs):
- member = kwargs['member']
- if member == "AllowCancel":
- self.AllowCancel(args[0])
- elif member == "CallerActiveChanged":
- self.CallerActiveChanged(args[0])
- elif member == "Category":
- self.Category(args[0], args[1], args[2], args[3], args[4])
- elif member == "Details":
- self.Details(args[0], args[1], args[2], args[3], args[4], args[5])
- elif member == "ErrorCode":
- self.ErrorCode(args[0], args[1])
- elif member == "Files":
- self.Files(args[0], args[1])
- elif member == "Finished":
- self.loop.quit()
- self.Finished(args[0], args[1])
- elif member == "Message":
- self.Message(args[0], args[1])
- elif member == "Package":
- self.Package(args[0], args[1], args[2])
- elif member == "ProgressChanged":
- self.ProgressChanged(args[0], args[1], args[2], args[3])
- elif member == "RepoDetail":
- self.RepoDetail(args[0], args[1], args[2])
- elif member == "RepoSignatureRequired":
- self.RepoSignatureRequired(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7])
- elif member == "EulaRequired":
- self.EulaRequired(args[0], args[1], args[2], args[3])
- elif member == "MediaChangeRequired":
- self.MediaChangeRequired(args[0], args[1], args[2])
- elif member == "RequireRestart":
- self.RequireRestart(args[0], args[1])
- elif member == "StatusChanged":
- self.StatusChanged(args[0])
- elif member == "Transaction":
- self.Transaction(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7])
- elif member == "UpdateDetail":
- self.UpdateDetail(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11])
- elif member == "DistroUpgrade":
- self.DistroUpgrade(args[0], args[1], args[2])
- elif member in ["Destroy", "Locked", "TransactionListChanged"]:
- pass
- else:
- print "Caught unhandled signal %s"% member
- print " args:"
- for arg in args:
- print " " + str(arg)
-
-# --- PK Signal Handlers ---
-# See http://www.packagekit.org/gtk-doc/Transaction.html
-
- def AllowCancel(self,
- allow_cancel):
- pass
-
- def CallerActiveChanged(self,
- is_active):
- pass
-
- def Category(self,
- parent_id,
- cat_id,
- name,
- summary,
- icon):
- pass
-
- def Details(self,
- package_id,
- license,
- group,
- detail,
- url,
- size):
- pass
-
- def ErrorCode(self,
- code,
- details):
- pass
-
- def Files(self,
- package_id,
- file_list):
- pass
-
- def Finished(self,
- exit,
- runtime):
- pass
-
- def Message(self,
- type,
- details):
- pass
-
- def Package(self,
- info,
- package_id,
- summary):
- pass
-
- def ProgressChanged(self,
- percentage,
- subpercentage,
- elapsed,
- remaining):
- pass
-
- def RepoDetail(self,
- repo_id,
- description,
- enabled):
- pass
-
- def RepoSignatureRequired(self,
- package_id,
- repository_name,
- key_url,
- key_userid,
- key_id,
- key_fingerprint,
- key_timestamp,
- type):
- pass
-
- def EulaRequired(self,
- eula_id,
- package_id,
- vendor_name,
- license_agreement):
- pass
-
- def MediaChangeRequired(self,
- media_type,
- media_id,
- media_text):
- pass
-
- def RequireRestart(self,
- type,
- package_id):
- pass
-
- def StatusChanged(self,
- status):
- pass
-
- def Transaction(self,
- old_tid,
- timespec,
- succeeded,
- role,
- duration,
- data,
- uid,
- cmdline):
- pass
-
- def UpdateDetail(self,
- package_id,
- updates,
- obsoletes,
- vendor_url,
- bugzilla_url,
- cve_url,
- restart,
- update_text,
- changelog,
- state,
- issued,
- updated):
- pass
-
- def DistroUpgrade(self,
- type,
- name,
- summary):
- pass
-
-# --- PK Methods ---
-
-## Start a new transaction to do Foo
-
- @dbusException
- @job_id
- def GetUpdates(self, filter="none"):
- """
- Lists packages which could be updated.
- Causes 'Package' signals for each available package.
- """
- return self.get_iface().GetUpdates(filter)
-
- @dbusException
- @job_id
- def RefreshCache(self, force=False):
- """
- Refreshes the backend's cache.
- """
- return self.get_iface().RefreshCache(force)
-
- @dbusException
- @job_id
- def RepoEnable(self, repo, enabled):
- """
- Enable or disable the repository
- """
- return self.get_iface().RepoEnable(repo, enabled)
-
- @dbusException
- @job_id
- def GetRepoList(self, filter):
- """
- Enable or disable the repository
- """
- return self.get_iface().GetRepoList(filter)
-
- @dbusException
- @job_id
- def UpdateSystem(self):
- """
- Applies all available updates.
- Asynchronous
- """
- return self.get_iface().UpdateSystem()
-
- @dbusException
- @job_id
- def UpdatePackages(self, package_ids):
- """
- Applies all available updates.
- Asynchronous
- """
- return self.get_iface().UpdateSystem(package_ids)
-
- @dbusException
- @job_id
- def Resolve(self, package_names, filter="none"):
- """
- Finds a packages with the given names, and gives back a Package that matches those names exactly
- (not yet supported in yum backend, and maybe others)
- """
- return self.get_iface().Resolve(filter, package_names)
-
- @dbusException
- @job_id
- def SearchName(self, pattern, filter="none"):
- """
- Searches the 'Name' field for something matching 'pattern'.
- 'filter' could be 'installed', a repository name, or 'none'.
- Causes 'Package' signals for each package found.
- """
- return self.get_iface().SearchName(filter, pattern)
-
- @dbusException
- @job_id
- def SearchDetails(self, pattern, filter="none"):
- """
- Searches the 'Details' field for something matching 'pattern'.
- 'filter' could be 'installed', a repository name, or 'none'.
- Causes 'Package' signals for each package found.
- """
- return self.get_iface().SearchDetails(filter, pattern)
-
- @dbusException
- @job_id
- def SearchGroup(self, pattern, filter="none"):
- """
- Lists all packages in groups matching 'pattern'.
- 'filter' could be 'installed', a repository name, or 'none'.
- Causes 'Package' signals for each package found.
- """
- return self.get_iface().SearchGroup(filter, pattern)
-
- @dbusException
- @job_id
- def SearchFile(self, pattern, filter="none"):
- """
- Lists all packages that provide a file matching 'pattern'.
- 'filter' could be 'installed', a repository name, or 'none'.
- Causes 'Package' signals for each package found.
- """
- return self.get_iface().SearchFile(filter, pattern)
-
- @dbusException
- @job_id
- def GetDepends(self, package_ids, filter="none", recursive=False):
- """
- Lists package dependancies
- """
- return self.get_iface().GetDepends(filter, package_ids, recursive)
-
- @dbusException
- @job_id
- def GetRequires(self, package_ids, filter="none", recursive=False):
- """
- Lists package requires
- """
- return self.get_iface().GetRequires(filter, package_id, recursive)
-
- @dbusException
- @job_id
- def GetUpdateDetail(self, package_ids):
- """
- More details about an update.
- """
- return self.get_iface().GetUpdateDetail(package_ids)
-
- @dbusException
- @job_id
- def GetDetails(self, package_ids):
- """
- Gets the Details of given package_ids.
- Causes a 'Details' signal.
- """
- return self.get_iface().GetDetails(package_ids)
-
- @dbusException
- @job_id
- def RemovePackages(self, package_ids, allow_deps=False, auto_remove=False):
- """
- Removes packages.
- Asynchronous
- """
- return self.get_iface().RemovePackages(package_ids, allow_deps, auto_remove)
-
- @dbusException
- @job_id
- def InstallPackages(self, package_ids):
- """
- Installs packages.
- Asynchronous
- """
- return self.get_iface().InstallPackages(package_ids)
-
- @dbusException
- @job_id
- def UpdatePackages(self, package_ids):
- """
- Updates a package.
- Asynchronous
- """
- return self.get_iface().UpdatePackages(package_ids)
-
- @dbusException
- @job_id
- def InstallFiles(self, full_paths, only_trusted=False):
- """
- Installs a package which provides given file?
- Asynchronous
- """
- return self.get_iface().InstallFiles(only_trusted, full_paths)
-
- @dbusException
- @job_id
- def SetLocale(self, code):
- """
- Set system locale.
- """
- return self.get_iface().SetLocale(code)
-
- @dbusException
- @job_id
- def AcceptEula(self, eula_id):
- """
- This method allows the user to accept an end user licence agreement.
- """
- return self.get_iface().AcceptEula(eula_id)
-
- @dbusException
- @job_id
- def DownloadPackages(self, package_ids):
- """
- This method allows the user to accept an end user licence agreement.
- """
- return self.get_iface().DownloadPackages(package_ids)
-
- @dbusException
- @job_id
- def GetAllowCancel(self):
- """
- Get if cancel is allowed for the transaction
- """
- return self.get_iface().GetAllowCancel()
-
- @dbusException
- @job_id
- def GetCategories(self):
- """
- This method returns the collection categories
- """
- return self.get_iface().GetCategories()
-
- @dbusException
- @job_id
- def GetFiles(self, package_ids):
- """
- This method should return the file list of the package_ids
- """
- return self.get_iface().GetFiles(package_ids)
-
- @dbusException
- @job_id
- def GetPackageLast(self):
- """
- This method emits the package that was last emmitted from the daemon.
- """
- return self.get_iface().GetPackageLast()
-
- @dbusException
- @job_id
- def GetDistroUpgrades(self):
- """
- This method should return a list of distribution upgrades that are available.
- """
- return self.get_iface().GetDistroUpgrades()
-
- @dbusException
- @job_id
- def InstallSignature(self, sig_type, key_id, package_id):
- """
- This method allows us to install new security keys.
- """
- return self.get_iface().InstallSignature(sig_type, key_id, package_id)
-
- @dbusException
- @job_id
- def IsCallerActive(self):
- """
- This method allows us to find if the original caller of the method is still connected to the session bus.
- """
- return self.get_iface().IsCallerActive()
-
- @dbusException
- @job_id
- def RepoSetData(self, repo_id, parameter, value):
- """
- This method allows arbitary data to be passed to the repository handler.
- """
- return self.get_iface().RepoSetData(repo_id, parameter, value)
-
- @dbusException
- @job_id
- def Rollback(self, transaction_id):
- """
- This method rolls back the package database to a previous transaction.
- """
- return self.get_iface().Rollback(transaction_id)
-
- @dbusException
- @job_id
- def WhatProvides(self, filter, type, search):
- """
- This method returns packages that provide the supplied attributes.
- """
- return self.get_iface().WhatProvides(filter, type, search)
-
-## Do things or query transactions
- @dbusException
- @job_id
- def Cancel(self):
- """
- Might not succeed for all manner or reasons.
- throws NoSuchTransaction
- """
- return self.get_iface().Cancel()
-
- @dbusException
- @job_id
- def GetStatus(self):
- """
- This is what the transaction is currrently doing, and might change.
- Returns status (query, download, install, exit)
- throws NoSuchTransaction
- """
- return self.get_iface().GetStatus()
-
- @dbusException
- @job_id
- def GetRole(self):
- """
- This is the master role, i.e. won't change for the lifetime of the transaction
- Returns status (query, download, install, exit) and package_id (package acted upon, or NULL
- throws NoSuchTransaction
- """
- return self.get_iface().GetRole()
-
- @dbusException
- @job_id
- def GetProgress(self):
- """
- Returns progress of transaction
- """
- return self.get_iface().GetSubPercentage()
-
- @dbusException
- @job_id
- def GetPackages(self, filter="none"):
- """
- Returns packages being acted upon at this very moment
- throws NoSuchTransaction
- """
- return self.get_iface().GetPackage(filter)
-
-## Get lists of transactions
- @dbusException
- @job_id
- def GetOldTransactions(self, number=5):
- """
- Causes Transaction signals for each Old transaction.
- """
- return self.get_iface().GetOldTransactions(number)
-
-class DumpingPackageKit(PackageKit):
- """
- Just like PackageKit(), but prints all signals instead of handling them
- """
- def catchall_signal_handler(self, *args, **kwargs):
- if kwargs['member'] == "Finished":
- self.loop.quit()
-
- print "Caught signal %s"% kwargs['member']
- print " args:"
- for arg in args:
- print " " + str(arg)
-
-#### PolicyKit authentication borrowed wrapper ##
-class PermissionDeniedByPolicy(dbus.DBusException):
- _dbus_error_name = 'org.freedesktop.PackageKit.Transaction.RefusedByPolicy'
-
-def polkit_auth_wrapper(fn, *args, **kwargs):
- '''Function call wrapper for PolicyKit authentication.
-
- Call fn(*args, **kwargs). If it fails with a PermissionDeniedByPolicy
- and the caller can authenticate to get the missing privilege, the PolicyKit
- authentication agent is called, and the function call is attempted again.
- '''
- try:
- return fn(*args, **kwargs)
- except dbus.DBusException, e:
- if e._dbus_error_name == PermissionDeniedByPolicy._dbus_error_name:
- # last words in message are privilege and auth result
- (priv, auth_result) = e.message.split()[-2:]
- if auth_result.startswith('auth_'):
- pk_auth = dbus.SessionBus().get_object(
- 'org.freedesktop.PolicyKit.AuthenticationAgent', '/',
- 'org.gnome.PolicyKit.AuthorizationManager.SingleInstance')
- # TODO: provide xid
- res = pk_auth.ObtainAuthorization(priv, dbus.UInt32(0),
- dbus.UInt32(os.getpid()), timeout=300)
- print res
- if res:
- return fn(*args, **kwargs)
- raise PermissionDeniedByPolicy(priv + ' ' + auth_result)
- else:
- raise
-
-
diff --git a/lib/python/packagekit/pkdbus.py b/lib/python/packagekit/pkdbus.py
deleted file mode 100644
index 7568d0f..0000000
--- a/lib/python/packagekit/pkdbus.py
+++ /dev/null
@@ -1,60 +0,0 @@
-# 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Copyright (C) 2007
-# Tim Lauridsen <timlau at fedoraproject.org>
-# Tom Parker <palfrey at tevp.net>
-# Robin Norwood <rnorwood at redhat.com>
-
-# Handle the dbus bits, which are almost the same in the frontend and backend.
-
-import dbus
-from dbus.mainloop.glib import DBusGMainLoop
-from pkexceptions import PackageKitException, PackageKitNotStarted
-from pkexceptions import PackageKitAccessDenied, PackageKitTransactionFailure
-from pkexceptions import PackageKitBackendFailure
-
-def dbusException(func):
- def wrapper(*args, **kwargs):
- try:
- return func(*args, **kwargs)
- except dbus.exceptions.DBusException, e:
- if e.get_dbus_name() == "org.freedesktop.DBus.Error.AccessDenied":
- raise PackageKitAccessDenied(e)
- elif e.get_dbus_name() == "org.freedesktop.DBus.Error.NoReply":
- raise PackageKitBackendFailure(e)
- else:
- raise PackageKitException(e)
- return wrapper
-
-class PackageKitDbusInterface:
-
- def __init__(self, interface, service, path):
- DBusGMainLoop(set_as_default=True)
- bus = dbus.SystemBus()
- try:
- pk = bus.get_object(service, path)
- self.pk_iface = dbus.Interface(pk, dbus_interface=interface)
- except dbus.exceptions.DBusException, e:
- if e.get_dbus_name() == "org.freedesktop.DBus.Error.ServiceUnknown":
- raise PackageKitNotStarted
- else:
- raise PackageKitException(e)
-
- bus.add_signal_receiver(self.catchall_signal_handler, interface_keyword='dbus_interface', member_keyword='member', dbus_interface=interface)
-
- def catchall_signal_handler(self, *args, **kwargs):
- raise NotImplementedError()
diff --git a/lib/python/packagekit/pkexceptions.py b/lib/python/packagekit/pkexceptions.py
deleted file mode 100644
index b444a23..0000000
--- a/lib/python/packagekit/pkexceptions.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Copyright (C) 2007
-# Tim Lauridsen <timlau at fedoraproject.org>
-# Tom Parker <palfrey at tevp.net>
-# Robin Norwood <rnorwood at redhat.com>
-
-import dbus
-
-class PackageKitException(Exception):
- def __init__(self, e=None):
- Exception.__init__(self)
- if e == None:
- self._pk_name = None
- self._full_str = None
- else:
- if not isinstance(e, dbus.exceptions.DBusException):
- raise Exception, "Can only handle DBusExceptions"
- self._pk_name = str(e.get_dbus_name())
- self._full_str = str(e)
-
- def get_backend_name(self):
- return self._pk_name
-
- def __str__(self):
- if self._full_str != None:
- return self._full_str
- else:
- return ""
-
-class PackageKitNotStarted(PackageKitException):
- pass
-
-class PackageKitAccessDenied(PackageKitException):
- pass
-
-class PackageKitTransactionFailure(PackageKitException):
- pass
-
-class PackageKitBackendFailure(PackageKitException):
- pass
-
-class PackageKitBackendNotLocked(PackageKitException):
- pass
diff --git a/lib/python/pk-frontend-test.py b/lib/python/pk-frontend-test.py
deleted file mode 100755
index 7916c3e..0000000
--- a/lib/python/pk-frontend-test.py
+++ /dev/null
@@ -1,166 +0,0 @@
-#!/usr/bin/python
-#
-# 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-# Copyright (C) 2007 Tom Parker <palfrey at tevp.net>
-
-# "pkt" python test program for PackageKit
-#
-# pkt serves both as a simple PackageKit client, and as an example user of the
-# PackageKit python API
-
-from sys import argv,exit
-from optparse import OptionParser
-from types import FunctionType
-
-from packagekit.frontend import *
-
-class pkt(PackageKit):
- def ProgressChanged(self,jid,percent, elapsed, remaining):
- print "Progress: %.2f%%"%percent, elapsed, remaining
-
- def JobStatus(self,jid,type):
- print "Job type: %s"%type
-
- def Package(self,jid,value,name,summary):
- print "Package: %s - %s"%(name,summary)
-
- def Details(self,jid,package_id,license,group,detail,url,size,file_list):
- print "Package: %s" % package_id
- print " %s" % url
- print " %s" % detail
- print " %s bytes" % size
- print " Files:"
- for file in file_list.split(";"):
- print " %s" % file
-
- def Transaction(self,jid,old_jid,timespec,succeeded,role,duration):
- success = "Failed"
- if succeeded:
- success = "Successful"
-
- print "Transaction: %s\n" % old_jid,
- print " %s" % role
- print " %s" % timespec
- print " %s seconds" % duration
- print " %s" % success
-
- def ErrorCode(self,
- jid, # Job ID
- error_code, # enumerated - see pk-enum.c in PackageKit source
- details # non-localized details
- ):
- print "Error (type is %s):"%error_code,details
-
-try:
- p = pkt()
-except PackageKitNotStarted:
- print "PackageKit doesn't appear to be started. You may need to enable dbus autostart"
- exit(1)
-
-def search(*args):
- patt = " ".join(args[0])
- if len(patt)==0:
- print "need something to search for"
- raise PackageKitTransactionFailure
- return p.SearchName(patt)
-
-def desc(*args):
- if len(args)!=1 or len(args[0])!=1:
- print "desc only takes single arg"
- raise PackageKitTransactionFailure
- return p.GetDetails(args[0][0])
-
-def depends(*args):
- if len(args)!=1 or len(args[0])!=1:
- print "depends only takes single arg"
- raise PackageKitTransactionFailure
- return p.GetDepends(args[0][0])
-
-def refresh_cache(*args):
- if len(args)>0 and len(args[0])>0:
- print "refresh_cache doesn't take args"
- raise PackageKitTransactionFailure
- return p.RefreshCache()
-
-def history(*args):
- count = 5
- if len(args)==1 and len(args[0])==1:
- count = args[0][0]
-
- count = int(count)
-
- if count < 1:
- print "history takes an integer (how many transactions to show)"
-
- return p.GetOldTransactions(count)
-
-def get_backend_detail(*args):
- details = p.GetBackendDetail()
- for d in details:
- print " %s" % d
-
- # Quit immediately because no job was scheduled
- exit(0)
-
-def get_actions(*args):
- details = p.GetActions().split(";")
- for d in details:
- print " %s" % d
-
- # Quit immediately because no job was scheduled
- exit(0)
-
-def get_missing_actions(*args):
- details = p.GetActions().split(";")
- for x in PackageKitEnum.role:
- if x not in details and x not in ["unknown"]:
- print " %s" % x
-
- # Quit immediately because no job was scheduled
- exit(0)
-
-def usage():
- print "Usage: %s <command> <options>"%argv[0]
- print "Valid commands are:"
- for k in globals().keys():
- if k in ["usage","catchall_signal_handler"]: #ignore
- continue
- g = globals()[k]
- if type(g) == FunctionType:
- print "\t%s"%k
- exit(1)
-
-parser = OptionParser()
-(options, args) = parser.parse_args()
-
-if len(args)==0:
- usage()
-
-if not globals().has_key(args[0]):
- print "Don't know operation '%s'"%args[0]
- usage()
-
-try:
- globals()[args[0]](args[1:])
-except PackageKitAccessDenied:
- print "You don't have sufficient permissions to access PackageKit (on the org.freedesktop.PackageKit dbus service)"
- exit(1)
-except PackageKitTransactionFailure:
- usage()
-
-p.run()
diff --git a/lib/python/wrapper-test.py b/lib/python/wrapper-test.py
deleted file mode 100755
index f3371d0..0000000
--- a/lib/python/wrapper-test.py
+++ /dev/null
@@ -1,140 +0,0 @@
-#!/usr/bin/python
-# 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-# Copyright (C) 2008
-# Tim Lauridsen <timlau at fedoraproject.org>
-
-import sys
-
-from packagekit.client import PackageKitClient
-from packagekit.enums import *
-
-def show_packages(pkit, pkgs, details=False, limit=None):
- i = 0
- for pkg in pkgs:
- i += 1
- if limit and i == limit:
- break
- show_package(pkg)
- if details:
- detail = pkit.GetDetails(pkg.id)
- print 79 *"-"
- print detail[0].detail
- print 79 *"="
-
-def show_package(pkg):
- if pkg:
- if isinstance(pkg, list):
- pkg = pkg[0]
- print pkg
- print pkg.summary
- else:
- print "no package found"
-
-if __name__ == '__main__':
- if len(sys.argv) > 1:
- cmd = sys.argv[1:]
- else:
- cmd = 'all'
-
- pk = PackageKitClient()
-
- if 'all' in cmd or "refresh-cache" in cmd:
- print '---- RefreshCache() -----'''
- pk.RefreshCache()
-
- if 'all' in cmd or "resolve" in cmd:
- print '---- Resolve() -----'
- pkg = pk.Resolve(FILTER_NONE, 'yum')
- show_package(pkg)
-
- if 'all' in cmd or "get-packages" in cmd:
- print '---- GetPackages() ----'
- packages = pk.GetPackages(FILTER_INSTALLED)
- show_packages(pk, packages, details=True, limit=20)
-
- if 'all' in cmd or "search-file" in cmd:
- print '---- SearchFile() ----'
- pkgs = pk.SearchFile(FILTER_INSTALLED,"/usr/bin/yum")
- show_packages(pk, pkgs)
-
- if 'all' in cmd or "get-updates" in cmd:
- print '---- GetUpdates() ----'
- pkgs = pk.GetUpdates(FILTER_INSTALLED)
- if pkgs: # We have updates
- for p in pkgs:
- print p.id
- print pk.GetUpdateDetail(p.id)
-
- if 'all' in cmd or "search-name" in cmd:
- print '---- SearchName() -----'
- show_package(pk.SearchName(FILTER_NOT_INSTALLED, 'coreutils'))
- show_package(pk.SearchName(FILTER_INSTALLED, 'coreutils'))
-
- if "search-group" in cmd:
- print '---- SearchGroup() -----'
- show_packages(pk, pk.SearchGroup(FILTER_NONE, GROUP_GAMES))
- show_packages(pk, pk.SearchGroup(FILTER_NONE, GROUP_COLLECTIONS))
-
- if "get-distro-upgrades" in cmd:
- print '---- GetDistroUpgrades() -----'
- rc = pk.GetDistroUpgrades()
- if rc:
- print rc
- else:
- print "No distribution upgrades"
-
-
- def cb(status, pct, spct, elem, rem, cancel):
- print 'install pkg: %s, %i%%, cancel allowed: %s' % \
- (status, pct, str(cancel))
- return True
- #return pc < 12
-
- if "updates-system" in cmd:
- print '---- UpdateSystem() ----'
- print pk.UpdateSystem()
-
- if "install-packages" in cmd:
- print '---- InstallPackages() -----'
- pkg = pk.Resolve(FILTER_NOT_INSTALLED, 'yumex')
- if pkg:
- print "Installing : %s " % pkg[0].id
- pk.InstallPackages(pkg[0].id, cb)
-
- if "remove-packages" in cmd:
- print '---- RemovePackages() -----'
- pkg = pk.Resolve(FILTER_INSTALLED, 'yumex')
- if pkg:
- print "Removing : %s " % pkg[0].id
- pk.RemovePackages(pkg[0].id, cb)
-
- if "download-packages" in cmd:
- print '---- DownloadPackages() -----'
- pkg = pk.Resolve(FILTER_NOT_INSTALLED, 'yumex')
- if pkg:
- print "Installing : %s " % pkg[0].id
- print pk.DownloadPackages(pkg[0].id)
-
- if "get-categories" in cmd:
- print '---- GetCategories() -----'
- cats = pk.GetCategories()
- for cat in cats:
- print cat.name
-
- pk.SuggestDaemonQuit()
-
commit d64808ce6d7b5bf7cd607619179539fdd7d760f0
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 12 17:09:12 2011 +0100
trivial: Post branch version bump
diff --git a/configure.ac b/configure.ac
index a12c36e..68d11e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,8 +2,8 @@
AC_PREREQ(2.63)
m4_define([pk_major_version], [0])
-m4_define([pk_minor_version], [6])
-m4_define([pk_micro_version], [17])
+m4_define([pk_minor_version], [7])
+m4_define([pk_micro_version], [0])
m4_define([pk_version],
[pk_major_version.pk_minor_version.pk_micro_version])
commit 0e5c2d88a4e9f955e491c950d7c35e222a1815bd
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 12 16:25:36 2011 +0100
trivial: Move PkProc to plugins/ since it's only used there
diff --git a/src/Makefile.am b/src/Makefile.am
index d69b851..535f23e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -57,8 +57,6 @@ shared_SOURCES = \
egg-dbus-monitor.h \
pk-marshal.c \
pk-marshal.h \
- pk-proc.c \
- pk-proc.h \
pk-dbus.c \
pk-dbus.h \
pk-transaction.c \
diff --git a/src/pk-proc.c b/src/pk-proc.c
deleted file mode 100644
index f715b5b..0000000
--- a/src/pk-proc.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2009 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <glib.h>
-
-#include "egg-string.h"
-
-#include "pk-proc.h"
-
-#define PK_PROC_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_PROC, PkProcPrivate))
-
-struct PkProcPrivate
-{
- GPtrArray *list_data;
-};
-
-G_DEFINE_TYPE (PkProc, pk_proc, G_TYPE_OBJECT)
-
-typedef struct {
- gchar *cmdline;
- guint pid;
- guint uid;
-} PkProcData;
-
-/**
- * pk_proc_data_free:
- **/
-static void
-pk_proc_data_free (PkProcData *proc)
-{
- g_free (proc->cmdline);
- g_free (proc);
-}
-
-/**
- * pk_proc_data_new:
- **/
-static PkProcData *
-pk_proc_data_new (const gchar *cmdline, guint pid, guint uid)
-{
- PkProcData *data;
- data = g_new0 (PkProcData, 1);
- data->pid = pid;
- data->uid = uid;
- data->cmdline = g_strdup (cmdline);
- return data;
-}
-
-/**
- * pk_proc_refresh_find_file:
- **/
-static gchar *
-pk_proc_refresh_find_file (const gchar *filename)
-{
- gchar *path;
- gboolean ret;
- guint i;
- const gchar *paths[] = { "/usr/bin", "/usr/sbin", "/bin", "/sbin", "/usr/libexec", "/usr/lib/vte/", NULL };
-
- /* try each one */
- for (i=0; paths[i] != NULL; i++) {
- path = g_build_filename (paths[i], filename, NULL);
- ret = g_file_test (path, G_FILE_TEST_IS_REGULAR);
- if (ret)
- goto out;
- g_free (path);
- }
-
- /* we failed */
- path = NULL;
-out:
- return path;
-}
-
-/**
- * pk_proc_refresh_add_file:
- **/
-static gboolean
-pk_proc_refresh_add_file (PkProc *proc, const gchar *pid_text, const gchar *path)
-{
- gboolean ret = FALSE;
- GError *error = NULL;
- gchar *cmdline = NULL;
- gint pid = -1;
- guint uid;
- PkProcData *data;
- gchar *cmdline_full = NULL;
- gchar *offset;
- gchar *uid_file = NULL;
- gchar *contents = NULL;
-
- /* get cmdline */
- ret = g_file_get_contents (path, &cmdline, NULL, &error);
- if (!ret) {
- g_warning ("failed to get cmdline: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* remove prelink junk */
- offset = g_strrstr (cmdline, ".#prelink#.");
- if (offset != NULL)
- *(offset) = '\0';
-
- /* remove added junk */
- g_strdelimit (cmdline, " \t:;", '\0');
-
- /* do we have anything left? */
- if (cmdline[0] == '\0') {
- ret = FALSE;
- goto out;
- }
-
- /* prepend path if it does not already exist */
- if (cmdline[0] == '/') {
- cmdline_full = g_strdup (cmdline);
- } else {
- cmdline_full = pk_proc_refresh_find_file (cmdline);
- if (cmdline_full == NULL) {
- g_debug ("cannot find in any bin dir: %s", cmdline);
- ret = FALSE;
- goto out;
- }
- }
-
- /* check if path exists */
- ret = g_file_test (cmdline_full, G_FILE_TEST_IS_REGULAR);
- if (!ret) {
- g_debug ("cmdline does not exist: %s", cmdline_full);
- goto out;
- }
-
- /* parse PID */
- ret = egg_strtoint (pid_text, &pid);
- if (!ret)
- goto out;
-
- /* get UID */
- uid_file = g_build_filename ("/proc", pid_text, "loginuid", NULL);
-
- /* is a process file */
- if (!g_file_test (uid_file, G_FILE_TEST_EXISTS))
- goto out;
-
- /* able to get contents */
- ret = g_file_get_contents (uid_file, &contents, 0, NULL);
- if (!ret)
- goto out;
-
- /* parse UID */
- ret = egg_strtouint (contents, &uid);
- if (!ret)
- goto out;
-
- /* add data to array */
- data = pk_proc_data_new (cmdline_full, pid, uid);
- g_ptr_array_add (proc->priv->list_data, data);
- g_debug ("adding %s pid:%i uid:%i", data->cmdline, data->pid, data->uid);
-out:
- g_free (cmdline_full);
- g_free (cmdline);
- g_free (contents);
- g_free (uid_file);
- return ret;
-}
-
-/**
- * pk_proc_refresh:
- **/
-gboolean
-pk_proc_refresh (PkProc *proc)
-{
- gboolean ret = FALSE;
- GError *error = NULL;
- GDir *dir;
- const gchar *filename;
- gchar *path;
-
- g_return_val_if_fail (PK_IS_PROC (proc), FALSE);
-
- /* open directory */
- dir = g_dir_open ("/proc", 0, &error);
- if (dir == NULL) {
- g_warning ("failed to open directory: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* clear */
- g_ptr_array_set_size (proc->priv->list_data, 0);
-
- /* find all files */
- filename = g_dir_read_name (dir);
- while (filename != NULL) {
- /* this is Linux specific, but #ifdef code welcome */
- path = g_build_filename ("/proc", filename, "cmdline", NULL);
-
- /* only process files that exist */
- ret = g_file_test (path, G_FILE_TEST_IS_REGULAR);
- if (ret)
- pk_proc_refresh_add_file (proc, filename, path);
-
- /* get next entry */
- filename = g_dir_read_name (dir);
- g_free (path);
- }
-
- /* success */
- ret = TRUE;
-
-out:
- if (dir != NULL)
- g_dir_close (dir);
- return ret;
-}
-
-/**
- * pk_proc_find_exec:
- **/
-gboolean
-pk_proc_find_exec (PkProc *proc, const gchar *filename)
-{
- guint j;
- gboolean ret = FALSE;
- GPtrArray *list_data;
- const PkProcData *data;
-
- g_return_val_if_fail (PK_IS_PROC (proc), FALSE);
-
- /* setup state */
- list_data = proc->priv->list_data;
-
- /* find executable that matches the pattern */
- for (j=0; j < list_data->len; j++) {
- data = g_ptr_array_index (list_data, j);
- ret = g_pattern_match_simple (filename, data->cmdline);
- if (ret)
- break;
- }
-
- return ret;
-}
-
-/**
- * pk_proc_find_execs:
- **/
-gboolean
-pk_proc_find_execs (PkProc *proc, gchar **filenames)
-{
- guint i;
- gboolean ret = FALSE;
-
- g_return_val_if_fail (PK_IS_PROC (proc), FALSE);
-
- /* find executable that matches the pattern */
- for (i=0; filenames[i] != NULL; i++) {
- ret = pk_proc_find_exec (proc, filenames[i]);
- if (ret)
- break;
- }
-
- return ret;
-}
-
-/**
- * pk_proc_finalize:
- **/
-static void
-pk_proc_finalize (GObject *object)
-{
- PkProc *proc;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (PK_IS_PROC (object));
- proc = PK_PROC (object);
-
- g_ptr_array_unref (proc->priv->list_data);
-
- G_OBJECT_CLASS (pk_proc_parent_class)->finalize (object);
-}
-
-/**
- * pk_proc_class_init:
- **/
-static void
-pk_proc_class_init (PkProcClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = pk_proc_finalize;
- g_type_class_add_private (klass, sizeof (PkProcPrivate));
-}
-
-/**
- * pk_proc_init:
- *
- * initializes the proc class. NOTE: We expect proc objects
- * to *NOT* be removed or added during the session.
- * We only control the first proc object if there are more than one.
- **/
-static void
-pk_proc_init (PkProc *proc)
-{
- proc->priv = PK_PROC_GET_PRIVATE (proc);
- proc->priv->list_data = g_ptr_array_new_with_free_func ((GDestroyNotify) pk_proc_data_free);
-}
-
-/**
- * pk_proc_new:
- * Return value: A new proc class instance.
- **/
-PkProc *
-pk_proc_new (void)
-{
- PkProc *proc;
- proc = g_object_new (PK_TYPE_PROC, NULL);
- return PK_PROC (proc);
-}
-
diff --git a/src/pk-proc.h b/src/pk-proc.h
deleted file mode 100644
index 9bb7f42..0000000
--- a/src/pk-proc.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2009 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PK_PROC_H
-#define __PK_PROC_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define PK_TYPE_PROC (pk_proc_get_type ())
-#define PK_PROC(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_PROC, PkProc))
-#define PK_PROC_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_PROC, PkProcClass))
-#define PK_IS_PROC(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_PROC))
-#define PK_IS_PROC_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_PROC))
-#define PK_PROC_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_PROC, PkProcClass))
-
-typedef struct PkProcPrivate PkProcPrivate;
-
-typedef struct
-{
- GObject parent;
- PkProcPrivate *priv;
-} PkProc;
-
-typedef struct
-{
- GObjectClass parent_class;
-} PkProcClass;
-
-GType pk_proc_get_type (void);
-PkProc *pk_proc_new (void);
-
-gboolean pk_proc_refresh (PkProc *proc);
-gchar *pk_proc_get_process_for_cmdlines (PkProc *proc,
- gchar **filenames);
-gboolean pk_proc_find_execs (PkProc *proc,
- gchar **filenames);
-gboolean pk_proc_find_exec (PkProc *proc,
- const gchar *filename);
-
-G_END_DECLS
-
-#endif /* __PK_PROC_H */
-
diff --git a/src/pk-self-test.c b/src/pk-self-test.c
index 765d791..d481081 100644
--- a/src/pk-self-test.c
+++ b/src/pk-self-test.c
@@ -34,7 +34,6 @@
#include "pk-file-monitor.h"
#include "pk-inhibit.h"
#include "pk-notify.h"
-#include "pk-proc.h"
#include "pk-spawn.h"
#include "pk-store.h"
#include "pk-syslog.h"
@@ -834,23 +833,6 @@ pk_test_notify_func (void)
g_object_unref (notify);
}
-static void
-pk_test_proc_func (void)
-{
- gboolean ret;
- PkProc *proc;
-// gchar *files[] = { "/sbin/udevd", NULL };
-
- proc = pk_proc_new ();
- g_assert (proc != NULL);
-
- /* refresh proc data */
- ret = pk_proc_refresh (proc);
- g_assert (ret);
-
- g_object_unref (proc);
-}
-
PkSpawnExitType mexit = PK_SPAWN_EXIT_TYPE_UNKNOWN;
guint stdout_count = 0;
guint finished_count = 0;
@@ -1796,7 +1778,6 @@ main (int argc, char **argv)
/* components */
g_test_add_func ("/packagekit/notify", pk_test_proc_func);
- g_test_add_func ("/packagekit/proc", pk_test_proc_func);
g_test_add_func ("/packagekit/file-monitor", pk_test_file_monitor_func);
g_test_add_func ("/packagekit/time", pk_test_time_func);
g_test_add_func ("/packagekit/dbus", pk_test_dbus_func);
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index 99bfff6..79ee111 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -31,7 +31,9 @@ check_PROGRAMS = \
pk_self_test_SOURCES = \
pk-self-test.c \
pk-lsof.h \
- pk-lsof.c
+ pk-lsof.c \
+ pk-proc.c \
+ pk-proc.h
pk_self_test_LDADD = \
$(GLIB_LIBS) \
@@ -82,7 +84,10 @@ libpk_plugin_update_package_list_la_LIBADD = $(PK_PLUGIN_LIBS)
libpk_plugin_update_package_list_la_LDFLAGS = -module -avoid-version
libpk_plugin_update_package_list_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
-libpk_plugin_no_update_process_la_SOURCES = pk-plugin-no-update-process.c
+libpk_plugin_no_update_process_la_SOURCES = \
+ pk-plugin-no-update-process.c \
+ pk-proc.c \
+ pk-proc.h
libpk_plugin_no_update_process_la_LIBADD = $(PK_PLUGIN_LIBS)
libpk_plugin_no_update_process_la_LDFLAGS = -module -avoid-version
libpk_plugin_no_update_process_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
@@ -92,7 +97,10 @@ libpk_plugin_scan_desktop_files_la_LIBADD = $(PK_PLUGIN_LIBS)
libpk_plugin_scan_desktop_files_la_LDFLAGS = -module -avoid-version
libpk_plugin_scan_desktop_files_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
-libpk_plugin_update_check_processes_la_SOURCES = pk-plugin-update-check-processes.c
+libpk_plugin_update_check_processes_la_SOURCES = \
+ pk-plugin-update-check-processes.c \
+ pk-proc.c \
+ pk-proc.h
libpk_plugin_update_check_processes_la_LIBADD = $(PK_PLUGIN_LIBS)
libpk_plugin_update_check_processes_la_LDFLAGS = -module -avoid-version
libpk_plugin_update_check_processes_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
diff --git a/src/plugins/pk-proc.c b/src/plugins/pk-proc.c
new file mode 100644
index 0000000..fe12cf9
--- /dev/null
+++ b/src/plugins/pk-proc.c
@@ -0,0 +1,362 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2009 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <glib.h>
+
+#include "pk-proc.h"
+
+#define PK_PROC_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_PROC, PkProcPrivate))
+
+struct PkProcPrivate
+{
+ GPtrArray *list_data;
+};
+
+G_DEFINE_TYPE (PkProc, pk_proc, G_TYPE_OBJECT)
+
+typedef struct {
+ gchar *cmdline;
+ guint pid;
+ guint uid;
+} PkProcData;
+
+/**
+ * pk_proc_data_free:
+ **/
+static void
+pk_proc_data_free (PkProcData *proc)
+{
+ g_free (proc->cmdline);
+ g_free (proc);
+}
+
+/**
+ * pk_proc_data_new:
+ **/
+static PkProcData *
+pk_proc_data_new (const gchar *cmdline, guint pid, guint uid)
+{
+ PkProcData *data;
+ data = g_new0 (PkProcData, 1);
+ data->pid = pid;
+ data->uid = uid;
+ data->cmdline = g_strdup (cmdline);
+ return data;
+}
+
+/**
+ * pk_proc_refresh_find_file:
+ **/
+static gchar *
+pk_proc_refresh_find_file (const gchar *filename)
+{
+ gchar *path;
+ gboolean ret;
+ guint i;
+ const gchar *paths[] = { "/usr/bin", "/usr/sbin", "/bin", "/sbin", "/usr/libexec", "/usr/lib/vte/", NULL };
+
+ /* try each one */
+ for (i=0; paths[i] != NULL; i++) {
+ path = g_build_filename (paths[i], filename, NULL);
+ ret = g_file_test (path, G_FILE_TEST_IS_REGULAR);
+ if (ret)
+ goto out;
+ g_free (path);
+ }
+
+ /* we failed */
+ path = NULL;
+out:
+ return path;
+}
+
+/**
+ * egg_strtoint:
+ **/
+static gboolean
+egg_strtoint (const gchar *text, gint *value)
+{
+ gchar *endptr = NULL;
+ gint64 value_raw;
+
+ value_raw = g_ascii_strtoll (text, &endptr, 10);
+ if (endptr == text)
+ return FALSE;
+
+ /* out of range */
+ if (value_raw > G_MAXINT || value_raw < G_MININT)
+ return FALSE;
+
+ /* cast back down to value */
+ *value = (gint) value_raw;
+ return TRUE;
+}
+
+/**
+ * pk_proc_refresh_add_file:
+ **/
+static gboolean
+pk_proc_refresh_add_file (PkProc *proc, const gchar *pid_text, const gchar *path)
+{
+ gboolean ret = FALSE;
+ GError *error = NULL;
+ gchar *cmdline = NULL;
+ gint pid = -1;
+ gint uid;
+ PkProcData *data;
+ gchar *cmdline_full = NULL;
+ gchar *offset;
+ gchar *uid_file = NULL;
+ gchar *contents = NULL;
+
+ /* get cmdline */
+ ret = g_file_get_contents (path, &cmdline, NULL, &error);
+ if (!ret) {
+ g_warning ("failed to get cmdline: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* remove prelink junk */
+ offset = g_strrstr (cmdline, ".#prelink#.");
+ if (offset != NULL)
+ *(offset) = '\0';
+
+ /* remove added junk */
+ g_strdelimit (cmdline, " \t:;", '\0');
+
+ /* do we have anything left? */
+ if (cmdline[0] == '\0') {
+ ret = FALSE;
+ goto out;
+ }
+
+ /* prepend path if it does not already exist */
+ if (cmdline[0] == '/') {
+ cmdline_full = g_strdup (cmdline);
+ } else {
+ cmdline_full = pk_proc_refresh_find_file (cmdline);
+ if (cmdline_full == NULL) {
+ g_debug ("cannot find in any bin dir: %s", cmdline);
+ ret = FALSE;
+ goto out;
+ }
+ }
+
+ /* check if path exists */
+ ret = g_file_test (cmdline_full, G_FILE_TEST_IS_REGULAR);
+ if (!ret) {
+ g_debug ("cmdline does not exist: %s", cmdline_full);
+ goto out;
+ }
+
+ /* parse PID */
+ ret = egg_strtoint (pid_text, &pid);
+ if (!ret)
+ goto out;
+
+ /* get UID */
+ uid_file = g_build_filename ("/proc", pid_text, "loginuid", NULL);
+
+ /* is a process file */
+ if (!g_file_test (uid_file, G_FILE_TEST_EXISTS))
+ goto out;
+
+ /* able to get contents */
+ ret = g_file_get_contents (uid_file, &contents, 0, NULL);
+ if (!ret)
+ goto out;
+
+ /* parse UID */
+ ret = egg_strtoint (contents, &uid);
+ if (!ret)
+ goto out;
+
+ /* add data to array */
+ data = pk_proc_data_new (cmdline_full, pid, uid);
+ g_ptr_array_add (proc->priv->list_data, data);
+ g_debug ("adding %s pid:%i uid:%i", data->cmdline, data->pid, data->uid);
+out:
+ g_free (cmdline_full);
+ g_free (cmdline);
+ g_free (contents);
+ g_free (uid_file);
+ return ret;
+}
+
+/**
+ * pk_proc_refresh:
+ **/
+gboolean
+pk_proc_refresh (PkProc *proc)
+{
+ gboolean ret = FALSE;
+ GError *error = NULL;
+ GDir *dir;
+ const gchar *filename;
+ gchar *path;
+
+ g_return_val_if_fail (PK_IS_PROC (proc), FALSE);
+
+ /* open directory */
+ dir = g_dir_open ("/proc", 0, &error);
+ if (dir == NULL) {
+ g_warning ("failed to open directory: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* clear */
+ g_ptr_array_set_size (proc->priv->list_data, 0);
+
+ /* find all files */
+ filename = g_dir_read_name (dir);
+ while (filename != NULL) {
+ /* this is Linux specific, but #ifdef code welcome */
+ path = g_build_filename ("/proc", filename, "cmdline", NULL);
+
+ /* only process files that exist */
+ ret = g_file_test (path, G_FILE_TEST_IS_REGULAR);
+ if (ret)
+ pk_proc_refresh_add_file (proc, filename, path);
+
+ /* get next entry */
+ filename = g_dir_read_name (dir);
+ g_free (path);
+ }
+
+ /* success */
+ ret = TRUE;
+
+out:
+ if (dir != NULL)
+ g_dir_close (dir);
+ return ret;
+}
+
+/**
+ * pk_proc_find_exec:
+ **/
+gboolean
+pk_proc_find_exec (PkProc *proc, const gchar *filename)
+{
+ guint j;
+ gboolean ret = FALSE;
+ GPtrArray *list_data;
+ const PkProcData *data;
+
+ g_return_val_if_fail (PK_IS_PROC (proc), FALSE);
+
+ /* setup state */
+ list_data = proc->priv->list_data;
+
+ /* find executable that matches the pattern */
+ for (j=0; j < list_data->len; j++) {
+ data = g_ptr_array_index (list_data, j);
+ ret = g_pattern_match_simple (filename, data->cmdline);
+ if (ret)
+ break;
+ }
+
+ return ret;
+}
+
+/**
+ * pk_proc_find_execs:
+ **/
+gboolean
+pk_proc_find_execs (PkProc *proc, gchar **filenames)
+{
+ guint i;
+ gboolean ret = FALSE;
+
+ g_return_val_if_fail (PK_IS_PROC (proc), FALSE);
+
+ /* find executable that matches the pattern */
+ for (i=0; filenames[i] != NULL; i++) {
+ ret = pk_proc_find_exec (proc, filenames[i]);
+ if (ret)
+ break;
+ }
+
+ return ret;
+}
+
+/**
+ * pk_proc_finalize:
+ **/
+static void
+pk_proc_finalize (GObject *object)
+{
+ PkProc *proc;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (PK_IS_PROC (object));
+ proc = PK_PROC (object);
+
+ g_ptr_array_unref (proc->priv->list_data);
+
+ G_OBJECT_CLASS (pk_proc_parent_class)->finalize (object);
+}
+
+/**
+ * pk_proc_class_init:
+ **/
+static void
+pk_proc_class_init (PkProcClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = pk_proc_finalize;
+ g_type_class_add_private (klass, sizeof (PkProcPrivate));
+}
+
+/**
+ * pk_proc_init:
+ *
+ * initializes the proc class. NOTE: We expect proc objects
+ * to *NOT* be removed or added during the session.
+ * We only control the first proc object if there are more than one.
+ **/
+static void
+pk_proc_init (PkProc *proc)
+{
+ proc->priv = PK_PROC_GET_PRIVATE (proc);
+ proc->priv->list_data = g_ptr_array_new_with_free_func ((GDestroyNotify) pk_proc_data_free);
+}
+
+/**
+ * pk_proc_new:
+ * Return value: A new proc class instance.
+ **/
+PkProc *
+pk_proc_new (void)
+{
+ PkProc *proc;
+ proc = g_object_new (PK_TYPE_PROC, NULL);
+ return PK_PROC (proc);
+}
+
diff --git a/src/plugins/pk-proc.h b/src/plugins/pk-proc.h
new file mode 100644
index 0000000..9bb7f42
--- /dev/null
+++ b/src/plugins/pk-proc.h
@@ -0,0 +1,63 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2009 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __PK_PROC_H
+#define __PK_PROC_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define PK_TYPE_PROC (pk_proc_get_type ())
+#define PK_PROC(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_PROC, PkProc))
+#define PK_PROC_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_PROC, PkProcClass))
+#define PK_IS_PROC(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_PROC))
+#define PK_IS_PROC_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_PROC))
+#define PK_PROC_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_PROC, PkProcClass))
+
+typedef struct PkProcPrivate PkProcPrivate;
+
+typedef struct
+{
+ GObject parent;
+ PkProcPrivate *priv;
+} PkProc;
+
+typedef struct
+{
+ GObjectClass parent_class;
+} PkProcClass;
+
+GType pk_proc_get_type (void);
+PkProc *pk_proc_new (void);
+
+gboolean pk_proc_refresh (PkProc *proc);
+gchar *pk_proc_get_process_for_cmdlines (PkProc *proc,
+ gchar **filenames);
+gboolean pk_proc_find_execs (PkProc *proc,
+ gchar **filenames);
+gboolean pk_proc_find_exec (PkProc *proc,
+ const gchar *filename);
+
+G_END_DECLS
+
+#endif /* __PK_PROC_H */
+
diff --git a/src/plugins/pk-self-test.c b/src/plugins/pk-self-test.c
index a336cab..aaa9c0b 100644
--- a/src/plugins/pk-self-test.c
+++ b/src/plugins/pk-self-test.c
@@ -26,6 +26,7 @@
#include <glib/gstdio.h>
#include "pk-lsof.h"
+#include "pk-proc.h"
static void
pk_test_lsof_get_files_for_directory (GPtrArray *files, const gchar *dirname)
@@ -88,6 +89,23 @@ pk_test_lsof_func (void)
g_object_unref (lsof);
}
+static void
+pk_test_proc_func (void)
+{
+ gboolean ret;
+ PkProc *proc;
+// gchar *files[] = { "/sbin/udevd", NULL };
+
+ proc = pk_proc_new ();
+ g_assert (proc != NULL);
+
+ /* refresh proc data */
+ ret = pk_proc_refresh (proc);
+ g_assert (ret);
+
+ g_object_unref (proc);
+}
+
int
main (int argc, char **argv)
{
@@ -97,6 +115,7 @@ main (int argc, char **argv)
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/plugins/lsof", pk_test_lsof_func);
+ g_test_add_func ("/plugins/proc", pk_test_proc_func);
return g_test_run ();
}
commit c338669ba8e6cb4a7645f89e6ff65b155bd8c55d
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 12 15:57:37 2011 +0100
yum: Add a document detailing the yum API we're using
This might help avoid security bugs in the future if the yum guys know what
we're using.
diff --git a/backends/yum/yum-api-search.txt b/backends/yum/yum-api-search.txt
new file mode 100644
index 0000000..efd50cd
--- /dev/null
+++ b/backends/yum/yum-api-search.txt
@@ -0,0 +1,87 @@
+== PROPERTIES ===
+
+yb.comps.categories
+yb.comps._categories[cat_id]
+yb.comps.compscount
+yb.comps.groups:
+yb.conf.cache = 1
+yb.conf.exactarchlist
+yb.conf.exclude
+yb.conf.gpgcheck = 0
+yb.conf.localpkg_gpgcheck
+yb.conf.skip_broken
+yb.conf.throttle
+yb.conf.yumvar['releasever']
+yb.missingGPGKey
+yb.pkgSack
+yb.rpmdb
+yb.rpmdb.auto_close
+yb.tsInfo
+yb._tsInfo
+yb.tsInfo.pkgSack
+yb.up
+
+=== METHODS ===
+
+rpmdb.searchNevra(name=pkg.name)
+yb.allowedMultipleInstalls(pkg)
+yb.buildTransaction()
+yb._checkSignatures([po], None)
+yb.closeRpmDB()
+yb.comps._categories.has_key(cat_id):
+yb.comps.has_group(x)
+yb.comps.return_group(grp_id)
+yb.deselectGroup(grp.groupid)
+yb.doConfigSetup(errorlevel=0, debuglevel=0)
+yb.doGroupSetup()
+yb.doLock(foo)
+yb.doPackageLists(pkgnarrow='obsoletes')
+yb.doPackageLists(pkgnarrow='recent')
+yb.doPackageLists(pkgnarrow='updates')
+yb.doUnlock(foo)
+yb.findDeps(pkgs)
+yb.getKeyForPackage(pkg, askcb = lambda x, y, z: True)
+yb.getKeyForRepo(repo, callback = lambda x: True)
+yb.groupRemove(grp.groupid)
+yb.groupUnremove(grp.groupid)
+yb.installLocal(inst_file)
+yb.install(po=pkg)
+yb._media_find_root(repo.mediaid)
+yb.pkgSack.returnNewestByName(name=package)
+yb.pkgSack.searchFiles(value)
+yb.pkgSack.searchNames(names=name_list)
+yb.pkgSack.searchNevra(n, e, v, r, a)
+yb.pkgSack.searchProvides(provide)
+yb.processTransaction()
+yb.remove(po=pkg)
+yb.repos.disableRepo(repo.id)
+yb.repos.doSetup(thisrepo=repoid)
+yb.repos.findRepos(repo)
+yb.repos.getRepo(pkg_download.repoid)
+yb.repos.getRepo(pkg.repoid)
+yb.repos.getRepo(repoid)
+yb.repos.listEnabled()
+yb.repos.populateSack(repo)
+yb.repos.populateSack(which=[repo.id], mdtype='filelists', cacheonly=1)
+yb.repos.populateSack(which=[repo.id], mdtype='metadata', cacheonly=1)
+yb.repos.repos.values()
+yb.repos.setProgressBar()
+yb.rpmdb.installed(po=pkg)
+yb.rpmdb.searchFiles(value)
+yb.rpmdb.searchNevra(name=n, epoch=e, ver=v, arch=a)
+yb.rpmdb.searchNevra(name=n, epoch=e, ver=v, rel=r, arch=a)
+yb.rpmdb.searchNevra(name=package)
+yb.rpmdb.searchNevra(name=pkg.name)
+yb.rpmdb.searchNevra(name=pkg.name, arch=pkg.arch)
+yb.rpmdb.searchNevra(name=pkg.name, epoch=e, ver=v, rel=r, arch=a)
+yb.rpmdb.searchPkgTuple(installed)[0]
+yb.rpmdb.searchProvides(provide)
+yb.searchGenerator(searchlist, values)
+yb.selectGroup(grp.groupid)
+yb.update()
+yb.update(po=pkg)
+yb.up.doObsoletes()
+yb.up.getObsoletesTuples(newest=1)
+yb.up.getUpdatesTuples()
+YumLocalPackage(ts=yb.rpmdb.readOnlyTS(), filename=inst_file)
+yum.misc.find_unfinished_transactions(yumlibpath=foo)
commit 5456681c29753439766700f5dc431a4a1cf72a2e
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 12 14:37:32 2011 +0100
Actually use the value from /etc/login.defs
diff --git a/src/plugins/pk-plugin-check-shared-libraries-in-use.c b/src/plugins/pk-plugin-check-shared-libraries-in-use.c
index 4b42c7d..943adfc 100644
--- a/src/plugins/pk-plugin-check-shared-libraries-in-use.c
+++ b/src/plugins/pk-plugin-check-shared-libraries-in-use.c
@@ -524,7 +524,7 @@ pk_plugin_transaction_finished_results (PkPlugin *plugin,
cmdline_full = g_strdup_printf ("/usr/bin/%s", cmdline);
g_debug ("pid=%i: %s (%i)", pid, cmdline_full, uid);
- if (uid < 500)
+ if (uid < (gint)uid_min)
g_ptr_array_add (files_system, cmdline_full);
else
g_ptr_array_add (files_session, cmdline_full);
commit a04c976ad294f79ae8221f71493d39d6d905e535
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 12 14:25:10 2011 +0100
trivial: Use the PkBackend in the PkPlugin structure
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 71bc5cb..a1f5839 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -876,16 +876,6 @@ pk_transaction_get_conf (PkTransaction *transaction)
}
/**
- * pk_transaction_get_backend:
- **/
-PkBackend *
-pk_transaction_get_backend (PkTransaction *transaction)
-{
- g_return_val_if_fail (PK_IS_TRANSACTION (transaction), NULL);
- return transaction->priv->backend;
-}
-
-/**
* pk_transaction_get_results:
**/
PkResults *
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index ce8f218..ddff2fa 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -77,7 +77,6 @@ gboolean pk_transaction_run (PkTransaction *transaction)
void pk_transaction_cancel_bg (PkTransaction *transaction);
PkRoleEnum pk_transaction_get_role (PkTransaction *transaction);
PkConf *pk_transaction_get_conf (PkTransaction *transaction);
-PkBackend *pk_transaction_get_backend (PkTransaction *transaction);
PkResults *pk_transaction_get_results (PkTransaction *transaction);
gchar **pk_transaction_get_package_ids (PkTransaction *transaction);
void pk_transaction_set_package_ids (PkTransaction *transaction,
diff --git a/src/plugins/pk-plugin-check-shared-libraries-in-use.c b/src/plugins/pk-plugin-check-shared-libraries-in-use.c
index 53de322..4b42c7d 100644
--- a/src/plugins/pk-plugin-check-shared-libraries-in-use.c
+++ b/src/plugins/pk-plugin-check-shared-libraries-in-use.c
@@ -100,14 +100,12 @@ pk_plugin_get_installed_package_for_file (PkPlugin *plugin,
{
PkPackage *package = NULL;
gchar **filenames;
- PkBackend *backend;
/* use PK to find the correct package */
g_ptr_array_set_size (plugin->priv->list, 0);
- backend = pk_transaction_get_backend (transaction);
- pk_backend_reset (backend);
+ pk_backend_reset (plugin->backend);
filenames = g_strsplit (filename, "|||", -1);
- pk_backend_search_files (backend,
+ pk_backend_search_files (plugin->backend,
pk_bitfield_value (PK_FILTER_ENUM_INSTALLED),
filenames);
@@ -286,7 +284,6 @@ pk_plugin_transaction_run (PkPlugin *plugin,
guint length = 0;
guint files_id = 0;
guint finished_id = 0;
- PkBackend *backend = NULL;
PkConf *conf;
PkInfoEnum info;
PkPackage *item;
@@ -308,15 +305,14 @@ pk_plugin_transaction_run (PkPlugin *plugin,
goto out;
/* check we can do the action */
- backend = pk_transaction_get_backend (transaction);
- if (!pk_backend_is_implemented (backend,
+ if (!pk_backend_is_implemented (plugin->backend,
PK_ROLE_ENUM_GET_FILES)) {
g_debug ("cannot get files");
goto out;
}
- files_id = g_signal_connect (backend, "files",
+ files_id = g_signal_connect (plugin->backend, "files",
G_CALLBACK (pk_plugin_files_cb), plugin);
- finished_id = g_signal_connect (backend, "finished",
+ finished_id = g_signal_connect (plugin->backend, "finished",
G_CALLBACK (pk_plugin_finished_cb), plugin);
/* do we have a cache */
@@ -393,8 +389,8 @@ pk_plugin_transaction_run (PkPlugin *plugin,
}
/* set status */
- pk_backend_set_status (backend, PK_STATUS_ENUM_SCAN_PROCESS_LIST);
- pk_backend_set_percentage (backend, 101);
+ pk_backend_set_status (plugin->backend, PK_STATUS_ENUM_SCAN_PROCESS_LIST);
+ pk_backend_set_percentage (plugin->backend, 101);
/* get list from lsof */
ret = pk_lsof_refresh (plugin->priv->lsof);
@@ -404,9 +400,10 @@ pk_plugin_transaction_run (PkPlugin *plugin,
}
/* get all the files touched in the packages we just updated */
- pk_backend_reset (backend);
- pk_backend_set_status (backend, PK_STATUS_ENUM_CHECK_LIBRARIES);
- pk_backend_get_files (backend, package_ids_security);
+ pk_backend_reset (plugin->backend);
+ pk_backend_set_status (plugin->backend,
+ PK_STATUS_ENUM_CHECK_LIBRARIES);
+ pk_backend_get_files (plugin->backend, package_ids_security);
/* wait for finished */
g_main_loop_run (plugin->priv->loop);
@@ -434,14 +431,12 @@ pk_plugin_transaction_run (PkPlugin *plugin,
}
/* don't emit until we've run the transaction and it's success */
- pk_backend_set_percentage (backend, 100);
+ pk_backend_set_percentage (plugin->backend, 100);
out:
- if (backend != NULL) {
- if (files_id > 0)
- g_signal_handler_disconnect (backend, files_id);
- if (finished_id > 0)
- g_signal_handler_disconnect (backend, finished_id);
- }
+ if (files_id > 0)
+ g_signal_handler_disconnect (plugin->backend, files_id);
+ if (finished_id > 0)
+ g_signal_handler_disconnect (plugin->backend, finished_id);
g_strfreev (files);
if (updates != NULL)
g_ptr_array_unref (updates);
@@ -458,7 +453,6 @@ pk_plugin_transaction_finished_results (PkPlugin *plugin,
PkTransaction *transaction)
{
gboolean ret;
- PkBackend *backend = NULL;
PkConf *conf;
PkRoleEnum role;
gint uid;
@@ -485,8 +479,7 @@ pk_plugin_transaction_finished_results (PkPlugin *plugin,
goto out;
/* check we can do the action */
- backend = pk_transaction_get_backend (transaction);
- if (!pk_backend_is_implemented (backend,
+ if (!pk_backend_is_implemented (plugin->backend,
PK_ROLE_ENUM_GET_PACKAGES)) {
g_debug ("cannot get packages");
goto out;
@@ -502,7 +495,8 @@ pk_plugin_transaction_finished_results (PkPlugin *plugin,
goto out;
/* set status */
- pk_backend_set_status (backend, PK_STATUS_ENUM_CHECK_LIBRARIES);
+ pk_backend_set_status (plugin->backend,
+ PK_STATUS_ENUM_CHECK_LIBRARIES);
/* get user UID range */
uid_min = pk_plugin_get_uid_min ();
@@ -554,7 +548,7 @@ pk_plugin_transaction_finished_results (PkPlugin *plugin,
g_debug ("failed to find package for %s", filename);
continue;
}
- pk_backend_require_restart (backend,
+ pk_backend_require_restart (plugin->backend,
PK_RESTART_ENUM_SECURITY_SESSION,
pk_package_get_id (package));
}
@@ -570,7 +564,9 @@ pk_plugin_transaction_finished_results (PkPlugin *plugin,
g_debug ("failed to find package for %s", filename);
continue;
}
- pk_backend_require_restart (backend, PK_RESTART_ENUM_SECURITY_SYSTEM, pk_package_get_id (package));
+ pk_backend_require_restart (plugin->backend,
+ PK_RESTART_ENUM_SECURITY_SYSTEM,
+ pk_package_get_id (package));
}
out:
if (files_session != NULL)
diff --git a/src/plugins/pk-plugin-example.c b/src/plugins/pk-plugin-example.c
index 7e35152..ce2e7e5 100644
--- a/src/plugins/pk-plugin-example.c
+++ b/src/plugins/pk-plugin-example.c
@@ -64,7 +64,6 @@ pk_plugin_transaction_run (PkPlugin *plugin,
PkTransaction *transaction)
{
gboolean ret;
- PkBackend *backend = NULL;
PkConf *conf;
PkRoleEnum role;
@@ -80,8 +79,7 @@ pk_plugin_transaction_run (PkPlugin *plugin,
goto out;
/* check we can do the action */
- backend = pk_transaction_get_backend (transaction);
- if (!pk_backend_is_implemented (backend,
+ if (!pk_backend_is_implemented (plugin->backend,
PK_ROLE_ENUM_GET_PACKAGES)) {
g_debug ("cannot get packages");
goto out;
diff --git a/src/plugins/pk-plugin-no-update-process.c b/src/plugins/pk-plugin-no-update-process.c
index 95db2e9..b3d2e72 100644
--- a/src/plugins/pk-plugin-no-update-process.c
+++ b/src/plugins/pk-plugin-no-update-process.c
@@ -163,7 +163,6 @@ pk_plugin_transaction_run (PkPlugin *plugin,
gchar *process = NULL;
guint files_id = 0;
guint finished_id = 0;
- PkBackend *backend = NULL;
PkConf *conf;
PkRoleEnum role;
@@ -173,8 +172,7 @@ pk_plugin_transaction_run (PkPlugin *plugin,
goto out;
/* check we can do the action */
- backend = pk_transaction_get_backend (transaction);
- if (!pk_backend_is_implemented (backend,
+ if (!pk_backend_is_implemented (plugin->backend,
PK_ROLE_ENUM_GET_FILES)) {
g_debug ("cannot get files");
goto out;
@@ -197,8 +195,9 @@ pk_plugin_transaction_run (PkPlugin *plugin,
g_ptr_array_set_size (plugin->priv->files_list, 0);
/* set status */
- pk_backend_set_status (backend, PK_STATUS_ENUM_SCAN_PROCESS_LIST);
- pk_backend_set_percentage (backend, 101);
+ pk_backend_set_status (plugin->backend,
+ PK_STATUS_ENUM_SCAN_PROCESS_LIST);
+ pk_backend_set_percentage (plugin->backend, 101);
/* get list from proc */
ret = pk_proc_refresh (plugin->priv->proc);
@@ -209,35 +208,36 @@ pk_plugin_transaction_run (PkPlugin *plugin,
}
/* set status */
- pk_backend_set_status (backend, PK_STATUS_ENUM_CHECK_EXECUTABLE_FILES);
+ pk_backend_set_status (plugin->backend,
+ PK_STATUS_ENUM_CHECK_EXECUTABLE_FILES);
- files_id = g_signal_connect (backend, "files",
+ files_id = g_signal_connect (plugin->backend, "files",
G_CALLBACK (pk_plugin_files_cb), plugin);
- finished_id = g_signal_connect (backend, "finished",
+ finished_id = g_signal_connect (plugin->backend, "finished",
G_CALLBACK (pk_plugin_finished_cb), plugin);
/* get all the files touched in the packages we just updated */
package_ids = pk_transaction_get_package_ids (transaction);
- pk_backend_reset (backend);
- pk_backend_get_files (backend, package_ids);
+ pk_backend_reset (plugin->backend);
+ pk_backend_get_files (plugin->backend, package_ids);
/* wait for finished */
g_main_loop_run (plugin->priv->loop);
- pk_backend_set_percentage (backend, 100);
+ pk_backend_set_percentage (plugin->backend, 100);
/* there is a file we can't COW */
if (plugin->priv->files_list->len != 0) {
file = g_ptr_array_index (plugin->priv->files_list, 0);
- pk_backend_error_code (backend,
+ pk_backend_error_code (plugin->backend,
PK_ERROR_ENUM_UPDATE_FAILED_DUE_TO_RUNNING_PROCESS,
"failed to run as %s is running", file);
goto out;
}
out:
if (files_id > 0)
- g_signal_handler_disconnect (backend, files_id);
+ g_signal_handler_disconnect (plugin->backend, files_id);
if (finished_id > 0)
- g_signal_handler_disconnect (backend, finished_id);
+ g_signal_handler_disconnect (plugin->backend, finished_id);
g_strfreev (files);
g_free (process);
}
diff --git a/src/plugins/pk-plugin-scan-desktop-files.c b/src/plugins/pk-plugin-scan-desktop-files.c
index fbda2fe..142ca45 100644
--- a/src/plugins/pk-plugin-scan-desktop-files.c
+++ b/src/plugins/pk-plugin-scan-desktop-files.c
@@ -33,7 +33,6 @@ struct PkPluginPrivate {
GPtrArray *list;
GMainLoop *loop;
GHashTable *hash;
- PkBackend *backend;
};
/**
@@ -164,9 +163,9 @@ pk_plugin_get_installed_package_for_file (PkPlugin *plugin,
/* use PK to find the correct package */
if (plugin->priv->list->len > 0)
g_ptr_array_set_size (plugin->priv->list, 0);
- pk_backend_reset (plugin->priv->backend);
+ pk_backend_reset (plugin->backend);
filenames = g_strsplit (filename, "|||", -1);
- pk_backend_search_files (plugin->priv->backend,
+ pk_backend_search_files (plugin->backend,
pk_bitfield_value (PK_FILTER_ENUM_INSTALLED),
filenames);
g_strfreev (filenames);
@@ -465,7 +464,6 @@ pk_plugin_transaction_finished_end (PkPlugin *plugin,
guint finished_id = 0;
guint i;
guint package_id = 0;
- PkBackend *backend = NULL;
PkRoleEnum role;
/* load */
@@ -482,28 +480,24 @@ pk_plugin_transaction_finished_end (PkPlugin *plugin,
goto out;
/* connect to backend */
- backend = pk_transaction_get_backend (transaction);
- if (!pk_backend_is_implemented (backend,
+ if (!pk_backend_is_implemented (plugin->backend,
PK_ROLE_ENUM_SEARCH_FILE)) {
g_debug ("cannot search files");
goto out;
}
- finished_id = g_signal_connect (backend, "finished",
+ finished_id = g_signal_connect (plugin->backend, "finished",
G_CALLBACK (pk_plugin_finished_cb), plugin);
- package_id = g_signal_connect (backend, "package",
+ package_id = g_signal_connect (plugin->backend, "package",
G_CALLBACK (pk_plugin_package_cb), plugin);
/* use a local backend instance */
- pk_backend_reset (backend);
- pk_backend_set_status (backend,
+ pk_backend_reset (plugin->backend);
+ pk_backend_set_status (plugin->backend,
PK_STATUS_ENUM_SCAN_APPLICATIONS);
- /* cache */
- plugin->priv->backend = backend;
-
/* reset hash */
g_hash_table_remove_all (plugin->priv->hash);
- pk_backend_set_percentage (backend, 101);
+ pk_backend_set_percentage (plugin->backend, 101);
/* first go through the existing data, and look for
* modifications and removals */
@@ -527,12 +521,12 @@ pk_plugin_transaction_finished_end (PkPlugin *plugin,
if (array->len) {
step = 100.0f / array->len;
- pk_backend_set_status (backend,
+ pk_backend_set_status (plugin->backend,
PK_STATUS_ENUM_GENERATE_PACKAGE_LIST);
/* process files in an array */
for (i=0; i<array->len; i++) {
- pk_backend_set_percentage (backend, i * step);
+ pk_backend_set_percentage (plugin->backend, i * step);
path = g_ptr_array_index (array, i);
pk_plugin_sqlite_add_filename (plugin,
path,
@@ -540,17 +534,15 @@ pk_plugin_transaction_finished_end (PkPlugin *plugin,
}
}
- pk_backend_set_percentage (backend, 100);
- pk_backend_set_status (backend, PK_STATUS_ENUM_FINISHED);
+ pk_backend_set_percentage (plugin->backend, 100);
+ pk_backend_set_status (plugin->backend, PK_STATUS_ENUM_FINISHED);
out:
if (array != NULL)
g_ptr_array_unref (array);
- if (backend == NULL) {
- if (package_id > 0)
- g_signal_handler_disconnect (backend, package_id);
- if (finished_id > 0)
- g_signal_handler_disconnect (backend, finished_id);
- }
+ if (package_id > 0)
+ g_signal_handler_disconnect (plugin->backend, package_id);
+ if (finished_id > 0)
+ g_signal_handler_disconnect (plugin->backend, finished_id);
}
/**
@@ -617,7 +609,6 @@ pk_plugin_transaction_finished_results (PkPlugin *plugin,
guint files_id = 0;
guint finished_id = 0;
guint i;
- PkBackend *backend = NULL;
PkInfoEnum info;
PkPackage *item;
PkResults *results;
@@ -637,20 +628,16 @@ pk_plugin_transaction_finished_results (PkPlugin *plugin,
goto out;
/* connect to backend */
- backend = pk_transaction_get_backend (transaction);
- if (!pk_backend_is_implemented (backend,
+ if (!pk_backend_is_implemented (plugin->backend,
PK_ROLE_ENUM_GET_FILES)) {
g_debug ("cannot get files");
goto out;
}
- finished_id = g_signal_connect (backend, "finished",
+ finished_id = g_signal_connect (plugin->backend, "finished",
G_CALLBACK (pk_plugin_finished_cb), plugin);
- files_id = g_signal_connect (backend, "files",
+ files_id = g_signal_connect (plugin->backend, "files",
G_CALLBACK (pk_plugin_files_cb), plugin);
- /* cache */
- plugin->priv->backend = backend;
-
/* get results */
results = pk_transaction_get_results (transaction);
array = pk_results_get_package_array (results);
@@ -677,23 +664,21 @@ pk_plugin_transaction_finished_results (PkPlugin *plugin,
goto out;
/* get all the files touched in the packages we just installed */
- pk_backend_reset (backend);
- pk_backend_set_status (backend, PK_STATUS_ENUM_SCAN_APPLICATIONS);
- pk_backend_set_percentage (backend, 101);
+ pk_backend_reset (plugin->backend);
+ pk_backend_set_status (plugin->backend, PK_STATUS_ENUM_SCAN_APPLICATIONS);
+ pk_backend_set_percentage (plugin->backend, 101);
package_ids = pk_ptr_array_to_strv (list);
- pk_backend_get_files (backend, package_ids);
+ pk_backend_get_files (plugin->backend, package_ids);
/* wait for finished */
g_main_loop_run (plugin->priv->loop);
- pk_backend_set_percentage (backend, 100);
+ pk_backend_set_percentage (plugin->backend, 100);
out:
- if (backend == NULL) {
- if (files_id > 0)
- g_signal_handler_disconnect (backend, files_id);
- if (finished_id > 0)
- g_signal_handler_disconnect (backend, finished_id);
- }
+ if (files_id > 0)
+ g_signal_handler_disconnect (plugin->backend, files_id);
+ if (finished_id > 0)
+ g_signal_handler_disconnect (plugin->backend, finished_id);
if (array != NULL)
g_ptr_array_unref (array);
if (list != NULL)
diff --git a/src/plugins/pk-plugin-update-check-processes.c b/src/plugins/pk-plugin-update-check-processes.c
index 0c9a2c9..2b8ff83 100644
--- a/src/plugins/pk-plugin-update-check-processes.c
+++ b/src/plugins/pk-plugin-update-check-processes.c
@@ -139,7 +139,6 @@ pk_plugin_transaction_finished_results (PkPlugin *plugin,
guint files_id = 0;
guint finished_id = 0;
guint i;
- PkBackend *backend = NULL;
PkConf *conf;
PkPackage *item;
PkResults *results;
@@ -158,15 +157,14 @@ pk_plugin_transaction_finished_results (PkPlugin *plugin,
goto out;
/* check we can do the action */
- backend = pk_transaction_get_backend (transaction);
- if (!pk_backend_is_implemented (backend,
+ if (!pk_backend_is_implemented (plugin->backend,
PK_ROLE_ENUM_GET_FILES)) {
g_debug ("cannot get files");
goto out;
}
- finished_id = g_signal_connect (backend, "finished",
+ finished_id = g_signal_connect (plugin->backend, "finished",
G_CALLBACK (pk_plugin_finished_cb), plugin);
- files_id = g_signal_connect (backend, "files",
+ files_id = g_signal_connect (plugin->backend, "files",
G_CALLBACK (pk_plugin_files_cb), plugin);
/* get results */
@@ -197,25 +195,23 @@ pk_plugin_transaction_finished_results (PkPlugin *plugin,
pk_proc_refresh (plugin->priv->proc);
/* get all the files touched in the packages we just updated */
- pk_backend_reset (backend);
- pk_backend_set_status (backend, PK_STATUS_ENUM_CHECK_EXECUTABLE_FILES);
- pk_backend_set_percentage (backend, 101);
+ pk_backend_reset (plugin->backend);
+ pk_backend_set_status (plugin->backend, PK_STATUS_ENUM_CHECK_EXECUTABLE_FILES);
+ pk_backend_set_percentage (plugin->backend, 101);
package_ids = pk_ptr_array_to_strv (list);
- pk_backend_get_files (backend, package_ids);
+ pk_backend_get_files (plugin->backend, package_ids);
/* wait for finished */
g_main_loop_run (plugin->priv->loop);
- pk_backend_set_percentage (backend, 100);
+ pk_backend_set_percentage (plugin->backend, 100);
out:
g_strfreev (package_ids);
- if (backend == NULL) {
- if (files_id > 0)
- g_signal_handler_disconnect (backend, files_id);
- if (finished_id > 0)
- g_signal_handler_disconnect (backend, finished_id);
- }
+ if (files_id > 0)
+ g_signal_handler_disconnect (plugin->backend, files_id);
+ if (finished_id > 0)
+ g_signal_handler_disconnect (plugin->backend, finished_id);
if (array != NULL)
g_ptr_array_unref (array);
if (list != NULL)
diff --git a/src/plugins/pk-plugin-update-package-list.c b/src/plugins/pk-plugin-update-package-list.c
index 064b322..d94e78d 100644
--- a/src/plugins/pk-plugin-update-package-list.c
+++ b/src/plugins/pk-plugin-update-package-list.c
@@ -131,7 +131,6 @@ pk_plugin_transaction_finished_end (PkPlugin *plugin,
GError *error = NULL;
guint finished_id = 0;
guint package_id = 0;
- PkBackend *backend = NULL;
PkConf *conf;
PkRoleEnum role;
@@ -147,18 +146,16 @@ pk_plugin_transaction_finished_end (PkPlugin *plugin,
goto out;
/* check we can do the action */
- backend = pk_transaction_get_backend (transaction);
- if (!pk_backend_is_implemented (backend,
+ if (!pk_backend_is_implemented (plugin->backend,
PK_ROLE_ENUM_GET_PACKAGES)) {
g_debug ("cannot get packages");
goto out;
}
/* connect to backend */
- backend = pk_transaction_get_backend (transaction);
- finished_id = g_signal_connect (backend, "finished",
+ finished_id = g_signal_connect (plugin->backend, "finished",
G_CALLBACK (pk_plugin_finished_cb), plugin);
- package_id = g_signal_connect (backend, "package",
+ package_id = g_signal_connect (plugin->backend, "package",
G_CALLBACK (pk_plugin_package_cb), plugin);
g_debug ("plugin: updating package lists");
@@ -168,19 +165,19 @@ pk_plugin_transaction_finished_end (PkPlugin *plugin,
g_ptr_array_set_size (plugin->priv->list, 0);
/* update UI */
- pk_backend_set_status (backend,
+ pk_backend_set_status (plugin->backend,
PK_STATUS_ENUM_GENERATE_PACKAGE_LIST);
- pk_backend_set_percentage (backend, 101);
+ pk_backend_set_percentage (plugin->backend, 101);
/* get the new package list */
- pk_backend_reset (backend);
- pk_backend_get_packages (backend, PK_FILTER_ENUM_NONE);
+ pk_backend_reset (plugin->backend);
+ pk_backend_get_packages (plugin->backend, PK_FILTER_ENUM_NONE);
/* wait for finished */
g_main_loop_run (plugin->priv->loop);
/* update UI */
- pk_backend_set_percentage (backend, 90);
+ pk_backend_set_percentage (plugin->backend, 90);
/* convert to a file */
data = pk_plugin_package_list_to_string (plugin->priv->list);
@@ -193,12 +190,12 @@ pk_plugin_transaction_finished_end (PkPlugin *plugin,
}
/* update UI */
- pk_backend_set_percentage (backend, 100);
- pk_backend_set_status (backend, PK_STATUS_ENUM_FINISHED);
+ pk_backend_set_percentage (plugin->backend, 100);
+ pk_backend_set_status (plugin->backend, PK_STATUS_ENUM_FINISHED);
out:
- if (backend != NULL) {
- g_signal_handler_disconnect (backend, finished_id);
- g_signal_handler_disconnect (backend, package_id);
+ if (finished_id != 0) {
+ g_signal_handler_disconnect (plugin->backend, finished_id);
+ g_signal_handler_disconnect (plugin->backend, package_id);
}
g_free (data);
}
commit 44f4129c6d561554ca57cfa2b349c5250d6c9f85
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 12 14:23:50 2011 +0100
trivial: Add the PkBackend in the PkPlugin struct
Most of the plugins need this, and it's easy to provide.
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 91457e9..5034b46 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -1477,7 +1477,7 @@ pk_engine_network_state_changed_cb (PkNetwork *network, PkNetworkEnum network_st
*/
static void
pk_engine_load_plugin (PkEngine *engine,
- const gchar *filename)
+ const gchar *filename)
{
gboolean ret;
GModule *module;
@@ -1506,6 +1506,7 @@ pk_engine_load_plugin (PkEngine *engine,
/* print what we know */
plugin = g_new0 (PkPlugin, 1);
plugin->module = module;
+ plugin->backend = g_object_ref (engine->priv->backend);
g_debug ("opened plugin %s: %s",
filename, plugin_desc ());
@@ -1566,6 +1567,7 @@ static void
pk_engine_plugin_free (PkPlugin *plugin)
{
g_free (plugin->priv);
+ g_object_unref (plugin->backend);
g_module_close (plugin->module);
g_free (plugin);
}
diff --git a/src/pk-plugin.h b/src/pk-plugin.h
index 76fa6c2..417e643 100644
--- a/src/pk-plugin.h
+++ b/src/pk-plugin.h
@@ -24,6 +24,7 @@
#include <glib-object.h>
+#include "pk-backend.h"
#include "pk-transaction.h"
G_BEGIN_DECLS
@@ -32,6 +33,7 @@ typedef struct PkPluginPrivate PkPluginPrivate;
typedef struct {
GModule *module;
+ PkBackend *backend;
PkPluginPrivate *priv;
} PkPlugin;
commit 6f4e16094532afc4adab44a1d6da5ffb9d595026
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 12 14:22:43 2011 +0100
trivial: Add a method for a plugin to register a role implementation
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 87653de..53fe435 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -335,11 +335,23 @@ gboolean
pk_backend_is_implemented (PkBackend *backend, PkRoleEnum role)
{
PkBitfield roles;
+ g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
roles = pk_backend_get_roles (backend);
return pk_bitfield_contain (roles, role);
}
/**
+ * pk_backend_implement:
+ **/
+void
+pk_backend_implement (PkBackend *backend, PkRoleEnum role)
+{
+ g_return_if_fail (PK_IS_BACKEND (backend));
+ g_return_if_fail (role != PK_ROLE_ENUM_UNKNOWN);
+ pk_bitfield_add (backend->priv->roles, role);
+}
+
+/**
* pk_backend_set_string:
**/
gboolean
diff --git a/src/pk-backend.h b/src/pk-backend.h
index 54f66e4..e08ed29 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -101,6 +101,8 @@ gchar *pk_backend_get_mime_types (PkBackend *backend);
gboolean pk_backend_has_set_error_code (PkBackend *backend);
gboolean pk_backend_is_implemented (PkBackend *backend,
PkRoleEnum role);
+void pk_backend_implement (PkBackend *backend,
+ PkRoleEnum role);
gchar *pk_backend_get_accepted_eula_string (PkBackend *backend);
void pk_backend_cancel (PkBackend *backend);
void pk_backend_download_packages (PkBackend *backend,
commit 69ea6dc0601f3826da2d2f56798168fa226af4d7
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 12 13:42:05 2011 +0100
trivial: Do not continue to the native backend if the plugin serviced the request completely
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 293fe87..87653de 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -2210,6 +2210,16 @@ pk_backend_set_exit_code (PkBackend *backend, PkExitEnum exit_enum)
}
/**
+ * pk_backend_get_exit_code:
+ **/
+PkExitEnum
+pk_backend_get_exit_code (PkBackend *backend)
+{
+ g_return_val_if_fail (PK_IS_BACKEND (backend), PK_EXIT_ENUM_UNKNOWN);
+ return backend->priv->exit;
+}
+
+/**
* pk_backend_transaction_start:
*
* This is called just before the threaded transaction method, and in
diff --git a/src/pk-backend.h b/src/pk-backend.h
index b19ac37..54f66e4 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -202,6 +202,7 @@ gboolean pk_backend_is_eula_valid (PkBackend *backend,
gboolean pk_backend_set_role (PkBackend *backend,
PkRoleEnum role);
PkRoleEnum pk_backend_get_role (PkBackend *backend);
+PkExitEnum pk_backend_get_exit_code (PkBackend *backend);
gboolean pk_backend_set_status (PkBackend *backend,
PkStatusEnum status);
gboolean pk_backend_set_allow_cancel (PkBackend *backend,
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 0f52ace..71bc5cb 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -1701,6 +1701,7 @@ pk_transaction_run (PkTransaction *transaction)
guint i;
GError *error = NULL;
PkBitfield filters;
+ PkExitEnum exit_status;
PkTransactionPrivate *priv = PK_TRANSACTION_GET_PRIVATE (transaction);
g_return_val_if_fail (PK_IS_TRANSACTION (transaction), FALSE);
@@ -1826,11 +1827,10 @@ pk_transaction_run (PkTransaction *transaction)
pk_transaction_plugin_phase (transaction,
PK_PLUGIN_PHASE_TRANSACTION_STARTED);
- /* is an error code set? */
- if (pk_backend_get_is_error_set (priv->backend)) {
- pk_transaction_finished_emit (transaction, PK_EXIT_ENUM_FAILED, 0);
-
- /* do not fail the tranaction */
+ /* did the plugin finish or abort the transaction */
+ exit_status = pk_backend_get_exit_code (priv->backend);
+ if (exit_status != PK_EXIT_ENUM_UNKNOWN) {
+ pk_transaction_finished_emit (transaction, exit_status, 0);
ret = TRUE;
goto out;
}
commit 15fde4371d047fd5bdf5b01c4143c0e5b1034486
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 12 12:44:05 2011 +0100
Add plugin API so that plugins can modify the internal array state
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 8a614e4..0f52ace 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -871,6 +871,7 @@ pk_transaction_plugin_phase (PkTransaction *transaction,
PkConf *
pk_transaction_get_conf (PkTransaction *transaction)
{
+ g_return_val_if_fail (PK_IS_TRANSACTION (transaction), NULL);
return transaction->priv->conf;
}
@@ -880,6 +881,7 @@ pk_transaction_get_conf (PkTransaction *transaction)
PkBackend *
pk_transaction_get_backend (PkTransaction *transaction)
{
+ g_return_val_if_fail (PK_IS_TRANSACTION (transaction), NULL);
return transaction->priv->backend;
}
@@ -889,6 +891,7 @@ pk_transaction_get_backend (PkTransaction *transaction)
PkResults *
pk_transaction_get_results (PkTransaction *transaction)
{
+ g_return_val_if_fail (PK_IS_TRANSACTION (transaction), NULL);
return transaction->priv->results;
}
@@ -898,15 +901,29 @@ pk_transaction_get_results (PkTransaction *transaction)
gchar **
pk_transaction_get_package_ids (PkTransaction *transaction)
{
+ g_return_val_if_fail (PK_IS_TRANSACTION (transaction), NULL);
return transaction->priv->cached_package_ids;
}
/**
+ * pk_transaction_set_package_ids:
+ **/
+void
+pk_transaction_set_package_ids (PkTransaction *transaction,
+ gchar **package_ids)
+{
+ g_return_if_fail (PK_IS_TRANSACTION (transaction));
+ g_strfreev (transaction->priv->cached_package_ids);
+ transaction->priv->cached_package_ids = g_strdupv (package_ids);
+}
+
+/**
* pk_transaction_get_values:
**/
gchar **
pk_transaction_get_values (PkTransaction *transaction)
{
+ g_return_val_if_fail (PK_IS_TRANSACTION (transaction), NULL);
return transaction->priv->cached_values;
}
@@ -916,10 +933,23 @@ pk_transaction_get_values (PkTransaction *transaction)
gchar **
pk_transaction_get_full_paths (PkTransaction *transaction)
{
+ g_return_val_if_fail (PK_IS_TRANSACTION (transaction), NULL);
return transaction->priv->cached_full_paths;
}
/**
+ * pk_transaction_set_full_paths:
+ **/
+void
+pk_transaction_set_full_paths (PkTransaction *transaction,
+ gchar **full_paths)
+{
+ g_return_if_fail (PK_IS_TRANSACTION (transaction));
+ g_strfreev (transaction->priv->cached_full_paths);
+ transaction->priv->cached_full_paths = g_strdupv (full_paths);
+}
+
+/**
* pk_transaction_finished_cb:
**/
static void
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index bd06148..ce8f218 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -80,8 +80,12 @@ PkConf *pk_transaction_get_conf (PkTransaction *transaction);
PkBackend *pk_transaction_get_backend (PkTransaction *transaction);
PkResults *pk_transaction_get_results (PkTransaction *transaction);
gchar **pk_transaction_get_package_ids (PkTransaction *transaction);
+void pk_transaction_set_package_ids (PkTransaction *transaction,
+ gchar **package_ids);
gchar **pk_transaction_get_values (PkTransaction *transaction);
gchar **pk_transaction_get_full_paths (PkTransaction *transaction);
+void pk_transaction_set_full_paths (PkTransaction *transaction,
+ gchar **full_paths);
PkTransactionState pk_transaction_get_state (PkTransaction *transaction);
gboolean pk_transaction_set_state (PkTransaction *transaction,
PkTransactionState state);
commit c24f5c38f5424f6596d4f7f6c936b0742de3377c
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jul 11 22:21:58 2011 +0100
trivial: add another plugin phase for adding content types
diff --git a/src/pk-plugin.h b/src/pk-plugin.h
index 1e1905f..76fa6c2 100644
--- a/src/pk-plugin.h
+++ b/src/pk-plugin.h
@@ -38,6 +38,7 @@ typedef struct {
typedef enum {
PK_PLUGIN_PHASE_INIT, /* plugin started */
+ PK_PLUGIN_PHASE_TRANSACTION_CONTENT_TYPES, /* for adding content types */
PK_PLUGIN_PHASE_TRANSACTION_RUN, /* only this running */
PK_PLUGIN_PHASE_TRANSACTION_STARTED, /* all signals connected */
PK_PLUGIN_PHASE_TRANSACTION_FINISHED_START, /* finshed with all signals */
@@ -67,6 +68,8 @@ void pk_plugin_transaction_finished_results (PkPlugin *plugin,
PkTransaction *transaction);
void pk_plugin_transaction_finished_end (PkPlugin *plugin,
PkTransaction *transaction);
+void pk_plugin_transaction_content_types (PkPlugin *plugin,
+ PkTransaction *transaction);
G_END_DECLS
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index f9de378..8a614e4 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -166,7 +166,7 @@ struct PkTransactionPrivate
guint signal_category;
guint signal_speed;
GPtrArray *plugins;
- GPtrArray *supported_mime_types;
+ GPtrArray *supported_content_types;
};
typedef enum {
@@ -824,6 +824,9 @@ pk_transaction_plugin_phase (PkTransaction *transaction,
case PK_PLUGIN_PHASE_TRANSACTION_RUN:
function = "pk_plugin_transaction_run";
break;
+ case PK_PLUGIN_PHASE_TRANSACTION_CONTENT_TYPES:
+ function = "pk_plugin_transaction_content_types";
+ break;
case PK_PLUGIN_PHASE_TRANSACTION_STARTED:
function = "pk_plugin_transaction_started";
break;
@@ -3704,7 +3707,7 @@ pk_transaction_is_supported_content_type (PkTransaction *transaction,
{
const gchar *mime_type_tmp;
gboolean ret = FALSE;
- GPtrArray *array = transaction->priv->supported_mime_types;
+ GPtrArray *array = transaction->priv->supported_content_types;
guint i;
/* can we support this one? */
@@ -3758,6 +3761,10 @@ pk_transaction_install_files (PkTransaction *transaction, gboolean only_trusted,
goto out;
}
+ /* run the plugins */
+ pk_transaction_plugin_phase (transaction,
+ PK_PLUGIN_PHASE_TRANSACTION_CONTENT_TYPES);
+
/* check all files exists and are valid */
length = g_strv_length (full_paths);
@@ -4860,6 +4867,10 @@ pk_transaction_simulate_install_files (PkTransaction *transaction, gchar **full_
return;
}
+ /* run the plugins */
+ pk_transaction_plugin_phase (transaction,
+ PK_PLUGIN_PHASE_TRANSACTION_CONTENT_TYPES);
+
/* check all files exists and are valid */
length = g_strv_length (full_paths);
@@ -5427,16 +5438,17 @@ pk_transaction_upgrade_system (PkTransaction *transaction, const gchar *distro_i
}
/**
- * pk_transaction_add_supported_mime_type:
+ * pk_transaction_add_supported_content_type:
*
* Designed to be used by plugins.
**/
void
-pk_transaction_add_supported_mime_type (PkTransaction *transaction,
+pk_transaction_add_supported_content_type (PkTransaction *transaction,
const gchar *mime_type)
{
g_return_if_fail (PK_IS_TRANSACTION (transaction));
- g_ptr_array_add (transaction->priv->supported_mime_types,
+ g_debug ("added supported content type of %s", mime_type);
+ g_ptr_array_add (transaction->priv->supported_content_types,
g_strdup (mime_type));
}
@@ -5454,7 +5466,7 @@ pk_transaction_setup_mime_types (PkTransaction *transaction)
mime_types_str = pk_backend_get_mime_types (transaction->priv->backend);
mime_types = g_strsplit (mime_types_str, ";", -1);
for (i=0; mime_types[i] != NULL; i++) {
- g_ptr_array_add (transaction->priv->supported_mime_types,
+ g_ptr_array_add (transaction->priv->supported_content_types,
g_strdup (mime_types[i]));
}
@@ -5778,7 +5790,7 @@ pk_transaction_init (PkTransaction *transaction)
transaction->priv->syslog = pk_syslog_new ();
transaction->priv->dbus = pk_dbus_new ();
transaction->priv->results = pk_results_new ();
- transaction->priv->supported_mime_types = g_ptr_array_new_with_free_func (g_free);
+ transaction->priv->supported_content_types = g_ptr_array_new_with_free_func (g_free);
#ifdef USE_SECURITY_POLKIT
#if defined(USE_SECURITY_POLKIT_NEW) && defined(HAVE_POLKIT_AUTHORITY_GET_SYNC)
transaction->priv->authority = polkit_authority_get_sync (NULL, &error);
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index b6b9ebc..bd06148 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -87,7 +87,7 @@ gboolean pk_transaction_set_state (PkTransaction *transaction,
PkTransactionState state);
const gchar *pk_transaction_state_to_string (PkTransactionState state);
const gchar *pk_transaction_get_tid (PkTransaction *transaction);
-void pk_transaction_add_supported_mime_type (PkTransaction *transaction,
+void pk_transaction_add_supported_content_type (PkTransaction *transaction,
const gchar *mime_type);
void pk_transaction_set_plugins (PkTransaction *transaction,
GPtrArray *plugins);
commit abd83790abfa5f46d2d9c8c861ea3fac28f1d722
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jul 11 17:29:35 2011 +0100
trivial: log when no plugins provide a phase hook
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 910829f..f9de378 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -816,6 +816,7 @@ pk_transaction_plugin_phase (PkTransaction *transaction,
guint i;
const gchar *function = NULL;
gboolean ret;
+ gboolean ran_one = FALSE;
PkPluginTransactionFunc plugin_func = NULL;
PkPlugin *plugin;
@@ -851,11 +852,14 @@ pk_transaction_plugin_phase (PkTransaction *transaction,
if (!ret)
continue;
+ ran_one = TRUE;
g_debug ("run %s on %s",
function,
g_module_name (plugin->module));
plugin_func (plugin, transaction);
}
+ if (!ran_one)
+ g_debug ("no plugins provided %s", function);
}
/**
commit 64e123ead3552c6f7d0d1d9df3c447db74e4867b
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jul 11 15:26:03 2011 +0100
trivial: only call initialize and destroy on the plugins once, not every transaction
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 6017364..91457e9 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -46,21 +46,22 @@
#include "egg-string.h"
-#include "pk-network.h"
-#include "pk-cache.h"
-#include "pk-shared.h"
#include "pk-backend.h"
+#include "pk-cache.h"
+#include "pk-conf.h"
+#include "pk-dbus.h"
#include "pk-engine.h"
-#include "pk-transaction.h"
-#include "pk-transaction-dbus.h"
-#include "pk-transaction-db.h"
-#include "pk-transaction-list.h"
+#include "pk-file-monitor.h"
#include "pk-inhibit.h"
#include "pk-marshal.h"
+#include "pk-network.h"
#include "pk-notify.h"
-#include "pk-file-monitor.h"
-#include "pk-conf.h"
-#include "pk-dbus.h"
+#include "pk-plugin.h"
+#include "pk-shared.h"
+#include "pk-transaction-db.h"
+#include "pk-transaction-dbus.h"
+#include "pk-transaction.h"
+#include "pk-transaction-list.h"
static void pk_engine_finalize (GObject *object);
@@ -100,6 +101,7 @@ struct PkEnginePrivate
#endif
gboolean locked;
PkNetworkEnum network_state;
+ GPtrArray *plugins;
};
enum {
@@ -1469,6 +1471,148 @@ pk_engine_network_state_changed_cb (PkNetwork *network, PkNetworkEnum network_st
g_signal_emit (engine, signals[SIGNAL_CHANGED], 0);
}
+
+/**
+ * pk_engine_load_plugin:
+ */
+static void
+pk_engine_load_plugin (PkEngine *engine,
+ const gchar *filename)
+{
+ gboolean ret;
+ GModule *module;
+ PkPlugin *plugin;
+ PkPluginGetDescFunc plugin_desc = NULL;
+
+ module = g_module_open (filename,
+ 0);
+ if (module == NULL) {
+ g_warning ("failed to open plugin %s: %s",
+ filename, g_module_error ());
+ goto out;
+ }
+
+ /* get description */
+ ret = g_module_symbol (module,
+ "pk_plugin_get_description",
+ (gpointer *) &plugin_desc);
+ if (!ret) {
+ g_warning ("Plugin %s requires description",
+ filename);
+ g_module_close (module);
+ goto out;
+ }
+
+ /* print what we know */
+ plugin = g_new0 (PkPlugin, 1);
+ plugin->module = module;
+ g_debug ("opened plugin %s: %s",
+ filename, plugin_desc ());
+
+ /* add to array */
+ g_ptr_array_add (engine->priv->plugins,
+ plugin);
+out:
+ return;
+}
+
+/**
+ * pk_engine_load_plugins:
+ */
+static void
+pk_engine_load_plugins (PkEngine *engine)
+{
+ const gchar *filename_tmp;
+ gchar *filename_plugin;
+ gchar *path;
+ GDir *dir;
+ GError *error = NULL;
+
+ /* search in the plugin directory for plugins */
+ path = g_build_filename (LIBDIR, "packagekit-plugins", NULL);
+ dir = g_dir_open (path, 0, &error);
+ if (dir == NULL) {
+ g_warning ("failed to open plugin directory: %s",
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* try to open each plugin */
+ g_debug ("searching for plugins in %s", path);
+ do {
+ filename_tmp = g_dir_read_name (dir);
+ if (filename_tmp == NULL)
+ break;
+ if (!g_str_has_suffix (filename_tmp, ".so"))
+ continue;
+ filename_plugin = g_build_filename (path,
+ filename_tmp,
+ NULL);
+ pk_engine_load_plugin (engine,
+ filename_plugin);
+ g_free (filename_plugin);
+ } while (TRUE);
+out:
+ if (dir != NULL)
+ g_dir_close (dir);
+ g_free (path);
+}
+
+/**
+ * pk_engine_plugin_free:
+ **/
+static void
+pk_engine_plugin_free (PkPlugin *plugin)
+{
+ g_free (plugin->priv);
+ g_module_close (plugin->module);
+ g_free (plugin);
+}
+
+
+/**
+ * pk_engine_plugin_phase:
+ **/
+static void
+pk_engine_plugin_phase (PkEngine *engine,
+ PkPluginPhase phase)
+{
+ guint i;
+ const gchar *function = NULL;
+ gboolean ret;
+ PkPluginFunc plugin_func = NULL;
+ PkPlugin *plugin;
+
+ switch (phase) {
+ case PK_PLUGIN_PHASE_INIT:
+ function = "pk_plugin_initialize";
+ break;
+ case PK_PLUGIN_PHASE_DESTROY:
+ function = "pk_plugin_destroy";
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+
+ g_assert (function != NULL);
+
+ /* run each plugin */
+ for (i=0; i<engine->priv->plugins->len; i++) {
+ plugin = g_ptr_array_index (engine->priv->plugins, i);
+ ret = g_module_symbol (plugin->module,
+ function,
+ (gpointer *) &plugin_func);
+ if (!ret)
+ continue;
+ g_debug ("run %s on %s",
+ function,
+ g_module_name (plugin->module));
+ plugin_func (plugin);
+ }
+}
+
/**
* pk_engine_init:
**/
@@ -1634,12 +1778,23 @@ pk_engine_init (PkEngine *engine)
g_signal_connect (engine->priv->transaction_list, "changed",
G_CALLBACK (pk_engine_transaction_list_changed_cb), engine);
+ /* get plugins */
+ engine->priv->plugins = g_ptr_array_new_with_free_func ((GDestroyNotify) pk_engine_plugin_free);
+ pk_engine_load_plugins (engine);
+ pk_transaction_list_set_plugins (engine->priv->transaction_list,
+ engine->priv->plugins);
+
+
engine->priv->inhibit = pk_inhibit_new ();
g_signal_connect (engine->priv->inhibit, "locked",
G_CALLBACK (pk_engine_inhibit_locked_cb), engine);
/* we use a trasaction db to store old transactions and to do rollbacks */
engine->priv->transaction_db = pk_transaction_db_new ();
+
+ /* initialize plugins */
+ pk_engine_plugin_phase (engine,
+ PK_PLUGIN_PHASE_INIT);
}
/**
@@ -1659,6 +1814,10 @@ pk_engine_finalize (GObject *object)
g_return_if_fail (engine->priv != NULL);
+ /* run the plugins */
+ pk_engine_plugin_phase (engine,
+ PK_PLUGIN_PHASE_DESTROY);
+
/* unlock if we locked this */
ret = pk_backend_unlock (engine->priv->backend);
if (!ret)
@@ -1690,6 +1849,7 @@ pk_engine_finalize (GObject *object)
g_object_unref (engine->priv->cache);
g_object_unref (engine->priv->conf);
g_object_unref (engine->priv->dbus);
+ g_ptr_array_unref (engine->priv->plugins);
g_free (engine->priv->mime_types);
g_free (engine->priv->backend_name);
g_free (engine->priv->backend_description);
diff --git a/src/pk-plugin.h b/src/pk-plugin.h
index 268f425..1e1905f 100644
--- a/src/pk-plugin.h
+++ b/src/pk-plugin.h
@@ -35,6 +35,18 @@ typedef struct {
PkPluginPrivate *priv;
} PkPlugin;
+
+typedef enum {
+ PK_PLUGIN_PHASE_INIT, /* plugin started */
+ PK_PLUGIN_PHASE_TRANSACTION_RUN, /* only this running */
+ PK_PLUGIN_PHASE_TRANSACTION_STARTED, /* all signals connected */
+ PK_PLUGIN_PHASE_TRANSACTION_FINISHED_START, /* finshed with all signals */
+ PK_PLUGIN_PHASE_TRANSACTION_FINISHED_RESULTS, /* finished with some signals */
+ PK_PLUGIN_PHASE_TRANSACTION_FINISHED_END, /* finished with no signals */
+ PK_PLUGIN_PHASE_DESTROY, /* plugin finalized */
+ PK_PLUGIN_PHASE_UNKNOWN
+} PkPluginPhase;
+
#define PK_TRANSACTION_PLUGIN_GET_PRIVATE(x) g_new0 (x,1)
typedef const gchar *(*PkPluginGetDescFunc) (void);
diff --git a/src/pk-transaction-list.c b/src/pk-transaction-list.c
index 85706e7..a237878 100644
--- a/src/pk-transaction-list.c
+++ b/src/pk-transaction-list.c
@@ -59,6 +59,7 @@ struct PkTransactionListPrivate
guint unwedge1_id;
guint unwedge2_id;
PkConf *conf;
+ GPtrArray *plugins;
};
typedef struct {
@@ -479,6 +480,10 @@ pk_transaction_list_create (PkTransactionList *tlist, const gchar *tid, const gc
g_signal_connect_after (item->transaction, "finished",
G_CALLBACK (pk_transaction_list_transaction_finished_cb), tlist);
+ /* set plugins */
+ pk_transaction_set_plugins (item->transaction,
+ tlist->priv->plugins);
+
/* set transaction state */
ret = pk_transaction_set_state (item->transaction, PK_TRANSACTION_STATE_NEW);
if (!ret) {
@@ -898,6 +903,16 @@ pk_transaction_list_wedge_check1 (PkTransactionList *tlist)
}
/**
+ * pk_transaction_list_set_plugins:
+ */
+void
+pk_transaction_list_set_plugins (PkTransactionList *tlist,
+ GPtrArray *plugins)
+{
+ tlist->priv->plugins = g_ptr_array_ref (plugins);
+}
+
+/**
* pk_transaction_list_class_init:
* @klass: The PkTransactionListClass
**/
@@ -958,6 +973,7 @@ pk_transaction_list_finalize (GObject *object)
g_ptr_array_foreach (tlist->priv->array, (GFunc) pk_transaction_list_item_free, NULL);
g_ptr_array_free (tlist->priv->array, TRUE);
g_object_unref (tlist->priv->conf);
+ g_ptr_array_unref (tlist->priv->plugins);
G_OBJECT_CLASS (pk_transaction_list_parent_class)->finalize (object);
}
diff --git a/src/pk-transaction-list.h b/src/pk-transaction-list.h
index 2812e7d..f4a548e 100644
--- a/src/pk-transaction-list.h
+++ b/src/pk-transaction-list.h
@@ -76,6 +76,8 @@ guint pk_transaction_list_get_size (PkTransactionList *tlist);
PkTransaction *pk_transaction_list_get_transaction (PkTransactionList *tlist,
const gchar *tid);
void pk_transaction_list_cancel_background (PkTransactionList *tlist);
+void pk_transaction_list_set_plugins (PkTransactionList *tlist,
+ GPtrArray *plugins);
G_END_DECLS
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index a25a144..910829f 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -195,17 +195,6 @@ typedef enum {
PK_TRANSACTION_ERROR_LAST
} PkTransactionError;
-typedef enum {
- PK_PLUGIN_PHASE_INIT, /* plugin started */
- PK_PLUGIN_PHASE_TRANSACTION_RUN, /* only this running */
- PK_PLUGIN_PHASE_TRANSACTION_STARTED, /* all signals connected */
- PK_PLUGIN_PHASE_TRANSACTION_FINISHED_START, /* finshed with all signals */
- PK_PLUGIN_PHASE_TRANSACTION_FINISHED_RESULTS, /* finished with some signals */
- PK_PLUGIN_PHASE_TRANSACTION_FINISHED_END, /* finished with no signals */
- PK_PLUGIN_PHASE_DESTROY, /* plugin finalized */
- PK_PLUGIN_PHASE_UNKNOWN
-} PkPluginPhase;
-
enum {
SIGNAL_DETAILS,
SIGNAL_ERROR_CODE,
@@ -303,90 +292,13 @@ pk_transaction_error_get_type (void)
}
/**
- * pk_transaction_load_plugin:
+ * pk_transaction_set_plugins:
*/
-static void
-pk_transaction_load_plugin (PkTransaction *transaction,
- const gchar *filename)
+void
+pk_transaction_set_plugins (PkTransaction *transaction,
+ GPtrArray *plugins)
{
- gboolean ret;
- GModule *module;
- PkPlugin *plugin;
- PkPluginGetDescFunc plugin_desc = NULL;
-
- module = g_module_open (filename,
- 0);
- if (module == NULL) {
- g_warning ("failed to open plugin %s: %s",
- filename, g_module_error ());
- goto out;
- }
-
- /* get description */
- ret = g_module_symbol (module,
- "pk_plugin_get_description",
- (gpointer *) &plugin_desc);
- if (!ret) {
- g_warning ("Plugin %s requires description",
- filename);
- g_module_close (module);
- goto out;
- }
-
- /* print what we know */
- plugin = g_new0 (PkPlugin, 1);
- plugin->module = module;
- g_debug ("opened plugin %s: %s",
- filename, plugin_desc ());
-
- /* add to array */
- g_ptr_array_add (transaction->priv->plugins,
- plugin);
-out:
- return;
-}
-
-/**
- * pk_transaction_load_plugins:
- */
-static void
-pk_transaction_load_plugins (PkTransaction *transaction)
-{
- const gchar *filename_tmp;
- gchar *filename_plugin;
- gchar *path;
- GDir *dir;
- GError *error = NULL;
-
- /* search in the plugin directory for plugins */
- path = g_build_filename (LIBDIR, "packagekit-plugins", NULL);
- dir = g_dir_open (path, 0, &error);
- if (dir == NULL) {
- g_warning ("failed to open plugin directory: %s",
- error->message);
- g_error_free (error);
- goto out;
- }
-
- /* try to open each plugin */
- g_debug ("searching for plugins in %s", path);
- do {
- filename_tmp = g_dir_read_name (dir);
- if (filename_tmp == NULL)
- break;
- if (!g_str_has_suffix (filename_tmp, ".so"))
- continue;
- filename_plugin = g_build_filename (path,
- filename_tmp,
- NULL);
- pk_transaction_load_plugin (transaction,
- filename_plugin);
- g_free (filename_plugin);
- } while (TRUE);
-out:
- if (dir != NULL)
- g_dir_close (dir);
- g_free (path);
+ transaction->priv->plugins = g_ptr_array_ref (plugins);
}
/**
@@ -904,42 +816,27 @@ pk_transaction_plugin_phase (PkTransaction *transaction,
guint i;
const gchar *function = NULL;
gboolean ret;
- gboolean use_transaction;
- PkPluginFunc plugin_func = NULL;
- PkPluginTransactionFunc plugin_trans_func = NULL;
- gpointer func;
+ PkPluginTransactionFunc plugin_func = NULL;
PkPlugin *plugin;
switch (phase) {
- case PK_PLUGIN_PHASE_INIT:
- function = "pk_plugin_initialize";
- use_transaction = FALSE;
- break;
case PK_PLUGIN_PHASE_TRANSACTION_RUN:
function = "pk_plugin_transaction_run";
- use_transaction = TRUE;
break;
case PK_PLUGIN_PHASE_TRANSACTION_STARTED:
function = "pk_plugin_transaction_started";
- use_transaction = TRUE;
break;
case PK_PLUGIN_PHASE_TRANSACTION_FINISHED_START:
function = "pk_plugin_transaction_finished_start";
- use_transaction = TRUE;
break;
case PK_PLUGIN_PHASE_TRANSACTION_FINISHED_RESULTS:
function = "pk_plugin_transaction_finished_results";
- use_transaction = TRUE;
break;
case PK_PLUGIN_PHASE_TRANSACTION_FINISHED_END:
function = "pk_plugin_transaction_finished_end";
- use_transaction = TRUE;
- break;
- case PK_PLUGIN_PHASE_DESTROY:
- function = "pk_plugin_destroy";
- use_transaction = FALSE;
break;
default:
+ g_assert_not_reached ();
break;
}
@@ -950,20 +847,14 @@ pk_transaction_plugin_phase (PkTransaction *transaction,
plugin = g_ptr_array_index (transaction->priv->plugins, i);
ret = g_module_symbol (plugin->module,
function,
- &func);
+ (gpointer *) &plugin_func);
if (!ret)
continue;
g_debug ("run %s on %s",
function,
g_module_name (plugin->module));
- if (!use_transaction) {
- plugin_func = (PkPluginFunc) func;
- plugin_func (plugin);
- } else {
- plugin_trans_func = (PkPluginTransactionFunc) func;
- plugin_trans_func (plugin, transaction);
- }
+ plugin_func (plugin, transaction);
}
}
@@ -5568,17 +5459,6 @@ pk_transaction_setup_mime_types (PkTransaction *transaction)
}
/**
- * pk_transaction_plugin_free:
- **/
-static void
-pk_transaction_plugin_free (PkPlugin *plugin)
-{
- g_free (plugin->priv);
- g_module_close (plugin->module);
- g_free (plugin);
-}
-
-/**
* pk_transaction_get_property:
**/
static void
@@ -5918,15 +5798,6 @@ pk_transaction_init (PkTransaction *transaction)
/* setup supported mime types */
pk_transaction_setup_mime_types (transaction);
-
- /* get plugins */
- transaction->priv->plugins = g_ptr_array_new_with_free_func ((GDestroyNotify) pk_transaction_plugin_free);
- pk_transaction_load_plugins (transaction);
-
- /* initialize plugins */
- pk_transaction_plugin_phase (transaction,
- PK_PLUGIN_PHASE_INIT);
-
}
/**
@@ -5973,10 +5844,6 @@ pk_transaction_finalize (GObject *object)
transaction = PK_TRANSACTION (object);
- /* run the plugins */
- pk_transaction_plugin_phase (transaction,
- PK_PLUGIN_PHASE_DESTROY);
-
#ifdef USE_SECURITY_POLKIT
if (transaction->priv->subject != NULL)
g_object_unref (transaction->priv->subject);
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index 39b1d01..b6b9ebc 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -89,6 +89,8 @@ const gchar *pk_transaction_state_to_string (PkTransactionState state);
const gchar *pk_transaction_get_tid (PkTransaction *transaction);
void pk_transaction_add_supported_mime_type (PkTransaction *transaction,
const gchar *mime_type);
+void pk_transaction_set_plugins (PkTransaction *transaction,
+ GPtrArray *plugins);
G_END_DECLS
diff --git a/src/plugins/pk-plugin-check-shared-libraries-in-use.c b/src/plugins/pk-plugin-check-shared-libraries-in-use.c
index d8f7530..53de322 100644
--- a/src/plugins/pk-plugin-check-shared-libraries-in-use.c
+++ b/src/plugins/pk-plugin-check-shared-libraries-in-use.c
@@ -85,7 +85,8 @@ pk_plugin_finished_cb (PkBackend *backend,
PkExitEnum exit_enum,
PkPlugin *plugin)
{
- g_assert (g_main_loop_is_running (plugin->priv->loop));
+ if (!g_main_loop_is_running (plugin->priv->loop))
+ return;
g_main_loop_quit (plugin->priv->loop);
}
diff --git a/src/plugins/pk-plugin-no-update-process.c b/src/plugins/pk-plugin-no-update-process.c
index bbcaae7..95db2e9 100644
--- a/src/plugins/pk-plugin-no-update-process.c
+++ b/src/plugins/pk-plugin-no-update-process.c
@@ -52,7 +52,8 @@ pk_plugin_finished_cb (PkBackend *backend,
PkExitEnum exit_enum,
PkPlugin *plugin)
{
- g_assert (g_main_loop_is_running (plugin->priv->loop));
+ if (!g_main_loop_is_running (plugin->priv->loop))
+ return;
g_main_loop_quit (plugin->priv->loop);
}
diff --git a/src/plugins/pk-plugin-scan-desktop-files.c b/src/plugins/pk-plugin-scan-desktop-files.c
index d521280..fbda2fe 100644
--- a/src/plugins/pk-plugin-scan-desktop-files.c
+++ b/src/plugins/pk-plugin-scan-desktop-files.c
@@ -64,7 +64,8 @@ pk_plugin_finished_cb (PkBackend *backend,
PkExitEnum exit_enum,
PkPlugin *plugin)
{
- g_assert (g_main_loop_is_running (plugin->priv->loop));
+ if (!g_main_loop_is_running (plugin->priv->loop))
+ return;
if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
g_warning ("%s failed with exit code: %s",
pk_role_enum_to_string (pk_backend_get_role (backend)),
diff --git a/src/plugins/pk-plugin-update-check-processes.c b/src/plugins/pk-plugin-update-check-processes.c
index 2f57e1a..0c9a2c9 100644
--- a/src/plugins/pk-plugin-update-check-processes.c
+++ b/src/plugins/pk-plugin-update-check-processes.c
@@ -69,7 +69,8 @@ pk_plugin_finished_cb (PkBackend *backend,
PkExitEnum exit_enum,
PkPlugin *plugin)
{
- g_assert (g_main_loop_is_running (plugin->priv->loop));
+ if (!g_main_loop_is_running (plugin->priv->loop))
+ return;
g_main_loop_quit (plugin->priv->loop);
}
diff --git a/src/plugins/pk-plugin-update-package-list.c b/src/plugins/pk-plugin-update-package-list.c
index 7b9ea7f..064b322 100644
--- a/src/plugins/pk-plugin-update-package-list.c
+++ b/src/plugins/pk-plugin-update-package-list.c
@@ -57,7 +57,8 @@ pk_plugin_finished_cb (PkBackend *backend,
PkExitEnum exit_enum,
PkPlugin *plugin)
{
- g_assert (g_main_loop_is_running (plugin->priv->loop));
+ if (!g_main_loop_is_running (plugin->priv->loop))
+ return;
g_main_loop_quit (plugin->priv->loop);
}
commit 736237694671ec8fd2b498e016d8d2cf0cd45cbc
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jul 11 14:55:05 2011 +0100
trivial: change the plugin API to be shorter and not use static variables
diff --git a/contrib/pk-plugin-external.c b/contrib/pk-plugin-external.c
index 455ab91..22acae8 100644
--- a/contrib/pk-plugin-external.c
+++ b/contrib/pk-plugin-external.c
@@ -42,46 +42,44 @@ libpk_plugin_external_la_CFLAGS = $(PK_PLUGIN_CFLAGS)
#include <stdlib.h>
#include <PackageKit/plugin/packagekit-plugin.h>
-typedef struct {
+struct PkPluginPrivate {
guint dummy;
-} PluginPrivate;
-
-static PluginPrivate *priv;
+};
/**
- * pk_transaction_plugin_get_description:
+ * pk_plugin_get_description:
*/
const gchar *
-pk_transaction_plugin_get_description (void)
+pk_plugin_get_description (void)
{
return "An external plugin that compiles outside of PK";
}
/**
- * pk_transaction_plugin_initialize:
+ * pk_plugin_initialize:
*/
void
-pk_transaction_plugin_initialize (PkTransaction *transaction)
+pk_plugin_initialize (PkPlugin *plugin)
{
/* create private area */
- priv = g_new0 (PluginPrivate, 1);
- priv->dummy = 999;
+ plugin->priv = PK_TRANSACTION_PLUGIN_GET_PRIVATE (PkPluginPrivate);
+ plugin->priv->dummy = 999;
}
/**
- * pk_transaction_plugin_destroy:
+ * pk_plugin_destroy:
*/
void
-pk_transaction_plugin_destroy (PkTransaction *transaction)
+pk_plugin_destroy (PkPlugin *plugin)
{
- g_free (priv);
}
/**
- * pk_transaction_plugin_run:
+ * pk_plugin_transaction_run:
*/
void
-pk_transaction_plugin_run (PkTransaction *transaction)
+pk_plugin_transaction_run (PkPlugin *plugin,
+ PkTransaction *transaction)
{
gboolean ret;
PkBackend *backend = NULL;
@@ -111,33 +109,37 @@ out:
}
/**
- * pk_transaction_plugin_started:
+ * pk_plugin_transaction_started:
*/
void
-pk_transaction_plugin_started (PkTransaction *transaction)
+pk_plugin_transaction_started (PkPlugin *plugin,
+ PkTransaction *transaction)
{
}
/**
- * pk_transaction_plugin_finished_start:
+ * pk_plugin_transaction_finished_start:
*/
void
-pk_transaction_plugin_finished_start (PkTransaction *transaction)
+pk_plugin_transaction_finished_start (PkPlugin *plugin,
+ PkTransaction *transaction)
{
}
/**
- * pk_transaction_plugin_finished_results:
+ * pk_plugin_transaction_finished_results:
*/
void
-pk_transaction_plugin_finished_results (PkTransaction *transaction)
+pk_plugin_transaction_finished_results (PkPlugin *plugin,
+ PkTransaction *transaction)
{
}
/**
- * pk_transaction_plugin_finished_end:
+ * pk_plugin_transaction_finished_end:
*/
void
-pk_transaction_plugin_finished_end (PkTransaction *transaction)
+pk_plugin_transaction_finished_end (PkPlugin *plugin,
+ PkTransaction *transaction)
{
}
diff --git a/src/Makefile.am b/src/Makefile.am
index 89c69e7..d69b851 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -47,6 +47,7 @@ plugininclude_HEADERS = \
packagekit-plugin.h \
pk-backend.h \
pk-conf.h \
+ pk-plugin.h \
pk-transaction.h
shared_SOURCES = \
diff --git a/src/packagekit-plugin.h b/src/packagekit-plugin.h
index b65f30b..f8f156a 100644
--- a/src/packagekit-plugin.h
+++ b/src/packagekit-plugin.h
@@ -29,7 +29,9 @@
#include <packagekit-glib2/packagekit.h>
#define __PACKAGEKIT_H_INSIDE__
+
#include <plugin/pk-backend.h>
+#include <plugin/pk-plugin.h>
#include <plugin/pk-transaction.h>
#undef __PACKAGEKIT_H_INSIDE__
diff --git a/src/pk-plugin.h b/src/pk-plugin.h
new file mode 100644
index 0000000..268f425
--- /dev/null
+++ b/src/pk-plugin.h
@@ -0,0 +1,61 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __PK_PLUGIN_H
+#define __PK_PLUGIN_H
+
+#include <glib-object.h>
+
+#include "pk-transaction.h"
+
+G_BEGIN_DECLS
+
+typedef struct PkPluginPrivate PkPluginPrivate;
+
+typedef struct {
+ GModule *module;
+ PkPluginPrivate *priv;
+} PkPlugin;
+
+#define PK_TRANSACTION_PLUGIN_GET_PRIVATE(x) g_new0 (x,1)
+
+typedef const gchar *(*PkPluginGetDescFunc) (void);
+typedef void (*PkPluginFunc) (PkPlugin *plugin);
+typedef void (*PkPluginTransactionFunc) (PkPlugin *plugin,
+ PkTransaction *transaction);
+
+const gchar *pk_plugin_get_description (void);
+void pk_plugin_initialize (PkPlugin *plugin);
+void pk_plugin_destroy (PkPlugin *plugin);
+void pk_plugin_transaction_run (PkPlugin *plugin,
+ PkTransaction *transaction);
+void pk_plugin_transaction_started (PkPlugin *plugin,
+ PkTransaction *transaction);
+void pk_plugin_transaction_finished_start (PkPlugin *plugin,
+ PkTransaction *transaction);
+void pk_plugin_transaction_finished_results (PkPlugin *plugin,
+ PkTransaction *transaction);
+void pk_plugin_transaction_finished_end (PkPlugin *plugin,
+ PkTransaction *transaction);
+
+G_END_DECLS
+
+#endif /* __PK_PLUGIN_H */
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 702034d..a25a144 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -54,19 +54,20 @@
#include "egg-string.h"
#include "egg-dbus-monitor.h"
-#include "pk-transaction.h"
-#include "pk-transaction-dbus.h"
-#include "pk-transaction-list.h"
-#include "pk-transaction-db.h"
-#include "pk-marshal.h"
#include "pk-backend.h"
-#include "pk-inhibit.h"
-#include "pk-conf.h"
-#include "pk-shared.h"
#include "pk-cache.h"
+#include "pk-conf.h"
+#include "pk-dbus.h"
+#include "pk-inhibit.h"
+#include "pk-marshal.h"
#include "pk-notify.h"
+#include "pk-plugin.h"
+#include "pk-shared.h"
#include "pk-syslog.h"
-#include "pk-dbus.h"
+#include "pk-transaction-db.h"
+#include "pk-transaction-dbus.h"
+#include "pk-transaction.h"
+#include "pk-transaction-list.h"
static void pk_transaction_finalize (GObject *object);
static void pk_transaction_dispose (GObject *object);
@@ -195,15 +196,15 @@ typedef enum {
} PkTransactionError;
typedef enum {
- PK_TRANSACTION_PLUGIN_PHASE_INIT, /* plugin started */
- PK_TRANSACTION_PLUGIN_PHASE_RUN, /* only this running */
- PK_TRANSACTION_PLUGIN_PHASE_STARTED, /* all signals connected */
- PK_TRANSACTION_PLUGIN_PHASE_FINISHED_START, /* finshed with all signals */
- PK_TRANSACTION_PLUGIN_PHASE_FINISHED_RESULTS, /* finished with some signals */
- PK_TRANSACTION_PLUGIN_PHASE_FINISHED_END, /* finished with no signals */
- PK_TRANSACTION_PLUGIN_PHASE_DESTROY, /* plugin finalized */
- PK_TRANSACTION_PLUGIN_PHASE_UNKNOWN
-} PkTransactionPluginPhase;
+ PK_PLUGIN_PHASE_INIT, /* plugin started */
+ PK_PLUGIN_PHASE_TRANSACTION_RUN, /* only this running */
+ PK_PLUGIN_PHASE_TRANSACTION_STARTED, /* all signals connected */
+ PK_PLUGIN_PHASE_TRANSACTION_FINISHED_START, /* finshed with all signals */
+ PK_PLUGIN_PHASE_TRANSACTION_FINISHED_RESULTS, /* finished with some signals */
+ PK_PLUGIN_PHASE_TRANSACTION_FINISHED_END, /* finished with no signals */
+ PK_PLUGIN_PHASE_DESTROY, /* plugin finalized */
+ PK_PLUGIN_PHASE_UNKNOWN
+} PkPluginPhase;
enum {
SIGNAL_DETAILS,
@@ -310,7 +311,8 @@ pk_transaction_load_plugin (PkTransaction *transaction,
{
gboolean ret;
GModule *module;
- PkTransactionPluginGetDescFunc plugin_desc = NULL;
+ PkPlugin *plugin;
+ PkPluginGetDescFunc plugin_desc = NULL;
module = g_module_open (filename,
0);
@@ -322,7 +324,7 @@ pk_transaction_load_plugin (PkTransaction *transaction,
/* get description */
ret = g_module_symbol (module,
- "pk_transaction_plugin_get_description",
+ "pk_plugin_get_description",
(gpointer *) &plugin_desc);
if (!ret) {
g_warning ("Plugin %s requires description",
@@ -332,12 +334,14 @@ pk_transaction_load_plugin (PkTransaction *transaction,
}
/* print what we know */
+ plugin = g_new0 (PkPlugin, 1);
+ plugin->module = module;
g_debug ("opened plugin %s: %s",
filename, plugin_desc ());
/* add to array */
g_ptr_array_add (transaction->priv->plugins,
- module);
+ plugin);
out:
return;
}
@@ -895,35 +899,45 @@ pk_transaction_get_state (PkTransaction *transaction)
**/
static void
pk_transaction_plugin_phase (PkTransaction *transaction,
- PkTransactionPluginPhase phase)
+ PkPluginPhase phase)
{
guint i;
const gchar *function = NULL;
- GModule *module;
gboolean ret;
- PkTransactionPluginFunc plugin_func = NULL;
+ gboolean use_transaction;
+ PkPluginFunc plugin_func = NULL;
+ PkPluginTransactionFunc plugin_trans_func = NULL;
+ gpointer func;
+ PkPlugin *plugin;
switch (phase) {
- case PK_TRANSACTION_PLUGIN_PHASE_INIT:
- function = "pk_transaction_plugin_initialize";
+ case PK_PLUGIN_PHASE_INIT:
+ function = "pk_plugin_initialize";
+ use_transaction = FALSE;
break;
- case PK_TRANSACTION_PLUGIN_PHASE_RUN:
- function = "pk_transaction_plugin_run";
+ case PK_PLUGIN_PHASE_TRANSACTION_RUN:
+ function = "pk_plugin_transaction_run";
+ use_transaction = TRUE;
break;
- case PK_TRANSACTION_PLUGIN_PHASE_STARTED:
- function = "pk_transaction_plugin_started";
+ case PK_PLUGIN_PHASE_TRANSACTION_STARTED:
+ function = "pk_plugin_transaction_started";
+ use_transaction = TRUE;
break;
- case PK_TRANSACTION_PLUGIN_PHASE_FINISHED_START:
- function = "pk_transaction_plugin_finished_start";
+ case PK_PLUGIN_PHASE_TRANSACTION_FINISHED_START:
+ function = "pk_plugin_transaction_finished_start";
+ use_transaction = TRUE;
break;
- case PK_TRANSACTION_PLUGIN_PHASE_FINISHED_RESULTS:
- function = "pk_transaction_plugin_finished_results";
+ case PK_PLUGIN_PHASE_TRANSACTION_FINISHED_RESULTS:
+ function = "pk_plugin_transaction_finished_results";
+ use_transaction = TRUE;
break;
- case PK_TRANSACTION_PLUGIN_PHASE_FINISHED_END:
- function = "pk_transaction_plugin_finished_end";
+ case PK_PLUGIN_PHASE_TRANSACTION_FINISHED_END:
+ function = "pk_plugin_transaction_finished_end";
+ use_transaction = TRUE;
break;
- case PK_TRANSACTION_PLUGIN_PHASE_DESTROY:
- function = "pk_transaction_plugin_destroy";
+ case PK_PLUGIN_PHASE_DESTROY:
+ function = "pk_plugin_destroy";
+ use_transaction = FALSE;
break;
default:
break;
@@ -933,16 +947,23 @@ pk_transaction_plugin_phase (PkTransaction *transaction,
/* run each plugin */
for (i=0; i<transaction->priv->plugins->len; i++) {
- module = g_ptr_array_index (transaction->priv->plugins, i);
- ret = g_module_symbol (module,
+ plugin = g_ptr_array_index (transaction->priv->plugins, i);
+ ret = g_module_symbol (plugin->module,
function,
- (gpointer *) &plugin_func);
+ &func);
if (!ret)
continue;
+
g_debug ("run %s on %s",
function,
- g_module_name (module));
- plugin_func (transaction);
+ g_module_name (plugin->module));
+ if (!use_transaction) {
+ plugin_func = (PkPluginFunc) func;
+ plugin_func (plugin);
+ } else {
+ plugin_trans_func = (PkPluginTransactionFunc) func;
+ plugin_trans_func (plugin, transaction);
+ }
}
}
@@ -1025,7 +1046,7 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
/* run the plugins */
pk_transaction_plugin_phase (transaction,
- PK_TRANSACTION_PLUGIN_PHASE_FINISHED_START);
+ PK_PLUGIN_PHASE_TRANSACTION_FINISHED_START);
/* disconnect these straight away */
g_signal_handler_disconnect (transaction->priv->backend,
@@ -1057,7 +1078,7 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
/* run the plugins */
pk_transaction_plugin_phase (transaction,
- PK_TRANSACTION_PLUGIN_PHASE_FINISHED_RESULTS);
+ PK_PLUGIN_PHASE_TRANSACTION_FINISHED_RESULTS);
/* signals we are not allowed to send from the second phase post transaction */
g_signal_handler_disconnect (transaction->priv->backend,
@@ -1073,7 +1094,7 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
/* run the plugins */
pk_transaction_plugin_phase (transaction,
- PK_TRANSACTION_PLUGIN_PHASE_FINISHED_END);
+ PK_PLUGIN_PHASE_TRANSACTION_FINISHED_END);
/* save this so we know if the cache is valid */
pk_results_set_exit_code (transaction->priv->results, exit_enum);
@@ -1797,7 +1818,7 @@ pk_transaction_run (PkTransaction *transaction)
/* run the plugins */
pk_transaction_plugin_phase (transaction,
- PK_TRANSACTION_PLUGIN_PHASE_RUN);
+ PK_PLUGIN_PHASE_TRANSACTION_RUN);
/* is an error code set? */
if (pk_backend_get_is_error_set (priv->backend)) {
@@ -1875,7 +1896,7 @@ pk_transaction_run (PkTransaction *transaction)
/* run the plugins */
pk_transaction_plugin_phase (transaction,
- PK_TRANSACTION_PLUGIN_PHASE_STARTED);
+ PK_PLUGIN_PHASE_TRANSACTION_STARTED);
/* is an error code set? */
if (pk_backend_get_is_error_set (priv->backend)) {
@@ -5547,6 +5568,17 @@ pk_transaction_setup_mime_types (PkTransaction *transaction)
}
/**
+ * pk_transaction_plugin_free:
+ **/
+static void
+pk_transaction_plugin_free (PkPlugin *plugin)
+{
+ g_free (plugin->priv);
+ g_module_close (plugin->module);
+ g_free (plugin);
+}
+
+/**
* pk_transaction_get_property:
**/
static void
@@ -5888,12 +5920,12 @@ pk_transaction_init (PkTransaction *transaction)
pk_transaction_setup_mime_types (transaction);
/* get plugins */
- transaction->priv->plugins = g_ptr_array_new_with_free_func ((GDestroyNotify) g_module_close);
+ transaction->priv->plugins = g_ptr_array_new_with_free_func ((GDestroyNotify) pk_transaction_plugin_free);
pk_transaction_load_plugins (transaction);
/* initialize plugins */
pk_transaction_plugin_phase (transaction,
- PK_TRANSACTION_PLUGIN_PHASE_INIT);
+ PK_PLUGIN_PHASE_INIT);
}
@@ -5943,7 +5975,7 @@ pk_transaction_finalize (GObject *object)
/* run the plugins */
pk_transaction_plugin_phase (transaction,
- PK_TRANSACTION_PLUGIN_PHASE_DESTROY);
+ PK_PLUGIN_PHASE_DESTROY);
#ifdef USE_SECURITY_POLKIT
if (transaction->priv->subject != NULL)
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index be0659f..39b1d01 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -90,18 +90,6 @@ const gchar *pk_transaction_get_tid (PkTransaction *transaction);
void pk_transaction_add_supported_mime_type (PkTransaction *transaction,
const gchar *mime_type);
-/* plugin support */
-typedef const gchar *(*PkTransactionPluginGetDescFunc) (void);
-typedef void (*PkTransactionPluginFunc) (PkTransaction *transaction);
-const gchar *pk_transaction_plugin_get_description (void);
-void pk_transaction_plugin_initialize (PkTransaction *transaction);
-void pk_transaction_plugin_destroy (PkTransaction *transaction);
-void pk_transaction_plugin_run (PkTransaction *transaction);
-void pk_transaction_plugin_started (PkTransaction *transaction);
-void pk_transaction_plugin_finished_start (PkTransaction *transaction);
-void pk_transaction_plugin_finished_results (PkTransaction *transaction);
-void pk_transaction_plugin_finished_end (PkTransaction *transaction);
-
G_END_DECLS
#endif /* __PK_TRANSACTION_H */
diff --git a/src/plugins/pk-plugin-check-shared-libraries-in-use.c b/src/plugins/pk-plugin-check-shared-libraries-in-use.c
index 9a74c95..d8f7530 100644
--- a/src/plugins/pk-plugin-check-shared-libraries-in-use.c
+++ b/src/plugins/pk-plugin-check-shared-libraries-in-use.c
@@ -24,7 +24,7 @@
#include <string.h>
#include <stdlib.h>
-#include <pk-transaction.h>
+#include <pk-plugin.h>
#include "pk-cache.h"
#include "pk-lsof.h"
@@ -32,52 +32,49 @@
/* for when parsing /etc/login.defs fails */
#define PK_TRANSACTION_EXTRA_UID_MIN_DEFALT 500
-typedef struct {
+struct PkPluginPrivate {
GMainLoop *loop;
GPtrArray *list;
GPtrArray *pids;
GPtrArray *files_list;
PkLsof *lsof;
-} PluginPrivate;
-
-static PluginPrivate *priv;
+};
/**
- * pk_transaction_plugin_get_description:
+ * pk_plugin_get_description:
*/
const gchar *
-pk_transaction_plugin_get_description (void)
+pk_plugin_get_description (void)
{
return "checks for any shared libraries in use after a security update";
}
/**
- * pk_transaction_plugin_initialize:
+ * pk_plugin_initialize:
*/
void
-pk_transaction_plugin_initialize (PkTransaction *transaction)
+pk_plugin_initialize (PkPlugin *plugin)
{
/* create private area */
- priv = g_new0 (PluginPrivate, 1);
- priv->loop = g_main_loop_new (NULL, FALSE);
- priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
- priv->files_list = g_ptr_array_new_with_free_func (g_free);
- priv->lsof = pk_lsof_new ();
+ plugin->priv = PK_TRANSACTION_PLUGIN_GET_PRIVATE (PkPluginPrivate);
+ plugin->priv->loop = g_main_loop_new (NULL, FALSE);
+ plugin->priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+ plugin->priv->files_list = g_ptr_array_new_with_free_func (g_free);
+ plugin->priv->lsof = pk_lsof_new ();
}
/**
- * pk_transaction_plugin_destroy:
+ * pk_plugin_destroy:
*/
void
-pk_transaction_plugin_destroy (PkTransaction *transaction)
+pk_plugin_destroy (PkPlugin *plugin)
{
- g_main_loop_unref (priv->loop);
- g_ptr_array_unref (priv->list);
- g_object_unref (priv->lsof);
- g_ptr_array_unref (priv->files_list);
- if (priv->pids != NULL)
- g_ptr_array_free (priv->pids, TRUE);
- g_free (priv);
+ g_main_loop_unref (plugin->priv->loop);
+ g_ptr_array_unref (plugin->priv->list);
+ g_object_unref (plugin->priv->lsof);
+ g_ptr_array_unref (plugin->priv->files_list);
+ if (plugin->priv->pids != NULL)
+ g_ptr_array_free (plugin->priv->pids, TRUE);
}
/**
@@ -86,23 +83,18 @@ pk_transaction_plugin_destroy (PkTransaction *transaction)
static void
pk_plugin_finished_cb (PkBackend *backend,
PkExitEnum exit_enum,
- gpointer user_data)
+ PkPlugin *plugin)
{
- if (!g_main_loop_is_running (priv->loop))
- return;
- if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
- g_warning ("%s failed with exit code: %s",
- pk_role_enum_to_string (pk_backend_get_role (backend)),
- pk_exit_enum_to_string (exit_enum));
- }
- g_main_loop_quit (priv->loop);
+ g_assert (g_main_loop_is_running (plugin->priv->loop));
+ g_main_loop_quit (plugin->priv->loop);
}
/**
* pk_plugin_get_installed_package_for_file:
**/
static PkPackage *
-pk_plugin_get_installed_package_for_file (PkTransaction *transaction,
+pk_plugin_get_installed_package_for_file (PkPlugin *plugin,
+ PkTransaction *transaction,
const gchar *filename)
{
PkPackage *package = NULL;
@@ -110,7 +102,7 @@ pk_plugin_get_installed_package_for_file (PkTransaction *transaction,
PkBackend *backend;
/* use PK to find the correct package */
- g_ptr_array_set_size (priv->list, 0);
+ g_ptr_array_set_size (plugin->priv->list, 0);
backend = pk_transaction_get_backend (transaction);
pk_backend_reset (backend);
filenames = g_strsplit (filename, "|||", -1);
@@ -119,16 +111,16 @@ pk_plugin_get_installed_package_for_file (PkTransaction *transaction,
filenames);
/* wait for finished */
- g_main_loop_run (priv->loop);
+ g_main_loop_run (plugin->priv->loop);
/* check that we only matched one package */
- if (priv->list->len != 1) {
- g_warning ("not correct size, %i", priv->list->len);
+ if (plugin->priv->list->len != 1) {
+ g_warning ("not correct size, %i", plugin->priv->list->len);
goto out;
}
/* get the package */
- package = g_ptr_array_index (priv->list, 0);
+ package = g_ptr_array_index (plugin->priv->list, 0);
if (package == NULL) {
g_warning ("cannot get package");
goto out;
@@ -144,7 +136,7 @@ out:
static void
pk_plugin_files_cb (PkBackend *backend,
PkFiles *files,
- PkTransaction *transaction)
+ PkPlugin *plugin)
{
guint i;
guint len;
@@ -168,7 +160,7 @@ pk_plugin_files_cb (PkBackend *backend,
/* add as it matches the criteria */
g_debug ("adding filename %s", filenames[i]);
- g_ptr_array_add (priv->files_list,
+ g_ptr_array_add (plugin->priv->files_list,
g_strdup (filenames[i]));
}
g_strfreev (filenames);
@@ -268,7 +260,7 @@ out:
}
/**
- * pk_transaction_plugin_run:
+ * pk_plugin_transaction_run:
*
* This function does the following things:
* 1) Refreshes the list of open files
@@ -279,7 +271,8 @@ out:
* 6) For each package, emit a RequireRestart of the correct type (according to the UID)
*/
void
-pk_transaction_plugin_run (PkTransaction *transaction)
+pk_plugin_transaction_run (PkPlugin *plugin,
+ PkTransaction *transaction)
{
gboolean ret;
gchar **files = NULL;
@@ -321,9 +314,9 @@ pk_transaction_plugin_run (PkTransaction *transaction)
goto out;
}
files_id = g_signal_connect (backend, "files",
- G_CALLBACK (pk_plugin_files_cb), NULL);
+ G_CALLBACK (pk_plugin_files_cb), plugin);
finished_id = g_signal_connect (backend, "finished",
- G_CALLBACK (pk_plugin_finished_cb), NULL);
+ G_CALLBACK (pk_plugin_finished_cb), plugin);
/* do we have a cache */
cache = pk_cache_new ();
@@ -391,11 +384,11 @@ pk_transaction_plugin_run (PkTransaction *transaction)
}
/* reset */
- g_ptr_array_set_size (priv->files_list, 0);
+ g_ptr_array_set_size (plugin->priv->files_list, 0);
- if (priv->pids != NULL) {
- g_ptr_array_free (priv->pids, TRUE);
- priv->pids = NULL;
+ if (plugin->priv->pids != NULL) {
+ g_ptr_array_free (plugin->priv->pids, TRUE);
+ plugin->priv->pids = NULL;
}
/* set status */
@@ -403,7 +396,7 @@ pk_transaction_plugin_run (PkTransaction *transaction)
pk_backend_set_percentage (backend, 101);
/* get list from lsof */
- ret = pk_lsof_refresh (priv->lsof);
+ ret = pk_lsof_refresh (plugin->priv->lsof);
if (!ret) {
g_warning ("failed to refresh");
goto out;
@@ -415,26 +408,26 @@ pk_transaction_plugin_run (PkTransaction *transaction)
pk_backend_get_files (backend, package_ids_security);
/* wait for finished */
- g_main_loop_run (priv->loop);
+ g_main_loop_run (plugin->priv->loop);
/* nothing to do */
- if (priv->files_list->len == 0) {
+ if (plugin->priv->files_list->len == 0) {
g_debug ("no files");
goto out;
}
/* get the list of PIDs */
- files = pk_ptr_array_to_strv (priv->files_list);
- priv->pids = pk_lsof_get_pids_for_filenames (priv->lsof, files);
+ files = pk_ptr_array_to_strv (plugin->priv->files_list);
+ plugin->priv->pids = pk_lsof_get_pids_for_filenames (plugin->priv->lsof, files);
/* nothing depends on these libraries */
- if (priv->pids == NULL) {
+ if (plugin->priv->pids == NULL) {
g_warning ("failed to get process list");
goto out;
}
/* nothing depends on these libraries */
- if (priv->pids->len == 0) {
+ if (plugin->priv->pids->len == 0) {
g_debug ("no processes depend on these libraries");
goto out;
}
@@ -457,10 +450,11 @@ out:
}
/**
- * pk_transaction_plugin_finished_results:
+ * pk_plugin_transaction_finished_results:
*/
void
-pk_transaction_plugin_finished_results (PkTransaction *transaction)
+pk_plugin_transaction_finished_results (PkPlugin *plugin,
+ PkTransaction *transaction)
{
gboolean ret;
PkBackend *backend = NULL;
@@ -502,7 +496,7 @@ pk_transaction_plugin_finished_results (PkTransaction *transaction)
files_system = g_ptr_array_new_with_free_func (g_free);
/* get local array */
- pids = priv->pids;
+ pids = plugin->priv->pids;
if (pids == NULL)
goto out;
@@ -552,7 +546,8 @@ pk_transaction_plugin_finished_results (PkTransaction *transaction)
for (i=0; i<files_session->len; i++) {
filename = g_ptr_array_index (files_session, i);
- package = pk_plugin_get_installed_package_for_file (transaction,
+ package = pk_plugin_get_installed_package_for_file (plugin,
+ transaction,
filename);
if (package == NULL) {
g_debug ("failed to find package for %s", filename);
@@ -567,7 +562,8 @@ pk_transaction_plugin_finished_results (PkTransaction *transaction)
for (i=0; i<files_system->len; i++) {
filename = g_ptr_array_index (files_system, i);
- package = pk_plugin_get_installed_package_for_file (transaction,
+ package = pk_plugin_get_installed_package_for_file (plugin,
+ transaction,
filename);
if (package == NULL) {
g_debug ("failed to find package for %s", filename);
diff --git a/src/plugins/pk-plugin-clear-firmware-requests.c b/src/plugins/pk-plugin-clear-firmware-requests.c
index 45b5593..8b4216a 100644
--- a/src/plugins/pk-plugin-clear-firmware-requests.c
+++ b/src/plugins/pk-plugin-clear-firmware-requests.c
@@ -21,24 +21,25 @@
#include <config.h>
#include <gio/gio.h>
+#include <pk-plugin.h>
-#include "pk-transaction.h"
#include "pk-shared.h"
/**
- * pk_transaction_plugin_get_description:
+ * pk_plugin_get_description:
*/
const gchar *
-pk_transaction_plugin_get_description (void)
+pk_plugin_get_description (void)
{
return "Clears firmware requests";
}
/**
- * pk_transaction_plugin_finished_end:
+ * pk_plugin_transaction_finished_end:
*/
void
-pk_transaction_plugin_finished_end (PkTransaction *transaction)
+pk_plugin_transaction_finished_end (PkPlugin *plugin,
+ PkTransaction *transaction)
{
gboolean ret;
gchar *filename = NULL;
diff --git a/src/plugins/pk-plugin-example.c b/src/plugins/pk-plugin-example.c
index 7eb6708..7e35152 100644
--- a/src/plugins/pk-plugin-example.c
+++ b/src/plugins/pk-plugin-example.c
@@ -21,48 +21,47 @@
#include <config.h>
#include <gio/gio.h>
-#include <pk-transaction.h>
+#include <pk-plugin.h>
-typedef struct {
+struct PkPluginPrivate {
guint dummy;
-} PluginPrivate;
-
-static PluginPrivate *priv;
+};
/**
- * pk_transaction_plugin_get_description:
+ * pk_plugin_get_description:
*/
const gchar *
-pk_transaction_plugin_get_description (void)
+pk_plugin_get_description (void)
{
return "A dummy plugin that doesn't do anything";
}
/**
- * pk_transaction_plugin_initialize:
+ * pk_plugin_initialize:
*/
void
-pk_transaction_plugin_initialize (PkTransaction *transaction)
+pk_plugin_initialize (PkPlugin *plugin)
{
/* create private area */
- priv = g_new0 (PluginPrivate, 1);
- priv->dummy = 999;
+ plugin->priv = PK_TRANSACTION_PLUGIN_GET_PRIVATE (PkPluginPrivate);
+ plugin->priv->dummy = 999;
}
/**
- * pk_transaction_plugin_destroy:
+ * pk_plugin_destroy:
*/
void
-pk_transaction_plugin_destroy (PkTransaction *transaction)
+pk_plugin_destroy (PkPlugin *plugin)
{
- g_free (priv);
+ plugin->priv->dummy = 0;
}
/**
- * pk_transaction_plugin_run:
+ * pk_plugin_transaction_run:
*/
void
-pk_transaction_plugin_run (PkTransaction *transaction)
+pk_plugin_transaction_run (PkPlugin *plugin,
+ PkTransaction *transaction)
{
gboolean ret;
PkBackend *backend = NULL;
@@ -92,33 +91,37 @@ out:
}
/**
- * pk_transaction_plugin_started:
+ * pk_plugin_transaction_started:
*/
void
-pk_transaction_plugin_started (PkTransaction *transaction)
+pk_plugin_transaction_started (PkPlugin *plugin,
+ PkTransaction *transaction)
{
}
/**
- * pk_transaction_plugin_finished_start:
+ * pk_plugin_transaction_finished_start:
*/
void
-pk_transaction_plugin_finished_start (PkTransaction *transaction)
+pk_plugin_transaction_finished_start (PkPlugin *plugin,
+ PkTransaction *transaction)
{
}
/**
- * pk_transaction_plugin_finished_results:
+ * pk_plugin_transaction_finished_results:
*/
void
-pk_transaction_plugin_finished_results (PkTransaction *transaction)
+pk_plugin_transaction_finished_results (PkPlugin *plugin,
+ PkTransaction *transaction)
{
}
/**
- * pk_transaction_plugin_finished_end:
+ * pk_plugin_transaction_finished_end:
*/
void
-pk_transaction_plugin_finished_end (PkTransaction *transaction)
+pk_plugin_transaction_finished_end (PkPlugin *plugin,
+ PkTransaction *transaction)
{
}
diff --git a/src/plugins/pk-plugin-no-update-process.c b/src/plugins/pk-plugin-no-update-process.c
index 2039f07..bbcaae7 100644
--- a/src/plugins/pk-plugin-no-update-process.c
+++ b/src/plugins/pk-plugin-no-update-process.c
@@ -21,27 +21,25 @@
#include <config.h>
#include <gio/gio.h>
-#include <pk-transaction.h>
+#include <pk-plugin.h>
#include <packagekit-glib2/pk-package.h>
#include <packagekit-glib2/pk-files.h>
#include "pk-proc.h"
-typedef struct {
+struct PkPluginPrivate {
GMainLoop *loop;
GPtrArray *files_list;
- gchar **no_update_process_list;
+ gchar **no_update;
PkProc *proc;
-} PluginPrivate;
-
-static PluginPrivate *priv;
+};
/**
- * pk_transaction_plugin_get_description:
+ * pk_plugin_get_description:
*/
const gchar *
-pk_transaction_plugin_get_description (void)
+pk_plugin_get_description (void)
{
return "Updates the package lists after refresh";
}
@@ -52,48 +50,35 @@ pk_transaction_plugin_get_description (void)
static void
pk_plugin_finished_cb (PkBackend *backend,
PkExitEnum exit_enum,
- gpointer user_data)
+ PkPlugin *plugin)
{
- if (!g_main_loop_is_running (priv->loop))
- return;
- if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
- g_warning ("%s failed with exit code: %s",
- pk_role_enum_to_string (pk_backend_get_role (backend)),
- pk_exit_enum_to_string (exit_enum));
- }
- g_main_loop_quit (priv->loop);
+ g_assert (g_main_loop_is_running (plugin->priv->loop));
+ g_main_loop_quit (plugin->priv->loop);
}
/**
- * pk_transaction_plugin_initialize:
+ * pk_plugin_initialize:
*/
void
-pk_transaction_plugin_initialize (PkTransaction *transaction)
+pk_plugin_initialize (PkPlugin *plugin)
{
- PkConf *conf;
-
/* create private area */
- priv = g_new0 (PluginPrivate, 1);
- priv->loop = g_main_loop_new (NULL, FALSE);
- priv->files_list = g_ptr_array_new_with_free_func (g_free);
- priv->proc = pk_proc_new ();
-
- /* get the list of processes we should neverupdate when running */
- conf = pk_transaction_get_conf (transaction);
- priv->no_update_process_list = pk_conf_get_strv (conf, "NoUpdateProcessList");
+ plugin->priv = PK_TRANSACTION_PLUGIN_GET_PRIVATE (PkPluginPrivate);
+ plugin->priv->loop = g_main_loop_new (NULL, FALSE);
+ plugin->priv->files_list = g_ptr_array_new_with_free_func (g_free);
+ plugin->priv->proc = pk_proc_new ();
}
/**
- * pk_transaction_plugin_destroy:
+ * pk_plugin_destroy:
*/
void
-pk_transaction_plugin_destroy (PkTransaction *transaction)
+pk_plugin_destroy (PkPlugin *plugin)
{
- g_main_loop_unref (priv->loop);
- g_strfreev (priv->no_update_process_list);
- g_ptr_array_unref (priv->files_list);
- g_object_unref (priv->proc);
- g_free (priv);
+ g_main_loop_unref (plugin->priv->loop);
+ g_strfreev (plugin->priv->no_update);
+ g_ptr_array_unref (plugin->priv->files_list);
+ g_object_unref (plugin->priv->proc);
}
/**
@@ -102,21 +87,21 @@ pk_transaction_plugin_destroy (PkTransaction *transaction)
* Only if the pattern matches the old and new names we refuse to run
**/
static gboolean
-pk_plugin_match_running_file (gpointer user_data, const gchar *filename)
+pk_plugin_match_running_file (PkPlugin *plugin, const gchar *filename)
{
guint i;
gchar **list;
gboolean ret;
/* compare each pattern */
- list = priv->no_update_process_list;
+ list = plugin->priv->no_update;
for (i=0; list[i] != NULL; i++) {
/* does the package filename match */
ret = g_pattern_match_simple (list[i], filename);
if (ret) {
/* is there a running process that also matches */
- ret = pk_proc_find_exec (priv->proc, list[i]);
+ ret = pk_proc_find_exec (plugin->priv->proc, list[i]);
if (ret)
goto out;
}
@@ -134,7 +119,7 @@ out:
static void
pk_plugin_files_cb (PkBackend *backend,
PkFiles *files,
- gpointer user_data)
+ PkPlugin *plugin)
{
guint i;
guint len;
@@ -152,22 +137,23 @@ pk_plugin_files_cb (PkBackend *backend,
for (i=0; i<len; i++) {
/* does the package filename match */
- ret = pk_plugin_match_running_file (backend, filenames[i]);
+ ret = pk_plugin_match_running_file (plugin, filenames[i]);
if (!ret)
continue;
/* add as it matches the criteria */
g_debug ("adding filename %s", filenames[i]);
- g_ptr_array_add (priv->files_list, g_strdup (filenames[i]));
+ g_ptr_array_add (plugin->priv->files_list, g_strdup (filenames[i]));
}
g_strfreev (filenames);
}
/**
- * pk_transaction_plugin_run:
+ * pk_plugin_transaction_run:
*/
void
-pk_transaction_plugin_run (PkTransaction *transaction)
+pk_plugin_transaction_run (PkPlugin *plugin,
+ PkTransaction *transaction)
{
const gchar *file;
gboolean ret;
@@ -177,6 +163,7 @@ pk_transaction_plugin_run (PkTransaction *transaction)
guint files_id = 0;
guint finished_id = 0;
PkBackend *backend = NULL;
+ PkConf *conf;
PkRoleEnum role;
/* check the role */
@@ -192,22 +179,28 @@ pk_transaction_plugin_run (PkTransaction *transaction)
goto out;
}
+ /* get the list of processes we should neverupdate when running */
+ conf = pk_transaction_get_conf (transaction);
+ if (plugin->priv->no_update == NULL) {
+ plugin->priv->no_update = pk_conf_get_strv (conf, "NoUpdateProcessList");
+ }
+
/* check we have entry */
- if (priv->no_update_process_list == NULL ||
- priv->no_update_process_list[0] == NULL) {
+ if (plugin->priv->no_update == NULL ||
+ plugin->priv->no_update[0] == NULL) {
g_debug ("no processes to watch");
goto out;
}
/* reset */
- g_ptr_array_set_size (priv->files_list, 0);
+ g_ptr_array_set_size (plugin->priv->files_list, 0);
/* set status */
pk_backend_set_status (backend, PK_STATUS_ENUM_SCAN_PROCESS_LIST);
pk_backend_set_percentage (backend, 101);
/* get list from proc */
- ret = pk_proc_refresh (priv->proc);
+ ret = pk_proc_refresh (plugin->priv->proc);
if (!ret) {
g_warning ("failed to refresh");
/* non-fatal */
@@ -218,9 +211,9 @@ pk_transaction_plugin_run (PkTransaction *transaction)
pk_backend_set_status (backend, PK_STATUS_ENUM_CHECK_EXECUTABLE_FILES);
files_id = g_signal_connect (backend, "files",
- G_CALLBACK (pk_plugin_files_cb), NULL);
+ G_CALLBACK (pk_plugin_files_cb), plugin);
finished_id = g_signal_connect (backend, "finished",
- G_CALLBACK (pk_plugin_finished_cb), NULL);
+ G_CALLBACK (pk_plugin_finished_cb), plugin);
/* get all the files touched in the packages we just updated */
package_ids = pk_transaction_get_package_ids (transaction);
@@ -228,12 +221,12 @@ pk_transaction_plugin_run (PkTransaction *transaction)
pk_backend_get_files (backend, package_ids);
/* wait for finished */
- g_main_loop_run (priv->loop);
+ g_main_loop_run (plugin->priv->loop);
pk_backend_set_percentage (backend, 100);
/* there is a file we can't COW */
- if (priv->files_list->len != 0) {
- file = g_ptr_array_index (priv->files_list, 0);
+ if (plugin->priv->files_list->len != 0) {
+ file = g_ptr_array_index (plugin->priv->files_list, 0);
pk_backend_error_code (backend,
PK_ERROR_ENUM_UPDATE_FAILED_DUE_TO_RUNNING_PROCESS,
"failed to run as %s is running", file);
diff --git a/src/plugins/pk-plugin-scan-desktop-files.c b/src/plugins/pk-plugin-scan-desktop-files.c
index b30bb97..d521280 100644
--- a/src/plugins/pk-plugin-scan-desktop-files.c
+++ b/src/plugins/pk-plugin-scan-desktop-files.c
@@ -22,26 +22,25 @@
#include <config.h>
#include <gio/gdesktopappinfo.h>
#include <gio/gio.h>
-#include <pk-transaction.h>
+#include <pk-plugin.h>
#include <sqlite3.h>
#include <packagekit-glib2/pk-desktop.h>
#include <packagekit-glib2/pk-package.h>
-typedef struct {
+struct PkPluginPrivate {
sqlite3 *db;
GPtrArray *list;
GMainLoop *loop;
GHashTable *hash;
-} PluginPrivate;
-
-static PluginPrivate *priv;
+ PkBackend *backend;
+};
/**
- * pk_transaction_plugin_get_description:
+ * pk_plugin_get_description:
*/
const gchar *
-pk_transaction_plugin_get_description (void)
+pk_plugin_get_description (void)
{
return "Scans desktop files on refresh and adds them to a database";
}
@@ -52,9 +51,9 @@ pk_transaction_plugin_get_description (void)
static void
pk_plugin_package_cb (PkBackend *backend,
PkPackage *package,
- gpointer user_data)
+ PkPlugin *plugin)
{
- g_ptr_array_add (priv->list, g_object_ref (package));
+ g_ptr_array_add (plugin->priv->list, g_object_ref (package));
}
/**
@@ -63,93 +62,40 @@ pk_plugin_package_cb (PkBackend *backend,
static void
pk_plugin_finished_cb (PkBackend *backend,
PkExitEnum exit_enum,
- gpointer user_data)
+ PkPlugin *plugin)
{
- if (!g_main_loop_is_running (priv->loop))
- return;
+ g_assert (g_main_loop_is_running (plugin->priv->loop));
if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
g_warning ("%s failed with exit code: %s",
pk_role_enum_to_string (pk_backend_get_role (backend)),
pk_exit_enum_to_string (exit_enum));
}
- g_main_loop_quit (priv->loop);
+ g_main_loop_quit (plugin->priv->loop);
}
/**
- * pk_transaction_plugin_initialize:
+ * pk_plugin_initialize:
*/
void
-pk_transaction_plugin_initialize (PkTransaction *transaction)
+pk_plugin_initialize (PkPlugin *plugin)
{
- const gchar *statement_create;
- gboolean ret;
- gchar *error_msg = NULL;
- gint rc;
- PkConf *conf;
-
/* create private area */
- priv = g_new0 (PluginPrivate, 1);
- priv->loop = g_main_loop_new (NULL, FALSE);
- priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
- priv->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-
- /* check the config file */
- conf = pk_transaction_get_conf (transaction);
- ret = pk_conf_get_bool (conf, "ScanDesktopFiles");
- if (!ret)
- goto out;
-
- /* check if database exists */
- ret = g_file_test (PK_DESKTOP_DEFAULT_DATABASE,
- G_FILE_TEST_EXISTS);
-
- g_debug ("trying to open database '%s'",
- PK_DESKTOP_DEFAULT_DATABASE);
- rc = sqlite3_open (PK_DESKTOP_DEFAULT_DATABASE, &priv->db);
- if (rc != 0) {
- g_warning ("Can't open desktop database: %s\n",
- sqlite3_errmsg (priv->db));
- sqlite3_close (priv->db);
- priv->db = NULL;
- goto out;
- }
-
- /* create if not exists */
- if (!ret) {
- g_debug ("creating database cache in %s",
- PK_DESKTOP_DEFAULT_DATABASE);
- statement_create = "CREATE TABLE cache ("
- "filename TEXT,"
- "package TEXT,"
- "show INTEGER,"
- "md5 TEXT);";
- rc = sqlite3_exec (priv->db, statement_create,
- NULL, NULL, &error_msg);
- if (rc != SQLITE_OK) {
- g_warning ("SQL error: %s\n", error_msg);
- sqlite3_free (error_msg);
- goto out;
- }
- }
-
- /* we don't need to keep syncing */
- sqlite3_exec (priv->db, "PRAGMA synchronous=OFF", NULL, NULL, NULL);
-
-out:
- return;
+ plugin->priv = PK_TRANSACTION_PLUGIN_GET_PRIVATE (PkPluginPrivate);
+ plugin->priv->loop = g_main_loop_new (NULL, FALSE);
+ plugin->priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+ plugin->priv->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
}
/**
- * pk_transaction_plugin_destroy:
+ * pk_plugin_destroy:
*/
void
-pk_transaction_plugin_destroy (PkTransaction *transaction)
+pk_plugin_destroy (PkPlugin *plugin)
{
- g_ptr_array_unref (priv->list);
- g_main_loop_unref (priv->loop);
- g_hash_table_unref (priv->hash);
- sqlite3_close (priv->db);
- g_free (priv);
+ g_ptr_array_unref (plugin->priv->list);
+ g_main_loop_unref (plugin->priv->loop);
+ g_hash_table_unref (plugin->priv->hash);
+ sqlite3_close (plugin->priv->db);
}
/**
@@ -191,7 +137,7 @@ out:
* pk_plugin_sqlite_remove_filename:
**/
static gint
-pk_plugin_sqlite_remove_filename (PkTransaction *transaction,
+pk_plugin_sqlite_remove_filename (PkPlugin *plugin,
const gchar *filename)
{
gchar *statement;
@@ -199,7 +145,7 @@ pk_plugin_sqlite_remove_filename (PkTransaction *transaction,
statement = g_strdup_printf ("DELETE FROM cache WHERE filename = '%s'",
filename);
- rc = sqlite3_exec (priv->db, statement, NULL, NULL, NULL);
+ rc = sqlite3_exec (plugin->priv->db, statement, NULL, NULL, NULL);
g_free (statement);
return rc;
}
@@ -208,35 +154,33 @@ pk_plugin_sqlite_remove_filename (PkTransaction *transaction,
* pk_plugin_get_installed_package_for_file:
**/
static PkPackage *
-pk_plugin_get_installed_package_for_file (PkTransaction *transaction,
+pk_plugin_get_installed_package_for_file (PkPlugin *plugin,
const gchar *filename)
{
PkPackage *package = NULL;
gchar **filenames;
- PkBackend *backend = NULL;
/* use PK to find the correct package */
- if (priv->list->len > 0)
- g_ptr_array_set_size (priv->list, 0);
- backend = pk_transaction_get_backend (transaction);
- pk_backend_reset (backend);
+ if (plugin->priv->list->len > 0)
+ g_ptr_array_set_size (plugin->priv->list, 0);
+ pk_backend_reset (plugin->priv->backend);
filenames = g_strsplit (filename, "|||", -1);
- pk_backend_search_files (backend,
+ pk_backend_search_files (plugin->priv->backend,
pk_bitfield_value (PK_FILTER_ENUM_INSTALLED),
filenames);
g_strfreev (filenames);
/* wait for finished */
- g_main_loop_run (priv->loop);
+ g_main_loop_run (plugin->priv->loop);
/* check that we only matched one package */
- if (priv->list->len != 1) {
- g_warning ("not correct size, %i", priv->list->len);
+ if (plugin->priv->list->len != 1) {
+ g_warning ("not correct size, %i", plugin->priv->list->len);
goto out;
}
/* get the package */
- package = g_ptr_array_index (priv->list, 0);
+ package = g_ptr_array_index (plugin->priv->list, 0);
if (package == NULL) {
g_warning ("cannot get package");
goto out;
@@ -249,7 +193,7 @@ out:
* pk_plugin_sqlite_add_filename_details:
**/
static gint
-pk_plugin_sqlite_add_filename_details (PkTransaction *transaction,
+pk_plugin_sqlite_add_filename_details (PkPlugin *plugin,
const gchar *filename,
const gchar *package,
const gchar *md5)
@@ -276,17 +220,17 @@ pk_plugin_sqlite_add_filename_details (PkTransaction *transaction,
/* the row might already exist */
statement = g_strdup_printf ("DELETE FROM cache WHERE filename = '%s'",
filename);
- sqlite3_exec (priv->db, statement, NULL, NULL, NULL);
+ sqlite3_exec (plugin->priv->db, statement, NULL, NULL, NULL);
g_free (statement);
/* prepare the query, as we don't escape it */
- rc = sqlite3_prepare_v2 (priv->db,
+ rc = sqlite3_prepare_v2 (plugin->priv->db,
"INSERT INTO cache (filename, package, show, md5) "
"VALUES (?, ?, ?, ?)",
-1, &sql_statement, NULL);
if (rc != SQLITE_OK) {
g_warning ("SQL failed to prepare: %s",
- sqlite3_errmsg (priv->db));
+ sqlite3_errmsg (plugin->priv->db));
goto out;
}
@@ -312,7 +256,7 @@ out:
* pk_plugin_sqlite_add_filename:
**/
static gint
-pk_plugin_sqlite_add_filename (PkTransaction *transaction,
+pk_plugin_sqlite_add_filename (PkPlugin *plugin,
const gchar *filename,
const gchar *md5_opt)
{
@@ -327,7 +271,7 @@ pk_plugin_sqlite_add_filename (PkTransaction *transaction,
md5 = pk_plugin_get_filename_md5 (filename);
/* resolve */
- package = pk_plugin_get_installed_package_for_file (transaction,
+ package = pk_plugin_get_installed_package_for_file (plugin,
filename);
if (package == NULL) {
g_warning ("failed to get list");
@@ -335,7 +279,7 @@ pk_plugin_sqlite_add_filename (PkTransaction *transaction,
}
/* add */
- rc = pk_plugin_sqlite_add_filename_details (transaction,
+ rc = pk_plugin_sqlite_add_filename_details (plugin,
filename,
pk_package_get_name (package),
md5);
@@ -353,7 +297,7 @@ pk_plugin_sqlite_cache_rescan_cb (void *data,
gchar **argv,
gchar **col_name)
{
- PkTransaction *transaction = PK_TRANSACTION (data);
+ PkPlugin *plugin = (PkPlugin*) data;
const gchar *filename = NULL;
const gchar *md5 = NULL;
gchar *md5_calc = NULL;
@@ -377,12 +321,12 @@ pk_plugin_sqlite_cache_rescan_cb (void *data,
md5_calc = pk_plugin_get_filename_md5 (filename);
if (md5_calc == NULL) {
g_debug ("remove of %s as no longer found", filename);
- pk_plugin_sqlite_remove_filename (transaction, filename);
+ pk_plugin_sqlite_remove_filename (plugin, filename);
goto out;
}
/* we've checked the file */
- g_hash_table_insert (priv->hash,
+ g_hash_table_insert (plugin->priv->hash,
g_strdup (filename),
GUINT_TO_POINTER (1));
@@ -390,7 +334,7 @@ pk_plugin_sqlite_cache_rescan_cb (void *data,
if (g_strcmp0 (md5, md5_calc) != 0) {
g_debug ("add of %s as md5 invalid (%s vs %s)",
filename, md5, md5_calc);
- pk_plugin_sqlite_add_filename (transaction,
+ pk_plugin_sqlite_add_filename (plugin,
filename,
md5_calc);
}
@@ -405,7 +349,7 @@ out:
* pk_plugin_get_desktop_files:
**/
static void
-pk_plugin_get_desktop_files (PkTransaction *transaction,
+pk_plugin_get_desktop_files (PkPlugin *plugin,
const gchar *app_dir,
GPtrArray *array)
{
@@ -430,10 +374,10 @@ pk_plugin_get_desktop_files (PkTransaction *transaction,
while (filename != NULL) {
path = g_build_filename (app_dir, filename, NULL);
if (g_file_test (path, G_FILE_TEST_IS_DIR)) {
- pk_plugin_get_desktop_files (transaction,
+ pk_plugin_get_desktop_files (plugin,
path, array);
} else if (g_str_has_suffix (filename, ".desktop")) {
- data = g_hash_table_lookup (priv->hash, path);
+ data = g_hash_table_lookup (plugin->priv->hash, path);
if (data == NULL) {
g_debug ("add of %s as not present in db",
path);
@@ -447,10 +391,69 @@ pk_plugin_get_desktop_files (PkTransaction *transaction,
}
/**
- * pk_transaction_plugin_finished_end:
+ * pk_transaction_plugin_load_db:
+ */
+static void
+pk_transaction_plugin_load_db (PkPlugin *plugin,
+ PkTransaction *transaction)
+{
+ const gchar *statement_create;
+ gboolean ret;
+ gchar *error_msg = NULL;
+ gint rc;
+ PkConf *conf;
+
+ /* check the config file */
+ conf = pk_transaction_get_conf (transaction);
+ ret = pk_conf_get_bool (conf, "ScanDesktopFiles");
+ if (!ret)
+ goto out;
+
+ /* check if database exists */
+ ret = g_file_test (PK_DESKTOP_DEFAULT_DATABASE,
+ G_FILE_TEST_EXISTS);
+
+ g_debug ("trying to open database '%s'",
+ PK_DESKTOP_DEFAULT_DATABASE);
+ rc = sqlite3_open (PK_DESKTOP_DEFAULT_DATABASE, &plugin->priv->db);
+ if (rc != 0) {
+ g_warning ("Can't open desktop database: %s\n",
+ sqlite3_errmsg (plugin->priv->db));
+ sqlite3_close (plugin->priv->db);
+ plugin->priv->db = NULL;
+ goto out;
+ }
+
+ /* create if not exists */
+ if (!ret) {
+ g_debug ("creating database cache in %s",
+ PK_DESKTOP_DEFAULT_DATABASE);
+ statement_create = "CREATE TABLE cache ("
+ "filename TEXT,"
+ "package TEXT,"
+ "show INTEGER,"
+ "md5 TEXT);";
+ rc = sqlite3_exec (plugin->priv->db, statement_create,
+ NULL, NULL, &error_msg);
+ if (rc != SQLITE_OK) {
+ g_warning ("SQL error: %s\n", error_msg);
+ sqlite3_free (error_msg);
+ goto out;
+ }
+ }
+
+ /* we don't need to keep syncing */
+ sqlite3_exec (plugin->priv->db, "PRAGMA synchronous=OFF", NULL, NULL, NULL);
+out:
+ return;
+}
+
+/**
+ * pk_plugin_transaction_finished_end:
*/
void
-pk_transaction_plugin_finished_end (PkTransaction *transaction)
+pk_plugin_transaction_finished_end (PkPlugin *plugin,
+ PkTransaction *transaction)
{
gchar *error_msg = NULL;
gchar *path;
@@ -464,8 +467,12 @@ pk_transaction_plugin_finished_end (PkTransaction *transaction)
PkBackend *backend = NULL;
PkRoleEnum role;
+ /* load */
+ if (plugin->priv->db == NULL)
+ pk_transaction_plugin_load_db (plugin, transaction);
+
/* no database */
- if (priv->db == NULL)
+ if (plugin->priv->db == NULL)
goto out;
/* check the role */
@@ -481,26 +488,29 @@ pk_transaction_plugin_finished_end (PkTransaction *transaction)
goto out;
}
finished_id = g_signal_connect (backend, "finished",
- G_CALLBACK (pk_plugin_finished_cb), NULL);
+ G_CALLBACK (pk_plugin_finished_cb), plugin);
package_id = g_signal_connect (backend, "package",
- G_CALLBACK (pk_plugin_package_cb), NULL);
+ G_CALLBACK (pk_plugin_package_cb), plugin);
/* use a local backend instance */
pk_backend_reset (backend);
pk_backend_set_status (backend,
PK_STATUS_ENUM_SCAN_APPLICATIONS);
+ /* cache */
+ plugin->priv->backend = backend;
+
/* reset hash */
- g_hash_table_remove_all (priv->hash);
+ g_hash_table_remove_all (plugin->priv->hash);
pk_backend_set_percentage (backend, 101);
/* first go through the existing data, and look for
* modifications and removals */
statement = g_strdup ("SELECT filename, md5 FROM cache");
- rc = sqlite3_exec (priv->db,
+ rc = sqlite3_exec (plugin->priv->db,
statement,
pk_plugin_sqlite_cache_rescan_cb,
- transaction,
+ plugin,
&error_msg);
g_free (statement);
if (rc != SQLITE_OK) {
@@ -510,7 +520,7 @@ pk_transaction_plugin_finished_end (PkTransaction *transaction)
}
array = g_ptr_array_new_with_free_func (g_free);
- pk_plugin_get_desktop_files (transaction,
+ pk_plugin_get_desktop_files (plugin,
PK_DESKTOP_DEFAULT_APPLICATION_DIR,
array);
@@ -523,7 +533,7 @@ pk_transaction_plugin_finished_end (PkTransaction *transaction)
for (i=0; i<array->len; i++) {
pk_backend_set_percentage (backend, i * step);
path = g_ptr_array_index (array, i);
- pk_plugin_sqlite_add_filename (transaction,
+ pk_plugin_sqlite_add_filename (plugin,
path,
NULL);
}
@@ -548,7 +558,7 @@ out:
static void
pk_plugin_files_cb (PkBackend *backend,
PkFiles *files,
- PkTransaction *transaction)
+ PkPlugin *plugin)
{
guint i;
guint len;
@@ -581,7 +591,7 @@ pk_plugin_files_cb (PkBackend *backend,
g_debug ("adding filename %s", filenames[i]);
md5 = pk_plugin_get_filename_md5 (filenames[i]);
- pk_plugin_sqlite_add_filename_details (transaction,
+ pk_plugin_sqlite_add_filename_details (plugin,
filenames[i],
package[PK_PACKAGE_ID_NAME],
md5);
@@ -593,10 +603,11 @@ pk_plugin_files_cb (PkBackend *backend,
}
/**
- * pk_transaction_plugin_finished_results:
+ * pk_plugin_transaction_finished_results:
*/
void
-pk_transaction_plugin_finished_results (PkTransaction *transaction)
+pk_plugin_transaction_finished_results (PkPlugin *plugin,
+ PkTransaction *transaction)
{
gchar **package_ids = NULL;
gchar *package_id_tmp;
@@ -611,8 +622,12 @@ pk_transaction_plugin_finished_results (PkTransaction *transaction)
PkResults *results;
PkRoleEnum role;
+ /* load */
+ if (plugin->priv->db == NULL)
+ pk_transaction_plugin_load_db (plugin, transaction);
+
/* no database */
- if (priv->db == NULL)
+ if (plugin->priv->db == NULL)
goto out;
/* check the role */
@@ -628,9 +643,12 @@ pk_transaction_plugin_finished_results (PkTransaction *transaction)
goto out;
}
finished_id = g_signal_connect (backend, "finished",
- G_CALLBACK (pk_plugin_finished_cb), NULL);
+ G_CALLBACK (pk_plugin_finished_cb), plugin);
files_id = g_signal_connect (backend, "files",
- G_CALLBACK (pk_plugin_files_cb), NULL);
+ G_CALLBACK (pk_plugin_files_cb), plugin);
+
+ /* cache */
+ plugin->priv->backend = backend;
/* get results */
results = pk_transaction_get_results (transaction);
@@ -665,7 +683,7 @@ pk_transaction_plugin_finished_results (PkTransaction *transaction)
pk_backend_get_files (backend, package_ids);
/* wait for finished */
- g_main_loop_run (priv->loop);
+ g_main_loop_run (plugin->priv->loop);
pk_backend_set_percentage (backend, 100);
out:
diff --git a/src/plugins/pk-plugin-scripts.c b/src/plugins/pk-plugin-scripts.c
index b2ca5cb..3b942f0 100644
--- a/src/plugins/pk-plugin-scripts.c
+++ b/src/plugins/pk-plugin-scripts.c
@@ -21,13 +21,13 @@
#include <config.h>
#include <gio/gio.h>
-#include <pk-transaction.h>
+#include <pk-plugin.h>
/**
- * pk_transaction_plugin_get_description:
+ * pk_plugin_get_description:
*/
const gchar *
-pk_transaction_plugin_get_description (void)
+pk_plugin_get_description (void)
{
return "Runs external scrips";
}
@@ -138,20 +138,22 @@ out:
}
/**
- * pk_transaction_plugin_run:
+ * pk_plugin_transaction_run:
*/
void
-pk_transaction_plugin_run (PkTransaction *transaction)
+pk_plugin_transaction_run (PkPlugin *plugin,
+ PkTransaction *transaction)
{
pk_transaction_process_scripts (transaction,
"pre-transaction.d");
}
/**
- * pk_transaction_plugin_finished_end:
+ * pk_plugin_transaction_finished_end:
*/
void
-pk_transaction_plugin_finished_end (PkTransaction *transaction)
+pk_plugin_transaction_finished_end (PkPlugin *plugin,
+ PkTransaction *transaction)
{
pk_transaction_process_scripts (transaction,
"post-transaction.d");
diff --git a/src/plugins/pk-plugin-update-check-processes.c b/src/plugins/pk-plugin-update-check-processes.c
index d161cf6..2f57e1a 100644
--- a/src/plugins/pk-plugin-update-check-processes.c
+++ b/src/plugins/pk-plugin-update-check-processes.c
@@ -21,47 +21,44 @@
#include <config.h>
#include <gio/gio.h>
-#include <pk-transaction.h>
+#include <pk-plugin.h>
#include "pk-proc.h"
-typedef struct {
+struct PkPluginPrivate {
PkProc *proc;
GMainLoop *loop;
-} PluginPrivate;
-
-static PluginPrivate *priv;
+};
/**
- * pk_transaction_plugin_get_description:
+ * pk_plugin_get_description:
*/
const gchar *
-pk_transaction_plugin_get_description (void)
+pk_plugin_get_description (void)
{
return "Checks for running processes during update for session restarts";
}
/**
- * pk_transaction_plugin_initialize:
+ * pk_plugin_initialize:
*/
void
-pk_transaction_plugin_initialize (PkTransaction *transaction)
+pk_plugin_initialize (PkPlugin *plugin)
{
/* create private area */
- priv = g_new0 (PluginPrivate, 1);
- priv->loop = g_main_loop_new (NULL, FALSE);
- priv->proc = pk_proc_new ();
+ plugin->priv = PK_TRANSACTION_PLUGIN_GET_PRIVATE (PkPluginPrivate);
+ plugin->priv->loop = g_main_loop_new (NULL, FALSE);
+ plugin->priv->proc = pk_proc_new ();
}
/**
- * pk_transaction_plugin_destroy:
+ * pk_plugin_destroy:
*/
void
-pk_transaction_plugin_destroy (PkTransaction *transaction)
+pk_plugin_destroy (PkPlugin *plugin)
{
- g_main_loop_unref (priv->loop);
- g_object_unref (priv->proc);
- g_free (priv);
+ g_main_loop_unref (plugin->priv->loop);
+ g_object_unref (plugin->priv->proc);
}
/**
@@ -70,16 +67,10 @@ pk_transaction_plugin_destroy (PkTransaction *transaction)
static void
pk_plugin_finished_cb (PkBackend *backend,
PkExitEnum exit_enum,
- gpointer user_data)
+ PkPlugin *plugin)
{
- if (!g_main_loop_is_running (priv->loop))
- return;
- if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
- g_warning ("%s failed with exit code: %s",
- pk_role_enum_to_string (pk_backend_get_role (backend)),
- pk_exit_enum_to_string (exit_enum));
- }
- g_main_loop_quit (priv->loop);
+ g_assert (g_main_loop_is_running (plugin->priv->loop));
+ g_main_loop_quit (plugin->priv->loop);
}
/**
@@ -88,7 +79,7 @@ pk_plugin_finished_cb (PkBackend *backend,
static void
pk_plugin_files_cb (PkBackend *backend,
PkFiles *files,
- PkTransaction *transaction)
+ PkPlugin *plugin)
{
guint i;
guint len;
@@ -114,7 +105,7 @@ pk_plugin_files_cb (PkBackend *backend,
continue;
/* running? */
- ret = pk_proc_find_exec (priv->proc, filenames[i]);
+ ret = pk_proc_find_exec (plugin->priv->proc, filenames[i]);
if (!ret)
continue;
@@ -133,10 +124,11 @@ pk_plugin_files_cb (PkBackend *backend,
}
/**
- * pk_transaction_plugin_finished_results:
+ * pk_plugin_transaction_finished_results:
*/
void
-pk_transaction_plugin_finished_results (PkTransaction *transaction)
+pk_plugin_transaction_finished_results (PkPlugin *plugin,
+ PkTransaction *transaction)
{
gboolean ret;
gchar **package_ids = NULL;
@@ -172,9 +164,9 @@ pk_transaction_plugin_finished_results (PkTransaction *transaction)
goto out;
}
finished_id = g_signal_connect (backend, "finished",
- G_CALLBACK (pk_plugin_finished_cb), NULL);
+ G_CALLBACK (pk_plugin_finished_cb), plugin);
files_id = g_signal_connect (backend, "files",
- G_CALLBACK (pk_plugin_files_cb), NULL);
+ G_CALLBACK (pk_plugin_files_cb), plugin);
/* get results */
results = pk_transaction_get_results (transaction);
@@ -201,7 +193,7 @@ pk_transaction_plugin_finished_results (PkTransaction *transaction)
goto out;
/* get all the running processes */
- pk_proc_refresh (priv->proc);
+ pk_proc_refresh (plugin->priv->proc);
/* get all the files touched in the packages we just updated */
pk_backend_reset (backend);
@@ -211,7 +203,7 @@ pk_transaction_plugin_finished_results (PkTransaction *transaction)
pk_backend_get_files (backend, package_ids);
/* wait for finished */
- g_main_loop_run (priv->loop);
+ g_main_loop_run (plugin->priv->loop);
pk_backend_set_percentage (backend, 100);
diff --git a/src/plugins/pk-plugin-update-package-list.c b/src/plugins/pk-plugin-update-package-list.c
index becfc20..7b9ea7f 100644
--- a/src/plugins/pk-plugin-update-package-list.c
+++ b/src/plugins/pk-plugin-update-package-list.c
@@ -21,21 +21,19 @@
#include <config.h>
#include <gio/gio.h>
-#include <pk-transaction.h>
+#include <pk-plugin.h>
#include <packagekit-glib2/pk-package.h>
-typedef struct {
+struct PkPluginPrivate {
GPtrArray *list;
GMainLoop *loop;
-} PluginPrivate;
-
-static PluginPrivate *priv;
+};
/**
- * pk_transaction_plugin_get_description:
+ * pk_plugin_get_description:
*/
const gchar *
-pk_transaction_plugin_get_description (void)
+pk_plugin_get_description (void)
{
return "Updates the package lists after refresh";
}
@@ -46,9 +44,9 @@ pk_transaction_plugin_get_description (void)
static void
pk_plugin_package_cb (PkBackend *backend,
PkPackage *package,
- gpointer user_data)
+ PkPlugin *plugin)
{
- g_ptr_array_add (priv->list, g_object_ref (package));
+ g_ptr_array_add (plugin->priv->list, g_object_ref (package));
}
/**
@@ -57,39 +55,32 @@ pk_plugin_package_cb (PkBackend *backend,
static void
pk_plugin_finished_cb (PkBackend *backend,
PkExitEnum exit_enum,
- gpointer user_data)
+ PkPlugin *plugin)
{
- if (!g_main_loop_is_running (priv->loop))
- return;
- if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
- g_warning ("%s failed with exit code: %s",
- pk_role_enum_to_string (pk_backend_get_role (backend)),
- pk_exit_enum_to_string (exit_enum));
- }
- g_main_loop_quit (priv->loop);
+ g_assert (g_main_loop_is_running (plugin->priv->loop));
+ g_main_loop_quit (plugin->priv->loop);
}
/**
- * pk_transaction_plugin_initialize:
+ * pk_plugin_initialize:
*/
void
-pk_transaction_plugin_initialize (PkTransaction *transaction)
+pk_plugin_initialize (PkPlugin *plugin)
{
/* create private area */
- priv = g_new0 (PluginPrivate, 1);
- priv->loop = g_main_loop_new (NULL, FALSE);
- priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+ plugin->priv = PK_TRANSACTION_PLUGIN_GET_PRIVATE (PkPluginPrivate);
+ plugin->priv->loop = g_main_loop_new (NULL, FALSE);
+ plugin->priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
}
/**
- * pk_transaction_plugin_destroy:
+ * pk_plugin_destroy:
*/
void
-pk_transaction_plugin_destroy (PkTransaction *transaction)
+pk_plugin_destroy (PkPlugin *plugin)
{
- g_ptr_array_unref (priv->list);
- g_main_loop_unref (priv->loop);
- g_free (priv);
+ g_ptr_array_unref (plugin->priv->list);
+ g_main_loop_unref (plugin->priv->loop);
}
/**
@@ -128,10 +119,11 @@ pk_plugin_package_list_to_string (GPtrArray *array)
}
/**
- * pk_transaction_plugin_finished_end:
+ * pk_plugin_transaction_finished_end:
*/
void
-pk_transaction_plugin_finished_end (PkTransaction *transaction)
+pk_plugin_transaction_finished_end (PkPlugin *plugin,
+ PkTransaction *transaction)
{
gboolean ret;
gchar *data = NULL;
@@ -164,15 +156,15 @@ pk_transaction_plugin_finished_end (PkTransaction *transaction)
/* connect to backend */
backend = pk_transaction_get_backend (transaction);
finished_id = g_signal_connect (backend, "finished",
- G_CALLBACK (pk_plugin_finished_cb), NULL);
+ G_CALLBACK (pk_plugin_finished_cb), plugin);
package_id = g_signal_connect (backend, "package",
- G_CALLBACK (pk_plugin_package_cb), NULL);
+ G_CALLBACK (pk_plugin_package_cb), plugin);
g_debug ("plugin: updating package lists");
/* clear old list */
- if (priv->list->len > 0)
- g_ptr_array_set_size (priv->list, 0);
+ if (plugin->priv->list->len > 0)
+ g_ptr_array_set_size (plugin->priv->list, 0);
/* update UI */
pk_backend_set_status (backend,
@@ -184,13 +176,13 @@ pk_transaction_plugin_finished_end (PkTransaction *transaction)
pk_backend_get_packages (backend, PK_FILTER_ENUM_NONE);
/* wait for finished */
- g_main_loop_run (priv->loop);
+ g_main_loop_run (plugin->priv->loop);
/* update UI */
pk_backend_set_percentage (backend, 90);
/* convert to a file */
- data = pk_plugin_package_list_to_string (priv->list);
+ data = pk_plugin_package_list_to_string (plugin->priv->list);
ret = g_file_set_contents (PK_SYSTEM_PACKAGE_LIST_FILENAME,
data, -1, &error);
if (!ret) {
commit 0872988cc1e43f04dacc08e5d8be62bcdebcacef
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jul 11 13:04:49 2011 +0100
trivial: ensure all the plugins get built
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index d0677b6..99bfff6 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -97,7 +97,7 @@ libpk_plugin_update_check_processes_la_LIBADD = $(PK_PLUGIN_LIBS)
libpk_plugin_update_check_processes_la_LDFLAGS = -module -avoid-version
libpk_plugin_update_check_processes_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
-libpk_plugin_check_shared_libraries_in_use_la_SOURCES =
+libpk_plugin_check_shared_libraries_in_use_la_SOURCES = \
pk-plugin-check-shared-libraries-in-use.c \
pk-lsof.h \
pk-lsof.c
commit b1c58c9cccf5f50205f75622cb41392e78652709
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jul 11 12:31:34 2011 +0100
trivial: Move PkLsof to the plugin directory
diff --git a/src/Makefile.am b/src/Makefile.am
index a1acbc7..89c69e7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -56,8 +56,6 @@ shared_SOURCES = \
egg-dbus-monitor.h \
pk-marshal.c \
pk-marshal.h \
- pk-lsof.c \
- pk-lsof.h \
pk-proc.c \
pk-proc.h \
pk-dbus.c \
diff --git a/src/pk-lsof.c b/src/pk-lsof.c
deleted file mode 100644
index 1755c13..0000000
--- a/src/pk-lsof.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2009 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include <glib.h>
-
-#include "egg-string.h"
-
-#include "pk-lsof.h"
-
-#define PK_LSOF_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_LSOF, PkLsofPrivate))
-
-struct PkLsofPrivate
-{
- GPtrArray *list_data;
-};
-
-G_DEFINE_TYPE (PkLsof, pk_lsof, G_TYPE_OBJECT)
-
-typedef struct {
- guint pid;
- gchar *filename;
-} PkLsofData;
-
-/**
- * pk_lsof_add_pid:
- **/
-static gboolean
-pk_lsof_add_pid (GPtrArray *array, guint pid)
-{
- guint i;
- guint pid_tmp;
- gboolean found = FALSE;
-
- /* search already list */
- for (i=0; i<array->len; i++) {
- pid_tmp = GPOINTER_TO_INT (g_ptr_array_index (array, i));
- if (pid_tmp == pid) {
- found = TRUE;
- break;
- }
- }
-
- /* not found, so add */
- if (!found) {
- g_ptr_array_add (array, GINT_TO_POINTER (pid));
- }
- return !found;
-}
-
-/**
- * pk_lsof_data_free:
- **/
-static void
-pk_lsof_data_free (PkLsofData *lsof)
-{
- g_free (lsof->filename);
- g_free (lsof);
-}
-
-/**
- * pk_lsof_data_new:
- **/
-static PkLsofData *
-pk_lsof_data_new (guint pid, const gchar *filename)
-{
- PkLsofData *data;
- data = g_new0 (PkLsofData, 1);
- data->pid = pid;
- data->filename = g_strdup (filename);
- return data;
-}
-
-typedef enum {
- PK_LSOF_TYPE_MEM,
- PK_LSOF_TYPE_DEL,
- PK_LSOF_TYPE_TXT,
- PK_LSOF_TYPE_UNKNOWN
-} PkLsofType;
-
-/**
- * pk_lsof_type_to_string:
- **/
-static const gchar *
-pk_lsof_type_to_string (PkLsofType type)
-{
- if (type == PK_LSOF_TYPE_MEM)
- return "mem";
- if (type == PK_LSOF_TYPE_TXT)
- return "txt";
- if (type == PK_LSOF_TYPE_DEL)
- return "del";
- return "unknown";
-}
-
-/**
- * pk_lsof_type_from_string:
- **/
-static PkLsofType
-pk_lsof_type_from_string (const gchar *type)
-{
- if (g_ascii_strcasecmp (type, "mem") == 0)
- return PK_LSOF_TYPE_MEM;
- if (g_ascii_strcasecmp (type, "txt") == 0)
- return PK_LSOF_TYPE_TXT;
- if (g_ascii_strcasecmp (type, "del") == 0)
- return PK_LSOF_TYPE_DEL;
- return PK_LSOF_TYPE_UNKNOWN;
-}
-
-/**
- * pk_lsof_refresh:
- **/
-gboolean
-pk_lsof_refresh (PkLsof *lsof)
-{
- gboolean ret;
- GError *error = NULL;
- gchar *stdout = NULL;
- gchar *stderr = NULL;
- const gchar *lsof_name;
- gchar *lsof_cmd = NULL;
- PkLsofData *data;
- gchar **lines = NULL;
- guint i;
- const gchar *value;
- gchar mode;
- gint pid = -1;
- PkLsofType type = PK_LSOF_TYPE_UNKNOWN;
-
- g_return_val_if_fail (PK_IS_LSOF (lsof), FALSE);
-
- /* try to find lsof */
- lsof_name = "/usr/sbin/lsof";
- ret = g_file_test (lsof_name, G_FILE_TEST_EXISTS);
- if (!ret) {
- lsof_name = "/usr/bin/lsof";
- ret = g_file_test (lsof_name, G_FILE_TEST_EXISTS);
- if (!ret) {
- g_warning ("lsof not found, cannot continue");
- goto out;
- }
- }
-
- /* run lsof to get all data */
- lsof_cmd = g_strconcat (lsof_name, " ", "-Fpfn", NULL);
- ret = g_spawn_command_line_sync (lsof_cmd, &stdout, &stderr, NULL, &error);
- if (!ret) {
- g_warning ("failed to get pids: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* clear */
- g_ptr_array_set_size (lsof->priv->list_data, 0);
-
- /* split into lines */
- lines = g_strsplit (stdout, "\n", -1);
- for (i=0; lines[i] != NULL; i++) {
-
- /* get mode */
- mode = lines[i][0];
- if (mode == '\0')
- continue;
-
- value = &lines[i][1];
- switch (mode) {
- case 'p':
-
- /* parse PID */
- ret = egg_strtoint (value, &pid);
- if (!ret) {
- g_warning ("failed to parse pid: '%s'", value);
- pid = -1;
- goto out;
- }
- break;
- case 'f':
- type = pk_lsof_type_from_string (value);
- break;
- case 'n':
- if (type == PK_LSOF_TYPE_DEL ||
- type == PK_LSOF_TYPE_MEM) {
-
- /* no valid pid found */
- if (pid == -1)
- break;
-
- /* not a system library */
- if (strstr (value, "/lib/") == NULL)
- break;
-
- /* not a shared object */
- if (strstr (value, ".so") == NULL)
- break;
-
- /* add to array */
- data = pk_lsof_data_new (pid, value);
- g_ptr_array_add (lsof->priv->list_data, data);
- }
- break;
- default:
- g_debug ("ignoring %c=%s (type=%s)", mode, value, pk_lsof_type_to_string (type));
- break;
- }
- }
- ret = TRUE;
-out:
- g_strfreev (lines);
- g_free (lsof_cmd);
- g_free (stdout);
- g_free (stderr);
- return ret;
-}
-
-/**
- * pk_lsof_get_pids_for_filenames:
- **/
-GPtrArray *
-pk_lsof_get_pids_for_filenames (PkLsof *lsof, gchar **filenames)
-{
- guint i;
- guint j;
- gboolean ret;
- GPtrArray *list_data;
- GPtrArray *pids = NULL;
- const PkLsofData *data;
-
- g_return_val_if_fail (PK_IS_LSOF (lsof), NULL);
-
- /* might not have been refreshed ever */
- list_data = lsof->priv->list_data;
- if (list_data->len == 0) {
- ret = pk_lsof_refresh (lsof);
- if (!ret) {
- g_warning ("failed to refresh");
- goto out;
- }
- }
-
- /* create array of pids that are using this library */
- pids = g_ptr_array_new ();
- for (i=0; filenames[i] != NULL; i++) {
- for (j=0; j < list_data->len; j++) {
- data = g_ptr_array_index (list_data, j);
- g_debug ("got %s", data->filename);
- if (g_strcmp0 (filenames[i], data->filename) == 0) {
- pk_lsof_add_pid (pids, data->pid);
- }
- }
- }
-out:
- return pids;
-}
-
-/**
- * pk_lsof_finalize:
- **/
-static void
-pk_lsof_finalize (GObject *object)
-{
- PkLsof *lsof;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (PK_IS_LSOF (object));
- lsof = PK_LSOF (object);
-
- g_ptr_array_unref (lsof->priv->list_data);
-
- G_OBJECT_CLASS (pk_lsof_parent_class)->finalize (object);
-}
-
-/**
- * pk_lsof_class_init:
- **/
-static void
-pk_lsof_class_init (PkLsofClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = pk_lsof_finalize;
- g_type_class_add_private (klass, sizeof (PkLsofPrivate));
-}
-
-/**
- * pk_lsof_init:
- *
- * initializes the lsof class. NOTE: We expect lsof objects
- * to *NOT* be removed or added during the session.
- * We only control the first lsof object if there are more than one.
- **/
-static void
-pk_lsof_init (PkLsof *lsof)
-{
- lsof->priv = PK_LSOF_GET_PRIVATE (lsof);
- lsof->priv->list_data = g_ptr_array_new_with_free_func ((GDestroyNotify) pk_lsof_data_free);
-}
-
-/**
- * pk_lsof_new:
- * Return value: A new lsof class instance.
- **/
-PkLsof *
-pk_lsof_new (void)
-{
- PkLsof *lsof;
- lsof = g_object_new (PK_TYPE_LSOF, NULL);
- return PK_LSOF (lsof);
-}
-
diff --git a/src/pk-lsof.h b/src/pk-lsof.h
deleted file mode 100644
index 98cf798..0000000
--- a/src/pk-lsof.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2009 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PK_LSOF_H
-#define __PK_LSOF_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define PK_TYPE_LSOF (pk_lsof_get_type ())
-#define PK_LSOF(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_LSOF, PkLsof))
-#define PK_LSOF_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_LSOF, PkLsofClass))
-#define PK_IS_LSOF(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_LSOF))
-#define PK_IS_LSOF_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_LSOF))
-#define PK_LSOF_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_LSOF, PkLsofClass))
-
-typedef struct PkLsofPrivate PkLsofPrivate;
-
-typedef struct
-{
- GObject parent;
- PkLsofPrivate *priv;
-} PkLsof;
-
-typedef struct
-{
- GObjectClass parent_class;
-} PkLsofClass;
-
-GType pk_lsof_get_type (void);
-PkLsof *pk_lsof_new (void);
-
-gboolean pk_lsof_refresh (PkLsof *lsof);
-GPtrArray *pk_lsof_get_pids_for_filenames (PkLsof *lsof,
- gchar **filenames);
-
-G_END_DECLS
-
-#endif /* __PK_LSOF_H */
-
diff --git a/src/pk-self-test.c b/src/pk-self-test.c
index 26743d0..765d791 100644
--- a/src/pk-self-test.c
+++ b/src/pk-self-test.c
@@ -33,7 +33,6 @@
#include "pk-engine.h"
#include "pk-file-monitor.h"
#include "pk-inhibit.h"
-#include "pk-lsof.h"
#include "pk-notify.h"
#include "pk-proc.h"
#include "pk-spawn.h"
@@ -825,67 +824,6 @@ pk_test_inhibit_func (void)
}
static void
-pk_test_lsof_get_files_for_directory (GPtrArray *files, const gchar *dirname)
-{
- GDir *dir;
- const gchar *filename;
- dir = g_dir_open (dirname, 0, NULL);
- if (dir == NULL)
- return;
- filename = g_dir_read_name (dir);
- while (filename != NULL) {
- if (g_str_has_prefix (filename, "libglib-2.0.so"))
- g_ptr_array_add (files,
- g_build_filename (dirname, filename, NULL));
- filename = g_dir_read_name (dir);
- }
- g_dir_close (dir);
-}
-
-static gchar **
-pk_test_lsof_get_files (void)
-{
- GPtrArray *files;
- gchar **retval;
-
- files = g_ptr_array_new_with_free_func (g_free);
- pk_test_lsof_get_files_for_directory (files, "/lib");
- pk_test_lsof_get_files_for_directory (files, "/usr/lib");
- pk_test_lsof_get_files_for_directory (files, "/usr/lib64");
-
- /* convert to gchar ** */
- retval = pk_ptr_array_to_strv (files);
- g_ptr_array_unref (files);
- return retval;
-}
-
-static void
-pk_test_lsof_func (void)
-{
- gboolean ret;
- PkLsof *lsof;
- GPtrArray *pids;
- gchar **files;
-
- lsof = pk_lsof_new ();
- g_assert (lsof != NULL);
-
- /* refresh lsof data */
- ret = pk_lsof_refresh (lsof);
- g_assert (ret);
-
- /* get pids for some test files */
- files = pk_test_lsof_get_files ();
- g_assert_cmpint (g_strv_length (files), >, 0);
- pids = pk_lsof_get_pids_for_filenames (lsof, files);
- g_assert_cmpint (pids->len, >, 0);
- g_ptr_array_unref (pids);
-
- g_strfreev (files);
- g_object_unref (lsof);
-}
-
-static void
pk_test_notify_func (void)
{
PkNotify *notify;
@@ -1859,7 +1797,6 @@ main (int argc, char **argv)
/* components */
g_test_add_func ("/packagekit/notify", pk_test_proc_func);
g_test_add_func ("/packagekit/proc", pk_test_proc_func);
- g_test_add_func ("/packagekit/lsof", pk_test_lsof_func);
g_test_add_func ("/packagekit/file-monitor", pk_test_file_monitor_func);
g_test_add_func ("/packagekit/time", pk_test_time_func);
g_test_add_func ("/packagekit/dbus", pk_test_dbus_func);
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index 705ad25..d0677b6 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -30,8 +30,8 @@ check_PROGRAMS = \
pk_self_test_SOURCES = \
pk-self-test.c \
- $(shared_SOURCES) \
- $(NULL)
+ pk-lsof.h \
+ pk-lsof.c
pk_self_test_LDADD = \
$(GLIB_LIBS) \
@@ -97,7 +97,10 @@ libpk_plugin_update_check_processes_la_LIBADD = $(PK_PLUGIN_LIBS)
libpk_plugin_update_check_processes_la_LDFLAGS = -module -avoid-version
libpk_plugin_update_check_processes_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
-libpk_plugin_check_shared_libraries_in_use_la_SOURCES = pk-plugin-check-shared-libraries-in-use.c
+libpk_plugin_check_shared_libraries_in_use_la_SOURCES =
+ pk-plugin-check-shared-libraries-in-use.c \
+ pk-lsof.h \
+ pk-lsof.c
libpk_plugin_check_shared_libraries_in_use_la_LIBADD = $(PK_PLUGIN_LIBS)
libpk_plugin_check_shared_libraries_in_use_la_LDFLAGS = -module -avoid-version
libpk_plugin_check_shared_libraries_in_use_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
diff --git a/src/plugins/pk-lsof.c b/src/plugins/pk-lsof.c
new file mode 100644
index 0000000..80badaa
--- /dev/null
+++ b/src/plugins/pk-lsof.c
@@ -0,0 +1,359 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2009 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <glib.h>
+
+#include "pk-lsof.h"
+
+#define PK_LSOF_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_LSOF, PkLsofPrivate))
+
+struct PkLsofPrivate
+{
+ GPtrArray *list_data;
+};
+
+G_DEFINE_TYPE (PkLsof, pk_lsof, G_TYPE_OBJECT)
+
+typedef struct {
+ guint pid;
+ gchar *filename;
+} PkLsofData;
+
+/**
+ * pk_lsof_add_pid:
+ **/
+static gboolean
+pk_lsof_add_pid (GPtrArray *array, guint pid)
+{
+ guint i;
+ guint pid_tmp;
+ gboolean found = FALSE;
+
+ /* search already list */
+ for (i=0; i<array->len; i++) {
+ pid_tmp = GPOINTER_TO_INT (g_ptr_array_index (array, i));
+ if (pid_tmp == pid) {
+ found = TRUE;
+ break;
+ }
+ }
+
+ /* not found, so add */
+ if (!found) {
+ g_ptr_array_add (array, GINT_TO_POINTER (pid));
+ }
+ return !found;
+}
+
+/**
+ * pk_lsof_data_free:
+ **/
+static void
+pk_lsof_data_free (PkLsofData *lsof)
+{
+ g_free (lsof->filename);
+ g_free (lsof);
+}
+
+/**
+ * pk_lsof_data_new:
+ **/
+static PkLsofData *
+pk_lsof_data_new (guint pid, const gchar *filename)
+{
+ PkLsofData *data;
+ data = g_new0 (PkLsofData, 1);
+ data->pid = pid;
+ data->filename = g_strdup (filename);
+ return data;
+}
+
+typedef enum {
+ PK_LSOF_TYPE_MEM,
+ PK_LSOF_TYPE_DEL,
+ PK_LSOF_TYPE_TXT,
+ PK_LSOF_TYPE_UNKNOWN
+} PkLsofType;
+
+/**
+ * pk_lsof_type_to_string:
+ **/
+static const gchar *
+pk_lsof_type_to_string (PkLsofType type)
+{
+ if (type == PK_LSOF_TYPE_MEM)
+ return "mem";
+ if (type == PK_LSOF_TYPE_TXT)
+ return "txt";
+ if (type == PK_LSOF_TYPE_DEL)
+ return "del";
+ return "unknown";
+}
+
+/**
+ * pk_lsof_type_from_string:
+ **/
+static PkLsofType
+pk_lsof_type_from_string (const gchar *type)
+{
+ if (g_ascii_strcasecmp (type, "mem") == 0)
+ return PK_LSOF_TYPE_MEM;
+ if (g_ascii_strcasecmp (type, "txt") == 0)
+ return PK_LSOF_TYPE_TXT;
+ if (g_ascii_strcasecmp (type, "del") == 0)
+ return PK_LSOF_TYPE_DEL;
+ return PK_LSOF_TYPE_UNKNOWN;
+}
+
+/**
+ * pk_lsof_strtoint:
+ **/
+static gboolean
+pk_lsof_strtoint (const gchar *text, gint *value)
+{
+ gchar *endptr = NULL;
+ gint64 value_raw;
+
+ /* invalid */
+ if (text == NULL)
+ return FALSE;
+
+ /* parse */
+ value_raw = g_ascii_strtoll (text, &endptr, 10);
+
+ /* parsing error */
+ if (endptr == text)
+ return FALSE;
+
+ /* out of range */
+ if (value_raw > G_MAXINT || value_raw < G_MININT)
+ return FALSE;
+
+ /* cast back down to value */
+ *value = (gint) value_raw;
+ return TRUE;
+}
+
+/**
+ * pk_lsof_refresh:
+ **/
+gboolean
+pk_lsof_refresh (PkLsof *lsof)
+{
+ gboolean ret;
+ GError *error = NULL;
+ gchar *stdout = NULL;
+ gchar *stderr = NULL;
+ const gchar *lsof_name;
+ gchar *lsof_cmd = NULL;
+ PkLsofData *data;
+ gchar **lines = NULL;
+ guint i;
+ const gchar *value;
+ gchar mode;
+ gint pid = -1;
+ PkLsofType type = PK_LSOF_TYPE_UNKNOWN;
+
+ g_return_val_if_fail (PK_IS_LSOF (lsof), FALSE);
+
+ /* try to find lsof */
+ lsof_name = "/usr/sbin/lsof";
+ ret = g_file_test (lsof_name, G_FILE_TEST_EXISTS);
+ if (!ret) {
+ lsof_name = "/usr/bin/lsof";
+ ret = g_file_test (lsof_name, G_FILE_TEST_EXISTS);
+ if (!ret) {
+ g_warning ("lsof not found, cannot continue");
+ goto out;
+ }
+ }
+
+ /* run lsof to get all data */
+ lsof_cmd = g_strconcat (lsof_name, " ", "-Fpfn", NULL);
+ ret = g_spawn_command_line_sync (lsof_cmd, &stdout, &stderr, NULL, &error);
+ if (!ret) {
+ g_warning ("failed to get pids: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* clear */
+ g_ptr_array_set_size (lsof->priv->list_data, 0);
+
+ /* split into lines */
+ lines = g_strsplit (stdout, "\n", -1);
+ for (i=0; lines[i] != NULL; i++) {
+
+ /* get mode */
+ mode = lines[i][0];
+ if (mode == '\0')
+ continue;
+
+ value = &lines[i][1];
+ switch (mode) {
+ case 'p':
+
+ /* parse PID */
+ ret = pk_lsof_strtoint (value, &pid);
+ if (!ret) {
+ g_warning ("failed to parse pid: '%s'", value);
+ pid = -1;
+ goto out;
+ }
+ break;
+ case 'f':
+ type = pk_lsof_type_from_string (value);
+ break;
+ case 'n':
+ if (type == PK_LSOF_TYPE_DEL ||
+ type == PK_LSOF_TYPE_MEM) {
+
+ /* no valid pid found */
+ if (pid == -1)
+ break;
+
+ /* not a system library */
+ if (strstr (value, "/lib/") == NULL)
+ break;
+
+ /* not a shared object */
+ if (strstr (value, ".so") == NULL)
+ break;
+
+ /* add to array */
+ data = pk_lsof_data_new (pid, value);
+ g_ptr_array_add (lsof->priv->list_data, data);
+ }
+ break;
+ default:
+ g_debug ("ignoring %c=%s (type=%s)", mode, value, pk_lsof_type_to_string (type));
+ break;
+ }
+ }
+ ret = TRUE;
+out:
+ g_strfreev (lines);
+ g_free (lsof_cmd);
+ g_free (stdout);
+ g_free (stderr);
+ return ret;
+}
+
+/**
+ * pk_lsof_get_pids_for_filenames:
+ **/
+GPtrArray *
+pk_lsof_get_pids_for_filenames (PkLsof *lsof, gchar **filenames)
+{
+ guint i;
+ guint j;
+ gboolean ret;
+ GPtrArray *list_data;
+ GPtrArray *pids = NULL;
+ const PkLsofData *data;
+
+ g_return_val_if_fail (PK_IS_LSOF (lsof), NULL);
+
+ /* might not have been refreshed ever */
+ list_data = lsof->priv->list_data;
+ if (list_data->len == 0) {
+ ret = pk_lsof_refresh (lsof);
+ if (!ret) {
+ g_warning ("failed to refresh");
+ goto out;
+ }
+ }
+
+ /* create array of pids that are using this library */
+ pids = g_ptr_array_new ();
+ for (i=0; filenames[i] != NULL; i++) {
+ for (j=0; j < list_data->len; j++) {
+ data = g_ptr_array_index (list_data, j);
+ g_debug ("got %s", data->filename);
+ if (g_strcmp0 (filenames[i], data->filename) == 0) {
+ pk_lsof_add_pid (pids, data->pid);
+ }
+ }
+ }
+out:
+ return pids;
+}
+
+/**
+ * pk_lsof_finalize:
+ **/
+static void
+pk_lsof_finalize (GObject *object)
+{
+ PkLsof *lsof;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (PK_IS_LSOF (object));
+ lsof = PK_LSOF (object);
+
+ g_ptr_array_unref (lsof->priv->list_data);
+
+ G_OBJECT_CLASS (pk_lsof_parent_class)->finalize (object);
+}
+
+/**
+ * pk_lsof_class_init:
+ **/
+static void
+pk_lsof_class_init (PkLsofClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = pk_lsof_finalize;
+ g_type_class_add_private (klass, sizeof (PkLsofPrivate));
+}
+
+/**
+ * pk_lsof_init:
+ *
+ * initializes the lsof class. NOTE: We expect lsof objects
+ * to *NOT* be removed or added during the session.
+ * We only control the first lsof object if there are more than one.
+ **/
+static void
+pk_lsof_init (PkLsof *lsof)
+{
+ lsof->priv = PK_LSOF_GET_PRIVATE (lsof);
+ lsof->priv->list_data = g_ptr_array_new_with_free_func ((GDestroyNotify) pk_lsof_data_free);
+}
+
+/**
+ * pk_lsof_new:
+ * Return value: A new lsof class instance.
+ **/
+PkLsof *
+pk_lsof_new (void)
+{
+ PkLsof *lsof;
+ lsof = g_object_new (PK_TYPE_LSOF, NULL);
+ return PK_LSOF (lsof);
+}
+
diff --git a/src/plugins/pk-lsof.h b/src/plugins/pk-lsof.h
new file mode 100644
index 0000000..98cf798
--- /dev/null
+++ b/src/plugins/pk-lsof.h
@@ -0,0 +1,59 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2009 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __PK_LSOF_H
+#define __PK_LSOF_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define PK_TYPE_LSOF (pk_lsof_get_type ())
+#define PK_LSOF(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_LSOF, PkLsof))
+#define PK_LSOF_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_LSOF, PkLsofClass))
+#define PK_IS_LSOF(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_LSOF))
+#define PK_IS_LSOF_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_LSOF))
+#define PK_LSOF_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_LSOF, PkLsofClass))
+
+typedef struct PkLsofPrivate PkLsofPrivate;
+
+typedef struct
+{
+ GObject parent;
+ PkLsofPrivate *priv;
+} PkLsof;
+
+typedef struct
+{
+ GObjectClass parent_class;
+} PkLsofClass;
+
+GType pk_lsof_get_type (void);
+PkLsof *pk_lsof_new (void);
+
+gboolean pk_lsof_refresh (PkLsof *lsof);
+GPtrArray *pk_lsof_get_pids_for_filenames (PkLsof *lsof,
+ gchar **filenames);
+
+G_END_DECLS
+
+#endif /* __PK_LSOF_H */
+
diff --git a/src/plugins/pk-self-test.c b/src/plugins/pk-self-test.c
index 07930fa..a336cab 100644
--- a/src/plugins/pk-self-test.c
+++ b/src/plugins/pk-self-test.c
@@ -25,6 +25,69 @@
#include <glib-object.h>
#include <glib/gstdio.h>
+#include "pk-lsof.h"
+
+static void
+pk_test_lsof_get_files_for_directory (GPtrArray *files, const gchar *dirname)
+{
+ GDir *dir;
+ const gchar *filename;
+ dir = g_dir_open (dirname, 0, NULL);
+ if (dir == NULL)
+ return;
+ filename = g_dir_read_name (dir);
+ while (filename != NULL) {
+ if (g_str_has_prefix (filename, "libglib-2.0.so"))
+ g_ptr_array_add (files,
+ g_build_filename (dirname, filename, NULL));
+ filename = g_dir_read_name (dir);
+ }
+ g_dir_close (dir);
+}
+
+static gchar **
+pk_test_lsof_get_files (void)
+{
+ GPtrArray *files;
+ gchar **retval;
+
+ files = g_ptr_array_new_with_free_func (g_free);
+ pk_test_lsof_get_files_for_directory (files, "/lib");
+ pk_test_lsof_get_files_for_directory (files, "/usr/lib");
+ pk_test_lsof_get_files_for_directory (files, "/usr/lib64");
+
+ /* convert to gchar ** */
+ retval = pk_ptr_array_to_strv (files);
+ g_ptr_array_unref (files);
+ return retval;
+}
+
+static void
+pk_test_lsof_func (void)
+{
+ gboolean ret;
+ PkLsof *lsof;
+ GPtrArray *pids;
+ gchar **files;
+
+ lsof = pk_lsof_new ();
+ g_assert (lsof != NULL);
+
+ /* refresh lsof data */
+ ret = pk_lsof_refresh (lsof);
+ g_assert (ret);
+
+ /* get pids for some test files */
+ files = pk_test_lsof_get_files ();
+ g_assert_cmpint (g_strv_length (files), >, 0);
+ pids = pk_lsof_get_pids_for_filenames (lsof, files);
+ g_assert_cmpint (pids->len, >, 0);
+ g_ptr_array_unref (pids);
+
+ g_strfreev (files);
+ g_object_unref (lsof);
+}
+
int
main (int argc, char **argv)
{
@@ -33,6 +96,8 @@ main (int argc, char **argv)
g_type_init ();
g_test_init (&argc, &argv, NULL);
+ g_test_add_func ("/plugins/lsof", pk_test_lsof_func);
+
return g_test_run ();
}
commit ca4b404c870ceb682e6f3ad3e6c1298780f86419
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jul 11 12:10:09 2011 +0100
Add an example to contrib to show how to build an out-of-tree plugin
diff --git a/contrib/pk-plugin-external.c b/contrib/pk-plugin-external.c
new file mode 100644
index 0000000..455ab91
--- /dev/null
+++ b/contrib/pk-plugin-external.c
@@ -0,0 +1,143 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/* You need to compile this with the folowing commands:
+ * {
+libtool --mode=compile gcc -Wall -Werror -g -O `pkg-config --cflags --libs packagekit-plugin` -c pk-plugin-external.c
+libtool --mode=link gcc -g -O -module -avoid-version -o libpk-plugin-external.la -rpath /home/hughsie/.root/lib/packagekit-plugins pk-plugin-external.lo
+libtool --mode=install cp libpk-plugin-external.la /home/hughsie/.root/lib/packagekit-plugins/libpk-plugin-external.la
+ *
+ * or, if using automake:
+ * {
+plugindir = $(LIBDIR)/packagekit-plugins
+plugin_LTLIBRARIES = libpk_plugin_external.la
+libpk_plugin_external_la_SOURCES = pk-plugin-external.c
+libpk_plugin_external_la_LIBADD = $(PK_PLUGIN_LIBS)
+libpk_plugin_external_la_LDFLAGS = -module -avoid-version
+libpk_plugin_external_la_CFLAGS = $(PK_PLUGIN_CFLAGS)
+ * }
+ */
+
+#define I_KNOW_THE_PACKAGEKIT_PLUGIN_API_IS_SUBJECT_TO_CHANGE
+#define I_KNOW_THE_PACKAGEKIT_GLIB2_API_IS_SUBJECT_TO_CHANGE
+
+#include <stdlib.h>
+#include <PackageKit/plugin/packagekit-plugin.h>
+
+typedef struct {
+ guint dummy;
+} PluginPrivate;
+
+static PluginPrivate *priv;
+
+/**
+ * pk_transaction_plugin_get_description:
+ */
+const gchar *
+pk_transaction_plugin_get_description (void)
+{
+ return "An external plugin that compiles outside of PK";
+}
+
+/**
+ * pk_transaction_plugin_initialize:
+ */
+void
+pk_transaction_plugin_initialize (PkTransaction *transaction)
+{
+ /* create private area */
+ priv = g_new0 (PluginPrivate, 1);
+ priv->dummy = 999;
+}
+
+/**
+ * pk_transaction_plugin_destroy:
+ */
+void
+pk_transaction_plugin_destroy (PkTransaction *transaction)
+{
+ g_free (priv);
+}
+
+/**
+ * pk_transaction_plugin_run:
+ */
+void
+pk_transaction_plugin_run (PkTransaction *transaction)
+{
+ gboolean ret;
+ PkBackend *backend = NULL;
+ PkConf *conf;
+ PkRoleEnum role;
+
+ /* check the config file */
+ conf = pk_transaction_get_conf (transaction);
+ ret = pk_conf_get_bool (conf, "UseDummy");
+ if (!ret)
+ goto out;
+
+ /* check the role */
+ role = pk_transaction_get_role (transaction);
+ if (role != PK_ROLE_ENUM_REFRESH_CACHE)
+ goto out;
+
+ /* check we can do the action */
+ backend = pk_transaction_get_backend (transaction);
+ if (!pk_backend_is_implemented (backend,
+ PK_ROLE_ENUM_GET_PACKAGES)) {
+ g_debug ("cannot get packages");
+ goto out;
+ }
+out:
+ return;
+}
+
+/**
+ * pk_transaction_plugin_started:
+ */
+void
+pk_transaction_plugin_started (PkTransaction *transaction)
+{
+}
+
+/**
+ * pk_transaction_plugin_finished_start:
+ */
+void
+pk_transaction_plugin_finished_start (PkTransaction *transaction)
+{
+}
+
+/**
+ * pk_transaction_plugin_finished_results:
+ */
+void
+pk_transaction_plugin_finished_results (PkTransaction *transaction)
+{
+}
+
+/**
+ * pk_transaction_plugin_finished_end:
+ */
+void
+pk_transaction_plugin_finished_end (PkTransaction *transaction)
+{
+}
commit 7cd5b68e4427ebe03d393193234e48f4aef6d0a9
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jul 11 11:43:12 2011 +0100
trivial: move the plugins to thier own directory
diff --git a/configure.ac b/configure.ac
index ce6e3e6..a12c36e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -839,7 +839,8 @@ lib/python/Makefile
lib/python/packagekit/Makefile
policy/Makefile
src/Makefile
-src/packagekit-plugin.pc
+src/plugins/Makefile
+src/plugins/packagekit-plugin.pc
client/Makefile
tools/Makefile
po/Makefile.in
diff --git a/src/Makefile.am b/src/Makefile.am
index 14adb0a..a1acbc7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,8 @@
## We require new-style dependency handling.
AUTOMAKE_OPTIONS = 1.7
+SUBDIRS = plugins
+
NULL =
PK_GLIB2_LIBS = \
@@ -153,12 +155,7 @@ BUILT_SOURCES = \
pk-marshal.c \
pk-marshal.h \
org.freedesktop.PackageKit.h \
- org.freedesktop.PackageKit.Transaction.h \
- $(NULL)
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = \
- packagekit-plugin.pc
+ org.freedesktop.PackageKit.Transaction.h
pk-marshal.c: pk-marshal.list
echo "#include \"pk-marshal.h\"" > $@ && \
@@ -228,58 +225,4 @@ clean-local:
CLEANFILES = *~ $(BUILT_SOURCES)
-# plugins
-plugindir = $(LIBDIR)/packagekit-plugins
-noinst_LTLIBRARIES = \
- libpk_plugin_example.la
-
-plugin_LTLIBRARIES = \
- libpk_plugin_scripts.la \
- libpk_plugin-update-package-list.la \
- libpk_plugin-no-update-process.la \
- libpk_plugin-scan-desktop-files.la \
- libpk_plugin-update-check-processes.la \
- libpk_plugin-check-shared-libraries-in-use.la \
- libpk-plugin-clear-firmware-requests.la
-
-libpk_plugin_example_la_SOURCES = pk-plugin-example.c
-libpk_plugin_example_la_LIBADD = $(PK_PLUGIN_LIBS)
-libpk_plugin_example_la_LDFLAGS = -module -avoid-version
-libpk_plugin_example_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
-
-libpk_plugin_scripts_la_SOURCES = pk-plugin-scripts.c
-libpk_plugin_scripts_la_LIBADD = $(PK_PLUGIN_LIBS)
-libpk_plugin_scripts_la_LDFLAGS = -module -avoid-version
-libpk_plugin_scripts_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
-
-libpk_plugin_clear_firmware_requests_la_SOURCES = pk-plugin-clear-firmware-requests.c
-libpk_plugin_clear_firmware_requests_la_LIBADD = $(PK_PLUGIN_LIBS)
-libpk_plugin_clear_firmware_requests_la_LDFLAGS = -module -avoid-version
-libpk_plugin_clear_firmware_requests_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
-
-libpk_plugin_update_package_list_la_SOURCES = pk-plugin-update-package-list.c
-libpk_plugin_update_package_list_la_LIBADD = $(PK_PLUGIN_LIBS)
-libpk_plugin_update_package_list_la_LDFLAGS = -module -avoid-version
-libpk_plugin_update_package_list_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
-
-libpk_plugin_no_update_process_la_SOURCES = pk-plugin-no-update-process.c
-libpk_plugin_no_update_process_la_LIBADD = $(PK_PLUGIN_LIBS)
-libpk_plugin_no_update_process_la_LDFLAGS = -module -avoid-version
-libpk_plugin_no_update_process_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
-
-libpk_plugin_scan_desktop_files_la_SOURCES = pk-plugin-scan-desktop-files.c
-libpk_plugin_scan_desktop_files_la_LIBADD = $(PK_PLUGIN_LIBS)
-libpk_plugin_scan_desktop_files_la_LDFLAGS = -module -avoid-version
-libpk_plugin_scan_desktop_files_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
-
-libpk_plugin_update_check_processes_la_SOURCES = pk-plugin-update-check-processes.c
-libpk_plugin_update_check_processes_la_LIBADD = $(PK_PLUGIN_LIBS)
-libpk_plugin_update_check_processes_la_LDFLAGS = -module -avoid-version
-libpk_plugin_update_check_processes_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
-
-libpk_plugin_check_shared_libraries_in_use_la_SOURCES = pk-plugin-check-shared-libraries-in-use.c
-libpk_plugin_check_shared_libraries_in_use_la_LIBADD = $(PK_PLUGIN_LIBS)
-libpk_plugin_check_shared_libraries_in_use_la_LDFLAGS = -module -avoid-version
-libpk_plugin_check_shared_libraries_in_use_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
-
-include $(top_srcdir)/git.mk
diff --git a/src/packagekit-plugin.pc.in b/src/packagekit-plugin.pc.in
deleted file mode 100644
index ef91181..0000000
--- a/src/packagekit-plugin.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: packagekit-plugin
-Description: PackageKit is a system daemon for installing stuff.
-Version: @VERSION@
-Requires.private: dbus-1, gthread-2.0
-Requires: glib-2.0, gobject-2.0, sqlite3
-Libs: -L${libdir} -lpackagekit-glib2
-Cflags: -I${includedir}/PackageKit
diff --git a/src/pk-plugin-check-shared-libraries-in-use.c b/src/pk-plugin-check-shared-libraries-in-use.c
deleted file mode 100644
index 9a74c95..0000000
--- a/src/pk-plugin-check-shared-libraries-in-use.c
+++ /dev/null
@@ -1,583 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2011 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <config.h>
-#include <gio/gio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <pk-transaction.h>
-
-#include "pk-cache.h"
-#include "pk-lsof.h"
-
-/* for when parsing /etc/login.defs fails */
-#define PK_TRANSACTION_EXTRA_UID_MIN_DEFALT 500
-
-typedef struct {
- GMainLoop *loop;
- GPtrArray *list;
- GPtrArray *pids;
- GPtrArray *files_list;
- PkLsof *lsof;
-} PluginPrivate;
-
-static PluginPrivate *priv;
-
-/**
- * pk_transaction_plugin_get_description:
- */
-const gchar *
-pk_transaction_plugin_get_description (void)
-{
- return "checks for any shared libraries in use after a security update";
-}
-
-/**
- * pk_transaction_plugin_initialize:
- */
-void
-pk_transaction_plugin_initialize (PkTransaction *transaction)
-{
- /* create private area */
- priv = g_new0 (PluginPrivate, 1);
- priv->loop = g_main_loop_new (NULL, FALSE);
- priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
- priv->files_list = g_ptr_array_new_with_free_func (g_free);
- priv->lsof = pk_lsof_new ();
-}
-
-/**
- * pk_transaction_plugin_destroy:
- */
-void
-pk_transaction_plugin_destroy (PkTransaction *transaction)
-{
- g_main_loop_unref (priv->loop);
- g_ptr_array_unref (priv->list);
- g_object_unref (priv->lsof);
- g_ptr_array_unref (priv->files_list);
- if (priv->pids != NULL)
- g_ptr_array_free (priv->pids, TRUE);
- g_free (priv);
-}
-
-/**
- * pk_plugin_finished_cb:
- **/
-static void
-pk_plugin_finished_cb (PkBackend *backend,
- PkExitEnum exit_enum,
- gpointer user_data)
-{
- if (!g_main_loop_is_running (priv->loop))
- return;
- if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
- g_warning ("%s failed with exit code: %s",
- pk_role_enum_to_string (pk_backend_get_role (backend)),
- pk_exit_enum_to_string (exit_enum));
- }
- g_main_loop_quit (priv->loop);
-}
-
-/**
- * pk_plugin_get_installed_package_for_file:
- **/
-static PkPackage *
-pk_plugin_get_installed_package_for_file (PkTransaction *transaction,
- const gchar *filename)
-{
- PkPackage *package = NULL;
- gchar **filenames;
- PkBackend *backend;
-
- /* use PK to find the correct package */
- g_ptr_array_set_size (priv->list, 0);
- backend = pk_transaction_get_backend (transaction);
- pk_backend_reset (backend);
- filenames = g_strsplit (filename, "|||", -1);
- pk_backend_search_files (backend,
- pk_bitfield_value (PK_FILTER_ENUM_INSTALLED),
- filenames);
-
- /* wait for finished */
- g_main_loop_run (priv->loop);
-
- /* check that we only matched one package */
- if (priv->list->len != 1) {
- g_warning ("not correct size, %i", priv->list->len);
- goto out;
- }
-
- /* get the package */
- package = g_ptr_array_index (priv->list, 0);
- if (package == NULL) {
- g_warning ("cannot get package");
- goto out;
- }
-out:
- g_strfreev (filenames);
- return package;
-}
-
-/**
- * pk_plugin_files_cb:
- **/
-static void
-pk_plugin_files_cb (PkBackend *backend,
- PkFiles *files,
- PkTransaction *transaction)
-{
- guint i;
- guint len;
- gchar **filenames = NULL;
-
- /* get data */
- g_object_get (files,
- "files", &filenames,
- NULL);
-
- /* check each file to see if it's a system shared library */
- len = g_strv_length (filenames);
- for (i=0; i<len; i++) {
- /* not a system library */
- if (strstr (filenames[i], "/lib") == NULL)
- continue;
-
- /* not a shared object */
- if (strstr (filenames[i], ".so") == NULL)
- continue;
-
- /* add as it matches the criteria */
- g_debug ("adding filename %s", filenames[i]);
- g_ptr_array_add (priv->files_list,
- g_strdup (filenames[i]));
- }
- g_strfreev (filenames);
-}
-
-/**
- * pk_plugin_get_cmdline:
- **/
-static gchar *
-pk_plugin_get_cmdline (PkTransaction *transaction, guint pid)
-{
- gboolean ret;
- gchar *filename = NULL;
- gchar *cmdline = NULL;
- GError *error = NULL;
-
- /* get command line from proc */
- filename = g_strdup_printf ("/proc/%i/cmdline", pid);
- ret = g_file_get_contents (filename, &cmdline, NULL, &error);
- if (!ret) {
- g_warning ("failed to get cmdline: %s", error->message);
- g_error_free (error);
- goto out;
- }
-out:
- g_free (filename);
- return cmdline;
-}
-
-/**
- * pk_plugin_get_uid:
- **/
-static gint
-pk_plugin_get_uid (PkTransaction *transaction, guint pid)
-{
- gboolean ret;
- gchar *endptr = NULL;
- gchar *filename = NULL;
- gchar *text = NULL;
- guint64 value_raw;
- gint uid = -1;
-
- /* get command line from proc */
- filename = g_strdup_printf ("/proc/%i/loginuid", pid);
- ret = g_file_get_contents (filename, &text, NULL, NULL);
- if (!ret)
- goto out;
-
- /* parse */
- value_raw = g_ascii_strtoull (text, &endptr, 10);
-
- /* parsing error */
- if (endptr == text)
- goto out;
-
- /* out of range */
- if (value_raw > G_MAXUINT)
- goto out;
-
- /* cast back down to value */
- uid = (gint) value_raw;
-out:
- g_free (filename);
- g_free (text);
- return uid;
-}
-
-static guint
-pk_plugin_get_uid_min (void)
-{
- gboolean ret;
- guint i;
- gchar *data = NULL;
- gchar **split = NULL;
- GError *error = NULL;
- guint uid_min = G_MAXUINT;
-
- /* get contents */
- ret = g_file_get_contents ("/etc/login.defs", &data, NULL, &error);
- if (!ret) {
- g_warning ("failed to get login UID_MIN: %s",
- error->message);
- g_error_free (error);
- goto out;
- }
- split = g_strsplit (data, "\n", -1);
- for (i = 0; split[i] != NULL; i++) {
- if (!g_str_has_prefix (split[i], "UID_MIN"))
- continue;
- uid_min = atoi (g_strchug (split[i]+7));
- break;
- }
-out:
- g_free (data);
- g_strfreev (split);
- return uid_min;
-}
-
-/**
- * pk_transaction_plugin_run:
- *
- * This function does the following things:
- * 1) Refreshes the list of open files
- * 2) Gets the list of library files from the security updates
- * 3) Gets a list of pids that are using the libraries
- * 4) The list of pids are converted to a list of files
- * 5) The list of files is converted to a list of packages
- * 6) For each package, emit a RequireRestart of the correct type (according to the UID)
- */
-void
-pk_transaction_plugin_run (PkTransaction *transaction)
-{
- gboolean ret;
- gchar **files = NULL;
- gchar *package_id;
- gchar **package_ids;
- gchar **package_ids_security = NULL;
- GPtrArray *updates = NULL;
- guint i;
- guint j = 0;
- guint length = 0;
- guint files_id = 0;
- guint finished_id = 0;
- PkBackend *backend = NULL;
- PkConf *conf;
- PkInfoEnum info;
- PkPackage *item;
- PkResults *results;
- PkRoleEnum role;
- PkCache *cache = NULL;
-
- /* check the config file */
- conf = pk_transaction_get_conf (transaction);
- ret = pk_conf_get_bool (conf, "CheckSharedLibrariesInUse");
- if (!ret)
- goto out;
-
- /* check the role */
- role = pk_transaction_get_role (transaction);
- if (role != PK_ROLE_ENUM_UPDATE_SYSTEM &&
- role != PK_ROLE_ENUM_UPDATE_PACKAGES &&
- role != PK_ROLE_ENUM_INSTALL_PACKAGES)
- goto out;
-
- /* check we can do the action */
- backend = pk_transaction_get_backend (transaction);
- if (!pk_backend_is_implemented (backend,
- PK_ROLE_ENUM_GET_FILES)) {
- g_debug ("cannot get files");
- goto out;
- }
- files_id = g_signal_connect (backend, "files",
- G_CALLBACK (pk_plugin_files_cb), NULL);
- finished_id = g_signal_connect (backend, "finished",
- G_CALLBACK (pk_plugin_finished_cb), NULL);
-
- /* do we have a cache */
- cache = pk_cache_new ();
- results = pk_cache_get_results (cache, PK_ROLE_ENUM_GET_UPDATES);
- if (results == NULL) {
- g_warning ("no updates cache");
- goto out;
- }
-
- /* find security update packages */
- updates = pk_results_get_package_array (results);
- for (i=0; i<updates->len; i++) {
- item = g_ptr_array_index (updates, i);
- g_object_get (item,
- "info", &info,
- "package-id", &package_id,
- NULL);
- if (info == PK_INFO_ENUM_SECURITY) {
- g_debug ("security update: %s", package_id);
- length++;
- }
- g_free (package_id);
- }
-
- /* nothing to scan for */
- if (length == 0) {
- g_debug ("no security updates");
- goto out;
- }
-
- /* create list of security packages */
- package_ids_security = g_new0 (gchar *, length+1);
- for (i=0; i<updates->len; i++) {
- item = g_ptr_array_index (updates, i);
- g_object_get (item,
- "info", &info,
- "package-id", &package_id,
- NULL);
- if (info == PK_INFO_ENUM_SECURITY)
- package_ids_security[j++] = g_strdup (package_id);
- g_free (package_id);
- }
-
- /* is a security update we are installing */
- package_ids = pk_transaction_get_package_ids (transaction);
- if (role == PK_ROLE_ENUM_INSTALL_PACKAGES) {
- ret = FALSE;
-
- /* do any of the packages we are updating match */
- for (i=0; package_ids_security[i] != NULL; i++) {
- for (j=0; package_ids[j] != NULL; j++) {
- if (g_strcmp0 (package_ids_security[i],
- package_ids[j]) == 0) {
- ret = TRUE;
- break;
- }
- }
- }
-
- /* nothing matched */
- if (!ret) {
- g_debug ("not installing a security update package");
- goto out;
- }
- }
-
- /* reset */
- g_ptr_array_set_size (priv->files_list, 0);
-
- if (priv->pids != NULL) {
- g_ptr_array_free (priv->pids, TRUE);
- priv->pids = NULL;
- }
-
- /* set status */
- pk_backend_set_status (backend, PK_STATUS_ENUM_SCAN_PROCESS_LIST);
- pk_backend_set_percentage (backend, 101);
-
- /* get list from lsof */
- ret = pk_lsof_refresh (priv->lsof);
- if (!ret) {
- g_warning ("failed to refresh");
- goto out;
- }
-
- /* get all the files touched in the packages we just updated */
- pk_backend_reset (backend);
- pk_backend_set_status (backend, PK_STATUS_ENUM_CHECK_LIBRARIES);
- pk_backend_get_files (backend, package_ids_security);
-
- /* wait for finished */
- g_main_loop_run (priv->loop);
-
- /* nothing to do */
- if (priv->files_list->len == 0) {
- g_debug ("no files");
- goto out;
- }
-
- /* get the list of PIDs */
- files = pk_ptr_array_to_strv (priv->files_list);
- priv->pids = pk_lsof_get_pids_for_filenames (priv->lsof, files);
-
- /* nothing depends on these libraries */
- if (priv->pids == NULL) {
- g_warning ("failed to get process list");
- goto out;
- }
-
- /* nothing depends on these libraries */
- if (priv->pids->len == 0) {
- g_debug ("no processes depend on these libraries");
- goto out;
- }
-
- /* don't emit until we've run the transaction and it's success */
- pk_backend_set_percentage (backend, 100);
-out:
- if (backend != NULL) {
- if (files_id > 0)
- g_signal_handler_disconnect (backend, files_id);
- if (finished_id > 0)
- g_signal_handler_disconnect (backend, finished_id);
- }
- g_strfreev (files);
- if (updates != NULL)
- g_ptr_array_unref (updates);
- if (cache != NULL)
- g_object_unref (cache);
- g_strfreev (package_ids_security);
-}
-
-/**
- * pk_transaction_plugin_finished_results:
- */
-void
-pk_transaction_plugin_finished_results (PkTransaction *transaction)
-{
- gboolean ret;
- PkBackend *backend = NULL;
- PkConf *conf;
- PkRoleEnum role;
- gint uid;
- guint i;
- guint pid;
- gchar *filename;
- gchar *cmdline;
- gchar *cmdline_full;
- GPtrArray *files_session = NULL;
- GPtrArray *files_system = NULL;
- PkPackage *package;
- GPtrArray *pids;
- guint uid_min;
-
- /* check the config file */
- conf = pk_transaction_get_conf (transaction);
- ret = pk_conf_get_bool (conf, "CheckSharedLibrariesInUse");
- if (!ret)
- goto out;
-
- /* check the role */
- role = pk_transaction_get_role (transaction);
- if (role != PK_ROLE_ENUM_GET_UPDATES)
- goto out;
-
- /* check we can do the action */
- backend = pk_transaction_get_backend (transaction);
- if (!pk_backend_is_implemented (backend,
- PK_ROLE_ENUM_GET_PACKAGES)) {
- g_debug ("cannot get packages");
- goto out;
- }
-
- /* create arrays */
- files_session = g_ptr_array_new_with_free_func (g_free);
- files_system = g_ptr_array_new_with_free_func (g_free);
-
- /* get local array */
- pids = priv->pids;
- if (pids == NULL)
- goto out;
-
- /* set status */
- pk_backend_set_status (backend, PK_STATUS_ENUM_CHECK_LIBRARIES);
-
- /* get user UID range */
- uid_min = pk_plugin_get_uid_min ();
- if (uid_min == G_MAXUINT)
- uid_min = PK_TRANSACTION_EXTRA_UID_MIN_DEFALT;
-
- /* find the package name of each pid */
- for (i=0; i<pids->len; i++) {
- pid = GPOINTER_TO_INT (g_ptr_array_index (pids, i));
-
- /* get user */
- uid = pk_plugin_get_uid (transaction, pid);
- if (uid < 0)
- continue;
-
- /* get command line */
- cmdline = pk_plugin_get_cmdline (transaction, pid);
- if (cmdline == NULL)
- continue;
-
- /* prepend path if it does not already exist */
- if (cmdline[0] == '/')
- cmdline_full = g_strdup (cmdline);
- else
- cmdline_full = g_strdup_printf ("/usr/bin/%s", cmdline);
-
- g_debug ("pid=%i: %s (%i)", pid, cmdline_full, uid);
- if (uid < 500)
- g_ptr_array_add (files_system, cmdline_full);
- else
- g_ptr_array_add (files_session, cmdline_full);
- g_free (cmdline);
- }
-
- /* we found nothing */
- if (files_system->len == 0 && files_session->len == 0) {
- g_warning ("no pids could be resolved");
- goto out;
- }
-
- /* process all session restarts */
- for (i=0; i<files_session->len; i++) {
- filename = g_ptr_array_index (files_session, i);
-
- package = pk_plugin_get_installed_package_for_file (transaction,
- filename);
- if (package == NULL) {
- g_debug ("failed to find package for %s", filename);
- continue;
- }
- pk_backend_require_restart (backend,
- PK_RESTART_ENUM_SECURITY_SESSION,
- pk_package_get_id (package));
- }
-
- /* process all system restarts */
- for (i=0; i<files_system->len; i++) {
- filename = g_ptr_array_index (files_system, i);
-
- package = pk_plugin_get_installed_package_for_file (transaction,
- filename);
- if (package == NULL) {
- g_debug ("failed to find package for %s", filename);
- continue;
- }
- pk_backend_require_restart (backend, PK_RESTART_ENUM_SECURITY_SYSTEM, pk_package_get_id (package));
- }
-out:
- if (files_session != NULL)
- g_ptr_array_free (files_session, TRUE);
- if (files_system != NULL)
- g_ptr_array_free (files_system, TRUE);
-}
diff --git a/src/pk-plugin-clear-firmware-requests.c b/src/pk-plugin-clear-firmware-requests.c
deleted file mode 100644
index 45b5593..0000000
--- a/src/pk-plugin-clear-firmware-requests.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2011 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <config.h>
-#include <gio/gio.h>
-
-#include "pk-transaction.h"
-#include "pk-shared.h"
-
-/**
- * pk_transaction_plugin_get_description:
- */
-const gchar *
-pk_transaction_plugin_get_description (void)
-{
- return "Clears firmware requests";
-}
-
-/**
- * pk_transaction_plugin_finished_end:
- */
-void
-pk_transaction_plugin_finished_end (PkTransaction *transaction)
-{
- gboolean ret;
- gchar *filename = NULL;
- PkRoleEnum role;
-
- role = pk_transaction_get_role (transaction);
- if (role != PK_ROLE_ENUM_REFRESH_CACHE)
- goto out;
-
- /* clear the firmware requests directory */
- filename = g_build_filename (LOCALSTATEDIR, "run", "PackageKit", "udev", NULL);
- g_debug ("clearing udev firmware requests at %s", filename);
- ret = pk_directory_remove_contents (filename);
- if (!ret)
- g_warning ("failed to clear %s", filename);
-out:
- g_free (filename);
-}
diff --git a/src/pk-plugin-example.c b/src/pk-plugin-example.c
deleted file mode 100644
index 7eb6708..0000000
--- a/src/pk-plugin-example.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2011 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <config.h>
-#include <gio/gio.h>
-#include <pk-transaction.h>
-
-typedef struct {
- guint dummy;
-} PluginPrivate;
-
-static PluginPrivate *priv;
-
-/**
- * pk_transaction_plugin_get_description:
- */
-const gchar *
-pk_transaction_plugin_get_description (void)
-{
- return "A dummy plugin that doesn't do anything";
-}
-
-/**
- * pk_transaction_plugin_initialize:
- */
-void
-pk_transaction_plugin_initialize (PkTransaction *transaction)
-{
- /* create private area */
- priv = g_new0 (PluginPrivate, 1);
- priv->dummy = 999;
-}
-
-/**
- * pk_transaction_plugin_destroy:
- */
-void
-pk_transaction_plugin_destroy (PkTransaction *transaction)
-{
- g_free (priv);
-}
-
-/**
- * pk_transaction_plugin_run:
- */
-void
-pk_transaction_plugin_run (PkTransaction *transaction)
-{
- gboolean ret;
- PkBackend *backend = NULL;
- PkConf *conf;
- PkRoleEnum role;
-
- /* check the config file */
- conf = pk_transaction_get_conf (transaction);
- ret = pk_conf_get_bool (conf, "UseDummy");
- if (!ret)
- goto out;
-
- /* check the role */
- role = pk_transaction_get_role (transaction);
- if (role != PK_ROLE_ENUM_REFRESH_CACHE)
- goto out;
-
- /* check we can do the action */
- backend = pk_transaction_get_backend (transaction);
- if (!pk_backend_is_implemented (backend,
- PK_ROLE_ENUM_GET_PACKAGES)) {
- g_debug ("cannot get packages");
- goto out;
- }
-out:
- return;
-}
-
-/**
- * pk_transaction_plugin_started:
- */
-void
-pk_transaction_plugin_started (PkTransaction *transaction)
-{
-}
-
-/**
- * pk_transaction_plugin_finished_start:
- */
-void
-pk_transaction_plugin_finished_start (PkTransaction *transaction)
-{
-}
-
-/**
- * pk_transaction_plugin_finished_results:
- */
-void
-pk_transaction_plugin_finished_results (PkTransaction *transaction)
-{
-}
-
-/**
- * pk_transaction_plugin_finished_end:
- */
-void
-pk_transaction_plugin_finished_end (PkTransaction *transaction)
-{
-}
diff --git a/src/pk-plugin-no-update-process.c b/src/pk-plugin-no-update-process.c
deleted file mode 100644
index 2039f07..0000000
--- a/src/pk-plugin-no-update-process.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2011 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <config.h>
-#include <gio/gio.h>
-#include <pk-transaction.h>
-
-#include <packagekit-glib2/pk-package.h>
-#include <packagekit-glib2/pk-files.h>
-
-#include "pk-proc.h"
-
-typedef struct {
- GMainLoop *loop;
- GPtrArray *files_list;
- gchar **no_update_process_list;
- PkProc *proc;
-} PluginPrivate;
-
-static PluginPrivate *priv;
-
-/**
- * pk_transaction_plugin_get_description:
- */
-const gchar *
-pk_transaction_plugin_get_description (void)
-{
- return "Updates the package lists after refresh";
-}
-
-/**
- * pk_plugin_finished_cb:
- **/
-static void
-pk_plugin_finished_cb (PkBackend *backend,
- PkExitEnum exit_enum,
- gpointer user_data)
-{
- if (!g_main_loop_is_running (priv->loop))
- return;
- if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
- g_warning ("%s failed with exit code: %s",
- pk_role_enum_to_string (pk_backend_get_role (backend)),
- pk_exit_enum_to_string (exit_enum));
- }
- g_main_loop_quit (priv->loop);
-}
-
-/**
- * pk_transaction_plugin_initialize:
- */
-void
-pk_transaction_plugin_initialize (PkTransaction *transaction)
-{
- PkConf *conf;
-
- /* create private area */
- priv = g_new0 (PluginPrivate, 1);
- priv->loop = g_main_loop_new (NULL, FALSE);
- priv->files_list = g_ptr_array_new_with_free_func (g_free);
- priv->proc = pk_proc_new ();
-
- /* get the list of processes we should neverupdate when running */
- conf = pk_transaction_get_conf (transaction);
- priv->no_update_process_list = pk_conf_get_strv (conf, "NoUpdateProcessList");
-}
-
-/**
- * pk_transaction_plugin_destroy:
- */
-void
-pk_transaction_plugin_destroy (PkTransaction *transaction)
-{
- g_main_loop_unref (priv->loop);
- g_strfreev (priv->no_update_process_list);
- g_ptr_array_unref (priv->files_list);
- g_object_unref (priv->proc);
- g_free (priv);
-}
-
-/**
- * pk_plugin_match_running_file:
- *
- * Only if the pattern matches the old and new names we refuse to run
- **/
-static gboolean
-pk_plugin_match_running_file (gpointer user_data, const gchar *filename)
-{
- guint i;
- gchar **list;
- gboolean ret;
-
- /* compare each pattern */
- list = priv->no_update_process_list;
- for (i=0; list[i] != NULL; i++) {
-
- /* does the package filename match */
- ret = g_pattern_match_simple (list[i], filename);
- if (ret) {
- /* is there a running process that also matches */
- ret = pk_proc_find_exec (priv->proc, list[i]);
- if (ret)
- goto out;
- }
- }
-
- /* we failed */
- ret = FALSE;
-out:
- return ret;
-}
-
-/**
- * pk_plugin_files_cb:
- **/
-static void
-pk_plugin_files_cb (PkBackend *backend,
- PkFiles *files,
- gpointer user_data)
-{
- guint i;
- guint len;
- gboolean ret;
- gchar **filenames = NULL;
-
- /* get data */
- g_object_get (files,
- "files", &filenames,
- NULL);
-
- /* check each file to see if it's a system shared library */
- len = g_strv_length (filenames);
- g_debug ("len=%i", len);
- for (i=0; i<len; i++) {
-
- /* does the package filename match */
- ret = pk_plugin_match_running_file (backend, filenames[i]);
- if (!ret)
- continue;
-
- /* add as it matches the criteria */
- g_debug ("adding filename %s", filenames[i]);
- g_ptr_array_add (priv->files_list, g_strdup (filenames[i]));
- }
- g_strfreev (filenames);
-}
-
-/**
- * pk_transaction_plugin_run:
- */
-void
-pk_transaction_plugin_run (PkTransaction *transaction)
-{
- const gchar *file;
- gboolean ret;
- gchar **files = NULL;
- gchar **package_ids;
- gchar *process = NULL;
- guint files_id = 0;
- guint finished_id = 0;
- PkBackend *backend = NULL;
- PkRoleEnum role;
-
- /* check the role */
- role = pk_transaction_get_role (transaction);
- if (role != PK_ROLE_ENUM_UPDATE_PACKAGES)
- goto out;
-
- /* check we can do the action */
- backend = pk_transaction_get_backend (transaction);
- if (!pk_backend_is_implemented (backend,
- PK_ROLE_ENUM_GET_FILES)) {
- g_debug ("cannot get files");
- goto out;
- }
-
- /* check we have entry */
- if (priv->no_update_process_list == NULL ||
- priv->no_update_process_list[0] == NULL) {
- g_debug ("no processes to watch");
- goto out;
- }
-
- /* reset */
- g_ptr_array_set_size (priv->files_list, 0);
-
- /* set status */
- pk_backend_set_status (backend, PK_STATUS_ENUM_SCAN_PROCESS_LIST);
- pk_backend_set_percentage (backend, 101);
-
- /* get list from proc */
- ret = pk_proc_refresh (priv->proc);
- if (!ret) {
- g_warning ("failed to refresh");
- /* non-fatal */
- goto out;
- }
-
- /* set status */
- pk_backend_set_status (backend, PK_STATUS_ENUM_CHECK_EXECUTABLE_FILES);
-
- files_id = g_signal_connect (backend, "files",
- G_CALLBACK (pk_plugin_files_cb), NULL);
- finished_id = g_signal_connect (backend, "finished",
- G_CALLBACK (pk_plugin_finished_cb), NULL);
-
- /* get all the files touched in the packages we just updated */
- package_ids = pk_transaction_get_package_ids (transaction);
- pk_backend_reset (backend);
- pk_backend_get_files (backend, package_ids);
-
- /* wait for finished */
- g_main_loop_run (priv->loop);
- pk_backend_set_percentage (backend, 100);
-
- /* there is a file we can't COW */
- if (priv->files_list->len != 0) {
- file = g_ptr_array_index (priv->files_list, 0);
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_UPDATE_FAILED_DUE_TO_RUNNING_PROCESS,
- "failed to run as %s is running", file);
- goto out;
- }
-out:
- if (files_id > 0)
- g_signal_handler_disconnect (backend, files_id);
- if (finished_id > 0)
- g_signal_handler_disconnect (backend, finished_id);
- g_strfreev (files);
- g_free (process);
-}
diff --git a/src/pk-plugin-scan-desktop-files.c b/src/pk-plugin-scan-desktop-files.c
deleted file mode 100644
index b30bb97..0000000
--- a/src/pk-plugin-scan-desktop-files.c
+++ /dev/null
@@ -1,683 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2011 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <config.h>
-#include <gio/gdesktopappinfo.h>
-#include <gio/gio.h>
-#include <pk-transaction.h>
-#include <sqlite3.h>
-
-#include <packagekit-glib2/pk-desktop.h>
-#include <packagekit-glib2/pk-package.h>
-
-typedef struct {
- sqlite3 *db;
- GPtrArray *list;
- GMainLoop *loop;
- GHashTable *hash;
-} PluginPrivate;
-
-static PluginPrivate *priv;
-
-/**
- * pk_transaction_plugin_get_description:
- */
-const gchar *
-pk_transaction_plugin_get_description (void)
-{
- return "Scans desktop files on refresh and adds them to a database";
-}
-
-/**
- * pk_plugin_package_cb:
- **/
-static void
-pk_plugin_package_cb (PkBackend *backend,
- PkPackage *package,
- gpointer user_data)
-{
- g_ptr_array_add (priv->list, g_object_ref (package));
-}
-
-/**
- * pk_plugin_finished_cb:
- **/
-static void
-pk_plugin_finished_cb (PkBackend *backend,
- PkExitEnum exit_enum,
- gpointer user_data)
-{
- if (!g_main_loop_is_running (priv->loop))
- return;
- if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
- g_warning ("%s failed with exit code: %s",
- pk_role_enum_to_string (pk_backend_get_role (backend)),
- pk_exit_enum_to_string (exit_enum));
- }
- g_main_loop_quit (priv->loop);
-}
-
-/**
- * pk_transaction_plugin_initialize:
- */
-void
-pk_transaction_plugin_initialize (PkTransaction *transaction)
-{
- const gchar *statement_create;
- gboolean ret;
- gchar *error_msg = NULL;
- gint rc;
- PkConf *conf;
-
- /* create private area */
- priv = g_new0 (PluginPrivate, 1);
- priv->loop = g_main_loop_new (NULL, FALSE);
- priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
- priv->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-
- /* check the config file */
- conf = pk_transaction_get_conf (transaction);
- ret = pk_conf_get_bool (conf, "ScanDesktopFiles");
- if (!ret)
- goto out;
-
- /* check if database exists */
- ret = g_file_test (PK_DESKTOP_DEFAULT_DATABASE,
- G_FILE_TEST_EXISTS);
-
- g_debug ("trying to open database '%s'",
- PK_DESKTOP_DEFAULT_DATABASE);
- rc = sqlite3_open (PK_DESKTOP_DEFAULT_DATABASE, &priv->db);
- if (rc != 0) {
- g_warning ("Can't open desktop database: %s\n",
- sqlite3_errmsg (priv->db));
- sqlite3_close (priv->db);
- priv->db = NULL;
- goto out;
- }
-
- /* create if not exists */
- if (!ret) {
- g_debug ("creating database cache in %s",
- PK_DESKTOP_DEFAULT_DATABASE);
- statement_create = "CREATE TABLE cache ("
- "filename TEXT,"
- "package TEXT,"
- "show INTEGER,"
- "md5 TEXT);";
- rc = sqlite3_exec (priv->db, statement_create,
- NULL, NULL, &error_msg);
- if (rc != SQLITE_OK) {
- g_warning ("SQL error: %s\n", error_msg);
- sqlite3_free (error_msg);
- goto out;
- }
- }
-
- /* we don't need to keep syncing */
- sqlite3_exec (priv->db, "PRAGMA synchronous=OFF", NULL, NULL, NULL);
-
-out:
- return;
-}
-
-/**
- * pk_transaction_plugin_destroy:
- */
-void
-pk_transaction_plugin_destroy (PkTransaction *transaction)
-{
- g_ptr_array_unref (priv->list);
- g_main_loop_unref (priv->loop);
- g_hash_table_unref (priv->hash);
- sqlite3_close (priv->db);
- g_free (priv);
-}
-
-/**
- * pk_plugin_get_filename_md5:
- **/
-static gchar *
-pk_plugin_get_filename_md5 (const gchar *filename)
-{
- gchar *md5 = NULL;
- gchar *data = NULL;
- gsize length;
- GError *error = NULL;
- gboolean ret;
-
- /* check is no longer exists */
- ret = g_file_test (filename, G_FILE_TEST_EXISTS);
- if (!ret)
- goto out;
-
- /* get data */
- ret = g_file_get_contents (filename, &data, &length, &error);
- if (!ret) {
- g_warning ("failed to open file %s: %s",
- filename, error->message);
- g_error_free (error);
- goto out;
- }
-
- /* check md5 is same */
- md5 = g_compute_checksum_for_data (G_CHECKSUM_MD5,
- (const guchar *) data,
- length);
-out:
- g_free (data);
- return md5;
-}
-
-/**
- * pk_plugin_sqlite_remove_filename:
- **/
-static gint
-pk_plugin_sqlite_remove_filename (PkTransaction *transaction,
- const gchar *filename)
-{
- gchar *statement;
- gint rc;
-
- statement = g_strdup_printf ("DELETE FROM cache WHERE filename = '%s'",
- filename);
- rc = sqlite3_exec (priv->db, statement, NULL, NULL, NULL);
- g_free (statement);
- return rc;
-}
-
-/**
- * pk_plugin_get_installed_package_for_file:
- **/
-static PkPackage *
-pk_plugin_get_installed_package_for_file (PkTransaction *transaction,
- const gchar *filename)
-{
- PkPackage *package = NULL;
- gchar **filenames;
- PkBackend *backend = NULL;
-
- /* use PK to find the correct package */
- if (priv->list->len > 0)
- g_ptr_array_set_size (priv->list, 0);
- backend = pk_transaction_get_backend (transaction);
- pk_backend_reset (backend);
- filenames = g_strsplit (filename, "|||", -1);
- pk_backend_search_files (backend,
- pk_bitfield_value (PK_FILTER_ENUM_INSTALLED),
- filenames);
- g_strfreev (filenames);
-
- /* wait for finished */
- g_main_loop_run (priv->loop);
-
- /* check that we only matched one package */
- if (priv->list->len != 1) {
- g_warning ("not correct size, %i", priv->list->len);
- goto out;
- }
-
- /* get the package */
- package = g_ptr_array_index (priv->list, 0);
- if (package == NULL) {
- g_warning ("cannot get package");
- goto out;
- }
-out:
- return package;
-}
-
-/**
- * pk_plugin_sqlite_add_filename_details:
- **/
-static gint
-pk_plugin_sqlite_add_filename_details (PkTransaction *transaction,
- const gchar *filename,
- const gchar *package,
- const gchar *md5)
-{
- gchar *statement;
- gchar *error_msg = NULL;
- sqlite3_stmt *sql_statement = NULL;
- gint rc = -1;
- gint show;
- GDesktopAppInfo *info;
-
- /* find out if we should show desktop file in menus */
- info = g_desktop_app_info_new_from_filename (filename);
- if (info == NULL) {
- g_warning ("could not load desktop file %s", filename);
- goto out;
- }
- show = g_app_info_should_show (G_APP_INFO (info));
- g_object_unref (info);
-
- g_debug ("add filename %s from %s with md5: %s (show: %i)",
- filename, package, md5, show);
-
- /* the row might already exist */
- statement = g_strdup_printf ("DELETE FROM cache WHERE filename = '%s'",
- filename);
- sqlite3_exec (priv->db, statement, NULL, NULL, NULL);
- g_free (statement);
-
- /* prepare the query, as we don't escape it */
- rc = sqlite3_prepare_v2 (priv->db,
- "INSERT INTO cache (filename, package, show, md5) "
- "VALUES (?, ?, ?, ?)",
- -1, &sql_statement, NULL);
- if (rc != SQLITE_OK) {
- g_warning ("SQL failed to prepare: %s",
- sqlite3_errmsg (priv->db));
- goto out;
- }
-
- /* add data */
- sqlite3_bind_text (sql_statement, 1, filename, -1, SQLITE_STATIC);
- sqlite3_bind_text (sql_statement, 2, package, -1, SQLITE_STATIC);
- sqlite3_bind_int (sql_statement, 3, show);
- sqlite3_bind_text (sql_statement, 4, md5, -1, SQLITE_STATIC);
-
- /* save this */
- sqlite3_step (sql_statement);
- rc = sqlite3_finalize (sql_statement);
- if (rc != SQLITE_OK) {
- g_warning ("SQL error: %s\n", error_msg);
- sqlite3_free (error_msg);
- goto out;
- }
-out:
- return rc;
-}
-
-/**
- * pk_plugin_sqlite_add_filename:
- **/
-static gint
-pk_plugin_sqlite_add_filename (PkTransaction *transaction,
- const gchar *filename,
- const gchar *md5_opt)
-{
- gchar *md5 = NULL;
- gint rc = -1;
- PkPackage *package;
-
- /* if we've got it, use old data */
- if (md5_opt != NULL)
- md5 = g_strdup (md5_opt);
- else
- md5 = pk_plugin_get_filename_md5 (filename);
-
- /* resolve */
- package = pk_plugin_get_installed_package_for_file (transaction,
- filename);
- if (package == NULL) {
- g_warning ("failed to get list");
- goto out;
- }
-
- /* add */
- rc = pk_plugin_sqlite_add_filename_details (transaction,
- filename,
- pk_package_get_name (package),
- md5);
-out:
- g_free (md5);
- return rc;
-}
-
-/**
- * pk_plugin_sqlite_cache_rescan_cb:
- **/
-static gint
-pk_plugin_sqlite_cache_rescan_cb (void *data,
- gint argc,
- gchar **argv,
- gchar **col_name)
-{
- PkTransaction *transaction = PK_TRANSACTION (data);
- const gchar *filename = NULL;
- const gchar *md5 = NULL;
- gchar *md5_calc = NULL;
- gint i;
-
- /* add the filename data to the array */
- for (i=0; i<argc; i++) {
- if (g_strcmp0 (col_name[i], "filename") == 0 && argv[i] != NULL)
- filename = argv[i];
- else if (g_strcmp0 (col_name[i], "md5") == 0 && argv[i] != NULL)
- md5 = argv[i];
- }
-
- /* sanity check */
- if (filename == NULL || md5 == NULL) {
- g_warning ("filename %s and md5 %s)", filename, md5);
- goto out;
- }
-
- /* get md5 */
- md5_calc = pk_plugin_get_filename_md5 (filename);
- if (md5_calc == NULL) {
- g_debug ("remove of %s as no longer found", filename);
- pk_plugin_sqlite_remove_filename (transaction, filename);
- goto out;
- }
-
- /* we've checked the file */
- g_hash_table_insert (priv->hash,
- g_strdup (filename),
- GUINT_TO_POINTER (1));
-
- /* check md5 is same */
- if (g_strcmp0 (md5, md5_calc) != 0) {
- g_debug ("add of %s as md5 invalid (%s vs %s)",
- filename, md5, md5_calc);
- pk_plugin_sqlite_add_filename (transaction,
- filename,
- md5_calc);
- }
-
- g_debug ("existing filename %s valid, md5=%s", filename, md5);
-out:
- g_free (md5_calc);
- return 0;
-}
-
-/**
- * pk_plugin_get_desktop_files:
- **/
-static void
-pk_plugin_get_desktop_files (PkTransaction *transaction,
- const gchar *app_dir,
- GPtrArray *array)
-{
- GError *error = NULL;
- GDir *dir;
- const gchar *filename;
- gpointer data;
- gchar *path;
-
- /* open directory */
- dir = g_dir_open (app_dir, 0, &error);
- if (dir == NULL) {
- g_warning ("failed to open directory %s: %s",
- app_dir, error->message);
- g_error_free (error);
- return;
- }
-
- /* go through desktop files and add them to an array
- * if not present */
- filename = g_dir_read_name (dir);
- while (filename != NULL) {
- path = g_build_filename (app_dir, filename, NULL);
- if (g_file_test (path, G_FILE_TEST_IS_DIR)) {
- pk_plugin_get_desktop_files (transaction,
- path, array);
- } else if (g_str_has_suffix (filename, ".desktop")) {
- data = g_hash_table_lookup (priv->hash, path);
- if (data == NULL) {
- g_debug ("add of %s as not present in db",
- path);
- g_ptr_array_add (array, g_strdup (path));
- }
- }
- g_free (path);
- filename = g_dir_read_name (dir);
- }
- g_dir_close (dir);
-}
-
-/**
- * pk_transaction_plugin_finished_end:
- */
-void
-pk_transaction_plugin_finished_end (PkTransaction *transaction)
-{
- gchar *error_msg = NULL;
- gchar *path;
- gchar *statement;
- gfloat step;
- gint rc;
- GPtrArray *array = NULL;
- guint finished_id = 0;
- guint i;
- guint package_id = 0;
- PkBackend *backend = NULL;
- PkRoleEnum role;
-
- /* no database */
- if (priv->db == NULL)
- goto out;
-
- /* check the role */
- role = pk_transaction_get_role (transaction);
- if (role != PK_ROLE_ENUM_REFRESH_CACHE)
- goto out;
-
- /* connect to backend */
- backend = pk_transaction_get_backend (transaction);
- if (!pk_backend_is_implemented (backend,
- PK_ROLE_ENUM_SEARCH_FILE)) {
- g_debug ("cannot search files");
- goto out;
- }
- finished_id = g_signal_connect (backend, "finished",
- G_CALLBACK (pk_plugin_finished_cb), NULL);
- package_id = g_signal_connect (backend, "package",
- G_CALLBACK (pk_plugin_package_cb), NULL);
-
- /* use a local backend instance */
- pk_backend_reset (backend);
- pk_backend_set_status (backend,
- PK_STATUS_ENUM_SCAN_APPLICATIONS);
-
- /* reset hash */
- g_hash_table_remove_all (priv->hash);
- pk_backend_set_percentage (backend, 101);
-
- /* first go through the existing data, and look for
- * modifications and removals */
- statement = g_strdup ("SELECT filename, md5 FROM cache");
- rc = sqlite3_exec (priv->db,
- statement,
- pk_plugin_sqlite_cache_rescan_cb,
- transaction,
- &error_msg);
- g_free (statement);
- if (rc != SQLITE_OK) {
- g_warning ("SQL error: %s\n", error_msg);
- sqlite3_free (error_msg);
- goto out;
- }
-
- array = g_ptr_array_new_with_free_func (g_free);
- pk_plugin_get_desktop_files (transaction,
- PK_DESKTOP_DEFAULT_APPLICATION_DIR,
- array);
-
- if (array->len) {
- step = 100.0f / array->len;
- pk_backend_set_status (backend,
- PK_STATUS_ENUM_GENERATE_PACKAGE_LIST);
-
- /* process files in an array */
- for (i=0; i<array->len; i++) {
- pk_backend_set_percentage (backend, i * step);
- path = g_ptr_array_index (array, i);
- pk_plugin_sqlite_add_filename (transaction,
- path,
- NULL);
- }
- }
-
- pk_backend_set_percentage (backend, 100);
- pk_backend_set_status (backend, PK_STATUS_ENUM_FINISHED);
-out:
- if (array != NULL)
- g_ptr_array_unref (array);
- if (backend == NULL) {
- if (package_id > 0)
- g_signal_handler_disconnect (backend, package_id);
- if (finished_id > 0)
- g_signal_handler_disconnect (backend, finished_id);
- }
-}
-
-/**
- * pk_plugin_files_cb:
- **/
-static void
-pk_plugin_files_cb (PkBackend *backend,
- PkFiles *files,
- PkTransaction *transaction)
-{
- guint i;
- guint len;
- gboolean ret;
- gchar **package;
- gchar *md5;
- gchar **filenames = NULL;
- gchar *package_id = NULL;
-
- /* get data */
- g_object_get (files,
- "package-id", &package_id,
- "files", &filenames,
- NULL);
-
- package = pk_package_id_split (package_id);
-
- /* check each file */
- len = g_strv_length (filenames);
- for (i=0; i<len; i++) {
- /* exists? */
- ret = g_file_test (filenames[i], G_FILE_TEST_EXISTS);
- if (!ret)
- continue;
-
- /* .desktop file? */
- ret = g_str_has_suffix (filenames[i], ".desktop");
- if (!ret)
- continue;
-
- g_debug ("adding filename %s", filenames[i]);
- md5 = pk_plugin_get_filename_md5 (filenames[i]);
- pk_plugin_sqlite_add_filename_details (transaction,
- filenames[i],
- package[PK_PACKAGE_ID_NAME],
- md5);
- g_free (md5);
- }
- g_strfreev (filenames);
- g_strfreev (package);
- g_free (package_id);
-}
-
-/**
- * pk_transaction_plugin_finished_results:
- */
-void
-pk_transaction_plugin_finished_results (PkTransaction *transaction)
-{
- gchar **package_ids = NULL;
- gchar *package_id_tmp;
- GPtrArray *array = NULL;
- GPtrArray *list = NULL;
- guint files_id = 0;
- guint finished_id = 0;
- guint i;
- PkBackend *backend = NULL;
- PkInfoEnum info;
- PkPackage *item;
- PkResults *results;
- PkRoleEnum role;
-
- /* no database */
- if (priv->db == NULL)
- goto out;
-
- /* check the role */
- role = pk_transaction_get_role (transaction);
- if (role != PK_ROLE_ENUM_INSTALL_PACKAGES)
- goto out;
-
- /* connect to backend */
- backend = pk_transaction_get_backend (transaction);
- if (!pk_backend_is_implemented (backend,
- PK_ROLE_ENUM_GET_FILES)) {
- g_debug ("cannot get files");
- goto out;
- }
- finished_id = g_signal_connect (backend, "finished",
- G_CALLBACK (pk_plugin_finished_cb), NULL);
- files_id = g_signal_connect (backend, "files",
- G_CALLBACK (pk_plugin_files_cb), NULL);
-
- /* get results */
- results = pk_transaction_get_results (transaction);
- array = pk_results_get_package_array (results);
-
- /* filter on INSTALLING | UPDATING */
- list = g_ptr_array_new_with_free_func (g_free);
- for (i=0; i<array->len; i++) {
- item = g_ptr_array_index (array, i);
- info = pk_package_get_info (item);
- if (info == PK_INFO_ENUM_INSTALLING ||
- info == PK_INFO_ENUM_UPDATING) {
- /* we convert the package_id data to be 'installed' */
- package_id_tmp = pk_package_id_build (pk_package_get_name (item),
- pk_package_get_version (item),
- pk_package_get_arch (item),
- "installed");
- g_ptr_array_add (list, package_id_tmp);
- }
- }
-
- /* process file lists on these packages */
- g_debug ("processing %i packags for desktop files", list->len);
- if (list->len == 0)
- goto out;
-
- /* get all the files touched in the packages we just installed */
- pk_backend_reset (backend);
- pk_backend_set_status (backend, PK_STATUS_ENUM_SCAN_APPLICATIONS);
- pk_backend_set_percentage (backend, 101);
- package_ids = pk_ptr_array_to_strv (list);
- pk_backend_get_files (backend, package_ids);
-
- /* wait for finished */
- g_main_loop_run (priv->loop);
-
- pk_backend_set_percentage (backend, 100);
-out:
- if (backend == NULL) {
- if (files_id > 0)
- g_signal_handler_disconnect (backend, files_id);
- if (finished_id > 0)
- g_signal_handler_disconnect (backend, finished_id);
- }
- if (array != NULL)
- g_ptr_array_unref (array);
- if (list != NULL)
- g_ptr_array_unref (list);
- g_strfreev (package_ids);
-}
diff --git a/src/pk-plugin-scripts.c b/src/pk-plugin-scripts.c
deleted file mode 100644
index b2ca5cb..0000000
--- a/src/pk-plugin-scripts.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2011 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <config.h>
-#include <gio/gio.h>
-#include <pk-transaction.h>
-
-/**
- * pk_transaction_plugin_get_description:
- */
-const gchar *
-pk_transaction_plugin_get_description (void)
-{
- return "Runs external scrips";
-}
-
-/**
- * pk_transaction_process_script:
- **/
-static void
-pk_transaction_process_script (PkTransaction *transaction, const gchar *filename)
-{
- GFile *file = NULL;
- GFileInfo *info = NULL;
- guint file_uid;
- gchar *command = NULL;
- gint exit_status = 0;
- gboolean ret;
- GError *error = NULL;
- PkRoleEnum role;
-
- /* get content type for file */
- file = g_file_new_for_path (filename);
- info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_UNIX_UID ","
- G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE,
- G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &error);
- if (info == NULL) {
- g_warning ("failed to get info: %s", error->message);
- goto out;
- }
-
- /* check is executable */
- ret = g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE);
- if (!ret) {
- g_warning ("%s is not executable", filename);
- goto out;
- }
-
- /* check is owned by the correct user */
- file_uid = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_UID);
- if (file_uid != 0) {
- g_warning ("%s is not owned by the root user", filename);
- goto out;
- }
-
- /* format the argument list */
- role = pk_transaction_get_role (transaction);
- command = g_strdup_printf ("%s %s NOTAPISTABLE",
- filename,
- pk_role_enum_to_string (role));
-
- /* run the command, but don't exit if fails */
- ret = g_spawn_command_line_sync (command, NULL, NULL, &exit_status, &error);
- if (!ret) {
- g_warning ("failed to spawn %s [%i]: %s", command, exit_status, error->message);
- g_error_free (error);
- } else {
- g_debug ("ran %s", command);
- }
-
-out:
- g_free (command);
- if (info != NULL)
- g_object_unref (info);
- if (file != NULL)
- g_object_unref (file);
-}
-
-/**
- * pk_transaction_process_scripts:
- *
- * Run all scripts in a given directory
- **/
-static void
-pk_transaction_process_scripts (PkTransaction *transaction, const gchar *location)
-{
- GError *error = NULL;
- gchar *filename;
- gchar *dirname;
- const gchar *file;
- GDir *dir;
-
- /* get location to search */
- dirname = g_build_filename (SYSCONFDIR, "PackageKit", "events", location, NULL);
- dir = g_dir_open (dirname, 0, &error);
- if (dir == NULL) {
- g_warning ("Failed to open %s: %s", dirname, error->message);
- g_error_free (error);
- goto out;
- }
-
- /* run scripts */
- file = g_dir_read_name (dir);
- while (file != NULL) {
- filename = g_build_filename (dirname, file, NULL);
-
- /* we put this here */
- if (g_strcmp0 (file, "README") != 0) {
- pk_transaction_process_script (transaction, filename);
- }
-
- g_free (filename);
- file = g_dir_read_name (dir);
- }
-out:
- if (dir != NULL)
- g_dir_close (dir);
- g_free (dirname);
-}
-
-/**
- * pk_transaction_plugin_run:
- */
-void
-pk_transaction_plugin_run (PkTransaction *transaction)
-{
- pk_transaction_process_scripts (transaction,
- "pre-transaction.d");
-}
-
-/**
- * pk_transaction_plugin_finished_end:
- */
-void
-pk_transaction_plugin_finished_end (PkTransaction *transaction)
-{
- pk_transaction_process_scripts (transaction,
- "post-transaction.d");
-}
diff --git a/src/pk-plugin-update-check-processes.c b/src/pk-plugin-update-check-processes.c
deleted file mode 100644
index d161cf6..0000000
--- a/src/pk-plugin-update-check-processes.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2011 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <config.h>
-#include <gio/gio.h>
-#include <pk-transaction.h>
-
-#include "pk-proc.h"
-
-typedef struct {
- PkProc *proc;
- GMainLoop *loop;
-} PluginPrivate;
-
-static PluginPrivate *priv;
-
-/**
- * pk_transaction_plugin_get_description:
- */
-const gchar *
-pk_transaction_plugin_get_description (void)
-{
- return "Checks for running processes during update for session restarts";
-}
-
-/**
- * pk_transaction_plugin_initialize:
- */
-void
-pk_transaction_plugin_initialize (PkTransaction *transaction)
-{
- /* create private area */
- priv = g_new0 (PluginPrivate, 1);
- priv->loop = g_main_loop_new (NULL, FALSE);
- priv->proc = pk_proc_new ();
-}
-
-/**
- * pk_transaction_plugin_destroy:
- */
-void
-pk_transaction_plugin_destroy (PkTransaction *transaction)
-{
- g_main_loop_unref (priv->loop);
- g_object_unref (priv->proc);
- g_free (priv);
-}
-
-/**
- * pk_plugin_finished_cb:
- **/
-static void
-pk_plugin_finished_cb (PkBackend *backend,
- PkExitEnum exit_enum,
- gpointer user_data)
-{
- if (!g_main_loop_is_running (priv->loop))
- return;
- if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
- g_warning ("%s failed with exit code: %s",
- pk_role_enum_to_string (pk_backend_get_role (backend)),
- pk_exit_enum_to_string (exit_enum));
- }
- g_main_loop_quit (priv->loop);
-}
-
-/**
- * pk_plugin_files_cb:
- **/
-static void
-pk_plugin_files_cb (PkBackend *backend,
- PkFiles *files,
- PkTransaction *transaction)
-{
- guint i;
- guint len;
- gboolean ret;
- gchar **filenames = NULL;
- gchar *package_id = NULL;
-
- /* get data */
- g_object_get (files,
- "package-id", &package_id,
- "files", &filenames,
- NULL);
-
- /* check each file */
- len = g_strv_length (filenames);
- for (i=0; i<len; i++) {
- /* executable? */
- ret = g_file_test (filenames[i],
- G_FILE_TEST_IS_REGULAR |
- G_FILE_TEST_IS_EXECUTABLE |
- G_FILE_TEST_EXISTS);
- if (!ret)
- continue;
-
- /* running? */
- ret = pk_proc_find_exec (priv->proc, filenames[i]);
- if (!ret)
- continue;
-
- /* TODO: findout if the executable has a desktop file, and if so,
- * suggest an application restart instead */
-
- /* send signal about session restart */
- g_debug ("package %s updated, and %s is running",
- package_id, filenames[i]);
- pk_backend_require_restart (backend,
- PK_RESTART_ENUM_SESSION,
- package_id);
- }
- g_strfreev (filenames);
- g_free (package_id);
-}
-
-/**
- * pk_transaction_plugin_finished_results:
- */
-void
-pk_transaction_plugin_finished_results (PkTransaction *transaction)
-{
- gboolean ret;
- gchar **package_ids = NULL;
- gchar *package_id_tmp;
- GPtrArray *array = NULL;
- GPtrArray *list = NULL;
- guint files_id = 0;
- guint finished_id = 0;
- guint i;
- PkBackend *backend = NULL;
- PkConf *conf;
- PkPackage *item;
- PkResults *results;
- PkRoleEnum role;
-
- /* check the config file */
- conf = pk_transaction_get_conf (transaction);
- ret = pk_conf_get_bool (conf, "UpdateCheckProcesses");
- if (!ret)
- goto out;
-
- /* check the role */
- role = pk_transaction_get_role (transaction);
- if (role != PK_ROLE_ENUM_UPDATE_SYSTEM &&
- role != PK_ROLE_ENUM_UPDATE_PACKAGES)
- goto out;
-
- /* check we can do the action */
- backend = pk_transaction_get_backend (transaction);
- if (!pk_backend_is_implemented (backend,
- PK_ROLE_ENUM_GET_FILES)) {
- g_debug ("cannot get files");
- goto out;
- }
- finished_id = g_signal_connect (backend, "finished",
- G_CALLBACK (pk_plugin_finished_cb), NULL);
- files_id = g_signal_connect (backend, "files",
- G_CALLBACK (pk_plugin_files_cb), NULL);
-
- /* get results */
- results = pk_transaction_get_results (transaction);
- array = pk_results_get_package_array (results);
-
- /* filter on UPDATING */
- list = g_ptr_array_new_with_free_func (g_free);
- for (i=0; i<array->len; i++) {
- item = g_ptr_array_index (array, i);
- if (pk_package_get_info (item) != PK_INFO_ENUM_UPDATING)
- continue;
- /* we convert the package_id data to be 'installed' as this means
- * we can use the local package database for GetFiles rather than
- * downloading new remote metadata */
- package_id_tmp = pk_package_id_build (pk_package_get_name (item),
- pk_package_get_version (item),
- pk_package_get_arch (item),
- "installed");
- g_ptr_array_add (list, package_id_tmp);
- }
-
- /* process file lists on these packages */
- if (list->len == 0)
- goto out;
-
- /* get all the running processes */
- pk_proc_refresh (priv->proc);
-
- /* get all the files touched in the packages we just updated */
- pk_backend_reset (backend);
- pk_backend_set_status (backend, PK_STATUS_ENUM_CHECK_EXECUTABLE_FILES);
- pk_backend_set_percentage (backend, 101);
- package_ids = pk_ptr_array_to_strv (list);
- pk_backend_get_files (backend, package_ids);
-
- /* wait for finished */
- g_main_loop_run (priv->loop);
-
- pk_backend_set_percentage (backend, 100);
-
-out:
- g_strfreev (package_ids);
- if (backend == NULL) {
- if (files_id > 0)
- g_signal_handler_disconnect (backend, files_id);
- if (finished_id > 0)
- g_signal_handler_disconnect (backend, finished_id);
- }
- if (array != NULL)
- g_ptr_array_unref (array);
- if (list != NULL)
- g_ptr_array_unref (list);
-}
diff --git a/src/pk-plugin-update-package-list.c b/src/pk-plugin-update-package-list.c
deleted file mode 100644
index becfc20..0000000
--- a/src/pk-plugin-update-package-list.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2011 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <config.h>
-#include <gio/gio.h>
-#include <pk-transaction.h>
-#include <packagekit-glib2/pk-package.h>
-
-typedef struct {
- GPtrArray *list;
- GMainLoop *loop;
-} PluginPrivate;
-
-static PluginPrivate *priv;
-
-/**
- * pk_transaction_plugin_get_description:
- */
-const gchar *
-pk_transaction_plugin_get_description (void)
-{
- return "Updates the package lists after refresh";
-}
-
-/**
- * pk_plugin_package_cb:
- **/
-static void
-pk_plugin_package_cb (PkBackend *backend,
- PkPackage *package,
- gpointer user_data)
-{
- g_ptr_array_add (priv->list, g_object_ref (package));
-}
-
-/**
- * pk_plugin_finished_cb:
- **/
-static void
-pk_plugin_finished_cb (PkBackend *backend,
- PkExitEnum exit_enum,
- gpointer user_data)
-{
- if (!g_main_loop_is_running (priv->loop))
- return;
- if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
- g_warning ("%s failed with exit code: %s",
- pk_role_enum_to_string (pk_backend_get_role (backend)),
- pk_exit_enum_to_string (exit_enum));
- }
- g_main_loop_quit (priv->loop);
-}
-
-/**
- * pk_transaction_plugin_initialize:
- */
-void
-pk_transaction_plugin_initialize (PkTransaction *transaction)
-{
- /* create private area */
- priv = g_new0 (PluginPrivate, 1);
- priv->loop = g_main_loop_new (NULL, FALSE);
- priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
-}
-
-/**
- * pk_transaction_plugin_destroy:
- */
-void
-pk_transaction_plugin_destroy (PkTransaction *transaction)
-{
- g_ptr_array_unref (priv->list);
- g_main_loop_unref (priv->loop);
- g_free (priv);
-}
-
-/**
- * pk_plugin_package_list_to_string:
- **/
-static gchar *
-pk_plugin_package_list_to_string (GPtrArray *array)
-{
- guint i;
- PkPackage *package;
- GString *string;
- PkInfoEnum info;
- gchar *package_id;
- gchar *summary;
-
- string = g_string_new ("");
- for (i=0; i<array->len; i++) {
- package = g_ptr_array_index (array, i);
- g_object_get (package,
- "info", &info,
- "package-id", &package_id,
- "summary", &summary,
- NULL);
- g_string_append_printf (string, "%s\t%s\t%s\n",
- pk_info_enum_to_string (info),
- package_id,
- summary);
- g_free (package_id);
- g_free (summary);
- }
-
- /* remove trailing newline */
- if (string->len != 0)
- g_string_set_size (string, string->len-1);
- return g_string_free (string, FALSE);
-}
-
-/**
- * pk_transaction_plugin_finished_end:
- */
-void
-pk_transaction_plugin_finished_end (PkTransaction *transaction)
-{
- gboolean ret;
- gchar *data = NULL;
- GError *error = NULL;
- guint finished_id = 0;
- guint package_id = 0;
- PkBackend *backend = NULL;
- PkConf *conf;
- PkRoleEnum role;
-
- /* check the config file */
- conf = pk_transaction_get_conf (transaction);
- ret = pk_conf_get_bool (conf, "UpdatePackageList");
- if (!ret)
- goto out;
-
- /* check the role */
- role = pk_transaction_get_role (transaction);
- if (role != PK_ROLE_ENUM_REFRESH_CACHE)
- goto out;
-
- /* check we can do the action */
- backend = pk_transaction_get_backend (transaction);
- if (!pk_backend_is_implemented (backend,
- PK_ROLE_ENUM_GET_PACKAGES)) {
- g_debug ("cannot get packages");
- goto out;
- }
-
- /* connect to backend */
- backend = pk_transaction_get_backend (transaction);
- finished_id = g_signal_connect (backend, "finished",
- G_CALLBACK (pk_plugin_finished_cb), NULL);
- package_id = g_signal_connect (backend, "package",
- G_CALLBACK (pk_plugin_package_cb), NULL);
-
- g_debug ("plugin: updating package lists");
-
- /* clear old list */
- if (priv->list->len > 0)
- g_ptr_array_set_size (priv->list, 0);
-
- /* update UI */
- pk_backend_set_status (backend,
- PK_STATUS_ENUM_GENERATE_PACKAGE_LIST);
- pk_backend_set_percentage (backend, 101);
-
- /* get the new package list */
- pk_backend_reset (backend);
- pk_backend_get_packages (backend, PK_FILTER_ENUM_NONE);
-
- /* wait for finished */
- g_main_loop_run (priv->loop);
-
- /* update UI */
- pk_backend_set_percentage (backend, 90);
-
- /* convert to a file */
- data = pk_plugin_package_list_to_string (priv->list);
- ret = g_file_set_contents (PK_SYSTEM_PACKAGE_LIST_FILENAME,
- data, -1, &error);
- if (!ret) {
- g_warning ("failed to save to file: %s",
- error->message);
- g_error_free (error);
- }
-
- /* update UI */
- pk_backend_set_percentage (backend, 100);
- pk_backend_set_status (backend, PK_STATUS_ENUM_FINISHED);
-out:
- if (backend != NULL) {
- g_signal_handler_disconnect (backend, finished_id);
- g_signal_handler_disconnect (backend, package_id);
- }
- g_free (data);
-}
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
new file mode 100644
index 0000000..705ad25
--- /dev/null
+++ b/src/plugins/Makefile.am
@@ -0,0 +1,105 @@
+## We require new-style dependency handling.
+AUTOMAKE_OPTIONS = 1.7
+
+PK_GLIB2_LIBS = \
+ $(top_builddir)/lib/packagekit-glib2/libpackagekit-glib2.la
+
+INCLUDES = \
+ $(GIO_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ $(SQLITE_CFLAGS) \
+ -DBINDIR=\"$(bindir)\" \
+ -DDATADIR=\"$(datadir)\" \
+ -DG_LOG_DOMAIN=\"PkPlugin\" \
+ -DLIBDIR=\""$(libdir)"\" \
+ -DLOCALSTATEDIR=\""$(localstatedir)"\" \
+ -DPK_COMPILATION \
+ -DSBINDIR=\"$(sbindir)\" \
+ -DSYSCONFDIR=\""$(sysconfdir)"\" \
+ -DTESTDATADIR=\""$(top_srcdir)/data/tests"\" \
+ -I$(top_srcdir)/lib
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = \
+ packagekit-plugin.pc
+
+if EGG_BUILD_TESTS
+
+check_PROGRAMS = \
+ pk-self-test
+
+pk_self_test_SOURCES = \
+ pk-self-test.c \
+ $(shared_SOURCES) \
+ $(NULL)
+
+pk_self_test_LDADD = \
+ $(GLIB_LIBS) \
+ $(GMODULE_LIBS) \
+ $(SQLITE_LIBS) \
+ $(PK_GLIB2_LIBS) \
+ $(GIO_LIBS)
+
+pk_self_test_CFLAGS = -DEGG_TEST $(AM_CFLAGS)
+
+TESTS = pk-self-test
+endif
+
+clean-local:
+ rm -f *~
+
+# plugins
+plugindir = $(LIBDIR)/packagekit-plugins
+noinst_LTLIBRARIES = \
+ libpk_plugin_example.la
+
+plugin_LTLIBRARIES = \
+ libpk_plugin_scripts.la \
+ libpk_plugin-update-package-list.la \
+ libpk_plugin-no-update-process.la \
+ libpk_plugin-scan-desktop-files.la \
+ libpk_plugin-update-check-processes.la \
+ libpk_plugin-check-shared-libraries-in-use.la \
+ libpk-plugin-clear-firmware-requests.la
+
+libpk_plugin_example_la_SOURCES = pk-plugin-example.c
+libpk_plugin_example_la_LIBADD = $(PK_PLUGIN_LIBS)
+libpk_plugin_example_la_LDFLAGS = -module -avoid-version
+libpk_plugin_example_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+
+libpk_plugin_scripts_la_SOURCES = pk-plugin-scripts.c
+libpk_plugin_scripts_la_LIBADD = $(PK_PLUGIN_LIBS)
+libpk_plugin_scripts_la_LDFLAGS = -module -avoid-version
+libpk_plugin_scripts_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+
+libpk_plugin_clear_firmware_requests_la_SOURCES = pk-plugin-clear-firmware-requests.c
+libpk_plugin_clear_firmware_requests_la_LIBADD = $(PK_PLUGIN_LIBS)
+libpk_plugin_clear_firmware_requests_la_LDFLAGS = -module -avoid-version
+libpk_plugin_clear_firmware_requests_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+
+libpk_plugin_update_package_list_la_SOURCES = pk-plugin-update-package-list.c
+libpk_plugin_update_package_list_la_LIBADD = $(PK_PLUGIN_LIBS)
+libpk_plugin_update_package_list_la_LDFLAGS = -module -avoid-version
+libpk_plugin_update_package_list_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+
+libpk_plugin_no_update_process_la_SOURCES = pk-plugin-no-update-process.c
+libpk_plugin_no_update_process_la_LIBADD = $(PK_PLUGIN_LIBS)
+libpk_plugin_no_update_process_la_LDFLAGS = -module -avoid-version
+libpk_plugin_no_update_process_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+
+libpk_plugin_scan_desktop_files_la_SOURCES = pk-plugin-scan-desktop-files.c
+libpk_plugin_scan_desktop_files_la_LIBADD = $(PK_PLUGIN_LIBS)
+libpk_plugin_scan_desktop_files_la_LDFLAGS = -module -avoid-version
+libpk_plugin_scan_desktop_files_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+
+libpk_plugin_update_check_processes_la_SOURCES = pk-plugin-update-check-processes.c
+libpk_plugin_update_check_processes_la_LIBADD = $(PK_PLUGIN_LIBS)
+libpk_plugin_update_check_processes_la_LDFLAGS = -module -avoid-version
+libpk_plugin_update_check_processes_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+
+libpk_plugin_check_shared_libraries_in_use_la_SOURCES = pk-plugin-check-shared-libraries-in-use.c
+libpk_plugin_check_shared_libraries_in_use_la_LIBADD = $(PK_PLUGIN_LIBS)
+libpk_plugin_check_shared_libraries_in_use_la_LDFLAGS = -module -avoid-version
+libpk_plugin_check_shared_libraries_in_use_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+
+-include $(top_srcdir)/git.mk
diff --git a/src/plugins/packagekit-plugin.pc.in b/src/plugins/packagekit-plugin.pc.in
new file mode 100644
index 0000000..ef91181
--- /dev/null
+++ b/src/plugins/packagekit-plugin.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: packagekit-plugin
+Description: PackageKit is a system daemon for installing stuff.
+Version: @VERSION@
+Requires.private: dbus-1, gthread-2.0
+Requires: glib-2.0, gobject-2.0, sqlite3
+Libs: -L${libdir} -lpackagekit-glib2
+Cflags: -I${includedir}/PackageKit
diff --git a/src/plugins/pk-plugin-check-shared-libraries-in-use.c b/src/plugins/pk-plugin-check-shared-libraries-in-use.c
new file mode 100644
index 0000000..9a74c95
--- /dev/null
+++ b/src/plugins/pk-plugin-check-shared-libraries-in-use.c
@@ -0,0 +1,583 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+#include <gio/gio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <pk-transaction.h>
+
+#include "pk-cache.h"
+#include "pk-lsof.h"
+
+/* for when parsing /etc/login.defs fails */
+#define PK_TRANSACTION_EXTRA_UID_MIN_DEFALT 500
+
+typedef struct {
+ GMainLoop *loop;
+ GPtrArray *list;
+ GPtrArray *pids;
+ GPtrArray *files_list;
+ PkLsof *lsof;
+} PluginPrivate;
+
+static PluginPrivate *priv;
+
+/**
+ * pk_transaction_plugin_get_description:
+ */
+const gchar *
+pk_transaction_plugin_get_description (void)
+{
+ return "checks for any shared libraries in use after a security update";
+}
+
+/**
+ * pk_transaction_plugin_initialize:
+ */
+void
+pk_transaction_plugin_initialize (PkTransaction *transaction)
+{
+ /* create private area */
+ priv = g_new0 (PluginPrivate, 1);
+ priv->loop = g_main_loop_new (NULL, FALSE);
+ priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+ priv->files_list = g_ptr_array_new_with_free_func (g_free);
+ priv->lsof = pk_lsof_new ();
+}
+
+/**
+ * pk_transaction_plugin_destroy:
+ */
+void
+pk_transaction_plugin_destroy (PkTransaction *transaction)
+{
+ g_main_loop_unref (priv->loop);
+ g_ptr_array_unref (priv->list);
+ g_object_unref (priv->lsof);
+ g_ptr_array_unref (priv->files_list);
+ if (priv->pids != NULL)
+ g_ptr_array_free (priv->pids, TRUE);
+ g_free (priv);
+}
+
+/**
+ * pk_plugin_finished_cb:
+ **/
+static void
+pk_plugin_finished_cb (PkBackend *backend,
+ PkExitEnum exit_enum,
+ gpointer user_data)
+{
+ if (!g_main_loop_is_running (priv->loop))
+ return;
+ if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
+ g_warning ("%s failed with exit code: %s",
+ pk_role_enum_to_string (pk_backend_get_role (backend)),
+ pk_exit_enum_to_string (exit_enum));
+ }
+ g_main_loop_quit (priv->loop);
+}
+
+/**
+ * pk_plugin_get_installed_package_for_file:
+ **/
+static PkPackage *
+pk_plugin_get_installed_package_for_file (PkTransaction *transaction,
+ const gchar *filename)
+{
+ PkPackage *package = NULL;
+ gchar **filenames;
+ PkBackend *backend;
+
+ /* use PK to find the correct package */
+ g_ptr_array_set_size (priv->list, 0);
+ backend = pk_transaction_get_backend (transaction);
+ pk_backend_reset (backend);
+ filenames = g_strsplit (filename, "|||", -1);
+ pk_backend_search_files (backend,
+ pk_bitfield_value (PK_FILTER_ENUM_INSTALLED),
+ filenames);
+
+ /* wait for finished */
+ g_main_loop_run (priv->loop);
+
+ /* check that we only matched one package */
+ if (priv->list->len != 1) {
+ g_warning ("not correct size, %i", priv->list->len);
+ goto out;
+ }
+
+ /* get the package */
+ package = g_ptr_array_index (priv->list, 0);
+ if (package == NULL) {
+ g_warning ("cannot get package");
+ goto out;
+ }
+out:
+ g_strfreev (filenames);
+ return package;
+}
+
+/**
+ * pk_plugin_files_cb:
+ **/
+static void
+pk_plugin_files_cb (PkBackend *backend,
+ PkFiles *files,
+ PkTransaction *transaction)
+{
+ guint i;
+ guint len;
+ gchar **filenames = NULL;
+
+ /* get data */
+ g_object_get (files,
+ "files", &filenames,
+ NULL);
+
+ /* check each file to see if it's a system shared library */
+ len = g_strv_length (filenames);
+ for (i=0; i<len; i++) {
+ /* not a system library */
+ if (strstr (filenames[i], "/lib") == NULL)
+ continue;
+
+ /* not a shared object */
+ if (strstr (filenames[i], ".so") == NULL)
+ continue;
+
+ /* add as it matches the criteria */
+ g_debug ("adding filename %s", filenames[i]);
+ g_ptr_array_add (priv->files_list,
+ g_strdup (filenames[i]));
+ }
+ g_strfreev (filenames);
+}
+
+/**
+ * pk_plugin_get_cmdline:
+ **/
+static gchar *
+pk_plugin_get_cmdline (PkTransaction *transaction, guint pid)
+{
+ gboolean ret;
+ gchar *filename = NULL;
+ gchar *cmdline = NULL;
+ GError *error = NULL;
+
+ /* get command line from proc */
+ filename = g_strdup_printf ("/proc/%i/cmdline", pid);
+ ret = g_file_get_contents (filename, &cmdline, NULL, &error);
+ if (!ret) {
+ g_warning ("failed to get cmdline: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+out:
+ g_free (filename);
+ return cmdline;
+}
+
+/**
+ * pk_plugin_get_uid:
+ **/
+static gint
+pk_plugin_get_uid (PkTransaction *transaction, guint pid)
+{
+ gboolean ret;
+ gchar *endptr = NULL;
+ gchar *filename = NULL;
+ gchar *text = NULL;
+ guint64 value_raw;
+ gint uid = -1;
+
+ /* get command line from proc */
+ filename = g_strdup_printf ("/proc/%i/loginuid", pid);
+ ret = g_file_get_contents (filename, &text, NULL, NULL);
+ if (!ret)
+ goto out;
+
+ /* parse */
+ value_raw = g_ascii_strtoull (text, &endptr, 10);
+
+ /* parsing error */
+ if (endptr == text)
+ goto out;
+
+ /* out of range */
+ if (value_raw > G_MAXUINT)
+ goto out;
+
+ /* cast back down to value */
+ uid = (gint) value_raw;
+out:
+ g_free (filename);
+ g_free (text);
+ return uid;
+}
+
+static guint
+pk_plugin_get_uid_min (void)
+{
+ gboolean ret;
+ guint i;
+ gchar *data = NULL;
+ gchar **split = NULL;
+ GError *error = NULL;
+ guint uid_min = G_MAXUINT;
+
+ /* get contents */
+ ret = g_file_get_contents ("/etc/login.defs", &data, NULL, &error);
+ if (!ret) {
+ g_warning ("failed to get login UID_MIN: %s",
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+ split = g_strsplit (data, "\n", -1);
+ for (i = 0; split[i] != NULL; i++) {
+ if (!g_str_has_prefix (split[i], "UID_MIN"))
+ continue;
+ uid_min = atoi (g_strchug (split[i]+7));
+ break;
+ }
+out:
+ g_free (data);
+ g_strfreev (split);
+ return uid_min;
+}
+
+/**
+ * pk_transaction_plugin_run:
+ *
+ * This function does the following things:
+ * 1) Refreshes the list of open files
+ * 2) Gets the list of library files from the security updates
+ * 3) Gets a list of pids that are using the libraries
+ * 4) The list of pids are converted to a list of files
+ * 5) The list of files is converted to a list of packages
+ * 6) For each package, emit a RequireRestart of the correct type (according to the UID)
+ */
+void
+pk_transaction_plugin_run (PkTransaction *transaction)
+{
+ gboolean ret;
+ gchar **files = NULL;
+ gchar *package_id;
+ gchar **package_ids;
+ gchar **package_ids_security = NULL;
+ GPtrArray *updates = NULL;
+ guint i;
+ guint j = 0;
+ guint length = 0;
+ guint files_id = 0;
+ guint finished_id = 0;
+ PkBackend *backend = NULL;
+ PkConf *conf;
+ PkInfoEnum info;
+ PkPackage *item;
+ PkResults *results;
+ PkRoleEnum role;
+ PkCache *cache = NULL;
+
+ /* check the config file */
+ conf = pk_transaction_get_conf (transaction);
+ ret = pk_conf_get_bool (conf, "CheckSharedLibrariesInUse");
+ if (!ret)
+ goto out;
+
+ /* check the role */
+ role = pk_transaction_get_role (transaction);
+ if (role != PK_ROLE_ENUM_UPDATE_SYSTEM &&
+ role != PK_ROLE_ENUM_UPDATE_PACKAGES &&
+ role != PK_ROLE_ENUM_INSTALL_PACKAGES)
+ goto out;
+
+ /* check we can do the action */
+ backend = pk_transaction_get_backend (transaction);
+ if (!pk_backend_is_implemented (backend,
+ PK_ROLE_ENUM_GET_FILES)) {
+ g_debug ("cannot get files");
+ goto out;
+ }
+ files_id = g_signal_connect (backend, "files",
+ G_CALLBACK (pk_plugin_files_cb), NULL);
+ finished_id = g_signal_connect (backend, "finished",
+ G_CALLBACK (pk_plugin_finished_cb), NULL);
+
+ /* do we have a cache */
+ cache = pk_cache_new ();
+ results = pk_cache_get_results (cache, PK_ROLE_ENUM_GET_UPDATES);
+ if (results == NULL) {
+ g_warning ("no updates cache");
+ goto out;
+ }
+
+ /* find security update packages */
+ updates = pk_results_get_package_array (results);
+ for (i=0; i<updates->len; i++) {
+ item = g_ptr_array_index (updates, i);
+ g_object_get (item,
+ "info", &info,
+ "package-id", &package_id,
+ NULL);
+ if (info == PK_INFO_ENUM_SECURITY) {
+ g_debug ("security update: %s", package_id);
+ length++;
+ }
+ g_free (package_id);
+ }
+
+ /* nothing to scan for */
+ if (length == 0) {
+ g_debug ("no security updates");
+ goto out;
+ }
+
+ /* create list of security packages */
+ package_ids_security = g_new0 (gchar *, length+1);
+ for (i=0; i<updates->len; i++) {
+ item = g_ptr_array_index (updates, i);
+ g_object_get (item,
+ "info", &info,
+ "package-id", &package_id,
+ NULL);
+ if (info == PK_INFO_ENUM_SECURITY)
+ package_ids_security[j++] = g_strdup (package_id);
+ g_free (package_id);
+ }
+
+ /* is a security update we are installing */
+ package_ids = pk_transaction_get_package_ids (transaction);
+ if (role == PK_ROLE_ENUM_INSTALL_PACKAGES) {
+ ret = FALSE;
+
+ /* do any of the packages we are updating match */
+ for (i=0; package_ids_security[i] != NULL; i++) {
+ for (j=0; package_ids[j] != NULL; j++) {
+ if (g_strcmp0 (package_ids_security[i],
+ package_ids[j]) == 0) {
+ ret = TRUE;
+ break;
+ }
+ }
+ }
+
+ /* nothing matched */
+ if (!ret) {
+ g_debug ("not installing a security update package");
+ goto out;
+ }
+ }
+
+ /* reset */
+ g_ptr_array_set_size (priv->files_list, 0);
+
+ if (priv->pids != NULL) {
+ g_ptr_array_free (priv->pids, TRUE);
+ priv->pids = NULL;
+ }
+
+ /* set status */
+ pk_backend_set_status (backend, PK_STATUS_ENUM_SCAN_PROCESS_LIST);
+ pk_backend_set_percentage (backend, 101);
+
+ /* get list from lsof */
+ ret = pk_lsof_refresh (priv->lsof);
+ if (!ret) {
+ g_warning ("failed to refresh");
+ goto out;
+ }
+
+ /* get all the files touched in the packages we just updated */
+ pk_backend_reset (backend);
+ pk_backend_set_status (backend, PK_STATUS_ENUM_CHECK_LIBRARIES);
+ pk_backend_get_files (backend, package_ids_security);
+
+ /* wait for finished */
+ g_main_loop_run (priv->loop);
+
+ /* nothing to do */
+ if (priv->files_list->len == 0) {
+ g_debug ("no files");
+ goto out;
+ }
+
+ /* get the list of PIDs */
+ files = pk_ptr_array_to_strv (priv->files_list);
+ priv->pids = pk_lsof_get_pids_for_filenames (priv->lsof, files);
+
+ /* nothing depends on these libraries */
+ if (priv->pids == NULL) {
+ g_warning ("failed to get process list");
+ goto out;
+ }
+
+ /* nothing depends on these libraries */
+ if (priv->pids->len == 0) {
+ g_debug ("no processes depend on these libraries");
+ goto out;
+ }
+
+ /* don't emit until we've run the transaction and it's success */
+ pk_backend_set_percentage (backend, 100);
+out:
+ if (backend != NULL) {
+ if (files_id > 0)
+ g_signal_handler_disconnect (backend, files_id);
+ if (finished_id > 0)
+ g_signal_handler_disconnect (backend, finished_id);
+ }
+ g_strfreev (files);
+ if (updates != NULL)
+ g_ptr_array_unref (updates);
+ if (cache != NULL)
+ g_object_unref (cache);
+ g_strfreev (package_ids_security);
+}
+
+/**
+ * pk_transaction_plugin_finished_results:
+ */
+void
+pk_transaction_plugin_finished_results (PkTransaction *transaction)
+{
+ gboolean ret;
+ PkBackend *backend = NULL;
+ PkConf *conf;
+ PkRoleEnum role;
+ gint uid;
+ guint i;
+ guint pid;
+ gchar *filename;
+ gchar *cmdline;
+ gchar *cmdline_full;
+ GPtrArray *files_session = NULL;
+ GPtrArray *files_system = NULL;
+ PkPackage *package;
+ GPtrArray *pids;
+ guint uid_min;
+
+ /* check the config file */
+ conf = pk_transaction_get_conf (transaction);
+ ret = pk_conf_get_bool (conf, "CheckSharedLibrariesInUse");
+ if (!ret)
+ goto out;
+
+ /* check the role */
+ role = pk_transaction_get_role (transaction);
+ if (role != PK_ROLE_ENUM_GET_UPDATES)
+ goto out;
+
+ /* check we can do the action */
+ backend = pk_transaction_get_backend (transaction);
+ if (!pk_backend_is_implemented (backend,
+ PK_ROLE_ENUM_GET_PACKAGES)) {
+ g_debug ("cannot get packages");
+ goto out;
+ }
+
+ /* create arrays */
+ files_session = g_ptr_array_new_with_free_func (g_free);
+ files_system = g_ptr_array_new_with_free_func (g_free);
+
+ /* get local array */
+ pids = priv->pids;
+ if (pids == NULL)
+ goto out;
+
+ /* set status */
+ pk_backend_set_status (backend, PK_STATUS_ENUM_CHECK_LIBRARIES);
+
+ /* get user UID range */
+ uid_min = pk_plugin_get_uid_min ();
+ if (uid_min == G_MAXUINT)
+ uid_min = PK_TRANSACTION_EXTRA_UID_MIN_DEFALT;
+
+ /* find the package name of each pid */
+ for (i=0; i<pids->len; i++) {
+ pid = GPOINTER_TO_INT (g_ptr_array_index (pids, i));
+
+ /* get user */
+ uid = pk_plugin_get_uid (transaction, pid);
+ if (uid < 0)
+ continue;
+
+ /* get command line */
+ cmdline = pk_plugin_get_cmdline (transaction, pid);
+ if (cmdline == NULL)
+ continue;
+
+ /* prepend path if it does not already exist */
+ if (cmdline[0] == '/')
+ cmdline_full = g_strdup (cmdline);
+ else
+ cmdline_full = g_strdup_printf ("/usr/bin/%s", cmdline);
+
+ g_debug ("pid=%i: %s (%i)", pid, cmdline_full, uid);
+ if (uid < 500)
+ g_ptr_array_add (files_system, cmdline_full);
+ else
+ g_ptr_array_add (files_session, cmdline_full);
+ g_free (cmdline);
+ }
+
+ /* we found nothing */
+ if (files_system->len == 0 && files_session->len == 0) {
+ g_warning ("no pids could be resolved");
+ goto out;
+ }
+
+ /* process all session restarts */
+ for (i=0; i<files_session->len; i++) {
+ filename = g_ptr_array_index (files_session, i);
+
+ package = pk_plugin_get_installed_package_for_file (transaction,
+ filename);
+ if (package == NULL) {
+ g_debug ("failed to find package for %s", filename);
+ continue;
+ }
+ pk_backend_require_restart (backend,
+ PK_RESTART_ENUM_SECURITY_SESSION,
+ pk_package_get_id (package));
+ }
+
+ /* process all system restarts */
+ for (i=0; i<files_system->len; i++) {
+ filename = g_ptr_array_index (files_system, i);
+
+ package = pk_plugin_get_installed_package_for_file (transaction,
+ filename);
+ if (package == NULL) {
+ g_debug ("failed to find package for %s", filename);
+ continue;
+ }
+ pk_backend_require_restart (backend, PK_RESTART_ENUM_SECURITY_SYSTEM, pk_package_get_id (package));
+ }
+out:
+ if (files_session != NULL)
+ g_ptr_array_free (files_session, TRUE);
+ if (files_system != NULL)
+ g_ptr_array_free (files_system, TRUE);
+}
diff --git a/src/plugins/pk-plugin-clear-firmware-requests.c b/src/plugins/pk-plugin-clear-firmware-requests.c
new file mode 100644
index 0000000..45b5593
--- /dev/null
+++ b/src/plugins/pk-plugin-clear-firmware-requests.c
@@ -0,0 +1,59 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+#include <gio/gio.h>
+
+#include "pk-transaction.h"
+#include "pk-shared.h"
+
+/**
+ * pk_transaction_plugin_get_description:
+ */
+const gchar *
+pk_transaction_plugin_get_description (void)
+{
+ return "Clears firmware requests";
+}
+
+/**
+ * pk_transaction_plugin_finished_end:
+ */
+void
+pk_transaction_plugin_finished_end (PkTransaction *transaction)
+{
+ gboolean ret;
+ gchar *filename = NULL;
+ PkRoleEnum role;
+
+ role = pk_transaction_get_role (transaction);
+ if (role != PK_ROLE_ENUM_REFRESH_CACHE)
+ goto out;
+
+ /* clear the firmware requests directory */
+ filename = g_build_filename (LOCALSTATEDIR, "run", "PackageKit", "udev", NULL);
+ g_debug ("clearing udev firmware requests at %s", filename);
+ ret = pk_directory_remove_contents (filename);
+ if (!ret)
+ g_warning ("failed to clear %s", filename);
+out:
+ g_free (filename);
+}
diff --git a/src/plugins/pk-plugin-example.c b/src/plugins/pk-plugin-example.c
new file mode 100644
index 0000000..7eb6708
--- /dev/null
+++ b/src/plugins/pk-plugin-example.c
@@ -0,0 +1,124 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+#include <gio/gio.h>
+#include <pk-transaction.h>
+
+typedef struct {
+ guint dummy;
+} PluginPrivate;
+
+static PluginPrivate *priv;
+
+/**
+ * pk_transaction_plugin_get_description:
+ */
+const gchar *
+pk_transaction_plugin_get_description (void)
+{
+ return "A dummy plugin that doesn't do anything";
+}
+
+/**
+ * pk_transaction_plugin_initialize:
+ */
+void
+pk_transaction_plugin_initialize (PkTransaction *transaction)
+{
+ /* create private area */
+ priv = g_new0 (PluginPrivate, 1);
+ priv->dummy = 999;
+}
+
+/**
+ * pk_transaction_plugin_destroy:
+ */
+void
+pk_transaction_plugin_destroy (PkTransaction *transaction)
+{
+ g_free (priv);
+}
+
+/**
+ * pk_transaction_plugin_run:
+ */
+void
+pk_transaction_plugin_run (PkTransaction *transaction)
+{
+ gboolean ret;
+ PkBackend *backend = NULL;
+ PkConf *conf;
+ PkRoleEnum role;
+
+ /* check the config file */
+ conf = pk_transaction_get_conf (transaction);
+ ret = pk_conf_get_bool (conf, "UseDummy");
+ if (!ret)
+ goto out;
+
+ /* check the role */
+ role = pk_transaction_get_role (transaction);
+ if (role != PK_ROLE_ENUM_REFRESH_CACHE)
+ goto out;
+
+ /* check we can do the action */
+ backend = pk_transaction_get_backend (transaction);
+ if (!pk_backend_is_implemented (backend,
+ PK_ROLE_ENUM_GET_PACKAGES)) {
+ g_debug ("cannot get packages");
+ goto out;
+ }
+out:
+ return;
+}
+
+/**
+ * pk_transaction_plugin_started:
+ */
+void
+pk_transaction_plugin_started (PkTransaction *transaction)
+{
+}
+
+/**
+ * pk_transaction_plugin_finished_start:
+ */
+void
+pk_transaction_plugin_finished_start (PkTransaction *transaction)
+{
+}
+
+/**
+ * pk_transaction_plugin_finished_results:
+ */
+void
+pk_transaction_plugin_finished_results (PkTransaction *transaction)
+{
+}
+
+/**
+ * pk_transaction_plugin_finished_end:
+ */
+void
+pk_transaction_plugin_finished_end (PkTransaction *transaction)
+{
+}
diff --git a/src/plugins/pk-plugin-no-update-process.c b/src/plugins/pk-plugin-no-update-process.c
new file mode 100644
index 0000000..2039f07
--- /dev/null
+++ b/src/plugins/pk-plugin-no-update-process.c
@@ -0,0 +1,249 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+#include <gio/gio.h>
+#include <pk-transaction.h>
+
+#include <packagekit-glib2/pk-package.h>
+#include <packagekit-glib2/pk-files.h>
+
+#include "pk-proc.h"
+
+typedef struct {
+ GMainLoop *loop;
+ GPtrArray *files_list;
+ gchar **no_update_process_list;
+ PkProc *proc;
+} PluginPrivate;
+
+static PluginPrivate *priv;
+
+/**
+ * pk_transaction_plugin_get_description:
+ */
+const gchar *
+pk_transaction_plugin_get_description (void)
+{
+ return "Updates the package lists after refresh";
+}
+
+/**
+ * pk_plugin_finished_cb:
+ **/
+static void
+pk_plugin_finished_cb (PkBackend *backend,
+ PkExitEnum exit_enum,
+ gpointer user_data)
+{
+ if (!g_main_loop_is_running (priv->loop))
+ return;
+ if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
+ g_warning ("%s failed with exit code: %s",
+ pk_role_enum_to_string (pk_backend_get_role (backend)),
+ pk_exit_enum_to_string (exit_enum));
+ }
+ g_main_loop_quit (priv->loop);
+}
+
+/**
+ * pk_transaction_plugin_initialize:
+ */
+void
+pk_transaction_plugin_initialize (PkTransaction *transaction)
+{
+ PkConf *conf;
+
+ /* create private area */
+ priv = g_new0 (PluginPrivate, 1);
+ priv->loop = g_main_loop_new (NULL, FALSE);
+ priv->files_list = g_ptr_array_new_with_free_func (g_free);
+ priv->proc = pk_proc_new ();
+
+ /* get the list of processes we should neverupdate when running */
+ conf = pk_transaction_get_conf (transaction);
+ priv->no_update_process_list = pk_conf_get_strv (conf, "NoUpdateProcessList");
+}
+
+/**
+ * pk_transaction_plugin_destroy:
+ */
+void
+pk_transaction_plugin_destroy (PkTransaction *transaction)
+{
+ g_main_loop_unref (priv->loop);
+ g_strfreev (priv->no_update_process_list);
+ g_ptr_array_unref (priv->files_list);
+ g_object_unref (priv->proc);
+ g_free (priv);
+}
+
+/**
+ * pk_plugin_match_running_file:
+ *
+ * Only if the pattern matches the old and new names we refuse to run
+ **/
+static gboolean
+pk_plugin_match_running_file (gpointer user_data, const gchar *filename)
+{
+ guint i;
+ gchar **list;
+ gboolean ret;
+
+ /* compare each pattern */
+ list = priv->no_update_process_list;
+ for (i=0; list[i] != NULL; i++) {
+
+ /* does the package filename match */
+ ret = g_pattern_match_simple (list[i], filename);
+ if (ret) {
+ /* is there a running process that also matches */
+ ret = pk_proc_find_exec (priv->proc, list[i]);
+ if (ret)
+ goto out;
+ }
+ }
+
+ /* we failed */
+ ret = FALSE;
+out:
+ return ret;
+}
+
+/**
+ * pk_plugin_files_cb:
+ **/
+static void
+pk_plugin_files_cb (PkBackend *backend,
+ PkFiles *files,
+ gpointer user_data)
+{
+ guint i;
+ guint len;
+ gboolean ret;
+ gchar **filenames = NULL;
+
+ /* get data */
+ g_object_get (files,
+ "files", &filenames,
+ NULL);
+
+ /* check each file to see if it's a system shared library */
+ len = g_strv_length (filenames);
+ g_debug ("len=%i", len);
+ for (i=0; i<len; i++) {
+
+ /* does the package filename match */
+ ret = pk_plugin_match_running_file (backend, filenames[i]);
+ if (!ret)
+ continue;
+
+ /* add as it matches the criteria */
+ g_debug ("adding filename %s", filenames[i]);
+ g_ptr_array_add (priv->files_list, g_strdup (filenames[i]));
+ }
+ g_strfreev (filenames);
+}
+
+/**
+ * pk_transaction_plugin_run:
+ */
+void
+pk_transaction_plugin_run (PkTransaction *transaction)
+{
+ const gchar *file;
+ gboolean ret;
+ gchar **files = NULL;
+ gchar **package_ids;
+ gchar *process = NULL;
+ guint files_id = 0;
+ guint finished_id = 0;
+ PkBackend *backend = NULL;
+ PkRoleEnum role;
+
+ /* check the role */
+ role = pk_transaction_get_role (transaction);
+ if (role != PK_ROLE_ENUM_UPDATE_PACKAGES)
+ goto out;
+
+ /* check we can do the action */
+ backend = pk_transaction_get_backend (transaction);
+ if (!pk_backend_is_implemented (backend,
+ PK_ROLE_ENUM_GET_FILES)) {
+ g_debug ("cannot get files");
+ goto out;
+ }
+
+ /* check we have entry */
+ if (priv->no_update_process_list == NULL ||
+ priv->no_update_process_list[0] == NULL) {
+ g_debug ("no processes to watch");
+ goto out;
+ }
+
+ /* reset */
+ g_ptr_array_set_size (priv->files_list, 0);
+
+ /* set status */
+ pk_backend_set_status (backend, PK_STATUS_ENUM_SCAN_PROCESS_LIST);
+ pk_backend_set_percentage (backend, 101);
+
+ /* get list from proc */
+ ret = pk_proc_refresh (priv->proc);
+ if (!ret) {
+ g_warning ("failed to refresh");
+ /* non-fatal */
+ goto out;
+ }
+
+ /* set status */
+ pk_backend_set_status (backend, PK_STATUS_ENUM_CHECK_EXECUTABLE_FILES);
+
+ files_id = g_signal_connect (backend, "files",
+ G_CALLBACK (pk_plugin_files_cb), NULL);
+ finished_id = g_signal_connect (backend, "finished",
+ G_CALLBACK (pk_plugin_finished_cb), NULL);
+
+ /* get all the files touched in the packages we just updated */
+ package_ids = pk_transaction_get_package_ids (transaction);
+ pk_backend_reset (backend);
+ pk_backend_get_files (backend, package_ids);
+
+ /* wait for finished */
+ g_main_loop_run (priv->loop);
+ pk_backend_set_percentage (backend, 100);
+
+ /* there is a file we can't COW */
+ if (priv->files_list->len != 0) {
+ file = g_ptr_array_index (priv->files_list, 0);
+ pk_backend_error_code (backend,
+ PK_ERROR_ENUM_UPDATE_FAILED_DUE_TO_RUNNING_PROCESS,
+ "failed to run as %s is running", file);
+ goto out;
+ }
+out:
+ if (files_id > 0)
+ g_signal_handler_disconnect (backend, files_id);
+ if (finished_id > 0)
+ g_signal_handler_disconnect (backend, finished_id);
+ g_strfreev (files);
+ g_free (process);
+}
diff --git a/src/plugins/pk-plugin-scan-desktop-files.c b/src/plugins/pk-plugin-scan-desktop-files.c
new file mode 100644
index 0000000..b30bb97
--- /dev/null
+++ b/src/plugins/pk-plugin-scan-desktop-files.c
@@ -0,0 +1,683 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+#include <gio/gdesktopappinfo.h>
+#include <gio/gio.h>
+#include <pk-transaction.h>
+#include <sqlite3.h>
+
+#include <packagekit-glib2/pk-desktop.h>
+#include <packagekit-glib2/pk-package.h>
+
+typedef struct {
+ sqlite3 *db;
+ GPtrArray *list;
+ GMainLoop *loop;
+ GHashTable *hash;
+} PluginPrivate;
+
+static PluginPrivate *priv;
+
+/**
+ * pk_transaction_plugin_get_description:
+ */
+const gchar *
+pk_transaction_plugin_get_description (void)
+{
+ return "Scans desktop files on refresh and adds them to a database";
+}
+
+/**
+ * pk_plugin_package_cb:
+ **/
+static void
+pk_plugin_package_cb (PkBackend *backend,
+ PkPackage *package,
+ gpointer user_data)
+{
+ g_ptr_array_add (priv->list, g_object_ref (package));
+}
+
+/**
+ * pk_plugin_finished_cb:
+ **/
+static void
+pk_plugin_finished_cb (PkBackend *backend,
+ PkExitEnum exit_enum,
+ gpointer user_data)
+{
+ if (!g_main_loop_is_running (priv->loop))
+ return;
+ if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
+ g_warning ("%s failed with exit code: %s",
+ pk_role_enum_to_string (pk_backend_get_role (backend)),
+ pk_exit_enum_to_string (exit_enum));
+ }
+ g_main_loop_quit (priv->loop);
+}
+
+/**
+ * pk_transaction_plugin_initialize:
+ */
+void
+pk_transaction_plugin_initialize (PkTransaction *transaction)
+{
+ const gchar *statement_create;
+ gboolean ret;
+ gchar *error_msg = NULL;
+ gint rc;
+ PkConf *conf;
+
+ /* create private area */
+ priv = g_new0 (PluginPrivate, 1);
+ priv->loop = g_main_loop_new (NULL, FALSE);
+ priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+ priv->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+ /* check the config file */
+ conf = pk_transaction_get_conf (transaction);
+ ret = pk_conf_get_bool (conf, "ScanDesktopFiles");
+ if (!ret)
+ goto out;
+
+ /* check if database exists */
+ ret = g_file_test (PK_DESKTOP_DEFAULT_DATABASE,
+ G_FILE_TEST_EXISTS);
+
+ g_debug ("trying to open database '%s'",
+ PK_DESKTOP_DEFAULT_DATABASE);
+ rc = sqlite3_open (PK_DESKTOP_DEFAULT_DATABASE, &priv->db);
+ if (rc != 0) {
+ g_warning ("Can't open desktop database: %s\n",
+ sqlite3_errmsg (priv->db));
+ sqlite3_close (priv->db);
+ priv->db = NULL;
+ goto out;
+ }
+
+ /* create if not exists */
+ if (!ret) {
+ g_debug ("creating database cache in %s",
+ PK_DESKTOP_DEFAULT_DATABASE);
+ statement_create = "CREATE TABLE cache ("
+ "filename TEXT,"
+ "package TEXT,"
+ "show INTEGER,"
+ "md5 TEXT);";
+ rc = sqlite3_exec (priv->db, statement_create,
+ NULL, NULL, &error_msg);
+ if (rc != SQLITE_OK) {
+ g_warning ("SQL error: %s\n", error_msg);
+ sqlite3_free (error_msg);
+ goto out;
+ }
+ }
+
+ /* we don't need to keep syncing */
+ sqlite3_exec (priv->db, "PRAGMA synchronous=OFF", NULL, NULL, NULL);
+
+out:
+ return;
+}
+
+/**
+ * pk_transaction_plugin_destroy:
+ */
+void
+pk_transaction_plugin_destroy (PkTransaction *transaction)
+{
+ g_ptr_array_unref (priv->list);
+ g_main_loop_unref (priv->loop);
+ g_hash_table_unref (priv->hash);
+ sqlite3_close (priv->db);
+ g_free (priv);
+}
+
+/**
+ * pk_plugin_get_filename_md5:
+ **/
+static gchar *
+pk_plugin_get_filename_md5 (const gchar *filename)
+{
+ gchar *md5 = NULL;
+ gchar *data = NULL;
+ gsize length;
+ GError *error = NULL;
+ gboolean ret;
+
+ /* check is no longer exists */
+ ret = g_file_test (filename, G_FILE_TEST_EXISTS);
+ if (!ret)
+ goto out;
+
+ /* get data */
+ ret = g_file_get_contents (filename, &data, &length, &error);
+ if (!ret) {
+ g_warning ("failed to open file %s: %s",
+ filename, error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* check md5 is same */
+ md5 = g_compute_checksum_for_data (G_CHECKSUM_MD5,
+ (const guchar *) data,
+ length);
+out:
+ g_free (data);
+ return md5;
+}
+
+/**
+ * pk_plugin_sqlite_remove_filename:
+ **/
+static gint
+pk_plugin_sqlite_remove_filename (PkTransaction *transaction,
+ const gchar *filename)
+{
+ gchar *statement;
+ gint rc;
+
+ statement = g_strdup_printf ("DELETE FROM cache WHERE filename = '%s'",
+ filename);
+ rc = sqlite3_exec (priv->db, statement, NULL, NULL, NULL);
+ g_free (statement);
+ return rc;
+}
+
+/**
+ * pk_plugin_get_installed_package_for_file:
+ **/
+static PkPackage *
+pk_plugin_get_installed_package_for_file (PkTransaction *transaction,
+ const gchar *filename)
+{
+ PkPackage *package = NULL;
+ gchar **filenames;
+ PkBackend *backend = NULL;
+
+ /* use PK to find the correct package */
+ if (priv->list->len > 0)
+ g_ptr_array_set_size (priv->list, 0);
+ backend = pk_transaction_get_backend (transaction);
+ pk_backend_reset (backend);
+ filenames = g_strsplit (filename, "|||", -1);
+ pk_backend_search_files (backend,
+ pk_bitfield_value (PK_FILTER_ENUM_INSTALLED),
+ filenames);
+ g_strfreev (filenames);
+
+ /* wait for finished */
+ g_main_loop_run (priv->loop);
+
+ /* check that we only matched one package */
+ if (priv->list->len != 1) {
+ g_warning ("not correct size, %i", priv->list->len);
+ goto out;
+ }
+
+ /* get the package */
+ package = g_ptr_array_index (priv->list, 0);
+ if (package == NULL) {
+ g_warning ("cannot get package");
+ goto out;
+ }
+out:
+ return package;
+}
+
+/**
+ * pk_plugin_sqlite_add_filename_details:
+ **/
+static gint
+pk_plugin_sqlite_add_filename_details (PkTransaction *transaction,
+ const gchar *filename,
+ const gchar *package,
+ const gchar *md5)
+{
+ gchar *statement;
+ gchar *error_msg = NULL;
+ sqlite3_stmt *sql_statement = NULL;
+ gint rc = -1;
+ gint show;
+ GDesktopAppInfo *info;
+
+ /* find out if we should show desktop file in menus */
+ info = g_desktop_app_info_new_from_filename (filename);
+ if (info == NULL) {
+ g_warning ("could not load desktop file %s", filename);
+ goto out;
+ }
+ show = g_app_info_should_show (G_APP_INFO (info));
+ g_object_unref (info);
+
+ g_debug ("add filename %s from %s with md5: %s (show: %i)",
+ filename, package, md5, show);
+
+ /* the row might already exist */
+ statement = g_strdup_printf ("DELETE FROM cache WHERE filename = '%s'",
+ filename);
+ sqlite3_exec (priv->db, statement, NULL, NULL, NULL);
+ g_free (statement);
+
+ /* prepare the query, as we don't escape it */
+ rc = sqlite3_prepare_v2 (priv->db,
+ "INSERT INTO cache (filename, package, show, md5) "
+ "VALUES (?, ?, ?, ?)",
+ -1, &sql_statement, NULL);
+ if (rc != SQLITE_OK) {
+ g_warning ("SQL failed to prepare: %s",
+ sqlite3_errmsg (priv->db));
+ goto out;
+ }
+
+ /* add data */
+ sqlite3_bind_text (sql_statement, 1, filename, -1, SQLITE_STATIC);
+ sqlite3_bind_text (sql_statement, 2, package, -1, SQLITE_STATIC);
+ sqlite3_bind_int (sql_statement, 3, show);
+ sqlite3_bind_text (sql_statement, 4, md5, -1, SQLITE_STATIC);
+
+ /* save this */
+ sqlite3_step (sql_statement);
+ rc = sqlite3_finalize (sql_statement);
+ if (rc != SQLITE_OK) {
+ g_warning ("SQL error: %s\n", error_msg);
+ sqlite3_free (error_msg);
+ goto out;
+ }
+out:
+ return rc;
+}
+
+/**
+ * pk_plugin_sqlite_add_filename:
+ **/
+static gint
+pk_plugin_sqlite_add_filename (PkTransaction *transaction,
+ const gchar *filename,
+ const gchar *md5_opt)
+{
+ gchar *md5 = NULL;
+ gint rc = -1;
+ PkPackage *package;
+
+ /* if we've got it, use old data */
+ if (md5_opt != NULL)
+ md5 = g_strdup (md5_opt);
+ else
+ md5 = pk_plugin_get_filename_md5 (filename);
+
+ /* resolve */
+ package = pk_plugin_get_installed_package_for_file (transaction,
+ filename);
+ if (package == NULL) {
+ g_warning ("failed to get list");
+ goto out;
+ }
+
+ /* add */
+ rc = pk_plugin_sqlite_add_filename_details (transaction,
+ filename,
+ pk_package_get_name (package),
+ md5);
+out:
+ g_free (md5);
+ return rc;
+}
+
+/**
+ * pk_plugin_sqlite_cache_rescan_cb:
+ **/
+static gint
+pk_plugin_sqlite_cache_rescan_cb (void *data,
+ gint argc,
+ gchar **argv,
+ gchar **col_name)
+{
+ PkTransaction *transaction = PK_TRANSACTION (data);
+ const gchar *filename = NULL;
+ const gchar *md5 = NULL;
+ gchar *md5_calc = NULL;
+ gint i;
+
+ /* add the filename data to the array */
+ for (i=0; i<argc; i++) {
+ if (g_strcmp0 (col_name[i], "filename") == 0 && argv[i] != NULL)
+ filename = argv[i];
+ else if (g_strcmp0 (col_name[i], "md5") == 0 && argv[i] != NULL)
+ md5 = argv[i];
+ }
+
+ /* sanity check */
+ if (filename == NULL || md5 == NULL) {
+ g_warning ("filename %s and md5 %s)", filename, md5);
+ goto out;
+ }
+
+ /* get md5 */
+ md5_calc = pk_plugin_get_filename_md5 (filename);
+ if (md5_calc == NULL) {
+ g_debug ("remove of %s as no longer found", filename);
+ pk_plugin_sqlite_remove_filename (transaction, filename);
+ goto out;
+ }
+
+ /* we've checked the file */
+ g_hash_table_insert (priv->hash,
+ g_strdup (filename),
+ GUINT_TO_POINTER (1));
+
+ /* check md5 is same */
+ if (g_strcmp0 (md5, md5_calc) != 0) {
+ g_debug ("add of %s as md5 invalid (%s vs %s)",
+ filename, md5, md5_calc);
+ pk_plugin_sqlite_add_filename (transaction,
+ filename,
+ md5_calc);
+ }
+
+ g_debug ("existing filename %s valid, md5=%s", filename, md5);
+out:
+ g_free (md5_calc);
+ return 0;
+}
+
+/**
+ * pk_plugin_get_desktop_files:
+ **/
+static void
+pk_plugin_get_desktop_files (PkTransaction *transaction,
+ const gchar *app_dir,
+ GPtrArray *array)
+{
+ GError *error = NULL;
+ GDir *dir;
+ const gchar *filename;
+ gpointer data;
+ gchar *path;
+
+ /* open directory */
+ dir = g_dir_open (app_dir, 0, &error);
+ if (dir == NULL) {
+ g_warning ("failed to open directory %s: %s",
+ app_dir, error->message);
+ g_error_free (error);
+ return;
+ }
+
+ /* go through desktop files and add them to an array
+ * if not present */
+ filename = g_dir_read_name (dir);
+ while (filename != NULL) {
+ path = g_build_filename (app_dir, filename, NULL);
+ if (g_file_test (path, G_FILE_TEST_IS_DIR)) {
+ pk_plugin_get_desktop_files (transaction,
+ path, array);
+ } else if (g_str_has_suffix (filename, ".desktop")) {
+ data = g_hash_table_lookup (priv->hash, path);
+ if (data == NULL) {
+ g_debug ("add of %s as not present in db",
+ path);
+ g_ptr_array_add (array, g_strdup (path));
+ }
+ }
+ g_free (path);
+ filename = g_dir_read_name (dir);
+ }
+ g_dir_close (dir);
+}
+
+/**
+ * pk_transaction_plugin_finished_end:
+ */
+void
+pk_transaction_plugin_finished_end (PkTransaction *transaction)
+{
+ gchar *error_msg = NULL;
+ gchar *path;
+ gchar *statement;
+ gfloat step;
+ gint rc;
+ GPtrArray *array = NULL;
+ guint finished_id = 0;
+ guint i;
+ guint package_id = 0;
+ PkBackend *backend = NULL;
+ PkRoleEnum role;
+
+ /* no database */
+ if (priv->db == NULL)
+ goto out;
+
+ /* check the role */
+ role = pk_transaction_get_role (transaction);
+ if (role != PK_ROLE_ENUM_REFRESH_CACHE)
+ goto out;
+
+ /* connect to backend */
+ backend = pk_transaction_get_backend (transaction);
+ if (!pk_backend_is_implemented (backend,
+ PK_ROLE_ENUM_SEARCH_FILE)) {
+ g_debug ("cannot search files");
+ goto out;
+ }
+ finished_id = g_signal_connect (backend, "finished",
+ G_CALLBACK (pk_plugin_finished_cb), NULL);
+ package_id = g_signal_connect (backend, "package",
+ G_CALLBACK (pk_plugin_package_cb), NULL);
+
+ /* use a local backend instance */
+ pk_backend_reset (backend);
+ pk_backend_set_status (backend,
+ PK_STATUS_ENUM_SCAN_APPLICATIONS);
+
+ /* reset hash */
+ g_hash_table_remove_all (priv->hash);
+ pk_backend_set_percentage (backend, 101);
+
+ /* first go through the existing data, and look for
+ * modifications and removals */
+ statement = g_strdup ("SELECT filename, md5 FROM cache");
+ rc = sqlite3_exec (priv->db,
+ statement,
+ pk_plugin_sqlite_cache_rescan_cb,
+ transaction,
+ &error_msg);
+ g_free (statement);
+ if (rc != SQLITE_OK) {
+ g_warning ("SQL error: %s\n", error_msg);
+ sqlite3_free (error_msg);
+ goto out;
+ }
+
+ array = g_ptr_array_new_with_free_func (g_free);
+ pk_plugin_get_desktop_files (transaction,
+ PK_DESKTOP_DEFAULT_APPLICATION_DIR,
+ array);
+
+ if (array->len) {
+ step = 100.0f / array->len;
+ pk_backend_set_status (backend,
+ PK_STATUS_ENUM_GENERATE_PACKAGE_LIST);
+
+ /* process files in an array */
+ for (i=0; i<array->len; i++) {
+ pk_backend_set_percentage (backend, i * step);
+ path = g_ptr_array_index (array, i);
+ pk_plugin_sqlite_add_filename (transaction,
+ path,
+ NULL);
+ }
+ }
+
+ pk_backend_set_percentage (backend, 100);
+ pk_backend_set_status (backend, PK_STATUS_ENUM_FINISHED);
+out:
+ if (array != NULL)
+ g_ptr_array_unref (array);
+ if (backend == NULL) {
+ if (package_id > 0)
+ g_signal_handler_disconnect (backend, package_id);
+ if (finished_id > 0)
+ g_signal_handler_disconnect (backend, finished_id);
+ }
+}
+
+/**
+ * pk_plugin_files_cb:
+ **/
+static void
+pk_plugin_files_cb (PkBackend *backend,
+ PkFiles *files,
+ PkTransaction *transaction)
+{
+ guint i;
+ guint len;
+ gboolean ret;
+ gchar **package;
+ gchar *md5;
+ gchar **filenames = NULL;
+ gchar *package_id = NULL;
+
+ /* get data */
+ g_object_get (files,
+ "package-id", &package_id,
+ "files", &filenames,
+ NULL);
+
+ package = pk_package_id_split (package_id);
+
+ /* check each file */
+ len = g_strv_length (filenames);
+ for (i=0; i<len; i++) {
+ /* exists? */
+ ret = g_file_test (filenames[i], G_FILE_TEST_EXISTS);
+ if (!ret)
+ continue;
+
+ /* .desktop file? */
+ ret = g_str_has_suffix (filenames[i], ".desktop");
+ if (!ret)
+ continue;
+
+ g_debug ("adding filename %s", filenames[i]);
+ md5 = pk_plugin_get_filename_md5 (filenames[i]);
+ pk_plugin_sqlite_add_filename_details (transaction,
+ filenames[i],
+ package[PK_PACKAGE_ID_NAME],
+ md5);
+ g_free (md5);
+ }
+ g_strfreev (filenames);
+ g_strfreev (package);
+ g_free (package_id);
+}
+
+/**
+ * pk_transaction_plugin_finished_results:
+ */
+void
+pk_transaction_plugin_finished_results (PkTransaction *transaction)
+{
+ gchar **package_ids = NULL;
+ gchar *package_id_tmp;
+ GPtrArray *array = NULL;
+ GPtrArray *list = NULL;
+ guint files_id = 0;
+ guint finished_id = 0;
+ guint i;
+ PkBackend *backend = NULL;
+ PkInfoEnum info;
+ PkPackage *item;
+ PkResults *results;
+ PkRoleEnum role;
+
+ /* no database */
+ if (priv->db == NULL)
+ goto out;
+
+ /* check the role */
+ role = pk_transaction_get_role (transaction);
+ if (role != PK_ROLE_ENUM_INSTALL_PACKAGES)
+ goto out;
+
+ /* connect to backend */
+ backend = pk_transaction_get_backend (transaction);
+ if (!pk_backend_is_implemented (backend,
+ PK_ROLE_ENUM_GET_FILES)) {
+ g_debug ("cannot get files");
+ goto out;
+ }
+ finished_id = g_signal_connect (backend, "finished",
+ G_CALLBACK (pk_plugin_finished_cb), NULL);
+ files_id = g_signal_connect (backend, "files",
+ G_CALLBACK (pk_plugin_files_cb), NULL);
+
+ /* get results */
+ results = pk_transaction_get_results (transaction);
+ array = pk_results_get_package_array (results);
+
+ /* filter on INSTALLING | UPDATING */
+ list = g_ptr_array_new_with_free_func (g_free);
+ for (i=0; i<array->len; i++) {
+ item = g_ptr_array_index (array, i);
+ info = pk_package_get_info (item);
+ if (info == PK_INFO_ENUM_INSTALLING ||
+ info == PK_INFO_ENUM_UPDATING) {
+ /* we convert the package_id data to be 'installed' */
+ package_id_tmp = pk_package_id_build (pk_package_get_name (item),
+ pk_package_get_version (item),
+ pk_package_get_arch (item),
+ "installed");
+ g_ptr_array_add (list, package_id_tmp);
+ }
+ }
+
+ /* process file lists on these packages */
+ g_debug ("processing %i packags for desktop files", list->len);
+ if (list->len == 0)
+ goto out;
+
+ /* get all the files touched in the packages we just installed */
+ pk_backend_reset (backend);
+ pk_backend_set_status (backend, PK_STATUS_ENUM_SCAN_APPLICATIONS);
+ pk_backend_set_percentage (backend, 101);
+ package_ids = pk_ptr_array_to_strv (list);
+ pk_backend_get_files (backend, package_ids);
+
+ /* wait for finished */
+ g_main_loop_run (priv->loop);
+
+ pk_backend_set_percentage (backend, 100);
+out:
+ if (backend == NULL) {
+ if (files_id > 0)
+ g_signal_handler_disconnect (backend, files_id);
+ if (finished_id > 0)
+ g_signal_handler_disconnect (backend, finished_id);
+ }
+ if (array != NULL)
+ g_ptr_array_unref (array);
+ if (list != NULL)
+ g_ptr_array_unref (list);
+ g_strfreev (package_ids);
+}
diff --git a/src/plugins/pk-plugin-scripts.c b/src/plugins/pk-plugin-scripts.c
new file mode 100644
index 0000000..b2ca5cb
--- /dev/null
+++ b/src/plugins/pk-plugin-scripts.c
@@ -0,0 +1,158 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+#include <gio/gio.h>
+#include <pk-transaction.h>
+
+/**
+ * pk_transaction_plugin_get_description:
+ */
+const gchar *
+pk_transaction_plugin_get_description (void)
+{
+ return "Runs external scrips";
+}
+
+/**
+ * pk_transaction_process_script:
+ **/
+static void
+pk_transaction_process_script (PkTransaction *transaction, const gchar *filename)
+{
+ GFile *file = NULL;
+ GFileInfo *info = NULL;
+ guint file_uid;
+ gchar *command = NULL;
+ gint exit_status = 0;
+ gboolean ret;
+ GError *error = NULL;
+ PkRoleEnum role;
+
+ /* get content type for file */
+ file = g_file_new_for_path (filename);
+ info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_UNIX_UID ","
+ G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &error);
+ if (info == NULL) {
+ g_warning ("failed to get info: %s", error->message);
+ goto out;
+ }
+
+ /* check is executable */
+ ret = g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE);
+ if (!ret) {
+ g_warning ("%s is not executable", filename);
+ goto out;
+ }
+
+ /* check is owned by the correct user */
+ file_uid = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_UID);
+ if (file_uid != 0) {
+ g_warning ("%s is not owned by the root user", filename);
+ goto out;
+ }
+
+ /* format the argument list */
+ role = pk_transaction_get_role (transaction);
+ command = g_strdup_printf ("%s %s NOTAPISTABLE",
+ filename,
+ pk_role_enum_to_string (role));
+
+ /* run the command, but don't exit if fails */
+ ret = g_spawn_command_line_sync (command, NULL, NULL, &exit_status, &error);
+ if (!ret) {
+ g_warning ("failed to spawn %s [%i]: %s", command, exit_status, error->message);
+ g_error_free (error);
+ } else {
+ g_debug ("ran %s", command);
+ }
+
+out:
+ g_free (command);
+ if (info != NULL)
+ g_object_unref (info);
+ if (file != NULL)
+ g_object_unref (file);
+}
+
+/**
+ * pk_transaction_process_scripts:
+ *
+ * Run all scripts in a given directory
+ **/
+static void
+pk_transaction_process_scripts (PkTransaction *transaction, const gchar *location)
+{
+ GError *error = NULL;
+ gchar *filename;
+ gchar *dirname;
+ const gchar *file;
+ GDir *dir;
+
+ /* get location to search */
+ dirname = g_build_filename (SYSCONFDIR, "PackageKit", "events", location, NULL);
+ dir = g_dir_open (dirname, 0, &error);
+ if (dir == NULL) {
+ g_warning ("Failed to open %s: %s", dirname, error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* run scripts */
+ file = g_dir_read_name (dir);
+ while (file != NULL) {
+ filename = g_build_filename (dirname, file, NULL);
+
+ /* we put this here */
+ if (g_strcmp0 (file, "README") != 0) {
+ pk_transaction_process_script (transaction, filename);
+ }
+
+ g_free (filename);
+ file = g_dir_read_name (dir);
+ }
+out:
+ if (dir != NULL)
+ g_dir_close (dir);
+ g_free (dirname);
+}
+
+/**
+ * pk_transaction_plugin_run:
+ */
+void
+pk_transaction_plugin_run (PkTransaction *transaction)
+{
+ pk_transaction_process_scripts (transaction,
+ "pre-transaction.d");
+}
+
+/**
+ * pk_transaction_plugin_finished_end:
+ */
+void
+pk_transaction_plugin_finished_end (PkTransaction *transaction)
+{
+ pk_transaction_process_scripts (transaction,
+ "post-transaction.d");
+}
diff --git a/src/plugins/pk-plugin-update-check-processes.c b/src/plugins/pk-plugin-update-check-processes.c
new file mode 100644
index 0000000..d161cf6
--- /dev/null
+++ b/src/plugins/pk-plugin-update-check-processes.c
@@ -0,0 +1,230 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+#include <gio/gio.h>
+#include <pk-transaction.h>
+
+#include "pk-proc.h"
+
+typedef struct {
+ PkProc *proc;
+ GMainLoop *loop;
+} PluginPrivate;
+
+static PluginPrivate *priv;
+
+/**
+ * pk_transaction_plugin_get_description:
+ */
+const gchar *
+pk_transaction_plugin_get_description (void)
+{
+ return "Checks for running processes during update for session restarts";
+}
+
+/**
+ * pk_transaction_plugin_initialize:
+ */
+void
+pk_transaction_plugin_initialize (PkTransaction *transaction)
+{
+ /* create private area */
+ priv = g_new0 (PluginPrivate, 1);
+ priv->loop = g_main_loop_new (NULL, FALSE);
+ priv->proc = pk_proc_new ();
+}
+
+/**
+ * pk_transaction_plugin_destroy:
+ */
+void
+pk_transaction_plugin_destroy (PkTransaction *transaction)
+{
+ g_main_loop_unref (priv->loop);
+ g_object_unref (priv->proc);
+ g_free (priv);
+}
+
+/**
+ * pk_plugin_finished_cb:
+ **/
+static void
+pk_plugin_finished_cb (PkBackend *backend,
+ PkExitEnum exit_enum,
+ gpointer user_data)
+{
+ if (!g_main_loop_is_running (priv->loop))
+ return;
+ if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
+ g_warning ("%s failed with exit code: %s",
+ pk_role_enum_to_string (pk_backend_get_role (backend)),
+ pk_exit_enum_to_string (exit_enum));
+ }
+ g_main_loop_quit (priv->loop);
+}
+
+/**
+ * pk_plugin_files_cb:
+ **/
+static void
+pk_plugin_files_cb (PkBackend *backend,
+ PkFiles *files,
+ PkTransaction *transaction)
+{
+ guint i;
+ guint len;
+ gboolean ret;
+ gchar **filenames = NULL;
+ gchar *package_id = NULL;
+
+ /* get data */
+ g_object_get (files,
+ "package-id", &package_id,
+ "files", &filenames,
+ NULL);
+
+ /* check each file */
+ len = g_strv_length (filenames);
+ for (i=0; i<len; i++) {
+ /* executable? */
+ ret = g_file_test (filenames[i],
+ G_FILE_TEST_IS_REGULAR |
+ G_FILE_TEST_IS_EXECUTABLE |
+ G_FILE_TEST_EXISTS);
+ if (!ret)
+ continue;
+
+ /* running? */
+ ret = pk_proc_find_exec (priv->proc, filenames[i]);
+ if (!ret)
+ continue;
+
+ /* TODO: findout if the executable has a desktop file, and if so,
+ * suggest an application restart instead */
+
+ /* send signal about session restart */
+ g_debug ("package %s updated, and %s is running",
+ package_id, filenames[i]);
+ pk_backend_require_restart (backend,
+ PK_RESTART_ENUM_SESSION,
+ package_id);
+ }
+ g_strfreev (filenames);
+ g_free (package_id);
+}
+
+/**
+ * pk_transaction_plugin_finished_results:
+ */
+void
+pk_transaction_plugin_finished_results (PkTransaction *transaction)
+{
+ gboolean ret;
+ gchar **package_ids = NULL;
+ gchar *package_id_tmp;
+ GPtrArray *array = NULL;
+ GPtrArray *list = NULL;
+ guint files_id = 0;
+ guint finished_id = 0;
+ guint i;
+ PkBackend *backend = NULL;
+ PkConf *conf;
+ PkPackage *item;
+ PkResults *results;
+ PkRoleEnum role;
+
+ /* check the config file */
+ conf = pk_transaction_get_conf (transaction);
+ ret = pk_conf_get_bool (conf, "UpdateCheckProcesses");
+ if (!ret)
+ goto out;
+
+ /* check the role */
+ role = pk_transaction_get_role (transaction);
+ if (role != PK_ROLE_ENUM_UPDATE_SYSTEM &&
+ role != PK_ROLE_ENUM_UPDATE_PACKAGES)
+ goto out;
+
+ /* check we can do the action */
+ backend = pk_transaction_get_backend (transaction);
+ if (!pk_backend_is_implemented (backend,
+ PK_ROLE_ENUM_GET_FILES)) {
+ g_debug ("cannot get files");
+ goto out;
+ }
+ finished_id = g_signal_connect (backend, "finished",
+ G_CALLBACK (pk_plugin_finished_cb), NULL);
+ files_id = g_signal_connect (backend, "files",
+ G_CALLBACK (pk_plugin_files_cb), NULL);
+
+ /* get results */
+ results = pk_transaction_get_results (transaction);
+ array = pk_results_get_package_array (results);
+
+ /* filter on UPDATING */
+ list = g_ptr_array_new_with_free_func (g_free);
+ for (i=0; i<array->len; i++) {
+ item = g_ptr_array_index (array, i);
+ if (pk_package_get_info (item) != PK_INFO_ENUM_UPDATING)
+ continue;
+ /* we convert the package_id data to be 'installed' as this means
+ * we can use the local package database for GetFiles rather than
+ * downloading new remote metadata */
+ package_id_tmp = pk_package_id_build (pk_package_get_name (item),
+ pk_package_get_version (item),
+ pk_package_get_arch (item),
+ "installed");
+ g_ptr_array_add (list, package_id_tmp);
+ }
+
+ /* process file lists on these packages */
+ if (list->len == 0)
+ goto out;
+
+ /* get all the running processes */
+ pk_proc_refresh (priv->proc);
+
+ /* get all the files touched in the packages we just updated */
+ pk_backend_reset (backend);
+ pk_backend_set_status (backend, PK_STATUS_ENUM_CHECK_EXECUTABLE_FILES);
+ pk_backend_set_percentage (backend, 101);
+ package_ids = pk_ptr_array_to_strv (list);
+ pk_backend_get_files (backend, package_ids);
+
+ /* wait for finished */
+ g_main_loop_run (priv->loop);
+
+ pk_backend_set_percentage (backend, 100);
+
+out:
+ g_strfreev (package_ids);
+ if (backend == NULL) {
+ if (files_id > 0)
+ g_signal_handler_disconnect (backend, files_id);
+ if (finished_id > 0)
+ g_signal_handler_disconnect (backend, finished_id);
+ }
+ if (array != NULL)
+ g_ptr_array_unref (array);
+ if (list != NULL)
+ g_ptr_array_unref (list);
+}
diff --git a/src/plugins/pk-plugin-update-package-list.c b/src/plugins/pk-plugin-update-package-list.c
new file mode 100644
index 0000000..becfc20
--- /dev/null
+++ b/src/plugins/pk-plugin-update-package-list.c
@@ -0,0 +1,211 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+#include <gio/gio.h>
+#include <pk-transaction.h>
+#include <packagekit-glib2/pk-package.h>
+
+typedef struct {
+ GPtrArray *list;
+ GMainLoop *loop;
+} PluginPrivate;
+
+static PluginPrivate *priv;
+
+/**
+ * pk_transaction_plugin_get_description:
+ */
+const gchar *
+pk_transaction_plugin_get_description (void)
+{
+ return "Updates the package lists after refresh";
+}
+
+/**
+ * pk_plugin_package_cb:
+ **/
+static void
+pk_plugin_package_cb (PkBackend *backend,
+ PkPackage *package,
+ gpointer user_data)
+{
+ g_ptr_array_add (priv->list, g_object_ref (package));
+}
+
+/**
+ * pk_plugin_finished_cb:
+ **/
+static void
+pk_plugin_finished_cb (PkBackend *backend,
+ PkExitEnum exit_enum,
+ gpointer user_data)
+{
+ if (!g_main_loop_is_running (priv->loop))
+ return;
+ if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
+ g_warning ("%s failed with exit code: %s",
+ pk_role_enum_to_string (pk_backend_get_role (backend)),
+ pk_exit_enum_to_string (exit_enum));
+ }
+ g_main_loop_quit (priv->loop);
+}
+
+/**
+ * pk_transaction_plugin_initialize:
+ */
+void
+pk_transaction_plugin_initialize (PkTransaction *transaction)
+{
+ /* create private area */
+ priv = g_new0 (PluginPrivate, 1);
+ priv->loop = g_main_loop_new (NULL, FALSE);
+ priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+}
+
+/**
+ * pk_transaction_plugin_destroy:
+ */
+void
+pk_transaction_plugin_destroy (PkTransaction *transaction)
+{
+ g_ptr_array_unref (priv->list);
+ g_main_loop_unref (priv->loop);
+ g_free (priv);
+}
+
+/**
+ * pk_plugin_package_list_to_string:
+ **/
+static gchar *
+pk_plugin_package_list_to_string (GPtrArray *array)
+{
+ guint i;
+ PkPackage *package;
+ GString *string;
+ PkInfoEnum info;
+ gchar *package_id;
+ gchar *summary;
+
+ string = g_string_new ("");
+ for (i=0; i<array->len; i++) {
+ package = g_ptr_array_index (array, i);
+ g_object_get (package,
+ "info", &info,
+ "package-id", &package_id,
+ "summary", &summary,
+ NULL);
+ g_string_append_printf (string, "%s\t%s\t%s\n",
+ pk_info_enum_to_string (info),
+ package_id,
+ summary);
+ g_free (package_id);
+ g_free (summary);
+ }
+
+ /* remove trailing newline */
+ if (string->len != 0)
+ g_string_set_size (string, string->len-1);
+ return g_string_free (string, FALSE);
+}
+
+/**
+ * pk_transaction_plugin_finished_end:
+ */
+void
+pk_transaction_plugin_finished_end (PkTransaction *transaction)
+{
+ gboolean ret;
+ gchar *data = NULL;
+ GError *error = NULL;
+ guint finished_id = 0;
+ guint package_id = 0;
+ PkBackend *backend = NULL;
+ PkConf *conf;
+ PkRoleEnum role;
+
+ /* check the config file */
+ conf = pk_transaction_get_conf (transaction);
+ ret = pk_conf_get_bool (conf, "UpdatePackageList");
+ if (!ret)
+ goto out;
+
+ /* check the role */
+ role = pk_transaction_get_role (transaction);
+ if (role != PK_ROLE_ENUM_REFRESH_CACHE)
+ goto out;
+
+ /* check we can do the action */
+ backend = pk_transaction_get_backend (transaction);
+ if (!pk_backend_is_implemented (backend,
+ PK_ROLE_ENUM_GET_PACKAGES)) {
+ g_debug ("cannot get packages");
+ goto out;
+ }
+
+ /* connect to backend */
+ backend = pk_transaction_get_backend (transaction);
+ finished_id = g_signal_connect (backend, "finished",
+ G_CALLBACK (pk_plugin_finished_cb), NULL);
+ package_id = g_signal_connect (backend, "package",
+ G_CALLBACK (pk_plugin_package_cb), NULL);
+
+ g_debug ("plugin: updating package lists");
+
+ /* clear old list */
+ if (priv->list->len > 0)
+ g_ptr_array_set_size (priv->list, 0);
+
+ /* update UI */
+ pk_backend_set_status (backend,
+ PK_STATUS_ENUM_GENERATE_PACKAGE_LIST);
+ pk_backend_set_percentage (backend, 101);
+
+ /* get the new package list */
+ pk_backend_reset (backend);
+ pk_backend_get_packages (backend, PK_FILTER_ENUM_NONE);
+
+ /* wait for finished */
+ g_main_loop_run (priv->loop);
+
+ /* update UI */
+ pk_backend_set_percentage (backend, 90);
+
+ /* convert to a file */
+ data = pk_plugin_package_list_to_string (priv->list);
+ ret = g_file_set_contents (PK_SYSTEM_PACKAGE_LIST_FILENAME,
+ data, -1, &error);
+ if (!ret) {
+ g_warning ("failed to save to file: %s",
+ error->message);
+ g_error_free (error);
+ }
+
+ /* update UI */
+ pk_backend_set_percentage (backend, 100);
+ pk_backend_set_status (backend, PK_STATUS_ENUM_FINISHED);
+out:
+ if (backend != NULL) {
+ g_signal_handler_disconnect (backend, finished_id);
+ g_signal_handler_disconnect (backend, package_id);
+ }
+ g_free (data);
+}
diff --git a/src/plugins/pk-self-test.c b/src/plugins/pk-self-test.c
new file mode 100644
index 0000000..07930fa
--- /dev/null
+++ b/src/plugins/pk-self-test.c
@@ -0,0 +1,38 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007-2010 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+
+#include <glib.h>
+#include <glib-object.h>
+#include <glib/gstdio.h>
+
+int
+main (int argc, char **argv)
+{
+ if (! g_thread_supported ())
+ g_thread_init (NULL);
+ g_type_init ();
+ g_test_init (&argc, &argv, NULL);
+
+ return g_test_run ();
+}
+
commit 7ad2d8f186e773ed46192aaab569f78f1353f349
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jul 11 11:26:42 2011 +0100
Ensure the example plugin is included in the tarball and built, but not installed
diff --git a/src/Makefile.am b/src/Makefile.am
index 3eddec7..14adb0a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -230,6 +230,9 @@ CLEANFILES = *~ $(BUILT_SOURCES)
# plugins
plugindir = $(LIBDIR)/packagekit-plugins
+noinst_LTLIBRARIES = \
+ libpk_plugin_example.la
+
plugin_LTLIBRARIES = \
libpk_plugin_scripts.la \
libpk_plugin-update-package-list.la \
@@ -239,6 +242,11 @@ plugin_LTLIBRARIES = \
libpk_plugin-check-shared-libraries-in-use.la \
libpk-plugin-clear-firmware-requests.la
+libpk_plugin_example_la_SOURCES = pk-plugin-example.c
+libpk_plugin_example_la_LIBADD = $(PK_PLUGIN_LIBS)
+libpk_plugin_example_la_LDFLAGS = -module -avoid-version
+libpk_plugin_example_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+
libpk_plugin_scripts_la_SOURCES = pk-plugin-scripts.c
libpk_plugin_scripts_la_LIBADD = $(PK_PLUGIN_LIBS)
libpk_plugin_scripts_la_LDFLAGS = -module -avoid-version
diff --git a/src/pk-plugin-example.c b/src/pk-plugin-example.c
index 9f19654..7eb6708 100644
--- a/src/pk-plugin-example.c
+++ b/src/pk-plugin-example.c
@@ -92,6 +92,14 @@ out:
}
/**
+ * pk_transaction_plugin_started:
+ */
+void
+pk_transaction_plugin_started (PkTransaction *transaction)
+{
+}
+
+/**
* pk_transaction_plugin_finished_start:
*/
void
commit 014d570376e5999b483aa25a4ce3cd32c6d232ce
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jul 11 11:22:13 2011 +0100
trivial: unexport more stuff in PkTransaction
diff --git a/src/pk-plugin-check-shared-libraries-in-use.c b/src/pk-plugin-check-shared-libraries-in-use.c
index d596121..9a74c95 100644
--- a/src/pk-plugin-check-shared-libraries-in-use.c
+++ b/src/pk-plugin-check-shared-libraries-in-use.c
@@ -111,7 +111,7 @@ pk_plugin_get_installed_package_for_file (PkTransaction *transaction,
/* use PK to find the correct package */
g_ptr_array_set_size (priv->list, 0);
- backend = pk_transaction_priv_get_backend (transaction);
+ backend = pk_transaction_get_backend (transaction);
pk_backend_reset (backend);
filenames = g_strsplit (filename, "|||", -1);
pk_backend_search_files (backend,
@@ -301,20 +301,20 @@ pk_transaction_plugin_run (PkTransaction *transaction)
PkCache *cache = NULL;
/* check the config file */
- conf = pk_transaction_priv_get_conf (transaction);
+ conf = pk_transaction_get_conf (transaction);
ret = pk_conf_get_bool (conf, "CheckSharedLibrariesInUse");
if (!ret)
goto out;
/* check the role */
- role = pk_transaction_priv_get_role (transaction);
+ role = pk_transaction_get_role (transaction);
if (role != PK_ROLE_ENUM_UPDATE_SYSTEM &&
role != PK_ROLE_ENUM_UPDATE_PACKAGES &&
role != PK_ROLE_ENUM_INSTALL_PACKAGES)
goto out;
/* check we can do the action */
- backend = pk_transaction_priv_get_backend (transaction);
+ backend = pk_transaction_get_backend (transaction);
if (!pk_backend_is_implemented (backend,
PK_ROLE_ENUM_GET_FILES)) {
g_debug ("cannot get files");
@@ -368,7 +368,7 @@ pk_transaction_plugin_run (PkTransaction *transaction)
}
/* is a security update we are installing */
- package_ids = pk_transaction_priv_get_package_ids (transaction);
+ package_ids = pk_transaction_get_package_ids (transaction);
if (role == PK_ROLE_ENUM_INSTALL_PACKAGES) {
ret = FALSE;
@@ -479,18 +479,18 @@ pk_transaction_plugin_finished_results (PkTransaction *transaction)
guint uid_min;
/* check the config file */
- conf = pk_transaction_priv_get_conf (transaction);
+ conf = pk_transaction_get_conf (transaction);
ret = pk_conf_get_bool (conf, "CheckSharedLibrariesInUse");
if (!ret)
goto out;
/* check the role */
- role = pk_transaction_priv_get_role (transaction);
+ role = pk_transaction_get_role (transaction);
if (role != PK_ROLE_ENUM_GET_UPDATES)
goto out;
/* check we can do the action */
- backend = pk_transaction_priv_get_backend (transaction);
+ backend = pk_transaction_get_backend (transaction);
if (!pk_backend_is_implemented (backend,
PK_ROLE_ENUM_GET_PACKAGES)) {
g_debug ("cannot get packages");
diff --git a/src/pk-plugin-clear-firmware-requests.c b/src/pk-plugin-clear-firmware-requests.c
index a7fdfc9..45b5593 100644
--- a/src/pk-plugin-clear-firmware-requests.c
+++ b/src/pk-plugin-clear-firmware-requests.c
@@ -44,7 +44,7 @@ pk_transaction_plugin_finished_end (PkTransaction *transaction)
gchar *filename = NULL;
PkRoleEnum role;
- role = pk_transaction_priv_get_role (transaction);
+ role = pk_transaction_get_role (transaction);
if (role != PK_ROLE_ENUM_REFRESH_CACHE)
goto out;
diff --git a/src/pk-plugin-example.c b/src/pk-plugin-example.c
index 0cfbedd..9f19654 100644
--- a/src/pk-plugin-example.c
+++ b/src/pk-plugin-example.c
@@ -70,18 +70,18 @@ pk_transaction_plugin_run (PkTransaction *transaction)
PkRoleEnum role;
/* check the config file */
- conf = pk_transaction_priv_get_conf (transaction);
+ conf = pk_transaction_get_conf (transaction);
ret = pk_conf_get_bool (conf, "UseDummy");
if (!ret)
goto out;
/* check the role */
- role = pk_transaction_priv_get_role (transaction);
+ role = pk_transaction_get_role (transaction);
if (role != PK_ROLE_ENUM_REFRESH_CACHE)
goto out;
/* check we can do the action */
- backend = pk_transaction_priv_get_backend (transaction);
+ backend = pk_transaction_get_backend (transaction);
if (!pk_backend_is_implemented (backend,
PK_ROLE_ENUM_GET_PACKAGES)) {
g_debug ("cannot get packages");
diff --git a/src/pk-plugin-no-update-process.c b/src/pk-plugin-no-update-process.c
index 51617a0..2039f07 100644
--- a/src/pk-plugin-no-update-process.c
+++ b/src/pk-plugin-no-update-process.c
@@ -79,7 +79,7 @@ pk_transaction_plugin_initialize (PkTransaction *transaction)
priv->proc = pk_proc_new ();
/* get the list of processes we should neverupdate when running */
- conf = pk_transaction_priv_get_conf (transaction);
+ conf = pk_transaction_get_conf (transaction);
priv->no_update_process_list = pk_conf_get_strv (conf, "NoUpdateProcessList");
}
@@ -180,12 +180,12 @@ pk_transaction_plugin_run (PkTransaction *transaction)
PkRoleEnum role;
/* check the role */
- role = pk_transaction_priv_get_role (transaction);
+ role = pk_transaction_get_role (transaction);
if (role != PK_ROLE_ENUM_UPDATE_PACKAGES)
goto out;
/* check we can do the action */
- backend = pk_transaction_priv_get_backend (transaction);
+ backend = pk_transaction_get_backend (transaction);
if (!pk_backend_is_implemented (backend,
PK_ROLE_ENUM_GET_FILES)) {
g_debug ("cannot get files");
@@ -223,7 +223,7 @@ pk_transaction_plugin_run (PkTransaction *transaction)
G_CALLBACK (pk_plugin_finished_cb), NULL);
/* get all the files touched in the packages we just updated */
- package_ids = pk_transaction_priv_get_package_ids (transaction);
+ package_ids = pk_transaction_get_package_ids (transaction);
pk_backend_reset (backend);
pk_backend_get_files (backend, package_ids);
diff --git a/src/pk-plugin-scan-desktop-files.c b/src/pk-plugin-scan-desktop-files.c
index 82f7f66..b30bb97 100644
--- a/src/pk-plugin-scan-desktop-files.c
+++ b/src/pk-plugin-scan-desktop-files.c
@@ -94,7 +94,7 @@ pk_transaction_plugin_initialize (PkTransaction *transaction)
priv->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
/* check the config file */
- conf = pk_transaction_priv_get_conf (transaction);
+ conf = pk_transaction_get_conf (transaction);
ret = pk_conf_get_bool (conf, "ScanDesktopFiles");
if (!ret)
goto out;
@@ -218,7 +218,7 @@ pk_plugin_get_installed_package_for_file (PkTransaction *transaction,
/* use PK to find the correct package */
if (priv->list->len > 0)
g_ptr_array_set_size (priv->list, 0);
- backend = pk_transaction_priv_get_backend (transaction);
+ backend = pk_transaction_get_backend (transaction);
pk_backend_reset (backend);
filenames = g_strsplit (filename, "|||", -1);
pk_backend_search_files (backend,
@@ -469,12 +469,12 @@ pk_transaction_plugin_finished_end (PkTransaction *transaction)
goto out;
/* check the role */
- role = pk_transaction_priv_get_role (transaction);
+ role = pk_transaction_get_role (transaction);
if (role != PK_ROLE_ENUM_REFRESH_CACHE)
goto out;
/* connect to backend */
- backend = pk_transaction_priv_get_backend (transaction);
+ backend = pk_transaction_get_backend (transaction);
if (!pk_backend_is_implemented (backend,
PK_ROLE_ENUM_SEARCH_FILE)) {
g_debug ("cannot search files");
@@ -616,12 +616,12 @@ pk_transaction_plugin_finished_results (PkTransaction *transaction)
goto out;
/* check the role */
- role = pk_transaction_priv_get_role (transaction);
+ role = pk_transaction_get_role (transaction);
if (role != PK_ROLE_ENUM_INSTALL_PACKAGES)
goto out;
/* connect to backend */
- backend = pk_transaction_priv_get_backend (transaction);
+ backend = pk_transaction_get_backend (transaction);
if (!pk_backend_is_implemented (backend,
PK_ROLE_ENUM_GET_FILES)) {
g_debug ("cannot get files");
@@ -633,7 +633,7 @@ pk_transaction_plugin_finished_results (PkTransaction *transaction)
G_CALLBACK (pk_plugin_files_cb), NULL);
/* get results */
- results = pk_transaction_priv_get_results (transaction);
+ results = pk_transaction_get_results (transaction);
array = pk_results_get_package_array (results);
/* filter on INSTALLING | UPDATING */
diff --git a/src/pk-plugin-scripts.c b/src/pk-plugin-scripts.c
index 58debf2..b2ca5cb 100644
--- a/src/pk-plugin-scripts.c
+++ b/src/pk-plugin-scripts.c
@@ -73,7 +73,7 @@ pk_transaction_process_script (PkTransaction *transaction, const gchar *filename
}
/* format the argument list */
- role = pk_transaction_priv_get_role (transaction);
+ role = pk_transaction_get_role (transaction);
command = g_strdup_printf ("%s %s NOTAPISTABLE",
filename,
pk_role_enum_to_string (role));
diff --git a/src/pk-plugin-update-check-processes.c b/src/pk-plugin-update-check-processes.c
index 5351894..d161cf6 100644
--- a/src/pk-plugin-update-check-processes.c
+++ b/src/pk-plugin-update-check-processes.c
@@ -153,19 +153,19 @@ pk_transaction_plugin_finished_results (PkTransaction *transaction)
PkRoleEnum role;
/* check the config file */
- conf = pk_transaction_priv_get_conf (transaction);
+ conf = pk_transaction_get_conf (transaction);
ret = pk_conf_get_bool (conf, "UpdateCheckProcesses");
if (!ret)
goto out;
/* check the role */
- role = pk_transaction_priv_get_role (transaction);
+ role = pk_transaction_get_role (transaction);
if (role != PK_ROLE_ENUM_UPDATE_SYSTEM &&
role != PK_ROLE_ENUM_UPDATE_PACKAGES)
goto out;
/* check we can do the action */
- backend = pk_transaction_priv_get_backend (transaction);
+ backend = pk_transaction_get_backend (transaction);
if (!pk_backend_is_implemented (backend,
PK_ROLE_ENUM_GET_FILES)) {
g_debug ("cannot get files");
@@ -177,7 +177,7 @@ pk_transaction_plugin_finished_results (PkTransaction *transaction)
G_CALLBACK (pk_plugin_files_cb), NULL);
/* get results */
- results = pk_transaction_priv_get_results (transaction);
+ results = pk_transaction_get_results (transaction);
array = pk_results_get_package_array (results);
/* filter on UPDATING */
diff --git a/src/pk-plugin-update-package-list.c b/src/pk-plugin-update-package-list.c
index a581f01..becfc20 100644
--- a/src/pk-plugin-update-package-list.c
+++ b/src/pk-plugin-update-package-list.c
@@ -143,18 +143,18 @@ pk_transaction_plugin_finished_end (PkTransaction *transaction)
PkRoleEnum role;
/* check the config file */
- conf = pk_transaction_priv_get_conf (transaction);
+ conf = pk_transaction_get_conf (transaction);
ret = pk_conf_get_bool (conf, "UpdatePackageList");
if (!ret)
goto out;
/* check the role */
- role = pk_transaction_priv_get_role (transaction);
+ role = pk_transaction_get_role (transaction);
if (role != PK_ROLE_ENUM_REFRESH_CACHE)
goto out;
/* check we can do the action */
- backend = pk_transaction_priv_get_backend (transaction);
+ backend = pk_transaction_get_backend (transaction);
if (!pk_backend_is_implemented (backend,
PK_ROLE_ENUM_GET_PACKAGES)) {
g_debug ("cannot get packages");
@@ -162,7 +162,7 @@ pk_transaction_plugin_finished_end (PkTransaction *transaction)
}
/* connect to backend */
- backend = pk_transaction_priv_get_backend (transaction);
+ backend = pk_transaction_get_backend (transaction);
finished_id = g_signal_connect (backend, "finished",
G_CALLBACK (pk_plugin_finished_cb), NULL);
package_id = g_signal_connect (backend, "package",
diff --git a/src/pk-self-test.c b/src/pk-self-test.c
index 7310937..26743d0 100644
--- a/src/pk-self-test.c
+++ b/src/pk-self-test.c
@@ -36,14 +36,16 @@
#include "pk-lsof.h"
#include "pk-notify.h"
#include "pk-proc.h"
-#include "pk-syslog.h"
#include "pk-spawn.h"
+#include "pk-store.h"
+#include "pk-syslog.h"
#include "pk-time.h"
#include "pk-transaction-db.h"
-#include "pk-transaction-db.h"
#include "pk-transaction.h"
#include "pk-transaction-list.h"
+#define PK_TRANSACTION_ERROR_INPUT_INVALID 14
+
/** ver:1.0 ***********************************************************/
static GMainLoop *_test_loop = NULL;
static guint _test_loop_timeout_id = 0;
diff --git a/src/pk-transaction-dbus.h b/src/pk-transaction-dbus.h
index fe96294..0610dc6 100644
--- a/src/pk-transaction-dbus.h
+++ b/src/pk-transaction-dbus.h
@@ -156,6 +156,15 @@ void pk_transaction_upgrade_system (PkTransaction *transaction,
const gchar *upgrade_kind_str,
DBusGMethodInvocation *context);
+gboolean pk_transaction_set_sender (PkTransaction *transaction,
+ const gchar *sender);
+gboolean pk_transaction_filter_check (const gchar *filter,
+ GError **error);
+gboolean pk_transaction_strvalidate (const gchar *textr,
+ GError **error);
+gboolean pk_transaction_set_tid (PkTransaction *transaction,
+ const gchar *tid);
+
G_END_DECLS
#endif /* __PK_TRANSACTION_DBUS_H */
diff --git a/src/pk-transaction-list.c b/src/pk-transaction-list.c
index 7e8d914..85706e7 100644
--- a/src/pk-transaction-list.c
+++ b/src/pk-transaction-list.c
@@ -149,7 +149,7 @@ pk_transaction_list_role_present (PkTransactionList *tlist, PkRoleEnum role)
/* we might have recently finished this, but not removed it */
if (pk_transaction_get_state (item->transaction) == PK_TRANSACTION_STATE_FINISHED)
continue;
- role_temp = pk_transaction_priv_get_role (item->transaction);
+ role_temp = pk_transaction_get_role (item->transaction);
if (role_temp == role)
return TRUE;
}
@@ -583,7 +583,7 @@ pk_transaction_list_cancel_background (PkTransactionList *tlist)
continue;
g_debug ("cancelling pending transaction %s",
item->tid);
- pk_transaction_priv_cancel_bg (item->transaction);
+ pk_transaction_cancel_bg (item->transaction);
}
/* cancel any running transactions */
@@ -596,7 +596,7 @@ pk_transaction_list_cancel_background (PkTransactionList *tlist)
continue;
g_debug ("cancelling running background transaction %s",
item->tid);
- pk_transaction_priv_cancel_bg (item->transaction);
+ pk_transaction_cancel_bg (item->transaction);
}
}
@@ -661,7 +661,7 @@ pk_transaction_list_commit (PkTransactionList *tlist, const gchar *tid)
g_debug ("cancelling running background transaction %s "
"and instead running %s",
item_active->tid, item->tid);
- pk_transaction_priv_cancel_bg (item_active->transaction);
+ pk_transaction_cancel_bg (item_active->transaction);
goto out;
}
out:
@@ -747,7 +747,7 @@ pk_transaction_list_get_state (PkTransactionList *tlist)
waiting++;
if (state == PK_TRANSACTION_STATE_NEW)
no_commit++;
- role = pk_transaction_priv_get_role (item->transaction);
+ role = pk_transaction_get_role (item->transaction);
g_string_append_printf (string, "%0i\t%s\t%s\tstate[%s] background[%i]\n", i,
pk_role_enum_to_string (role), item->tid,
pk_transaction_state_to_string (state),
@@ -817,7 +817,7 @@ pk_transaction_list_is_consistent (PkTransactionList *tlist)
waiting++;
if (state == PK_TRANSACTION_STATE_NEW)
no_commit++;
- role = pk_transaction_priv_get_role (item->transaction);
+ role = pk_transaction_get_role (item->transaction);
if (role == PK_ROLE_ENUM_UNKNOWN)
unknown_role++;
}
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 4ca3e58..702034d 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -169,6 +169,32 @@ struct PkTransactionPrivate
};
typedef enum {
+ PK_TRANSACTION_ERROR_DENIED,
+ PK_TRANSACTION_ERROR_NOT_RUNNING,
+ PK_TRANSACTION_ERROR_NO_ROLE,
+ PK_TRANSACTION_ERROR_CANNOT_CANCEL,
+ PK_TRANSACTION_ERROR_NOT_SUPPORTED,
+ PK_TRANSACTION_ERROR_NO_SUCH_TRANSACTION,
+ PK_TRANSACTION_ERROR_NO_SUCH_FILE,
+ PK_TRANSACTION_ERROR_NO_SUCH_DIRECTORY,
+ PK_TRANSACTION_ERROR_TRANSACTION_EXISTS_WITH_ROLE,
+ PK_TRANSACTION_ERROR_REFUSED_BY_POLICY,
+ PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID,
+ PK_TRANSACTION_ERROR_SEARCH_INVALID,
+ PK_TRANSACTION_ERROR_SEARCH_PATH_INVALID,
+ PK_TRANSACTION_ERROR_FILTER_INVALID,
+ PK_TRANSACTION_ERROR_INPUT_INVALID,
+ PK_TRANSACTION_ERROR_INVALID_STATE,
+ PK_TRANSACTION_ERROR_INITIALIZE_FAILED,
+ PK_TRANSACTION_ERROR_COMMIT_FAILED,
+ PK_TRANSACTION_ERROR_INVALID_PROVIDE,
+ PK_TRANSACTION_ERROR_PACK_INVALID,
+ PK_TRANSACTION_ERROR_MIME_TYPE_NOT_SUPPORTED,
+ PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
+ PK_TRANSACTION_ERROR_LAST
+} PkTransactionError;
+
+typedef enum {
PK_TRANSACTION_PLUGIN_PHASE_INIT, /* plugin started */
PK_TRANSACTION_PLUGIN_PHASE_RUN, /* only this running */
PK_TRANSACTION_PLUGIN_PHASE_STARTED, /* all signals connected */
@@ -921,55 +947,55 @@ pk_transaction_plugin_phase (PkTransaction *transaction,
}
/**
- * pk_transaction_priv_get_conf:
+ * pk_transaction_get_conf:
**/
PkConf *
-pk_transaction_priv_get_conf (PkTransaction *transaction)
+pk_transaction_get_conf (PkTransaction *transaction)
{
return transaction->priv->conf;
}
/**
- * pk_transaction_priv_get_backend:
+ * pk_transaction_get_backend:
**/
PkBackend *
-pk_transaction_priv_get_backend (PkTransaction *transaction)
+pk_transaction_get_backend (PkTransaction *transaction)
{
return transaction->priv->backend;
}
/**
- * pk_transaction_priv_get_results:
+ * pk_transaction_get_results:
**/
PkResults *
-pk_transaction_priv_get_results (PkTransaction *transaction)
+pk_transaction_get_results (PkTransaction *transaction)
{
return transaction->priv->results;
}
/**
- * pk_transaction_priv_get_package_ids:
+ * pk_transaction_get_package_ids:
**/
gchar **
-pk_transaction_priv_get_package_ids (PkTransaction *transaction)
+pk_transaction_get_package_ids (PkTransaction *transaction)
{
return transaction->priv->cached_package_ids;
}
/**
- * pk_transaction_priv_get_values:
+ * pk_transaction_get_values:
**/
gchar **
-pk_transaction_priv_get_values (PkTransaction *transaction)
+pk_transaction_get_values (PkTransaction *transaction)
{
return transaction->priv->cached_values;
}
/**
- * pk_transaction_priv_get_files:
+ * pk_transaction_get_full_paths:
**/
gchar **
-pk_transaction_priv_get_files (PkTransaction *transaction)
+pk_transaction_get_full_paths (PkTransaction *transaction)
{
return transaction->priv->cached_full_paths;
}
@@ -1717,10 +1743,10 @@ pk_transaction_speed_cb (GObject *object, GParamSpec *pspec, PkTransaction *tran
}
/**
- * pk_transaction_set_running:
+ * pk_transaction_run:
*/
-G_GNUC_WARN_UNUSED_RESULT static gboolean
-pk_transaction_set_running (PkTransaction *transaction)
+gboolean
+pk_transaction_run (PkTransaction *transaction)
{
gboolean ret;
guint i;
@@ -1967,20 +1993,6 @@ out:
}
/**
- * pk_transaction_run:
- */
-gboolean
-pk_transaction_run (PkTransaction *transaction)
-{
- gboolean ret;
- g_return_val_if_fail (PK_IS_TRANSACTION (transaction), FALSE);
- g_return_val_if_fail (transaction->priv->tid != NULL, FALSE);
-
- ret = pk_transaction_set_running (transaction);
- return ret;
-}
-
-/**
* pk_transaction_get_tid:
*/
const gchar *
@@ -2582,10 +2594,10 @@ pk_transaction_obtain_authorization (PkTransaction *transaction, gboolean only_t
#endif
/**
- * pk_transaction_priv_get_role:
+ * pk_transaction_get_role:
**/
PkRoleEnum
-pk_transaction_priv_get_role (PkTransaction *transaction)
+pk_transaction_get_role (PkTransaction *transaction)
{
g_return_val_if_fail (PK_IS_TRANSACTION (transaction), FALSE);
return transaction->priv->role;
@@ -2708,10 +2720,10 @@ pk_transaction_accept_eula (PkTransaction *transaction, const gchar *eula_id, DB
}
/**
- * pk_transaction_priv_cancel_bg:
+ * pk_transaction_cancel_bg:
**/
void
-pk_transaction_priv_cancel_bg (PkTransaction *transaction)
+pk_transaction_cancel_bg (PkTransaction *transaction)
{
g_debug ("CancelBg method called on %s", transaction->priv->tid);
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index d480c1a..be0659f 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -54,33 +54,6 @@ typedef struct
GObjectClass parent_class;
} PkTransactionClass;
-typedef enum
-{
- PK_TRANSACTION_ERROR_DENIED,
- PK_TRANSACTION_ERROR_NOT_RUNNING,
- PK_TRANSACTION_ERROR_NO_ROLE,
- PK_TRANSACTION_ERROR_CANNOT_CANCEL,
- PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- PK_TRANSACTION_ERROR_NO_SUCH_TRANSACTION,
- PK_TRANSACTION_ERROR_NO_SUCH_FILE,
- PK_TRANSACTION_ERROR_NO_SUCH_DIRECTORY,
- PK_TRANSACTION_ERROR_TRANSACTION_EXISTS_WITH_ROLE,
- PK_TRANSACTION_ERROR_REFUSED_BY_POLICY,
- PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID,
- PK_TRANSACTION_ERROR_SEARCH_INVALID,
- PK_TRANSACTION_ERROR_SEARCH_PATH_INVALID,
- PK_TRANSACTION_ERROR_FILTER_INVALID,
- PK_TRANSACTION_ERROR_INPUT_INVALID,
- PK_TRANSACTION_ERROR_INVALID_STATE,
- PK_TRANSACTION_ERROR_INITIALIZE_FAILED,
- PK_TRANSACTION_ERROR_COMMIT_FAILED,
- PK_TRANSACTION_ERROR_INVALID_PROVIDE,
- PK_TRANSACTION_ERROR_PACK_INVALID,
- PK_TRANSACTION_ERROR_MIME_TYPE_NOT_SUPPORTED,
- PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID,
- PK_TRANSACTION_ERROR_LAST
-} PkTransactionError;
-
/* these have to be kept in order */
typedef enum {
PK_TRANSACTION_STATE_NEW,
@@ -98,41 +71,28 @@ GType pk_transaction_get_type (void);
PkTransaction *pk_transaction_new (void);
/* go go go! */
-gboolean pk_transaction_run (PkTransaction *transaction)
+gboolean pk_transaction_run (PkTransaction *transaction)
G_GNUC_WARN_UNUSED_RESULT;
/* internal status */
-void pk_transaction_priv_cancel_bg (PkTransaction *transaction);
-PkRoleEnum pk_transaction_priv_get_role (PkTransaction *transaction);
-PkConf *pk_transaction_priv_get_conf (PkTransaction *transaction);
-PkBackend *pk_transaction_priv_get_backend (PkTransaction *transaction);
-PkResults *pk_transaction_priv_get_results (PkTransaction *transaction);
-gchar **pk_transaction_priv_get_package_ids (PkTransaction *transaction);
-gchar **pk_transaction_priv_get_values (PkTransaction *transaction);
-gchar **pk_transaction_priv_get_files (PkTransaction *transaction);
+void pk_transaction_cancel_bg (PkTransaction *transaction);
+PkRoleEnum pk_transaction_get_role (PkTransaction *transaction);
+PkConf *pk_transaction_get_conf (PkTransaction *transaction);
+PkBackend *pk_transaction_get_backend (PkTransaction *transaction);
+PkResults *pk_transaction_get_results (PkTransaction *transaction);
+gchar **pk_transaction_get_package_ids (PkTransaction *transaction);
+gchar **pk_transaction_get_values (PkTransaction *transaction);
+gchar **pk_transaction_get_full_paths (PkTransaction *transaction);
PkTransactionState pk_transaction_get_state (PkTransaction *transaction);
gboolean pk_transaction_set_state (PkTransaction *transaction,
PkTransactionState state);
const gchar *pk_transaction_state_to_string (PkTransactionState state);
-
-/* set and retrieve tid */
const gchar *pk_transaction_get_tid (PkTransaction *transaction);
-gboolean pk_transaction_set_tid (PkTransaction *transaction,
- const gchar *tid);
-
-/* set DBUS sender */
-gboolean pk_transaction_set_sender (PkTransaction *transaction,
- const gchar *sender);
-gboolean pk_transaction_filter_check (const gchar *filter,
- GError **error);
-gboolean pk_transaction_strvalidate (const gchar *textr,
- GError **error);
void pk_transaction_add_supported_mime_type (PkTransaction *transaction,
const gchar *mime_type);
/* plugin support */
typedef const gchar *(*PkTransactionPluginGetDescFunc) (void);
typedef void (*PkTransactionPluginFunc) (PkTransaction *transaction);
-
const gchar *pk_transaction_plugin_get_description (void);
void pk_transaction_plugin_initialize (PkTransaction *transaction);
void pk_transaction_plugin_destroy (PkTransaction *transaction);
commit 09943505d10b337405d6fafb40caad74f6830805
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jul 11 11:04:37 2011 +0100
trivial: split out the DBus method prototypes into a new header, we don't need to export those
diff --git a/src/Makefile.am b/src/Makefile.am
index 5203f90..3eddec7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -62,6 +62,7 @@ shared_SOURCES = \
pk-dbus.h \
pk-transaction.c \
pk-transaction.h \
+ pk-transaction-dbus.h \
pk-backend.c \
pk-backend.h \
pk-network.c \
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 4aedd8c..6017364 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -52,6 +52,7 @@
#include "pk-backend.h"
#include "pk-engine.h"
#include "pk-transaction.h"
+#include "pk-transaction-dbus.h"
#include "pk-transaction-db.h"
#include "pk-transaction-list.h"
#include "pk-inhibit.h"
diff --git a/src/pk-transaction-dbus.h b/src/pk-transaction-dbus.h
new file mode 100644
index 0000000..fe96294
--- /dev/null
+++ b/src/pk-transaction-dbus.h
@@ -0,0 +1,161 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008-2010 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __PK_TRANSACTION_DBUS_H
+#define __PK_TRANSACTION_DBUS_H
+
+#include "pk-transaction.h"
+
+G_BEGIN_DECLS
+
+void pk_transaction_accept_eula (PkTransaction *transaction,
+ const gchar *eula_id,
+ DBusGMethodInvocation *context);
+void pk_transaction_cancel (PkTransaction *transaction,
+ DBusGMethodInvocation *context);
+void pk_transaction_download_packages (PkTransaction *transaction,
+ gboolean copy_files,
+ gchar **package_ids,
+ DBusGMethodInvocation *context);
+void pk_transaction_get_categories (PkTransaction *transaction,
+ DBusGMethodInvocation *context);
+void pk_transaction_get_depends (PkTransaction *transaction,
+ const gchar *filter,
+ gchar **package_ids,
+ gboolean recursive,
+ DBusGMethodInvocation *context);
+void pk_transaction_get_details (PkTransaction *transaction,
+ gchar **package_ids,
+ DBusGMethodInvocation *context);
+void pk_transaction_get_distro_upgrades (PkTransaction *transaction,
+ DBusGMethodInvocation *context);
+void pk_transaction_get_files (PkTransaction *transaction,
+ gchar **package_ids,
+ DBusGMethodInvocation *context);
+gboolean pk_transaction_get_old_transactions (PkTransaction *transaction,
+ guint number,
+ GError **error);
+void pk_transaction_get_packages (PkTransaction *transaction,
+ const gchar *filter,
+ DBusGMethodInvocation *context);
+void pk_transaction_get_repo_list (PkTransaction *transaction,
+ const gchar *filter,
+ DBusGMethodInvocation *context);
+void pk_transaction_get_requires (PkTransaction *transaction,
+ const gchar *filter,
+ gchar **package_ids,
+ gboolean recursive,
+ DBusGMethodInvocation *context);
+void pk_transaction_get_update_detail (PkTransaction *transaction,
+ gchar **package_ids,
+ DBusGMethodInvocation *context);
+void pk_transaction_get_updates (PkTransaction *transaction,
+ const gchar *filter,
+ DBusGMethodInvocation *context);
+void pk_transaction_install_files (PkTransaction *transaction,
+ gboolean only_trusted,
+ gchar **full_paths,
+ DBusGMethodInvocation *context);
+void pk_transaction_install_packages (PkTransaction *transaction,
+ gboolean only_trusted,
+ gchar **package_ids,
+ DBusGMethodInvocation *context);
+void pk_transaction_install_signature (PkTransaction *transaction,
+ const gchar *sig_type,
+ const gchar *key_id,
+ const gchar *package_id,
+ DBusGMethodInvocation *context);
+void pk_transaction_refresh_cache (PkTransaction *transaction,
+ gboolean force,
+ DBusGMethodInvocation *context);
+void pk_transaction_remove_packages (PkTransaction *transaction,
+ gchar **package_ids,
+ gboolean allow_deps,
+ gboolean autoremove,
+ DBusGMethodInvocation *context);
+void pk_transaction_repo_enable (PkTransaction *transaction,
+ const gchar *repo_id,
+ gboolean enabled,
+ DBusGMethodInvocation *context);
+void pk_transaction_repo_set_data (PkTransaction *transaction,
+ const gchar *repo_id,
+ const gchar *parameter,
+ const gchar *value,
+ DBusGMethodInvocation *context);
+void pk_transaction_resolve (PkTransaction *transaction,
+ const gchar *filter,
+ gchar **packages,
+ DBusGMethodInvocation *context);
+void pk_transaction_rollback (PkTransaction *transaction,
+ const gchar *transaction_id,
+ DBusGMethodInvocation *context);
+void pk_transaction_search_details (PkTransaction *transaction,
+ const gchar *filter,
+ gchar **values,
+ DBusGMethodInvocation *context);
+void pk_transaction_search_files (PkTransaction *transaction,
+ const gchar *filter,
+ gchar **values,
+ DBusGMethodInvocation *context);
+void pk_transaction_search_groups (PkTransaction *transaction,
+ const gchar *filter,
+ gchar **values,
+ DBusGMethodInvocation *context);
+void pk_transaction_search_names (PkTransaction *transaction,
+ const gchar *filter,
+ gchar **values,
+ DBusGMethodInvocation *context);
+void pk_transaction_set_hints (PkTransaction *transaction,
+ gchar **hints,
+ DBusGMethodInvocation *context);
+void pk_transaction_simulate_install_files (PkTransaction *transaction,
+ gchar **full_paths,
+ DBusGMethodInvocation *context);
+void pk_transaction_simulate_install_packages (PkTransaction *transaction,
+ gchar **package_ids,
+ DBusGMethodInvocation *context);
+void pk_transaction_simulate_remove_packages (PkTransaction *transaction,
+ gchar **package_ids,
+ gboolean autoremove,
+ DBusGMethodInvocation *context);
+void pk_transaction_simulate_update_packages (PkTransaction *transaction,
+ gchar **package_ids,
+ DBusGMethodInvocation *context);
+void pk_transaction_update_packages (PkTransaction *transaction,
+ gboolean only_trusted,
+ gchar **package_ids,
+ DBusGMethodInvocation *context);
+void pk_transaction_update_system (PkTransaction *transaction,
+ gboolean only_trusted,
+ DBusGMethodInvocation *context);
+void pk_transaction_what_provides (PkTransaction *transaction,
+ const gchar *filter,
+ const gchar *type,
+ gchar **values,
+ DBusGMethodInvocation *context);
+void pk_transaction_upgrade_system (PkTransaction *transaction,
+ const gchar *distro_id,
+ const gchar *upgrade_kind_str,
+ DBusGMethodInvocation *context);
+
+G_END_DECLS
+
+#endif /* __PK_TRANSACTION_DBUS_H */
diff --git a/src/pk-transaction-list.c b/src/pk-transaction-list.c
index f810911..7e8d914 100644
--- a/src/pk-transaction-list.c
+++ b/src/pk-transaction-list.c
@@ -42,6 +42,7 @@
#include "egg-string.h"
#include "pk-conf.h"
+#include "pk-transaction-dbus.h"
#include "pk-transaction-list.h"
#include "org.freedesktop.PackageKit.Transaction.h"
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 859bb00..4ca3e58 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -55,6 +55,7 @@
#include "egg-dbus-monitor.h"
#include "pk-transaction.h"
+#include "pk-transaction-dbus.h"
#include "pk-transaction-list.h"
#include "pk-transaction-db.h"
#include "pk-marshal.h"
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index 6c08408..d480c1a 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2008-2010 Richard Hughes <richard at hughsie.com>
+ * Copyright (C) 2008-2011 Richard Hughes <richard at hughsie.com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -122,137 +122,6 @@ gboolean pk_transaction_set_tid (PkTransaction *transaction,
/* set DBUS sender */
gboolean pk_transaction_set_sender (PkTransaction *transaction,
const gchar *sender);
-
-/* dbus methods */
-void pk_transaction_accept_eula (PkTransaction *transaction,
- const gchar *eula_id,
- DBusGMethodInvocation *context);
-void pk_transaction_cancel (PkTransaction *transaction,
- DBusGMethodInvocation *context);
-void pk_transaction_download_packages (PkTransaction *transaction,
- gboolean copy_files,
- gchar **package_ids,
- DBusGMethodInvocation *context);
-void pk_transaction_get_categories (PkTransaction *transaction,
- DBusGMethodInvocation *context);
-void pk_transaction_get_depends (PkTransaction *transaction,
- const gchar *filter,
- gchar **package_ids,
- gboolean recursive,
- DBusGMethodInvocation *context);
-void pk_transaction_get_details (PkTransaction *transaction,
- gchar **package_ids,
- DBusGMethodInvocation *context);
-void pk_transaction_get_distro_upgrades (PkTransaction *transaction,
- DBusGMethodInvocation *context);
-void pk_transaction_get_files (PkTransaction *transaction,
- gchar **package_ids,
- DBusGMethodInvocation *context);
-gboolean pk_transaction_get_old_transactions (PkTransaction *transaction,
- guint number,
- GError **error);
-void pk_transaction_get_packages (PkTransaction *transaction,
- const gchar *filter,
- DBusGMethodInvocation *context);
-void pk_transaction_get_repo_list (PkTransaction *transaction,
- const gchar *filter,
- DBusGMethodInvocation *context);
-void pk_transaction_get_requires (PkTransaction *transaction,
- const gchar *filter,
- gchar **package_ids,
- gboolean recursive,
- DBusGMethodInvocation *context);
-void pk_transaction_get_update_detail (PkTransaction *transaction,
- gchar **package_ids,
- DBusGMethodInvocation *context);
-void pk_transaction_get_updates (PkTransaction *transaction,
- const gchar *filter,
- DBusGMethodInvocation *context);
-void pk_transaction_install_files (PkTransaction *transaction,
- gboolean only_trusted,
- gchar **full_paths,
- DBusGMethodInvocation *context);
-void pk_transaction_install_packages (PkTransaction *transaction,
- gboolean only_trusted,
- gchar **package_ids,
- DBusGMethodInvocation *context);
-void pk_transaction_install_signature (PkTransaction *transaction,
- const gchar *sig_type,
- const gchar *key_id,
- const gchar *package_id,
- DBusGMethodInvocation *context);
-void pk_transaction_refresh_cache (PkTransaction *transaction,
- gboolean force,
- DBusGMethodInvocation *context);
-void pk_transaction_remove_packages (PkTransaction *transaction,
- gchar **package_ids,
- gboolean allow_deps,
- gboolean autoremove,
- DBusGMethodInvocation *context);
-void pk_transaction_repo_enable (PkTransaction *transaction,
- const gchar *repo_id,
- gboolean enabled,
- DBusGMethodInvocation *context);
-void pk_transaction_repo_set_data (PkTransaction *transaction,
- const gchar *repo_id,
- const gchar *parameter,
- const gchar *value,
- DBusGMethodInvocation *context);
-void pk_transaction_resolve (PkTransaction *transaction,
- const gchar *filter,
- gchar **packages,
- DBusGMethodInvocation *context);
-void pk_transaction_rollback (PkTransaction *transaction,
- const gchar *transaction_id,
- DBusGMethodInvocation *context);
-void pk_transaction_search_details (PkTransaction *transaction,
- const gchar *filter,
- gchar **values,
- DBusGMethodInvocation *context);
-void pk_transaction_search_files (PkTransaction *transaction,
- const gchar *filter,
- gchar **values,
- DBusGMethodInvocation *context);
-void pk_transaction_search_groups (PkTransaction *transaction,
- const gchar *filter,
- gchar **values,
- DBusGMethodInvocation *context);
-void pk_transaction_search_names (PkTransaction *transaction,
- const gchar *filter,
- gchar **values,
- DBusGMethodInvocation *context);
-void pk_transaction_set_hints (PkTransaction *transaction,
- gchar **hints,
- DBusGMethodInvocation *context);
-void pk_transaction_simulate_install_files (PkTransaction *transaction,
- gchar **full_paths,
- DBusGMethodInvocation *context);
-void pk_transaction_simulate_install_packages (PkTransaction *transaction,
- gchar **package_ids,
- DBusGMethodInvocation *context);
-void pk_transaction_simulate_remove_packages (PkTransaction *transaction,
- gchar **package_ids,
- gboolean autoremove,
- DBusGMethodInvocation *context);
-void pk_transaction_simulate_update_packages (PkTransaction *transaction,
- gchar **package_ids,
- DBusGMethodInvocation *context);
-void pk_transaction_update_packages (PkTransaction *transaction,
- gboolean only_trusted,
- gchar **package_ids,
- DBusGMethodInvocation *context);
-void pk_transaction_update_system (PkTransaction *transaction,
- gboolean only_trusted,
- DBusGMethodInvocation *context);
-void pk_transaction_what_provides (PkTransaction *transaction,
- const gchar *filter,
- const gchar *type,
- gchar **values,
- DBusGMethodInvocation *context);
-void pk_transaction_upgrade_system (PkTransaction *transaction,
- const gchar *distro_id,
- const gchar *upgrade_kind_str,
- DBusGMethodInvocation *context);
gboolean pk_transaction_filter_check (const gchar *filter,
GError **error);
gboolean pk_transaction_strvalidate (const gchar *textr,
commit 43f3d26fc46eed0b8b4cc1033129ff186439bb7b
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jul 11 10:31:46 2011 +0100
trivial: add two more hooks for plugins to use
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index eee53f4..859bb00 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -956,6 +956,24 @@ pk_transaction_priv_get_package_ids (PkTransaction *transaction)
}
/**
+ * pk_transaction_priv_get_values:
+ **/
+gchar **
+pk_transaction_priv_get_values (PkTransaction *transaction)
+{
+ return transaction->priv->cached_values;
+}
+
+/**
+ * pk_transaction_priv_get_files:
+ **/
+gchar **
+pk_transaction_priv_get_files (PkTransaction *transaction)
+{
+ return transaction->priv->cached_full_paths;
+}
+
+/**
* pk_transaction_finished_cb:
**/
static void
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index a8e1e55..6c08408 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -107,6 +107,8 @@ PkConf *pk_transaction_priv_get_conf (PkTransaction *transaction);
PkBackend *pk_transaction_priv_get_backend (PkTransaction *transaction);
PkResults *pk_transaction_priv_get_results (PkTransaction *transaction);
gchar **pk_transaction_priv_get_package_ids (PkTransaction *transaction);
+gchar **pk_transaction_priv_get_values (PkTransaction *transaction);
+gchar **pk_transaction_priv_get_files (PkTransaction *transaction);
PkTransactionState pk_transaction_get_state (PkTransaction *transaction);
gboolean pk_transaction_set_state (PkTransaction *transaction,
PkTransactionState state);
commit f8612afebb1d74a3abebda4a0f4556c4b9d1a25d
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jul 11 10:23:20 2011 +0100
trivial: Add another transaction phase for plugins to use
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index d8f23c1..eee53f4 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -168,12 +168,13 @@ struct PkTransactionPrivate
};
typedef enum {
- PK_TRANSACTION_PLUGIN_PHASE_INIT,
- PK_TRANSACTION_PLUGIN_PHASE_RUN,
- PK_TRANSACTION_PLUGIN_PHASE_FINISHED_START,
- PK_TRANSACTION_PLUGIN_PHASE_FINISHED_RESULTS,
- PK_TRANSACTION_PLUGIN_PHASE_FINISHED_END,
- PK_TRANSACTION_PLUGIN_PHASE_DESTROY,
+ PK_TRANSACTION_PLUGIN_PHASE_INIT, /* plugin started */
+ PK_TRANSACTION_PLUGIN_PHASE_RUN, /* only this running */
+ PK_TRANSACTION_PLUGIN_PHASE_STARTED, /* all signals connected */
+ PK_TRANSACTION_PLUGIN_PHASE_FINISHED_START, /* finshed with all signals */
+ PK_TRANSACTION_PLUGIN_PHASE_FINISHED_RESULTS, /* finished with some signals */
+ PK_TRANSACTION_PLUGIN_PHASE_FINISHED_END, /* finished with no signals */
+ PK_TRANSACTION_PLUGIN_PHASE_DESTROY, /* plugin finalized */
PK_TRANSACTION_PLUGIN_PHASE_UNKNOWN
} PkTransactionPluginPhase;
@@ -882,6 +883,9 @@ pk_transaction_plugin_phase (PkTransaction *transaction,
case PK_TRANSACTION_PLUGIN_PHASE_RUN:
function = "pk_transaction_plugin_run";
break;
+ case PK_TRANSACTION_PLUGIN_PHASE_STARTED:
+ function = "pk_transaction_plugin_started";
+ break;
case PK_TRANSACTION_PLUGIN_PHASE_FINISHED_START:
function = "pk_transaction_plugin_finished_start";
break;
@@ -1764,7 +1768,9 @@ pk_transaction_set_running (PkTransaction *transaction)
/* set the role */
pk_backend_set_role (priv->backend, priv->role);
- g_debug ("setting role for %s to %s", priv->tid, pk_role_enum_to_string (priv->role));
+ g_debug ("setting role for %s to %s",
+ priv->tid,
+ pk_role_enum_to_string (priv->role));
/* connect up the signals */
priv->signal_allow_cancel =
@@ -1822,6 +1828,19 @@ pk_transaction_set_running (PkTransaction *transaction)
g_signal_connect (priv->backend, "notify::speed",
G_CALLBACK (pk_transaction_speed_cb), transaction);
+ /* run the plugins */
+ pk_transaction_plugin_phase (transaction,
+ PK_TRANSACTION_PLUGIN_PHASE_STARTED);
+
+ /* is an error code set? */
+ if (pk_backend_get_is_error_set (priv->backend)) {
+ pk_transaction_finished_emit (transaction, PK_EXIT_ENUM_FAILED, 0);
+
+ /* do not fail the tranaction */
+ ret = TRUE;
+ goto out;
+ }
+
/* mark running */
priv->allow_cancel = FALSE;
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index 27333e4..a8e1e55 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -266,6 +266,7 @@ const gchar *pk_transaction_plugin_get_description (void);
void pk_transaction_plugin_initialize (PkTransaction *transaction);
void pk_transaction_plugin_destroy (PkTransaction *transaction);
void pk_transaction_plugin_run (PkTransaction *transaction);
+void pk_transaction_plugin_started (PkTransaction *transaction);
void pk_transaction_plugin_finished_start (PkTransaction *transaction);
void pk_transaction_plugin_finished_results (PkTransaction *transaction);
void pk_transaction_plugin_finished_end (PkTransaction *transaction);
commit a9e6f745e69e82d1e5f1b846a9d93f7dbb460992
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jul 11 10:18:32 2011 +0100
trivial: don't use egg_strtoint() in plugins, just use g_ascii_strtoull() directly
diff --git a/src/pk-plugin-check-shared-libraries-in-use.c b/src/pk-plugin-check-shared-libraries-in-use.c
index c503dca..d596121 100644
--- a/src/pk-plugin-check-shared-libraries-in-use.c
+++ b/src/pk-plugin-check-shared-libraries-in-use.c
@@ -205,23 +205,34 @@ static gint
pk_plugin_get_uid (PkTransaction *transaction, guint pid)
{
gboolean ret;
- gint uid = -1;
+ gchar *endptr = NULL;
gchar *filename = NULL;
- gchar *uid_text = NULL;
+ gchar *text = NULL;
+ guint64 value_raw;
+ gint uid = -1;
/* get command line from proc */
filename = g_strdup_printf ("/proc/%i/loginuid", pid);
- ret = g_file_get_contents (filename, &uid_text, NULL, NULL);
+ ret = g_file_get_contents (filename, &text, NULL, NULL);
if (!ret)
goto out;
- /* convert from text */
- ret = egg_strtoint (uid_text, &uid);
- if (!ret)
+ /* parse */
+ value_raw = g_ascii_strtoull (text, &endptr, 10);
+
+ /* parsing error */
+ if (endptr == text)
goto out;
+
+ /* out of range */
+ if (value_raw > G_MAXUINT)
+ goto out;
+
+ /* cast back down to value */
+ uid = (gint) value_raw;
out:
g_free (filename);
- g_free (uid_text);
+ g_free (text);
return uid;
}
commit 8ea3dcda5543af119ccf32dc80cf65633cb78ad7
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Jul 10 19:32:46 2011 +0100
Install a pkgconfig file so external projects can build plugins
diff --git a/configure.ac b/configure.ac
index 37aab7e..ce6e3e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -839,6 +839,7 @@ lib/python/Makefile
lib/python/packagekit/Makefile
policy/Makefile
src/Makefile
+src/packagekit-plugin.pc
client/Makefile
tools/Makefile
po/Makefile.in
diff --git a/contrib/PackageKit.spec.in b/contrib/PackageKit.spec.in
index 29ccb36..897034f 100644
--- a/contrib/PackageKit.spec.in
+++ b/contrib/PackageKit.spec.in
@@ -462,6 +462,8 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%dir %{_includedir}/PackageKit
%dir %{_includedir}/PackageKit/backend
%{_includedir}/PackageKit/backend/*.h
+%{_includedir}/PackageKit/plugin
+%{_libdir}/pkgconfig/packagekit-plugin.pc
%changelog
* #LONGDATE# Richard Hughes <richard at hughsie.com> #VERSION#-0.#BUILD##ALPHATAG#
diff --git a/src/Makefile.am b/src/Makefile.am
index 424ab78..5203f90 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -36,11 +36,16 @@ INCLUDES = \
$(NULL)
pkbackendincludedir=$(includedir)/PackageKit/backend
-
pkbackendinclude_HEADERS = \
pk-backend.h \
- pk-backend-spawn.h \
- $(NULL)
+ pk-backend-spawn.h
+
+pluginincludedir=$(includedir)/PackageKit/plugin
+plugininclude_HEADERS = \
+ packagekit-plugin.h \
+ pk-backend.h \
+ pk-conf.h \
+ pk-transaction.h
shared_SOURCES = \
egg-string.c \
@@ -150,6 +155,10 @@ BUILT_SOURCES = \
org.freedesktop.PackageKit.Transaction.h \
$(NULL)
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = \
+ packagekit-plugin.pc
+
pk-marshal.c: pk-marshal.list
echo "#include \"pk-marshal.h\"" > $@ && \
glib-genmarshal $< --prefix=pk_marshal --body >> $@
diff --git a/src/packagekit-plugin.h b/src/packagekit-plugin.h
new file mode 100644
index 0000000..b65f30b
--- /dev/null
+++ b/src/packagekit-plugin.h
@@ -0,0 +1,38 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __PACKAGEKIT_PLUGIN_H__
+#define __PACKAGEKIT_PLUGIN_H__
+
+#ifndef I_KNOW_THE_PACKAGEKIT_PLUGIN_API_IS_SUBJECT_TO_CHANGE
+#error You have to define I_KNOW_THE_PACKAGEKIT_PLUGIN_API_IS_SUBJECT_TO_CHANGE
+#endif
+
+#include <packagekit-glib2/packagekit.h>
+
+#define __PACKAGEKIT_H_INSIDE__
+#include <plugin/pk-backend.h>
+#include <plugin/pk-transaction.h>
+
+#undef __PACKAGEKIT_H_INSIDE__
+
+#endif /* __PACKAGEKIT_PLUGIN_H__ */
+
diff --git a/src/packagekit-plugin.pc.in b/src/packagekit-plugin.pc.in
new file mode 100644
index 0000000..ef91181
--- /dev/null
+++ b/src/packagekit-plugin.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: packagekit-plugin
+Description: PackageKit is a system daemon for installing stuff.
+Version: @VERSION@
+Requires.private: dbus-1, gthread-2.0
+Requires: glib-2.0, gobject-2.0, sqlite3
+Libs: -L${libdir} -lpackagekit-glib2
+Cflags: -I${includedir}/PackageKit
diff --git a/src/pk-backend.h b/src/pk-backend.h
index bf5a8ca..b19ac37 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -34,11 +34,8 @@
#include <packagekit-glib2/pk-package-ids.h>
#include <packagekit-glib2/pk-bitfield.h>
-#include "pk-store.h"
#include "pk-backend.h"
-#include "egg-string.h"
-
G_BEGIN_DECLS
#define PK_TYPE_BACKEND (pk_backend_get_type ())
commit 804e525126fb364ba6ae23eca7469f4cc22b9577
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Jul 10 11:54:11 2011 +0100
trivial: fix make check
diff --git a/src/pk-self-test.c b/src/pk-self-test.c
index 3b04259..7310937 100644
--- a/src/pk-self-test.c
+++ b/src/pk-self-test.c
@@ -41,7 +41,6 @@
#include "pk-time.h"
#include "pk-transaction-db.h"
#include "pk-transaction-db.h"
-#include "pk-transaction-extra.h"
#include "pk-transaction.h"
#include "pk-transaction-list.h"
@@ -1529,17 +1528,6 @@ pk_test_transaction_db_func (void)
g_object_unref (db);
}
-static void
-pk_test_transaction_extra_func (void)
-{
- PkTransactionExtra *extra;
-
- extra = pk_transaction_extra_new ();
- g_assert (extra != NULL);
-
- g_object_unref (extra);
-}
-
static PkTransactionDb *db = NULL;
/**
@@ -1882,7 +1870,6 @@ main (int argc, char **argv)
g_test_add_func ("/packagekit/transaction", pk_test_transaction_func);
g_test_add_func ("/packagekit/transaction-list", pk_test_transaction_list_func);
g_test_add_func ("/packagekit/transaction-db", pk_test_transaction_db_func);
- g_test_add_func ("/packagekit/transaction-extra", pk_test_transaction_extra_func);
/* backend stuff */
g_test_add_func ("/packagekit/backend", pk_test_backend_func);
commit 9e47f5708d017d02e193c5dad8eb242cab3a43c7
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Jul 10 11:49:57 2011 +0100
Allow plugins to add supported content types
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index dc8ee7e..d8f23c1 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -164,6 +164,7 @@ struct PkTransactionPrivate
guint signal_category;
guint signal_speed;
GPtrArray *plugins;
+ GPtrArray *supported_mime_types;
};
typedef enum {
@@ -3732,27 +3733,22 @@ out:
* pk_transaction_is_supported_content_type:
**/
static gboolean
-pk_transaction_is_supported_content_type (PkTransaction *transaction, const gchar *content_type)
+pk_transaction_is_supported_content_type (PkTransaction *transaction,
+ const gchar *content_type)
{
- guint i;
+ const gchar *mime_type_tmp;
gboolean ret = FALSE;
- gchar *mime_types_str;
- gchar **mime_types;
-
- /* get list of mime types supported by backends */
- mime_types_str = pk_backend_get_mime_types (transaction->priv->backend);
- mime_types = g_strsplit (mime_types_str, ";", -1);
+ GPtrArray *array = transaction->priv->supported_mime_types;
+ guint i;
/* can we support this one? */
- for (i=0; mime_types[i] != NULL; i++) {
- if (g_strcmp0 (mime_types[i], content_type) == 0) {
+ for (i=0; i<array->len; i++) {
+ mime_type_tmp = g_ptr_array_index (array, i);
+ if (g_strcmp0 (mime_type_tmp, content_type) == 0) {
ret = TRUE;
break;
}
}
-
- g_free (mime_types_str);
- g_strfreev (mime_types);
return ret;
}
@@ -5465,6 +5461,42 @@ pk_transaction_upgrade_system (PkTransaction *transaction, const gchar *distro_i
}
/**
+ * pk_transaction_add_supported_mime_type:
+ *
+ * Designed to be used by plugins.
+ **/
+void
+pk_transaction_add_supported_mime_type (PkTransaction *transaction,
+ const gchar *mime_type)
+{
+ g_return_if_fail (PK_IS_TRANSACTION (transaction));
+ g_ptr_array_add (transaction->priv->supported_mime_types,
+ g_strdup (mime_type));
+}
+
+/**
+ * pk_transaction_setup_mime_types:
+ **/
+static void
+pk_transaction_setup_mime_types (PkTransaction *transaction)
+{
+ guint i;
+ gchar *mime_types_str;
+ gchar **mime_types;
+
+ /* get list of mime types supported by backends */
+ mime_types_str = pk_backend_get_mime_types (transaction->priv->backend);
+ mime_types = g_strsplit (mime_types_str, ";", -1);
+ for (i=0; mime_types[i] != NULL; i++) {
+ g_ptr_array_add (transaction->priv->supported_mime_types,
+ g_strdup (mime_types[i]));
+ }
+
+ g_free (mime_types_str);
+ g_strfreev (mime_types);
+}
+
+/**
* pk_transaction_get_property:
**/
static void
@@ -5780,6 +5812,7 @@ pk_transaction_init (PkTransaction *transaction)
transaction->priv->syslog = pk_syslog_new ();
transaction->priv->dbus = pk_dbus_new ();
transaction->priv->results = pk_results_new ();
+ transaction->priv->supported_mime_types = g_ptr_array_new_with_free_func (g_free);
#ifdef USE_SECURITY_POLKIT
#if defined(USE_SECURITY_POLKIT_NEW) && defined(HAVE_POLKIT_AUTHORITY_GET_SYNC)
transaction->priv->authority = polkit_authority_get_sync (NULL, &error);
@@ -5801,6 +5834,9 @@ pk_transaction_init (PkTransaction *transaction)
g_signal_connect (transaction->priv->monitor, "connection-changed",
G_CALLBACK (pk_transaction_caller_active_changed_cb), transaction);
+ /* setup supported mime types */
+ pk_transaction_setup_mime_types (transaction);
+
/* get plugins */
transaction->priv->plugins = g_ptr_array_new_with_free_func ((GDestroyNotify) g_module_close);
pk_transaction_load_plugins (transaction);
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index 4eaf564..27333e4 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -255,6 +255,8 @@ gboolean pk_transaction_filter_check (const gchar *filter,
GError **error);
gboolean pk_transaction_strvalidate (const gchar *textr,
GError **error);
+void pk_transaction_add_supported_mime_type (PkTransaction *transaction,
+ const gchar *mime_type);
/* plugin support */
typedef const gchar *(*PkTransactionPluginGetDescFunc) (void);
commit 5ebf3117590ee8cd6511218dd2cf2e5829e9aa04
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Jul 10 11:38:26 2011 +0100
Call destroy for each plugin when the transaction is destroyed
diff --git a/src/pk-plugin-check-shared-libraries-in-use.c b/src/pk-plugin-check-shared-libraries-in-use.c
index 9668799..c503dca 100644
--- a/src/pk-plugin-check-shared-libraries-in-use.c
+++ b/src/pk-plugin-check-shared-libraries-in-use.c
@@ -63,8 +63,6 @@ pk_transaction_plugin_initialize (PkTransaction *transaction)
priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
priv->files_list = g_ptr_array_new_with_free_func (g_free);
priv->lsof = pk_lsof_new ();
-
- g_debug ("plugin: initialize");
}
/**
@@ -73,7 +71,6 @@ pk_transaction_plugin_initialize (PkTransaction *transaction)
void
pk_transaction_plugin_destroy (PkTransaction *transaction)
{
- g_debug ("plugin: destroy");
g_main_loop_unref (priv->loop);
g_ptr_array_unref (priv->list);
g_object_unref (priv->lsof);
@@ -432,7 +429,6 @@ pk_transaction_plugin_run (PkTransaction *transaction)
}
/* don't emit until we've run the transaction and it's success */
- g_debug ("plugin: run");
pk_backend_set_percentage (backend, 100);
out:
if (backend != NULL) {
diff --git a/src/pk-plugin-example.c b/src/pk-plugin-example.c
index 2bfdee0..0cfbedd 100644
--- a/src/pk-plugin-example.c
+++ b/src/pk-plugin-example.c
@@ -47,8 +47,6 @@ pk_transaction_plugin_initialize (PkTransaction *transaction)
/* create private area */
priv = g_new0 (PluginPrivate, 1);
priv->dummy = 999;
-
- g_debug ("plugin: initialize");
}
/**
@@ -57,7 +55,6 @@ pk_transaction_plugin_initialize (PkTransaction *transaction)
void
pk_transaction_plugin_destroy (PkTransaction *transaction)
{
- g_debug ("plugin: destroy");
g_free (priv);
}
@@ -90,8 +87,6 @@ pk_transaction_plugin_run (PkTransaction *transaction)
g_debug ("cannot get packages");
goto out;
}
-
- g_debug ("plugin: run");
out:
return;
}
@@ -102,7 +97,6 @@ out:
void
pk_transaction_plugin_finished_start (PkTransaction *transaction)
{
- g_debug ("plugin: finished-start");
}
/**
@@ -111,7 +105,6 @@ pk_transaction_plugin_finished_start (PkTransaction *transaction)
void
pk_transaction_plugin_finished_results (PkTransaction *transaction)
{
- g_debug ("plugin: finished-results");
}
/**
@@ -120,5 +113,4 @@ pk_transaction_plugin_finished_results (PkTransaction *transaction)
void
pk_transaction_plugin_finished_end (PkTransaction *transaction)
{
- g_debug ("plugin: finished-end");
}
diff --git a/src/pk-plugin-no-update-process.c b/src/pk-plugin-no-update-process.c
index 82106f2..51617a0 100644
--- a/src/pk-plugin-no-update-process.c
+++ b/src/pk-plugin-no-update-process.c
@@ -81,8 +81,6 @@ pk_transaction_plugin_initialize (PkTransaction *transaction)
/* get the list of processes we should neverupdate when running */
conf = pk_transaction_priv_get_conf (transaction);
priv->no_update_process_list = pk_conf_get_strv (conf, "NoUpdateProcessList");
-
- g_debug ("plugin: initialize");
}
/**
@@ -91,7 +89,6 @@ pk_transaction_plugin_initialize (PkTransaction *transaction)
void
pk_transaction_plugin_destroy (PkTransaction *transaction)
{
- g_debug ("plugin: destroy");
g_main_loop_unref (priv->loop);
g_strfreev (priv->no_update_process_list);
g_ptr_array_unref (priv->files_list);
diff --git a/src/pk-plugin-scan-desktop-files.c b/src/pk-plugin-scan-desktop-files.c
index 133d293..82f7f66 100644
--- a/src/pk-plugin-scan-desktop-files.c
+++ b/src/pk-plugin-scan-desktop-files.c
@@ -135,7 +135,6 @@ pk_transaction_plugin_initialize (PkTransaction *transaction)
/* we don't need to keep syncing */
sqlite3_exec (priv->db, "PRAGMA synchronous=OFF", NULL, NULL, NULL);
- g_debug ("plugin: initialize");
out:
return;
}
@@ -146,7 +145,6 @@ out:
void
pk_transaction_plugin_destroy (PkTransaction *transaction)
{
- g_debug ("plugin: destroy");
g_ptr_array_unref (priv->list);
g_main_loop_unref (priv->loop);
g_hash_table_unref (priv->hash);
@@ -403,7 +401,6 @@ out:
return 0;
}
-
/**
* pk_plugin_get_desktop_files:
**/
@@ -488,8 +485,6 @@ pk_transaction_plugin_finished_end (PkTransaction *transaction)
package_id = g_signal_connect (backend, "package",
G_CALLBACK (pk_plugin_package_cb), NULL);
- g_debug ("plugin: finished-end");
-
/* use a local backend instance */
pk_backend_reset (backend);
pk_backend_set_status (backend,
@@ -547,7 +542,6 @@ out:
}
}
-
/**
* pk_plugin_files_cb:
**/
diff --git a/src/pk-plugin-update-check-processes.c b/src/pk-plugin-update-check-processes.c
index 0df5d8f..5351894 100644
--- a/src/pk-plugin-update-check-processes.c
+++ b/src/pk-plugin-update-check-processes.c
@@ -51,8 +51,6 @@ pk_transaction_plugin_initialize (PkTransaction *transaction)
priv = g_new0 (PluginPrivate, 1);
priv->loop = g_main_loop_new (NULL, FALSE);
priv->proc = pk_proc_new ();
-
- g_debug ("plugin: initialize");
}
/**
@@ -61,7 +59,6 @@ pk_transaction_plugin_initialize (PkTransaction *transaction)
void
pk_transaction_plugin_destroy (PkTransaction *transaction)
{
- g_debug ("plugin: destroy");
g_main_loop_unref (priv->loop);
g_object_unref (priv->proc);
g_free (priv);
@@ -218,7 +215,6 @@ pk_transaction_plugin_finished_results (PkTransaction *transaction)
pk_backend_set_percentage (backend, 100);
- g_debug ("plugin: finished-results");
out:
g_strfreev (package_ids);
if (backend == NULL) {
diff --git a/src/pk-plugin-update-package-list.c b/src/pk-plugin-update-package-list.c
index 1e27575..a581f01 100644
--- a/src/pk-plugin-update-package-list.c
+++ b/src/pk-plugin-update-package-list.c
@@ -79,8 +79,6 @@ pk_transaction_plugin_initialize (PkTransaction *transaction)
priv = g_new0 (PluginPrivate, 1);
priv->loop = g_main_loop_new (NULL, FALSE);
priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
-
- g_debug ("plugin: initialize");
}
/**
@@ -89,13 +87,11 @@ pk_transaction_plugin_initialize (PkTransaction *transaction)
void
pk_transaction_plugin_destroy (PkTransaction *transaction)
{
- g_debug ("plugin: destroy");
g_ptr_array_unref (priv->list);
g_main_loop_unref (priv->loop);
g_free (priv);
}
-
/**
* pk_plugin_package_list_to_string:
**/
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 0a4e613..dc8ee7e 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -172,6 +172,7 @@ typedef enum {
PK_TRANSACTION_PLUGIN_PHASE_FINISHED_START,
PK_TRANSACTION_PLUGIN_PHASE_FINISHED_RESULTS,
PK_TRANSACTION_PLUGIN_PHASE_FINISHED_END,
+ PK_TRANSACTION_PLUGIN_PHASE_DESTROY,
PK_TRANSACTION_PLUGIN_PHASE_UNKNOWN
} PkTransactionPluginPhase;
@@ -889,6 +890,9 @@ pk_transaction_plugin_phase (PkTransaction *transaction,
case PK_TRANSACTION_PLUGIN_PHASE_FINISHED_END:
function = "pk_transaction_plugin_finished_end";
break;
+ case PK_TRANSACTION_PLUGIN_PHASE_DESTROY:
+ function = "pk_transaction_plugin_destroy";
+ break;
default:
break;
}
@@ -5851,6 +5855,10 @@ pk_transaction_finalize (GObject *object)
transaction = PK_TRANSACTION (object);
+ /* run the plugins */
+ pk_transaction_plugin_phase (transaction,
+ PK_TRANSACTION_PLUGIN_PHASE_DESTROY);
+
#ifdef USE_SECURITY_POLKIT
if (transaction->priv->subject != NULL)
g_object_unref (transaction->priv->subject);
commit 5bbb92bb06cd2263da82c5c593d3c199f3eeffed
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Jul 10 11:32:29 2011 +0100
Move the check for libraries in use for security updates functionality to a plugin
diff --git a/src/Makefile.am b/src/Makefile.am
index 6994015..424ab78 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -57,8 +57,6 @@ shared_SOURCES = \
pk-dbus.h \
pk-transaction.c \
pk-transaction.h \
- pk-transaction-extra.c \
- pk-transaction-extra.h \
pk-backend.c \
pk-backend.h \
pk-network.c \
@@ -228,6 +226,7 @@ plugin_LTLIBRARIES = \
libpk_plugin-no-update-process.la \
libpk_plugin-scan-desktop-files.la \
libpk_plugin-update-check-processes.la \
+ libpk_plugin-check-shared-libraries-in-use.la \
libpk-plugin-clear-firmware-requests.la
libpk_plugin_scripts_la_SOURCES = pk-plugin-scripts.c
@@ -260,4 +259,9 @@ libpk_plugin_update_check_processes_la_LIBADD = $(PK_PLUGIN_LIBS)
libpk_plugin_update_check_processes_la_LDFLAGS = -module -avoid-version
libpk_plugin_update_check_processes_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+libpk_plugin_check_shared_libraries_in_use_la_SOURCES = pk-plugin-check-shared-libraries-in-use.c
+libpk_plugin_check_shared_libraries_in_use_la_LIBADD = $(PK_PLUGIN_LIBS)
+libpk_plugin_check_shared_libraries_in_use_la_LDFLAGS = -module -avoid-version
+libpk_plugin_check_shared_libraries_in_use_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+
-include $(top_srcdir)/git.mk
diff --git a/src/pk-plugin-check-shared-libraries-in-use.c b/src/pk-plugin-check-shared-libraries-in-use.c
new file mode 100644
index 0000000..9668799
--- /dev/null
+++ b/src/pk-plugin-check-shared-libraries-in-use.c
@@ -0,0 +1,576 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+#include <gio/gio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <pk-transaction.h>
+
+#include "pk-cache.h"
+#include "pk-lsof.h"
+
+/* for when parsing /etc/login.defs fails */
+#define PK_TRANSACTION_EXTRA_UID_MIN_DEFALT 500
+
+typedef struct {
+ GMainLoop *loop;
+ GPtrArray *list;
+ GPtrArray *pids;
+ GPtrArray *files_list;
+ PkLsof *lsof;
+} PluginPrivate;
+
+static PluginPrivate *priv;
+
+/**
+ * pk_transaction_plugin_get_description:
+ */
+const gchar *
+pk_transaction_plugin_get_description (void)
+{
+ return "checks for any shared libraries in use after a security update";
+}
+
+/**
+ * pk_transaction_plugin_initialize:
+ */
+void
+pk_transaction_plugin_initialize (PkTransaction *transaction)
+{
+ /* create private area */
+ priv = g_new0 (PluginPrivate, 1);
+ priv->loop = g_main_loop_new (NULL, FALSE);
+ priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+ priv->files_list = g_ptr_array_new_with_free_func (g_free);
+ priv->lsof = pk_lsof_new ();
+
+ g_debug ("plugin: initialize");
+}
+
+/**
+ * pk_transaction_plugin_destroy:
+ */
+void
+pk_transaction_plugin_destroy (PkTransaction *transaction)
+{
+ g_debug ("plugin: destroy");
+ g_main_loop_unref (priv->loop);
+ g_ptr_array_unref (priv->list);
+ g_object_unref (priv->lsof);
+ g_ptr_array_unref (priv->files_list);
+ if (priv->pids != NULL)
+ g_ptr_array_free (priv->pids, TRUE);
+ g_free (priv);
+}
+
+/**
+ * pk_plugin_finished_cb:
+ **/
+static void
+pk_plugin_finished_cb (PkBackend *backend,
+ PkExitEnum exit_enum,
+ gpointer user_data)
+{
+ if (!g_main_loop_is_running (priv->loop))
+ return;
+ if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
+ g_warning ("%s failed with exit code: %s",
+ pk_role_enum_to_string (pk_backend_get_role (backend)),
+ pk_exit_enum_to_string (exit_enum));
+ }
+ g_main_loop_quit (priv->loop);
+}
+
+/**
+ * pk_plugin_get_installed_package_for_file:
+ **/
+static PkPackage *
+pk_plugin_get_installed_package_for_file (PkTransaction *transaction,
+ const gchar *filename)
+{
+ PkPackage *package = NULL;
+ gchar **filenames;
+ PkBackend *backend;
+
+ /* use PK to find the correct package */
+ g_ptr_array_set_size (priv->list, 0);
+ backend = pk_transaction_priv_get_backend (transaction);
+ pk_backend_reset (backend);
+ filenames = g_strsplit (filename, "|||", -1);
+ pk_backend_search_files (backend,
+ pk_bitfield_value (PK_FILTER_ENUM_INSTALLED),
+ filenames);
+
+ /* wait for finished */
+ g_main_loop_run (priv->loop);
+
+ /* check that we only matched one package */
+ if (priv->list->len != 1) {
+ g_warning ("not correct size, %i", priv->list->len);
+ goto out;
+ }
+
+ /* get the package */
+ package = g_ptr_array_index (priv->list, 0);
+ if (package == NULL) {
+ g_warning ("cannot get package");
+ goto out;
+ }
+out:
+ g_strfreev (filenames);
+ return package;
+}
+
+/**
+ * pk_plugin_files_cb:
+ **/
+static void
+pk_plugin_files_cb (PkBackend *backend,
+ PkFiles *files,
+ PkTransaction *transaction)
+{
+ guint i;
+ guint len;
+ gchar **filenames = NULL;
+
+ /* get data */
+ g_object_get (files,
+ "files", &filenames,
+ NULL);
+
+ /* check each file to see if it's a system shared library */
+ len = g_strv_length (filenames);
+ for (i=0; i<len; i++) {
+ /* not a system library */
+ if (strstr (filenames[i], "/lib") == NULL)
+ continue;
+
+ /* not a shared object */
+ if (strstr (filenames[i], ".so") == NULL)
+ continue;
+
+ /* add as it matches the criteria */
+ g_debug ("adding filename %s", filenames[i]);
+ g_ptr_array_add (priv->files_list,
+ g_strdup (filenames[i]));
+ }
+ g_strfreev (filenames);
+}
+
+/**
+ * pk_plugin_get_cmdline:
+ **/
+static gchar *
+pk_plugin_get_cmdline (PkTransaction *transaction, guint pid)
+{
+ gboolean ret;
+ gchar *filename = NULL;
+ gchar *cmdline = NULL;
+ GError *error = NULL;
+
+ /* get command line from proc */
+ filename = g_strdup_printf ("/proc/%i/cmdline", pid);
+ ret = g_file_get_contents (filename, &cmdline, NULL, &error);
+ if (!ret) {
+ g_warning ("failed to get cmdline: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+out:
+ g_free (filename);
+ return cmdline;
+}
+
+/**
+ * pk_plugin_get_uid:
+ **/
+static gint
+pk_plugin_get_uid (PkTransaction *transaction, guint pid)
+{
+ gboolean ret;
+ gint uid = -1;
+ gchar *filename = NULL;
+ gchar *uid_text = NULL;
+
+ /* get command line from proc */
+ filename = g_strdup_printf ("/proc/%i/loginuid", pid);
+ ret = g_file_get_contents (filename, &uid_text, NULL, NULL);
+ if (!ret)
+ goto out;
+
+ /* convert from text */
+ ret = egg_strtoint (uid_text, &uid);
+ if (!ret)
+ goto out;
+out:
+ g_free (filename);
+ g_free (uid_text);
+ return uid;
+}
+
+static guint
+pk_plugin_get_uid_min (void)
+{
+ gboolean ret;
+ guint i;
+ gchar *data = NULL;
+ gchar **split = NULL;
+ GError *error = NULL;
+ guint uid_min = G_MAXUINT;
+
+ /* get contents */
+ ret = g_file_get_contents ("/etc/login.defs", &data, NULL, &error);
+ if (!ret) {
+ g_warning ("failed to get login UID_MIN: %s",
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+ split = g_strsplit (data, "\n", -1);
+ for (i = 0; split[i] != NULL; i++) {
+ if (!g_str_has_prefix (split[i], "UID_MIN"))
+ continue;
+ uid_min = atoi (g_strchug (split[i]+7));
+ break;
+ }
+out:
+ g_free (data);
+ g_strfreev (split);
+ return uid_min;
+}
+
+/**
+ * pk_transaction_plugin_run:
+ *
+ * This function does the following things:
+ * 1) Refreshes the list of open files
+ * 2) Gets the list of library files from the security updates
+ * 3) Gets a list of pids that are using the libraries
+ * 4) The list of pids are converted to a list of files
+ * 5) The list of files is converted to a list of packages
+ * 6) For each package, emit a RequireRestart of the correct type (according to the UID)
+ */
+void
+pk_transaction_plugin_run (PkTransaction *transaction)
+{
+ gboolean ret;
+ gchar **files = NULL;
+ gchar *package_id;
+ gchar **package_ids;
+ gchar **package_ids_security = NULL;
+ GPtrArray *updates = NULL;
+ guint i;
+ guint j = 0;
+ guint length = 0;
+ guint files_id = 0;
+ guint finished_id = 0;
+ PkBackend *backend = NULL;
+ PkConf *conf;
+ PkInfoEnum info;
+ PkPackage *item;
+ PkResults *results;
+ PkRoleEnum role;
+ PkCache *cache = NULL;
+
+ /* check the config file */
+ conf = pk_transaction_priv_get_conf (transaction);
+ ret = pk_conf_get_bool (conf, "CheckSharedLibrariesInUse");
+ if (!ret)
+ goto out;
+
+ /* check the role */
+ role = pk_transaction_priv_get_role (transaction);
+ if (role != PK_ROLE_ENUM_UPDATE_SYSTEM &&
+ role != PK_ROLE_ENUM_UPDATE_PACKAGES &&
+ role != PK_ROLE_ENUM_INSTALL_PACKAGES)
+ goto out;
+
+ /* check we can do the action */
+ backend = pk_transaction_priv_get_backend (transaction);
+ if (!pk_backend_is_implemented (backend,
+ PK_ROLE_ENUM_GET_FILES)) {
+ g_debug ("cannot get files");
+ goto out;
+ }
+ files_id = g_signal_connect (backend, "files",
+ G_CALLBACK (pk_plugin_files_cb), NULL);
+ finished_id = g_signal_connect (backend, "finished",
+ G_CALLBACK (pk_plugin_finished_cb), NULL);
+
+ /* do we have a cache */
+ cache = pk_cache_new ();
+ results = pk_cache_get_results (cache, PK_ROLE_ENUM_GET_UPDATES);
+ if (results == NULL) {
+ g_warning ("no updates cache");
+ goto out;
+ }
+
+ /* find security update packages */
+ updates = pk_results_get_package_array (results);
+ for (i=0; i<updates->len; i++) {
+ item = g_ptr_array_index (updates, i);
+ g_object_get (item,
+ "info", &info,
+ "package-id", &package_id,
+ NULL);
+ if (info == PK_INFO_ENUM_SECURITY) {
+ g_debug ("security update: %s", package_id);
+ length++;
+ }
+ g_free (package_id);
+ }
+
+ /* nothing to scan for */
+ if (length == 0) {
+ g_debug ("no security updates");
+ goto out;
+ }
+
+ /* create list of security packages */
+ package_ids_security = g_new0 (gchar *, length+1);
+ for (i=0; i<updates->len; i++) {
+ item = g_ptr_array_index (updates, i);
+ g_object_get (item,
+ "info", &info,
+ "package-id", &package_id,
+ NULL);
+ if (info == PK_INFO_ENUM_SECURITY)
+ package_ids_security[j++] = g_strdup (package_id);
+ g_free (package_id);
+ }
+
+ /* is a security update we are installing */
+ package_ids = pk_transaction_priv_get_package_ids (transaction);
+ if (role == PK_ROLE_ENUM_INSTALL_PACKAGES) {
+ ret = FALSE;
+
+ /* do any of the packages we are updating match */
+ for (i=0; package_ids_security[i] != NULL; i++) {
+ for (j=0; package_ids[j] != NULL; j++) {
+ if (g_strcmp0 (package_ids_security[i],
+ package_ids[j]) == 0) {
+ ret = TRUE;
+ break;
+ }
+ }
+ }
+
+ /* nothing matched */
+ if (!ret) {
+ g_debug ("not installing a security update package");
+ goto out;
+ }
+ }
+
+ /* reset */
+ g_ptr_array_set_size (priv->files_list, 0);
+
+ if (priv->pids != NULL) {
+ g_ptr_array_free (priv->pids, TRUE);
+ priv->pids = NULL;
+ }
+
+ /* set status */
+ pk_backend_set_status (backend, PK_STATUS_ENUM_SCAN_PROCESS_LIST);
+ pk_backend_set_percentage (backend, 101);
+
+ /* get list from lsof */
+ ret = pk_lsof_refresh (priv->lsof);
+ if (!ret) {
+ g_warning ("failed to refresh");
+ goto out;
+ }
+
+ /* get all the files touched in the packages we just updated */
+ pk_backend_reset (backend);
+ pk_backend_set_status (backend, PK_STATUS_ENUM_CHECK_LIBRARIES);
+ pk_backend_get_files (backend, package_ids_security);
+
+ /* wait for finished */
+ g_main_loop_run (priv->loop);
+
+ /* nothing to do */
+ if (priv->files_list->len == 0) {
+ g_debug ("no files");
+ goto out;
+ }
+
+ /* get the list of PIDs */
+ files = pk_ptr_array_to_strv (priv->files_list);
+ priv->pids = pk_lsof_get_pids_for_filenames (priv->lsof, files);
+
+ /* nothing depends on these libraries */
+ if (priv->pids == NULL) {
+ g_warning ("failed to get process list");
+ goto out;
+ }
+
+ /* nothing depends on these libraries */
+ if (priv->pids->len == 0) {
+ g_debug ("no processes depend on these libraries");
+ goto out;
+ }
+
+ /* don't emit until we've run the transaction and it's success */
+ g_debug ("plugin: run");
+ pk_backend_set_percentage (backend, 100);
+out:
+ if (backend != NULL) {
+ if (files_id > 0)
+ g_signal_handler_disconnect (backend, files_id);
+ if (finished_id > 0)
+ g_signal_handler_disconnect (backend, finished_id);
+ }
+ g_strfreev (files);
+ if (updates != NULL)
+ g_ptr_array_unref (updates);
+ if (cache != NULL)
+ g_object_unref (cache);
+ g_strfreev (package_ids_security);
+}
+
+/**
+ * pk_transaction_plugin_finished_results:
+ */
+void
+pk_transaction_plugin_finished_results (PkTransaction *transaction)
+{
+ gboolean ret;
+ PkBackend *backend = NULL;
+ PkConf *conf;
+ PkRoleEnum role;
+ gint uid;
+ guint i;
+ guint pid;
+ gchar *filename;
+ gchar *cmdline;
+ gchar *cmdline_full;
+ GPtrArray *files_session = NULL;
+ GPtrArray *files_system = NULL;
+ PkPackage *package;
+ GPtrArray *pids;
+ guint uid_min;
+
+ /* check the config file */
+ conf = pk_transaction_priv_get_conf (transaction);
+ ret = pk_conf_get_bool (conf, "CheckSharedLibrariesInUse");
+ if (!ret)
+ goto out;
+
+ /* check the role */
+ role = pk_transaction_priv_get_role (transaction);
+ if (role != PK_ROLE_ENUM_GET_UPDATES)
+ goto out;
+
+ /* check we can do the action */
+ backend = pk_transaction_priv_get_backend (transaction);
+ if (!pk_backend_is_implemented (backend,
+ PK_ROLE_ENUM_GET_PACKAGES)) {
+ g_debug ("cannot get packages");
+ goto out;
+ }
+
+ /* create arrays */
+ files_session = g_ptr_array_new_with_free_func (g_free);
+ files_system = g_ptr_array_new_with_free_func (g_free);
+
+ /* get local array */
+ pids = priv->pids;
+ if (pids == NULL)
+ goto out;
+
+ /* set status */
+ pk_backend_set_status (backend, PK_STATUS_ENUM_CHECK_LIBRARIES);
+
+ /* get user UID range */
+ uid_min = pk_plugin_get_uid_min ();
+ if (uid_min == G_MAXUINT)
+ uid_min = PK_TRANSACTION_EXTRA_UID_MIN_DEFALT;
+
+ /* find the package name of each pid */
+ for (i=0; i<pids->len; i++) {
+ pid = GPOINTER_TO_INT (g_ptr_array_index (pids, i));
+
+ /* get user */
+ uid = pk_plugin_get_uid (transaction, pid);
+ if (uid < 0)
+ continue;
+
+ /* get command line */
+ cmdline = pk_plugin_get_cmdline (transaction, pid);
+ if (cmdline == NULL)
+ continue;
+
+ /* prepend path if it does not already exist */
+ if (cmdline[0] == '/')
+ cmdline_full = g_strdup (cmdline);
+ else
+ cmdline_full = g_strdup_printf ("/usr/bin/%s", cmdline);
+
+ g_debug ("pid=%i: %s (%i)", pid, cmdline_full, uid);
+ if (uid < 500)
+ g_ptr_array_add (files_system, cmdline_full);
+ else
+ g_ptr_array_add (files_session, cmdline_full);
+ g_free (cmdline);
+ }
+
+ /* we found nothing */
+ if (files_system->len == 0 && files_session->len == 0) {
+ g_warning ("no pids could be resolved");
+ goto out;
+ }
+
+ /* process all session restarts */
+ for (i=0; i<files_session->len; i++) {
+ filename = g_ptr_array_index (files_session, i);
+
+ package = pk_plugin_get_installed_package_for_file (transaction,
+ filename);
+ if (package == NULL) {
+ g_debug ("failed to find package for %s", filename);
+ continue;
+ }
+ pk_backend_require_restart (backend,
+ PK_RESTART_ENUM_SECURITY_SESSION,
+ pk_package_get_id (package));
+ }
+
+ /* process all system restarts */
+ for (i=0; i<files_system->len; i++) {
+ filename = g_ptr_array_index (files_system, i);
+
+ package = pk_plugin_get_installed_package_for_file (transaction,
+ filename);
+ if (package == NULL) {
+ g_debug ("failed to find package for %s", filename);
+ continue;
+ }
+ pk_backend_require_restart (backend, PK_RESTART_ENUM_SECURITY_SYSTEM, pk_package_get_id (package));
+ }
+out:
+ if (files_session != NULL)
+ g_ptr_array_free (files_session, TRUE);
+ if (files_system != NULL)
+ g_ptr_array_free (files_system, TRUE);
+}
diff --git a/src/pk-transaction-extra.c b/src/pk-transaction-extra.c
deleted file mode 100644
index e61a3fd..0000000
--- a/src/pk-transaction-extra.c
+++ /dev/null
@@ -1,552 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008-2009 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <packagekit-glib2/pk-enum.h>
-#include <packagekit-glib2/pk-results.h>
-#include <packagekit-glib2/pk-package-id.h>
-#include <packagekit-glib2/pk-desktop.h>
-#include <packagekit-glib2/pk-common.h>
-#include <gio/gdesktopappinfo.h>
-#include <sqlite3.h>
-
-#include "pk-transaction-extra.h"
-#include "pk-shared.h"
-#include "pk-marshal.h"
-#include "pk-backend.h"
-#include "pk-lsof.h"
-#include "pk-conf.h"
-
-/* for when parsing /etc/login.defs fails */
-#define PK_TRANSACTION_EXTRA_UID_MIN_DEFALT 500
-
-#define PK_POST_TRANS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_POST_TRANS, PkTransactionExtraPrivate))
-
-struct PkTransactionExtraPrivate
-{
- PkBackend *backend;
- GMainLoop *loop;
- GPtrArray *list;
- PkLsof *lsof;
- PkConf *conf;
- guint finished_id;
- guint package_id;
- GPtrArray *files_list;
- GPtrArray *pids;
-};
-
-enum {
- PK_POST_TRANS_STATUS_CHANGED,
- PK_POST_TRANS_PROGRESS_CHANGED,
- PK_POST_TRANS_LAST_SIGNAL
-};
-
-static guint signals [PK_POST_TRANS_LAST_SIGNAL] = { 0 };
-G_DEFINE_TYPE (PkTransactionExtra, pk_transaction_extra, G_TYPE_OBJECT)
-
-/**
- * pk_transaction_extra_finished_cb:
- **/
-static void
-pk_transaction_extra_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransactionExtra *extra)
-{
- if (g_main_loop_is_running (extra->priv->loop)) {
- if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
- g_warning ("%s failed with exit code: %s",
- pk_role_enum_to_string (pk_backend_get_role (backend)),
- pk_exit_enum_to_string (exit_enum));
- }
- g_main_loop_quit (extra->priv->loop);
- }
-}
-
-/**
- * pk_transaction_extra_package_cb:
- **/
-static void
-pk_transaction_extra_package_cb (PkBackend *backend, PkPackage *package, PkTransactionExtra *extra)
-{
- g_ptr_array_add (extra->priv->list, g_object_ref (package));
-}
-
-/**
- * pk_transaction_extra_set_status_changed:
- **/
-static void
-pk_transaction_extra_set_status_changed (PkTransactionExtra *extra, PkStatusEnum status)
-{
- g_debug ("emiting status-changed %s", pk_status_enum_to_string (status));
- g_signal_emit (extra, signals [PK_POST_TRANS_STATUS_CHANGED], 0, status);
-}
-
-/**
- * pk_transaction_extra_set_progress_changed:
- **/
-static void
-pk_transaction_extra_set_progress_changed (PkTransactionExtra *extra, guint percentage)
-{
- g_debug ("emiting progress-changed %i", percentage);
- g_signal_emit (extra, signals [PK_POST_TRANS_PROGRESS_CHANGED], 0, percentage, 0, 0, 0);
-}
-
-/**
- * pk_transaction_extra_get_installed_package_for_file:
- **/
-static PkPackage *
-pk_transaction_extra_get_installed_package_for_file (PkTransactionExtra *extra, const gchar *filename)
-{
- PkPackage *package = NULL;
- gchar **filenames;
-
- /* use PK to find the correct package */
- if (extra->priv->list->len > 0)
- g_ptr_array_remove_range (extra->priv->list, 0, extra->priv->list->len);
- pk_backend_reset (extra->priv->backend);
- filenames = g_strsplit (filename, "|||", -1);
- pk_backend_search_files (extra->priv->backend, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), filenames);
- g_strfreev (filenames);
-
- /* wait for finished */
- g_main_loop_run (extra->priv->loop);
-
- /* check that we only matched one package */
- if (extra->priv->list->len != 1) {
- g_warning ("not correct size, %i", extra->priv->list->len);
- goto out;
- }
-
- /* get the package */
- package = g_ptr_array_index (extra->priv->list, 0);
- if (package == NULL) {
- g_warning ("cannot get package");
- goto out;
- }
-out:
- return package;
-}
-
-/**
- * pk_transaction_extra_files_check_library_restart_cb:
- **/
-static void
-pk_transaction_extra_files_check_library_restart_cb (PkBackend *backend, PkFiles *files, PkTransactionExtra *extra)
-{
- guint i;
- guint len;
- gchar **filenames = NULL;
-
- /* get data */
- g_object_get (files,
- "files", &filenames,
- NULL);
-
- /* check each file to see if it's a system shared library */
- len = g_strv_length (filenames);
- for (i=0; i<len; i++) {
- /* not a system library */
- if (strstr (filenames[i], "/lib") == NULL)
- continue;
-
- /* not a shared object */
- if (strstr (filenames[i], ".so") == NULL)
- continue;
-
- /* add as it matches the criteria */
- g_debug ("adding filename %s", filenames[i]);
- g_ptr_array_add (extra->priv->files_list, g_strdup (filenames[i]));
- }
- g_strfreev (filenames);
-}
-
-/**
- * pk_transaction_extra_get_cmdline:
- **/
-static gchar *
-pk_transaction_extra_get_cmdline (PkTransactionExtra *extra, guint pid)
-{
- gboolean ret;
- gchar *filename = NULL;
- gchar *cmdline = NULL;
- GError *error = NULL;
-
- /* get command line from proc */
- filename = g_strdup_printf ("/proc/%i/cmdline", pid);
- ret = g_file_get_contents (filename, &cmdline, NULL, &error);
- if (!ret) {
- g_warning ("failed to get cmdline: %s", error->message);
- g_error_free (error);
- goto out;
- }
-out:
- g_free (filename);
- return cmdline;
-}
-
-/**
- * pk_transaction_extra_get_uid:
- **/
-static gint
-pk_transaction_extra_get_uid (PkTransactionExtra *extra, guint pid)
-{
- gboolean ret;
- gint uid = -1;
- gchar *filename = NULL;
- gchar *uid_text = NULL;
-
- /* get command line from proc */
- filename = g_strdup_printf ("/proc/%i/loginuid", pid);
- ret = g_file_get_contents (filename, &uid_text, NULL, NULL);
- if (!ret)
- goto out;
-
- /* convert from text */
- ret = egg_strtoint (uid_text, &uid);
- if (!ret)
- goto out;
-out:
- g_free (filename);
- g_free (uid_text);
- return uid;
-}
-
-static guint
-pk_transaction_extra_get_uid_min (void)
-{
- gboolean ret;
- guint i;
- gchar *data = NULL;
- gchar **split = NULL;
- GError *error = NULL;
- guint uid_min = G_MAXUINT;
-
- /* get contents */
- ret = g_file_get_contents ("/etc/login.defs", &data, NULL, &error);
- if (!ret) {
- g_warning ("failed to get login UID_MIN: %s",
- error->message);
- g_error_free (error);
- goto out;
- }
- split = g_strsplit (data, "\n", -1);
- for (i = 0; split[i] != NULL; i++) {
- if (!g_str_has_prefix (split[i], "UID_MIN"))
- continue;
- uid_min = atoi (g_strchug (split[i]+7));
- break;
- }
-out:
- g_free (data);
- g_strfreev (split);
- return uid_min;
-}
-
-/**
- * pk_transaction_extra_check_library_restart:
- **/
-gboolean
-pk_transaction_extra_check_library_restart (PkTransactionExtra *extra)
-{
- gint uid;
- guint i;
- guint pid;
- gchar *filename;
- gchar *cmdline;
- gchar *cmdline_full;
- GPtrArray *files_session;
- GPtrArray *files_system;
- PkPackage *package;
- GPtrArray *pids;
- guint uid_min;
-
- g_return_val_if_fail (PK_IS_POST_TRANS (extra), FALSE);
-
- /* create arrays */
- files_session = g_ptr_array_new ();
- files_system = g_ptr_array_new ();
-
- /* get local array */
- pids = extra->priv->pids;
- if (pids == NULL)
- goto out;
-
- /* set status */
- pk_transaction_extra_set_status_changed (extra, PK_STATUS_ENUM_CHECK_LIBRARIES);
-
- /* get user UID range */
- uid_min = pk_transaction_extra_get_uid_min ();
- if (uid_min == G_MAXUINT)
- uid_min = PK_TRANSACTION_EXTRA_UID_MIN_DEFALT;
-
- /* find the package name of each pid */
- for (i=0; i<pids->len; i++) {
- pid = GPOINTER_TO_INT (g_ptr_array_index (pids, i));
-
- /* get user */
- uid = pk_transaction_extra_get_uid (extra, pid);
- if (uid < 0)
- continue;
-
- /* get command line */
- cmdline = pk_transaction_extra_get_cmdline (extra, pid);
- if (cmdline == NULL)
- continue;
-
- /* prepend path if it does not already exist */
- if (cmdline[0] == '/')
- cmdline_full = g_strdup (cmdline);
- else
- cmdline_full = g_strdup_printf ("/usr/bin/%s", cmdline);
-
- g_debug ("pid=%i: %s (%i)", pid, cmdline_full, uid);
- if (uid < 500)
- g_ptr_array_add (files_system, cmdline_full);
- else
- g_ptr_array_add (files_session, cmdline_full);
- g_free (cmdline);
- }
-
- /* we found nothing */
- if (files_system->len == 0 && files_session->len == 0) {
- g_warning ("no pids could be resolved");
- goto out;
- }
-
- /* process all session restarts */
- for (i=0; i<files_session->len; i++) {
- filename = g_ptr_array_index (files_session, i);
-
- package = pk_transaction_extra_get_installed_package_for_file (extra, filename);
- if (package == NULL) {
- g_debug ("failed to find package for %s", filename);
- continue;
- }
- pk_backend_require_restart (extra->priv->backend, PK_RESTART_ENUM_SECURITY_SESSION, pk_package_get_id (package));
- }
-
- /* process all system restarts */
- for (i=0; i<files_system->len; i++) {
- filename = g_ptr_array_index (files_system, i);
-
- package = pk_transaction_extra_get_installed_package_for_file (extra, filename);
- if (package == NULL) {
- g_debug ("failed to find package for %s", filename);
- continue;
- }
- pk_backend_require_restart (extra->priv->backend, PK_RESTART_ENUM_SECURITY_SYSTEM, pk_package_get_id (package));
- }
-
-out:
- g_ptr_array_foreach (files_session, (GFunc) g_free, NULL);
- g_ptr_array_foreach (files_system, (GFunc) g_free, NULL);
- g_ptr_array_free (files_session, TRUE);
- g_ptr_array_free (files_system, TRUE);
- return TRUE;
-}
-
-/**
- * pk_transaction_extra_check_library_restart_pre:
- * @package_ids: the list of security updates
- *
- * This function does the following things:
- * 1) Refreshes the list of open files
- * 2) Gets the list of library files from the security updates
- * 3) Gets a list of pids that are using the libraries
- * 4) The list of pids are converted to a list of files
- * 5) The list of files is converted to a list of packages
- * 6) For each package, emit a RequireRestart of the correct type (according to the UID)
- *
- * Return value: success, so %TRUE means the library check completed okay
- **/
-gboolean
-pk_transaction_extra_check_library_restart_pre (PkTransactionExtra *extra, gchar **package_ids)
-{
- guint signal_files = 0;
- gboolean ret = TRUE;
- gchar **files = NULL;
-
- g_return_val_if_fail (PK_IS_POST_TRANS (extra), FALSE);
-
- if (!pk_backend_is_implemented (extra->priv->backend, PK_ROLE_ENUM_GET_FILES)) {
- g_debug ("cannot get files");
- return FALSE;
- }
-
- /* reset */
- g_ptr_array_set_size (extra->priv->files_list, 0);
-
- if (extra->priv->pids != NULL) {
- g_ptr_array_free (extra->priv->pids, TRUE);
- extra->priv->pids = NULL;
- }
-
- /* set status */
- pk_transaction_extra_set_status_changed (extra, PK_STATUS_ENUM_SCAN_PROCESS_LIST);
- pk_transaction_extra_set_progress_changed (extra, 101);
-
- /* get list from lsof */
- ret = pk_lsof_refresh (extra->priv->lsof);
- if (!ret) {
- g_warning ("failed to refresh");
- goto out;
- }
-
- /* set status */
- pk_transaction_extra_set_status_changed (extra, PK_STATUS_ENUM_CHECK_LIBRARIES);
-
- signal_files = g_signal_connect (extra->priv->backend, "files",
- G_CALLBACK (pk_transaction_extra_files_check_library_restart_cb), extra);
-
- /* get all the files touched in the packages we just updated */
- pk_backend_reset (extra->priv->backend);
- pk_backend_get_files (extra->priv->backend, package_ids);
-
- /* wait for finished */
- g_main_loop_run (extra->priv->loop);
-
- /* nothing to do */
- if (extra->priv->files_list->len == 0) {
- g_debug ("no files");
- goto out;
- }
-
- /* get the list of PIDs */
- files = pk_ptr_array_to_strv (extra->priv->files_list);
- extra->priv->pids = pk_lsof_get_pids_for_filenames (extra->priv->lsof, files);
-
- /* nothing depends on these libraries */
- if (extra->priv->pids == NULL) {
- g_warning ("failed to get process list");
- goto out;
- }
-
- /* nothing depends on these libraries */
- if (extra->priv->pids->len == 0) {
- g_debug ("no processes depend on these libraries");
- goto out;
- }
-
- /* don't emit until we've run the transaction and it's success */
-out:
- pk_transaction_extra_set_progress_changed (extra, 100);
- if (signal_files > 0)
- g_signal_handler_disconnect (extra->priv->backend, signal_files);
- g_strfreev (files);
- return ret;
-}
-
-/**
- * pk_transaction_extra_finalize:
- **/
-static void
-pk_transaction_extra_finalize (GObject *object)
-{
- PkTransactionExtra *extra;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (PK_IS_POST_TRANS (object));
- extra = PK_POST_TRANS (object);
-
- g_signal_handler_disconnect (extra->priv->backend, extra->priv->finished_id);
- g_signal_handler_disconnect (extra->priv->backend, extra->priv->package_id);
-
- if (extra->priv->pids != NULL)
- g_ptr_array_free (extra->priv->pids, TRUE);
- if (g_main_loop_is_running (extra->priv->loop))
- g_main_loop_quit (extra->priv->loop);
- g_main_loop_unref (extra->priv->loop);
- g_ptr_array_unref (extra->priv->files_list);
-
- g_object_unref (extra->priv->backend);
- g_object_unref (extra->priv->lsof);
- g_object_unref (extra->priv->conf);
- g_ptr_array_unref (extra->priv->list);
-
- G_OBJECT_CLASS (pk_transaction_extra_parent_class)->finalize (object);
-}
-
-/**
- * pk_transaction_extra_class_init:
- **/
-static void
-pk_transaction_extra_class_init (PkTransactionExtraClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = pk_transaction_extra_finalize;
- signals [PK_POST_TRANS_STATUS_CHANGED] =
- g_signal_new ("status-changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, g_cclosure_marshal_VOID__UINT,
- G_TYPE_NONE, 1, G_TYPE_UINT);
- signals [PK_POST_TRANS_PROGRESS_CHANGED] =
- g_signal_new ("progress-changed",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__UINT_UINT_UINT_UINT,
- G_TYPE_NONE, 4, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
- g_type_class_add_private (klass, sizeof (PkTransactionExtraPrivate));
-}
-
-/**
- * pk_transaction_extra_init:
- *
- * initializes the extra_trans class. NOTE: We expect extra_trans objects
- * to *NOT* be removed or added during the session.
- * We only control the first extra_trans object if there are more than one.
- **/
-static void
-pk_transaction_extra_init (PkTransactionExtra *extra)
-{
- extra->priv = PK_POST_TRANS_GET_PRIVATE (extra);
- extra->priv->loop = g_main_loop_new (NULL, FALSE);
- extra->priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
- extra->priv->backend = pk_backend_new ();
- extra->priv->lsof = pk_lsof_new ();
- extra->priv->pids = NULL;
- extra->priv->files_list = g_ptr_array_new_with_free_func (g_free);
- extra->priv->conf = pk_conf_new ();
-
- extra->priv->finished_id =
- g_signal_connect (extra->priv->backend, "finished",
- G_CALLBACK (pk_transaction_extra_finished_cb), extra);
- extra->priv->package_id =
- g_signal_connect (extra->priv->backend, "package",
- G_CALLBACK (pk_transaction_extra_package_cb), extra);
-}
-
-/**
- * pk_transaction_extra_new:
- * Return value: A new extra_trans class instance.
- **/
-PkTransactionExtra *
-pk_transaction_extra_new (void)
-{
- PkTransactionExtra *extra;
- extra = g_object_new (PK_TYPE_POST_TRANS, NULL);
- return PK_POST_TRANS (extra);
-}
-
diff --git a/src/pk-transaction-extra.h b/src/pk-transaction-extra.h
deleted file mode 100644
index 79f2c9d..0000000
--- a/src/pk-transaction-extra.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008-2009 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __PK_POST_TRANS_H
-#define __PK_POST_TRANS_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define PK_TYPE_POST_TRANS (pk_transaction_extra_get_type ())
-#define PK_POST_TRANS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_POST_TRANS, PkTransactionExtra))
-#define PK_POST_TRANS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_POST_TRANS, PkTransactionExtraClass))
-#define PK_IS_POST_TRANS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_POST_TRANS))
-#define PK_IS_POST_TRANS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_POST_TRANS))
-#define PK_POST_TRANS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_POST_TRANS, PkTransactionExtraClass))
-
-typedef struct PkTransactionExtraPrivate PkTransactionExtraPrivate;
-
-typedef struct
-{
- GObject parent;
- PkTransactionExtraPrivate *priv;
-} PkTransactionExtra;
-
-typedef struct
-{
- GObjectClass parent_class;
-} PkTransactionExtraClass;
-
-GType pk_transaction_extra_get_type (void);
-PkTransactionExtra *pk_transaction_extra_new (void);
-
-gboolean pk_transaction_extra_check_library_restart (PkTransactionExtra *extra);
-gboolean pk_transaction_extra_check_library_restart_pre (PkTransactionExtra *extra,
- gchar **package_ids);
-
-G_END_DECLS
-
-#endif /* __PK_POST_TRANS_H */
-
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 4e31dd2..0a4e613 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -64,7 +64,6 @@
#include "pk-shared.h"
#include "pk-cache.h"
#include "pk-notify.h"
-#include "pk-transaction-extra.h"
#include "pk-syslog.h"
#include "pk-dbus.h"
@@ -115,7 +114,6 @@ struct PkTransactionPrivate
PolkitSubject *subject;
GCancellable *cancellable;
#endif
- PkTransactionExtra *transaction_extra;
PkSyslog *syslog;
/* needed for gui coldplugging */
@@ -954,7 +952,6 @@ pk_transaction_priv_get_package_ids (PkTransaction *transaction)
static void
pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransaction *transaction)
{
- gboolean ret;
guint time_ms;
gchar *packages;
guint i;
@@ -1008,15 +1005,6 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
pk_transaction_plugin_phase (transaction,
PK_TRANSACTION_PLUGIN_PHASE_FINISHED_RESULTS);
- /* look for library restarts */
- if (exit_enum == PK_EXIT_ENUM_SUCCESS) {
- ret = pk_conf_get_bool (transaction->priv->conf, "CheckSharedLibrariesInUse");
- if (ret) {
- /* now emit what we found ealier */
- pk_transaction_extra_check_library_restart (transaction->priv->transaction_extra);
- }
- }
-
/* signals we are not allowed to send from the second phase post transaction */
g_signal_handler_disconnect (transaction->priv->backend,
transaction->priv->signal_allow_cancel);
@@ -1610,124 +1598,6 @@ pk_transaction_update_detail_cb (PkBackend *backend, PkUpdateDetail *item, PkTra
}
/**
- * pk_transaction_pre_transaction_checks:
- * @package_ids: the list of packages to process
- *
- * This function does any pre-transaction checks before the backend is connected
- */
-static gboolean
-pk_transaction_pre_transaction_checks (PkTransaction *transaction, gchar **package_ids, GError **error)
-{
- GPtrArray *updates = NULL;
- PkPackage *item;
- PkResults *results;
- guint i;
- guint j = 0;
- guint length = 0;
- gboolean ret = FALSE;
- gboolean success = TRUE;
- gchar **package_ids_security = NULL;
- gchar *package_id;
- PkInfoEnum info;
- PkTransactionPrivate *priv = transaction->priv;
-
- /* check we have anything to process */
- if (package_ids == NULL) {
- g_debug ("no package_ids for %s", pk_role_enum_to_string (priv->role));
- goto out;
- }
-
- /* only do this for update actions */
- if (priv->role != PK_ROLE_ENUM_UPDATE_SYSTEM &&
- priv->role != PK_ROLE_ENUM_UPDATE_PACKAGES &&
- priv->role != PK_ROLE_ENUM_INSTALL_PACKAGES) {
- g_debug ("doing nothing, as not update or install");
- goto out;
- }
-
- /* do we want to enable this codepath? */
- ret = pk_conf_get_bool (priv->conf, "CheckSharedLibrariesInUse");
- if (!ret) {
- g_warning ("not checking for library restarts");
- goto out;
- }
-
- /* do we have a cache */
- results = pk_cache_get_results (priv->cache, PK_ROLE_ENUM_GET_UPDATES);
- if (results == NULL) {
- g_warning ("no updates cache");
- goto out;
- }
-
- /* find security update packages */
- updates = pk_results_get_package_array (results);
- for (i=0; i<updates->len; i++) {
- item = g_ptr_array_index (updates, i);
- g_object_get (item,
- "info", &info,
- "package-id", &package_id,
- NULL);
- if (info == PK_INFO_ENUM_SECURITY) {
- g_debug ("security update: %s", package_id);
- length++;
- }
- g_free (package_id);
- }
-
- /* nothing to scan for */
- if (length == 0) {
- g_debug ("no security updates");
- goto out;
- }
-
- /* create list of security packages */
- package_ids_security = g_new0 (gchar *, length+1);
- for (i=0; i<updates->len; i++) {
- item = g_ptr_array_index (updates, i);
- g_object_get (item,
- "info", &info,
- "package-id", &package_id,
- NULL);
- if (info == PK_INFO_ENUM_SECURITY)
- package_ids_security[j++] = g_strdup (package_id);
- g_free (package_id);
- }
-
- /* is a security update we are installing */
- if (priv->role == PK_ROLE_ENUM_INSTALL_PACKAGES) {
- ret = FALSE;
-
- /* do any of the packages we are updating match */
- for (i=0; package_ids_security[i] != NULL; i++) {
- for (j=0; package_ids[j] != NULL; j++) {
- if (g_strcmp0 (package_ids_security[i], package_ids[j]) == 0) {
- ret = TRUE;
- break;
- }
- }
- }
-
- /* nothing matched */
- if (!ret) {
- g_debug ("not installing a security update package");
- goto out;
- }
- }
-
- /* find files in security updates */
- ret = pk_transaction_extra_check_library_restart_pre (priv->transaction_extra, package_ids_security);
- if (!ret) {
- g_debug ("could not check the library list");
- goto out;
- }
-out:
- if (updates != NULL)
- g_ptr_array_unref (updates);
- g_strfreev (package_ids_security);
- return success;
-}
-
-/**
* pk_transaction_set_session_state:
*/
static gboolean
@@ -1861,6 +1731,7 @@ pk_transaction_set_running (PkTransaction *transaction)
/* set proxy */
ret = pk_transaction_set_session_state (transaction, &error);
if (!ret) {
+ ret = TRUE;
g_debug ("failed to set the session state (non-fatal): %s",
error->message);
g_clear_error (&error);
@@ -1883,21 +1754,6 @@ pk_transaction_set_running (PkTransaction *transaction)
goto out;
}
- /* do any pre transaction checks */
- ret = pk_transaction_pre_transaction_checks (transaction, priv->cached_package_ids, &error);
- if (!ret) {
- /* run a fake transaction */
- pk_transaction_status_changed_emit (transaction, PK_STATUS_ENUM_FINISHED);
- pk_transaction_error_code_emit (transaction, PK_ERROR_ENUM_UPDATE_FAILED_DUE_TO_RUNNING_PROCESS, error->message);
- pk_transaction_finished_emit (transaction, PK_EXIT_ENUM_FAILED, 0);
-
- /* do not fail the tranaction */
- ret = TRUE;
-
- g_error_free (error);
- goto out;
- }
-
/* might have to reset again if we used the backend */
pk_backend_reset (priv->backend);
@@ -5933,12 +5789,6 @@ pk_transaction_init (PkTransaction *transaction)
transaction->priv->cancellable = g_cancellable_new ();
#endif
- transaction->priv->transaction_extra = pk_transaction_extra_new ();
- g_signal_connect (transaction->priv->transaction_extra, "status-changed",
- G_CALLBACK (pk_transaction_status_changed_cb), transaction);
- g_signal_connect (transaction->priv->transaction_extra, "progress-changed",
- G_CALLBACK (pk_transaction_progress_changed_cb), transaction);
-
transaction->priv->transaction_db = pk_transaction_db_new ();
g_signal_connect (transaction->priv->transaction_db, "transaction",
G_CALLBACK (pk_transaction_transaction_cb), transaction);
@@ -6031,7 +5881,6 @@ pk_transaction_finalize (GObject *object)
g_object_unref (transaction->priv->transaction_db);
g_object_unref (transaction->priv->notify);
g_object_unref (transaction->priv->syslog);
- g_object_unref (transaction->priv->transaction_extra);
g_object_unref (transaction->priv->results);
#ifdef USE_SECURITY_POLKIT
// g_object_unref (transaction->priv->authority);
commit 3052bce4046cc6e2b77f3473f59d64f4a62bd846
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Jul 10 10:53:22 2011 +0100
Move the update check for running processes into a plugin
diff --git a/src/Makefile.am b/src/Makefile.am
index a278fd9..6994015 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -227,6 +227,7 @@ plugin_LTLIBRARIES = \
libpk_plugin-update-package-list.la \
libpk_plugin-no-update-process.la \
libpk_plugin-scan-desktop-files.la \
+ libpk_plugin-update-check-processes.la \
libpk-plugin-clear-firmware-requests.la
libpk_plugin_scripts_la_SOURCES = pk-plugin-scripts.c
@@ -254,4 +255,9 @@ libpk_plugin_scan_desktop_files_la_LIBADD = $(PK_PLUGIN_LIBS)
libpk_plugin_scan_desktop_files_la_LDFLAGS = -module -avoid-version
libpk_plugin_scan_desktop_files_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+libpk_plugin_update_check_processes_la_SOURCES = pk-plugin-update-check-processes.c
+libpk_plugin_update_check_processes_la_LIBADD = $(PK_PLUGIN_LIBS)
+libpk_plugin_update_check_processes_la_LDFLAGS = -module -avoid-version
+libpk_plugin_update_check_processes_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+
-include $(top_srcdir)/git.mk
diff --git a/src/pk-plugin-update-check-processes.c b/src/pk-plugin-update-check-processes.c
new file mode 100644
index 0000000..0df5d8f
--- /dev/null
+++ b/src/pk-plugin-update-check-processes.c
@@ -0,0 +1,234 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+#include <gio/gio.h>
+#include <pk-transaction.h>
+
+#include "pk-proc.h"
+
+typedef struct {
+ PkProc *proc;
+ GMainLoop *loop;
+} PluginPrivate;
+
+static PluginPrivate *priv;
+
+/**
+ * pk_transaction_plugin_get_description:
+ */
+const gchar *
+pk_transaction_plugin_get_description (void)
+{
+ return "Checks for running processes during update for session restarts";
+}
+
+/**
+ * pk_transaction_plugin_initialize:
+ */
+void
+pk_transaction_plugin_initialize (PkTransaction *transaction)
+{
+ /* create private area */
+ priv = g_new0 (PluginPrivate, 1);
+ priv->loop = g_main_loop_new (NULL, FALSE);
+ priv->proc = pk_proc_new ();
+
+ g_debug ("plugin: initialize");
+}
+
+/**
+ * pk_transaction_plugin_destroy:
+ */
+void
+pk_transaction_plugin_destroy (PkTransaction *transaction)
+{
+ g_debug ("plugin: destroy");
+ g_main_loop_unref (priv->loop);
+ g_object_unref (priv->proc);
+ g_free (priv);
+}
+
+/**
+ * pk_plugin_finished_cb:
+ **/
+static void
+pk_plugin_finished_cb (PkBackend *backend,
+ PkExitEnum exit_enum,
+ gpointer user_data)
+{
+ if (!g_main_loop_is_running (priv->loop))
+ return;
+ if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
+ g_warning ("%s failed with exit code: %s",
+ pk_role_enum_to_string (pk_backend_get_role (backend)),
+ pk_exit_enum_to_string (exit_enum));
+ }
+ g_main_loop_quit (priv->loop);
+}
+
+/**
+ * pk_plugin_files_cb:
+ **/
+static void
+pk_plugin_files_cb (PkBackend *backend,
+ PkFiles *files,
+ PkTransaction *transaction)
+{
+ guint i;
+ guint len;
+ gboolean ret;
+ gchar **filenames = NULL;
+ gchar *package_id = NULL;
+
+ /* get data */
+ g_object_get (files,
+ "package-id", &package_id,
+ "files", &filenames,
+ NULL);
+
+ /* check each file */
+ len = g_strv_length (filenames);
+ for (i=0; i<len; i++) {
+ /* executable? */
+ ret = g_file_test (filenames[i],
+ G_FILE_TEST_IS_REGULAR |
+ G_FILE_TEST_IS_EXECUTABLE |
+ G_FILE_TEST_EXISTS);
+ if (!ret)
+ continue;
+
+ /* running? */
+ ret = pk_proc_find_exec (priv->proc, filenames[i]);
+ if (!ret)
+ continue;
+
+ /* TODO: findout if the executable has a desktop file, and if so,
+ * suggest an application restart instead */
+
+ /* send signal about session restart */
+ g_debug ("package %s updated, and %s is running",
+ package_id, filenames[i]);
+ pk_backend_require_restart (backend,
+ PK_RESTART_ENUM_SESSION,
+ package_id);
+ }
+ g_strfreev (filenames);
+ g_free (package_id);
+}
+
+/**
+ * pk_transaction_plugin_finished_results:
+ */
+void
+pk_transaction_plugin_finished_results (PkTransaction *transaction)
+{
+ gboolean ret;
+ gchar **package_ids = NULL;
+ gchar *package_id_tmp;
+ GPtrArray *array = NULL;
+ GPtrArray *list = NULL;
+ guint files_id = 0;
+ guint finished_id = 0;
+ guint i;
+ PkBackend *backend = NULL;
+ PkConf *conf;
+ PkPackage *item;
+ PkResults *results;
+ PkRoleEnum role;
+
+ /* check the config file */
+ conf = pk_transaction_priv_get_conf (transaction);
+ ret = pk_conf_get_bool (conf, "UpdateCheckProcesses");
+ if (!ret)
+ goto out;
+
+ /* check the role */
+ role = pk_transaction_priv_get_role (transaction);
+ if (role != PK_ROLE_ENUM_UPDATE_SYSTEM &&
+ role != PK_ROLE_ENUM_UPDATE_PACKAGES)
+ goto out;
+
+ /* check we can do the action */
+ backend = pk_transaction_priv_get_backend (transaction);
+ if (!pk_backend_is_implemented (backend,
+ PK_ROLE_ENUM_GET_FILES)) {
+ g_debug ("cannot get files");
+ goto out;
+ }
+ finished_id = g_signal_connect (backend, "finished",
+ G_CALLBACK (pk_plugin_finished_cb), NULL);
+ files_id = g_signal_connect (backend, "files",
+ G_CALLBACK (pk_plugin_files_cb), NULL);
+
+ /* get results */
+ results = pk_transaction_priv_get_results (transaction);
+ array = pk_results_get_package_array (results);
+
+ /* filter on UPDATING */
+ list = g_ptr_array_new_with_free_func (g_free);
+ for (i=0; i<array->len; i++) {
+ item = g_ptr_array_index (array, i);
+ if (pk_package_get_info (item) != PK_INFO_ENUM_UPDATING)
+ continue;
+ /* we convert the package_id data to be 'installed' as this means
+ * we can use the local package database for GetFiles rather than
+ * downloading new remote metadata */
+ package_id_tmp = pk_package_id_build (pk_package_get_name (item),
+ pk_package_get_version (item),
+ pk_package_get_arch (item),
+ "installed");
+ g_ptr_array_add (list, package_id_tmp);
+ }
+
+ /* process file lists on these packages */
+ if (list->len == 0)
+ goto out;
+
+ /* get all the running processes */
+ pk_proc_refresh (priv->proc);
+
+ /* get all the files touched in the packages we just updated */
+ pk_backend_reset (backend);
+ pk_backend_set_status (backend, PK_STATUS_ENUM_CHECK_EXECUTABLE_FILES);
+ pk_backend_set_percentage (backend, 101);
+ package_ids = pk_ptr_array_to_strv (list);
+ pk_backend_get_files (backend, package_ids);
+
+ /* wait for finished */
+ g_main_loop_run (priv->loop);
+
+ pk_backend_set_percentage (backend, 100);
+
+ g_debug ("plugin: finished-results");
+out:
+ g_strfreev (package_ids);
+ if (backend == NULL) {
+ if (files_id > 0)
+ g_signal_handler_disconnect (backend, files_id);
+ if (finished_id > 0)
+ g_signal_handler_disconnect (backend, finished_id);
+ }
+ if (array != NULL)
+ g_ptr_array_unref (array);
+ if (list != NULL)
+ g_ptr_array_unref (list);
+}
diff --git a/src/pk-transaction-extra.c b/src/pk-transaction-extra.c
index 021b668..e61a3fd 100644
--- a/src/pk-transaction-extra.c
+++ b/src/pk-transaction-extra.c
@@ -41,7 +41,6 @@
#include "pk-marshal.h"
#include "pk-backend.h"
#include "pk-lsof.h"
-#include "pk-proc.h"
#include "pk-conf.h"
/* for when parsing /etc/login.defs fails */
@@ -55,7 +54,6 @@ struct PkTransactionExtraPrivate
GMainLoop *loop;
GPtrArray *list;
PkLsof *lsof;
- PkProc *proc;
PkConf *conf;
guint finished_id;
guint package_id;
@@ -154,83 +152,6 @@ out:
}
/**
- * pk_transaction_extra_update_files_check_running_cb:
- **/
-static void
-pk_transaction_extra_update_files_check_running_cb (PkBackend *backend, PkFiles *files, PkTransactionExtra *extra)
-{
- guint i;
- guint len;
- gboolean ret;
- gchar **filenames = NULL;
- gchar *package_id = NULL;
-
- /* get data */
- g_object_get (files,
- "package-id", &package_id,
- "files", &filenames,
- NULL);
-
- /* check each file */
- len = g_strv_length (filenames);
- for (i=0; i<len; i++) {
- /* executable? */
- ret = g_file_test (filenames[i], G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_EXECUTABLE | G_FILE_TEST_EXISTS);
- if (!ret)
- continue;
-
- /* running? */
- ret = pk_proc_find_exec (extra->priv->proc, filenames[i]);
- if (!ret)
- continue;
-
- /* TODO: findout if the executable has a desktop file, and if so,
- * suggest an application restart instead */
-
- /* send signal about session restart */
- g_debug ("package %s updated, and %s is running", package_id, filenames[i]);
- pk_backend_require_restart (extra->priv->backend, PK_RESTART_ENUM_SESSION, package_id);
- }
- g_strfreev (filenames);
- g_free (package_id);
-}
-
-/**
- * pk_transaction_extra_check_running_process:
- **/
-gboolean
-pk_transaction_extra_check_running_process (PkTransactionExtra *extra, gchar **package_ids)
-{
- guint signal_files = 0;
-
- g_return_val_if_fail (PK_IS_POST_TRANS (extra), FALSE);
-
- if (!pk_backend_is_implemented (extra->priv->backend, PK_ROLE_ENUM_GET_FILES)) {
- g_debug ("cannot get files");
- return FALSE;
- }
-
- pk_transaction_extra_set_status_changed (extra, PK_STATUS_ENUM_CHECK_EXECUTABLE_FILES);
- pk_transaction_extra_set_progress_changed (extra, 101);
-
- pk_proc_refresh (extra->priv->proc);
-
- signal_files = g_signal_connect (extra->priv->backend, "files",
- G_CALLBACK (pk_transaction_extra_update_files_check_running_cb), extra);
-
- /* get all the files touched in the packages we just updated */
- pk_backend_reset (extra->priv->backend);
- pk_backend_get_files (extra->priv->backend, package_ids);
-
- /* wait for finished */
- g_main_loop_run (extra->priv->loop);
-
- g_signal_handler_disconnect (extra->priv->backend, signal_files);
- pk_transaction_extra_set_progress_changed (extra, 100);
- return TRUE;
-}
-
-/**
* pk_transaction_extra_files_check_library_restart_cb:
**/
static void
@@ -563,7 +484,6 @@ pk_transaction_extra_finalize (GObject *object)
g_object_unref (extra->priv->backend);
g_object_unref (extra->priv->lsof);
- g_object_unref (extra->priv->proc);
g_object_unref (extra->priv->conf);
g_ptr_array_unref (extra->priv->list);
@@ -606,7 +526,6 @@ pk_transaction_extra_init (PkTransactionExtra *extra)
extra->priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
extra->priv->backend = pk_backend_new ();
extra->priv->lsof = pk_lsof_new ();
- extra->priv->proc = pk_proc_new ();
extra->priv->pids = NULL;
extra->priv->files_list = g_ptr_array_new_with_free_func (g_free);
extra->priv->conf = pk_conf_new ();
diff --git a/src/pk-transaction-extra.h b/src/pk-transaction-extra.h
index 3a56a40..79f2c9d 100644
--- a/src/pk-transaction-extra.h
+++ b/src/pk-transaction-extra.h
@@ -49,8 +49,6 @@ typedef struct
GType pk_transaction_extra_get_type (void);
PkTransactionExtra *pk_transaction_extra_new (void);
-gboolean pk_transaction_extra_check_running_process (PkTransactionExtra *extra,
- gchar **package_ids);
gboolean pk_transaction_extra_check_library_restart (PkTransactionExtra *extra);
gboolean pk_transaction_extra_check_library_restart_pre (PkTransactionExtra *extra,
gchar **package_ids);
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 6d23476..4e31dd2 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -957,14 +957,10 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
gboolean ret;
guint time_ms;
gchar *packages;
- gchar **package_ids;
guint i;
- GPtrArray *list;
GPtrArray *array;
PkPackage *item;
gchar *package_id;
- gchar *package_id_tmp;
- gchar **split;
PkInfoEnum info;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
@@ -1012,51 +1008,6 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
pk_transaction_plugin_phase (transaction,
PK_TRANSACTION_PLUGIN_PHASE_FINISHED_RESULTS);
- /* check for session restarts */
- if (exit_enum == PK_EXIT_ENUM_SUCCESS &&
- (transaction->priv->role == PK_ROLE_ENUM_UPDATE_SYSTEM ||
- transaction->priv->role == PK_ROLE_ENUM_UPDATE_PACKAGES)) {
-
- /* check updated packages file lists and running processes */
- ret = pk_conf_get_bool (transaction->priv->conf, "UpdateCheckProcesses");
- if (ret) {
- /* get results */
- array = pk_results_get_package_array (transaction->priv->results);
-
- /* filter on UPDATING */
- list = g_ptr_array_new_with_free_func (g_free);
- for (i=0; i<array->len; i++) {
- item = g_ptr_array_index (array, i);
- g_object_get (item,
- "info", &info,
- "package-id", &package_id,
- NULL);
- if (info == PK_INFO_ENUM_UPDATING) {
- /* we convert the package_id data to be 'installed' as this means
- * we can use the local package database for GetFiles rather than
- * downloading new remote metadata */
- split = pk_package_id_split (package_id);
- package_id_tmp = pk_package_id_build (split[PK_PACKAGE_ID_NAME],
- split[PK_PACKAGE_ID_VERSION],
- split[PK_PACKAGE_ID_ARCH],
- "installed");
- g_ptr_array_add (list, package_id_tmp);
- g_strfreev (split);
- }
- g_free (package_id);
- }
-
- /* process file lists on these packages */
- if (list->len > 0) {
- package_ids = pk_ptr_array_to_strv (list);
- pk_transaction_extra_check_running_process (transaction->priv->transaction_extra, package_ids);
- g_strfreev (package_ids);
- }
- g_ptr_array_unref (array);
- g_ptr_array_unref (list);
- }
- }
-
/* look for library restarts */
if (exit_enum == PK_EXIT_ENUM_SUCCESS) {
ret = pk_conf_get_bool (transaction->priv->conf, "CheckSharedLibrariesInUse");
commit 889e02dc75b18942e2cdf78f4151fadd1a2ab30d
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Jul 10 10:03:56 2011 +0100
Move the desktop database rescan functionality into a plugin
diff --git a/src/Makefile.am b/src/Makefile.am
index 7b4d179..a278fd9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -226,6 +226,7 @@ plugin_LTLIBRARIES = \
libpk_plugin_scripts.la \
libpk_plugin-update-package-list.la \
libpk_plugin-no-update-process.la \
+ libpk_plugin-scan-desktop-files.la \
libpk-plugin-clear-firmware-requests.la
libpk_plugin_scripts_la_SOURCES = pk-plugin-scripts.c
@@ -248,4 +249,9 @@ libpk_plugin_no_update_process_la_LIBADD = $(PK_PLUGIN_LIBS)
libpk_plugin_no_update_process_la_LDFLAGS = -module -avoid-version
libpk_plugin_no_update_process_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+libpk_plugin_scan_desktop_files_la_SOURCES = pk-plugin-scan-desktop-files.c
+libpk_plugin_scan_desktop_files_la_LIBADD = $(PK_PLUGIN_LIBS)
+libpk_plugin_scan_desktop_files_la_LDFLAGS = -module -avoid-version
+libpk_plugin_scan_desktop_files_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+
-include $(top_srcdir)/git.mk
diff --git a/src/pk-plugin-scan-desktop-files.c b/src/pk-plugin-scan-desktop-files.c
new file mode 100644
index 0000000..133d293
--- /dev/null
+++ b/src/pk-plugin-scan-desktop-files.c
@@ -0,0 +1,689 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+#include <gio/gdesktopappinfo.h>
+#include <gio/gio.h>
+#include <pk-transaction.h>
+#include <sqlite3.h>
+
+#include <packagekit-glib2/pk-desktop.h>
+#include <packagekit-glib2/pk-package.h>
+
+typedef struct {
+ sqlite3 *db;
+ GPtrArray *list;
+ GMainLoop *loop;
+ GHashTable *hash;
+} PluginPrivate;
+
+static PluginPrivate *priv;
+
+/**
+ * pk_transaction_plugin_get_description:
+ */
+const gchar *
+pk_transaction_plugin_get_description (void)
+{
+ return "Scans desktop files on refresh and adds them to a database";
+}
+
+/**
+ * pk_plugin_package_cb:
+ **/
+static void
+pk_plugin_package_cb (PkBackend *backend,
+ PkPackage *package,
+ gpointer user_data)
+{
+ g_ptr_array_add (priv->list, g_object_ref (package));
+}
+
+/**
+ * pk_plugin_finished_cb:
+ **/
+static void
+pk_plugin_finished_cb (PkBackend *backend,
+ PkExitEnum exit_enum,
+ gpointer user_data)
+{
+ if (!g_main_loop_is_running (priv->loop))
+ return;
+ if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
+ g_warning ("%s failed with exit code: %s",
+ pk_role_enum_to_string (pk_backend_get_role (backend)),
+ pk_exit_enum_to_string (exit_enum));
+ }
+ g_main_loop_quit (priv->loop);
+}
+
+/**
+ * pk_transaction_plugin_initialize:
+ */
+void
+pk_transaction_plugin_initialize (PkTransaction *transaction)
+{
+ const gchar *statement_create;
+ gboolean ret;
+ gchar *error_msg = NULL;
+ gint rc;
+ PkConf *conf;
+
+ /* create private area */
+ priv = g_new0 (PluginPrivate, 1);
+ priv->loop = g_main_loop_new (NULL, FALSE);
+ priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+ priv->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+ /* check the config file */
+ conf = pk_transaction_priv_get_conf (transaction);
+ ret = pk_conf_get_bool (conf, "ScanDesktopFiles");
+ if (!ret)
+ goto out;
+
+ /* check if database exists */
+ ret = g_file_test (PK_DESKTOP_DEFAULT_DATABASE,
+ G_FILE_TEST_EXISTS);
+
+ g_debug ("trying to open database '%s'",
+ PK_DESKTOP_DEFAULT_DATABASE);
+ rc = sqlite3_open (PK_DESKTOP_DEFAULT_DATABASE, &priv->db);
+ if (rc != 0) {
+ g_warning ("Can't open desktop database: %s\n",
+ sqlite3_errmsg (priv->db));
+ sqlite3_close (priv->db);
+ priv->db = NULL;
+ goto out;
+ }
+
+ /* create if not exists */
+ if (!ret) {
+ g_debug ("creating database cache in %s",
+ PK_DESKTOP_DEFAULT_DATABASE);
+ statement_create = "CREATE TABLE cache ("
+ "filename TEXT,"
+ "package TEXT,"
+ "show INTEGER,"
+ "md5 TEXT);";
+ rc = sqlite3_exec (priv->db, statement_create,
+ NULL, NULL, &error_msg);
+ if (rc != SQLITE_OK) {
+ g_warning ("SQL error: %s\n", error_msg);
+ sqlite3_free (error_msg);
+ goto out;
+ }
+ }
+
+ /* we don't need to keep syncing */
+ sqlite3_exec (priv->db, "PRAGMA synchronous=OFF", NULL, NULL, NULL);
+
+ g_debug ("plugin: initialize");
+out:
+ return;
+}
+
+/**
+ * pk_transaction_plugin_destroy:
+ */
+void
+pk_transaction_plugin_destroy (PkTransaction *transaction)
+{
+ g_debug ("plugin: destroy");
+ g_ptr_array_unref (priv->list);
+ g_main_loop_unref (priv->loop);
+ g_hash_table_unref (priv->hash);
+ sqlite3_close (priv->db);
+ g_free (priv);
+}
+
+/**
+ * pk_plugin_get_filename_md5:
+ **/
+static gchar *
+pk_plugin_get_filename_md5 (const gchar *filename)
+{
+ gchar *md5 = NULL;
+ gchar *data = NULL;
+ gsize length;
+ GError *error = NULL;
+ gboolean ret;
+
+ /* check is no longer exists */
+ ret = g_file_test (filename, G_FILE_TEST_EXISTS);
+ if (!ret)
+ goto out;
+
+ /* get data */
+ ret = g_file_get_contents (filename, &data, &length, &error);
+ if (!ret) {
+ g_warning ("failed to open file %s: %s",
+ filename, error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* check md5 is same */
+ md5 = g_compute_checksum_for_data (G_CHECKSUM_MD5,
+ (const guchar *) data,
+ length);
+out:
+ g_free (data);
+ return md5;
+}
+
+/**
+ * pk_plugin_sqlite_remove_filename:
+ **/
+static gint
+pk_plugin_sqlite_remove_filename (PkTransaction *transaction,
+ const gchar *filename)
+{
+ gchar *statement;
+ gint rc;
+
+ statement = g_strdup_printf ("DELETE FROM cache WHERE filename = '%s'",
+ filename);
+ rc = sqlite3_exec (priv->db, statement, NULL, NULL, NULL);
+ g_free (statement);
+ return rc;
+}
+
+/**
+ * pk_plugin_get_installed_package_for_file:
+ **/
+static PkPackage *
+pk_plugin_get_installed_package_for_file (PkTransaction *transaction,
+ const gchar *filename)
+{
+ PkPackage *package = NULL;
+ gchar **filenames;
+ PkBackend *backend = NULL;
+
+ /* use PK to find the correct package */
+ if (priv->list->len > 0)
+ g_ptr_array_set_size (priv->list, 0);
+ backend = pk_transaction_priv_get_backend (transaction);
+ pk_backend_reset (backend);
+ filenames = g_strsplit (filename, "|||", -1);
+ pk_backend_search_files (backend,
+ pk_bitfield_value (PK_FILTER_ENUM_INSTALLED),
+ filenames);
+ g_strfreev (filenames);
+
+ /* wait for finished */
+ g_main_loop_run (priv->loop);
+
+ /* check that we only matched one package */
+ if (priv->list->len != 1) {
+ g_warning ("not correct size, %i", priv->list->len);
+ goto out;
+ }
+
+ /* get the package */
+ package = g_ptr_array_index (priv->list, 0);
+ if (package == NULL) {
+ g_warning ("cannot get package");
+ goto out;
+ }
+out:
+ return package;
+}
+
+/**
+ * pk_plugin_sqlite_add_filename_details:
+ **/
+static gint
+pk_plugin_sqlite_add_filename_details (PkTransaction *transaction,
+ const gchar *filename,
+ const gchar *package,
+ const gchar *md5)
+{
+ gchar *statement;
+ gchar *error_msg = NULL;
+ sqlite3_stmt *sql_statement = NULL;
+ gint rc = -1;
+ gint show;
+ GDesktopAppInfo *info;
+
+ /* find out if we should show desktop file in menus */
+ info = g_desktop_app_info_new_from_filename (filename);
+ if (info == NULL) {
+ g_warning ("could not load desktop file %s", filename);
+ goto out;
+ }
+ show = g_app_info_should_show (G_APP_INFO (info));
+ g_object_unref (info);
+
+ g_debug ("add filename %s from %s with md5: %s (show: %i)",
+ filename, package, md5, show);
+
+ /* the row might already exist */
+ statement = g_strdup_printf ("DELETE FROM cache WHERE filename = '%s'",
+ filename);
+ sqlite3_exec (priv->db, statement, NULL, NULL, NULL);
+ g_free (statement);
+
+ /* prepare the query, as we don't escape it */
+ rc = sqlite3_prepare_v2 (priv->db,
+ "INSERT INTO cache (filename, package, show, md5) "
+ "VALUES (?, ?, ?, ?)",
+ -1, &sql_statement, NULL);
+ if (rc != SQLITE_OK) {
+ g_warning ("SQL failed to prepare: %s",
+ sqlite3_errmsg (priv->db));
+ goto out;
+ }
+
+ /* add data */
+ sqlite3_bind_text (sql_statement, 1, filename, -1, SQLITE_STATIC);
+ sqlite3_bind_text (sql_statement, 2, package, -1, SQLITE_STATIC);
+ sqlite3_bind_int (sql_statement, 3, show);
+ sqlite3_bind_text (sql_statement, 4, md5, -1, SQLITE_STATIC);
+
+ /* save this */
+ sqlite3_step (sql_statement);
+ rc = sqlite3_finalize (sql_statement);
+ if (rc != SQLITE_OK) {
+ g_warning ("SQL error: %s\n", error_msg);
+ sqlite3_free (error_msg);
+ goto out;
+ }
+out:
+ return rc;
+}
+
+/**
+ * pk_plugin_sqlite_add_filename:
+ **/
+static gint
+pk_plugin_sqlite_add_filename (PkTransaction *transaction,
+ const gchar *filename,
+ const gchar *md5_opt)
+{
+ gchar *md5 = NULL;
+ gint rc = -1;
+ PkPackage *package;
+
+ /* if we've got it, use old data */
+ if (md5_opt != NULL)
+ md5 = g_strdup (md5_opt);
+ else
+ md5 = pk_plugin_get_filename_md5 (filename);
+
+ /* resolve */
+ package = pk_plugin_get_installed_package_for_file (transaction,
+ filename);
+ if (package == NULL) {
+ g_warning ("failed to get list");
+ goto out;
+ }
+
+ /* add */
+ rc = pk_plugin_sqlite_add_filename_details (transaction,
+ filename,
+ pk_package_get_name (package),
+ md5);
+out:
+ g_free (md5);
+ return rc;
+}
+
+/**
+ * pk_plugin_sqlite_cache_rescan_cb:
+ **/
+static gint
+pk_plugin_sqlite_cache_rescan_cb (void *data,
+ gint argc,
+ gchar **argv,
+ gchar **col_name)
+{
+ PkTransaction *transaction = PK_TRANSACTION (data);
+ const gchar *filename = NULL;
+ const gchar *md5 = NULL;
+ gchar *md5_calc = NULL;
+ gint i;
+
+ /* add the filename data to the array */
+ for (i=0; i<argc; i++) {
+ if (g_strcmp0 (col_name[i], "filename") == 0 && argv[i] != NULL)
+ filename = argv[i];
+ else if (g_strcmp0 (col_name[i], "md5") == 0 && argv[i] != NULL)
+ md5 = argv[i];
+ }
+
+ /* sanity check */
+ if (filename == NULL || md5 == NULL) {
+ g_warning ("filename %s and md5 %s)", filename, md5);
+ goto out;
+ }
+
+ /* get md5 */
+ md5_calc = pk_plugin_get_filename_md5 (filename);
+ if (md5_calc == NULL) {
+ g_debug ("remove of %s as no longer found", filename);
+ pk_plugin_sqlite_remove_filename (transaction, filename);
+ goto out;
+ }
+
+ /* we've checked the file */
+ g_hash_table_insert (priv->hash,
+ g_strdup (filename),
+ GUINT_TO_POINTER (1));
+
+ /* check md5 is same */
+ if (g_strcmp0 (md5, md5_calc) != 0) {
+ g_debug ("add of %s as md5 invalid (%s vs %s)",
+ filename, md5, md5_calc);
+ pk_plugin_sqlite_add_filename (transaction,
+ filename,
+ md5_calc);
+ }
+
+ g_debug ("existing filename %s valid, md5=%s", filename, md5);
+out:
+ g_free (md5_calc);
+ return 0;
+}
+
+
+/**
+ * pk_plugin_get_desktop_files:
+ **/
+static void
+pk_plugin_get_desktop_files (PkTransaction *transaction,
+ const gchar *app_dir,
+ GPtrArray *array)
+{
+ GError *error = NULL;
+ GDir *dir;
+ const gchar *filename;
+ gpointer data;
+ gchar *path;
+
+ /* open directory */
+ dir = g_dir_open (app_dir, 0, &error);
+ if (dir == NULL) {
+ g_warning ("failed to open directory %s: %s",
+ app_dir, error->message);
+ g_error_free (error);
+ return;
+ }
+
+ /* go through desktop files and add them to an array
+ * if not present */
+ filename = g_dir_read_name (dir);
+ while (filename != NULL) {
+ path = g_build_filename (app_dir, filename, NULL);
+ if (g_file_test (path, G_FILE_TEST_IS_DIR)) {
+ pk_plugin_get_desktop_files (transaction,
+ path, array);
+ } else if (g_str_has_suffix (filename, ".desktop")) {
+ data = g_hash_table_lookup (priv->hash, path);
+ if (data == NULL) {
+ g_debug ("add of %s as not present in db",
+ path);
+ g_ptr_array_add (array, g_strdup (path));
+ }
+ }
+ g_free (path);
+ filename = g_dir_read_name (dir);
+ }
+ g_dir_close (dir);
+}
+
+/**
+ * pk_transaction_plugin_finished_end:
+ */
+void
+pk_transaction_plugin_finished_end (PkTransaction *transaction)
+{
+ gchar *error_msg = NULL;
+ gchar *path;
+ gchar *statement;
+ gfloat step;
+ gint rc;
+ GPtrArray *array = NULL;
+ guint finished_id = 0;
+ guint i;
+ guint package_id = 0;
+ PkBackend *backend = NULL;
+ PkRoleEnum role;
+
+ /* no database */
+ if (priv->db == NULL)
+ goto out;
+
+ /* check the role */
+ role = pk_transaction_priv_get_role (transaction);
+ if (role != PK_ROLE_ENUM_REFRESH_CACHE)
+ goto out;
+
+ /* connect to backend */
+ backend = pk_transaction_priv_get_backend (transaction);
+ if (!pk_backend_is_implemented (backend,
+ PK_ROLE_ENUM_SEARCH_FILE)) {
+ g_debug ("cannot search files");
+ goto out;
+ }
+ finished_id = g_signal_connect (backend, "finished",
+ G_CALLBACK (pk_plugin_finished_cb), NULL);
+ package_id = g_signal_connect (backend, "package",
+ G_CALLBACK (pk_plugin_package_cb), NULL);
+
+ g_debug ("plugin: finished-end");
+
+ /* use a local backend instance */
+ pk_backend_reset (backend);
+ pk_backend_set_status (backend,
+ PK_STATUS_ENUM_SCAN_APPLICATIONS);
+
+ /* reset hash */
+ g_hash_table_remove_all (priv->hash);
+ pk_backend_set_percentage (backend, 101);
+
+ /* first go through the existing data, and look for
+ * modifications and removals */
+ statement = g_strdup ("SELECT filename, md5 FROM cache");
+ rc = sqlite3_exec (priv->db,
+ statement,
+ pk_plugin_sqlite_cache_rescan_cb,
+ transaction,
+ &error_msg);
+ g_free (statement);
+ if (rc != SQLITE_OK) {
+ g_warning ("SQL error: %s\n", error_msg);
+ sqlite3_free (error_msg);
+ goto out;
+ }
+
+ array = g_ptr_array_new_with_free_func (g_free);
+ pk_plugin_get_desktop_files (transaction,
+ PK_DESKTOP_DEFAULT_APPLICATION_DIR,
+ array);
+
+ if (array->len) {
+ step = 100.0f / array->len;
+ pk_backend_set_status (backend,
+ PK_STATUS_ENUM_GENERATE_PACKAGE_LIST);
+
+ /* process files in an array */
+ for (i=0; i<array->len; i++) {
+ pk_backend_set_percentage (backend, i * step);
+ path = g_ptr_array_index (array, i);
+ pk_plugin_sqlite_add_filename (transaction,
+ path,
+ NULL);
+ }
+ }
+
+ pk_backend_set_percentage (backend, 100);
+ pk_backend_set_status (backend, PK_STATUS_ENUM_FINISHED);
+out:
+ if (array != NULL)
+ g_ptr_array_unref (array);
+ if (backend == NULL) {
+ if (package_id > 0)
+ g_signal_handler_disconnect (backend, package_id);
+ if (finished_id > 0)
+ g_signal_handler_disconnect (backend, finished_id);
+ }
+}
+
+
+/**
+ * pk_plugin_files_cb:
+ **/
+static void
+pk_plugin_files_cb (PkBackend *backend,
+ PkFiles *files,
+ PkTransaction *transaction)
+{
+ guint i;
+ guint len;
+ gboolean ret;
+ gchar **package;
+ gchar *md5;
+ gchar **filenames = NULL;
+ gchar *package_id = NULL;
+
+ /* get data */
+ g_object_get (files,
+ "package-id", &package_id,
+ "files", &filenames,
+ NULL);
+
+ package = pk_package_id_split (package_id);
+
+ /* check each file */
+ len = g_strv_length (filenames);
+ for (i=0; i<len; i++) {
+ /* exists? */
+ ret = g_file_test (filenames[i], G_FILE_TEST_EXISTS);
+ if (!ret)
+ continue;
+
+ /* .desktop file? */
+ ret = g_str_has_suffix (filenames[i], ".desktop");
+ if (!ret)
+ continue;
+
+ g_debug ("adding filename %s", filenames[i]);
+ md5 = pk_plugin_get_filename_md5 (filenames[i]);
+ pk_plugin_sqlite_add_filename_details (transaction,
+ filenames[i],
+ package[PK_PACKAGE_ID_NAME],
+ md5);
+ g_free (md5);
+ }
+ g_strfreev (filenames);
+ g_strfreev (package);
+ g_free (package_id);
+}
+
+/**
+ * pk_transaction_plugin_finished_results:
+ */
+void
+pk_transaction_plugin_finished_results (PkTransaction *transaction)
+{
+ gchar **package_ids = NULL;
+ gchar *package_id_tmp;
+ GPtrArray *array = NULL;
+ GPtrArray *list = NULL;
+ guint files_id = 0;
+ guint finished_id = 0;
+ guint i;
+ PkBackend *backend = NULL;
+ PkInfoEnum info;
+ PkPackage *item;
+ PkResults *results;
+ PkRoleEnum role;
+
+ /* no database */
+ if (priv->db == NULL)
+ goto out;
+
+ /* check the role */
+ role = pk_transaction_priv_get_role (transaction);
+ if (role != PK_ROLE_ENUM_INSTALL_PACKAGES)
+ goto out;
+
+ /* connect to backend */
+ backend = pk_transaction_priv_get_backend (transaction);
+ if (!pk_backend_is_implemented (backend,
+ PK_ROLE_ENUM_GET_FILES)) {
+ g_debug ("cannot get files");
+ goto out;
+ }
+ finished_id = g_signal_connect (backend, "finished",
+ G_CALLBACK (pk_plugin_finished_cb), NULL);
+ files_id = g_signal_connect (backend, "files",
+ G_CALLBACK (pk_plugin_files_cb), NULL);
+
+ /* get results */
+ results = pk_transaction_priv_get_results (transaction);
+ array = pk_results_get_package_array (results);
+
+ /* filter on INSTALLING | UPDATING */
+ list = g_ptr_array_new_with_free_func (g_free);
+ for (i=0; i<array->len; i++) {
+ item = g_ptr_array_index (array, i);
+ info = pk_package_get_info (item);
+ if (info == PK_INFO_ENUM_INSTALLING ||
+ info == PK_INFO_ENUM_UPDATING) {
+ /* we convert the package_id data to be 'installed' */
+ package_id_tmp = pk_package_id_build (pk_package_get_name (item),
+ pk_package_get_version (item),
+ pk_package_get_arch (item),
+ "installed");
+ g_ptr_array_add (list, package_id_tmp);
+ }
+ }
+
+ /* process file lists on these packages */
+ g_debug ("processing %i packags for desktop files", list->len);
+ if (list->len == 0)
+ goto out;
+
+ /* get all the files touched in the packages we just installed */
+ pk_backend_reset (backend);
+ pk_backend_set_status (backend, PK_STATUS_ENUM_SCAN_APPLICATIONS);
+ pk_backend_set_percentage (backend, 101);
+ package_ids = pk_ptr_array_to_strv (list);
+ pk_backend_get_files (backend, package_ids);
+
+ /* wait for finished */
+ g_main_loop_run (priv->loop);
+
+ pk_backend_set_percentage (backend, 100);
+out:
+ if (backend == NULL) {
+ if (files_id > 0)
+ g_signal_handler_disconnect (backend, files_id);
+ if (finished_id > 0)
+ g_signal_handler_disconnect (backend, finished_id);
+ }
+ if (array != NULL)
+ g_ptr_array_unref (array);
+ if (list != NULL)
+ g_ptr_array_unref (list);
+ g_strfreev (package_ids);
+}
diff --git a/src/pk-transaction-extra.c b/src/pk-transaction-extra.c
index 7e01a79..021b668 100644
--- a/src/pk-transaction-extra.c
+++ b/src/pk-transaction-extra.c
@@ -51,7 +51,6 @@
struct PkTransactionExtraPrivate
{
- sqlite3 *db;
PkBackend *backend;
GMainLoop *loop;
GPtrArray *list;
@@ -60,7 +59,6 @@ struct PkTransactionExtraPrivate
PkConf *conf;
guint finished_id;
guint package_id;
- GHashTable *hash;
GPtrArray *files_list;
GPtrArray *pids;
};
@@ -156,297 +154,6 @@ out:
}
/**
- * pk_transaction_extra_get_filename_md5:
- **/
-static gchar *
-pk_transaction_extra_get_filename_md5 (const gchar *filename)
-{
- gchar *md5 = NULL;
- gchar *data = NULL;
- gsize length;
- GError *error = NULL;
- gboolean ret;
-
- /* check is no longer exists */
- ret = g_file_test (filename, G_FILE_TEST_EXISTS);
- if (!ret)
- goto out;
-
- /* get data */
- ret = g_file_get_contents (filename, &data, &length, &error);
- if (!ret) {
- g_warning ("failed to open file %s: %s", filename, error->message);
- g_error_free (error);
- goto out;
- }
-
- /* check md5 is same */
- md5 = g_compute_checksum_for_data (G_CHECKSUM_MD5, (const guchar *) data, length);
-out:
- g_free (data);
- return md5;
-}
-
-/**
- * pk_transaction_extra_sqlite_remove_filename:
- **/
-static gint
-pk_transaction_extra_sqlite_remove_filename (PkTransactionExtra *extra, const gchar *filename)
-{
- gchar *statement;
- gint rc;
-
- statement = g_strdup_printf ("DELETE FROM cache WHERE filename = '%s'", filename);
- rc = sqlite3_exec (extra->priv->db, statement, NULL, NULL, NULL);
- g_free (statement);
- return rc;
-}
-
-/**
- * pk_transaction_extra_sqlite_add_filename_details:
- **/
-static gint
-pk_transaction_extra_sqlite_add_filename_details (PkTransactionExtra *extra, const gchar *filename, const gchar *package, const gchar *md5)
-{
- gchar *statement;
- gchar *error_msg = NULL;
- sqlite3_stmt *sql_statement = NULL;
- gint rc = -1;
- gint show;
- GDesktopAppInfo *info;
-
- /* find out if we should show desktop file in menus */
- info = g_desktop_app_info_new_from_filename (filename);
- if (info == NULL) {
- g_warning ("could not load desktop file %s", filename);
- goto out;
- }
- show = g_app_info_should_show (G_APP_INFO (info));
- g_object_unref (info);
-
- g_debug ("add filename %s from %s with md5: %s (show: %i)", filename, package, md5, show);
-
- /* the row might already exist */
- statement = g_strdup_printf ("DELETE FROM cache WHERE filename = '%s'", filename);
- sqlite3_exec (extra->priv->db, statement, NULL, NULL, NULL);
- g_free (statement);
-
- /* prepare the query, as we don't escape it */
- rc = sqlite3_prepare_v2 (extra->priv->db, "INSERT INTO cache (filename, package, show, md5) VALUES (?, ?, ?, ?)", -1, &sql_statement, NULL);
- if (rc != SQLITE_OK) {
- g_warning ("SQL failed to prepare: %s", sqlite3_errmsg (extra->priv->db));
- goto out;
- }
-
- /* add data */
- sqlite3_bind_text (sql_statement, 1, filename, -1, SQLITE_STATIC);
- sqlite3_bind_text (sql_statement, 2, package, -1, SQLITE_STATIC);
- sqlite3_bind_int (sql_statement, 3, show);
- sqlite3_bind_text (sql_statement, 4, md5, -1, SQLITE_STATIC);
-
- /* save this */
- sqlite3_step (sql_statement);
- rc = sqlite3_finalize (sql_statement);
- if (rc != SQLITE_OK) {
- g_warning ("SQL error: %s\n", error_msg);
- sqlite3_free (error_msg);
- goto out;
- }
-
-out:
- return rc;
-}
-
-/**
- * pk_transaction_extra_sqlite_add_filename:
- **/
-static gint
-pk_transaction_extra_sqlite_add_filename (PkTransactionExtra *extra, const gchar *filename, const gchar *md5_opt)
-{
- gchar *md5 = NULL;
- gint rc = -1;
- PkPackage *package;
- gchar **parts = NULL;
-
- /* if we've got it, use old data */
- if (md5_opt != NULL)
- md5 = g_strdup (md5_opt);
- else
- md5 = pk_transaction_extra_get_filename_md5 (filename);
-
- /* resolve */
- package = pk_transaction_extra_get_installed_package_for_file (extra, filename);
- if (package == NULL) {
- g_warning ("failed to get list");
- goto out;
- }
-
- /* add */
- parts = pk_package_id_split (pk_package_get_id (package));
- rc = pk_transaction_extra_sqlite_add_filename_details (extra, filename, parts[PK_PACKAGE_ID_NAME], md5);
-out:
- g_strfreev (parts);
- g_free (md5);
- return rc;
-}
-
-/**
- * pk_transaction_extra_sqlite_cache_rescan_cb:
- **/
-static gint
-pk_transaction_extra_sqlite_cache_rescan_cb (void *data, gint argc, gchar **argv, gchar **col_name)
-{
- PkTransactionExtra *extra = PK_POST_TRANS (data);
- const gchar *filename = NULL;
- const gchar *md5 = NULL;
- gchar *md5_calc = NULL;
- gint i;
-
- /* add the filename data to the array */
- for (i=0; i<argc; i++) {
- if (g_strcmp0 (col_name[i], "filename") == 0 && argv[i] != NULL)
- filename = argv[i];
- else if (g_strcmp0 (col_name[i], "md5") == 0 && argv[i] != NULL)
- md5 = argv[i];
- }
-
- /* sanity check */
- if (filename == NULL || md5 == NULL) {
- g_warning ("filename %s and md5 %s)", filename, md5);
- goto out;
- }
-
- /* get md5 */
- md5_calc = pk_transaction_extra_get_filename_md5 (filename);
- if (md5_calc == NULL) {
- g_debug ("remove of %s as no longer found", filename);
- pk_transaction_extra_sqlite_remove_filename (extra, filename);
- goto out;
- }
-
- /* we've checked the file */
- g_hash_table_insert (extra->priv->hash, g_strdup (filename), GUINT_TO_POINTER (1));
-
- /* check md5 is same */
- if (g_strcmp0 (md5, md5_calc) != 0) {
- g_debug ("add of %s as md5 invalid (%s vs %s)", filename, md5, md5_calc);
- pk_transaction_extra_sqlite_add_filename (extra, filename, md5_calc);
- }
-
- g_debug ("existing filename %s valid, md5=%s", filename, md5);
-out:
- g_free (md5_calc);
- return 0;
-}
-
-/**
- * pk_transaction_extra_get_desktop_files:
- **/
-static void
-pk_transaction_extra_get_desktop_files (PkTransactionExtra *extra,
- const gchar *app_dir,
- GPtrArray *array)
-{
- GError *error = NULL;
- GDir *dir;
- const gchar *filename;
- gpointer data;
- gchar *path;
-
- /* open directory */
- dir = g_dir_open (app_dir, 0, &error);
- if (dir == NULL) {
- g_warning ("failed to open directory %s: %s", app_dir, error->message);
- g_error_free (error);
- return;
- }
-
- /* go through desktop files and add them to an array if not present */
- filename = g_dir_read_name (dir);
- while (filename != NULL) {
- path = g_build_filename (app_dir, filename, NULL);
- if (g_file_test (path, G_FILE_TEST_IS_DIR)) {
- pk_transaction_extra_get_desktop_files (extra, path, array);
- } else if (g_str_has_suffix (filename, ".desktop")) {
- data = g_hash_table_lookup (extra->priv->hash, path);
- if (data == NULL) {
- g_debug ("add of %s as not present in db", path);
- g_ptr_array_add (array, g_strdup (path));
- }
- }
- g_free (path);
- filename = g_dir_read_name (dir);
- }
- g_dir_close (dir);
-}
-
-/**
- * pk_transaction_extra_import_desktop_files:
- **/
-gboolean
-pk_transaction_extra_import_desktop_files (PkTransactionExtra *extra)
-{
- gchar *statement;
- gchar *error_msg = NULL;
- gint rc;
- gchar *path;
- GPtrArray *array;
- gfloat step;
- guint i;
-
- g_return_val_if_fail (PK_IS_POST_TRANS (extra), FALSE);
-
- /* no database */
- if (extra->priv->db == NULL) {
- g_debug ("unable to import: no database");
- return FALSE;
- }
-
- /* no support */
- if (!pk_backend_is_implemented (extra->priv->backend, PK_ROLE_ENUM_SEARCH_FILE)) {
- g_debug ("cannot search files");
- return FALSE;
- }
-
- /* use a local backend instance */
- pk_backend_reset (extra->priv->backend);
- pk_transaction_extra_set_status_changed (extra, PK_STATUS_ENUM_SCAN_APPLICATIONS);
-
- /* reset hash */
- g_hash_table_remove_all (extra->priv->hash);
- pk_transaction_extra_set_progress_changed (extra, 101);
-
- /* first go through the existing data, and look for modifications and removals */
- statement = g_strdup ("SELECT filename, md5 FROM cache");
- rc = sqlite3_exec (extra->priv->db, statement, pk_transaction_extra_sqlite_cache_rescan_cb, extra, &error_msg);
- g_free (statement);
- if (rc != SQLITE_OK) {
- g_warning ("SQL error: %s\n", error_msg);
- sqlite3_free (error_msg);
- }
-
- array = g_ptr_array_new_with_free_func (g_free);
- pk_transaction_extra_get_desktop_files (extra, PK_DESKTOP_DEFAULT_APPLICATION_DIR, array);
-
- if (array->len) {
- step = 100.0f / array->len;
- pk_transaction_extra_set_status_changed (extra, PK_STATUS_ENUM_GENERATE_PACKAGE_LIST);
-
- /* process files in an array */
- for (i=0; i<array->len; i++) {
- pk_transaction_extra_set_progress_changed (extra, i * step);
- path = g_ptr_array_index (array, i);
- pk_transaction_extra_sqlite_add_filename (extra, path, NULL);
- }
- }
- g_ptr_array_free (array, TRUE);
-
- pk_transaction_extra_set_progress_changed (extra, 100);
- pk_transaction_extra_set_status_changed (extra, PK_STATUS_ENUM_FINISHED);
- return TRUE;
-}
-
-/**
* pk_transaction_extra_update_files_check_running_cb:
**/
static void
@@ -524,84 +231,6 @@ pk_transaction_extra_check_running_process (PkTransactionExtra *extra, gchar **p
}
/**
- * pk_transaction_extra_update_files_check_desktop_cb:
- **/
-static void
-pk_transaction_extra_update_files_check_desktop_cb (PkBackend *backend, PkFiles *files, PkTransactionExtra *extra)
-{
- guint i;
- guint len;
- gboolean ret;
- gchar **package;
- gchar *md5;
- gchar **filenames = NULL;
- gchar *package_id = NULL;
-
- /* get data */
- g_object_get (files,
- "package-id", &package_id,
- "files", &filenames,
- NULL);
-
- package = pk_package_id_split (package_id);
-
- /* check each file */
- len = g_strv_length (filenames);
- for (i=0; i<len; i++) {
- /* exists? */
- ret = g_file_test (filenames[i], G_FILE_TEST_EXISTS);
- if (!ret)
- continue;
-
- /* .desktop file? */
- ret = g_str_has_suffix (filenames[i], ".desktop");
- if (!ret)
- continue;
-
- g_debug ("adding filename %s", filenames[i]);
- md5 = pk_transaction_extra_get_filename_md5 (filenames[i]);
- pk_transaction_extra_sqlite_add_filename_details (extra, filenames[i], package[PK_PACKAGE_ID_NAME], md5);
- g_free (md5);
- }
- g_strfreev (filenames);
- g_strfreev (package);
- g_free (package_id);
-}
-
-/**
- * pk_transaction_extra_check_desktop_files:
- **/
-gboolean
-pk_transaction_extra_check_desktop_files (PkTransactionExtra *extra, gchar **package_ids)
-{
- guint signal_files = 0;
-
- g_return_val_if_fail (PK_IS_POST_TRANS (extra), FALSE);
-
- if (!pk_backend_is_implemented (extra->priv->backend, PK_ROLE_ENUM_GET_FILES)) {
- g_debug ("cannot get files");
- return FALSE;
- }
-
- pk_transaction_extra_set_status_changed (extra, PK_STATUS_ENUM_SCAN_APPLICATIONS);
- pk_transaction_extra_set_progress_changed (extra, 101);
-
- signal_files = g_signal_connect (extra->priv->backend, "files",
- G_CALLBACK (pk_transaction_extra_update_files_check_desktop_cb), extra);
-
- /* get all the files touched in the packages we just updated */
- pk_backend_reset (extra->priv->backend);
- pk_backend_get_files (extra->priv->backend, package_ids);
-
- /* wait for finished */
- g_main_loop_run (extra->priv->loop);
-
- g_signal_handler_disconnect (extra->priv->backend, signal_files);
- pk_transaction_extra_set_progress_changed (extra, 100);
- return TRUE;
-}
-
-/**
* pk_transaction_extra_files_check_library_restart_cb:
**/
static void
@@ -930,8 +559,6 @@ pk_transaction_extra_finalize (GObject *object)
if (g_main_loop_is_running (extra->priv->loop))
g_main_loop_quit (extra->priv->loop);
g_main_loop_unref (extra->priv->loop);
- sqlite3_close (extra->priv->db);
- g_hash_table_unref (extra->priv->hash);
g_ptr_array_unref (extra->priv->files_list);
g_object_unref (extra->priv->backend);
@@ -974,20 +601,13 @@ pk_transaction_extra_class_init (PkTransactionExtraClass *klass)
static void
pk_transaction_extra_init (PkTransactionExtra *extra)
{
- gboolean ret;
- const gchar *statement;
- gchar *error_msg = NULL;
- gint rc;
-
extra->priv = PK_POST_TRANS_GET_PRIVATE (extra);
extra->priv->loop = g_main_loop_new (NULL, FALSE);
extra->priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
extra->priv->backend = pk_backend_new ();
extra->priv->lsof = pk_lsof_new ();
extra->priv->proc = pk_proc_new ();
- extra->priv->db = NULL;
extra->priv->pids = NULL;
- extra->priv->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
extra->priv->files_list = g_ptr_array_new_with_free_func (g_free);
extra->priv->conf = pk_conf_new ();
@@ -997,36 +617,6 @@ pk_transaction_extra_init (PkTransactionExtra *extra)
extra->priv->package_id =
g_signal_connect (extra->priv->backend, "package",
G_CALLBACK (pk_transaction_extra_package_cb), extra);
-
- /* check if exists */
- ret = g_file_test (PK_DESKTOP_DEFAULT_DATABASE, G_FILE_TEST_EXISTS);
-
- g_debug ("trying to open database '%s'", PK_DESKTOP_DEFAULT_DATABASE);
- rc = sqlite3_open (PK_DESKTOP_DEFAULT_DATABASE, &extra->priv->db);
- if (rc != 0) {
- g_warning ("Can't open desktop database: %s\n", sqlite3_errmsg (extra->priv->db));
- sqlite3_close (extra->priv->db);
- extra->priv->db = NULL;
- return;
- }
-
- /* create if not exists */
- if (!ret) {
- g_debug ("creating database cache in %s", PK_DESKTOP_DEFAULT_DATABASE);
- statement = "CREATE TABLE cache ("
- "filename TEXT,"
- "package TEXT,"
- "show INTEGER,"
- "md5 TEXT);";
- rc = sqlite3_exec (extra->priv->db, statement, NULL, NULL, &error_msg);
- if (rc != SQLITE_OK) {
- g_warning ("SQL error: %s\n", error_msg);
- sqlite3_free (error_msg);
- }
- }
-
- /* we don't need to keep syncing */
- sqlite3_exec (extra->priv->db, "PRAGMA synchronous=OFF", NULL, NULL, NULL);
}
/**
diff --git a/src/pk-transaction-extra.h b/src/pk-transaction-extra.h
index cd61fe6..3a56a40 100644
--- a/src/pk-transaction-extra.h
+++ b/src/pk-transaction-extra.h
@@ -49,11 +49,8 @@ typedef struct
GType pk_transaction_extra_get_type (void);
PkTransactionExtra *pk_transaction_extra_new (void);
-gboolean pk_transaction_extra_import_desktop_files (PkTransactionExtra *extra);
gboolean pk_transaction_extra_check_running_process (PkTransactionExtra *extra,
gchar **package_ids);
-gboolean pk_transaction_extra_check_desktop_files (PkTransactionExtra *extra,
- gchar **package_ids);
gboolean pk_transaction_extra_check_library_restart (PkTransactionExtra *extra);
gboolean pk_transaction_extra_check_library_restart_pre (PkTransactionExtra *extra,
gchar **package_ids);
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 58f9caf..6d23476 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -931,6 +931,15 @@ pk_transaction_priv_get_backend (PkTransaction *transaction)
}
/**
+ * pk_transaction_priv_get_results:
+ **/
+PkResults *
+pk_transaction_priv_get_results (PkTransaction *transaction)
+{
+ return transaction->priv->results;
+}
+
+/**
* pk_transaction_priv_get_package_ids:
**/
gchar **
@@ -1048,50 +1057,6 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
}
}
- /* rescan desktop files after install */
- if (exit_enum == PK_EXIT_ENUM_SUCCESS &&
- transaction->priv->role == PK_ROLE_ENUM_INSTALL_PACKAGES) {
-
- /* refresh the desktop icon cache */
- ret = pk_conf_get_bool (transaction->priv->conf, "ScanDesktopFiles");
- if (ret) {
- /* get results */
- array = pk_results_get_package_array (transaction->priv->results);
-
- /* filter on INSTALLING | UPDATING */
- list = g_ptr_array_new_with_free_func (g_free);
- for (i=0; i<array->len; i++) {
- item = g_ptr_array_index (array, i);
- g_object_get (item,
- "info", &info,
- "package-id", &package_id,
- NULL);
- if (info == PK_INFO_ENUM_INSTALLING ||
- info == PK_INFO_ENUM_UPDATING) {
- /* we convert the package_id data to be 'installed' */
- split = pk_package_id_split (package_id);
- package_id_tmp = pk_package_id_build (split[PK_PACKAGE_ID_NAME],
- split[PK_PACKAGE_ID_VERSION],
- split[PK_PACKAGE_ID_ARCH],
- "installed");
- g_ptr_array_add (list, package_id_tmp);
- g_strfreev (split);
- }
- g_free (package_id);
- }
-
- g_debug ("processing %i packags for desktop files", list->len);
- /* process file lists on these packages */
- if (list->len > 0) {
- package_ids = pk_ptr_array_to_strv (list);
- pk_transaction_extra_check_desktop_files (transaction->priv->transaction_extra, package_ids);
- g_strfreev (package_ids);
- }
- g_ptr_array_unref (array);
- g_ptr_array_unref (list);
- }
- }
-
/* look for library restarts */
if (exit_enum == PK_EXIT_ENUM_SUCCESS) {
ret = pk_conf_get_bool (transaction->priv->conf, "CheckSharedLibrariesInUse");
@@ -1113,16 +1078,6 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
g_signal_handler_disconnect (transaction->priv->backend,
transaction->priv->signal_require_restart);
- /* do some optional extra actions when we've finished refreshing the cache */
- if (exit_enum == PK_EXIT_ENUM_SUCCESS &&
- transaction->priv->role == PK_ROLE_ENUM_REFRESH_CACHE) {
-
- /* refresh the desktop icon cache */
- ret = pk_conf_get_bool (transaction->priv->conf, "ScanDesktopFiles");
- if (ret)
- pk_transaction_extra_import_desktop_files (transaction->priv->transaction_extra);
- }
-
/* run the plugins */
pk_transaction_plugin_phase (transaction,
PK_TRANSACTION_PLUGIN_PHASE_FINISHED_END);
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index 1d6d76f..4eaf564 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -25,6 +25,7 @@
#include <glib-object.h>
#include <dbus/dbus-glib.h>
#include <packagekit-glib2/pk-enum.h>
+#include <packagekit-glib2/pk-results.h>
#include "pk-conf.h"
#include "pk-backend.h"
@@ -104,6 +105,7 @@ void pk_transaction_priv_cancel_bg (PkTransaction *transaction);
PkRoleEnum pk_transaction_priv_get_role (PkTransaction *transaction);
PkConf *pk_transaction_priv_get_conf (PkTransaction *transaction);
PkBackend *pk_transaction_priv_get_backend (PkTransaction *transaction);
+PkResults *pk_transaction_priv_get_results (PkTransaction *transaction);
gchar **pk_transaction_priv_get_package_ids (PkTransaction *transaction);
PkTransactionState pk_transaction_get_state (PkTransaction *transaction);
gboolean pk_transaction_set_state (PkTransaction *transaction,
commit d82244ffbd4166fa73f135927e88a09619bef84a
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Jul 10 10:02:51 2011 +0100
trivial: flesh out the example plugin a little more
diff --git a/src/pk-plugin-example.c b/src/pk-plugin-example.c
index 45b7a51..2bfdee0 100644
--- a/src/pk-plugin-example.c
+++ b/src/pk-plugin-example.c
@@ -24,7 +24,7 @@
#include <pk-transaction.h>
typedef struct {
- guint dummy;
+ guint dummy;
} PluginPrivate;
static PluginPrivate *priv;
@@ -67,7 +67,33 @@ pk_transaction_plugin_destroy (PkTransaction *transaction)
void
pk_transaction_plugin_run (PkTransaction *transaction)
{
+ gboolean ret;
+ PkBackend *backend = NULL;
+ PkConf *conf;
+ PkRoleEnum role;
+
+ /* check the config file */
+ conf = pk_transaction_priv_get_conf (transaction);
+ ret = pk_conf_get_bool (conf, "UseDummy");
+ if (!ret)
+ goto out;
+
+ /* check the role */
+ role = pk_transaction_priv_get_role (transaction);
+ if (role != PK_ROLE_ENUM_REFRESH_CACHE)
+ goto out;
+
+ /* check we can do the action */
+ backend = pk_transaction_priv_get_backend (transaction);
+ if (!pk_backend_is_implemented (backend,
+ PK_ROLE_ENUM_GET_PACKAGES)) {
+ g_debug ("cannot get packages");
+ goto out;
+ }
+
g_debug ("plugin: run");
+out:
+ return;
}
/**
commit 61d869dc067d0a31638f8fb9ccc2e15712feffe9
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Jul 10 10:02:20 2011 +0100
trivial: initialize plugins in order in one phase
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index ae02d25..58f9caf 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -283,7 +283,6 @@ pk_transaction_load_plugin (PkTransaction *transaction,
gboolean ret;
GModule *module;
PkTransactionPluginGetDescFunc plugin_desc = NULL;
- PkTransactionPluginFunc plugin_func = NULL;
module = g_module_open (filename,
0);
@@ -308,15 +307,6 @@ pk_transaction_load_plugin (PkTransaction *transaction,
g_debug ("opened plugin %s: %s",
filename, plugin_desc ());
- /* optionally initialize plugin */
- ret = g_module_symbol (module,
- "pk_transaction_plugin_initialize",
- (gpointer *) &plugin_func);
- if (ret) {
- g_debug ("running init on %s", filename);
- plugin_func (transaction);
- }
-
/* add to array */
g_ptr_array_add (transaction->priv->plugins,
module);
@@ -6054,6 +6044,11 @@ pk_transaction_init (PkTransaction *transaction)
/* get plugins */
transaction->priv->plugins = g_ptr_array_new_with_free_func ((GDestroyNotify) g_module_close);
pk_transaction_load_plugins (transaction);
+
+ /* initialize plugins */
+ pk_transaction_plugin_phase (transaction,
+ PK_TRANSACTION_PLUGIN_PHASE_INIT);
+
}
/**
commit d37ed83285160115b54e3a2ef77fbce3e2708e11
Author: Richard Hughes <richard at hughsie.com>
Date: Sat Jul 9 11:02:21 2011 +0100
Move the checking for running processes before update to a plugin
diff --git a/src/Makefile.am b/src/Makefile.am
index e793da0..7b4d179 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -225,6 +225,7 @@ plugindir = $(LIBDIR)/packagekit-plugins
plugin_LTLIBRARIES = \
libpk_plugin_scripts.la \
libpk_plugin-update-package-list.la \
+ libpk_plugin-no-update-process.la \
libpk-plugin-clear-firmware-requests.la
libpk_plugin_scripts_la_SOURCES = pk-plugin-scripts.c
@@ -242,4 +243,9 @@ libpk_plugin_update_package_list_la_LIBADD = $(PK_PLUGIN_LIBS)
libpk_plugin_update_package_list_la_LDFLAGS = -module -avoid-version
libpk_plugin_update_package_list_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+libpk_plugin_no_update_process_la_SOURCES = pk-plugin-no-update-process.c
+libpk_plugin_no_update_process_la_LIBADD = $(PK_PLUGIN_LIBS)
+libpk_plugin_no_update_process_la_LDFLAGS = -module -avoid-version
+libpk_plugin_no_update_process_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+
-include $(top_srcdir)/git.mk
diff --git a/src/pk-plugin-no-update-process.c b/src/pk-plugin-no-update-process.c
new file mode 100644
index 0000000..82106f2
--- /dev/null
+++ b/src/pk-plugin-no-update-process.c
@@ -0,0 +1,252 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+#include <gio/gio.h>
+#include <pk-transaction.h>
+
+#include <packagekit-glib2/pk-package.h>
+#include <packagekit-glib2/pk-files.h>
+
+#include "pk-proc.h"
+
+typedef struct {
+ GMainLoop *loop;
+ GPtrArray *files_list;
+ gchar **no_update_process_list;
+ PkProc *proc;
+} PluginPrivate;
+
+static PluginPrivate *priv;
+
+/**
+ * pk_transaction_plugin_get_description:
+ */
+const gchar *
+pk_transaction_plugin_get_description (void)
+{
+ return "Updates the package lists after refresh";
+}
+
+/**
+ * pk_plugin_finished_cb:
+ **/
+static void
+pk_plugin_finished_cb (PkBackend *backend,
+ PkExitEnum exit_enum,
+ gpointer user_data)
+{
+ if (!g_main_loop_is_running (priv->loop))
+ return;
+ if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
+ g_warning ("%s failed with exit code: %s",
+ pk_role_enum_to_string (pk_backend_get_role (backend)),
+ pk_exit_enum_to_string (exit_enum));
+ }
+ g_main_loop_quit (priv->loop);
+}
+
+/**
+ * pk_transaction_plugin_initialize:
+ */
+void
+pk_transaction_plugin_initialize (PkTransaction *transaction)
+{
+ PkConf *conf;
+
+ /* create private area */
+ priv = g_new0 (PluginPrivate, 1);
+ priv->loop = g_main_loop_new (NULL, FALSE);
+ priv->files_list = g_ptr_array_new_with_free_func (g_free);
+ priv->proc = pk_proc_new ();
+
+ /* get the list of processes we should neverupdate when running */
+ conf = pk_transaction_priv_get_conf (transaction);
+ priv->no_update_process_list = pk_conf_get_strv (conf, "NoUpdateProcessList");
+
+ g_debug ("plugin: initialize");
+}
+
+/**
+ * pk_transaction_plugin_destroy:
+ */
+void
+pk_transaction_plugin_destroy (PkTransaction *transaction)
+{
+ g_debug ("plugin: destroy");
+ g_main_loop_unref (priv->loop);
+ g_strfreev (priv->no_update_process_list);
+ g_ptr_array_unref (priv->files_list);
+ g_object_unref (priv->proc);
+ g_free (priv);
+}
+
+/**
+ * pk_plugin_match_running_file:
+ *
+ * Only if the pattern matches the old and new names we refuse to run
+ **/
+static gboolean
+pk_plugin_match_running_file (gpointer user_data, const gchar *filename)
+{
+ guint i;
+ gchar **list;
+ gboolean ret;
+
+ /* compare each pattern */
+ list = priv->no_update_process_list;
+ for (i=0; list[i] != NULL; i++) {
+
+ /* does the package filename match */
+ ret = g_pattern_match_simple (list[i], filename);
+ if (ret) {
+ /* is there a running process that also matches */
+ ret = pk_proc_find_exec (priv->proc, list[i]);
+ if (ret)
+ goto out;
+ }
+ }
+
+ /* we failed */
+ ret = FALSE;
+out:
+ return ret;
+}
+
+/**
+ * pk_plugin_files_cb:
+ **/
+static void
+pk_plugin_files_cb (PkBackend *backend,
+ PkFiles *files,
+ gpointer user_data)
+{
+ guint i;
+ guint len;
+ gboolean ret;
+ gchar **filenames = NULL;
+
+ /* get data */
+ g_object_get (files,
+ "files", &filenames,
+ NULL);
+
+ /* check each file to see if it's a system shared library */
+ len = g_strv_length (filenames);
+ g_debug ("len=%i", len);
+ for (i=0; i<len; i++) {
+
+ /* does the package filename match */
+ ret = pk_plugin_match_running_file (backend, filenames[i]);
+ if (!ret)
+ continue;
+
+ /* add as it matches the criteria */
+ g_debug ("adding filename %s", filenames[i]);
+ g_ptr_array_add (priv->files_list, g_strdup (filenames[i]));
+ }
+ g_strfreev (filenames);
+}
+
+/**
+ * pk_transaction_plugin_run:
+ */
+void
+pk_transaction_plugin_run (PkTransaction *transaction)
+{
+ const gchar *file;
+ gboolean ret;
+ gchar **files = NULL;
+ gchar **package_ids;
+ gchar *process = NULL;
+ guint files_id = 0;
+ guint finished_id = 0;
+ PkBackend *backend = NULL;
+ PkRoleEnum role;
+
+ /* check the role */
+ role = pk_transaction_priv_get_role (transaction);
+ if (role != PK_ROLE_ENUM_UPDATE_PACKAGES)
+ goto out;
+
+ /* check we can do the action */
+ backend = pk_transaction_priv_get_backend (transaction);
+ if (!pk_backend_is_implemented (backend,
+ PK_ROLE_ENUM_GET_FILES)) {
+ g_debug ("cannot get files");
+ goto out;
+ }
+
+ /* check we have entry */
+ if (priv->no_update_process_list == NULL ||
+ priv->no_update_process_list[0] == NULL) {
+ g_debug ("no processes to watch");
+ goto out;
+ }
+
+ /* reset */
+ g_ptr_array_set_size (priv->files_list, 0);
+
+ /* set status */
+ pk_backend_set_status (backend, PK_STATUS_ENUM_SCAN_PROCESS_LIST);
+ pk_backend_set_percentage (backend, 101);
+
+ /* get list from proc */
+ ret = pk_proc_refresh (priv->proc);
+ if (!ret) {
+ g_warning ("failed to refresh");
+ /* non-fatal */
+ goto out;
+ }
+
+ /* set status */
+ pk_backend_set_status (backend, PK_STATUS_ENUM_CHECK_EXECUTABLE_FILES);
+
+ files_id = g_signal_connect (backend, "files",
+ G_CALLBACK (pk_plugin_files_cb), NULL);
+ finished_id = g_signal_connect (backend, "finished",
+ G_CALLBACK (pk_plugin_finished_cb), NULL);
+
+ /* get all the files touched in the packages we just updated */
+ package_ids = pk_transaction_priv_get_package_ids (transaction);
+ pk_backend_reset (backend);
+ pk_backend_get_files (backend, package_ids);
+
+ /* wait for finished */
+ g_main_loop_run (priv->loop);
+ pk_backend_set_percentage (backend, 100);
+
+ /* there is a file we can't COW */
+ if (priv->files_list->len != 0) {
+ file = g_ptr_array_index (priv->files_list, 0);
+ pk_backend_error_code (backend,
+ PK_ERROR_ENUM_UPDATE_FAILED_DUE_TO_RUNNING_PROCESS,
+ "failed to run as %s is running", file);
+ goto out;
+ }
+out:
+ if (files_id > 0)
+ g_signal_handler_disconnect (backend, files_id);
+ if (finished_id > 0)
+ g_signal_handler_disconnect (backend, finished_id);
+ g_strfreev (files);
+ g_free (process);
+}
diff --git a/src/pk-transaction-extra.c b/src/pk-transaction-extra.c
index 127fcb6..7e01a79 100644
--- a/src/pk-transaction-extra.c
+++ b/src/pk-transaction-extra.c
@@ -60,7 +60,6 @@ struct PkTransactionExtraPrivate
PkConf *conf;
guint finished_id;
guint package_id;
- gchar **no_update_process_list;
GHashTable *hash;
GPtrArray *files_list;
GPtrArray *pids;
@@ -821,145 +820,6 @@ out:
}
/**
- * pk_transaction_extra_match_running_file:
- *
- * Only if the pattern matches the old and new names we refuse to run
- **/
-static gboolean
-pk_transaction_extra_match_running_file (PkTransactionExtra *extra, const gchar *filename)
-{
- guint i;
- gchar **list;
- gboolean ret;
-
- /* compare each pattern */
- list = extra->priv->no_update_process_list;
- for (i=0; list[i] != NULL; i++) {
-
- /* does the package filename match */
- ret = g_pattern_match_simple (list[i], filename);
- if (ret) {
- /* is there a running process that also matches */
- ret = pk_proc_find_exec (extra->priv->proc, list[i]);
- if (ret)
- goto out;
- }
- }
-
- /* we failed */
- ret = FALSE;
-out:
- return ret;
-}
-
-/**
- * pk_transaction_extra_files_check_applications_are_running_cb:
- **/
-static void
-pk_transaction_extra_files_check_applications_are_running_cb (PkBackend *backend, PkFiles *files, PkTransactionExtra *extra)
-{
- guint i;
- guint len;
- gboolean ret;
- gchar **filenames = NULL;
-
- /* get data */
- g_object_get (files,
- "files", &filenames,
- NULL);
-
- /* check each file to see if it's a system shared library */
- len = g_strv_length (filenames);
- g_debug ("len=%i", len);
- for (i=0; i<len; i++) {
-
- /* does the package filename match */
- ret = pk_transaction_extra_match_running_file (extra, filenames[i]);
- if (!ret)
- continue;
-
- /* add as it matches the criteria */
- g_debug ("adding filename %s", filenames[i]);
- g_ptr_array_add (extra->priv->files_list, g_strdup (filenames[i]));
- }
- g_strfreev (filenames);
-}
-
-/**
- * pk_transaction_extra_applications_are_running:
- **/
-gboolean
-pk_transaction_extra_applications_are_running (PkTransactionExtra *extra, gchar **package_ids, GError **error)
-{
- gboolean ret = TRUE;
- const gchar *file;
- gchar **files = NULL;
- gchar *process = NULL;
- guint signal_files = 0;
-
- g_return_val_if_fail (PK_IS_POST_TRANS (extra), FALSE);
- g_return_val_if_fail (package_ids != NULL, FALSE);
-
- if (!pk_backend_is_implemented (extra->priv->backend, PK_ROLE_ENUM_GET_FILES)) {
- g_debug ("cannot get files");
- /* return success, as we're not setting an error */
- return TRUE;
- }
-
- /* check we have entry */
- if (extra->priv->no_update_process_list == NULL ||
- extra->priv->no_update_process_list[0] == NULL) {
- g_debug ("no processes to watch");
- /* return success, as we're not setting an error */
- return TRUE;
- }
-
- /* reset */
- g_ptr_array_set_size (extra->priv->files_list, 0);
-
- /* set status */
- pk_transaction_extra_set_status_changed (extra, PK_STATUS_ENUM_SCAN_PROCESS_LIST);
- pk_transaction_extra_set_progress_changed (extra, 101);
-
- /* get list from proc */
- ret = pk_proc_refresh (extra->priv->proc);
- if (!ret) {
- g_warning ("failed to refresh");
- /* non-fatal */
- ret = TRUE;
- goto out;
- }
-
- /* set status */
- pk_transaction_extra_set_status_changed (extra, PK_STATUS_ENUM_CHECK_EXECUTABLE_FILES);
-
- signal_files = g_signal_connect (extra->priv->backend, "files",
- G_CALLBACK (pk_transaction_extra_files_check_applications_are_running_cb), extra);
-
- /* get all the files touched in the packages we just updated */
- pk_backend_reset (extra->priv->backend);
- pk_backend_get_files (extra->priv->backend, package_ids);
-
- /* wait for finished */
- g_main_loop_run (extra->priv->loop);
-
- /* there is a file we can't COW */
- if (extra->priv->files_list->len != 0) {
- file = g_ptr_array_index (extra->priv->files_list, 0);
- g_set_error (error, 1, 0, "failed to run as %s is running", file);
- ret = FALSE;
- goto out;
- }
-out:
- pk_transaction_extra_set_progress_changed (extra, 100);
- if (signal_files > 0)
- g_signal_handler_disconnect (extra->priv->backend, signal_files);
- g_strfreev (files);
- g_free (process);
- return ret;
-}
-
-/**
* pk_transaction_extra_check_library_restart_pre:
* @package_ids: the list of security updates
*
@@ -1073,7 +933,6 @@ pk_transaction_extra_finalize (GObject *object)
sqlite3_close (extra->priv->db);
g_hash_table_unref (extra->priv->hash);
g_ptr_array_unref (extra->priv->files_list);
- g_strfreev (extra->priv->no_update_process_list);
g_object_unref (extra->priv->backend);
g_object_unref (extra->priv->lsof);
@@ -1139,9 +998,6 @@ pk_transaction_extra_init (PkTransactionExtra *extra)
g_signal_connect (extra->priv->backend, "package",
G_CALLBACK (pk_transaction_extra_package_cb), extra);
- /* get the list of processes we should neverupdate when running */
- extra->priv->no_update_process_list = pk_conf_get_strv (extra->priv->conf, "NoUpdateProcessList");
-
/* check if exists */
ret = g_file_test (PK_DESKTOP_DEFAULT_DATABASE, G_FILE_TEST_EXISTS);
diff --git a/src/pk-transaction-extra.h b/src/pk-transaction-extra.h
index ce232f5..cd61fe6 100644
--- a/src/pk-transaction-extra.h
+++ b/src/pk-transaction-extra.h
@@ -57,9 +57,6 @@ gboolean pk_transaction_extra_check_desktop_files (PkTransactionExtra *extra,
gboolean pk_transaction_extra_check_library_restart (PkTransactionExtra *extra);
gboolean pk_transaction_extra_check_library_restart_pre (PkTransactionExtra *extra,
gchar **package_ids);
-gboolean pk_transaction_extra_applications_are_running (PkTransactionExtra *extra,
- gchar **package_ids,
- GError **error);
G_END_DECLS
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 3661778..ae02d25 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -941,6 +941,15 @@ pk_transaction_priv_get_backend (PkTransaction *transaction)
}
/**
+ * pk_transaction_priv_get_package_ids:
+ **/
+gchar **
+pk_transaction_priv_get_package_ids (PkTransaction *transaction)
+{
+ return transaction->priv->cached_package_ids;
+}
+
+/**
* pk_transaction_finished_cb:
**/
static void
@@ -1726,13 +1735,6 @@ pk_transaction_pre_transaction_checks (PkTransaction *transaction, gchar **packa
PkInfoEnum info;
PkTransactionPrivate *priv = transaction->priv;
- /* only do this for update actions, FIXME: need to get cached updtae list for update */
- if (priv->role == PK_ROLE_ENUM_UPDATE_PACKAGES) {
- success = pk_transaction_extra_applications_are_running (priv->transaction_extra, package_ids, error);
- if (!success)
- goto out;
- }
-
/* check we have anything to process */
if (package_ids == NULL) {
g_debug ("no package_ids for %s", pk_role_enum_to_string (priv->role));
@@ -1972,6 +1974,19 @@ pk_transaction_set_running (PkTransaction *transaction)
pk_backend_set_status (priv->backend, PK_STATUS_ENUM_SETUP);
pk_transaction_status_changed_emit (transaction, PK_STATUS_ENUM_SETUP);
+ /* run the plugins */
+ pk_transaction_plugin_phase (transaction,
+ PK_TRANSACTION_PLUGIN_PHASE_RUN);
+
+ /* is an error code set? */
+ if (pk_backend_get_is_error_set (priv->backend)) {
+ pk_transaction_finished_emit (transaction, PK_EXIT_ENUM_FAILED, 0);
+
+ /* do not fail the tranaction */
+ ret = TRUE;
+ goto out;
+ }
+
/* do any pre transaction checks */
ret = pk_transaction_pre_transaction_checks (transaction, priv->cached_package_ids, &error);
if (!ret) {
@@ -2166,10 +2181,6 @@ pk_transaction_run (PkTransaction *transaction)
g_return_val_if_fail (PK_IS_TRANSACTION (transaction), FALSE);
g_return_val_if_fail (transaction->priv->tid != NULL, FALSE);
- /* run the plugins */
- pk_transaction_plugin_phase (transaction,
- PK_TRANSACTION_PLUGIN_PHASE_RUN);
-
ret = pk_transaction_set_running (transaction);
return ret;
}
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index e86559d..1d6d76f 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -104,6 +104,7 @@ void pk_transaction_priv_cancel_bg (PkTransaction *transaction);
PkRoleEnum pk_transaction_priv_get_role (PkTransaction *transaction);
PkConf *pk_transaction_priv_get_conf (PkTransaction *transaction);
PkBackend *pk_transaction_priv_get_backend (PkTransaction *transaction);
+gchar **pk_transaction_priv_get_package_ids (PkTransaction *transaction);
PkTransactionState pk_transaction_get_state (PkTransaction *transaction);
gboolean pk_transaction_set_state (PkTransaction *transaction,
PkTransactionState state);
commit ead279b92414d6c4a2fd3d9cdd0bab47108a22c6
Author: Richard Hughes <richard at hughsie.com>
Date: Sat Jul 9 10:08:12 2011 +0100
Move the updating of the package list into a plugin
diff --git a/src/Makefile.am b/src/Makefile.am
index da2a9b8..e793da0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -224,6 +224,7 @@ CLEANFILES = *~ $(BUILT_SOURCES)
plugindir = $(LIBDIR)/packagekit-plugins
plugin_LTLIBRARIES = \
libpk_plugin_scripts.la \
+ libpk_plugin-update-package-list.la \
libpk-plugin-clear-firmware-requests.la
libpk_plugin_scripts_la_SOURCES = pk-plugin-scripts.c
@@ -236,4 +237,9 @@ libpk_plugin_clear_firmware_requests_la_LIBADD = $(PK_PLUGIN_LIBS)
libpk_plugin_clear_firmware_requests_la_LDFLAGS = -module -avoid-version
libpk_plugin_clear_firmware_requests_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+libpk_plugin_update_package_list_la_SOURCES = pk-plugin-update-package-list.c
+libpk_plugin_update_package_list_la_LIBADD = $(PK_PLUGIN_LIBS)
+libpk_plugin_update_package_list_la_LDFLAGS = -module -avoid-version
+libpk_plugin_update_package_list_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+
-include $(top_srcdir)/git.mk
diff --git a/src/pk-plugin-update-package-list.c b/src/pk-plugin-update-package-list.c
new file mode 100644
index 0000000..1e27575
--- /dev/null
+++ b/src/pk-plugin-update-package-list.c
@@ -0,0 +1,215 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+#include <gio/gio.h>
+#include <pk-transaction.h>
+#include <packagekit-glib2/pk-package.h>
+
+typedef struct {
+ GPtrArray *list;
+ GMainLoop *loop;
+} PluginPrivate;
+
+static PluginPrivate *priv;
+
+/**
+ * pk_transaction_plugin_get_description:
+ */
+const gchar *
+pk_transaction_plugin_get_description (void)
+{
+ return "Updates the package lists after refresh";
+}
+
+/**
+ * pk_plugin_package_cb:
+ **/
+static void
+pk_plugin_package_cb (PkBackend *backend,
+ PkPackage *package,
+ gpointer user_data)
+{
+ g_ptr_array_add (priv->list, g_object_ref (package));
+}
+
+/**
+ * pk_plugin_finished_cb:
+ **/
+static void
+pk_plugin_finished_cb (PkBackend *backend,
+ PkExitEnum exit_enum,
+ gpointer user_data)
+{
+ if (!g_main_loop_is_running (priv->loop))
+ return;
+ if (exit_enum != PK_EXIT_ENUM_SUCCESS) {
+ g_warning ("%s failed with exit code: %s",
+ pk_role_enum_to_string (pk_backend_get_role (backend)),
+ pk_exit_enum_to_string (exit_enum));
+ }
+ g_main_loop_quit (priv->loop);
+}
+
+/**
+ * pk_transaction_plugin_initialize:
+ */
+void
+pk_transaction_plugin_initialize (PkTransaction *transaction)
+{
+ /* create private area */
+ priv = g_new0 (PluginPrivate, 1);
+ priv->loop = g_main_loop_new (NULL, FALSE);
+ priv->list = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
+
+ g_debug ("plugin: initialize");
+}
+
+/**
+ * pk_transaction_plugin_destroy:
+ */
+void
+pk_transaction_plugin_destroy (PkTransaction *transaction)
+{
+ g_debug ("plugin: destroy");
+ g_ptr_array_unref (priv->list);
+ g_main_loop_unref (priv->loop);
+ g_free (priv);
+}
+
+
+/**
+ * pk_plugin_package_list_to_string:
+ **/
+static gchar *
+pk_plugin_package_list_to_string (GPtrArray *array)
+{
+ guint i;
+ PkPackage *package;
+ GString *string;
+ PkInfoEnum info;
+ gchar *package_id;
+ gchar *summary;
+
+ string = g_string_new ("");
+ for (i=0; i<array->len; i++) {
+ package = g_ptr_array_index (array, i);
+ g_object_get (package,
+ "info", &info,
+ "package-id", &package_id,
+ "summary", &summary,
+ NULL);
+ g_string_append_printf (string, "%s\t%s\t%s\n",
+ pk_info_enum_to_string (info),
+ package_id,
+ summary);
+ g_free (package_id);
+ g_free (summary);
+ }
+
+ /* remove trailing newline */
+ if (string->len != 0)
+ g_string_set_size (string, string->len-1);
+ return g_string_free (string, FALSE);
+}
+
+/**
+ * pk_transaction_plugin_finished_end:
+ */
+void
+pk_transaction_plugin_finished_end (PkTransaction *transaction)
+{
+ gboolean ret;
+ gchar *data = NULL;
+ GError *error = NULL;
+ guint finished_id = 0;
+ guint package_id = 0;
+ PkBackend *backend = NULL;
+ PkConf *conf;
+ PkRoleEnum role;
+
+ /* check the config file */
+ conf = pk_transaction_priv_get_conf (transaction);
+ ret = pk_conf_get_bool (conf, "UpdatePackageList");
+ if (!ret)
+ goto out;
+
+ /* check the role */
+ role = pk_transaction_priv_get_role (transaction);
+ if (role != PK_ROLE_ENUM_REFRESH_CACHE)
+ goto out;
+
+ /* check we can do the action */
+ backend = pk_transaction_priv_get_backend (transaction);
+ if (!pk_backend_is_implemented (backend,
+ PK_ROLE_ENUM_GET_PACKAGES)) {
+ g_debug ("cannot get packages");
+ goto out;
+ }
+
+ /* connect to backend */
+ backend = pk_transaction_priv_get_backend (transaction);
+ finished_id = g_signal_connect (backend, "finished",
+ G_CALLBACK (pk_plugin_finished_cb), NULL);
+ package_id = g_signal_connect (backend, "package",
+ G_CALLBACK (pk_plugin_package_cb), NULL);
+
+ g_debug ("plugin: updating package lists");
+
+ /* clear old list */
+ if (priv->list->len > 0)
+ g_ptr_array_set_size (priv->list, 0);
+
+ /* update UI */
+ pk_backend_set_status (backend,
+ PK_STATUS_ENUM_GENERATE_PACKAGE_LIST);
+ pk_backend_set_percentage (backend, 101);
+
+ /* get the new package list */
+ pk_backend_reset (backend);
+ pk_backend_get_packages (backend, PK_FILTER_ENUM_NONE);
+
+ /* wait for finished */
+ g_main_loop_run (priv->loop);
+
+ /* update UI */
+ pk_backend_set_percentage (backend, 90);
+
+ /* convert to a file */
+ data = pk_plugin_package_list_to_string (priv->list);
+ ret = g_file_set_contents (PK_SYSTEM_PACKAGE_LIST_FILENAME,
+ data, -1, &error);
+ if (!ret) {
+ g_warning ("failed to save to file: %s",
+ error->message);
+ g_error_free (error);
+ }
+
+ /* update UI */
+ pk_backend_set_percentage (backend, 100);
+ pk_backend_set_status (backend, PK_STATUS_ENUM_FINISHED);
+out:
+ if (backend != NULL) {
+ g_signal_handler_disconnect (backend, finished_id);
+ g_signal_handler_disconnect (backend, package_id);
+ }
+ g_free (data);
+}
diff --git a/src/pk-transaction-extra.c b/src/pk-transaction-extra.c
index 32d5f24..127fcb6 100644
--- a/src/pk-transaction-extra.c
+++ b/src/pk-transaction-extra.c
@@ -448,91 +448,6 @@ pk_transaction_extra_import_desktop_files (PkTransactionExtra *extra)
}
/**
- * pk_transaction_extra_package_list_to_string:
- **/
-static gchar *
-pk_transaction_extra_package_list_to_string (GPtrArray *array)
-{
- guint i;
- PkPackage *package;
- GString *string;
- PkInfoEnum info;
- gchar *package_id;
- gchar *summary;
-
- string = g_string_new ("");
- for (i=0; i<array->len; i++) {
- package = g_ptr_array_index (array, i);
- g_object_get (package,
- "info", &info,
- "package-id", &package_id,
- "summary", &summary,
- NULL);
- g_string_append_printf (string, "%s\t%s\t%s\n", pk_info_enum_to_string (info), package_id, summary);
- g_free (package_id);
- g_free (summary);
- }
-
- /* remove trailing newline */
- if (string->len != 0)
- g_string_set_size (string, string->len-1);
- return g_string_free (string, FALSE);
-}
-
-/**
- * pk_transaction_extra_update_package_list:
- **/
-gboolean
-pk_transaction_extra_update_package_list (PkTransactionExtra *extra)
-{
- gboolean ret;
- gchar *data = NULL;
- GError *error = NULL;
-
- g_return_val_if_fail (PK_IS_POST_TRANS (extra), FALSE);
-
- if (!pk_backend_is_implemented (extra->priv->backend, PK_ROLE_ENUM_GET_PACKAGES)) {
- g_debug ("cannot get packages");
- return FALSE;
- }
-
- g_debug ("updating package lists");
-
- /* clear old list */
- if (extra->priv->list->len > 0)
- g_ptr_array_remove_range (extra->priv->list, 0, extra->priv->list->len);
-
- /* update UI */
- pk_transaction_extra_set_status_changed (extra, PK_STATUS_ENUM_GENERATE_PACKAGE_LIST);
- pk_transaction_extra_set_progress_changed (extra, 101);
-
- /* get the new package list */
- pk_backend_reset (extra->priv->backend);
- pk_backend_get_packages (extra->priv->backend, PK_FILTER_ENUM_NONE);
-
- /* wait for finished */
- g_main_loop_run (extra->priv->loop);
-
- /* update UI */
- pk_transaction_extra_set_progress_changed (extra, 90);
-
- /* convert to a file */
- data = pk_transaction_extra_package_list_to_string (extra->priv->list);
- ret = g_file_set_contents (PK_SYSTEM_PACKAGE_LIST_FILENAME, data, -1, &error);
- if (!ret) {
- g_warning ("failed to save to file: %s", error->message);
- g_error_free (error);
- }
-
- /* update UI */
- pk_transaction_extra_set_progress_changed (extra, 100);
- pk_transaction_extra_set_status_changed (extra, PK_STATUS_ENUM_FINISHED);
-
- g_free (data);
- return ret;
-}
-
-/**
* pk_transaction_extra_update_files_check_running_cb:
**/
static void
diff --git a/src/pk-transaction-extra.h b/src/pk-transaction-extra.h
index 6f3f380..ce232f5 100644
--- a/src/pk-transaction-extra.h
+++ b/src/pk-transaction-extra.h
@@ -49,7 +49,6 @@ typedef struct
GType pk_transaction_extra_get_type (void);
PkTransactionExtra *pk_transaction_extra_new (void);
-gboolean pk_transaction_extra_update_package_list (PkTransactionExtra *extra);
gboolean pk_transaction_extra_import_desktop_files (PkTransactionExtra *extra);
gboolean pk_transaction_extra_check_running_process (PkTransactionExtra *extra,
gchar **package_ids);
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index c684cc6..3661778 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -1118,11 +1118,6 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
if (exit_enum == PK_EXIT_ENUM_SUCCESS &&
transaction->priv->role == PK_ROLE_ENUM_REFRESH_CACHE) {
- /* generate the package list */
- ret = pk_conf_get_bool (transaction->priv->conf, "UpdatePackageList");
- if (ret)
- pk_transaction_extra_update_package_list (transaction->priv->transaction_extra);
-
/* refresh the desktop icon cache */
ret = pk_conf_get_bool (transaction->priv->conf, "ScanDesktopFiles");
if (ret)
commit 36857a1381d31ff56b67d9fcedcda68515b19036
Author: Richard Hughes <richard at hughsie.com>
Date: Sat Jul 9 10:07:10 2011 +0100
Split the post-transaction plugin phase into 3 phases
This allows us to grab the various transaction objects before we destroy them in
other plugins.
diff --git a/src/pk-plugin-clear-firmware-requests.c b/src/pk-plugin-clear-firmware-requests.c
index b354033..a7fdfc9 100644
--- a/src/pk-plugin-clear-firmware-requests.c
+++ b/src/pk-plugin-clear-firmware-requests.c
@@ -35,10 +35,10 @@ pk_transaction_plugin_get_description (void)
}
/**
- * pk_transaction_plugin_transaction_post:
+ * pk_transaction_plugin_finished_end:
*/
void
-pk_transaction_plugin_transaction_post (PkTransaction *transaction)
+pk_transaction_plugin_finished_end (PkTransaction *transaction)
{
gboolean ret;
gchar *filename = NULL;
diff --git a/src/pk-plugin-example.c b/src/pk-plugin-example.c
index 9484fd1..45b7a51 100644
--- a/src/pk-plugin-example.c
+++ b/src/pk-plugin-example.c
@@ -62,19 +62,37 @@ pk_transaction_plugin_destroy (PkTransaction *transaction)
}
/**
- * pk_transaction_plugin_transaction_pre:
+ * pk_transaction_plugin_run:
*/
void
-pk_transaction_plugin_transaction_pre (PkTransaction *transaction)
+pk_transaction_plugin_run (PkTransaction *transaction)
{
- g_debug ("plugin: pre");
+ g_debug ("plugin: run");
}
/**
- * pk_transaction_plugin_transaction_post:
+ * pk_transaction_plugin_finished_start:
*/
void
-pk_transaction_plugin_transaction_post (PkTransaction *transaction)
+pk_transaction_plugin_finished_start (PkTransaction *transaction)
{
- g_debug ("plugin: post");
+ g_debug ("plugin: finished-start");
+}
+
+/**
+ * pk_transaction_plugin_finished_results:
+ */
+void
+pk_transaction_plugin_finished_results (PkTransaction *transaction)
+{
+ g_debug ("plugin: finished-results");
+}
+
+/**
+ * pk_transaction_plugin_finished_end:
+ */
+void
+pk_transaction_plugin_finished_end (PkTransaction *transaction)
+{
+ g_debug ("plugin: finished-end");
}
diff --git a/src/pk-plugin-scripts.c b/src/pk-plugin-scripts.c
index a0ae788..58debf2 100644
--- a/src/pk-plugin-scripts.c
+++ b/src/pk-plugin-scripts.c
@@ -138,20 +138,20 @@ out:
}
/**
- * pk_transaction_plugin_transaction_pre:
+ * pk_transaction_plugin_run:
*/
void
-pk_transaction_plugin_transaction_pre (PkTransaction *transaction)
+pk_transaction_plugin_run (PkTransaction *transaction)
{
pk_transaction_process_scripts (transaction,
"pre-transaction.d");
}
/**
- * pk_transaction_plugin_transaction_post:
+ * pk_transaction_plugin_finished_end:
*/
void
-pk_transaction_plugin_transaction_post (PkTransaction *transaction)
+pk_transaction_plugin_finished_end (PkTransaction *transaction)
{
pk_transaction_process_scripts (transaction,
"post-transaction.d");
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 344194d..c684cc6 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -170,8 +170,10 @@ struct PkTransactionPrivate
typedef enum {
PK_TRANSACTION_PLUGIN_PHASE_INIT,
- PK_TRANSACTION_PLUGIN_PHASE_PRE,
- PK_TRANSACTION_PLUGIN_PHASE_POST,
+ PK_TRANSACTION_PLUGIN_PHASE_RUN,
+ PK_TRANSACTION_PLUGIN_PHASE_FINISHED_START,
+ PK_TRANSACTION_PLUGIN_PHASE_FINISHED_RESULTS,
+ PK_TRANSACTION_PLUGIN_PHASE_FINISHED_END,
PK_TRANSACTION_PLUGIN_PHASE_UNKNOWN
} PkTransactionPluginPhase;
@@ -887,11 +889,17 @@ pk_transaction_plugin_phase (PkTransaction *transaction,
case PK_TRANSACTION_PLUGIN_PHASE_INIT:
function = "pk_transaction_plugin_initialize";
break;
- case PK_TRANSACTION_PLUGIN_PHASE_PRE:
- function = "pk_transaction_plugin_transaction_pre";
+ case PK_TRANSACTION_PLUGIN_PHASE_RUN:
+ function = "pk_transaction_plugin_run";
break;
- case PK_TRANSACTION_PLUGIN_PHASE_POST:
- function = "pk_transaction_plugin_transaction_post";
+ case PK_TRANSACTION_PLUGIN_PHASE_FINISHED_START:
+ function = "pk_transaction_plugin_finished_start";
+ break;
+ case PK_TRANSACTION_PLUGIN_PHASE_FINISHED_RESULTS:
+ function = "pk_transaction_plugin_finished_results";
+ break;
+ case PK_TRANSACTION_PLUGIN_PHASE_FINISHED_END:
+ function = "pk_transaction_plugin_finished_end";
break;
default:
break;
@@ -960,20 +968,41 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
return;
}
- /* disconnect these straight away, as the PkTransaction object takes time to timeout */
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_details);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_error_code);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_files);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_distro_upgrade);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_finished);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_package);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_repo_detail);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_repo_signature_required);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_eula_required);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_media_change_required);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_update_detail);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_category);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_speed);
+ /* run the plugins */
+ pk_transaction_plugin_phase (transaction,
+ PK_TRANSACTION_PLUGIN_PHASE_FINISHED_START);
+
+ /* disconnect these straight away */
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_details);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_error_code);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_files);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_distro_upgrade);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_finished);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_package);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_repo_detail);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_repo_signature_required);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_eula_required);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_media_change_required);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_update_detail);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_category);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_speed);
+
+ /* run the plugins */
+ pk_transaction_plugin_phase (transaction,
+ PK_TRANSACTION_PLUGIN_PHASE_FINISHED_RESULTS);
/* check for session restarts */
if (exit_enum == PK_EXIT_ENUM_SUCCESS &&
@@ -1074,11 +1103,16 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
}
/* signals we are not allowed to send from the second phase post transaction */
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_allow_cancel);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_message);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_status_changed);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_progress_changed);
- g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_require_restart);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_allow_cancel);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_message);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_status_changed);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_progress_changed);
+ g_signal_handler_disconnect (transaction->priv->backend,
+ transaction->priv->signal_require_restart);
/* do some optional extra actions when we've finished refreshing the cache */
if (exit_enum == PK_EXIT_ENUM_SUCCESS &&
@@ -1097,7 +1131,7 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
/* run the plugins */
pk_transaction_plugin_phase (transaction,
- PK_TRANSACTION_PLUGIN_PHASE_POST);
+ PK_TRANSACTION_PLUGIN_PHASE_FINISHED_END);
/* save this so we know if the cache is valid */
pk_results_set_exit_code (transaction->priv->results, exit_enum);
@@ -2139,7 +2173,7 @@ pk_transaction_run (PkTransaction *transaction)
/* run the plugins */
pk_transaction_plugin_phase (transaction,
- PK_TRANSACTION_PLUGIN_PHASE_PRE);
+ PK_TRANSACTION_PLUGIN_PHASE_RUN);
ret = pk_transaction_set_running (transaction);
return ret;
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index 7e36284..e86559d 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -260,8 +260,10 @@ typedef void (*PkTransactionPluginFunc) (PkTransaction *transaction);
const gchar *pk_transaction_plugin_get_description (void);
void pk_transaction_plugin_initialize (PkTransaction *transaction);
void pk_transaction_plugin_destroy (PkTransaction *transaction);
-void pk_transaction_plugin_transaction_pre (PkTransaction *transaction);
-void pk_transaction_plugin_transaction_post (PkTransaction *transaction);
+void pk_transaction_plugin_run (PkTransaction *transaction);
+void pk_transaction_plugin_finished_start (PkTransaction *transaction);
+void pk_transaction_plugin_finished_results (PkTransaction *transaction);
+void pk_transaction_plugin_finished_end (PkTransaction *transaction);
G_END_DECLS
commit 75ef6ac1f6bf489e08f4dd2144b2f94e8d9915da
Author: Richard Hughes <richard at hughsie.com>
Date: Sat Jul 9 10:04:07 2011 +0100
trivial: Add some accessors for different objects from plugins
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index d7f2db7..344194d 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -915,6 +915,24 @@ pk_transaction_plugin_phase (PkTransaction *transaction,
}
/**
+ * pk_transaction_priv_get_conf:
+ **/
+PkConf *
+pk_transaction_priv_get_conf (PkTransaction *transaction)
+{
+ return transaction->priv->conf;
+}
+
+/**
+ * pk_transaction_priv_get_backend:
+ **/
+PkBackend *
+pk_transaction_priv_get_backend (PkTransaction *transaction)
+{
+ return transaction->priv->backend;
+}
+
+/**
* pk_transaction_finished_cb:
**/
static void
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index 636bb77..7e36284 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -26,6 +26,9 @@
#include <dbus/dbus-glib.h>
#include <packagekit-glib2/pk-enum.h>
+#include "pk-conf.h"
+#include "pk-backend.h"
+
G_BEGIN_DECLS
#define PK_TYPE_TRANSACTION (pk_transaction_get_type ())
@@ -99,6 +102,8 @@ gboolean pk_transaction_run (PkTransaction *transaction)
/* internal status */
void pk_transaction_priv_cancel_bg (PkTransaction *transaction);
PkRoleEnum pk_transaction_priv_get_role (PkTransaction *transaction);
+PkConf *pk_transaction_priv_get_conf (PkTransaction *transaction);
+PkBackend *pk_transaction_priv_get_backend (PkTransaction *transaction);
PkTransactionState pk_transaction_get_state (PkTransaction *transaction);
gboolean pk_transaction_set_state (PkTransaction *transaction,
PkTransactionState state);
commit 6d118111e3e11116d339ac4339eea9aefcf74fb7
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Jul 8 18:21:44 2011 +0100
Move the clearing firmware functionality into a plugin
diff --git a/src/Makefile.am b/src/Makefile.am
index 967450f..da2a9b8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -222,10 +222,18 @@ CLEANFILES = *~ $(BUILT_SOURCES)
# plugins
plugindir = $(LIBDIR)/packagekit-plugins
-plugin_LTLIBRARIES = libpk_plugin_scripts.la
+plugin_LTLIBRARIES = \
+ libpk_plugin_scripts.la \
+ libpk-plugin-clear-firmware-requests.la
+
libpk_plugin_scripts_la_SOURCES = pk-plugin-scripts.c
libpk_plugin_scripts_la_LIBADD = $(PK_PLUGIN_LIBS)
libpk_plugin_scripts_la_LDFLAGS = -module -avoid-version
libpk_plugin_scripts_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+libpk_plugin_clear_firmware_requests_la_SOURCES = pk-plugin-clear-firmware-requests.c
+libpk_plugin_clear_firmware_requests_la_LIBADD = $(PK_PLUGIN_LIBS)
+libpk_plugin_clear_firmware_requests_la_LDFLAGS = -module -avoid-version
+libpk_plugin_clear_firmware_requests_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
+
-include $(top_srcdir)/git.mk
diff --git a/src/pk-plugin-clear-firmware-requests.c b/src/pk-plugin-clear-firmware-requests.c
new file mode 100644
index 0000000..b354033
--- /dev/null
+++ b/src/pk-plugin-clear-firmware-requests.c
@@ -0,0 +1,59 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+#include <gio/gio.h>
+
+#include "pk-transaction.h"
+#include "pk-shared.h"
+
+/**
+ * pk_transaction_plugin_get_description:
+ */
+const gchar *
+pk_transaction_plugin_get_description (void)
+{
+ return "Clears firmware requests";
+}
+
+/**
+ * pk_transaction_plugin_transaction_post:
+ */
+void
+pk_transaction_plugin_transaction_post (PkTransaction *transaction)
+{
+ gboolean ret;
+ gchar *filename = NULL;
+ PkRoleEnum role;
+
+ role = pk_transaction_priv_get_role (transaction);
+ if (role != PK_ROLE_ENUM_REFRESH_CACHE)
+ goto out;
+
+ /* clear the firmware requests directory */
+ filename = g_build_filename (LOCALSTATEDIR, "run", "PackageKit", "udev", NULL);
+ g_debug ("clearing udev firmware requests at %s", filename);
+ ret = pk_directory_remove_contents (filename);
+ if (!ret)
+ g_warning ("failed to clear %s", filename);
+out:
+ g_free (filename);
+}
diff --git a/src/pk-transaction-extra.c b/src/pk-transaction-extra.c
index 659f206..32d5f24 100644
--- a/src/pk-transaction-extra.c
+++ b/src/pk-transaction-extra.c
@@ -533,27 +533,6 @@ pk_transaction_extra_update_package_list (PkTransactionExtra *extra)
}
/**
- * pk_transaction_extra_clear_firmware_requests:
- **/
-gboolean
-pk_transaction_extra_clear_firmware_requests (PkTransactionExtra *extra)
-{
- gboolean ret;
- gchar *filename;
-
- g_return_val_if_fail (PK_IS_POST_TRANS (extra), FALSE);
-
- /* clear the firmware requests directory */
- filename = g_build_filename (LOCALSTATEDIR, "run", "PackageKit", "udev", NULL);
- g_debug ("clearing udev firmware requests at %s", filename);
- ret = pk_directory_remove_contents (filename);
- if (!ret)
- g_warning ("failed to clear %s", filename);
- g_free (filename);
- return ret;
-}
-
-/**
* pk_transaction_extra_update_files_check_running_cb:
**/
static void
diff --git a/src/pk-transaction-extra.h b/src/pk-transaction-extra.h
index ebab8f0..6f3f380 100644
--- a/src/pk-transaction-extra.h
+++ b/src/pk-transaction-extra.h
@@ -49,7 +49,6 @@ typedef struct
GType pk_transaction_extra_get_type (void);
PkTransactionExtra *pk_transaction_extra_new (void);
-gboolean pk_transaction_extra_clear_firmware_requests (PkTransactionExtra *extra);
gboolean pk_transaction_extra_update_package_list (PkTransactionExtra *extra);
gboolean pk_transaction_extra_import_desktop_files (PkTransactionExtra *extra);
gboolean pk_transaction_extra_check_running_process (PkTransactionExtra *extra,
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 08a763e..d7f2db7 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -1075,9 +1075,6 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
ret = pk_conf_get_bool (transaction->priv->conf, "ScanDesktopFiles");
if (ret)
pk_transaction_extra_import_desktop_files (transaction->priv->transaction_extra);
-
- /* clear the firmware requests directory */
- pk_transaction_extra_clear_firmware_requests (transaction->priv->transaction_extra);
}
/* run the plugins */
commit 77f6dbd75e31313f3f1ddddef3951a1505d81b17
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Jul 8 17:58:26 2011 +0100
Add an example plugin that saves private state
diff --git a/src/pk-plugin-example.c b/src/pk-plugin-example.c
new file mode 100644
index 0000000..9484fd1
--- /dev/null
+++ b/src/pk-plugin-example.c
@@ -0,0 +1,80 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+#include <gio/gio.h>
+#include <pk-transaction.h>
+
+typedef struct {
+ guint dummy;
+} PluginPrivate;
+
+static PluginPrivate *priv;
+
+/**
+ * pk_transaction_plugin_get_description:
+ */
+const gchar *
+pk_transaction_plugin_get_description (void)
+{
+ return "A dummy plugin that doesn't do anything";
+}
+
+/**
+ * pk_transaction_plugin_initialize:
+ */
+void
+pk_transaction_plugin_initialize (PkTransaction *transaction)
+{
+ /* create private area */
+ priv = g_new0 (PluginPrivate, 1);
+ priv->dummy = 999;
+
+ g_debug ("plugin: initialize");
+}
+
+/**
+ * pk_transaction_plugin_destroy:
+ */
+void
+pk_transaction_plugin_destroy (PkTransaction *transaction)
+{
+ g_debug ("plugin: destroy");
+ g_free (priv);
+}
+
+/**
+ * pk_transaction_plugin_transaction_pre:
+ */
+void
+pk_transaction_plugin_transaction_pre (PkTransaction *transaction)
+{
+ g_debug ("plugin: pre");
+}
+
+/**
+ * pk_transaction_plugin_transaction_post:
+ */
+void
+pk_transaction_plugin_transaction_post (PkTransaction *transaction)
+{
+ g_debug ("plugin: post");
+}
commit 1915b0586cd24329a72a93c525c713b0a35ee1d2
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Jul 8 17:54:15 2011 +0100
Move the pre-transaction.d and post-transaction.d functionality into a plugin
diff --git a/src/Makefile.am b/src/Makefile.am
index 23c4728..967450f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -220,5 +220,12 @@ clean-local:
CLEANFILES = *~ $(BUILT_SOURCES)
+# plugins
+plugindir = $(LIBDIR)/packagekit-plugins
+plugin_LTLIBRARIES = libpk_plugin_scripts.la
+libpk_plugin_scripts_la_SOURCES = pk-plugin-scripts.c
+libpk_plugin_scripts_la_LIBADD = $(PK_PLUGIN_LIBS)
+libpk_plugin_scripts_la_LDFLAGS = -module -avoid-version
+libpk_plugin_scripts_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
-include $(top_srcdir)/git.mk
diff --git a/src/pk-plugin-scripts.c b/src/pk-plugin-scripts.c
new file mode 100644
index 0000000..a0ae788
--- /dev/null
+++ b/src/pk-plugin-scripts.c
@@ -0,0 +1,158 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+#include <gio/gio.h>
+#include <pk-transaction.h>
+
+/**
+ * pk_transaction_plugin_get_description:
+ */
+const gchar *
+pk_transaction_plugin_get_description (void)
+{
+ return "Runs external scrips";
+}
+
+/**
+ * pk_transaction_process_script:
+ **/
+static void
+pk_transaction_process_script (PkTransaction *transaction, const gchar *filename)
+{
+ GFile *file = NULL;
+ GFileInfo *info = NULL;
+ guint file_uid;
+ gchar *command = NULL;
+ gint exit_status = 0;
+ gboolean ret;
+ GError *error = NULL;
+ PkRoleEnum role;
+
+ /* get content type for file */
+ file = g_file_new_for_path (filename);
+ info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_UNIX_UID ","
+ G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &error);
+ if (info == NULL) {
+ g_warning ("failed to get info: %s", error->message);
+ goto out;
+ }
+
+ /* check is executable */
+ ret = g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE);
+ if (!ret) {
+ g_warning ("%s is not executable", filename);
+ goto out;
+ }
+
+ /* check is owned by the correct user */
+ file_uid = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_UID);
+ if (file_uid != 0) {
+ g_warning ("%s is not owned by the root user", filename);
+ goto out;
+ }
+
+ /* format the argument list */
+ role = pk_transaction_priv_get_role (transaction);
+ command = g_strdup_printf ("%s %s NOTAPISTABLE",
+ filename,
+ pk_role_enum_to_string (role));
+
+ /* run the command, but don't exit if fails */
+ ret = g_spawn_command_line_sync (command, NULL, NULL, &exit_status, &error);
+ if (!ret) {
+ g_warning ("failed to spawn %s [%i]: %s", command, exit_status, error->message);
+ g_error_free (error);
+ } else {
+ g_debug ("ran %s", command);
+ }
+
+out:
+ g_free (command);
+ if (info != NULL)
+ g_object_unref (info);
+ if (file != NULL)
+ g_object_unref (file);
+}
+
+/**
+ * pk_transaction_process_scripts:
+ *
+ * Run all scripts in a given directory
+ **/
+static void
+pk_transaction_process_scripts (PkTransaction *transaction, const gchar *location)
+{
+ GError *error = NULL;
+ gchar *filename;
+ gchar *dirname;
+ const gchar *file;
+ GDir *dir;
+
+ /* get location to search */
+ dirname = g_build_filename (SYSCONFDIR, "PackageKit", "events", location, NULL);
+ dir = g_dir_open (dirname, 0, &error);
+ if (dir == NULL) {
+ g_warning ("Failed to open %s: %s", dirname, error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* run scripts */
+ file = g_dir_read_name (dir);
+ while (file != NULL) {
+ filename = g_build_filename (dirname, file, NULL);
+
+ /* we put this here */
+ if (g_strcmp0 (file, "README") != 0) {
+ pk_transaction_process_script (transaction, filename);
+ }
+
+ g_free (filename);
+ file = g_dir_read_name (dir);
+ }
+out:
+ if (dir != NULL)
+ g_dir_close (dir);
+ g_free (dirname);
+}
+
+/**
+ * pk_transaction_plugin_transaction_pre:
+ */
+void
+pk_transaction_plugin_transaction_pre (PkTransaction *transaction)
+{
+ pk_transaction_process_scripts (transaction,
+ "pre-transaction.d");
+}
+
+/**
+ * pk_transaction_plugin_transaction_post:
+ */
+void
+pk_transaction_plugin_transaction_post (PkTransaction *transaction)
+{
+ pk_transaction_process_scripts (transaction,
+ "post-transaction.d");
+}
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index a37e771..08a763e 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -782,109 +782,6 @@ pk_transaction_package_list_to_string (GPtrArray *array)
}
/**
- * pk_transaction_process_script:
- **/
-static void
-pk_transaction_process_script (PkTransaction *transaction, const gchar *filename)
-{
- GFile *file = NULL;
- GFileInfo *info = NULL;
- guint file_uid;
- gchar *command = NULL;
- gint exit_status = 0;
- gboolean ret;
- GError *error = NULL;
-
- /* get content type for file */
- file = g_file_new_for_path (filename);
- info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_UNIX_UID ","
- G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE,
- G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &error);
- if (info == NULL) {
- g_warning ("failed to get info: %s", error->message);
- goto out;
- }
-
- /* check is executable */
- ret = g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE);
- if (!ret) {
- g_warning ("%s is not executable", filename);
- goto out;
- }
-
- /* check is owned by the correct user */
- file_uid = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_UID);
- if (file_uid != 0) {
- g_warning ("%s is not owned by the root user", filename);
- goto out;
- }
-
- /* format the argument list */
- command = g_strdup_printf ("%s %s NOTAPISTABLE",
- filename,
- pk_role_enum_to_string (transaction->priv->role));
-
- /* run the command, but don't exit if fails */
- ret = g_spawn_command_line_sync (command, NULL, NULL, &exit_status, &error);
- if (!ret) {
- g_warning ("failed to spawn %s [%i]: %s", command, exit_status, error->message);
- g_error_free (error);
- } else {
- g_debug ("ran %s", command);
- }
-
-out:
- g_free (command);
- if (info != NULL)
- g_object_unref (info);
- if (file != NULL)
- g_object_unref (file);
-}
-
-/**
- * pk_transaction_process_scripts:
- *
- * Run all scripts in a given directory
- **/
-static void
-pk_transaction_process_scripts (PkTransaction *transaction, const gchar *location)
-{
- GError *error = NULL;
- gchar *filename;
- gchar *dirname;
- const gchar *file;
- GDir *dir;
-
- /* get location to search */
- dirname = g_build_filename (SYSCONFDIR, "PackageKit", "events", location, NULL);
- dir = g_dir_open (dirname, 0, &error);
- if (dir == NULL) {
- g_warning ("Failed to open %s: %s", dirname, error->message);
- g_error_free (error);
- goto out;
- }
-
- /* run scripts */
- file = g_dir_read_name (dir);
- while (file != NULL) {
- filename = g_build_filename (dirname, file, NULL);
-
- /* we put this here */
- if (g_strcmp0 (file, "README") != 0) {
- pk_transaction_process_script (transaction, filename);
- }
-
- g_free (filename);
- file = g_dir_read_name (dir);
- }
-out:
- if (dir != NULL)
- g_dir_close (dir);
- g_free (dirname);
-}
-
-/**
* pk_transaction_state_to_string:
**/
const gchar *
@@ -1187,9 +1084,6 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
pk_transaction_plugin_phase (transaction,
PK_TRANSACTION_PLUGIN_PHASE_POST);
- /* do the post-transaction.d scripts */
- pk_transaction_process_scripts (transaction, "post-transaction.d");
-
/* save this so we know if the cache is valid */
pk_results_set_exit_code (transaction->priv->results, exit_enum);
@@ -2232,9 +2126,6 @@ pk_transaction_run (PkTransaction *transaction)
pk_transaction_plugin_phase (transaction,
PK_TRANSACTION_PLUGIN_PHASE_PRE);
- /* do the pre-transaction.d scripts */
- pk_transaction_process_scripts (transaction, "pre-transaction.d");
-
ret = pk_transaction_set_running (transaction);
return ret;
}
commit f8c316e8b471d9720a963a02b80dcb819936f93e
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Jul 8 17:52:24 2011 +0100
Add a transaction plugin infrastructure to packagekitd
The plan is to move the PkTransactionExtra hacks to proper plugins.
This also allows out-of-tree projects to add extensions to PackageKit.
diff --git a/contrib/PackageKit.spec.in b/contrib/PackageKit.spec.in
index c832b2b..29ccb36 100644
--- a/contrib/PackageKit.spec.in
+++ b/contrib/PackageKit.spec.in
@@ -271,6 +271,7 @@ make install DESTDIR=$RPM_BUILD_ROOT
rm -f $RPM_BUILD_ROOT%{_libdir}/libpackagekit*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/packagekit-backend/*.la
+rm -f $RPM_BUILD_ROOT%{_libdir}/packagekit-plugins/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/mozilla/plugins/packagekit-plugin.la
rm -f $RPM_BUILD_ROOT%{_libdir}/gtk-?.0/modules/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/polkit-1/extensions/libpackagekit-action-lookup.la
@@ -346,6 +347,7 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%ghost %verify(not md5 size mtime) %{_localstatedir}/lib/PackageKit/transactions.db
%{_datadir}/dbus-1/system-services/*.service
%{_libdir}/pm-utils/sleep.d/95packagekit
+%{_libdir}/packagekit-plugins/*.so
%files docs
%defattr(-,root,root,-)
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index d898ae4..a37e771 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -165,8 +165,16 @@ struct PkTransactionPrivate
guint signal_update_detail;
guint signal_category;
guint signal_speed;
+ GPtrArray *plugins;
};
+typedef enum {
+ PK_TRANSACTION_PLUGIN_PHASE_INIT,
+ PK_TRANSACTION_PLUGIN_PHASE_PRE,
+ PK_TRANSACTION_PLUGIN_PHASE_POST,
+ PK_TRANSACTION_PLUGIN_PHASE_UNKNOWN
+} PkTransactionPluginPhase;
+
enum {
SIGNAL_DETAILS,
SIGNAL_ERROR_CODE,
@@ -264,6 +272,100 @@ pk_transaction_error_get_type (void)
}
/**
+ * pk_transaction_load_plugin:
+ */
+static void
+pk_transaction_load_plugin (PkTransaction *transaction,
+ const gchar *filename)
+{
+ gboolean ret;
+ GModule *module;
+ PkTransactionPluginGetDescFunc plugin_desc = NULL;
+ PkTransactionPluginFunc plugin_func = NULL;
+
+ module = g_module_open (filename,
+ 0);
+ if (module == NULL) {
+ g_warning ("failed to open plugin %s: %s",
+ filename, g_module_error ());
+ goto out;
+ }
+
+ /* get description */
+ ret = g_module_symbol (module,
+ "pk_transaction_plugin_get_description",
+ (gpointer *) &plugin_desc);
+ if (!ret) {
+ g_warning ("Plugin %s requires description",
+ filename);
+ g_module_close (module);
+ goto out;
+ }
+
+ /* print what we know */
+ g_debug ("opened plugin %s: %s",
+ filename, plugin_desc ());
+
+ /* optionally initialize plugin */
+ ret = g_module_symbol (module,
+ "pk_transaction_plugin_initialize",
+ (gpointer *) &plugin_func);
+ if (ret) {
+ g_debug ("running init on %s", filename);
+ plugin_func (transaction);
+ }
+
+ /* add to array */
+ g_ptr_array_add (transaction->priv->plugins,
+ module);
+out:
+ return;
+}
+
+/**
+ * pk_transaction_load_plugins:
+ */
+static void
+pk_transaction_load_plugins (PkTransaction *transaction)
+{
+ const gchar *filename_tmp;
+ gchar *filename_plugin;
+ gchar *path;
+ GDir *dir;
+ GError *error = NULL;
+
+ /* search in the plugin directory for plugins */
+ path = g_build_filename (LIBDIR, "packagekit-plugins", NULL);
+ dir = g_dir_open (path, 0, &error);
+ if (dir == NULL) {
+ g_warning ("failed to open plugin directory: %s",
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* try to open each plugin */
+ g_debug ("searching for plugins in %s", path);
+ do {
+ filename_tmp = g_dir_read_name (dir);
+ if (filename_tmp == NULL)
+ break;
+ if (!g_str_has_suffix (filename_tmp, ".so"))
+ continue;
+ filename_plugin = g_build_filename (path,
+ filename_tmp,
+ NULL);
+ pk_transaction_load_plugin (transaction,
+ filename_plugin);
+ g_free (filename_plugin);
+ } while (TRUE);
+out:
+ if (dir != NULL)
+ g_dir_close (dir);
+ g_free (path);
+}
+
+/**
* pk_transaction_get_runtime:
*
* Returns time running in ms
@@ -872,6 +974,50 @@ pk_transaction_get_state (PkTransaction *transaction)
}
/**
+ * pk_transaction_plugin_phase:
+ **/
+static void
+pk_transaction_plugin_phase (PkTransaction *transaction,
+ PkTransactionPluginPhase phase)
+{
+ guint i;
+ const gchar *function = NULL;
+ GModule *module;
+ gboolean ret;
+ PkTransactionPluginFunc plugin_func = NULL;
+
+ switch (phase) {
+ case PK_TRANSACTION_PLUGIN_PHASE_INIT:
+ function = "pk_transaction_plugin_initialize";
+ break;
+ case PK_TRANSACTION_PLUGIN_PHASE_PRE:
+ function = "pk_transaction_plugin_transaction_pre";
+ break;
+ case PK_TRANSACTION_PLUGIN_PHASE_POST:
+ function = "pk_transaction_plugin_transaction_post";
+ break;
+ default:
+ break;
+ }
+
+ g_assert (function != NULL);
+
+ /* run each plugin */
+ for (i=0; i<transaction->priv->plugins->len; i++) {
+ module = g_ptr_array_index (transaction->priv->plugins, i);
+ ret = g_module_symbol (module,
+ function,
+ (gpointer *) &plugin_func);
+ if (!ret)
+ continue;
+ g_debug ("run %s on %s",
+ function,
+ g_module_name (module));
+ plugin_func (transaction);
+ }
+}
+
+/**
* pk_transaction_finished_cb:
**/
static void
@@ -1037,6 +1183,10 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact
pk_transaction_extra_clear_firmware_requests (transaction->priv->transaction_extra);
}
+ /* run the plugins */
+ pk_transaction_plugin_phase (transaction,
+ PK_TRANSACTION_PLUGIN_PHASE_POST);
+
/* do the post-transaction.d scripts */
pk_transaction_process_scripts (transaction, "post-transaction.d");
@@ -2078,6 +2228,10 @@ pk_transaction_run (PkTransaction *transaction)
g_return_val_if_fail (PK_IS_TRANSACTION (transaction), FALSE);
g_return_val_if_fail (transaction->priv->tid != NULL, FALSE);
+ /* run the plugins */
+ pk_transaction_plugin_phase (transaction,
+ PK_TRANSACTION_PLUGIN_PHASE_PRE);
+
/* do the pre-transaction.d scripts */
pk_transaction_process_scripts (transaction, "pre-transaction.d");
@@ -5950,6 +6104,10 @@ pk_transaction_init (PkTransaction *transaction)
transaction->priv->monitor = egg_dbus_monitor_new ();
g_signal_connect (transaction->priv->monitor, "connection-changed",
G_CALLBACK (pk_transaction_caller_active_changed_cb), transaction);
+
+ /* get plugins */
+ transaction->priv->plugins = g_ptr_array_new_with_free_func ((GDestroyNotify) g_module_close);
+ pk_transaction_load_plugins (transaction);
}
/**
@@ -6032,6 +6190,7 @@ pk_transaction_finalize (GObject *object)
// g_object_unref (transaction->priv->authority);
g_object_unref (transaction->priv->cancellable);
#endif
+ g_ptr_array_unref (transaction->priv->plugins);
G_OBJECT_CLASS (pk_transaction_parent_class)->finalize (object);
}
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index a307fc4..636bb77 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -248,6 +248,16 @@ gboolean pk_transaction_filter_check (const gchar *filter,
gboolean pk_transaction_strvalidate (const gchar *textr,
GError **error);
+/* plugin support */
+typedef const gchar *(*PkTransactionPluginGetDescFunc) (void);
+typedef void (*PkTransactionPluginFunc) (PkTransaction *transaction);
+
+const gchar *pk_transaction_plugin_get_description (void);
+void pk_transaction_plugin_initialize (PkTransaction *transaction);
+void pk_transaction_plugin_destroy (PkTransaction *transaction);
+void pk_transaction_plugin_transaction_pre (PkTransaction *transaction);
+void pk_transaction_plugin_transaction_post (PkTransaction *transaction);
+
G_END_DECLS
#endif /* __PK_TRANSACTION_H */
commit 7f752fe0241dde3c42ddda18ec93fed3977290e4
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Jul 8 13:51:34 2011 +0100
yum: Manually convert the results of GetDetails to unicode. Fixes rh#719916
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index d9a293c..152c841 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -2624,7 +2624,9 @@ 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 = _to_unicode(pkg.description)
+ url = _to_unicode(pkg.url)
+ license = _to_unicode(pkg.license)
# some RPM's (especially from google) have no description
if desc:
@@ -2639,7 +2641,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
size = 0
group = self.comps.get_group(pkg.name)
- self.details(package_id, pkg.license, group, desc, pkg.url, size)
+ self.details(package_id, license, group, desc, url, size)
def get_files(self, package_ids):
try:
commit 54fe916971a6810e5868c93fbb6813e4a1fc6c92
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jul 4 16:33:28 2011 +0100
trivial: post release version bump
diff --git a/RELEASE b/RELEASE
index 22f6623..df4f63d 100644
--- a/RELEASE
+++ b/RELEASE
@@ -2,10 +2,10 @@ PackageKit Release Notes
1. Write NEWS entries for PackageKit in the same format as usual.
-git shortlog PACKAGEKIT_0_6_15.. | grep -i -v trivial | grep -v Merge > NEWS.new
+git shortlog PACKAGEKIT_0_6_16.. | grep -i -v trivial | grep -v Merge > NEWS.new
--------------------------------------------------------------------------------
-Version 0.6.16
+Version 0.6.17
~~~~~~~~~~~~~~
Released: 2011-xx-xx
@@ -30,8 +30,8 @@ tx pull --all
4. Commit changes in PackageKit git:
-git commit -a -m "Release version 0.6.16"
-git tag -s -f -m "Release 0.6.16" PACKAGEKIT_0_6_16
+git commit -a -m "Release version 0.6.17"
+git tag -s -f -m "Release 0.6.17" PACKAGEKIT_0_6_17
<gpg password>
git push --tags
git push
@@ -57,7 +57,7 @@ tx push --source
10. Send an email to packagekit at lists.freedesktop.org
=================================================
-PackageKit 0.6.16 released!
+PackageKit 0.6.17 released!
Tarballs available here: http://www.packagekit.org/releases/
diff --git a/configure.ac b/configure.ac
index 9097b1b..37aab7e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@ AC_PREREQ(2.63)
m4_define([pk_major_version], [0])
m4_define([pk_minor_version], [6])
-m4_define([pk_micro_version], [16])
+m4_define([pk_micro_version], [17])
m4_define([pk_version],
[pk_major_version.pk_minor_version.pk_micro_version])
More information about the PackageKit-commit
mailing list