[packagekit] packagekit: Branch 'master' - 18 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Mon Sep 24 10:16:38 PDT 2007
Makefile.am | 3
backends/BACKENDS | 8 -
backends/alpm/pk-backend-alpm.c | 76 ++++++++++++++++--
backends/conary/helpers/Makefile.am | 1
backends/conary/helpers/conaryBackend.py | 125 ++++++++++++++++++++----------
backends/conary/helpers/conaryCallback.py | 97 +++++++++++++++++++++++
backends/conary/pk-backend-conary.c | 2
configure.ac | 5 +
libpackagekit/pk-task-monitor.c | 17 ++--
python/pkt | 2
src/pk-engine.c | 14 ++-
src/pk-marshal.list | 1
12 files changed, 284 insertions(+), 67 deletions(-)
New commits:
diff-tree 9e250c0dbbda2083c0a98656bc5e4320d17b1a06 (from 2a72d011b98b22d439565f01ceeda8750393b26b)
Author: Ken VanDine <ken at vandine.org>
Date: Mon Sep 24 09:14:44 2007 -0400
Fix version
diff --git a/backends/conary/helpers/conaryBackend.py b/backends/conary/helpers/conaryBackend.py
index e021245..df6773a 100644
--- a/backends/conary/helpers/conaryBackend.py
+++ b/backends/conary/helpers/conaryBackend.py
@@ -94,7 +94,7 @@ class PackageKitConaryBackend(PackageKit
flavor = deps.ThawFlavor(troveTuple[2])
# We don't have summary data yet... so leave it blank for now
summary = " "
- troveTuple = tuple([name, fullVersion, flavor])
+ troveTuple = tuple([name, version, flavor])
installed = self.check_installed(troveTuple)
if self._do_filtering(name,fltlist,installed):
diff-tree 2a72d011b98b22d439565f01ceeda8750393b26b (from 0e39754a7f3efe04d2094be2f36e1a5bd410bcb8)
Author: Ken VanDine <ken at vandine.org>
Date: Mon Sep 24 09:14:21 2007 -0400
Include new conaryCallbacks.py file
diff --git a/backends/conary/helpers/Makefile.am b/backends/conary/helpers/Makefile.am
index c3c2ca6..0f25047 100644
--- a/backends/conary/helpers/Makefile.am
+++ b/backends/conary/helpers/Makefile.am
@@ -15,6 +15,7 @@ dist_helper_DATA = \
update-system.py \
get-description.py \
conaryBackend.py \
+ conaryCallback.py \
packagekit.py \
$(NULL)
diff-tree 0e39754a7f3efe04d2094be2f36e1a5bd410bcb8 (from 480c6b8b6ca20d5456340b02d626c4d5de8ca735)
Author: Ken VanDine <ken at vandine.org>
Date: Mon Sep 24 09:13:57 2007 -0400
Enable backend_update_system
diff --git a/backends/conary/pk-backend-conary.c b/backends/conary/pk-backend-conary.c
index 5314e46..ea06109 100644
--- a/backends/conary/pk-backend-conary.c
+++ b/backends/conary/pk-backend-conary.c
@@ -169,6 +169,6 @@ PK_BACKEND_OPTIONS (
NULL, /* search_group */
backend_search_name, /* search_name */
NULL, /* update_package */
- NULL /* update_system */
+ backend_update_system /* update_system */
);
diff-tree 480c6b8b6ca20d5456340b02d626c4d5de8ca735 (from 9ed65e80d8a80d27569412af2c70ecfdfdc96cf3)
Author: Elliot Peele <elliot at bentlogic.net>
Date: Mon Sep 24 00:57:28 2007 -0400
update conary backend support
diff --git a/backends/BACKENDS b/backends/BACKENDS
index 800cf8d..c7962ca 100644
--- a/backends/BACKENDS
+++ b/backends/BACKENDS
@@ -5,16 +5,16 @@ Current status of the backends
resolve | | | | X | |
refresh-cache | X | X | X | X | |
get-updates | X | X | | X | |
-update-system | | X | | | |
+update-system | X | X | | | |
search-name | X | X | X | X | X |
search-details | | X | X | X | |
search-file | | X | | X | |
search-group | | | | | |
-install-package | | X | | X | X |
+install-package | X | X | | X | X |
install-file | | | | X | |
-remove | | X | | X | X |
+remove | X | X | | X | X |
get-depends | | X | | | |
-get-requires | | | | | |
+get-requires | X | | | | |
get-description | X | X | X | X | |
get-update-detail | | | | | |
diff-tree 9ed65e80d8a80d27569412af2c70ecfdfdc96cf3 (from 250f016b3fb2da547786141d503b635b294fe837)
Author: Elliot Peele <elliot at bentlogic.net>
Date: Mon Sep 24 00:55:32 2007 -0400
make updates, installs, and removes work for conary
diff --git a/backends/conary/helpers/conaryBackend.py b/backends/conary/helpers/conaryBackend.py
index 59d931a..e021245 100644
--- a/backends/conary/helpers/conaryBackend.py
+++ b/backends/conary/helpers/conaryBackend.py
@@ -24,7 +24,7 @@ class PackageKitConaryBackend(PackageKit
self.cfg = conarycfg.ConaryConfiguration(True)
self.cfg.initializeFlavors()
self.client = conaryclient.ConaryClient(self.cfg)
- self.callback = UpdateCallback(self.cfg)
+ self.callback = UpdateCallback(self, self.cfg)
self.client.setUpdateCallback(self.callback)
def _get_arch(self, flavor):
@@ -35,9 +35,9 @@ class PackageKitConaryBackend(PackageKit
return ','.join(arches)
def get_package_id(self, name, versionObj, flavor=None):
- version = versionObj.tralingRevision()
+ version = versionObj.trailingRevision()
fullVersion = versionObj.asString()
- if flavor:
+ if flavor is not None:
arch = self._get_arch(flavor)
else:
arch = ""
@@ -48,10 +48,13 @@ class PackageKitConaryBackend(PackageKit
name, verString, archString, fullVerString = \
PackageKitBaseBackend.get_package_from_id(self, id)
- version = versions.fromString(fullVerString)
+ if verString:
+ version = versions.VersionFromString(fullVerString)
+ else:
+ version = None
if archString:
- arches = 'is: %s' % archString.split(',').join(' ')
+ arches = 'is: %s' % ' '.join(archString.split(','))
flavor = deps.parseFlavor(arches)
else:
flavor = None
@@ -151,7 +154,7 @@ class PackageKitConaryBackend(PackageKit
except:
self.error(ERROR_INTERNAL_ERROR, 'An internal error has occurred')
- def _do_update(self, applyList, apply=True):
+ def _do_update(self, applyList, apply=False):
self.cfg.autoResolve = True
updJob = self.client.newUpdateJob()
@@ -162,8 +165,13 @@ class PackageKitConaryBackend(PackageKit
return updJob, suggMap
- def _do_package_update(self, package_id):
- pass
+ def _do_package_update(self, name, version, flavor, apply=False):
+ if name.startswith('-'):
+ applyList = [(name, (version, flavor), (None, None), False)]
+ else:
+ applyList = [(name, (None, None), (version, flavor), False)]
+ updJob, suggMap = self._do_update(applyList, apply=apply)
+ return updJob, suggMap
def check_installed(self, troveTuple):
db = conaryclient.ConaryClient(self.cfg).db
@@ -194,10 +202,27 @@ class PackageKitConaryBackend(PackageKit
pass
def get_requires(self, package_id):
- pass
+ name, version, flavor, installed = self._findPackage(package_id)
+
+ if name:
+ if installed:
+ self.error(ERROR_PACKAGE_ALREADY_INSTALLED,
+ 'Package already installed')
+
+ updJob, suggMap = self._do_pacakge_update(name, version, flavor,
+ apply=False)
+
+ for what, need in suggMap:
+ id = self.get_package_id(need[0], need[1], need[2])
+ self.package(id, False, '')
+ else:
+ self.error(ERROR_PACKAGE_ALREADY_INSTALLED,
+ 'Package was not found')
def update_system(self):
- pass
+ updateItems = self.client.fullUpdateItemList()
+ applyList = [ (x[0], (None, None), x[1:], True) for x in updateItems ]
+ updJob, suggMap = self._do_update(applyList, apply=True)
def refresh_cache(self):
self.percentage()
@@ -215,8 +240,8 @@ class PackageKitConaryBackend(PackageKit
self.error(ERROR_PACKAGE_ALREADY_INSTALLED,
'Package already installed')
try:
- self.base.status(STATE_INSTALL)
- #print "Update code goes here"
+ self.status(STATE_INSTALL)
+ self._do_package_update(name, version, flavor, apply=True)
except:
pass
else:
@@ -234,8 +259,9 @@ class PackageKitConaryBackend(PackageKit
self.error(ERROR_PACKAGE_NOT_INSTALLED,
'Package not installed')
try:
- self.base.status(STATE_REMOVE)
- #print "Remove code goes here"
+ self.status(STATE_REMOVE)
+ name = '-%s' % name
+ self._do_package_update(name, version, flavor, apply=True)
except:
pass
else:
diff --git a/backends/conary/helpers/conaryCallback.py b/backends/conary/helpers/conaryCallback.py
index bbc1430..fb38da5 100644
--- a/backends/conary/helpers/conaryCallback.py
+++ b/backends/conary/helpers/conaryCallback.py
@@ -10,34 +10,37 @@
#
from conary import callbacks
-from conaryBackend import PackageKitConaryBackend
+from packagekit import *
-class UpdateCallback(callbacks.UpdateCallback, PackageKitConaryBackend):
+class UpdateCallback(callbacks.UpdateCallback):
def resolvingDependencies(self):
- self.status('Resolving Dependencies')
+ self.backend.status('Resolving Dependencies')
def creatingRollback(self):
- self.status('Creating Rollback')
+ self.backend.status('Creating Rollback')
def committingTransaction(self):
- self.status('Committing Transaction')
+ self.backend.status('Committing Transaction')
def downloadingFileContents(self, got, need):
- self.status('Downloading files for changeset')
+ self.backend.status('Downloading files for changeset')
def downloadingChangeSet(self, got, need):
- self.status('Downloading')
+ self.backend.status('Downloading')
def requestingFileContents(self):
- self.status('Requesting File Contents')
+ self.backend.status('Requesting File Contents')
def requestingChangeSet(self):
- self.status('Requesting Changeset')
+ self.backend.status('Requesting Changeset')
+
+ def done(self):
+ self.backend.status('Done')
def preparingUpdate(self, troveNum, troveCount, add=0):
if troveNum > 0 and troveCount > 0:
sub_percent = (add + troveNum) / (2 * float(troveCount)) * 100
- self.sub_percentage(sub_percent)
+ self.backend.sub_percentage(sub_percent)
if troveNum != 0:
troveNum -= 1
@@ -48,16 +51,16 @@ class UpdateCallback(callbacks.UpdateCal
newVersion, newFlavor = job[2]
if oldVersion and newVersion:
- self.status('Update')
- id = self.get_package_id(name, newVersion, newFlavor)
+ self.backend.status('Update')
+ id = self.backend.get_package_id(name, newVersion, newFlavor)
elif oldVersion and not newVersion:
- self.status('Erase')
- id = self.get_package_id(name, oldVersion, oldFlavor)
+ self.backend.status('Erase')
+ id = self.backend.get_package_id(name, oldVersion, oldFlavor)
elif not oldVersion and newVersion:
- self.status('Install')
- id = self.get_package_id(name, newVersion, newFlavor)
+ self.backend.status('Install')
+ id = self.backend.get_package_id(name, newVersion, newFlavor)
- self.package(id, 1, '')
+ self.backend.package(id, 1, '')
def creatingDatabaseTransaction(self, troveNum, troveCount):
self.preparingUpdate(troveNum, troveCount, add=troveCount)
@@ -68,7 +71,7 @@ class UpdateCallback(callbacks.UpdateCal
def setUpdateHunk(self, hunk, hunkCount):
if hunk > 0 and hunkCount > 0:
percentage = hunk / float(hunkCount) * 100.0
- self.percentage(percentage)
+ self.backend.percentage(percentage)
def setUpdateJob(self, job):
self.currentJob = job
@@ -76,9 +79,6 @@ class UpdateCallback(callbacks.UpdateCal
def updateDone(self):
self.currentJob = None
- def done(self):
- self.status('done')
-
def tagHandlerOutput(self, tag, msg, stderr = False):
pass
@@ -88,10 +88,10 @@ class UpdateCallback(callbacks.UpdateCal
def troveScriptFailure(self, typ, errcode):
pass
- def __init__(self, cfg=None, args=None):
+ def __init__(self, backend, cfg=None):
callbacks.UpdateCallback.__init__(self)
if cfg:
self.setTrustThreshold(cfg.trustThreshold)
- PackageKitConaryBackend.__init__(self, args)
+ self.backend = backend
self.currentJob = None
diff-tree 250f016b3fb2da547786141d503b635b294fe837 (from 3f9ad9036c9505cb4100ad8a340ef277a48eab4e)
Author: Elliot Peele <elliot at bentlogic.net>
Date: Sun Sep 23 12:16:55 2007 -0400
override get_package_from_id to return a name, version, flavor tuple
diff --git a/backends/conary/helpers/conaryBackend.py b/backends/conary/helpers/conaryBackend.py
index 2777852..59d931a 100644
--- a/backends/conary/helpers/conaryBackend.py
+++ b/backends/conary/helpers/conaryBackend.py
@@ -41,8 +41,22 @@ class PackageKitConaryBackend(PackageKit
arch = self._get_arch(flavor)
else:
arch = ""
- return PackageKitBackend.get_package_id(self, name, version, arch,
- fullVersion)
+ return PackageKitBaseBackend.get_package_id(self, name, version, arch,
+ fullVersion)
+
+ def get_package_from_id(self, id):
+ name, verString, archString, fullVerString = \
+ PackageKitBaseBackend.get_package_from_id(self, id)
+
+ version = versions.fromString(fullVerString)
+
+ if archString:
+ arches = 'is: %s' % archString.split(',').join(' ')
+ flavor = deps.parseFlavor(arches)
+ else:
+ flavor = None
+
+ return name, version, flavor
def _do_search(self, searchlist, filters):
fltlist = filters.split(';')
@@ -148,7 +162,7 @@ class PackageKitConaryBackend(PackageKit
return updJob, suggMap
- def _do_package_update(self, package):
+ def _do_package_update(self, package_id):
pass
def check_installed(self, troveTuple):
@@ -194,8 +208,7 @@ class PackageKitConaryBackend(PackageKit
'''
Implement the {backend}-install functionality
'''
- name, installed, version, arch, fullVersion = \
- self._findPackage(package_id)
+ name, version, flavor, installed = self._findPackage(package_id)
if name:
if installed:
@@ -214,8 +227,7 @@ class PackageKitConaryBackend(PackageKit
'''
Implement the {backend}-remove functionality
'''
- name, installed, version, arch, fullVersion = \
- self._findPackage(package_id)
+ name, version, flavor, installed = self._findPackage(package_id)
if name:
if not installed:
@@ -234,16 +246,13 @@ class PackageKitConaryBackend(PackageKit
'''
Print a detailed description for a given package
'''
- name, installed, version, arch, fullVersion = \
- self._findPackage(package_id)
+ name, version, flavor, installed = self._findPackage(package_id)
- fullVersion = versions.VersionFromString(fullVersion)
- version = fullVersion.trailingRevision()
if name:
- id = self.get_package_id(name, version)
+ id = self.get_package_id(name, version, flavor)
desc = ""
desc += "%s \n" % name
- desc += "%s \n" % version
+ desc += "%s \n" % version.trailingRevision()
desc = desc.replace('\n\n',';')
desc = desc.replace('\n',' ')
detail = ""
@@ -326,13 +335,10 @@ class PackageKitConaryBackend(PackageKit
'''
find a package based on a package id (name;version;arch;repoid)
'''
- # Split up the id
- (name, version, arch, fullVersion) = self.get_package_from_id(id)
- troveTuple = tuple([name,
- versions.VersionFromString(fullVersion),
- None])
+ name, version, flavor = self.get_package_from_id(id)
+ troveTuple = (name, version, flavor)
installed = self.check_installed(troveTuple)
- return name, installed, version, arch, fullVersion
+ return name, version, flavor, installed
class Cache(object):
diff-tree 3f9ad9036c9505cb4100ad8a340ef277a48eab4e (from 23cf7f0166f2b00dcd4e389008eb478cf890cc59)
Author: Elliot Peele <elliot at bentlogic.net>
Date: Sun Sep 23 11:54:31 2007 -0400
add callbacks for erase, install, and update
diff --git a/backends/conary/helpers/conaryCallback.py b/backends/conary/helpers/conaryCallback.py
index b00ce89..bbc1430 100644
--- a/backends/conary/helpers/conaryCallback.py
+++ b/backends/conary/helpers/conaryCallback.py
@@ -44,9 +44,18 @@ class UpdateCallback(callbacks.UpdateCal
job = self.currentJob[troveNum]
name = job[0]
- version, flavor = job[2]
+ oldVersion, oldFlavor = job[1]
+ newVersion, newFlavor = job[2]
- id = self.get_package_id(name, version, flavor)
+ if oldVersion and newVersion:
+ self.status('Update')
+ id = self.get_package_id(name, newVersion, newFlavor)
+ elif oldVersion and not newVersion:
+ self.status('Erase')
+ id = self.get_package_id(name, oldVersion, oldFlavor)
+ elif not oldVersion and newVersion:
+ self.status('Install')
+ id = self.get_package_id(name, newVersion, newFlavor)
self.package(id, 1, '')
diff-tree 23cf7f0166f2b00dcd4e389008eb478cf890cc59 (from parents)
Merge: 03756e64f5a58f56764d0a45dc9a0a4ded435656 67e21e6fef087a473536684ee5871c9322422888
Author: Elliot Peele <elliot at bentlogic.net>
Date: Sun Sep 23 11:52:32 2007 -0400
Merge branch 'master' of git+ssh://git.packagekit.org/srv/git/PackageKit
diff-tree 03756e64f5a58f56764d0a45dc9a0a4ded435656 (from 087fdc05d3f44c78eceac150c131d4c4e7f6ef67)
Author: Elliot Peele <elliot at bentlogic.net>
Date: Sun Sep 23 11:52:25 2007 -0400
clean up get_package_id code
diff --git a/backends/conary/helpers/conaryBackend.py b/backends/conary/helpers/conaryBackend.py
index 41541b1..6e378b7 100644
--- a/backends/conary/helpers/conaryBackend.py
+++ b/backends/conary/helpers/conaryBackend.py
@@ -34,17 +34,15 @@ class PackageKitConaryBackend(PackageKit
arches = [ 'noarch' ]
return ','.join(arches)
- def _get_version(self, version):
- return version.asString()
-
- def get_package_id(self, name, version, flavor=None, fullVersion=None):
- version = self._get_version(version)
- if not flavor == None:
+ def get_package_id(self, name, versionObj, flavor=None):
+ version = versionObj.tralingRevision()
+ fullVersion = versionObj.asString()
+ if flavor:
arch = self._get_arch(flavor)
else:
arch = ""
- return PackageKitBaseBackend.get_package_id(self, name, version,
- arch, fullVersion)
+ return PackageKitBackend.get_package_id(self, name, version, arch,
+ fullVersion)
def _do_search(self, searchlist, filters):
fltlist = filters.split(';')
@@ -71,8 +69,7 @@ class PackageKitConaryBackend(PackageKit
for troveTuple in troveTupleList:
troveTuple = tuple([item.encode('UTF-8') for item in troveTuple])
name = troveTuple[0]
- version = versions.ThawVersion(troveTuple[1]).trailingRevision()
- fullVersion = versions.ThawVersion(troveTuple[1])
+ version = versions.ThawVersion(troveTuple[1])
flavor = deps.ThawFlavor(troveTuple[2])
# We don't have summary data yet... so leave it blank for now
summary = " "
@@ -80,7 +77,7 @@ class PackageKitConaryBackend(PackageKit
installed = self.check_installed(troveTuple)
if self._do_filtering(name,fltlist,installed):
- id = self.get_package_id(name, version, flavor, fullVersion)
+ id = self.get_package_id(name, version, flavor)
self.package(id, installed, summary)
def _do_search_live(self, searchlist, filters):
@@ -120,15 +117,14 @@ class PackageKitConaryBackend(PackageKit
for troveTuple in troveTupleList:
name = troveTuple[0]
- version = troveTuple[1].trailingRevision()
- fullVersion = troveTuple[1].asString()
+ version = troveTuple[1]
flavor = troveTuple[2]
# We don't have summary data yet... so leave it blank for now
summary = " "
installed = self.check_installed(troveTuple)
if self._do_filtering(name,fltlist,installed):
- id = self.get_package_id(name, version, flavor, fullVersion)
+ id = self.get_package_id(name, version, flavor)
self.package(id, installed, summary)
except:
self.error(ERROR_INTERNAL_ERROR, 'An internal error has occurred')
diff-tree 67e21e6fef087a473536684ee5871c9322422888 (from 3f02b426fb8a43a5d0ad20d5a45a3ebabc08dcbd)
Author: Robin Norwood <rnorwood at solitude.devel.redhat.com>
Date: Fri Sep 21 20:42:16 2007 -0400
Automake and configure changes to move packagekit.py to __init__.py. Also fix import in python/pkt
diff --git a/Makefile.am b/Makefile.am
index d22300e..5063b36 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,6 +22,9 @@ pkgconfig_DATA = packagekit.pc
dbusdir = ${SYSCONFDIR}/dbus-1/system.d
dist_dbus_DATA = PackageKit.conf
+packagekitpythondir = ${PYTHON_PACKAGE_DIR}
+packagekitpython_PYTHON = python/__init__.py
+
EXTRA_DIST = \
PackageKit.conf.in \
packagekit.pc.in \
diff --git a/configure.ac b/configure.ac
index 65ac324..8960710 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,6 +23,11 @@ AM_PROG_LIBTOOL
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
+AM_PATH_PYTHON
+PYTHON_PACKAGE_DIR=${pythondir}/PackageKit
+AC_SUBST(PYTHON_PACKAGE_DIR)
+
+
dnl ---------------------------------------------------------------------------
dnl - Extra verbose warning switches
dnl ---------------------------------------------------------------------------
diff --git a/python/pkt b/python/pkt
index ab8b71b..28e9a5b 100755
--- a/python/pkt
+++ b/python/pkt
@@ -17,7 +17,7 @@ from sys import argv,exit
from optparse import OptionParser
from types import FunctionType
-from packagekit import *
+from PackageKit import *
class pkt(PackageKit):
def Percentage(self,progress):
diff-tree 3f02b426fb8a43a5d0ad20d5a45a3ebabc08dcbd (from 88bd12f30e34bbf1d59f962e398246de13805293)
Author: Andreas Obergrusberger <tradiaz at yahoo.de>
Date: Sat Sep 22 03:13:54 2007 +0200
added install_file to alpm backend
diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index 1f664c8..268380b 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -815,6 +815,48 @@ backend_get_filters (PkBackend *backend,
pk_enum_list_append (list, PK_FILTER_ENUM_INSTALLED);
}
+static void
+backend_install_file (PkBackend *backend, const gchar *path)
+{
+ g_return_if_fail (backend != NULL);
+ alpm_list_t *problems = NULL;
+ if (alpm_trans_init (PM_TRANS_TYPE_ADD, 0,
+ trans_event_cb, trans_conv_cb,
+ trans_prog_cb) == -1)
+ {
+ pk_backend_error_code (backend,
+ PK_ERROR_ENUM_TRANSACTION_ERROR,
+ alpm_strerror (pm_errno));
+ pk_backend_finished (backend);
+ return;
+ }
+
+ alpm_trans_addtarget ((char *)path);
+
+ if (alpm_trans_prepare (&problems) != 0)
+ {
+ pk_backend_error_code (backend,
+ PK_ERROR_ENUM_TRANSACTION_ERROR,
+ alpm_strerror (pm_errno));
+ pk_backend_finished (backend);
+ alpm_trans_release ();
+ return;
+ }
+
+ if (alpm_trans_commit (&problems) != 0)
+ {
+ pk_backend_error_code (backend,
+ PK_ERROR_ENUM_TRANSACTION_ERROR,
+ alpm_strerror (pm_errno));
+ pk_backend_finished (backend);
+ alpm_trans_release ();
+ return;
+ }
+
+ alpm_trans_release ();
+ pk_backend_finished (backend);
+}
+
PK_BACKEND_OPTIONS (
"alpm", /* description */
@@ -831,7 +873,7 @@ PK_BACKEND_OPTIONS (
NULL, /* get_update_detail */
backend_get_updates, /* get_updates */
backend_install_package, /* install_package */
- NULL, /* install_file */
+ backend_install_file, /* install_file */
backend_refresh_cache, /* refresh_cache */
backend_remove_package, /* remove_package */
NULL, /* resolve */
diff-tree 88bd12f30e34bbf1d59f962e398246de13805293 (from a6d3ebc3d58c81f5509acaf6da0098e2bf680917)
Author: Andreas Obergrusberger <tradiaz at yahoo.de>
Date: Sat Sep 22 03:00:15 2007 +0200
add get_filters to alpm backend
diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index bb5f817..1f664c8 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -20,7 +20,9 @@
*/
#define ALPM_CONFIG_PATH "/etc/pacman.conf"
-#define PROGRESS_UPDATE_INTERVAL 400
+#define ALPM_PROGRESS_UPDATE_INTERVAL 400
+#define ALPM_FILTER_INSTALLED "installed"
+#define ALPM_FILTER_NINSTALLED "~installed"
#include <gmodule.h>
#include <glib.h>
@@ -552,7 +554,7 @@ backend_refresh_cache (PkBackend *backen
alpm_list_t *i = NULL;
pk_backend_change_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
- g_timeout_add (PROGRESS_UPDATE_INTERVAL, update_subprogress, backend);
+ g_timeout_add (ALPM_PROGRESS_UPDATE_INTERVAL, update_subprogress, backend);
for (i = dbs; i; i = alpm_list_next (i))
{
if (alpm_db_update (force, (pmdb_t *)i->data))
@@ -706,11 +708,11 @@ backend_search_name (PkBackend *backend,
sections = g_strsplit (filter, ";", 0);
int i = 0;
while (sections[i]) {
- if (strcmp(sections[i], "installed") == 0)
+ if (strcmp(sections[i], ALPM_FILTER_INSTALLED) == 0)
{
installed = FALSE;
}
- if (strcmp(sections[i], "~installed") == 0)
+ if (strcmp(sections[i], ALPM_FILTER_NINSTALLED) == 0)
{
ninstalled = FALSE;
}
@@ -805,6 +807,14 @@ backend_get_groups (PkBackend *backend,
pk_enum_list_set_type (list, PK_ENUM_LIST_TYPE_GROUP);
}
+static void
+backend_get_filters (PkBackend *backend, PkEnumList *list)
+{
+ list = pk_enum_list_new ();
+ pk_enum_list_set_type (list, PK_ENUM_LIST_TYPE_FILTER);
+ pk_enum_list_append (list, PK_FILTER_ENUM_INSTALLED);
+}
+
PK_BACKEND_OPTIONS (
"alpm", /* description */
@@ -813,7 +823,7 @@ PK_BACKEND_OPTIONS (
backend_initialize, /* initalize */
backend_destroy, /* destroy */
backend_get_groups, /* get_groups */
- NULL, /* get_filters */
+ backend_get_filters, /* get_filters */
NULL, /* cancel */
backend_get_depends, /* get_depends */
backend_get_description, /* get_description */
diff-tree a6d3ebc3d58c81f5509acaf6da0098e2bf680917 (from parents)
Merge: fea7d74eb31392103da30bded475df86d886fdd4 2a050a7dc2428d6ddbe8a437d1900690883f48e5
Author: Andreas Obergrusberger <tradiaz at yahoo.de>
Date: Sat Sep 22 02:45:36 2007 +0200
Merge branch 'master' of git+ssh://tradiaz@git.packagekit.org/srv/git/PackageKit
diff-tree fea7d74eb31392103da30bded475df86d886fdd4 (from ec6fd193c33b44e3a9f5ba606b9d19f8a05ff601)
Author: Andreas Obergrusberger <tradiaz at yahoo.de>
Date: Sat Sep 22 02:45:16 2007 +0200
add get_groups to alpm
diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index c7bc26e..bb5f817 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -392,7 +392,7 @@ static void
backend_get_description (PkBackend *backend, const gchar *package_id)
{
g_return_if_fail (backend != NULL);
- PkPackageId *id = pk_package_id_new_from_string (package_id);
+ //PkPackageId *id = pk_package_id_new_from_string (package_id);
//pk_backend_description (backend, package_id, "unknown", PK_GROUP_ENUM_PROGRAMMING, "sdgd");
pk_backend_finished (backend);
}
@@ -798,13 +798,21 @@ backend_update_system (PkBackend *backen
g_timeout_add (1000, backend_update_system_timeout, backend);
}
+static void
+backend_get_groups (PkBackend *backend, PkEnumList *list)
+{
+ list = pk_enum_list_new ();
+ pk_enum_list_set_type (list, PK_ENUM_LIST_TYPE_GROUP);
+}
+
+
PK_BACKEND_OPTIONS (
"alpm", /* description */
"0.0.1", /* version */
"Andreas Obergrusberger <tradiaz at yahoo.de>", /* author */
backend_initialize, /* initalize */
backend_destroy, /* destroy */
- NULL, /* get_groups */
+ backend_get_groups, /* get_groups */
NULL, /* get_filters */
NULL, /* cancel */
backend_get_depends, /* get_depends */
diff-tree 2a050a7dc2428d6ddbe8a437d1900690883f48e5 (from ec6fd193c33b44e3a9f5ba606b9d19f8a05ff601)
Author: Richard Hughes <richard at hughsie.com>
Date: Sat Sep 22 00:11:31 2007 +0100
use transaction id for get_old_transactions
diff --git a/libpackagekit/pk-task-monitor.c b/libpackagekit/pk-task-monitor.c
index 0202fef..1c97dcc 100644
--- a/libpackagekit/pk-task-monitor.c
+++ b/libpackagekit/pk-task-monitor.c
@@ -422,16 +422,18 @@ pk_task_monitor_package_cb (DBusGProxy
* pk_task_monitor_transaction_cb:
*/
static void
-pk_task_monitor_transaction_cb (DBusGProxy *proxy,
- const gchar *tid, const gchar *timespec,
+pk_task_monitor_transaction_cb (DBusGProxy *proxy,
+ const gchar *tid, const gchar *old_tid, const gchar *timespec,
gboolean succeeded, const gchar *role, guint duration,
PkTaskMonitor *tmonitor)
{
g_return_if_fail (tmonitor != NULL);
g_return_if_fail (PK_IS_TASK_MONITOR (tmonitor));
- pk_debug ("emitting transaction %s, %s, %i, %s, %i", tid, timespec, succeeded, role, duration);
- g_signal_emit (tmonitor, signals [PK_TASK_MONITOR_TRANSACTION], 0, tid, timespec, succeeded, role, duration);
+ if (pk_transaction_id_equal (tid, tmonitor->priv->tid) == TRUE) {
+ pk_debug ("emitting transaction %s, %s, %i, %s, %i", old_tid, timespec, succeeded, role, duration);
+ g_signal_emit (tmonitor, signals [PK_TASK_MONITOR_TRANSACTION], 0, tid, timespec, succeeded, role, duration);
+ }
}
/**
@@ -674,8 +676,8 @@ pk_task_monitor_init (PkTaskMonitor *tmo
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
/* transaction */
- dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_BOOL_STRING_UINT,
- G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN,
+ dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING_BOOL_STRING_UINT,
+ G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN,
G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INVALID);
dbus_g_proxy_add_signal (proxy, "Finished",
@@ -709,7 +711,8 @@ pk_task_monitor_init (PkTaskMonitor *tmo
G_CALLBACK (pk_task_monitor_package_cb), tmonitor, NULL);
dbus_g_proxy_add_signal (proxy, "Transaction",
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INVALID);
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INVALID);
dbus_g_proxy_connect_signal (proxy, "Transaction",
G_CALLBACK (pk_task_monitor_transaction_cb), tmonitor, NULL);
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 121bd26..7eee5cb 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -64,6 +64,7 @@ struct PkEnginePrivate
gchar *backend;
PkTransactionList *transaction_list;
PkTransactionDb *transaction_db;
+ PkTransactionItem *sync_item;
};
enum {
@@ -1622,6 +1623,7 @@ pk_engine_get_old_transactions (PkEngine
g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);
item = pk_transaction_list_add (engine->priv->transaction_list, NULL);
+ engine->priv->sync_item = item;
pk_transaction_db_get_list (engine->priv->transaction_db, number);
*tid = g_strdup (item->tid);
// pk_engine_finished_cb ();
@@ -1782,11 +1784,12 @@ pk_engine_get_filters (PkEngine *engine,
* pk_engine_transaction_cb:
**/
static void
-pk_engine_transaction_cb (PkTransactionDb *tdb, const gchar *tid, const gchar *timespec,
+pk_engine_transaction_cb (PkTransactionDb *tdb, const gchar *old_tid, const gchar *timespec,
gboolean succeeded, const gchar *role, guint duration, PkEngine *engine)
{
- pk_debug ("emitting transaction %s, %s, %i, %s, %i", tid, timespec, succeeded, role, duration);
- g_signal_emit (engine, signals [PK_ENGINE_TRANSACTION], 0, tid, timespec, succeeded, role, duration);
+ const gchar *tid = engine->priv->sync_item->tid;
+ pk_debug ("emitting transaction %s, %s, %s, %i, %s, %i", tid, old_tid, timespec, succeeded, role, duration);
+ g_signal_emit (engine, signals [PK_ENGINE_TRANSACTION], 0, tid, old_tid, timespec, succeeded, role, duration);
}
/**
@@ -1892,8 +1895,9 @@ pk_engine_class_init (PkEngineClass *kla
signals [PK_ENGINE_TRANSACTION] =
g_signal_new ("transaction",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_BOOL_STRING_UINT,
- G_TYPE_NONE, 5, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_UINT);
+ 0, NULL, NULL, pk_marshal_VOID__STRING_STRING_STRING_BOOL_STRING_UINT,
+ G_TYPE_NONE, 6, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_UINT);
g_type_class_add_private (klass, sizeof (PkEnginePrivate));
}
diff --git a/src/pk-marshal.list b/src/pk-marshal.list
index 72a0ca8..ba07221 100644
--- a/src/pk-marshal.list
+++ b/src/pk-marshal.list
@@ -16,4 +16,5 @@ VOID:STRING,STRING,UINT,STRING,STRING
VOID:STRING,UINT,STRING,STRING
VOID:STRING,STRING,UINT,UINT,UINT
VOID:STRING,STRING,BOOL,STRING,UINT
+VOID:STRING,STRING,STRING,BOOL,STRING,UINT
diff-tree 087fdc05d3f44c78eceac150c131d4c4e7f6ef67 (from parents)
Merge: 835a71b48e87ef0fccaee18655091ec590526e48 c5e0f41d4db3fa360a6528566675b2ba11258067
Author: Elliot Peele <elliot at bentlogic.net>
Date: Fri Sep 21 12:13:31 2007 -0400
Merge branch 'master' of git+ssh://git.packagekit.org/srv/git/PackageKit
diff --cc backends/conary/helpers/conaryBackend.py
index 6a4fa89,f0209f3..41541b1
@@@ -249,10 -233,13 +250,11 @@@
self.error(ERROR_INTERNAL_ERROR,'Package was not found')
def get_updates(self):
+ self.percentage()
updateItems = self.client.fullUpdateItemList()
applyList = [ (x[0], (None, None), x[1:], True) for x in updateItems ]
- updJob = self.client.newUpdateJob()
- suggMap = self.client.prepareUpdateJob(updJob, applyList,
- resolveDeps=True,
- migrate=False)
+ updJob, suggMap = self._do_update(applyList, apply=False)
+
jobLists = updJob.getJobs()
totalJobs = len(jobLists)
diff-tree 835a71b48e87ef0fccaee18655091ec590526e48 (from 82325964ec316c467d787ffc8c15c2c4dbb20a90)
Author: Elliot Peele <elliot at bentlogic.net>
Date: Fri Sep 21 12:13:24 2007 -0400
initial install work
diff --git a/backends/conary/helpers/conaryBackend.py b/backends/conary/helpers/conaryBackend.py
index d2b0f8e..6a4fa89 100644
--- a/backends/conary/helpers/conaryBackend.py
+++ b/backends/conary/helpers/conaryBackend.py
@@ -16,6 +16,7 @@ from conary import conarycfg, conaryclie
from conary import dbstore, queryrep, versions, updatecmd
from packagekit import *
+from conaryCallback import UpdateCallback
class PackageKitConaryBackend(PackageKitBaseBackend):
def __init__(self, args):
@@ -23,6 +24,8 @@ class PackageKitConaryBackend(PackageKit
self.cfg = conarycfg.ConaryConfiguration(True)
self.cfg.initializeFlavors()
self.client = conaryclient.ConaryClient(self.cfg)
+ self.callback = UpdateCallback(self.cfg)
+ self.client.setUpdateCallback(self.callback)
def _get_arch(self, flavor):
isdep = deps.InstructionSetDependency
@@ -130,6 +133,20 @@ class PackageKitConaryBackend(PackageKit
except:
self.error(ERROR_INTERNAL_ERROR, 'An internal error has occurred')
+ def _do_update(self, applyList, apply=True):
+ self.cfg.autoResolve = True
+
+ updJob = self.client.newUpdateJob()
+ suggMap = self.client.prepareUpdateJob(updJob, applyList)
+
+ if apply:
+ restartDir = self.client.applyUpdateJob(updJob)
+
+ return updJob, suggMap
+
+ def _do_package_update(self, package):
+ pass
+
def check_installed(self, troveTuple):
db = conaryclient.ConaryClient(self.cfg).db
try:
@@ -234,10 +251,8 @@ class PackageKitConaryBackend(PackageKit
def get_updates(self):
updateItems = self.client.fullUpdateItemList()
applyList = [ (x[0], (None, None), x[1:], True) for x in updateItems ]
- updJob = self.client.newUpdateJob()
- suggMap = self.client.prepareUpdateJob(updJob, applyList,
- resolveDeps=True,
- migrate=False)
+ updJob, suggMap = self._do_update(applyList, apply=False)
+
jobLists = updJob.getJobs()
totalJobs = len(jobLists)
diff-tree 82325964ec316c467d787ffc8c15c2c4dbb20a90 (from 0f1902e99e453b98f1706ebced8b58a1245e6338)
Author: Elliot Peele <elliot at bentlogic.net>
Date: Fri Sep 21 00:00:34 2007 -0400
add callbacks
diff --git a/backends/conary/helpers/conaryCallback.py b/backends/conary/helpers/conaryCallback.py
new file mode 100644
index 0000000..b00ce89
--- /dev/null
+++ b/backends/conary/helpers/conaryCallback.py
@@ -0,0 +1,88 @@
+#
+# Copyright (c) 2007 Elliot Peele <elliot at bentlogic.net>
+#
+# Licensed under the GNU General Public License Version 2
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+
+from conary import callbacks
+from conaryBackend import PackageKitConaryBackend
+
+class UpdateCallback(callbacks.UpdateCallback, PackageKitConaryBackend):
+ def resolvingDependencies(self):
+ self.status('Resolving Dependencies')
+
+ def creatingRollback(self):
+ self.status('Creating Rollback')
+
+ def committingTransaction(self):
+ self.status('Committing Transaction')
+
+ def downloadingFileContents(self, got, need):
+ self.status('Downloading files for changeset')
+
+ def downloadingChangeSet(self, got, need):
+ self.status('Downloading')
+
+ def requestingFileContents(self):
+ self.status('Requesting File Contents')
+
+ def requestingChangeSet(self):
+ self.status('Requesting Changeset')
+
+ def preparingUpdate(self, troveNum, troveCount, add=0):
+ if troveNum > 0 and troveCount > 0:
+ sub_percent = (add + troveNum) / (2 * float(troveCount)) * 100
+ self.sub_percentage(sub_percent)
+
+ if troveNum != 0:
+ troveNum -= 1
+
+ job = self.currentJob[troveNum]
+ name = job[0]
+ version, flavor = job[2]
+
+ id = self.get_package_id(name, version, flavor)
+
+ self.package(id, 1, '')
+
+ def creatingDatabaseTransaction(self, troveNum, troveCount):
+ self.preparingUpdate(troveNum, troveCount, add=troveCount)
+
+ def setChangesetHunk(self, num, total):
+ pass
+
+ def setUpdateHunk(self, hunk, hunkCount):
+ if hunk > 0 and hunkCount > 0:
+ percentage = hunk / float(hunkCount) * 100.0
+ self.percentage(percentage)
+
+ def setUpdateJob(self, job):
+ self.currentJob = job
+
+ def updateDone(self):
+ self.currentJob = None
+
+ def done(self):
+ self.status('done')
+
+ def tagHandlerOutput(self, tag, msg, stderr = False):
+ pass
+
+ def troveScriptOutput(self, typ, msg):
+ pass
+
+ def troveScriptFailure(self, typ, errcode):
+ pass
+
+ def __init__(self, cfg=None, args=None):
+ callbacks.UpdateCallback.__init__(self)
+ if cfg:
+ self.setTrustThreshold(cfg.trustThreshold)
+ PackageKitConaryBackend.__init__(self, args)
+
+ self.currentJob = None
More information about the PackageKit
mailing list