[PackageKit-commit] packagekit: Branch 'master' - 29 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Thu Sep 18 03:55:46 PDT 2008
backends/smart/helpers/smartBackend.py | 10
backends/urpmi/helpers/Makefile.am | 19
backends/urpmi/helpers/get-depends.pl | 91 ----
backends/urpmi/helpers/get-details.pl | 70 ---
backends/urpmi/helpers/get-distro-upgrades.pl | 118 -----
backends/urpmi/helpers/get-files.pl | 62 ---
backends/urpmi/helpers/get-packages.pl | 63 ---
backends/urpmi/helpers/get-requires.pl | 65 ---
backends/urpmi/helpers/get-update-detail.pl | 81 ---
backends/urpmi/helpers/get-updates.pl | 56 --
backends/urpmi/helpers/install-packages.pl | 56 --
backends/urpmi/helpers/refresh-cache.pl | 46 --
backends/urpmi/helpers/remove-packages.pl | 92 ----
backends/urpmi/helpers/resolve.pl | 68 ---
backends/urpmi/helpers/search-details.pl | 67 ---
backends/urpmi/helpers/search-file.pl | 58 --
backends/urpmi/helpers/search-group.pl | 68 ---
backends/urpmi/helpers/search-name.pl | 74 ---
backends/urpmi/helpers/update-packages.pl | 61 ---
backends/urpmi/helpers/update-system.pl | 34 -
backends/urpmi/helpers/urpmi-dispatched-backend.pl | 66 ++-
backends/urpmi/pk-backend-urpmi.c | 36 -
backends/yum/yumBackend.py | 22 -
backends/zypp/pk-backend-zypp.cpp | 16
backends/zypp/zypp-utils.cpp | 2
client/pk-generate-pack.c | 2
client/pk-import-desktop.c | 5
data/tests/packagekit | 1
data/tests/pk-spawn-dispatcher.py | 24 -
docs/api/Makefile.am | 1
docs/api/spec/pk-developer-faq.xml | 130 +++---
docs/api/spec/pk-faq-error-code.png |binary
docs/api/spec/pk-faq-filter.png |binary
docs/api/spec/pk-faq-status.png |binary
docs/html/img/Makefile.am | 3
docs/html/img/gpk-client-codecs.png |binary
docs/html/img/gpk-client-font.png |binary
docs/html/img/gpk-client-mime-type.png |binary
docs/html/pk-screenshots.html | 9
libpackagekit/pk-client.c | 158 +++----
libpackagekit/pk-client.h | 1
libpackagekit/pk-control.c | 22 -
libpackagekit/pk-control.h | 3
libpackagekit/pk-extra.c | 10
libpackagekit/pk-package-list.c | 18
libpackagekit/pk-package-list.h | 14
libpackagekit/pk-task-list.c | 4
python/packagekit/backend.py | 10
python/packagekit/client.py | 121 +++--
python/packagekitwrapper.py | 426 ---------------------
python/wrapper-test.py | 66 ++-
src/pk-backend.c | 10
src/pk-spawn.c | 8
src/pk-transaction.c | 20
54 files changed, 450 insertions(+), 2017 deletions(-)
New commits:
commit c9ae67cf95c4b5bf50ebb76ad983042a4195afbb
Merge: e33229e... 07a6dda...
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Sep 18 11:31:24 2008 +0100
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit e33229e26fc503cbe1ec7fb10c90c95e320c97d7
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Sep 18 11:27:46 2008 +0100
trivial: add one more ui to the developer FAQ page
diff --git a/docs/api/Makefile.am b/docs/api/Makefile.am
index 755bf80..fbeb317 100644
--- a/docs/api/Makefile.am
+++ b/docs/api/Makefile.am
@@ -51,6 +51,7 @@ HTML_IMAGES = \
spec/pk-structure.svg \
spec/pk-faq-error-code.png \
spec/pk-faq-status.png \
+ spec/pk-faq-filter.png \
spec/pk-transactions.svg \
spec/pk-transactions-set-locale.png \
spec/pk-transactions-failure.png \
diff --git a/docs/api/spec/pk-developer-faq.xml b/docs/api/spec/pk-developer-faq.xml
index eba28eb..d40ca0c 100644
--- a/docs/api/spec/pk-developer-faq.xml
+++ b/docs/api/spec/pk-developer-faq.xml
@@ -9,61 +9,87 @@
This list is not exhaustive, but please ask before adding to it.
</para>
- <sect1 id="developer-faq-status-signals">
- <title>Backends should send status signals...</title>
+ <sect1 id="developer-faq-libnotify">
+ <title>Notify warnings...</title>
<para>
- If your backend does not set status signals you will get the following dialog:
+ If you compile with developer warnings, you may get notifications on your
+ desktop telling you you've done something wrong:
</para>
- <mediaobject id="pk-faq-status">
- <imageobject>
- <imagedata format="PNG" fileref="pk-faq-status.png" align="center"/>
- </imageobject>
- </mediaobject>
- <para>
- For every transaction, you need to tell the datemon what the backend is doing.
- You need to add to your backend:
- </para>
- <itemizedlist>
- <listitem>
- <para>
- For python: <literal>self.status(STATUS_QUERY)</literal>
- </para>
- </listitem>
- <listitem>
- <para>
- For compiled C/C++: <literal>pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);</literal>
- </para>
- </listitem>
- </itemizedlist>
- <para>
- You can send as many status calls as you need as the transaction progresses.
- The more calls you send, the more the UI will reflect what is being done, for instance,
- showing a downloading icon when <literal>PK_STATUS_ENUM_DOWNLOAD</literal> is used.
- </para>
- </sect1>
- <sect1 id="developer-faq-error-code-finished">
- <title>Finished() after ErrorCode()...</title>
- <para>
- If your backend does not send <literal>Finished()</literal> after <literal>ErrorCode()</literal>
- then the following dialog will be shown.
- </para>
- <mediaobject id="pk-faq-error-code">
- <imageobject>
- <imagedata format="PNG" fileref="pk-faq-error-code.png" align="center"/>
- </imageobject>
- </mediaobject>
- <para>
- The daemon recovers automatically, so this warning is not fatal, but the automatic recovery
- is not cost free.
- Every time the daemon cleans up a transaction like this, an additional 500ms is added to the
- transaction duration (to allow slow backends to clean up after themselves) and so the
- next transaction is delayed from starting.
- </para>
- <para>
- You need to ensure that <literal>Finished()</literal> follows <literal>ErrorCode()</literal>
- to remove this warning.
- </para>
+ <sect2 id="developer-faq-status-signals">
+ <title>Backends should send status signals...</title>
+ <para>
+ If your backend does not set status signals you will get the following dialog:
+ </para>
+ <mediaobject id="pk-faq-status">
+ <imageobject>
+ <imagedata format="PNG" fileref="pk-faq-status.png" align="center"/>
+ </imageobject>
+ </mediaobject>
+ <para>
+ For every transaction, you need to tell the daemon what the backend is doing.
+ You need to add to your backend:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ For python: <literal>self.status(STATUS_QUERY)</literal>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ For compiled C/C++: <literal>pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);</literal>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ You can send as many status calls as you need as the transaction progresses.
+ The more calls you send, the more the UI will reflect what is being done, for instance,
+ showing a downloading icon when <literal>PK_STATUS_ENUM_DOWNLOAD</literal> is used.
+ </para>
+ </sect2>
+
+ <sect2 id="developer-faq-error-code-finished">
+ <title>Finished() after ErrorCode()...</title>
+ <para>
+ If your backend does not send <literal>Finished()</literal> after <literal>ErrorCode()</literal>
+ then the following dialog will be shown.
+ </para>
+ <mediaobject id="pk-faq-error-code">
+ <imageobject>
+ <imagedata format="PNG" fileref="pk-faq-error-code.png" align="center"/>
+ </imageobject>
+ </mediaobject>
+ <para>
+ The daemon recovers automatically, so this warning is not fatal, but the automatic recovery
+ is not cost free.
+ Every time the daemon cleans up a transaction like this, an additional 500ms is added to the
+ transaction duration (to allow slow backends to clean up after themselves) and so the
+ next transaction is delayed from starting.
+ </para>
+ <para>
+ You need to ensure that <literal>Finished()</literal> follows <literal>ErrorCode()</literal>
+ to remove this warning.
+ </para>
+ </sect2>
+
+ <sect2 id="developer-faq-respect-filter">
+ <title>Not respecting filters...</title>
+ <para>
+ If your backend does not correctly use the PkInfo field in <literal>Package()</literal>
+ or it does not filter packages according to the specified filter, then the following dialog will be shown.
+ </para>
+ <mediaobject id="pk-faq-filter">
+ <imageobject>
+ <imagedata format="PNG" fileref="pk-faq-filter.png" align="center"/>
+ </imageobject>
+ </mediaobject>
+ <para>
+ You need to ensure that you respect the filter setting, as frontends will not
+ do client-side filtering.
+ </para>
+ </sect2>
+
</sect1>
</chapter>
diff --git a/docs/api/spec/pk-faq-error-code.png b/docs/api/spec/pk-faq-error-code.png
index 2cccae1..800cf55 100644
Binary files a/docs/api/spec/pk-faq-error-code.png and b/docs/api/spec/pk-faq-error-code.png differ
diff --git a/docs/api/spec/pk-faq-filter.png b/docs/api/spec/pk-faq-filter.png
new file mode 100644
index 0000000..a9de735
Binary files /dev/null and b/docs/api/spec/pk-faq-filter.png differ
diff --git a/docs/api/spec/pk-faq-status.png b/docs/api/spec/pk-faq-status.png
index 7c49b9c..f82925f 100644
Binary files a/docs/api/spec/pk-faq-status.png and b/docs/api/spec/pk-faq-status.png differ
commit 07a6dda4a7a1c95ce0bc13e959e8372e5ff25acf
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Thu Sep 18 12:25:08 2008 +0200
python api: implemented the last methods and make the wrapper-test.py a lot better
diff --git a/python/packagekit/client.py b/python/packagekit/client.py
index 9200f10..6e18c65 100644
--- a/python/packagekit/client.py
+++ b/python/packagekit/client.py
@@ -82,6 +82,23 @@ class PackageKitClient:
self._wrapCall(pk_xn, method, {'Package' : package_cb})
return result
+ def _wrapDistroUpgradeCall(self, pk_xn, method):
+ '''
+ Wraps a call which emits Finished, ErrorCode on completion and
+ DistroUpgrade for information returns a list of dicts with
+ 'type', 'name' and 'summary' keys
+ '''
+
+ result = []
+ distup_cb = lambda typ,name,summary: result.append(
+ {'type' : typ,
+ 'name': name,
+ 'summary' : self._to_utf8(summary)
+ })
+ self._wrapCall(pk_xn, method, {'DistroUpgrade' : distup_cb})
+ return result
+
+
def _wrapDetailsCall(self, pk_xn, method):
'''
Wraps a call which emits Finished, ErrorCode on completion and
@@ -275,15 +292,13 @@ class PackageKitClient:
self._wrapBasicCall(xn, lambda : xn.RefreshCache(force))
- def GetRepoList(self, filter=None):
+ def GetRepoList(self, filter=FILTER_NONE):
'''
Returns the list of repositories used in the system
filter is a correct filter, e.g. None or 'installed;~devel'
'''
- if (filter == None):
- filter = 'none'
xn = self._get_xn()
return self._wrapReposCall(xn, lambda : xn.GetRepoList(filter))
@@ -300,7 +315,7 @@ class PackageKitClient:
xn = self._get_xn()
self._wrapBasicCall(xn, lambda : xn.RepoEnable(repo_id, enabled))
- def GetUpdates(self, filter=None):
+ def GetUpdates(self, filter=FILTER_NONE):
'''
This method should return a list of packages that are installed and
are upgradable.
@@ -308,18 +323,14 @@ class PackageKitClient:
It should only return the newest update for each installed package.
'''
xn = self._get_xn()
- if (filter == None):
- filter = 'none'
return self._wrapPackageCall(xn, lambda : xn.GetUpdates(filter))
- def GetPackages(self, filter=None):
+ def GetPackages(self, filter=FILTER_NONE):
'''
This method should return a total list of packages, limmited by the
filter used
'''
xn = self._get_xn()
- if (filter == None):
- filter = FILTER_NONE
return self._wrapPackageCall(xn, lambda : xn.GetPackages(filter))
def UpdateSystem(self):
@@ -370,7 +381,8 @@ class PackageKitClient:
return self._wrapUpdateDetailsCall(xn, lambda : xn.GetUpdateDetail(package_ids))
def GetDistroUpgrades(self):
- raise PackageKitError(ERROR_NOT_SUPPORTED)
+ xn = self._get_xn()
+ return self._wrapPackageCall(xn, lambda : xn.GetDistroUpgrades())
def InstallFiles(self,trusted,files):
raise PackageKitError(ERROR_NOT_SUPPORTED)
@@ -432,19 +444,34 @@ class PackageKitClient:
self.main_loop.run()
def _h_status(self, status):
+ '''
+ StatusChanged signal handler
+ '''
self._status = status
def _h_allowcancel(self, allow):
+ '''
+ AllowCancel signal handler
+ '''
self._allow_cancel = allow
def _h_error(self, enum, desc):
+ '''
+ ErrorCode signal handler
+ '''
self._error_enum = enum
def _h_finished(self, status, code):
+ '''
+ Finished signal handler
+ '''
self._finished_status = status
self.main_loop.quit()
def _h_progress(self, per, subper, el, rem):
+ '''
+ ProgressChanged signal handler
+ '''
def _cancel(xn):
try:
xn.Cancel()
diff --git a/python/wrapper-test.py b/python/wrapper-test.py
index 87f190a..661f725 100755
--- a/python/wrapper-test.py
+++ b/python/wrapper-test.py
@@ -22,6 +22,29 @@ import sys
from packagekit.client import PackageKitClient
from packagekit.enums import *
+def show_packages(pk,pkgs,details=False,limit=None):
+ i = 0
+ for pkg in pkgs:
+ i += 1
+ if limit and i == limit:
+ break
+ show_package(pkg)
+ if details:
+ details = pk.GetDetails(pkg['id'])
+ print 79 *"-"
+ print details[0]['detail']
+ print 79 *"="
+
+def show_package(pkg):
+ if pkg:
+ if isinstance(pkg, list):
+ pkg = pkg[0]
+ (name,ver,arch,repo) = tuple(pkg['id'].split(";"))
+ p = "%s-%s.%s" % (name,ver,arch)
+ print "%-40s : %s" % (p,pkg['summary'])
+ else:
+ print "no package found"
+
if __name__ == '__main__':
if len(sys.argv) > 1:
cmd = sys.argv[1:]
@@ -32,32 +55,22 @@ if __name__ == '__main__':
if 'all' in cmd or "refresh-cache" in cmd:
print '---- RefreshCache() -----'''
- print pk.RefreshCache()
+ pk.RefreshCache()
if 'all' in cmd or "resolve" in cmd:
print '---- Resolve() -----'
pkg = pk.Resolve(FILTER_NONE, 'yum')
- if pkg:
- print pkg
+ show_package(pkg)
if 'all' in cmd or "get-packages" in cmd:
print '---- GetPackages() ----'
packages = pk.GetPackages(FILTER_INSTALLED)
- i = 0
- for pkg in packages:
- i += 1
- if i == 20:
- break
- (name,ver,arch,repo) = tuple(pkg['id'].split(";"))
- p = "%s-%s.%s" % (name,ver,arch)
- print "%-40s : %s" % (p,pkg['summary'])
- details = pk.GetDetails(pkg['id'])
- print 79 *"-"
- print details[0]['detail']
+ show_packages(pk,packages,details=True,limit=20)
if 'all' in cmd or "search-file" in cmd:
print '---- SearchFile() ----'
- print pk.SearchFile(FILTER_INSTALLED,"/usr/bin/yum")
+ pkgs = pk.SearchFile(FILTER_INSTALLED,"/usr/bin/yum")
+ show_packages(pk,pkgs)
if 'all' in cmd or "get-updates" in cmd:
print '---- GetUpdates() ----'
@@ -69,8 +82,21 @@ if __name__ == '__main__':
if 'all' in cmd or "search-name" in cmd:
print '---- SearchName() -----'
- print pk.SearchName(FILTER_NOT_INSTALLED, 'coreutils')
- print pk.SearchName(FILTER_INSTALLED, 'coreutils')
+ 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, pc, spc, el, rem, c):
commit 734d7c2b52b67ca7a4e28207d03c7d37ded43e79
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Thu Sep 18 10:09:11 2008 +0200
python: removed packagekitwrapper.py, it is replaced by packagekit/client.py
diff --git a/python/packagekitwrapper.py b/python/packagekitwrapper.py
deleted file mode 100644
index f333a41..0000000
--- a/python/packagekitwrapper.py
+++ /dev/null
@@ -1,426 +0,0 @@
-#!/usr/bin/python
-#
-# (c) 2008 Canonical Ltd.
-# (c) 2008 Aidan Skinner <aidan at skinner.me.uk>
-# Author: Martin Pitt <martin.pitt at ubuntu.com>
-# License: LGPL 2.1 or later
-#
-# Synchronous PackageKit client wrapper for Python.
-
-import gobject
-import dbus
-
-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, error):
- self.error = error
-
- def __str__(self):
- return self.error
-
-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
- if main_loop is None:
- import dbus.mainloop.glib
- main_loop = gobject.MainLoop()
- dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
- self.main_loop = main_loop
-
- self.bus = dbus.SystemBus()
-
- def _wrapCall(self, pk_xn, method, callbacks):
- '''
- Wraps a call which emits Finished and ErrorCode on completion
- '''
- pk_xn.connect_to_signal('Finished', self._h_finished)
- pk_xn.connect_to_signal('ErrorCode', self._h_error)
- for cb in callbacks.keys():
- pk_xn.connect_to_signal(cb, callbacks[cb])
-
- polkit_auth_wrapper(method)
- self._wait()
- if self._error_enum:
- raise PackageKitError(self._error_enum)
-
-
- def _wrapBasicCall(self, pk_xn, method):
- return self._wrapCall(pk_xn, method, {})
-
- def _wrapPackageCall(self, pk_xn, method):
- '''
- Wraps a call which emits Finished, ErrorCode on completion and
- Package for information returns a list of dicts with
- 'installed', 'id' and 'summary' keys
- '''
-
- result = []
- package_cb = lambda i, id, summary: result.append(
- {'installed' : (i == 'installed'),
- 'id': (str(id)),
- 'summary' : str(summary)
- })
- self._wrapCall(pk_xn, method, {'Package' : package_cb})
- return result
-
- def _wrapDetailsCall(self, pk_xn, method):
- '''
- Wraps a call which emits Finished, ErrorCode on completion and
- Details for information returns a list of dicts with 'id',
- 'license', 'group', 'description', 'upstream_url', 'size'.keys
- '''
- result = []
- details_cb = lambda id, license, group, detail, url, size: result.append
- ({"id" : str(id),
- "license" : str(license),
- "group" : str(group),
- "detail" : str(detail),
- "url" : str(url),
- "size" : int(size)
- })
-
- self._wrapCall(pk_xn, method, {'Details' : details_cb})
- return result
-
- def _wrapReposCall(self, pk_xn, method):
- '''
- Wraps a call which emits Finished, ErrorCode and RepoDetail
- for information returns a list of dicts with 'id',
- 'description', 'enabled' keys
- '''
- result = []
- repo_cb = lambda id, description, enabled: result.append
- ({'id' : str(id),
- 'desc' : str(description),
- 'enabled' : enabled})
- self._wrapCall(pk_xn, method, {'RepoDetail' : repo_cb})
- return result
-
-
- def SuggestDaemonQuit(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, filter, package):
- '''
- Resolve a package name to a PackageKit package_id filter and
- package are directly passed to the PackageKit transaction
- D-BUS method Resolve()
-
- Return Dict with keys of (installed, id, short_description)
- for all matches, where installed is a boolean and id and
- short_description are strings.
- '''
- xn = self._get_xn()
- return self._wrapPackageCall(xn, lambda : xn.Resolve(filter, package))
-
-
- def GetDetails(self, package_id):
- '''
- Get details about a PackageKit package_id.
-
- Return dict with keys (id, license, group, description,
- upstream_url, size).
- '''
- xn = self._get_xn()
- return self._wrapDetailsCall(xn, lambda : xn.GetDetails(package_id))
-
- def SearchName(self, filter, name):
- '''
- Search a package by name.
- '''
- xn = self._get_xn()
- return self._wrapPackageCall(xn, lambda : xn.SearchName(filter, name))
-
- def SearchDetails(self, filter, name):
- '''
- Search a packages details.
- '''
- xn = self._get_xn()
- return self._wrapPackageCall(xn,
- lambda : xn.SearchDetails(filter, name))
-
-
- def InstallPackages(self, package_ids, progress_cb=None):
- '''Install a list of package IDs.
-
- progress_cb is a function taking arguments (status, percentage,
- subpercentage, elapsed, remaining, allow_cancel). If it returns False,
- the action is cancelled (if allow_cancel == True), otherwise it
- continues.
-
- On failure this throws a PackageKitError or a DBusException.
- '''
- self._InstRemovePackages(package_ids, progress_cb, True, None, None)
-
- def RemovePackages(self, package_ids, progress_cb=None, allow_deps=False,
- auto_remove=True):
- '''Remove a list of package IDs.
-
- progress_cb is a function taking arguments (status, percentage,
- subpercentage, elapsed, remaining, allow_cancel). If it returns False,
- the action is cancelled (if allow_cancel == True), otherwise it
- continues.
-
- allow_deps and auto_remove are passed to the PackageKit function.
-
- On failure this throws a PackageKitError or a DBusException.
- '''
- self._InstRemovePackages(package_ids, progress_cb, False, allow_deps,
- auto_remove)
-
- def RefreshCache(self, force=False):
- '''
- 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.
- '''
- xn = self._get_xn()
- self._wrapBasicCall(xn, lambda : xn.RefreshCache(force))
-
-
- def GetRepoList(self, filter=None):
- '''
- Returns the list of repositories used in the system
-
- filter is a correct filter, e.g. None or 'installed;~devel'
-
- '''
- if (filter == None):
- filter = 'none'
- xn = self._get_xn()
- return self._wrapReposCall(xn, lambda : xn.GetRepoList(filter))
-
-
- def RepoEnable(self, repo_id, enabled):
- '''
- Enables the repository specified.
-
- repo_id is a repository identifier, e.g. fedora-development-debuginfo
-
- enabled true if enabled, false if disabled
-
- '''
- xn = self._get_xn()
- self._wrapBasicCall(xn, lambda : xn.RepoEnable(repo_id, enabled))
-
- def GetUpdates(self, filter=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.
- '''
- xn = self._get_xn()
- if (filter == None):
- filter = 'none'
- return self._wrapPackageCall(xn, lambda : xn.GetUpdates(filter))
-
- def UpdateSystem(self):
- '''
- 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.
- '''
- xn = self._get_xn()
- self._wrapPackageCall(xn, lambda : xn.UpdateSystem())
-
-
- #
- # Internal helper functions
- #
-
- def _wait(self):
- '''Wait until an async PK operation finishes.'''
- self.main_loop.run()
-
- def _h_status(self, status):
- self._status = status
-
- def _h_allowcancel(self, allow):
- self._allow_cancel = allow
-
- def _h_error(self, enum, desc):
- self._error_enum = enum
-
- def _h_finished(self, status, code):
- self.main_loop.quit()
-
- def _h_progress(self, per, subper, el, rem):
- def _cancel(xn):
- try:
- xn.Cancel()
- except dbus.DBusException, e:
- if e._dbus_error_name == 'org.freedesktop.PackageKit.Transaction.CannotCancel':
- pass
- else:
- raise
-
- ret = self._progress_cb(self._status, int(per),
- int(subper), int(el), int(rem), self._allow_cancel)
- if not ret:
- # we get backend timeout exceptions more likely when we call this
- # directly, so delay it a bit
- gobject.timeout_add(10, _cancel, pk_xn)
-
- def _auth(self):
- policykit = self.bus.get_object(
- 'org.freedesktop.PolicyKit.AuthenticationAgent', '/',
- 'org.freedesktop.PolicyKit.AuthenticationAgent')
- if(policykit == None):
- print("Error: Could not get PolicyKit D-Bus Interface\n")
- granted = policykit.ObtainAuthorization("org.freedesktop.packagekit.update-system",
- (dbus.UInt32)(xid),
- (dbus.UInt32)(os.getpid()))
-
- def _InstRemovePackages(self, package_ids, progress_cb, install,
- allow_deps, auto_remove):
- '''Shared implementation of InstallPackages and RemovePackages.'''
-
- self._status = None
- self._allow_cancel = False
-
- pk_xn = self._get_xn()
- if progress_cb:
- pk_xn.connect_to_signal('StatusChanged', self._h_status)
- pk_xn.connect_to_signal('AllowCancel', self._h_allowcancel)
- pk_xn.connect_to_signal('ProgressChanged', self._h_progress)
- self._progress_cb = progress_cb
- pk_xn.connect_to_signal('ErrorCode', self._h_error)
- pk_xn.connect_to_signal('Finished', self._h_finished)
- if install:
- pk_xn.InstallPackages(package_ids)
- else:
- pk_xn.RemovePackages(package_ids, allow_deps, auto_remove)
- self._wait()
- if self._error_enum:
- raise PackageKitError(self._error_enum)
- if self._finished_status != 'success':
- raise PackageKitError('internal-error')
-
- def _get_xn(self):
- '''Create a new PackageKit Transaction object.'''
-
- self._error_enum = None
- self._finished_status = None
- 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
-
- return dbus.Interface(self.bus.get_object('org.freedesktop.PackageKit',
- tid, False), 'org.freedesktop.PackageKit.Transaction')
-
-#### PolicyKit authentication borrowed wrapper ##
-class PermissionDeniedByPolicy(dbus.DBusException):
- _dbus_error_name = 'org.freedesktop.PackageKit.PermissionDeniedByPolicy'
-
-
-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.Interface(dbus.SessionBus().get_object(
- 'org.freedesktop.PolicyKit.AuthenticationAgent', '/', False),
- 'org.freedesktop.PolicyKit.AuthenticationAgent')
- # TODO: provide xid
- res = pk_auth.ObtainAuthorization(priv, dbus.UInt32(0),
- dbus.UInt32(os.getpid()), timeout=300)
- if res:
- return fn(*args, **kwargs)
- raise PermissionDeniedByPolicy(priv + ' ' + auth_result)
- else:
- raise
-
-#
-# Test code
-#
-
-if __name__ == '__main__':
- import subprocess, sys
-
- pk = PackageKitClient()
-
- print '---- RefreshCache() -----'''
- print pk.RefreshCache()
-
- print '---- Resolve() -----'
- pmount = pk.Resolve('none', 'pmount')
- print pmount
- print pk.Resolve('none', 'quilt')
- print pk.Resolve('none', 'foobar')
- print pk.Resolve('installed', 'coreutils')
- print pk.Resolve('installed', 'pmount')
-
- print '---- GetUpdates() ----'
- print pk.GetUpdates('none')
-
- print '---- GetDetails() -----'
- print pk.GetDetails(pmount[0]['id'])
-
- print '---- SearchName() -----'
- print pk.SearchName('available', 'coreutils')
- print pk.SearchName('installed', 'coreutils')
-
- #sys.exit(0)
-
- def cb(status, pc, spc, el, rem, c):
- print 'install pkg: %s, %i%%, cancel allowed: %s' % (status, pc, str(c))
- return True
- #return pc < 12
-
- print '---- UpdateSystem() ----'
- print pk.UpdateSystem()
-
- print '---- InstallPackages() -----'
- pk.InstallPackages(['pmount;0.9.17-2;i386;Ubuntu', 'quilt;0.46-6;all;Ubuntu'], cb)
-
- subprocess.call(['dpkg', '-l', 'pmount', 'quilt'])
-
- print '---- RemovePackages() -----'
- pk.RemovePackages(['pmount;0.9.17-2;i386;Ubuntu', 'quilt;0.46-6;all;Ubuntu'], cb)
-
- subprocess.call(['dpkg', '-l', 'pmount', 'quilt'])
-
- pk.SuggestDaemonQuit()
commit 71833a147ed59d520706ad8628e6b5f861da2621
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 17 22:19:28 2008 +0100
trivial: add what role the deveoper messages come from to help out backend authors
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 016a338..2c88ae3 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -848,7 +848,7 @@ pk_backend_set_status (PkBackend *backend, PkStatusEnum status)
if (status == PK_STATUS_ENUM_WAIT) {
egg_warning ("backend tried to WAIT, only the runner should set this value");
pk_backend_message (backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
- "backends shouldn't use STATUS_WAIT");
+ "%s shouldn't use STATUS_WAIT", pk_role_enum_to_text (backend->priv->role));
return FALSE;
}
@@ -856,7 +856,7 @@ pk_backend_set_status (PkBackend *backend, PkStatusEnum status)
if (status == PK_STATUS_ENUM_SETUP && backend->priv->status != PK_STATUS_ENUM_WAIT) {
egg_warning ("backend tried to SETUP, but should be in WAIT");
pk_backend_message (backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
- "Tried to SETUP when not in WAIT");
+ "%s to SETUP when not in WAIT", pk_role_enum_to_text (backend->priv->role));
return FALSE;
}
@@ -1548,14 +1548,14 @@ pk_backend_finished (PkBackend *backend)
/* are we trying to finish in init? */
if (backend->priv->during_initialize) {
pk_backend_message (backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
- "You can't call pk_backend_finished in backend_initialize!");
+ "%s can't call pk_backend_finished in backend_initialize!", role_text);
return FALSE;
}
/* check we have not already finished */
if (backend->priv->finished) {
pk_backend_message (backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
- "Backends cannot request Finished more than once!");
+ "%s cannot request Finished more than once!", role_text);
return FALSE;
}
@@ -1566,7 +1566,7 @@ pk_backend_finished (PkBackend *backend)
backend->priv->role == PK_ROLE_ENUM_REMOVE_PACKAGES ||
backend->priv->role == PK_ROLE_ENUM_UPDATE_PACKAGES)) {
pk_backend_message (backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
- "Backends should send a Package() for this role!");
+ "Backends should send a Package() for %s!", role_text);
}
/* if we set an error code notifier, clear */
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 6b20c51..63e8731 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -429,8 +429,8 @@ pk_transaction_error_code_cb (PkBackend *backend, PkErrorCodeEnum code,
if (code == PK_ERROR_ENUM_UNKNOWN) {
pk_backend_message (transaction->priv->backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
- "backend emitted 'unknown error' rather than a specific error "
- "- this is a backend problem and should be fixed!");
+ "%s emitted 'unknown error' rather than a specific error "
+ "- this is a backend problem and should be fixed!", pk_role_enum_to_text (transaction->priv->role));
}
code_text = pk_error_enum_to_text (code);
@@ -641,6 +641,7 @@ static void
pk_transaction_package_cb (PkBackend *backend, const PkPackageObj *obj, PkTransaction *transaction)
{
const gchar *info_text;
+ const gchar *role_text;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
@@ -651,14 +652,17 @@ pk_transaction_package_cb (PkBackend *backend, const PkPackageObj *obj, PkTransa
return;
}
+ /* we need this in warnings */
+ role_text = pk_role_enum_to_text (transaction->priv->role);
+
/* check the backend is doing the right thing */
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 (obj->info == PK_INFO_ENUM_INSTALLED) {
pk_backend_message (transaction->priv->backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
- "backend emitted 'installed' rather than 'installing' "
- "- you need to do the package *before* you do the action");
+ "%s emitted 'installed' rather than 'installing' "
+ "- you need to do the package *before* you do the action", role_text);
return;
}
}
@@ -667,16 +671,16 @@ pk_transaction_package_cb (PkBackend *backend, const PkPackageObj *obj, PkTransa
if (pk_bitfield_contain (transaction->priv->cached_filters, PK_FILTER_ENUM_NOT_INSTALLED)) {
if (obj->info == PK_INFO_ENUM_INSTALLED) {
pk_backend_message (transaction->priv->backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
- "backend emitted package that was installed when "
- "the ~installed filter is in place");
+ "%s emitted package that was installed when "
+ "the ~installed filter is in place", role_text);
return;
}
}
if (pk_bitfield_contain (transaction->priv->cached_filters, PK_FILTER_ENUM_INSTALLED)) {
if (obj->info == PK_INFO_ENUM_AVAILABLE) {
pk_backend_message (transaction->priv->backend, PK_MESSAGE_ENUM_BACKEND_ERROR,
- "backend emitted package that was ~installed when "
- "the installed filter is in place");
+ "%s emitted package that was ~installed when "
+ "the installed filter is in place", role_text);
return;
}
}
commit f658fc0e388bedb4b478115da36df90694e9f704
Merge: 360c281... f7dd135...
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 17 20:49:23 2008 +0100
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit f7dd135d28105b0249eafd7e74065afe6e699ec2
Author: Scott Reeves <sreeves at novell.com>
Date: Wed Sep 17 11:11:11 2008 -0600
zypp - fix the separator
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index e699768..e4a96cb 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -872,7 +872,7 @@ zypp_build_package_id_capabilities (zypp::Capabilities caps)
for (zypp::sat::WhatProvides::const_iterator it = provs.begin (); it != provs.end (); it++) {
gchar *package_id = zypp_build_package_id_from_resolvable (*it);
- package_ids = g_strconcat (package_ids, package_id, " ", (gchar *)NULL);
+ package_ids = g_strconcat (package_ids, package_id, "^", (gchar *)NULL);
g_free (package_id);
}
commit 360c281ff6e02616d8b0674ca19296edaf8a8a24
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 17 15:52:46 2008 +0100
yum: don't report the version or arch as meta else we display odd things in the UI
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 94919db..870b16e 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -288,7 +288,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
def _show_meta_package(self,grpid,fltlist=[]):
show_avail = FILTER_INSTALLED not in fltlist
show_inst = FILTER_NOT_INSTALLED not in fltlist
- id = "%s;meta;meta;meta" % grpid
+ id = "%s;;;meta" % grpid
grp = self.yumbase.comps.return_group(grpid)
if grp:
if grp.installed:
@@ -501,12 +501,11 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
grp = None
if len(id.split(';')) > 1:
# Split up the id
- (n,idver,a,d) = self.get_package_from_id(id)
- if idver == 'meta' and a == 'meta' and d == 'meta':
- meta = n
- grp = self.yumbase.comps.return_group(meta)
+ (name,idver,a,repo) = self.get_package_from_id(id)
+ if repo == 'meta':
+ grp = self.yumbase.comps.return_group(name)
if not grp:
- self.error(ERROR_PACKAGE_NOT_FOUND,"The Group %s dont exist" % meta)
+ self.error(ERROR_PACKAGE_NOT_FOUND,"The Group %s dont exist" % name)
return grp
def _findPackage(self,id):
@@ -1307,7 +1306,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
for package in package_ids:
grp = self._is_meta_package(package)
if grp:
- id = "%s;meta;meta;meta" % grp.groupid
+ id = "%s;;;meta" % grp.groupid
desc = grp.description
desc = desc.replace('\n\n',';')
desc = desc.replace('\n',' ')
commit 8a1eb06b7a8a79f854fea9ebe149f013ae2403ff
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 17 15:39:44 2008 +0100
bugfix: don't show a critical warning if we can't start up the daemon and start to use PkTasklist
diff --git a/libpackagekit/pk-task-list.c b/libpackagekit/pk-task-list.c
index 2bdb08f..3ccd063 100644
--- a/libpackagekit/pk-task-list.c
+++ b/libpackagekit/pk-task-list.c
@@ -272,6 +272,10 @@ pk_task_list_refresh (PkTaskList *tlist)
/* get the latest job list */
array = pk_control_transaction_list_get (tlist->priv->control);
+ if (array == NULL) {
+ egg_warning ("failed to get transaction list");
+ return FALSE;
+ }
/* mark previous tasks as non-valid */
length = tlist->priv->task_list->len;
commit 2a20b3c4147a50bf2af87a7b2d3be3aa8c695733
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Wed Sep 17 16:06:29 2008 +0200
python api: Implemented some extra methods and did some code cleanups
diff --git a/python/packagekit/client.py b/python/packagekit/client.py
index d51c69d..9200f10 100644
--- a/python/packagekit/client.py
+++ b/python/packagekit/client.py
@@ -140,6 +140,19 @@ class PackageKitClient:
self._wrapCall(pk_xn, method, {'RepoDetail' : repo_cb})
return result
+ def _wrapFilesCall(self, pk_xn, method):
+ '''
+ Wraps a call which emits Finished, ErrorCode and Files
+ for information returns a list of dicts with 'id',
+ 'files'
+ '''
+ result = []
+ files_cb = lambda id, files: result.append
+ ({'id' : str(id),
+ 'files' : files.split(';')})
+ self._wrapCall(pk_xn, method, {'Files' : files_cb})
+ return result
+
def SuggestDaemonQuit(self):
'''Ask the PackageKit daemon to shutdown.'''
@@ -217,7 +230,8 @@ class PackageKitClient:
On failure this throws a PackageKitError or a DBusException.
'''
package_ids = self._to_list(package_ids) # Make sure we have a list
- self._doPackages(package_ids, progress_cb, 'install')
+ xn = self._get_xn()
+ self._doPackages( xn, lambda : xn.InstallPackages(package_ids), progress_cb)
def UpdatePackages(self, package_ids, progress_cb=None):
'''UPdate a list of package IDs.
@@ -230,7 +244,8 @@ class PackageKitClient:
On failure this throws a PackageKitError or a DBusException.
'''
package_ids = self._to_list(package_ids) # Make sure we have a list
- self._doPackages(package_ids, progress_cb, 'update')
+ xn = self._get_xn()
+ self._doPackages(xn, lambda : xn.UpdatePackages(package_ids), progress_cb)
def RemovePackages(self, package_ids, progress_cb=None, allow_deps=False,
auto_remove=True):
@@ -246,8 +261,8 @@ class PackageKitClient:
On failure this throws a PackageKitError or a DBusException.
'''
package_ids = self._to_list(package_ids) # Make sure we have a list
- self._doPackages(package_ids, progress_cb, 'remove', allow_deps,
- auto_remove)
+ xn = self._get_xn()
+ self._doPackages(xn, lambda : xn.RemovePackages(package_ids, allow_deps, auto_remove), progress_cb)
def RefreshCache(self, force=False):
'''
@@ -318,7 +333,9 @@ class PackageKitClient:
self._wrapPackageCall(xn, lambda : xn.UpdateSystem())
def DownloadPackages(self,package_ids):
- raise PackageKitError(ERROR_NOT_SUPPORTED)
+ package_ids = self._to_list(package_ids) # Make sure we have a list
+ xn = self._get_xn()
+ return self._wrapFilesCall(xn,lambda : xn.DownloadPackages(package_ids))
def GetDepends(self,filter,package_ids,recursive=False):
'''
@@ -330,10 +347,10 @@ class PackageKitClient:
lambda : xn.GetDepends(filter,package_ids,recursive))
def GetFiles(self,package_ids):
- raise PackageKitError(ERROR_NOT_SUPPORTED)
+ package_ids = self._to_list(package_ids) # Make sure we have a list
+ xn = self._get_xn()
+ return self._wrapFilesCall(xn,lambda : xn.GetFiles(package_ids))
- def GetRepoList(self,filter):
- raise PackageKitError(ERROR_NOT_SUPPORTED)
def GetRequires(self,filter,package_ids,recursive=False):
'''
@@ -359,16 +376,22 @@ class PackageKitClient:
raise PackageKitError(ERROR_NOT_SUPPORTED)
def InstallSignatures(self,sig_type,key_id,package_id):
- raise PackageKitError(ERROR_NOT_SUPPORTED)
-
- def RepoEnable(self,repo_id,enabled):
- raise PackageKitError(ERROR_NOT_SUPPORTED)
+ '''
+ Install packages signing keys used to validate packages
+ '''
+ xn = self._get_xn()
+ self._wrapBasicCall(xn, lambda : xn.InstallSignatures(sig_type,key_id,package_id))
def RepoSetData(self,repo_id,parameter,value):
- raise PackageKitError(ERROR_NOT_SUPPORTED)
+ '''
+ Change custom parameter in Repository Configuration
+ '''
+ xn = self._get_xn()
+ self._wrapBasicCall(xn, lambda : xn.RepoSetData(repo_id,parameter,value))
def Rollback(self,transaction_id):
- raise PackageKitError(ERROR_NOT_SUPPORTED)
+ xn = self._get_xn()
+ self._wrapBasicCall(xn, lambda : xn.Rollback(transaction_id))
def WhatProvides(self,provide_type,search):
'''
@@ -379,10 +402,12 @@ class PackageKitClient:
lambda : xn.WhatProvides(provide_type,search))
def SetLocale(self,code):
- raise PackageKitError(ERROR_NOT_SUPPORTED)
+ xn = self._get_xn()
+ self._wrapBasicCall(xn, lambda : xn.SetLocale(code))
def AcceptEula(self,eula_id):
- raise PackageKitError(ERROR_NOT_SUPPORTED)
+ xn = self._get_xn()
+ self._wrapBasicCall(xn, lambda : xn.AcceptEula(eula_id))
@@ -446,32 +471,19 @@ class PackageKitClient:
(dbus.UInt32)(xid),
(dbus.UInt32)(os.getpid()))
- def _doPackages(self, package_ids, progress_cb, action,
- allow_deps=None, auto_remove=None):
+ def _doPackages(self, pk_xn, method, progress_cb):
'''Shared implementation of InstallPackages,UpdatePackages and RemovePackages.'''
self._status = None
self._allow_cancel = False
- pk_xn = self._get_xn()
if progress_cb:
pk_xn.connect_to_signal('StatusChanged', self._h_status)
pk_xn.connect_to_signal('AllowCancel', self._h_allowcancel)
pk_xn.connect_to_signal('ProgressChanged', self._h_progress)
self._progress_cb = progress_cb
- pk_xn.connect_to_signal('ErrorCode', self._h_error)
- pk_xn.connect_to_signal('Finished', self._h_finished)
- if action == "install":
- polkit_auth_wrapper(lambda : pk_xn.InstallPackages(package_ids))
- elif action == "remove":
- polkit_auth_wrapper(lambda : pk_xn.RemovePackages(package_ids, allow_deps, auto_remove))
- elif action == "update":
- polkit_auth_wrapper(lambda : pk_xn.UpdatePackages(package_ids))
- self._wait()
- if self._error_enum:
- raise PackageKitError(self._error_enum)
+ self._wrapBasicCall(pk_xn, method)
if self._finished_status != 'success':
- print self._finished_status
raise PackageKitError('internal-error')
def _get_xn(self):
diff --git a/python/wrapper-test.py b/python/wrapper-test.py
index 61870f6..87f190a 100755
--- a/python/wrapper-test.py
+++ b/python/wrapper-test.py
@@ -96,6 +96,12 @@ if __name__ == '__main__':
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'])
pk.SuggestDaemonQuit()
commit 507239c271af2a33d83f49df195e340662201893
Merge: 3cc92e5... c43dd24...
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 17 14:35:05 2008 +0100
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit 3cc92e5665d57f6e597580506ef3bb501aa2cf8b
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 17 14:33:24 2008 +0100
bugfix: when we can't start the dameon from a DBUS method, emit a proper error code rather than just 'failed'
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index cc710d6..284be12 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -141,9 +141,8 @@ GQuark
pk_client_error_quark (void)
{
static GQuark quark = 0;
- if (!quark) {
+ if (!quark)
quark = g_quark_from_static_string ("pk_client_error");
- }
return quark;
}
@@ -163,7 +162,8 @@ pk_client_error_get_type (void)
ENUM_ENTRY (PK_CLIENT_ERROR_FAILED_AUTH, "FailedAuth"),
ENUM_ENTRY (PK_CLIENT_ERROR_NO_TID, "NoTid"),
ENUM_ENTRY (PK_CLIENT_ERROR_ALREADY_TID, "AlreadyTid"),
- ENUM_ENTRY (PK_CLIENT_ERROR_ROLE_UNKNOWN, "RoleUnkown"),
+ ENUM_ENTRY (PK_CLIENT_ERROR_ROLE_UNKNOWN, "RoleUnknown"),
+ ENUM_ENTRY (PK_CLIENT_ERROR_CANNOT_START_DAEMON, "CannotStartDaemon"),
ENUM_ENTRY (PK_CLIENT_ERROR_INVALID_PACKAGEID, "InvalidPackageId"),
{ 0, NULL, NULL }
};
@@ -230,11 +230,10 @@ pk_client_error_print (GError **error)
if (error != NULL && *error != NULL) {
/* get some proper debugging */
if ((*error)->domain == DBUS_GERROR &&
- (*error)->code == DBUS_GERROR_REMOTE_EXCEPTION) {
+ (*error)->code == DBUS_GERROR_REMOTE_EXCEPTION)
name = dbus_g_error_get_name (*error);
- } else {
+ else
name = g_quark_to_string ((*error)->domain);
- }
egg_debug ("ERROR: %s: %s", name, (*error)->message);
return TRUE;
}
@@ -273,9 +272,8 @@ pk_client_error_refused_by_policy (GError *error)
const gchar *error_name;
/* if not set */
- if (error == NULL) {
+ if (error == NULL)
return FALSE;
- }
/* not a dbus error */
if (error->code != DBUS_GERROR_REMOTE_EXCEPTION) {
@@ -286,12 +284,10 @@ pk_client_error_refused_by_policy (GError *error)
/* check for specific error */
error_name = dbus_g_error_get_name (error);
egg_debug ("ERROR: %s: %s", error_name, error->message);
- if (egg_strequal (error_name, "org.freedesktop.PackageKit.RefusedByPolicy")) {
+ if (egg_strequal (error_name, "org.freedesktop.PackageKit.RefusedByPolicy"))
return TRUE;
- }
- if (egg_strequal (error_name, "org.freedesktop.PackageKit.Transaction.RefusedByPolicy")) {
+ if (egg_strequal (error_name, "org.freedesktop.PackageKit.Transaction.RefusedByPolicy"))
return TRUE;
- }
return FALSE;
}
@@ -333,9 +329,8 @@ pk_client_error_auth_obtain (GError *error)
/* this blocks - use polkit_gnome_auth_obtain for non blocking version */
ret = polkit_auth_obtain (action_id, 0, getpid (), &error2);
- if (dbus_error_is_set (&error2)) {
+ if (dbus_error_is_set (&error2))
egg_warning ("Failed to obtain auth: %s", error2.message);
- }
dbus_error_free (&error2);
egg_debug ("gained %s privilege = %d", action_id, ret);
@@ -474,9 +469,8 @@ pk_client_get_package_list (PkClient *client)
{
PkPackageList *list;
g_return_val_if_fail (PK_IS_CLIENT (client), NULL);
- if (!client->priv->use_buffer) {
+ if (!client->priv->use_buffer)
return NULL;
- }
list = client->priv->package_list;
g_object_ref (list);
return list;
@@ -512,9 +506,8 @@ pk_client_finished_cb (DBusGProxy *proxy, const gchar *exit_text, guint runtime,
client->priv->is_finishing = FALSE;
/* exit our private loop */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_quit (client->priv->loop);
- }
/* unref what we previously ref'd */
g_object_unref (client);
@@ -583,9 +576,8 @@ pk_client_package_cb (DBusGProxy *proxy,
g_signal_emit (client , signals [PK_CLIENT_PACKAGE], 0, obj);
/* cache */
- if (client->priv->use_buffer || client->priv->synchronous) {
+ if (client->priv->use_buffer || client->priv->synchronous)
pk_package_list_add_obj (client->priv->package_list, obj);
- }
pk_package_id_free (id);
pk_package_obj_free (obj);
}
@@ -737,9 +729,8 @@ pk_client_files_cb (DBusGProxy *proxy, const gchar *package_id, const gchar *fil
if (client->priv->role == PK_ROLE_ENUM_DOWNLOAD_PACKAGES) {
split = g_strsplit (filelist, ";", -1);
length = g_strv_length (split);
- for (i=0; i<length; i++) {
+ for (i=0; i<length; i++)
pk_client_file_copy (split[i], client->priv->cached_directory);
- }
g_strfreev (split);
}
}
@@ -1062,11 +1053,10 @@ pk_client_get_role (PkClient *client, PkRoleEnum *role, gchar **text, GError **e
if (ret) {
*role = pk_role_enum_from_text (role_text);
g_free (role_text);
- if (text != NULL) {
+ if (text != NULL)
*text = text_temp;
- } else {
+ else
g_free (text_temp);
- }
}
pk_client_error_fixup (error);
return ret;
@@ -1095,9 +1085,8 @@ pk_client_cancel (PkClient *client, GError **error)
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
/* we don't need to cancel, so return TRUE */
- if (client->priv->proxy == NULL) {
+ if (client->priv->proxy == NULL)
return TRUE;
- }
/* we cannot cancel a client in ::Finished() */
if (client->priv->is_finishing) {
@@ -1151,7 +1140,10 @@ pk_client_allocate_transaction_id (PkClient *client, GError **error)
/* get a new ID */
ret = pk_control_allocate_transaction_id (client->priv->control, &tid, &error_local);
if (!ret) {
- pk_client_error_set (error, PK_CLIENT_ERROR_FAILED, "failed to get a TID: %s", error_local->message);
+ if (error_local->code == PK_CONTROL_ERROR_CANNOT_START_DAEMON)
+ pk_client_error_set (error, PK_CLIENT_ERROR_CANNOT_START_DAEMON, "cannot start daemon: %s", error_local->message);
+ else
+ pk_client_error_set (error, PK_CLIENT_ERROR_FAILED, "failed to get a TID: %s (%i)", error_local->message, error_local->code);
g_error_free (error_local);
return FALSE;
}
@@ -1291,9 +1283,8 @@ pk_client_update_system (PkClient *client, GError **error)
}
}
/* we failed one of these, return the error to the user */
- if (!ret) {
+ if (!ret)
g_propagate_error (error, error_pk);
- }
if (ret && !client->priv->is_finished) {
/* allow clients to respond in the status changed callback */
@@ -1643,9 +1634,8 @@ pk_client_download_packages (PkClient *client, gchar **package_ids, const gchar
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
pk_client_error_fixup (error);
return ret;
@@ -3234,49 +3224,49 @@ pk_client_requeue (PkClient *client, GError **error)
pk_package_list_clear (client->priv->package_list);
/* do the correct action with the cached parameters */
- if (priv->role == PK_ROLE_ENUM_GET_DEPENDS) {
+ if (priv->role == PK_ROLE_ENUM_GET_DEPENDS)
ret = pk_client_get_depends (client, priv->cached_filters, priv->cached_package_ids, priv->cached_force, error);
- } else if (priv->role == PK_ROLE_ENUM_GET_UPDATE_DETAIL) {
+ else if (priv->role == PK_ROLE_ENUM_GET_UPDATE_DETAIL)
ret = pk_client_get_update_detail (client, priv->cached_package_ids, error);
- } else if (priv->role == PK_ROLE_ENUM_RESOLVE) {
+ else if (priv->role == PK_ROLE_ENUM_RESOLVE)
ret = pk_client_resolve (client, priv->cached_filters, priv->cached_package_ids, error);
- } else if (priv->role == PK_ROLE_ENUM_ROLLBACK) {
+ else if (priv->role == PK_ROLE_ENUM_ROLLBACK)
ret = pk_client_rollback (client, priv->cached_transaction_id, error);
- } else if (priv->role == PK_ROLE_ENUM_GET_DETAILS) {
+ else if (priv->role == PK_ROLE_ENUM_GET_DETAILS)
ret = pk_client_get_details (client, priv->cached_package_ids, error);
- } else if (priv->role == PK_ROLE_ENUM_GET_FILES) {
+ else if (priv->role == PK_ROLE_ENUM_GET_FILES)
ret = pk_client_get_files (client, priv->cached_package_ids, error);
- } else if (priv->role == PK_ROLE_ENUM_DOWNLOAD_PACKAGES) {
+ else if (priv->role == PK_ROLE_ENUM_DOWNLOAD_PACKAGES)
ret = pk_client_download_packages (client, priv->cached_package_ids, priv->cached_directory, error);
- } else if (priv->role == PK_ROLE_ENUM_GET_REQUIRES) {
+ else if (priv->role == PK_ROLE_ENUM_GET_REQUIRES)
ret = pk_client_get_requires (client, priv->cached_filters, priv->cached_package_ids, priv->cached_force, error);
- } else if (priv->role == PK_ROLE_ENUM_GET_UPDATES) {
+ else if (priv->role == PK_ROLE_ENUM_GET_UPDATES)
ret = pk_client_get_updates (client, priv->cached_filters, error);
- } else if (priv->role == PK_ROLE_ENUM_SEARCH_DETAILS) {
+ else if (priv->role == PK_ROLE_ENUM_SEARCH_DETAILS)
ret = pk_client_search_details (client, priv->cached_filters, priv->cached_search, error);
- } else if (priv->role == PK_ROLE_ENUM_SEARCH_FILE) {
+ else if (priv->role == PK_ROLE_ENUM_SEARCH_FILE)
ret = pk_client_search_file (client, priv->cached_filters, priv->cached_search, error);
- } else if (priv->role == PK_ROLE_ENUM_SEARCH_GROUP) {
+ else if (priv->role == PK_ROLE_ENUM_SEARCH_GROUP)
ret = pk_client_search_group (client, priv->cached_filters, priv->cached_search, error);
- } else if (priv->role == PK_ROLE_ENUM_SEARCH_NAME) {
+ else if (priv->role == PK_ROLE_ENUM_SEARCH_NAME)
ret = pk_client_search_name (client, priv->cached_filters, priv->cached_search, error);
- } else if (priv->role == PK_ROLE_ENUM_INSTALL_PACKAGES) {
+ else if (priv->role == PK_ROLE_ENUM_INSTALL_PACKAGES)
ret = pk_client_install_packages (client, priv->cached_package_ids, error);
- } else if (priv->role == PK_ROLE_ENUM_INSTALL_FILES) {
+ else if (priv->role == PK_ROLE_ENUM_INSTALL_FILES)
ret = pk_client_install_files (client, priv->cached_trusted, priv->cached_full_paths, error);
- } else if (priv->role == PK_ROLE_ENUM_INSTALL_SIGNATURE) {
+ else if (priv->role == PK_ROLE_ENUM_INSTALL_SIGNATURE)
ret = pk_client_install_signature (client, PK_SIGTYPE_ENUM_GPG, priv->cached_key_id, priv->cached_package_id, error);
- } else if (priv->role == PK_ROLE_ENUM_REFRESH_CACHE) {
+ else if (priv->role == PK_ROLE_ENUM_REFRESH_CACHE)
ret = pk_client_refresh_cache (client, priv->cached_force, error);
- } else if (priv->role == PK_ROLE_ENUM_REMOVE_PACKAGES) {
+ else if (priv->role == PK_ROLE_ENUM_REMOVE_PACKAGES)
ret = pk_client_remove_packages (client, priv->cached_package_ids, priv->cached_allow_deps, priv->cached_autoremove, error);
- } else if (priv->role == PK_ROLE_ENUM_UPDATE_PACKAGES) {
+ else if (priv->role == PK_ROLE_ENUM_UPDATE_PACKAGES)
ret = pk_client_update_packages (client, priv->cached_package_ids, error);
- } else if (priv->role == PK_ROLE_ENUM_UPDATE_SYSTEM) {
+ else if (priv->role == PK_ROLE_ENUM_UPDATE_SYSTEM)
ret = pk_client_update_system (client, error);
- } else if (priv->role == PK_ROLE_ENUM_GET_REPO_LIST) {
+ else if (priv->role == PK_ROLE_ENUM_GET_REPO_LIST)
ret = pk_client_get_repo_list (client, priv->cached_filters, error);
- } else {
+ else {
pk_client_error_set (error, PK_CLIENT_ERROR_ROLE_UNKNOWN, "role unknown for reque");
return FALSE;
}
@@ -3697,9 +3687,8 @@ static void
pk_connection_changed_cb (PkConnection *pconnection, gboolean connected, PkClient *client)
{
/* if PK re-started mid-transaction then show a big fat warning */
- if (!connected && client->priv->tid != NULL && !client->priv->is_finished) {
+ if (!connected && client->priv->tid != NULL && !client->priv->is_finished)
egg_warning ("daemon disconnected mid-transaction!");
- }
}
/**
@@ -3708,9 +3697,8 @@ pk_connection_changed_cb (PkConnection *pconnection, gboolean connected, PkClien
static gboolean
pk_client_disconnect_proxy (PkClient *client)
{
- if (client->priv->proxy == NULL) {
+ if (client->priv->proxy == NULL)
return FALSE;
- }
dbus_g_proxy_disconnect_signal (client->priv->proxy, "Finished",
G_CALLBACK (pk_client_finished_cb), client);
dbus_g_proxy_disconnect_signal (client->priv->proxy, "ProgressChanged",
@@ -3781,9 +3769,8 @@ pk_client_reset (PkClient *client, GError **error)
egg_debug ("not exit status, will try to cancel tid %s", client->priv->tid);
/* we try to cancel the running tranaction */
ret = pk_client_cancel (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
}
g_free (client->priv->tid);
@@ -3860,9 +3847,8 @@ pk_client_init (PkClient *client)
client->priv->pconnection = pk_connection_new ();
client->priv->pconnection_signal_id = g_signal_connect (client->priv->pconnection, "connection-changed",
G_CALLBACK (pk_connection_changed_cb), client);
- if (pk_connection_valid (client->priv->pconnection)) {
+ if (pk_connection_valid (client->priv->pconnection))
pk_client_connect (client);
- }
/* Use a main control object */
client->priv->control = pk_control_new ();
@@ -3964,9 +3950,8 @@ pk_client_finalize (GObject *object)
g_strfreev (client->priv->cached_full_paths);
/* clear the loop, if we were using it */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_quit (client->priv->loop);
- }
g_main_loop_unref (client->priv->loop);
/* disconnect signal handlers */
@@ -4082,9 +4067,8 @@ pk_client_test (EggTest *test)
file = pk_resolve_local_path ("/etc/hosts");
if (file != NULL && egg_strequal (file, "/etc/hosts"))
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "got: %s", file);
- }
g_free (file);
/************************************************************/
@@ -4092,9 +4076,8 @@ pk_client_test (EggTest *test)
file = pk_resolve_local_path ("/etc/../etc/hosts");
if (file != NULL && egg_strequal (file, "/etc/hosts"))
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "got: %s", file);
- }
g_free (file);
/************************************************************/
@@ -4123,13 +4106,12 @@ pk_client_test (EggTest *test)
/************************************************************/
egg_test_title (test, "we finished?");
- if (!ret) {
+ if (!ret)
egg_test_failed (test, "not correct return value");
- } else if (!finished) {
+ else if (!finished)
egg_test_failed (test, "not finished");
- } else {
+ else
egg_test_success (test, NULL);
- }
/************************************************************/
egg_test_title (test, "get new client so we can test resets in ::Finished()");
@@ -4154,11 +4136,10 @@ pk_client_test (EggTest *test)
/************************************************************/
egg_test_title (test, "check reset failed");
- if (!reset_okay) {
+ if (!reset_okay)
egg_test_success (test, "failed to reset in finished as sync");
- } else {
+ else
egg_test_failed (test, "reset in finished when sync");
- }
g_object_unref (client);
@@ -4204,9 +4185,8 @@ pk_client_test (EggTest *test)
ret = pk_client_get_updates (client, PK_FILTER_ENUM_NONE, NULL);
if (!ret)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "got updates with no reset (no description possible)");
- }
/************************************************************/
egg_test_title (test, "reset client #2");
@@ -4229,9 +4209,8 @@ pk_client_test (EggTest *test)
list = pk_client_get_package_list (client);
size = pk_package_list_get_size (list);
g_object_unref (list);
- if (size == 0) {
+ if (size == 0)
egg_test_failed (test, "failed: to get any results");
- }
egg_test_success (test, "search name with %i entries", size);
/************************************************************/
@@ -4251,9 +4230,8 @@ pk_client_test (EggTest *test)
list = pk_client_get_package_list (client);
size_new = pk_package_list_get_size (list);
g_object_unref (list);
- if (size != size_new) {
+ if (size != size_new)
egg_test_failed (test, "old size %i, new size %", size, size_new);
- }
}
egg_test_success (test, "%i search name loops completed in %ims", i, egg_test_elapsed (test));
g_object_unref (client);
@@ -4292,18 +4270,16 @@ pk_client_test (EggTest *test)
g_free (tid);
egg_test_loop_wait (test, 5000);
- if (clone_packages != size_new) {
+ if (clone_packages != size_new)
egg_test_failed (test, "failed to get correct number of packages: %i", clone_packages);
- }
egg_test_success (test, "cloned in %i", egg_test_elapsed (test));
/************************************************************/
egg_test_title (test, "cancel a finished task");
ret = pk_client_cancel (client, &error);
if (ret) {
- if (error != NULL) {
+ if (error != NULL)
egg_test_failed (test, "error set and retval true");
- }
egg_test_success (test, "did not cancel finished task");
} else {
egg_test_failed (test, "error %s", error->message);
@@ -4318,14 +4294,12 @@ pk_client_test (EggTest *test)
client = pk_client_new ();
ret = pk_client_set_tid (client, "/made_up_tid", &error);
if (ret) {
- if (error != NULL) {
+ if (error != NULL)
egg_test_failed (test, "error set and retval true");
- }
egg_test_success (test, NULL);
} else {
- if (error == NULL) {
+ if (error == NULL)
egg_test_failed (test, "error not set and retval false");
- }
egg_test_failed (test, "error %s", error->message);
g_error_free (error);
error = NULL;
@@ -4335,14 +4309,12 @@ pk_client_test (EggTest *test)
egg_test_title (test, "cancel a non running task");
ret = pk_client_cancel (client, &error);
if (ret) {
- if (error != NULL) {
+ if (error != NULL)
egg_test_failed (test, "error set and retval true");
- }
egg_test_success (test, "did not cancel non running task");
} else {
- if (error == NULL) {
+ if (error == NULL)
egg_test_failed (test, "error not set and retval false");
- }
egg_test_failed (test, "error %s", error->message);
g_error_free (error);
error = NULL;
diff --git a/libpackagekit/pk-client.h b/libpackagekit/pk-client.h
index 84f1337..c53e33b 100644
--- a/libpackagekit/pk-client.h
+++ b/libpackagekit/pk-client.h
@@ -64,6 +64,7 @@ typedef enum
PK_CLIENT_ERROR_NO_TID,
PK_CLIENT_ERROR_ALREADY_TID,
PK_CLIENT_ERROR_ROLE_UNKNOWN,
+ PK_CLIENT_ERROR_CANNOT_START_DAEMON,
PK_CLIENT_ERROR_INVALID_PACKAGEID
} PkClientError;
diff --git a/libpackagekit/pk-control.c b/libpackagekit/pk-control.c
index df64249..366a0e3 100644
--- a/libpackagekit/pk-control.c
+++ b/libpackagekit/pk-control.c
@@ -396,17 +396,15 @@ pk_control_get_backend_detail (PkControl *control, gchar **name, gchar **author,
}
/* copy needed bits */
- if (name != NULL) {
+ if (name != NULL)
*name = tname;
- } else {
+ else
g_free (tauthor);
- }
/* copy needed bits */
- if (author != NULL) {
+ if (author != NULL)
*author = tauthor;
- } else {
+ else
g_free (tauthor);
- }
return ret;
}
@@ -519,7 +517,10 @@ pk_control_allocate_transaction_id (PkControl *control, gchar **tid, GError **er
G_TYPE_INVALID);
if (!ret) {
egg_warning ("GetTid failed :%s", error_local->message);
- pk_control_error_set (error, PK_CONTROL_ERROR_FAILED, error_local->message);
+ if (error_local->code == DBUS_GERROR_SPAWN_CHILD_EXITED)
+ pk_control_error_set (error, PK_CONTROL_ERROR_CANNOT_START_DAEMON, "cannot GetTid: %s", error_local->message);
+ else
+ pk_control_error_set (error, PK_CONTROL_ERROR_FAILED, error_local->message);
g_error_free (error_local);
goto out;
}
@@ -561,9 +562,8 @@ pk_control_transaction_list_print (PkControl *control)
g_return_val_if_fail (PK_IS_CONTROL (control), FALSE);
length = g_strv_length (control->priv->array);
- if (length == 0) {
+ if (length == 0)
return TRUE;
- }
egg_debug ("jobs:");
for (i=0; i<length; i++) {
tid = control->priv->array[i];
diff --git a/libpackagekit/pk-control.h b/libpackagekit/pk-control.h
index 1d46e41..f2fd0c0 100644
--- a/libpackagekit/pk-control.h
+++ b/libpackagekit/pk-control.h
@@ -54,7 +54,8 @@ typedef struct _PkControlClass PkControlClass;
*/
typedef enum
{
- PK_CONTROL_ERROR_FAILED
+ PK_CONTROL_ERROR_FAILED,
+ PK_CONTROL_ERROR_CANNOT_START_DAEMON,
} PkControlError;
struct _PkControl
commit c43dd242c6cae7da002579573229bbcaba575cde
Author: Stefan Haas <shaas at suse.de>
Date: Wed Sep 17 15:08:21 2008 +0200
zypp: cleaned whatprovides method
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index fb905b1..86ff0a0 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -1747,6 +1747,7 @@ backend_repo_set_data (PkBackend *backend, const gchar *repo_id, const gchar *pa
static gboolean
backend_what_provides_thread (PkBackend *backend)
{
+ pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
const gchar *search;
search = pk_backend_get_string (backend, "search");
zypp::Capability cap (search);
@@ -1776,17 +1777,8 @@ backend_what_provides_thread (PkBackend *backend)
gboolean hit = FALSE;
- if (it->status ().isToBeUninstalled ()) {
- status = PK_INFO_ENUM_REMOVING;
- hit = TRUE;
- }else if (it->status ().isToBeInstalled ()) {
- status = PK_INFO_ENUM_INSTALLING;
- hit = TRUE;
- }else if (it->status ().isToBeUninstalledDueToUpgrade ()) {
- status = PK_INFO_ENUM_UPDATING;
- hit = TRUE;
- }else if (it->status ().isToBeUninstalledDueToObsolete ()) {
- status = PK_INFO_ENUM_OBSOLETING;
+ if (it->status ().isToBeInstalled ()) {
+ status = PK_INFO_ENUM_AVAILABLE;
hit = TRUE;
}
commit 7b92d0ffab368d4747cd071ab2dc7b923f159ee8
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 17 13:45:06 2008 +0100
bugfix: don't crash the client tools if we use pk_control_transaction_list_refresh with a null error
diff --git a/libpackagekit/pk-control.c b/libpackagekit/pk-control.c
index f717590..df64249 100644
--- a/libpackagekit/pk-control.c
+++ b/libpackagekit/pk-control.c
@@ -591,7 +591,6 @@ pk_control_transaction_list_refresh (PkControl *control, GError **error)
g_strfreev (control->priv->array);
control->priv->array = NULL;
}
- error = NULL;
ret = dbus_g_proxy_call (control->priv->proxy, "GetTransactionList", &error_local,
G_TYPE_INVALID,
G_TYPE_STRV, &control->priv->array,
@@ -828,9 +827,8 @@ pk_control_init (PkControl *control)
/* get a connection to the engine object */
control->priv->proxy = dbus_g_proxy_new_for_name (control->priv->connection,
PK_DBUS_SERVICE, PK_DBUS_PATH, PK_DBUS_INTERFACE);
- if (control->priv->proxy == NULL) {
+ if (control->priv->proxy == NULL)
egg_error ("Cannot connect to PackageKit.");
- }
dbus_g_proxy_add_signal (control->priv->proxy, "TransactionListChanged",
G_TYPE_STRV, G_TYPE_INVALID);
commit 7022bc1690935163a991467d98ca76c4a4f8ae20
Merge: e6beb73... 690aaef...
Author: Stefan Haas <shaas at suse.de>
Date: Wed Sep 17 14:41:01 2008 +0200
Merge branch 'master' of git+ssh://shaas@git.packagekit.org/srv/git/PackageKit
commit e6beb73a8925a6f14011c609408cf5876a4a48a5
Author: Stefan Haas <shaas at suse.de>
Date: Wed Sep 17 14:40:44 2008 +0200
zypp: build pool before solving
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index b9e86ca..fb905b1 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -1756,7 +1756,7 @@ backend_what_provides_thread (PkBackend *backend)
// solver run
- zypp::ResPool pool = zypp::ResPool::instance ();
+ zypp::ResPool pool = zypp_build_pool(true);
zypp::Resolver solver(pool);
if (solver.resolvePool () == FALSE) {
commit 690aaefe0664eba2b33edc7cd3fba61e5d0fa57f
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 17 13:13:29 2008 +0100
trivial: add a link to packagekit to fix the make check
diff --git a/data/tests/packagekit b/data/tests/packagekit
new file mode 120000
index 0000000..50227aa
--- /dev/null
+++ b/data/tests/packagekit
@@ -0,0 +1 @@
+../../python/packagekit
\ No newline at end of file
commit 2897f1fa04e883b93a057383533c67bb648906f6
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 17 13:13:03 2008 +0100
trivial: add three new screenshots
diff --git a/docs/html/img/Makefile.am b/docs/html/img/Makefile.am
index d4b1358..bb94122 100644
--- a/docs/html/img/Makefile.am
+++ b/docs/html/img/Makefile.am
@@ -35,6 +35,9 @@ IMAGE_FILES = \
gpk-waiting.png \
gpk-remove-confirm.png \
gpk-distro-upgrade-notify.png \
+ gpk-client-codecs.png \
+ gpk-client-mime-type.png \
+ gpk-client-font.png \
$(NULL)
EXTRA_DIST = \
diff --git a/docs/html/img/gpk-client-codecs.png b/docs/html/img/gpk-client-codecs.png
new file mode 100644
index 0000000..bfb0b51
Binary files /dev/null and b/docs/html/img/gpk-client-codecs.png differ
diff --git a/docs/html/img/gpk-client-font.png b/docs/html/img/gpk-client-font.png
new file mode 100644
index 0000000..ef12fcc
Binary files /dev/null and b/docs/html/img/gpk-client-font.png differ
diff --git a/docs/html/img/gpk-client-mime-type.png b/docs/html/img/gpk-client-mime-type.png
new file mode 100644
index 0000000..d91cbd4
Binary files /dev/null and b/docs/html/img/gpk-client-mime-type.png differ
diff --git a/docs/html/pk-screenshots.html b/docs/html/pk-screenshots.html
index a65d193..5d002fc 100644
--- a/docs/html/pk-screenshots.html
+++ b/docs/html/pk-screenshots.html
@@ -93,6 +93,15 @@
<center><img src="img/gpk-auto-update.png" alt=""/></center>
<p class="caption">Auto update install dialog</p>
+<center><img src="img/gpk-client-codecs.png" alt=""/></center>
+<p class="caption">Session installer for codecs</p>
+
+<center><img src="img/gpk-client-font.png" alt=""/></center>
+<p class="caption">Session installer for fonts</p>
+
+<center><img src="img/gpk-client-mime-type.png" alt=""/></center>
+<p class="caption">Session installer for MIME types</p>
+
<h1><a name="kde">KDE Screenshots</a></h1>
<center><img src="img/kpk-update.png" alt=""/></center>
commit abcd1d57ad8c74bca8465c019f54b50e841255e7
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 17 12:42:07 2008 +0100
bugfix: store translations in the C locale so we can still provide a package name in C even if there are no translations
diff --git a/client/pk-import-desktop.c b/client/pk-import-desktop.c
index 0fd7f1b..5feab0b 100644
--- a/client/pk-import-desktop.c
+++ b/client/pk-import-desktop.c
@@ -157,6 +157,11 @@ pk_desktop_process_desktop (const gchar *package_name, const gchar *filename)
/* get the default entry */
name_unlocalised = g_key_file_get_string (key, G_KEY_FILE_DESKTOP_GROUP, "Name", NULL);
+ if (!egg_strzero (name_unlocalised)) {
+ g_print ("C");
+ pk_extra_set_locale (extra, "C");
+ pk_extra_set_data_locale (extra, package_name, name_unlocalised);
+ }
/* for each locale */
for (i=0; i<locale_array->len; i++) {
diff --git a/libpackagekit/pk-extra.c b/libpackagekit/pk-extra.c
index 5f33919..a2ce19c 100644
--- a/libpackagekit/pk-extra.c
+++ b/libpackagekit/pk-extra.c
@@ -229,6 +229,16 @@ pk_extra_populate_locale_cache (PkExtra *extra)
sqlite3_free (error_msg);
return FALSE;
}
+
+ /* get summary packages - no translation */
+ statement = g_strdup_printf ("SELECT package, summary FROM localised WHERE locale = '%s'", "C");
+ rc = sqlite3_exec (extra->priv->db, statement, pk_extra_populate_locale_cache_callback, extra, &error_msg);
+ g_free (statement);
+ if (rc != SQLITE_OK) {
+ egg_warning ("SQL error: %s\n", error_msg);
+ sqlite3_free (error_msg);
+ return FALSE;
+ }
return TRUE;
}
commit 2661b1227176bf1ff1b52f92417e7285e568081d
Merge: a622fc4... 92f8881...
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 17 12:41:36 2008 +0100
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit 92f8881f4810ea272fbc669f8aee91064eeb0ca4
Author: Aurelien Lefebvre <alefebvre at mandriva.com>
Date: Wed Sep 17 13:10:34 2008 +0200
urpmi: trivial: using tabs instead of spaces to split commands in dispatched backend
diff --git a/backends/urpmi/helpers/urpmi-dispatched-backend.pl b/backends/urpmi/helpers/urpmi-dispatched-backend.pl
index aca9cba..f303280 100755
--- a/backends/urpmi/helpers/urpmi-dispatched-backend.pl
+++ b/backends/urpmi/helpers/urpmi-dispatched-backend.pl
@@ -67,7 +67,7 @@ print "finished\n";
while(<STDIN>) {
chomp($_);
- my @args = split (/ /, $_);
+ my @args = split (/\t/, $_);
dispatch_command($urpm, \@args);
print "finished\n";
}
commit a622fc47f0ed0a52b93045e0df4676522436c03e
Merge: 5d804fe... 112edcf...
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 17 11:48:21 2008 +0100
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit 112edcf2fcfe4e7eb8108831b8e1ab9bcd96f8fb
Merge: 2294a90... c1b6070...
Author: Aurelien Lefebvre <alefebvre at mandriva.com>
Date: Wed Sep 17 12:46:21 2008 +0200
Merge branch 'master' of git+ssh://alk@git.packagekit.org/srv/git/PackageKit
commit 2294a900ca822ffb65a7855739b7635f7c2f7b6a
Author: Aurelien Lefebvre <alefebvre at mandriva.com>
Date: Wed Sep 17 12:45:50 2008 +0200
urpmi: now using dispatched backend
diff --git a/backends/urpmi/helpers/Makefile.am b/backends/urpmi/helpers/Makefile.am
index be2cc19..aba39ec 100644
--- a/backends/urpmi/helpers/Makefile.am
+++ b/backends/urpmi/helpers/Makefile.am
@@ -5,24 +5,6 @@ helperdir = $(datadir)/PackageKit/helpers/urpmi
NULL =
dist_helper_DATA = \
- search-name.pl \
- get-details.pl \
- get-depends.pl \
- get-files.pl \
- get-updates.pl \
- get-update-detail.pl \
- refresh-cache.pl \
- install-packages.pl \
- remove-packages.pl \
- search-group.pl \
- get-packages.pl \
- get-requires.pl \
- search-details.pl \
- search-file.pl \
- resolve.pl \
- update-packages.pl \
- update-system.pl \
- get-distro-upgrades.pl \
urpmi-dispatched-backend.pl \
$(NULL)
diff --git a/backends/urpmi/helpers/get-depends.pl b/backends/urpmi/helpers/get-depends.pl
deleted file mode 100755
index fc7950e..0000000
--- a/backends/urpmi/helpers/get-depends.pl
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2008 Aurelien Lefebvre <alefebvre at mandriva.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.
-#
-
-use strict;
-
-use lib;
-use File::Basename;
-
-BEGIN {
- push @INC, dirname($0);
-}
-
-use URPM;
-use urpm;
-use urpm::args;
-use urpm::media;
-use urpm::select;
-
-use urpmi_backend::open_db;
-use urpmi_backend::tools;
-
-use perl_packagekit::enums;
-use perl_packagekit::prints;
-
-# At least 3 arguments (filter, package ids, recursive)
-$#ARGV > 1 or exit 1;
-
-my @filters = split(/;/, $ARGV[0]);
-shift @ARGV;
-my $recursive_text = pop(@ARGV);
-my $recursive_option = $recursive_text eq "yes" ? 1 : 0;
-my @pkgids = @ARGV;
-
-# We force the recursive option
-$recursive_option = 1;
-
-pk_print_status(PK_STATUS_ENUM_DEP_RESOLVE);
-
-my $urpm = urpm->new_parse_cmdline;
-urpm::media::configure($urpm);
-
-my @pkgnames;
-foreach (@pkgids) {
- my @pkgid = split(/;/, $_);
- push(@pkgnames, $pkgid[0]);
-}
-
-my %requested;
-my $results = urpm::select::search_packages($urpm, \%requested, \@pkgnames,
- fuzzy => 0,
- caseinsensitive => 0,
- all => 0
-);
-
-$results or exit;
-
-my $empty_db = new URPM;
-my $state = {};
-$urpm->resolve_requested($empty_db,
- $state,
- \%requested,
-);
-
-my $db = open_rpm_db();
-$urpm->compute_installed_flags($db);
-
-my %selected = %{$state->{selected}};
-my @selected_keys = keys %selected;
-my @depslist = @{$urpm->{depslist}};
-
-foreach(sort {@depslist[$b]->flag_installed <=> @depslist[$a]->flag_installed} @selected_keys) {
- my $pkg = @depslist[$_];
- if($pkg->flag_installed) {
- next if(grep(/^${\FILTER_NOT_INSTALLED}$/, @filters));
- pk_print_package(INFO_INSTALLED, get_package_id($pkg), $pkg->summary);
- }
- else {
- next if(grep(/^${\FILTER_INSTALLED}$/, @filters));
- pk_print_package(INFO_AVAILABLE, get_package_id($pkg), $pkg->summary);
- }
-}
-
diff --git a/backends/urpmi/helpers/get-details.pl b/backends/urpmi/helpers/get-details.pl
deleted file mode 100755
index ec2964e..0000000
--- a/backends/urpmi/helpers/get-details.pl
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2008 Aurelien Lefebvre <alefebvre at mandriva.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.
-#
-
-use strict;
-
-use lib;
-use File::Basename;
-
-BEGIN {
- push @INC, dirname($0);
-}
-
-use urpm;
-use urpm::args;
-use urpm::media;
-use urpmi_backend::tools;
-use MDK::Common;
-
-use perl_packagekit::prints;
-
-# One argument (package ids)
-$#ARGV > -1 or exit 1;
-
-my $urpm = urpm->new_parse_cmdline;
-urpm::media::configure($urpm);
-
-my @pkgids = @ARGV;
-
-foreach (@pkgids) {
- print_package_details($urpm, $_);
-}
-
-sub print_package_details {
-
- my ($urpm, $pkgid) = @_;
-
- my $pkg = get_package_by_package_id($urpm, $pkgid);
- $pkg or return;
-
- my $medium = pkg2medium($pkg, $urpm);
- my $xml_info = 'info';
- my $xml_info_file = urpm::media::any_xml_info($urpm, $medium, $xml_info, undef, undef);
-
- if(!$xml_info_file) {
- pk_print_details(get_package_id($pkg), "N/A", $pkg->group, "N/A", "N/A", 0);
- exit 0;
- }
-
- require urpm::xml_info;
- require urpm::xml_info_pkg;
- my $name = urpm_name($pkg);
- my %nodes = eval { urpm::xml_info::get_nodes($xml_info, $xml_info_file, [ $name ]) };
- my %xml_info_pkgs;
- put_in_hash($xml_info_pkgs{$name} ||= {}, $nodes{$name});
- my $description = $xml_info_pkgs{$name}{description};
- $description =~ s/\n/;/g;
- $description =~ s/\t/ /g;
-
- pk_print_details(get_package_id($pkg), "N/A", $pkg->group, ensure_utf8($description), "N/A", $pkg->size);
-}
-
diff --git a/backends/urpmi/helpers/get-distro-upgrades.pl b/backends/urpmi/helpers/get-distro-upgrades.pl
deleted file mode 100755
index 137cf1d..0000000
--- a/backends/urpmi/helpers/get-distro-upgrades.pl
+++ /dev/null
@@ -1,118 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2008 Aurelien Lefebvre <alefebvre at mandriva.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.
-#
-
-use strict;
-
-use lib;
-use File::Basename;
-
-BEGIN {
- push @INC, dirname($0);
-}
-
-use perl_packagekit::prints;
-use perl_packagekit::enums;
-
-pk_print_status(PK_STATUS_ENUM_QUERY);
-
-open(PRODUCT_FILE, "/etc/product.id");
-
-my %product_id;
-%product_id = parse_line(<PRODUCT_FILE>);
-close(PRODUCT_FILE);
-
-my $distribfile_path = "/tmp/distrib.list";
-download_distrib_file($distribfile_path, \%product_id);
-
--f $distribfile_path or finished(1);
-
-my @distribs;
-open(DISTRIB_FILE, $distribfile_path);
-while(<DISTRIB_FILE>) {
- my %distrib = parse_line($_);
- push(@distribs, \%distrib);
-}
-close(DISTRIB_FILE);
-
-my $distrib;
-foreach (@distribs) {
- if($_->{version} == $product_id{version}) {
- $distrib = $_;
- }
-}
-
-$distrib or finished(0);
- at distribs = sort { $b->{release_date} <=> $a->{release_date} } @distribs;
-
-my $newer_version = get_newer_distrib($distrib->{version}, \@distribs);
-$newer_version or finished(0);
-pk_print_distro_upgrade(PK_DISTRO_UPGRADE_ENUM_STABLE, join(" ", "Mandriva", $product_id{product}, $newer_version->{version}), "");
-
-unlink($distribfile_path);
-pk_print_status(PK_STATUS_ENUM_FINISHED);
-
-sub parse_line {
- my ($line) = @_;
- my %hash;
- my @affects = split(/,/, $line);
- foreach my $affect (@affects) {
- my ($variable, $value) = split(/=/, $affect);
- chomp($variable);
- chomp($value);
- $hash{$variable} = $value;
- }
- return %hash;
-}
-
-sub download_distrib_file {
-
- my ($outfile, $product_id) = @_;
-
- -x "/usr/bin/wget" or die "wget is missing\n";
-
- my $api_url = sprintf("http://api.mandriva.com/distributions/%s.%s.list?product=%s",
- lc($product_id->{type}),
- lc($product_id->{arch}),
- lc($product_id->{product}));
-
- my $wget_command = join(" ",
- "/usr/bin/wget",
- "--quiet",
- "--output-document", $outfile,
- $api_url);
-
- my $wget_pid = open(my $wget, "$wget_command |");
- close($wget);
-}
-
-sub get_newer_distrib {
-
- my ($installed_version, $distrib_list) = @_;
- my $installed_distrib;
- foreach (@$distrib_list) {
- if($_->{version} == $installed_version) {
- $installed_distrib = $_;
- }
- }
- $installed_distrib or return;
- foreach (@$distrib_list) {
- if($installed_distrib->{release_date} < $_->{release_date}) {
- return $_;
- }
- }
-}
-
-sub finished {
- my ($exit_status) = @_;
- pk_print_status(PK_STATUS_ENUM_FINISHED);
- exit $exit_status;
-}
diff --git a/backends/urpmi/helpers/get-files.pl b/backends/urpmi/helpers/get-files.pl
deleted file mode 100755
index ba6aa27..0000000
--- a/backends/urpmi/helpers/get-files.pl
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2008 Aurelien Lefebvre <alefebvre at mandriva.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.
-#
-
-use strict;
-
-use lib;
-use File::Basename;
-
-BEGIN {
- push @INC, dirname($0);
-}
-
-use urpm;
-use urpm::args;
-use urpm::media;
-use urpmi_backend::tools;
-use MDK::Common;
-
-use perl_packagekit::prints;
-
-# One argument (package ids)
-$#ARGV > -1 or exit 1;
-
-my $urpm = urpm->new_parse_cmdline;
-urpm::media::configure($urpm);
-
-my @pkgids = @ARGV;
-
-foreach (@pkgids) {
- print_package_files($urpm, $_);
-}
-
-sub print_package_files {
-
- my ($urpm, $pkgid) = @_;
-
- my $pkg = get_package_by_package_id($urpm, $pkgid);
- $pkg or return;
-
- my $medium = pkg2medium($pkg, $urpm);
- my $xml_info = 'files';
- my $xml_info_file = urpm::media::any_xml_info($urpm, $medium, $xml_info, undef, undef);
- require urpm::xml_info;
- require urpm::xml_info_pkg;
- my $name = urpm_name($pkg);
- my %nodes = eval { urpm::xml_info::get_nodes($xml_info, $xml_info_file, [ $name ]) };
- my %xml_info_pkgs;
- put_in_hash($xml_info_pkgs{$name} ||= {}, $nodes{$name});
- my @files = map { chomp_($_) } split("\n", $xml_info_pkgs{$name}{files});
-
- pk_print_files(get_package_id($pkg), join(';', @files));
-
-}
diff --git a/backends/urpmi/helpers/get-packages.pl b/backends/urpmi/helpers/get-packages.pl
deleted file mode 100755
index bef46aa..0000000
--- a/backends/urpmi/helpers/get-packages.pl
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2008 Aurelien Lefebvre <alefebvre at mandriva.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.
-#
-
-use strict;
-
-use lib;
-use File::Basename;
-
-BEGIN {
- push @INC, dirname($0);
-}
-
-use urpm;
-use urpm::media;
-use urpm::args;
-
-use urpmi_backend::open_db;
-use urpmi_backend::tools;
-use urpmi_backend::filters;
-
-use perl_packagekit::enums;
-use perl_packagekit::prints;
-
-# One argument (the filter)
-exit if ($#ARGV != 0);
-my @filters = split(/;/, $ARGV[0]);
-
-my $urpm = urpm->new_parse_cmdline;
-
-urpm::media::configure($urpm);
-
-my $db = open_rpm_db();
-$urpm->compute_installed_flags($db);
-
-# Here we display installed packages
-if(not grep(/^${\FILTER_NOT_INSTALLED}$/, @filters)) {
- $db->traverse(sub {
- my ($pkg) = @_;
- if(filter($pkg, \@filters, {FILTER_DEVELOPMENT => 1, FILTER_GUI => 1})) {
- pk_print_package(INFO_INSTALLED, get_package_id($pkg), ensure_utf8($pkg->summary));
- }
- });
-}
-
-# Here are package which can be installed
-if(not grep(/^${\FILTER_INSTALLED}$/, @filters)) {
- foreach my $pkg(@{$urpm->{depslist}}) {
- if($pkg->flag_upgrade) {
- if(filter($pkg, \@filters, {FILTER_DEVELOPMENT => 1, FILTER_GUI => 1})) {
- pk_print_package(INFO_AVAILABLE, get_package_id($pkg), ensure_utf8($pkg->summary));
- }
- }
- }
-}
diff --git a/backends/urpmi/helpers/get-requires.pl b/backends/urpmi/helpers/get-requires.pl
deleted file mode 100755
index a49e198..0000000
--- a/backends/urpmi/helpers/get-requires.pl
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2008 Aurelien Lefebvre <alefebvre at mandriva.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.
-#
-
-use strict;
-
-use lib;
-use File::Basename;
-
-BEGIN {
- push @INC, dirname($0);
-}
-
-use urpm;
-use urpm::args;
-use urpm::media;
-use urpm::select;
-use urpmi_backend::tools;
-use urpmi_backend::actions;
-use urpmi_backend::filters;
-use perl_packagekit::enums;
-use perl_packagekit::prints;
-
-# At least 3 arguments
-# (filter, package ids, and recursive option)
-$#ARGV > 1 or exit 1;
-
-my @filters = split(/;/, $ARGV[0]);
-shift @ARGV;
-my $recursive_text = pop @ARGV;
-my $recursive_option = $recursive_text eq "yes" ? 1 : 0;
-
-my $urpm = urpm->new_parse_cmdline;
-urpm::media::configure($urpm);
-
-my @pkgids = @ARGV;
-my @pkgnames;
-foreach (@pkgids) {
- my $pkg = get_package_by_package_id($urpm, $_);
- $pkg and push(@pkgnames, $pkg->name);
-}
-
-pk_print_status(PK_STATUS_ENUM_DEP_RESOLVE);
-my @requires = perform_requires_search($urpm, \@pkgnames, $recursive_option);
-
-foreach(@requires) {
- if(filter($_, \@filters, { FILTER_GUI => 1, FILTER_DEVELOPMENT => 1 })) {
- if(package_version_is_installed($_)) {
- !grep(/^${\FILTER_NOT_INSTALLED}$/, @filters) and pk_print_package(INFO_INSTALLED, get_package_id($_), $_->summary);
- }
- else {
- !grep(/^${\FILTER_INSTALLED}$/, @filters) and pk_print_package(INFO_AVAILABLE, get_package_id($_), $_->summary);
- }
- }
-}
-pk_print_status(PK_STATUS_ENUM_FINISHED);
-
diff --git a/backends/urpmi/helpers/get-update-detail.pl b/backends/urpmi/helpers/get-update-detail.pl
deleted file mode 100755
index 248928a..0000000
--- a/backends/urpmi/helpers/get-update-detail.pl
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2008 Aurelien Lefebvre <alefebvre at mandriva.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.
-#
-
-use strict;
-
-use lib;
-use File::Basename;
-
-BEGIN {
- push @INC, dirname($0);
-}
-
-use urpm;
-use urpm::args;
-use urpm::media;
-use urpm::select;
-use urpmi_backend::tools;
-use urpmi_backend::open_db;
-use perl_packagekit::enums;
-use perl_packagekit::prints;
-use MDK::Common;
-
-# One argument (package ids)
-$#ARGV > -1 or exit 1;
-
-my $urpm = urpm->new_parse_cmdline;
-urpm::media::configure($urpm);
-
-my @pkgids = @ARGV;
-
-foreach (@pkgids) {
- print_package_update_details($urpm, $_);
-}
-
-sub print_package_update_details {
-
- my ($urpm, $pkgid) = @_;
- my $pkg = get_package_by_package_id($urpm, $pkgid);
- $pkg or return;
-
- my %requested;
- $requested{$pkg->id} = 1;
- my $state = {};
- my $restart = urpm::select::resolve_dependencies($urpm, $state, \%requested);
- my @ask_unselect = urpm::select::unselected_packages($urpm, $state);
- my @to_remove = urpm::select::removed_packages($urpm, $state);
- my @to_install = @{$urpm->{depslist}}[sort { $a <=> $b } keys %{$state->{selected}}];
- my ($src, $binary) = partition { $_->arch eq 'src' } @to_install;
- @to_install = @$binary;
- my $updates_descr = urpm::get_updates_description($urpm);
- my $updesc = $updates_descr->{URPM::pkg2media($urpm->{media}, $pkg)->{name}}{$pkg->name};
- my $desc;
- if($updesc) {
- $desc = $updesc->{pre};
- $desc =~ s/\n/;/g;
- }
-
- my @to_upgrade_pkids;
- foreach(@to_install) {
- my $pkid = get_installed_version_pkid($_);
- push @to_upgrade_pkids, $pkid if $pkid;
- }
-
- pk_print_update_detail(get_package_id($pkg),
- join("^", @to_upgrade_pkids),
- join("^", map(fullname_to_package_id($_), @to_remove)),
- "http://qa.mandriva.com",
- "http://qa.mandriva.com",
- "http://qa.mandriva.com",
- $restart ? PK_RESTART_ENUM_SYSTEM : PK_RESTART_ENUM_APPLICATION,
- $desc);
-}
diff --git a/backends/urpmi/helpers/get-updates.pl b/backends/urpmi/helpers/get-updates.pl
deleted file mode 100755
index cb9b881..0000000
--- a/backends/urpmi/helpers/get-updates.pl
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2008 Aurelien Lefebvre <alefebvre at mandriva.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.
-#
-
-use strict;
-
-use lib;
-use File::Basename;
-
-BEGIN {
- push @INC, dirname($0);
-}
-
-use urpm;
-use urpm::args;
-use urpm::media;
-use urpm::select;
-use MDK::Common;
-use urpmi_backend::tools;
-use perl_packagekit::enums;
-use perl_packagekit::prints;
-
-# On argument (filter)
-exit if($#ARGV != 0);
-# Fix me
-# Filter are to be implemented.
-
-my $urpm = urpm->new_parse_cmdline;
-urpm::media::configure($urpm);
-
-my $state = {};
-my %requested;
-my $restart = urpm::select::resolve_dependencies($urpm, $state, \%requested,
- auto_select => 1);
-
-my %selected = %{$state->{selected} || {}};
-my @ask_unselect = urpm::select::unselected_packages($urpm, $state);
-my @to_remove = urpm::select::removed_packages($urpm, $state);
-my @to_install = @{$urpm->{depslist}}[sort { $a <=> $b } keys %{$state->{selected}}];
- at to_install = grep { $_->arch ne 'src' } @to_install;
-my $updates_descr = urpm::get_updates_description($urpm);
-
-foreach(@to_install) {
- my $updesc = $updates_descr->{URPM::pkg2media($urpm->{media}, $_)->{name}}{$_->name};
- pk_print_package($updesc->{importance} eq "bugfix" ? INFO_BUGFIX :
- $updesc->{importance} eq "security" ? INFO_SECURITY :
- INFO_NORMAL, get_package_id($_), $_->summary);
-}
diff --git a/backends/urpmi/helpers/install-packages.pl b/backends/urpmi/helpers/install-packages.pl
deleted file mode 100755
index 1bf5f0c..0000000
--- a/backends/urpmi/helpers/install-packages.pl
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2008 Aurelien Lefebvre <alefebvre at mandriva.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.
-#
-
-use strict;
-
-use lib;
-use File::Basename;
-
-BEGIN {
- push @INC, dirname($0);
-}
-
-use urpm;
-use urpm::media;
-use urpm::select;
-
-use perl_packagekit::enums;
-use perl_packagekit::prints;
-
-use urpmi_backend::actions;
-use urpmi_backend::tools;
-
-# One or more arguments (Package ids)
-exit if($#ARGV < 0);
-
-my @pkgids = @ARGV;
-
-my @names;
-foreach(@pkgids) {
- my @pkgid = (split(/;/, $_));
- push @names, $pkgid[0];
-}
-
-my $urpm = urpm->new_parse_cmdline;
-urpm::media::configure($urpm);
-
-my %requested;
-
-urpm::select::search_packages($urpm, \%requested, \@names,
- fuzzy => 0,
- caseinsensitive => 0,
- all => 0);
-
-eval {
- perform_installation($urpm, \%requested);
-};
-pk_print_status(PK_STATUS_ENUM_FINISHED);
diff --git a/backends/urpmi/helpers/refresh-cache.pl b/backends/urpmi/helpers/refresh-cache.pl
deleted file mode 100755
index 0edd018..0000000
--- a/backends/urpmi/helpers/refresh-cache.pl
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2008 Aurelien Lefebvre <alefebvre at mandriva.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.
-#
-
-use strict;
-use lib;
-use File::Basename;
-
-BEGIN {
- push @INC, dirname($0);
-}
-
-use urpm;
-use urpm::media;
-use urpm::select;
-use urpm::args;
-use urpmi_backend::actions;
-use perl_packagekit::enums;
-use perl_packagekit::prints;
-
-# No arguments
-$#ARGV != -1 and exit 1;
-
-my $urpm = urpm->new_parse_cmdline;
-$urpm->{fatal} = sub {
- pk_print_error(PK_ERROR_ENUM_TRANSACTION_ERROR, $_[1]."\n");
- exit($_[0])
-};
-my $urpmi_lock = urpm::lock::urpmi_db($urpm, 'exclusive', wait => 0);
-urpm::media::read_config($urpm);
-
-my @entries = map { $_->{name} } @{$urpm->{media}};
- at entries == 0 and pk_print_error(PK_ERROR_ENUM_TRANSACTION_ERROR, "nothing to update (use urpmi.addmedia to add a media)\n");
-
-my %options = ( all => 1 );
-
-my $ok = urpm::media::update_media($urpm, %options, quiet => 0);
-exit($ok ? 0 : 1);
diff --git a/backends/urpmi/helpers/remove-packages.pl b/backends/urpmi/helpers/remove-packages.pl
deleted file mode 100755
index d47383a..0000000
--- a/backends/urpmi/helpers/remove-packages.pl
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2008 Aurelien Lefebvre <alefebvre at mandriva.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.
-#
-
-use strict;
-
-use lib;
-use File::Basename;
-
-BEGIN {
- push @INC, dirname($0);
-}
-
-use urpm;
-use urpm::args;
-use urpm::media;
-use urpm::select;
-use urpm::install;
-use urpmi_backend::tools;
-use perl_packagekit::enums;
-use perl_packagekit::prints;
-
-my $notfound = 0;
-my @breaking_pkgs = ();
-my $allowdeps_option = 0;
-my @pkgid;
-my $state = {};
-my $notfound_callback = sub {
- $notfound = 1;
-};
-
-# At least two arguments (allow deps & a package id list)
-exit if($#ARGV < 1);
-
-my $urpm = urpm->new_parse_cmdline;
-my $urpmi_lock = urpm::lock::urpmi_db($urpm, 'exclusive', wait => 1);
-urpm::media::configure($urpm);
-
-$allowdeps_option = shift @ARGV;
-
-my @names;
-foreach(@ARGV) {
- my @pkg_id = (split(/;/, $_));
- push @names, $pkg_id[0];
-}
-
-pk_print_status(PK_STATUS_ENUM_DEP_RESOLVE);
-
-my @to_remove = urpm::select::find_packages_to_remove($urpm,
- $state,
- \@names,
- callback_notfound => $notfound_callback,
- callback_fuzzy => $notfound_callback,
- callback_base => sub {
- my $urpm = shift @_;
- push @breaking_pkgs, @_;
- }
-);
-
-if($notfound) {
- pk_print_error(PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED, "Selected package isn't installed on your system");
-}
-elsif(@breaking_pkgs) {
- pk_print_error(PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE, "Removing selected packages will break your system");
-}
-else {
- if(!$allowdeps_option && $#to_remove > 1) {
- pk_print_error(PK_ERROR_ENUM_TRANSACTION_ERROR, "Packages can't be removed because dependencies remove is forbidden");
- }
- else {
- pk_print_status(PK_STATUS_ENUM_REMOVE);
- urpm::install::install($urpm,
- \@to_remove, {}, {},
- callback_report_uninst => sub {
- my @return = split(/ /, $_[0]);
- pk_print_package(INFO_REMOVING, fullname_to_package_id($return[$#return]), "");
- }
- );
- }
-}
-
-$urpmi_lock->unlock;
-
-pk_print_status(PK_STATUS_ENUM_FINISHED);
diff --git a/backends/urpmi/helpers/resolve.pl b/backends/urpmi/helpers/resolve.pl
deleted file mode 100755
index 2248e53..0000000
--- a/backends/urpmi/helpers/resolve.pl
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2008 Aurelien Lefebvre <alefebvre at mandriva.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.
-#
-
-use strict;
-
-use lib;
-use File::Basename;
-
-BEGIN {
- push @INC, dirname($0);
-}
-
-use urpm;
-use urpm::args;
-use urpm::media;
-use urpmi_backend::open_db;
-use urpmi_backend::tools;
-use urpmi_backend::filters;
-use perl_packagekit::enums;
-use perl_packagekit::prints;
-
-# At least two arguments (filter and packages name)
-$#ARGV > 0 or exit 1;
-my @filters = split(/;/, $ARGV[0]);
-shift @ARGV;
-my @patterns = @ARGV;
-
-my $urpm = urpm->new_parse_cmdline;
-urpm::media::configure($urpm);
-
-my %requested;
-urpm::select::search_packages($urpm, \%requested, \@patterns,
- fuzzy => 0,
- caseinsensitive => 0,
- all => 0
-);
-
-
-my @requested_keys = keys %requested;
-my $db = open_rpm_db();
-$urpm->compute_installed_flags($db);
-
-foreach (@requested_keys) {
- my $pkg = @{$urpm->{depslist}}[$_];
- ($_ && $pkg) or next;
-
- # We exit the script if found package does not match with specified filters
- filter($pkg, \@filters, {FILTER_DEVELOPMENT => 1, FILTER_GUI => 1}) or next;
-
- if($pkg->version."-".$pkg->release eq find_installed_version($pkg)) {
- grep(/^${\FILTER_NOT_INSTALLED}$/, @filters) and next;
- pk_print_package(INFO_INSTALLED, get_package_id($pkg), $pkg->summary);
- }
- else {
- grep(/^${\FILTER_INSTALLED}$/, @filters) and next;
- pk_print_package(INFO_AVAILABLE, get_package_id($pkg), $pkg->summary);
- }
-}
-
diff --git a/backends/urpmi/helpers/search-details.pl b/backends/urpmi/helpers/search-details.pl
deleted file mode 100755
index fc5b2ec..0000000
--- a/backends/urpmi/helpers/search-details.pl
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2008 Aurelien Lefebvre <alefebvre at mandriva.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.
-#
-
-use strict;
-
-use lib;
-use File::Basename;
-
-BEGIN {
- push @INC, dirname($0);
-}
-
-use urpm;
-use urpm::media;
-use urpm::args;
-
-use urpmi_backend::open_db;
-use urpmi_backend::tools;
-use urpmi_backend::filters;
-
-use perl_packagekit::enums;
-use perl_packagekit::prints;
-
-# Two arguments (filterand search term)
-exit if ($#ARGV != 1);
-my @filters = split(/;/, $ARGV[0]);
-my $search_term = $ARGV[1];
-
-my $urpm = urpm->new_parse_cmdline;
-urpm::media::configure($urpm);
-
-my $db = open_rpm_db();
-$urpm->compute_installed_flags($db);
-
-# Here we display installed packages
-if(not grep(/^${\FILTER_NOT_INSTALLED}$/, @filters)) {
- $db->traverse(sub {
- my ($pkg) = @_;
- if(filter($pkg, \@filters, {FILTER_DEVELOPMENT => 1, FILTER_GUI => 1})) {
- if($pkg->name =~ /$search_term/ || $pkg->summary =~ /$search_term/ || $pkg->url =~ /$search_term/) {
- pk_print_package(INFO_INSTALLED, get_package_id($pkg), ensure_utf8($pkg->summary));
- }
- }
- });
-}
-
-# Here are package which can be installed
-if(not grep(/^${\FILTER_INSTALLED}$/, @filters)) {
- foreach my $pkg(@{$urpm->{depslist}}) {
- if($pkg->flag_upgrade) {
- if(filter($pkg, \@filters, {FILTER_DEVELOPMENT => 1, FILTER_GUI => 1})) {
- if($pkg->name =~ /$search_term/ || $pkg->summary =~ /$search_term/ || $pkg->url =~ /$search_term/) {
- pk_print_package(INFO_AVAILABLE, get_package_id($pkg), ensure_utf8($pkg->summary));
- }
- }
- }
- }
-}
diff --git a/backends/urpmi/helpers/search-file.pl b/backends/urpmi/helpers/search-file.pl
deleted file mode 100755
index 7ba8d26..0000000
--- a/backends/urpmi/helpers/search-file.pl
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2008 Aurelien Lefebvre <alefebvre at mandriva.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.
-#
-
-use strict;
-
-use lib;
-use File::Basename;
-
-BEGIN {
- push @INC, dirname($0);
-}
-
-use urpm;
-use urpm::media;
-
-use urpmi_backend::actions;
-use urpmi_backend::filters;
-use urpmi_backend::tools;
-use perl_packagekit::prints;
-use perl_packagekit::enums;
-
-# Two arguments (filter and search term)
-exit if ($#ARGV != 1);
-my @filters = split(/;/, $ARGV[0]);
-my $search_term = $ARGV[1];
-
-my $urpm = urpm->new_parse_cmdline;
-urpm::media::configure($urpm);
-
-my %requested;
-
-pk_print_status(PK_STATUS_ENUM_QUERY);
-
-perform_file_search($urpm, \%requested, $search_term, fuzzy => 1);
-
-foreach(keys %requested) {
- my $p = @{$urpm->{depslist}}[$_];
- if(filter($p, \@filters, { FILTER_INSTALLED => 1, FILTER_DEVELOPMENT=> 1, FILTER_GUI => 1})) {
- my $version = find_installed_version($p);
- if($version eq $p->version."-".$p->release) {
- pk_print_package(INFO_INSTALLED, get_package_id($p), ensure_utf8($p->summary));
- }
- else {
- pk_print_package(INFO_AVAILABLE, get_package_id($p), ensure_utf8($p->summary));
- }
- }
-}
-
-pk_print_status(PK_STATUS_ENUM_FINISHED);
diff --git a/backends/urpmi/helpers/search-group.pl b/backends/urpmi/helpers/search-group.pl
deleted file mode 100755
index 5745a6f..0000000
--- a/backends/urpmi/helpers/search-group.pl
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2008 Aurelien Lefebvre <alefebvre at mandriva.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.
-#
-
-use strict;
-
-use lib;
-use File::Basename;
-
-BEGIN {
- push @INC, dirname($0);
-}
-
-use urpm;
-use urpm::media;
-use urpm::args;
-
-use urpmi_backend::open_db;
-use urpmi_backend::tools;
-use urpmi_backend::filters;
-use urpmi_backend::groups;
-
-use perl_packagekit::enums;
-use perl_packagekit::prints;
-
-# Two arguments (filter and packagekit group)
-exit if ($#ARGV != 1);
-my @filters = split(/;/, $ARGV[0]);
-my $pk_group = $ARGV[1];
-
-my $urpm = urpm->new_parse_cmdline;
-urpm::media::configure($urpm);
-
-my $db = open_rpm_db();
-$urpm->compute_installed_flags($db);
-
-# Here we display installed packages
-if(not grep(/^${\FILTER_NOT_INSTALLED}$/, @filters)) {
- $db->traverse(sub {
- my ($pkg) = @_;
- if(filter($pkg, \@filters, {FILTER_DEVELOPMENT => 1, FILTER_GUI => 1})) {
- if(package_belongs_to_pk_group($pkg, $pk_group)) {
- pk_print_package(INFO_INSTALLED, get_package_id($pkg), ensure_utf8($pkg->summary));
- }
- }
- });
-}
-
-# Here are package which can be installed
-if(not grep(/^${\FILTER_INSTALLED}$/, @filters)) {
- foreach my $pkg(@{$urpm->{depslist}}) {
- if($pkg->flag_upgrade) {
- if(filter($pkg, \@filters, {FILTER_DEVELOPMENT => 1, FILTER_GUI => 1})) {
- if(package_belongs_to_pk_group($pkg, $pk_group)) {
- pk_print_package(INFO_AVAILABLE, get_package_id($pkg), ensure_utf8($pkg->summary));
- }
- }
- }
- }
-}
diff --git a/backends/urpmi/helpers/search-name.pl b/backends/urpmi/helpers/search-name.pl
deleted file mode 100755
index 2a381d1..0000000
--- a/backends/urpmi/helpers/search-name.pl
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2008 Aurelien Lefebvre <alefebvre at mandriva.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.
-#
-
-use strict;
-
-use lib;
-use File::Basename;
-
-BEGIN {
- push @INC, dirname($0);
-}
-
-use urpm;
-use urpm::media;
-use urpm::args;
-
-use urpmi_backend::open_db;
-use urpmi_backend::tools;
-use urpmi_backend::filters;
-
-use perl_packagekit::enums;
-use perl_packagekit::prints;
-
-# Two arguments (filter, search term)
-exit if ($#ARGV != 1);
-
-my @filters = split(/;/, $ARGV[0]);
-my $search_term = $ARGV[1];
-
-my $basename_option = FILTER_BASENAME;
-$basename_option = grep(/$basename_option/, @filters);
-
-my $urpm = urpm->new_parse_cmdline;
-
-urpm::media::configure($urpm);
-
-my $db = open_rpm_db();
-$urpm->compute_installed_flags($db);
-
-# Here we display installed packages
-if(not grep(/^${\FILTER_NOT_INSTALLED}$/, @filters)) {
- $db->traverse(sub {
- my ($pkg) = @_;
- if(filter($pkg, \@filters, {FILTER_DEVELOPMENT => 1, FILTER_GUI => 1})) {
- if( (!$basename_option && $pkg->name =~ /$search_term/)
- || $pkg->name =~ /^$search_term$/ ) {
- pk_print_package(INFO_INSTALLED, get_package_id($pkg), ensure_utf8($pkg->summary));
- }
- }
- });
-}
-
-# Here are packages which can be installed
-if(grep(/^${\FILTER_INSTALLED}$/, @filters)) {
- exit 0;
-}
-
-foreach my $pkg(@{$urpm->{depslist}}) {
- if($pkg->flag_upgrade && filter($pkg, \@filters, {FILTER_DEVELOPMENT => 1, FILTER_GUI => 1})) {
- if( (!$basename_option && $pkg->name =~ /$search_term/)
- || $pkg->name =~ /^$search_term$/ ) {
- pk_print_package(INFO_AVAILABLE, get_package_id($pkg), ensure_utf8($pkg->summary));
- }
- }
-}
diff --git a/backends/urpmi/helpers/update-packages.pl b/backends/urpmi/helpers/update-packages.pl
deleted file mode 100755
index f7a1b76..0000000
--- a/backends/urpmi/helpers/update-packages.pl
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2008 Aurelien Lefebvre <alefebvre at mandriva.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.
-#
-
-use strict;
-
-use lib;
-use File::Basename;
-
-BEGIN {
- push @INC, dirname($0);
-}
-
-use urpm;
-use urpm::media;
-use urpm::select;
-use urpm::args;
-use urpmi_backend::tools;
-use urpmi_backend::open_db;
-use urpmi_backend::actions;
-
-# This with one or more package ids
-exit if($#ARGV < 0);
-
-my @names;
-foreach(@ARGV) {
- print "-->", $_, "<--", "\n";
- my @pkgid = split(/;/, $_);
- push @names, $pkgid[0];
-}
-
-my $urpm = urpm->new_parse_cmdline;
-urpm::media::configure($urpm);
-
-my $db = open_rpm_db();
-$urpm->compute_installed_flags($db);
-
-my %requested;
-
-my @depslist = @{$urpm->{depslist}};
-my $pkg = undef;
-foreach my $depslistpkg (@depslist) {
- foreach my $name (@names) {
- if($depslistpkg->name =~ /^$name$/ && $depslistpkg->flag_upgrade) {
- $requested{$depslistpkg->id} = 1;
- goto tonext;
- }
- }
- tonext:
-}
-
-perform_installation($urpm, \%requested);
-
diff --git a/backends/urpmi/helpers/update-system.pl b/backends/urpmi/helpers/update-system.pl
deleted file mode 100755
index c9c44c4..0000000
--- a/backends/urpmi/helpers/update-system.pl
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright (C) 2008 Aurelien Lefebvre <alefebvre at mandriva.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.
-#
-
-use strict;
-
-use lib;
-use File::Basename;
-
-BEGIN {
- push @INC, dirname($0);
-}
-
-use urpm;
-use urpm::media;
-use urpm::select;
-use urpm::args;
-use urpmi_backend::actions;
-
-# No arguments
-exit if($#ARGV != -1);
-
-my $urpm = urpm->new_parse_cmdline;
-urpm::media::configure($urpm);
-
-perform_installation($urpm, {}, auto_select => 1);
diff --git a/backends/urpmi/pk-backend-urpmi-dispatched.c b/backends/urpmi/pk-backend-urpmi-dispatched.c
deleted file mode 100644
index 5362cb9..0000000
--- a/backends/urpmi/pk-backend-urpmi-dispatched.c
+++ /dev/null
@@ -1,396 +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <pk-backend.h>
-#include <pk-backend-spawn.h>
-#include <pk-package-ids.h>
-
-static PkBackendSpawn *spawn;
-
-/**
- * backend_initialize:
- * This should only be run once per backend load, i.e. not every transaction
- */
-static void
-backend_initialize (PkBackend *backend)
-{
- egg_debug ("backend: initialize");
- spawn = pk_backend_spawn_new ();
- pk_backend_spawn_set_name (spawn, "urpmi");
-}
-
-/**
- * backend_destroy:
- * This should only be run once per backend load, i.e. not every transaction
- */
-static void
-backend_destroy (PkBackend *backend)
-{
- egg_debug ("backend: destroy");
- g_object_unref (spawn);
-}
-
-/**
- * backend_get_groups:
- */
-static PkBitfield
-backend_get_groups (PkBackend *backend)
-{
- return pk_bitfield_from_enums (
- PK_GROUP_ENUM_ACCESSIBILITY,
- PK_GROUP_ENUM_ACCESSORIES,
- PK_GROUP_ENUM_EDUCATION,
- PK_GROUP_ENUM_GAMES,
- PK_GROUP_ENUM_GRAPHICS,
- PK_GROUP_ENUM_INTERNET,
- PK_GROUP_ENUM_OFFICE,
- PK_GROUP_ENUM_OTHER,
- PK_GROUP_ENUM_PROGRAMMING,
- PK_GROUP_ENUM_MULTIMEDIA,
- PK_GROUP_ENUM_SYSTEM,
- PK_GROUP_ENUM_DESKTOP_GNOME,
- PK_GROUP_ENUM_DESKTOP_KDE,
- PK_GROUP_ENUM_DESKTOP_XFCE,
- PK_GROUP_ENUM_DESKTOP_OTHER,
- PK_GROUP_ENUM_PUBLISHING,
- PK_GROUP_ENUM_SERVERS,
- PK_GROUP_ENUM_FONTS,
- PK_GROUP_ENUM_ADMIN_TOOLS,
- PK_GROUP_ENUM_LEGACY,
- PK_GROUP_ENUM_LOCALIZATION,
- PK_GROUP_ENUM_VIRTUALIZATION,
- PK_GROUP_ENUM_POWER_MANAGEMENT,
- PK_GROUP_ENUM_SECURITY,
- PK_GROUP_ENUM_COMMUNICATION,
- PK_GROUP_ENUM_NETWORK,
- PK_GROUP_ENUM_MAPS,
- PK_GROUP_ENUM_REPOS,
- -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,
- -1);
-}
-
-/**
- * pk_backend_bool_to_text:
- */
-static const gchar *
-pk_backend_bool_to_text (gboolean value)
-{
- if (value == TRUE) {
- return "yes";
- }
- return "no";
-}
-
-
-/**
- * pk_backend_search_name:
- */
-static void
-backend_search_name (PkBackend *backend, PkBitfield filters, const gchar *search)
-{
- gchar *filters_text;
- filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-name", filters_text, search, NULL);
- g_free (filters_text);
-}
-
-/**
- * backend_get_details:
- */
-static void
-backend_get_details (PkBackend *backend, gchar **package_ids)
-{
- gchar *package_ids_temp;
- package_ids_temp = pk_package_ids_to_text (package_ids, "|");
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-details", package_ids_temp, NULL);
- g_free (package_ids_temp);
-}
-
-/**
- * backend_get_files:
- */
-static void
-backend_get_files (PkBackend *backend, gchar **package_ids)
-{
- gchar *package_ids_temp;
- package_ids_temp = pk_package_ids_to_text (package_ids, "|");
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-files", 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_text (package_ids, "|");
- filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-depends", filters_text, package_ids_temp, pk_backend_bool_to_text (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_text (filters);
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-updates", 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_text (package_ids, "|");
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-update-detail", package_ids_temp, NULL);
- g_free (package_ids_temp);
-}
-
-/**
- * backend_refresh_cache:
- */
-static void
-backend_refresh_cache (PkBackend *backend, gboolean force)
-{
- /* check network state */
- if (!pk_backend_is_online (backend)) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot refresh cache whilst offline");
- pk_backend_finished (backend);
- return;
- }
-
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "refresh-cache", NULL);
-}
-
-/**
- * backend_install_packages:
- */
-static void
-backend_install_packages (PkBackend *backend, gchar **package_ids)
-{
- gchar *package_ids_temp;
-
- /* check network state */
- if (!pk_backend_is_online (backend)) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot install when offline");
- pk_backend_finished (backend);
- return;
- }
-
- /* send the complete list as stdin */
- package_ids_temp = pk_package_ids_to_text (package_ids, "|");
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "install-packages", package_ids_temp, NULL);
- g_free (package_ids_temp);
-}
-
-/**
- * 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_text (package_ids, "|");
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "remove-packages", pk_backend_bool_to_text (allow_deps), package_ids_temp, NULL);
- g_free (package_ids_temp);
-}
-
-/**
- * pk_backend_search_group:
- */
-static void
-backend_search_group (PkBackend *backend, PkBitfield filters, const gchar *search)
-{
- gchar *filters_text;
- filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-group", filters_text, search, 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_text (filters);
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-packages", filters_text, NULL);
- g_free (filters_text);
-}
-
-/**
- * backend_get_requires:
- */
-static void
-backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
-{
- gchar *package_ids_temp;
- package_ids_temp = pk_package_ids_to_text (package_ids, "|");
- gchar *filters_text;
- filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-requires", filters_text, package_ids_temp, pk_backend_bool_to_text (recursive), NULL);
- g_free (filters_text);
- g_free (package_ids_temp);
-}
-
-/**
- * pk_backend_search_details:
- */
-static void
-backend_search_details (PkBackend *backend, PkBitfield filters, const gchar *search)
-{
- gchar *filters_text;
- filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-details", filters_text, search, NULL);
- g_free (filters_text);
-}
-
-/**
- * pk_backend_search_file:
- */
-static void
-backend_search_file (PkBackend *backend, PkBitfield filters, const gchar *search)
-{
- gchar *filters_text;
- filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-file", filters_text, search, NULL);
- g_free (filters_text);
-}
-
-/**
- * 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_text (filters);
- package_ids_temp = pk_package_ids_to_text (package_ids, "|");
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "resolve", filters_text, package_ids_temp, NULL);
- g_free (filters_text);
- g_free (package_ids_temp);
-}
-
-/**
- * pk_backend_update_packages:
- */
-static void
-backend_update_packages (PkBackend *backend, gchar **package_ids)
-{
- gchar *package_ids_temp;
-
-
- /* check network state */
- if (!pk_backend_is_online (backend)) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot install when offline");
- pk_backend_finished (backend);
- return;
- }
-
- /* send the complete list as stdin */
- package_ids_temp = pk_package_ids_to_text (package_ids, "|");
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "update-packages", package_ids_temp, NULL);
- g_free (package_ids_temp);
-}
-
-/**
- * pk_backend_update_system:
- */
-static void
-backend_update_system (PkBackend *backend)
-{
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "update-system", NULL);
-}
-
-/**
- * backend_get_distro_upgrades:
- */
-static void
-backend_get_distro_upgrades (PkBackend *backend)
-{
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-distro-upgrades", NULL);
-}
-
-
-PK_BACKEND_OPTIONS (
- "URPMI", /* description */
- "Aurelien Lefebvre <alefebvre at mandriva.com>", /* author */
- backend_initialize, /* initalize */
- backend_destroy, /* destroy */
- backend_get_groups, /* get_groups */
- backend_get_filters, /* get_filters */
- NULL, /* cancel */
- NULL, /* download_packages */
- 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 */
- NULL, /* 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 */
- NULL, /* repo_enable */
- 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 */
- NULL, /* service_pack */
- backend_update_packages, /* update_packages */
- backend_update_system, /* update_system */
- NULL /* what_provides */
-);
-
diff --git a/backends/urpmi/pk-backend-urpmi.c b/backends/urpmi/pk-backend-urpmi.c
index 62c66f6..5362cb9 100644
--- a/backends/urpmi/pk-backend-urpmi.c
+++ b/backends/urpmi/pk-backend-urpmi.c
@@ -120,7 +120,7 @@ backend_search_name (PkBackend *backend, PkBitfield filters, const gchar *search
{
gchar *filters_text;
filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "search-name.pl", filters_text, search, NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-name", filters_text, search, NULL);
g_free (filters_text);
}
@@ -132,7 +132,7 @@ backend_get_details (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
package_ids_temp = pk_package_ids_to_text (package_ids, "|");
- pk_backend_spawn_helper (spawn, "get-details.pl", package_ids_temp, NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-details", package_ids_temp, NULL);
g_free (package_ids_temp);
}
@@ -144,7 +144,7 @@ backend_get_files (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
package_ids_temp = pk_package_ids_to_text (package_ids, "|");
- pk_backend_spawn_helper (spawn, "get-files.pl", package_ids_temp, NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-files", package_ids_temp, NULL);
g_free (package_ids_temp);
}
@@ -158,7 +158,7 @@ backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids
gchar *package_ids_temp;
package_ids_temp = pk_package_ids_to_text (package_ids, "|");
filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "get-depends.pl", filters_text, package_ids_temp, pk_backend_bool_to_text (recursive), NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-depends", filters_text, package_ids_temp, pk_backend_bool_to_text (recursive), NULL);
g_free (filters_text);
g_free (package_ids_temp);
}
@@ -171,7 +171,7 @@ backend_get_updates (PkBackend *backend, PkBitfield filters)
{
gchar *filters_text;
filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "get-updates.pl", filters_text, NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-updates", filters_text, NULL);
g_free (filters_text);
}
@@ -183,7 +183,7 @@ backend_get_update_detail (PkBackend *backend, gchar **package_ids)
{
gchar *package_ids_temp;
package_ids_temp = pk_package_ids_to_text (package_ids, "|");
- pk_backend_spawn_helper (spawn, "get-update-detail.pl", package_ids_temp, NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-update-detail", package_ids_temp, NULL);
g_free (package_ids_temp);
}
@@ -200,7 +200,7 @@ backend_refresh_cache (PkBackend *backend, gboolean force)
return;
}
- pk_backend_spawn_helper (spawn, "refresh-cache.pl", NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "refresh-cache", NULL);
}
/**
@@ -220,7 +220,7 @@ backend_install_packages (PkBackend *backend, gchar **package_ids)
/* send the complete list as stdin */
package_ids_temp = pk_package_ids_to_text (package_ids, "|");
- pk_backend_spawn_helper (spawn, "install-packages.pl", package_ids_temp, NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "install-packages", package_ids_temp, NULL);
g_free (package_ids_temp);
}
@@ -234,7 +234,7 @@ backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow
/* send the complete list as stdin */
package_ids_temp = pk_package_ids_to_text (package_ids, "|");
- pk_backend_spawn_helper (spawn, "remove-packages.pl", pk_backend_bool_to_text (allow_deps), package_ids_temp, NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "remove-packages", pk_backend_bool_to_text (allow_deps), package_ids_temp, NULL);
g_free (package_ids_temp);
}
@@ -246,7 +246,7 @@ backend_search_group (PkBackend *backend, PkBitfield filters, const gchar *searc
{
gchar *filters_text;
filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "search-group.pl", filters_text, search, NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-group", filters_text, search, NULL);
g_free (filters_text);
}
@@ -258,7 +258,7 @@ backend_get_packages (PkBackend *backend, PkBitfield filters)
{
gchar *filters_text;
filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "get-packages.pl", filters_text, NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-packages", filters_text, NULL);
g_free (filters_text);
}
@@ -272,7 +272,7 @@ backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_id
package_ids_temp = pk_package_ids_to_text (package_ids, "|");
gchar *filters_text;
filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "get-requires.pl", filters_text, package_ids_temp, pk_backend_bool_to_text (recursive), NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-requires", filters_text, package_ids_temp, pk_backend_bool_to_text (recursive), NULL);
g_free (filters_text);
g_free (package_ids_temp);
}
@@ -285,7 +285,7 @@ backend_search_details (PkBackend *backend, PkBitfield filters, const gchar *sea
{
gchar *filters_text;
filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "search-details.pl", filters_text, search, NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-details", filters_text, search, NULL);
g_free (filters_text);
}
@@ -297,7 +297,7 @@ backend_search_file (PkBackend *backend, PkBitfield filters, const gchar *search
{
gchar *filters_text;
filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "search-file.pl", filters_text, search, NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-file", filters_text, search, NULL);
g_free (filters_text);
}
@@ -311,7 +311,7 @@ backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
gchar *package_ids_temp;
filters_text = pk_filter_bitfield_to_text (filters);
package_ids_temp = pk_package_ids_to_text (package_ids, "|");
- pk_backend_spawn_helper (spawn, "resolve.pl", filters_text, package_ids_temp, NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "resolve", filters_text, package_ids_temp, NULL);
g_free (filters_text);
g_free (package_ids_temp);
}
@@ -334,7 +334,7 @@ backend_update_packages (PkBackend *backend, gchar **package_ids)
/* send the complete list as stdin */
package_ids_temp = pk_package_ids_to_text (package_ids, "|");
- pk_backend_spawn_helper (spawn, "update-packages.pl", package_ids_temp, NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "update-packages", package_ids_temp, NULL);
g_free (package_ids_temp);
}
@@ -344,7 +344,7 @@ backend_update_packages (PkBackend *backend, gchar **package_ids)
static void
backend_update_system (PkBackend *backend)
{
- pk_backend_spawn_helper (spawn, "update-system.pl", NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "update-system", NULL);
}
/**
@@ -353,7 +353,7 @@ backend_update_system (PkBackend *backend)
static void
backend_get_distro_upgrades (PkBackend *backend)
{
- pk_backend_spawn_helper (spawn, "get-distro-upgrades.pl", NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-distro-upgrades", NULL);
}
commit 5d804fe710cab7d6a5b615b4d1f6ce1013b2b6f2
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 17 11:41:04 2008 +0100
trivial: rename pk_package_list_to_argv to pk_package_list_to_strv to better match glib
diff --git a/client/pk-generate-pack.c b/client/pk-generate-pack.c
index fbd3b89..b0e4cd3 100644
--- a/client/pk-generate-pack.c
+++ b/client/pk-generate-pack.c
@@ -531,7 +531,7 @@ pk_generate_pack_main (const gchar *pack_filename, const gchar *directory, const
}
/* convert to list of package_ids */
- package_ids = pk_package_list_to_argv (list);
+ package_ids = pk_package_list_to_strv (list);
ret = pk_generate_pack_download_only (client, package_ids, directory);
g_strfreev (package_ids);
}
diff --git a/libpackagekit/pk-package-list.c b/libpackagekit/pk-package-list.c
index 352b7fe..5cb8fa6 100644
--- a/libpackagekit/pk-package-list.c
+++ b/libpackagekit/pk-package-list.c
@@ -162,10 +162,10 @@ pk_package_list_to_string (const PkPackageList *plist)
}
/**
- * pk_package_list_to_argv:
+ * pk_package_list_to_strv:
**/
gchar **
-pk_package_list_to_argv (const PkPackageList *plist)
+pk_package_list_to_strv (const PkPackageList *plist)
{
PkPackageObj *obj;
GPtrArray *array;
@@ -628,7 +628,7 @@ pk_package_list_test (EggTest *test)
/************************************************************/
egg_test_title (test, "make sure argv is correct");
- argv = pk_package_list_to_argv (plist);
+ argv = pk_package_list_to_strv (plist);
if (argv != NULL &&
egg_strequal (argv[0], "gnome;1.23;i386;data") &&
argv[1] == NULL)
diff --git a/libpackagekit/pk-package-list.h b/libpackagekit/pk-package-list.h
index 0d593df..a44fd64 100644
--- a/libpackagekit/pk-package-list.h
+++ b/libpackagekit/pk-package-list.h
@@ -71,7 +71,7 @@ gboolean pk_package_list_contains_obj (const PkPackageList *plist,
const PkPackageObj *obj);
gchar *pk_package_list_to_string (const PkPackageList *plist)
G_GNUC_WARN_UNUSED_RESULT;
-gchar **pk_package_list_to_argv (const PkPackageList *plist)
+gchar **pk_package_list_to_strv (const PkPackageList *plist)
G_GNUC_WARN_UNUSED_RESULT;
guint pk_package_list_get_size (const PkPackageList *plist);
gboolean pk_package_list_sort (PkPackageList *plist);
commit c1b60701795ed764bcf974eb442258cdbda09912
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 17 11:38:50 2008 +0100
trivial: more aggressive constification in PkPackageList
diff --git a/libpackagekit/pk-package-list.c b/libpackagekit/pk-package-list.c
index 8f55d44..352b7fe 100644
--- a/libpackagekit/pk-package-list.c
+++ b/libpackagekit/pk-package-list.c
@@ -132,7 +132,7 @@ pk_package_list_add_list (PkPackageList *plist, PkPackageList *list)
* pk_package_list_to_string:
**/
gchar *
-pk_package_list_to_string (PkPackageList *plist)
+pk_package_list_to_string (const PkPackageList *plist)
{
PkPackageObj *obj;
guint i;
@@ -165,7 +165,7 @@ pk_package_list_to_string (PkPackageList *plist)
* pk_package_list_to_argv:
**/
gchar **
-pk_package_list_to_argv (PkPackageList *plist)
+pk_package_list_to_argv (const PkPackageList *plist)
{
PkPackageObj *obj;
GPtrArray *array;
@@ -195,7 +195,7 @@ pk_package_list_to_argv (PkPackageList *plist)
* pk_package_list_get_size:
**/
guint
-pk_package_list_get_size (PkPackageList *plist)
+pk_package_list_get_size (const PkPackageList *plist)
{
g_return_val_if_fail (PK_IS_PACKAGE_LIST (plist), 0);
return plist->priv->array->len;
@@ -289,7 +289,7 @@ pk_package_list_sort_info (PkPackageList *plist)
* pk_package_list_get_obj:
**/
const PkPackageObj *
-pk_package_list_get_obj (PkPackageList *plist, guint item)
+pk_package_list_get_obj (const PkPackageList *plist, guint item)
{
g_return_val_if_fail (PK_IS_PACKAGE_LIST (plist), NULL);
if (item >= plist->priv->array->len) {
@@ -321,7 +321,7 @@ pk_package_list_clear (PkPackageList *plist)
* pk_package_list_contains:
**/
gboolean
-pk_package_list_contains (PkPackageList *plist, const gchar *package_id)
+pk_package_list_contains (const PkPackageList *plist, const gchar *package_id)
{
PkPackageObj *obj;
guint i;
@@ -407,7 +407,7 @@ pk_package_list_remove_obj (PkPackageList *plist, const PkPackageObj *obj)
* pk_package_list_contains_obj:
**/
gboolean
-pk_package_list_contains_obj (PkPackageList *plist, const PkPackageObj *obj)
+pk_package_list_contains_obj (const PkPackageList *plist, const PkPackageObj *obj)
{
PkPackageObj *obj_temp;
guint i;
@@ -432,7 +432,7 @@ pk_package_list_contains_obj (PkPackageList *plist, const PkPackageObj *obj)
* pk_package_list_to_file:
**/
gboolean
-pk_package_list_to_file (PkPackageList *plist, const gchar *filename)
+pk_package_list_to_file (const PkPackageList *plist, const gchar *filename)
{
PkPackageObj *obj;
guint i;
diff --git a/libpackagekit/pk-package-list.h b/libpackagekit/pk-package-list.h
index 22198a8..0d593df 100644
--- a/libpackagekit/pk-package-list.h
+++ b/libpackagekit/pk-package-list.h
@@ -61,26 +61,26 @@ gboolean pk_package_list_add_obj (PkPackageList *plist,
const PkPackageObj *obj);
gboolean pk_package_list_add_list (PkPackageList *plist,
PkPackageList *list);
-gboolean pk_package_list_contains (PkPackageList *plist,
+gboolean pk_package_list_contains (const PkPackageList *plist,
const gchar *package_id);
gboolean pk_package_list_remove (PkPackageList *plist,
const gchar *package_id);
gboolean pk_package_list_remove_obj (PkPackageList *plist,
const PkPackageObj *obj);
-gboolean pk_package_list_contains_obj (PkPackageList *plist,
+gboolean pk_package_list_contains_obj (const PkPackageList *plist,
const PkPackageObj *obj);
-gchar *pk_package_list_to_string (PkPackageList *plist)
+gchar *pk_package_list_to_string (const PkPackageList *plist)
G_GNUC_WARN_UNUSED_RESULT;
-gchar **pk_package_list_to_argv (PkPackageList *plist)
+gchar **pk_package_list_to_argv (const PkPackageList *plist)
G_GNUC_WARN_UNUSED_RESULT;
-guint pk_package_list_get_size (PkPackageList *plist);
+guint pk_package_list_get_size (const PkPackageList *plist);
gboolean pk_package_list_sort (PkPackageList *plist);
gboolean pk_package_list_sort_info (PkPackageList *plist);
gboolean pk_package_list_sort_summary (PkPackageList *plist);
-const PkPackageObj *pk_package_list_get_obj (PkPackageList *plist,
+const PkPackageObj *pk_package_list_get_obj (const PkPackageList *plist,
guint item);
gboolean pk_package_list_clear (PkPackageList *plist);
-gboolean pk_package_list_to_file (PkPackageList *plist,
+gboolean pk_package_list_to_file (const PkPackageList *plist,
const gchar *filename);
gboolean pk_package_list_add_file (PkPackageList *plist,
const gchar *filename);
commit 05be9e760a54c88b0adebcfbca91f61cec302c9e
Author: Aurelien Lefebvre <alefebvre at mandriva.com>
Date: Wed Sep 17 12:04:00 2008 +0200
urpmi: trivial fix in dispatched backend
diff --git a/backends/urpmi/helpers/urpmi-dispatched-backend.pl b/backends/urpmi/helpers/urpmi-dispatched-backend.pl
index 3313d36..aca9cba 100755
--- a/backends/urpmi/helpers/urpmi-dispatched-backend.pl
+++ b/backends/urpmi/helpers/urpmi-dispatched-backend.pl
@@ -103,6 +103,7 @@ sub dispatch_command {
}
elsif($command eq "install-packages") {
install_packages($urpm, $args);
+ urpm::media::configure($urpm);
}
elsif($command eq "search-name") {
search_name($urpm, $args);
@@ -113,6 +114,7 @@ sub dispatch_command {
}
elsif($command eq "remove-packages") {
remove_packages($urpm, $args);
+ urpm::media::configure($urpm);
}
elsif($command eq "resolve") {
resolve($urpm, $args);
@@ -128,9 +130,11 @@ sub dispatch_command {
}
elsif($command eq "update-packages") {
update_packages($urpm, $args);
+ urpm::media::configure($urpm);
}
elsif($command eq "update-system") {
update_system($urpm);
+ urpm::media::configure($urpm);
}
elsif($command eq "exit") {
exit 0;
commit a30fc59bed67df9687432c902292aadb33ea5d02
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 17 10:49:13 2008 +0100
trivial: move the common python dispatcher bits into backend.py
diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index ebcd0ae..7fdac2f 100755
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -1183,15 +1183,7 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
def main():
backend = PackageKitSmartBackend('')
- args = sys.argv[1:]
- backend.dispatch_command(args[0],args[1:])
- while True:
- line = raw_input('')
- if line == 'exit':
- break
- backend.reset()
- args = line.split('\t')
- backend.dispatch_command(args[0],args[1:])
+ backend.dispatcher(sys.argv[1:])
if __name__ == "__main__":
main()
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index cfbc17d..94919db 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -1949,14 +1949,7 @@ class PackageKitYumBase(yum.YumBase):
def main():
backend = PackageKitYumBackend('',lock=True)
- args = sys.argv[1:]
- backend.dispatch_command(args[0],args[1:])
- while True:
- line = raw_input('')
- if line == 'exit':
- break
- args = line.split('\t')
- backend.dispatch_command(args[0],args[1:])
+ backend.dispatcher(sys.argv[1:])
if __name__ == "__main__":
main()
diff --git a/data/tests/pk-spawn-dispatcher.py b/data/tests/pk-spawn-dispatcher.py
index 75469bb..419f571 100755
--- a/data/tests/pk-spawn-dispatcher.py
+++ b/data/tests/pk-spawn-dispatcher.py
@@ -10,27 +10,25 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Copyright (C) 2008 Tim Lauridsen <timlau at fedoraproject.org>
+# Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
# Dispacher script to run pk commands from stdin
import sys
+from packagekit.backend import *
-def dispatch(args):
- if args[0] == 'search-name':
+class PackageKitYumBackend(PackageKitBaseBackend):
+ def __init__(self,args,lock=True):
+ PackageKitBaseBackend.__init__(self,args)
+
+ def search_name(self,filters,key):
# check we escape spaces properly
- if args[2] == 'power manager':
- print 'package\tavailable\tpolkit;0.0.1;i386;data\tPolicyKit daemon'
- sys.stdout.flush()
+ if key == 'power manager':
+ self.package("polkit;0.0.1;i386;data",INFO_AVAILABLE,"PolicyKit daemon")
def main():
- args = sys.argv[1:]
- dispatch(args)
- while True:
- line = raw_input('')
- if line == 'exit':
- break
- args = line.split('\t')
- dispatch(args)
+ backend = PackageKitYumBackend('',lock=True)
+ backend.dispatcher(sys.argv[1:])
if __name__ == "__main__":
main()
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index 87abaa7..8f7ce66 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -556,6 +556,16 @@ class PackageKitBaseBackend:
self.error(ERROR_INTERNAL_ERROR,errmsg,exit=False)
self.finished();
+ def dispatcher(self,args):
+ if len(args) > 0:
+ self.dispatch_command(args[0],args[1:])
+ while True:
+ line = raw_input('')
+ if line == 'exit':
+ break
+ args = line.split('\t')
+ self.dispatch_command(args[0],args[1:])
+
def exceptionHandler(typ,value,tb,base):
# Restore original exception handler
sys.excepthook = sys.__excepthook__
diff --git a/src/pk-spawn.c b/src/pk-spawn.c
index 4714e3f..54699c3 100644
--- a/src/pk-spawn.c
+++ b/src/pk-spawn.c
@@ -804,8 +804,8 @@ pk_spawn_test (EggTest *test)
egg_test_failed (test, "dispatcher exited");
/************************************************************/
- egg_test_title (test, "we got a package?");
- if (stdout_count == 1)
+ egg_test_title (test, "we got a package (+finished)?");
+ if (stdout_count == 2)
egg_test_success (test, NULL);
else
egg_test_failed (test, "did not get a package");
@@ -829,8 +829,8 @@ pk_spawn_test (EggTest *test)
egg_test_loop_wait (test, 100);
/************************************************************/
- egg_test_title (test, "we got another package?");
- if (stdout_count == 2)
+ egg_test_title (test, "we got another package (+finished)?");
+ if (stdout_count == 4)
egg_test_success (test, NULL);
else
egg_test_failed (test, "did not get a package");
commit 1d025242eb4f2fc44a408a7045a01c5c4bac06ad
Author: Aurelien Lefebvre <alefebvre at mandriva.com>
Date: Wed Sep 17 11:29:53 2008 +0200
urpmi: dispatched backend update
diff --git a/backends/urpmi/helpers/Makefile.am b/backends/urpmi/helpers/Makefile.am
index f71bab0..be2cc19 100644
--- a/backends/urpmi/helpers/Makefile.am
+++ b/backends/urpmi/helpers/Makefile.am
@@ -23,6 +23,7 @@ dist_helper_DATA = \
update-packages.pl \
update-system.pl \
get-distro-upgrades.pl \
+ urpmi-dispatched-backend.pl \
$(NULL)
install-data-hook:
diff --git a/backends/urpmi/helpers/urpmi-dispatched-backend.pl b/backends/urpmi/helpers/urpmi-dispatched-backend.pl
index 2ea85ee..3313d36 100755
--- a/backends/urpmi/helpers/urpmi-dispatched-backend.pl
+++ b/backends/urpmi/helpers/urpmi-dispatched-backend.pl
@@ -34,10 +34,15 @@
#
use strict;
+local $| = 1; # stdout autoflush
use lib;
use File::Basename;
+BEGIN {
+ push @INC, dirname($0);
+}
+
use URPM;
use urpm;
use urpm::media;
@@ -55,76 +60,83 @@ use perl_packagekit::prints;
use MDK::Common;
-BEGIN {
- push @INC, dirname($0);
-}
-
my $urpm = urpm->new_parse_cmdline;
urpm::media::configure($urpm);
-
+dispatch_command($urpm, \@ARGV);
+print "finished\n";
+
while(<STDIN>) {
chomp($_);
my @args = split (/ /, $_);
- my $command = shift(@args);
+ dispatch_command($urpm, \@args);
+ print "finished\n";
+}
+
+sub dispatch_command {
+
+ my ($urpm, $args) = @_;
+
+ my $command = shift(@{$args});
if($command eq "get-depends") {
- get_depends($urpm, \@args);
+ get_depends($urpm, $args);
}
elsif($command eq "get-details") {
- get_details($urpm, \@args);
+ get_details($urpm, $args);
}
elsif($command eq "get-distro-upgrades") {
get_distro_upgrades();
}
elsif($command eq "get-files") {
- get_files($urpm, \@args);
+ get_files($urpm, $args);
}
elsif($command eq "get-packages") {
- get_packages($urpm, \@args);
+ get_packages($urpm, $args);
}
elsif($command eq "get-requires") {
- get_requires($urpm, \@args);
+ get_requires($urpm, $args);
}
elsif($command eq "get-update-detail") {
- get_update_detail($urpm, \@args);
+ get_update_detail($urpm, $args);
}
elsif($command eq "get-updates") {
- get_updates($urpm, \@args);
+ get_updates($urpm, $args);
}
elsif($command eq "install-packages") {
- install_packages($urpm, \@args);
+ install_packages($urpm, $args);
}
elsif($command eq "search-name") {
- search_name($urpm, \@args);
+ search_name($urpm, $args);
}
elsif($command eq "refresh-cache") {
refresh_cache($urpm);
urpm::media::configure($urpm);
}
elsif($command eq "remove-packages") {
- remove_packages($urpm, \@args);
+ remove_packages($urpm, $args);
}
elsif($command eq "resolve") {
- resolve($urpm, \@args);
+ resolve($urpm, $args);
}
elsif($command eq "search-details") {
- search_details($urpm, \@args);
+ search_details($urpm, $args);
}
elsif($command eq "search-file") {
- search_file($urpm, \@args);
+ search_file($urpm, $args);
}
elsif($command eq "search-group") {
- search_group($urpm, \@args);
+ search_group($urpm, $args);
}
elsif($command eq "update-packages") {
- update_packages($urpm, \@args);
+ update_packages($urpm, $args);
}
elsif($command eq "update-system") {
update_system($urpm);
}
+ elsif($command eq "exit") {
+ exit 0;
+ }
+ else {}
}
-
-
-
sub get_depends {
my ($urpm, $args) = @_;
diff --git a/backends/urpmi/pk-backend-urpmi-dispatched.c b/backends/urpmi/pk-backend-urpmi-dispatched.c
new file mode 100644
index 0000000..5362cb9
--- /dev/null
+++ b/backends/urpmi/pk-backend-urpmi-dispatched.c
@@ -0,0 +1,396 @@
+/* -*- 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <pk-backend.h>
+#include <pk-backend-spawn.h>
+#include <pk-package-ids.h>
+
+static PkBackendSpawn *spawn;
+
+/**
+ * backend_initialize:
+ * This should only be run once per backend load, i.e. not every transaction
+ */
+static void
+backend_initialize (PkBackend *backend)
+{
+ egg_debug ("backend: initialize");
+ spawn = pk_backend_spawn_new ();
+ pk_backend_spawn_set_name (spawn, "urpmi");
+}
+
+/**
+ * backend_destroy:
+ * This should only be run once per backend load, i.e. not every transaction
+ */
+static void
+backend_destroy (PkBackend *backend)
+{
+ egg_debug ("backend: destroy");
+ g_object_unref (spawn);
+}
+
+/**
+ * backend_get_groups:
+ */
+static PkBitfield
+backend_get_groups (PkBackend *backend)
+{
+ return pk_bitfield_from_enums (
+ PK_GROUP_ENUM_ACCESSIBILITY,
+ PK_GROUP_ENUM_ACCESSORIES,
+ PK_GROUP_ENUM_EDUCATION,
+ PK_GROUP_ENUM_GAMES,
+ PK_GROUP_ENUM_GRAPHICS,
+ PK_GROUP_ENUM_INTERNET,
+ PK_GROUP_ENUM_OFFICE,
+ PK_GROUP_ENUM_OTHER,
+ PK_GROUP_ENUM_PROGRAMMING,
+ PK_GROUP_ENUM_MULTIMEDIA,
+ PK_GROUP_ENUM_SYSTEM,
+ PK_GROUP_ENUM_DESKTOP_GNOME,
+ PK_GROUP_ENUM_DESKTOP_KDE,
+ PK_GROUP_ENUM_DESKTOP_XFCE,
+ PK_GROUP_ENUM_DESKTOP_OTHER,
+ PK_GROUP_ENUM_PUBLISHING,
+ PK_GROUP_ENUM_SERVERS,
+ PK_GROUP_ENUM_FONTS,
+ PK_GROUP_ENUM_ADMIN_TOOLS,
+ PK_GROUP_ENUM_LEGACY,
+ PK_GROUP_ENUM_LOCALIZATION,
+ PK_GROUP_ENUM_VIRTUALIZATION,
+ PK_GROUP_ENUM_POWER_MANAGEMENT,
+ PK_GROUP_ENUM_SECURITY,
+ PK_GROUP_ENUM_COMMUNICATION,
+ PK_GROUP_ENUM_NETWORK,
+ PK_GROUP_ENUM_MAPS,
+ PK_GROUP_ENUM_REPOS,
+ -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,
+ -1);
+}
+
+/**
+ * pk_backend_bool_to_text:
+ */
+static const gchar *
+pk_backend_bool_to_text (gboolean value)
+{
+ if (value == TRUE) {
+ return "yes";
+ }
+ return "no";
+}
+
+
+/**
+ * pk_backend_search_name:
+ */
+static void
+backend_search_name (PkBackend *backend, PkBitfield filters, const gchar *search)
+{
+ gchar *filters_text;
+ filters_text = pk_filter_bitfield_to_text (filters);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-name", filters_text, search, NULL);
+ g_free (filters_text);
+}
+
+/**
+ * backend_get_details:
+ */
+static void
+backend_get_details (PkBackend *backend, gchar **package_ids)
+{
+ gchar *package_ids_temp;
+ package_ids_temp = pk_package_ids_to_text (package_ids, "|");
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-details", package_ids_temp, NULL);
+ g_free (package_ids_temp);
+}
+
+/**
+ * backend_get_files:
+ */
+static void
+backend_get_files (PkBackend *backend, gchar **package_ids)
+{
+ gchar *package_ids_temp;
+ package_ids_temp = pk_package_ids_to_text (package_ids, "|");
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-files", 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_text (package_ids, "|");
+ filters_text = pk_filter_bitfield_to_text (filters);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-depends", filters_text, package_ids_temp, pk_backend_bool_to_text (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_text (filters);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-updates", 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_text (package_ids, "|");
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-update-detail", package_ids_temp, NULL);
+ g_free (package_ids_temp);
+}
+
+/**
+ * backend_refresh_cache:
+ */
+static void
+backend_refresh_cache (PkBackend *backend, gboolean force)
+{
+ /* check network state */
+ if (!pk_backend_is_online (backend)) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot refresh cache whilst offline");
+ pk_backend_finished (backend);
+ return;
+ }
+
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "refresh-cache", NULL);
+}
+
+/**
+ * backend_install_packages:
+ */
+static void
+backend_install_packages (PkBackend *backend, gchar **package_ids)
+{
+ gchar *package_ids_temp;
+
+ /* check network state */
+ if (!pk_backend_is_online (backend)) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot install when offline");
+ pk_backend_finished (backend);
+ return;
+ }
+
+ /* send the complete list as stdin */
+ package_ids_temp = pk_package_ids_to_text (package_ids, "|");
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "install-packages", package_ids_temp, NULL);
+ g_free (package_ids_temp);
+}
+
+/**
+ * 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_text (package_ids, "|");
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "remove-packages", pk_backend_bool_to_text (allow_deps), package_ids_temp, NULL);
+ g_free (package_ids_temp);
+}
+
+/**
+ * pk_backend_search_group:
+ */
+static void
+backend_search_group (PkBackend *backend, PkBitfield filters, const gchar *search)
+{
+ gchar *filters_text;
+ filters_text = pk_filter_bitfield_to_text (filters);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-group", filters_text, search, 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_text (filters);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-packages", filters_text, NULL);
+ g_free (filters_text);
+}
+
+/**
+ * backend_get_requires:
+ */
+static void
+backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
+{
+ gchar *package_ids_temp;
+ package_ids_temp = pk_package_ids_to_text (package_ids, "|");
+ gchar *filters_text;
+ filters_text = pk_filter_bitfield_to_text (filters);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-requires", filters_text, package_ids_temp, pk_backend_bool_to_text (recursive), NULL);
+ g_free (filters_text);
+ g_free (package_ids_temp);
+}
+
+/**
+ * pk_backend_search_details:
+ */
+static void
+backend_search_details (PkBackend *backend, PkBitfield filters, const gchar *search)
+{
+ gchar *filters_text;
+ filters_text = pk_filter_bitfield_to_text (filters);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-details", filters_text, search, NULL);
+ g_free (filters_text);
+}
+
+/**
+ * pk_backend_search_file:
+ */
+static void
+backend_search_file (PkBackend *backend, PkBitfield filters, const gchar *search)
+{
+ gchar *filters_text;
+ filters_text = pk_filter_bitfield_to_text (filters);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-file", filters_text, search, NULL);
+ g_free (filters_text);
+}
+
+/**
+ * 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_text (filters);
+ package_ids_temp = pk_package_ids_to_text (package_ids, "|");
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "resolve", filters_text, package_ids_temp, NULL);
+ g_free (filters_text);
+ g_free (package_ids_temp);
+}
+
+/**
+ * pk_backend_update_packages:
+ */
+static void
+backend_update_packages (PkBackend *backend, gchar **package_ids)
+{
+ gchar *package_ids_temp;
+
+
+ /* check network state */
+ if (!pk_backend_is_online (backend)) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot install when offline");
+ pk_backend_finished (backend);
+ return;
+ }
+
+ /* send the complete list as stdin */
+ package_ids_temp = pk_package_ids_to_text (package_ids, "|");
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "update-packages", package_ids_temp, NULL);
+ g_free (package_ids_temp);
+}
+
+/**
+ * pk_backend_update_system:
+ */
+static void
+backend_update_system (PkBackend *backend)
+{
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "update-system", NULL);
+}
+
+/**
+ * backend_get_distro_upgrades:
+ */
+static void
+backend_get_distro_upgrades (PkBackend *backend)
+{
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "get-distro-upgrades", NULL);
+}
+
+
+PK_BACKEND_OPTIONS (
+ "URPMI", /* description */
+ "Aurelien Lefebvre <alefebvre at mandriva.com>", /* author */
+ backend_initialize, /* initalize */
+ backend_destroy, /* destroy */
+ backend_get_groups, /* get_groups */
+ backend_get_filters, /* get_filters */
+ NULL, /* cancel */
+ NULL, /* download_packages */
+ 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 */
+ NULL, /* 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 */
+ NULL, /* repo_enable */
+ 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 */
+ NULL, /* service_pack */
+ backend_update_packages, /* update_packages */
+ backend_update_system, /* update_system */
+ NULL /* what_provides */
+);
+
More information about the PackageKit-commit
mailing list