[PackageKit-commit] packagekit: Branch 'master' - 14 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Tue Nov 18 01:05:20 PST 2008
backends/conary/Cache.py | 346 +++++++++++++++++++++++++
backends/conary/Makefile.am | 5
backends/conary/conaryBackend.py | 485 +++++++++---------------------------
backends/conary/conaryCallback.py | 33 +-
backends/conary/conaryFilter.py | 23 +
backends/conary/conaryInit.py | 17 +
backends/conary/pk-backend-conary.c | 31 ++
backends/conary/pkConaryLog.py | 9
client/pk-console.c | 263 +++++++++++++++++++
client/pk-monitor.c | 13
contrib/pk-completion.bash | 3
docs/html/pk-profiles.html | 2
lib/packagekit-glib/pk-client.h | 4
lib/packagekit-glib/pk-control.c | 19 +
lib/packagekit-qt/CMakeLists.txt | 14 -
lib/python/packagekit/client.py | 28 +-
po/pl.po | 125 ++++-----
17 files changed, 950 insertions(+), 470 deletions(-)
New commits:
commit 7fe8c4449ecada18696b160251cfe28f73ae8a3a
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Nov 18 09:04:33 2008 +0000
trivial: pylint and whitespaces fixes in the conary backend
diff --git a/backends/conary/Cache.py b/backends/conary/Cache.py
index f0dbe06..c3fc43a 100644
--- a/backends/conary/Cache.py
+++ b/backends/conary/Cache.py
@@ -43,7 +43,7 @@ class Cache(object):
def __init__(self):
""" Class to retrieve and cache package information from label. """
-
+
self.is_populate_database = False
if not os.path.isdir(self.dbPath):
os.makedirs(self.dbPath)
diff --git a/backends/conary/conaryBackend.py b/backends/conary/conaryBackend.py
index 083448a..3cdd6d1 100644
--- a/backends/conary/conaryBackend.py
+++ b/backends/conary/conaryBackend.py
@@ -42,7 +42,7 @@ from conary import conarycfg, conaryclient
pkpackage = PackagekitPackage()
-from pkConaryLog import log,pdb
+from pkConaryLog import log, pdb
groupMap = {
'2DGraphics' : GROUP_GRAPHICS,
@@ -159,7 +159,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
def __init__(self, args):
PackageKitBaseBackend.__init__(self, args)
-
+
# conary configurations
self.cfg = init_conary_config()
self.client = init_conary_client()
@@ -192,20 +192,20 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
return pkpackage.get_package_id(name, version, arch, data)
@ExceptionHandler
- def get_package_from_id(self, id):
- """ id(string) =
- "pastebinit;0.7-1-1;x86;/foresight.rpath.org at fl:2-qa/1222042924.172:0.7-1-1,1#x86"
+ def get_package_from_id(self, package_id):
+ """ package_id(string) =
+ "pastebinit;0.7-1-1;x86;/foresight.rpath.org at fl:2-qa/1222042924.172:0.7-1-1,1#x86"
"""
- log.info("=========== get package from id ======================")
- log.info(id)
- name, verString, archString, data = pkpackage.get_package_from_id(id)
+ log.info("=========== get package from package_id ======================")
+ log.info(package_id)
+ name, verString, archString, data = pkpackage.get_package_from_id(package_id)
log.info(data)
version, flavor = self._thawData(data)
return name, version, flavor
def _do_search(self, searchlist, filters):
"""
- searchlist(str)ist as the package for search like
+ searchlist(str)ist as the package for search like
filters(str) as the filter
"""
fltlist = filters.split(';')
@@ -216,7 +216,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
allowEmptyName=False) ]
# get a hold of cached data
cache = Cache()
- log.debug((searchlist,fltlist))
+ log.debug((searchlist, fltlist))
try:
troveTupleList = cache.search(searchlist)
@@ -233,7 +233,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
del tempDict # move on to the next method
else:
troveTupleList = tempDict.keys()
-
+
# Get the latest first
troveTupleList.sort()
troveTupleList.reverse()
@@ -246,7 +246,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
troveTuple = tuple([name, version, flavor])
log.info("TROVETUPLE %s" % str(troveTuple))
installed = self.check_installed(troveTuple)
-
+
if installed is "installed":
pkgfilter.add_installed([troveTuple])
log.info(" === Installed ========= %s" % name)
@@ -296,17 +296,17 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
return self._do_update(applyList)
@ExceptionHandler
- def resolve(self, filter, package):
+ def resolve(self, filters, packages):
self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
log.info("======== resolve =========")
- log.info("filter: %s package:%s "%(filter,package))
- if len(package):
- for i in package:
- self._do_search(i, filter)
+ log.info("filters: %s package:%s " % (filters, packages))
+ if len(packages):
+ for i in packages:
+ self._do_search(i, filters)
else:
- self._do_search(package,filter)
+ self._do_search(packages, filters)
@ExceptionHandler
def check_installed(self, troveTuple):
@@ -395,18 +395,18 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.percentage(None)
self.status(STATUS_QUERY)
log.info("============= search_name ========")
- log.info("options: %s searchlist:%s "%(options,searchlist))
+ log.info("options: %s searchlist:%s "%(options, searchlist))
self._do_search(searchlist, options)
def search_details(self, opt, key):
pass
- def get_requires(self, filters, package_id):
+ def get_requires(self, filters, package_ids, recursive_text):
pass
@ExceptionHandler
- def get_depends(self, filters, package_id):
- name, version, flavor, installed = self._findPackage(package_id)
+ def get_depends(self, filters, package_ids, recursive_text):
+ name, version, flavor, installed = self._findPackage(package_ids[0])
if name:
if installed == INFO_INSTALLED:
@@ -416,21 +416,21 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
updJob, suggMap = self._get_package_update(name, version,
flavor)
for what, need in suggMap:
- id = self.get_package_id(need[0], need[1], need[2])
+ package_id = self.get_package_id(need[0], need[1], need[2])
depInstalled = self.check_installed(need[0])
if depInstalled == INFO_INSTALLED:
- self.package(id, INFO_INSTALLED, '')
+ self.package(package_id, INFO_INSTALLED, '')
else:
- self.package(id, INFO_AVAILABLE, '')
+ self.package(package_id, INFO_AVAILABLE, '')
else:
self.error(ERROR_PACKAGE_ALREADY_INSTALLED, 'Package was not found')
@ExceptionHandler
- def get_files(self, package_id):
+ def get_files(self, package_ids):
self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
- package_id = package_id[0]
+ package_id = package_ids[0]
def _get_files(troveSource, n, v, f):
files = []
troves = [(n, v, f)]
@@ -438,7 +438,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
troves.extend([ x for x in trv.iterTroveList(strongRefs=True)
if troveSource.hasTrove(*x)])
for n, v, f in troves:
- for (pathId, path, fileId, version, file) in \
+ for (pathId, path, fileId, version, filename) in \
troveSource.iterFilesInTrove(n, v, f, sortByPath = True,
withFiles = True):
files.append(path)
@@ -471,7 +471,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
cache.populate_database()
@ExceptionHandler
- def update(self, packages):
+ def update(self, package_ids):
'''
Implement the {backend}-update functionality
'''
@@ -479,18 +479,19 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.percentage(0)
self.status(STATUS_RUNNING)
- for package in packages.split(" "):
+ for package in package_ids.split(" "):
name, version, flavor, installed = self._findPackage(package)
if name:
self._do_package_update(name, version, flavor)
else:
self.error(ERROR_PACKAGE_ALREADY_INSTALLED, 'No available updates')
- def install_packages(self, packages_ids):
- """
- alias of update_packages
+ def install_packages(self, package_ids):
+ """
+ alias of update_packages
"""
- self.update_packages(packages_ids)
+ self.update_packages(package_ids)
+
@ExceptionHandler
def update_packages(self, package_ids):
'''
@@ -501,7 +502,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
for package_id in package_ids:
log.info(package_id)
name, version, flavor, installed = self._findPackage(package_id)
- log.info((name,version))
+ log.info((name, version))
self.allow_cancel(True)
self.percentage(0)
@@ -542,7 +543,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
else:
self.error(ERROR_PACKAGE_ALREADY_INSTALLED, 'The package was not found')
- def _get_metadata(self, id, field):
+ def _get_metadata(self, package_id, field):
'''
Retrieve metadata from the repository and return result
field should be one of:
@@ -559,7 +560,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_QUERY)
- n, v, f = self.get_package_from_id(id)
+ n, v, f = self.get_package_from_id(package_id)
trvList = self.client.repos.findTrove(self.cfg.installLabelPath,
(n, v, f),
defaultFlavor = self.cfg.flavor)
@@ -570,8 +571,8 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
result = trove.getMetadata()[field]
return result
- def _get_update_extras(self, id):
- notice = self._get_metadata(id, 'notice') or " "
+ def _get_update_extras(self, package_id):
+ notice = self._get_metadata(package_id, 'notice') or " "
urls = {'jira':[], 'cve' : [], 'vendor': []}
if notice:
# Update Details
@@ -604,19 +605,19 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.require_restart(RESTART_SYSTEM, "")
@ExceptionHandler
- def get_update_detail(self, id):
+ def get_update_detail(self, package_ids):
'''
Implement the {backend}-get-update_detail functionality
'''
self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
- id = id[0]
- name, version, flavor, installed = self._findPackage(id)
+ package_id = package_ids[0]
+ name, version, flavor, installed = self._findPackage(package_id)
#update = self._get_updated(pkg)
update = ""
obsolete = ""
- #desc, urls, reboot = self._get_update_extras(id)
+ #desc, urls, reboot = self._get_update_extras(package_id)
#cve_url = _format_list(urls['cve'])
cve_url = ""
#bz_url = _format_list(urls['jira'])
@@ -624,12 +625,12 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
#vendor_url = _format_list(urls['vendor'])
vendor_url = ""
reboot = "none"
- desc = self._get_metadata(id, 'longDesc') or " "
- self.update_detail(id, update, obsolete, vendor_url, bz_url, cve_url,
+ desc = self._get_metadata(package_id, 'longDesc') or " "
+ self.update_detail(package_id, update, obsolete, vendor_url, bz_url, cve_url,
reboot, desc, changelog="", state="", issued="", updated="")
@ExceptionHandler
- def get_details(self, id):
+ def get_details(self, package_ids):
'''
Print a detailed description for a given package
'''
@@ -638,30 +639,29 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.status(STATUS_INFO)
log.info("========== get_details =============")
- log.info(id[0])
- id=id[0]
- name, version, flavor, installed = self._findPackage(id)
+ log.info(package_ids[0])
+ package_id = package_ids[0]
+ name, version, flavor, installed = self._findPackage(package_id)
log.info("name--------------------")
- log.info((id,name))
-
+ log.info((package_id, name))
if name:
- shortDesc = self._get_metadata(id, 'shortDesc') or name
- longDesc = self._get_metadata(id, 'longDesc') or ""
+ shortDesc = self._get_metadata(package_id, 'shortDesc') or name
+ longDesc = self._get_metadata(package_id, 'longDesc') or ""
url = "http://www.foresightlinux.org/packages/" + name + ".html"
- categories = self._get_metadata(id, 'categories') or "unknown"
+ categories = self._get_metadata(package_id, 'categories') or "unknown"
# Package size goes here, but I don't know how to find that for conary packages.
- self.details(id, None, categories, longDesc, url, 0)
+ self.details(package_id, None, categories, longDesc, url, 0)
else:
self.error(ERROR_PACKAGE_NOT_FOUND, 'Package was not found')
def _show_package(self, name, version, flavor, status):
''' Show info about package'''
- id = self.get_package_id(name, version, flavor)
- summary = self._get_metadata(id, 'shortDesc') or ""
- self.package(id, status, summary)
+ package_id = self.get_package_id(name, version, flavor)
+ summary = self._get_metadata(package_id, 'shortDesc') or ""
+ self.package(package_id, status, summary)
def _get_status(self, notice):
# We need to figure out how to get this info, this is a place holder
@@ -674,7 +674,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
return INFO_NORMAL
@ExceptionHandler
- def get_updates(self, filter):
+ def get_updates(self, filters):
self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
@@ -705,13 +705,13 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
installed = self.check_installed(troveTuple)
self._show_package(name, version, flavor, INFO_NORMAL)
- def _findPackage(self, id):
+ def _findPackage(self, package_id):
'''
find a package based on a package id (name;version;arch;repoid)
'''
log.info("========== _findPackage ==========")
- log.info(id)
- name, version, flavor = self.get_package_from_id(id)
+ log.info(package_id)
+ name, version, flavor = self.get_package_from_id(package_id)
troveTuple = (name, version, flavor)
log.info("======== trove ")
log.info(troveTuple)
@@ -736,7 +736,6 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'''
pass
-
def main():
backend = PackageKitConaryBackend('')
log.info("======== argv =========== ")
diff --git a/backends/conary/conaryCallback.py b/backends/conary/conaryCallback.py
index 84b574a..464e42f 100644
--- a/backends/conary/conaryCallback.py
+++ b/backends/conary/conaryCallback.py
@@ -35,7 +35,7 @@ class UpdateCallback(callbacks.UpdateCallback):
def committingTransaction(self):
#self.backend.status('Committing Transaction')
log.info("Callback ........ STATUS_COMMIT ")
-
+
self.backend.status(STATUS_COMMIT)
def downloadingFileContents(self, got, need):
@@ -85,23 +85,22 @@ class UpdateCallback(callbacks.UpdateCallback):
name = job[0]
oldVersion, oldFlavor = job[1]
newVersion, newFlavor = job[2]
- log.info((oldVersion,newVersion))
+ log.info((oldVersion, newVersion))
if oldVersion and newVersion:
log.info("Callback ........ STATUS_UPDATE ")
self.backend.status(STATUS_UPDATE)
- id = self.backend.get_package_id(name, newVersion, newFlavor)
- self.backend.package(id, INFO_UPDATING, '')
+ package_id = self.backend.get_package_id(name, newVersion, newFlavor)
+ self.backend.package(package_id, INFO_UPDATING, '')
elif oldVersion and not newVersion:
log.info("Callback ........ STATUS_REMOVE ")
self.backend.status(STATUS_REMOVE)
- id = self.backend.get_package_id(name, oldVersion, oldFlavor)
- self.backend.package(id, INFO_REMOVING, '')
+ package_id = self.backend.get_package_id(name, oldVersion, oldFlavor)
+ self.backend.package(package_id, INFO_REMOVING, '')
elif not oldVersion and newVersion:
log.info("Callback ........ STATUS_INSTALL ")
self.backend.status(STATUS_INSTALL)
- id = self.backend.get_package_id(name, newVersion, newFlavor)
- self.backend.package(id, INFO_INSTALLING, '')
-
+ package_id = self.backend.get_package_id(name, newVersion, newFlavor)
+ self.backend.package(package_id, INFO_INSTALLING, '')
def creatingDatabaseTransaction(self, troveNum, troveCount):
self.preparingUpdate(troveNum, troveCount, add=troveCount)
diff --git a/backends/conary/conaryFilter.py b/backends/conary/conaryFilter.py
index 1237987..635e0e2 100644
--- a/backends/conary/conaryFilter.py
+++ b/backends/conary/conaryFilter.py
@@ -40,13 +40,13 @@ class ConaryFilter(PackagekitFilter):
regex = re.compile(r'(:devel)')
return regex.search(pkg.name)
- def _pkg_is_installed(self,pkg):
+ def _pkg_is_installed(self, pkg):
'''
Return if the packages are installed
'''
log.info("======= FILTER ===== " )
log.info(pkg)
- troveTuple=pkg
+ troveTuple = pkg
db = conary_db()
try:
troveTuple = troveTuple[0], troveTuple[1], troveTuple[2]
@@ -58,6 +58,4 @@ class ConaryFilter(PackagekitFilter):
log.info(installed)
return installed
-
-
diff --git a/backends/conary/conaryInit.py b/backends/conary/conaryInit.py
index e46f1b0..2851916 100644
--- a/backends/conary/conaryInit.py
+++ b/backends/conary/conaryInit.py
@@ -1,9 +1,6 @@
#!/usr/bin/python
from conary import conarycfg, conaryclient
-
-
-
def init_conary_config():
cfg = conarycfg.ConaryConfiguration(True)
cfg.initializeFlavors()
@@ -14,8 +11,7 @@ def init_conary_config():
def init_conary_client():
cfg = init_conary_config()
return conaryclient.ConaryClient(cfg)
-
-
+
def conary_db():
client = init_conary_client()
return client.db
diff --git a/backends/conary/pk-backend-conary.c b/backends/conary/pk-backend-conary.c
index 2227f47..936e190 100644
--- a/backends/conary/pk-backend-conary.c
+++ b/backends/conary/pk-backend-conary.c
@@ -153,9 +153,9 @@ backend_get_update_detail (PkBackend *backend, gchar **package_ids)
* backend_install_packages:
*/
-/*
+/*
python conaryBackend.py update-packages "gimp;2.4.6-0.2-1;x86;/foresight.rpath.org at fl:devel//2-qa/1222042924.132:2.4.6-0.2-1,1#x86"
-
+
*/
static void
backend_install_packages (PkBackend *backend, gchar **package_ids)
@@ -214,7 +214,6 @@ backend_refresh_cache (PkBackend *backend, gboolean force)
zodman notes:
python conaryBackend.py remove-packages none "pastebinit;0.7-1-1;x86;/foresight.rpath.org at fl:2-qa/1222042924.172:0.7-1-1,1#x86"
-
*/
static void
backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove)
@@ -247,7 +246,6 @@ 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 update when offline");
@@ -274,8 +272,8 @@ backend_update_system (PkBackend *backend)
* pk_backend_resolve:
*/
-/* zodman note
-
+/* zodman note
+
# python conaryBackend.py resolve installed pastebinit
allow-cancel true
no-percentage-updates
@@ -283,10 +281,9 @@ status info
allow-cancel true
no-percentage-updates
status query
-package available pastebinit;0.7-1-1;x86;/foresight.rpath.org at fl:2-qa/1222042924.172:0.7-1-1,1#x86
+package available pastebinit;0.7-1-1;x86;/foresight.rpath.org at fl:2-qa/1222042924.172:0.7-1-1,1#x86
finished
-
*/
static void
backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
commit bfe5f6e7fea39ab88e6d413193158c323f6b947a
Author: Ken VanDine <ken at vandine.org>
Date: Mon Nov 17 21:19:30 2008 -0500
Updated the update-detail call
diff --git a/backends/conary/conaryBackend.py b/backends/conary/conaryBackend.py
index b86553f..083448a 100644
--- a/backends/conary/conaryBackend.py
+++ b/backends/conary/conaryBackend.py
@@ -611,6 +611,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
+ id = id[0]
name, version, flavor, installed = self._findPackage(id)
#update = self._get_updated(pkg)
update = ""
@@ -624,7 +625,8 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
vendor_url = ""
reboot = "none"
desc = self._get_metadata(id, 'longDesc') or " "
- self.update_detail(id, update, obsolete, vendor_url, bz_url, cve_url, reboot, desc)
+ self.update_detail(id, update, obsolete, vendor_url, bz_url, cve_url,
+ reboot, desc, changelog="", state="", issued="", updated="")
@ExceptionHandler
def get_details(self, id):
@@ -732,6 +734,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'''
Implement the {backend}-repo-enable functionality
'''
+ pass
def main():
commit 197a08bc08473fa51189f9c27938f57155210896
Author: Ken VanDine <ken at vandine.org>
Date: Mon Nov 17 16:17:42 2008 -0500
merged in more fixes from Andres
diff --git a/backends/conary/conaryBackend.py b/backends/conary/conaryBackend.py
index 07bb779..b86553f 100644
--- a/backends/conary/conaryBackend.py
+++ b/backends/conary/conaryBackend.py
@@ -196,8 +196,10 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
""" id(string) =
"pastebinit;0.7-1-1;x86;/foresight.rpath.org at fl:2-qa/1222042924.172:0.7-1-1,1#x86"
"""
+ log.info("=========== get package from id ======================")
log.info(id)
name, verString, archString, data = pkpackage.get_package_from_id(id)
+ log.info(data)
version, flavor = self._thawData(data)
return name, version, flavor
@@ -428,6 +430,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
+ package_id = package_id[0]
def _get_files(troveSource, n, v, f):
files = []
troves = [(n, v, f)]
@@ -632,9 +635,15 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.percentage(None)
self.status(STATUS_INFO)
+ log.info("========== get_details =============")
+ log.info(id[0])
id=id[0]
name, version, flavor, installed = self._findPackage(id)
+ log.info("name--------------------")
+ log.info((id,name))
+
+
if name:
shortDesc = self._get_metadata(id, 'shortDesc') or name
longDesc = self._get_metadata(id, 'longDesc') or ""
@@ -667,7 +676,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
-
+ log.info("============== get_updates ========================")
updateItems = self.client.fullUpdateItemList()
applyList = [ (x[0], (None, None), x[1:], True) for x in updateItems ]
updJob, suggMap = self._get_update(applyList)
@@ -702,6 +711,8 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
log.info(id)
name, version, flavor = self.get_package_from_id(id)
troveTuple = (name, version, flavor)
+ log.info("======== trove ")
+ log.info(troveTuple)
installed = self.check_installed(troveTuple)
return name, version, flavor, installed
commit 905e971b4aa75dcaa711cd72a3e619473e0e78e8
Author: Ken VanDine <ken at vandine.org>
Date: Mon Nov 17 15:59:10 2008 -0500
Merged in work from Andres Vargas
diff --git a/backends/conary/Cache.py b/backends/conary/Cache.py
new file mode 100644
index 0000000..f0dbe06
--- /dev/null
+++ b/backends/conary/Cache.py
@@ -0,0 +1,346 @@
+#!/usr/bin/python
+# Licensed under the GNU General Public License Version 2
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright (C) 2007 Ken VanDine <ken at vandine.org>
+# Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
+
+import os
+from conary import errors
+from conary.deps import deps
+from conary import conarycfg, conaryclient
+from conary import dbstore, queryrep, versions, updatecmd
+from conary.local import database
+from conary import trove
+
+
+
+from pkConaryLog import log
+
+class Cache(object):
+ # Database name and path
+ dbName = 'cache.db'
+ # Someday we might want to make this writable by users
+ #if 'HOME' in os.environ:
+ # dbPath = '%s/.conary/cache/data/' % os.environ['HOME']
+ #else:
+ # dbPath = '/var/cache/conary/'
+ dbPath = '/var/cache/conary/'
+ jobPath = dbPath + 'jobs'
+
+ def __init__(self):
+ """ Class to retrieve and cache package information from label. """
+
+ self.is_populate_database = False
+ if not os.path.isdir(self.dbPath):
+ os.makedirs(self.dbPath)
+ if not os.path.isdir(self.jobPath):
+ os.mkdir(self.jobPath)
+
+ self.conn = dbstore.connect(os.path.join(self.dbPath, self.dbName))
+ self.cursor = self.conn.cursor()
+ self.cursor.execute("PRAGMA count_changes=0", start_transaction=False)
+
+ if os.path.isfile(os.path.join(self.dbPath, self.dbName)):
+ self._validate_tables()
+
+ def _validate_tables(self):
+ """ Validates that all tables are up to date. """
+ #backend = PackageKitBaseBackend(self)
+ stmt = ("select tbl_name from sqlite_master "
+ "where type = 'table' and tbl_name like 'conary_%'")
+ self.cursor.execute(stmt)
+ # List of all tables with names that start with "conary_"
+ tbllist = self.cursor.fetchall()
+ if tbllist == [('conary_packages',)]:
+ self.cursor.execute('DROP TABLE conary_packages')
+ self.conn.commit()
+ tbllist = []
+ if tbllist != []:
+ return True
+ #print "Verified packages table"
+ else:
+ log.info("Creando tablas")
+ # Create all tables if database is empty
+ if len(tbllist) == 0:
+ self._create_database()
+ #ackend.status(STATUS_WAIT)
+ self.is_populate_database = True
+ self.populate_database()
+ return True
+
+ def _getJobCachePath(self, applyList):
+ from conary.lib import sha1helper
+ applyStr = '\0'.join(['%s=%s[%s]--%s[%s]%s' % (x[0], x[1][0], x[1][1], x[2][0], x[2][1], x[3]) for x in applyList])
+ return self.jobPath + '/' + sha1helper.sha1ToString(sha1helper.sha1String(applyStr))
+
+ def checkCachedUpdateJob(self, applyList):
+ jobPath = self._getJobCachePath(applyList)
+ if os.path.exists(jobPath):
+ return jobPath
+
+ def cacheUpdateJob(self, applyList, updJob):
+ jobPath = self._getJobCachePath(applyList)
+ if os.path.exists(jobPath):
+ from conary.lib import util
+ util.rmtree(jobPath)
+ os.mkdir(jobPath)
+ updJob.freeze(jobPath)
+
+ def conaryquery(self):
+ self.cfg = conarycfg.ConaryConfiguration()
+ self.client = conaryclient.ConaryClient(self.cfg)
+ self.cfg.readFiles()
+ self.cfg.initializeFlavors()
+ self.repos = self.client.getRepos()
+ self.db = conaryclient.ConaryClient(self.cfg).db
+
+ troves = queryrep.getTrovesToDisplay(self.repos, None, None, None,
+ queryrep.VERSION_FILTER_LEAVES, queryrep.FLAVOR_FILTER_BEST,
+ self.cfg.installLabelPath, self.cfg.flavor, None)
+
+ packages = []
+
+ for troveTuple in troves:
+ # troveTuple is probably what we want to store in the cachedb
+ # Then use the below methods to present them in a nicer fashion
+ if troveTuple[0].endswith(':source'):
+ continue
+ if ":" in troveTuple[0]:
+ fragments = troveTuple[0].split(":")
+ trove = fragments[0]
+ component = fragments[1]
+ else:
+ trove = troveTuple[0]
+ component = ""
+
+ installed = 0
+ flavor = troveTuple[2].freeze()
+ fullVersion = troveTuple[1].freeze()
+ label = str(troveTuple[1].branch().label())
+ description = ""
+ category = ""
+ packagegroup = ""
+ size = ""
+ packages.append([trove, component, fullVersion, label, flavor,
+ description, category, packagegroup, size])
+
+ return packages
+
+ def connect_memory(self):
+ return sqlite.connect(':memory:')
+
+ def cursor(self, connection):
+ return connection.cursor()
+
+ def _create_database(self):
+ #FIXME: delete the category column. it's not useful
+ """ Creates a blank database. """
+ sql = '''CREATE TABLE conary_packages (
+ packageId INTEGER,
+ trove text,
+ component text,
+ version text,
+ label text,
+ flavor text,
+ description text,
+ category text,
+ packagegroup text,
+ size text)'''
+
+ self.cursor.execute(sql)
+
+ sql = '''CREATE TABLE conary_categories (
+ categoryId INTEGER,
+ categoryName text)'''
+
+ self.cursor.execute(sql)
+
+ sql = '''CREATE TABLE conary_category_package_map (
+ categoryId INTEGER,
+ packageId INTEGER)'''
+
+ self.cursor.execute(sql)
+
+ sql = '''CREATE TABLE conary_licenses (
+ licenseId INTEGER,
+ licenseName text)'''
+
+ self.cursor.execute(sql)
+
+ sql = '''CREATE TABLE conary_license_package_map (
+ licenseId INTEGER,
+ packageId INTEGER)'''
+
+ self.cursor.execute(sql)
+
+ #self.conn.createIndex('conary_catagories', 'conary_category_name_idx', ['categoryName'])
+ #self.conn.createIndex('conary_catagories', 'conary_category_id_idx', ['categoryId'])
+ self.conn.commit()
+
+
+
+ def commit(self):
+ self.cursor.commit()
+
+ def getTroves(self, label=None):
+ """
+ Returns all troves for now. Add filtering capability.
+ """
+ stmt = ("select distinct trove, version, flavor, description, "
+ "category, packagegroup, size from conary_packages")
+
+ self.cursor.execute(stmt)
+ return self.cursor.fetchall()
+
+ def search(self, package, fullVersion=None):
+ """
+ Returns all troves for now. Add filtering capability.
+ """
+ #log.debug(package)
+ stmt = ("select distinct trove, version, flavor, description, "
+ "category, packagegroup, size from conary_packages")
+
+ if package and fullVersion:
+ stmt = ("select distinct trove, version, flavor from "
+ "conary_packages where trove ='%s' and version = '%s'"
+ % (package, fullVersion))
+ elif package:
+ stmt += (" where trove like '%%%s%%' and component = '' order by "
+ "version desc" % package)
+
+ try:
+ self.cursor.execute(stmt)
+ results = self.cursor.fetchall()
+ log.debug(results)
+ return results
+ except Exception, e:
+ print str(e)
+ return None
+
+ def searchByGroups(self, groups):
+ """
+ Returns all troves for given groups. (trove, version, flavor)
+ Needs filtering capability.
+ ['all'] means all packages
+ FIXME: No filtering done on group text - SQL injection
+ """
+ if not groups:
+ groups = ["all"]
+
+ if "all" in groups:
+ stmt = ("SELECT DISTINCT CP.trove, CP.version, CP.flavor, CC.categoryName"
+ " FROM conary_packages CP, conary_categories CC, conary_category_package_map CCMap"
+ " WHERE CCMap.packageId = CP.packageId"
+ " AND CCMap.categoryId = CC.categoryId"
+ " GROUP BY CP.trove, CP.version, CP.flavor"
+ " ORDER BY CP.trove, CP.version DESC, CP.flavor")
+ else:
+ group_string = ", ".join(groups)
+ stmt = ("SELECT DISTINCT CP.trove, CP.version, CP.flavor, CC.categoryName"
+ " FROM conary_packages CP, conary_categories CC, conary_category_package_map CCMap"
+ " WHERE CC.categoryName IN (%s)"
+ " AND CCMap.packageId = CP.packageId"
+ " AND CCMap.categoryId = CC.categoryId"
+ " GROUP BY CP.trove, CP.version, CP.flavor"
+ " ORDER BY CP.trove, CP.version DESC, CP.flavor" % group_string)
+
+ try:
+ self.cursor.execute(stmt)
+ return self.cursor.fetchall()
+ except Exception, e:
+ print str(e)
+ return None
+
+ def _insert(self, trove):
+ """
+ Insert trove into database.
+ """
+ res = self.cursor.execute("SELECT COALESCE(max(packageId), 0) + 1 FROM conary_packages")
+ pkgId = res.fetchone()[0] + 1
+ trove = [pkgId] + trove[:]
+
+ values = [str(field) for field in trove]
+ cols = ", ".join("?" * len(trove))
+ sql = "INSERT INTO conary_packages VALUES (%s)" % cols
+
+ try:
+ self.cursor.execute(sql, values)
+ #self.conn.commit()
+ except Exception, e:
+ print str(e)
+
+ def _clear_table(self, tableName='conary_packages'):
+ """
+ Deletes * records from table.
+ """
+ stmt = "DELETE FROM %s" % tableName
+ try:
+ self.cursor.execute(stmt)
+ except dbstore.sqlerrors.InvalidTable:
+ pass
+
+ def populate_database(self):
+ packages = self.conaryquery()
+ # Clear table first
+ for tblName in ('conary_packages', 'conary_category_package_map',
+ 'conary_categories'):
+ self._clear_table(tblName)
+ log.info("Insertando datos")
+ for package in packages:
+ self._insert(package)
+ self.conn.commit()
+ log.info("Datos insertados")
+
+ def _addPackageCategory(self, trv, category):
+ res = self.cursor.execute( \
+ 'SELECT packageId FROM conary_packages WHERE trove=? and version=? and flavor = ?', trv.getName(), trv.getVersion().freeze(), trv.getFlavor().freeze())
+ res = res.fetchone()
+ if res:
+ # we have a packageID
+ pkgId = res[0]
+ else:
+ # we really should have had this data
+ raise RuntimeError
+
+ # now look up/make the categoryId
+ res = self.cursor.execute('SELECT categoryId FROM conary_categories WHERE categoryName=?', category)
+ res = res.fetchone()
+ if not res:
+ res = self.cursor.execute('SELECT COALESCE(MAX(categoryId), 0) + 1 FROM conary_categories')
+ catId = res.fetchone()[0]
+ self.cursor.execute('INSERT INTO conary_categories VALUES(?, ?)',
+ catId, category)
+ else:
+ catId = category
+
+ self.cursor.execute("INSERT INTO conary_category_package_map VALUES(?, ?)", catId, pkgId)
+ self.conn.commit()
+
+ def populate_metadata(self, csList):
+ for cs in csList:
+ for troveCS in cs.iterNewTroveList():
+ trv = trove.Trove(troveCS)
+ if ':' in trv.getName():
+ # components aren't tracked at the moment
+ continue
+ metadata = trv.getMetadata()
+ categories = metadata.get('categories', [])
+ for category in categories:
+ self._addPackageCategory(trv, category)
+ #licenses = metadata.get('licenses', [])
+ #for license in licenses:
+ # self._addPackageLicense(trv, license)
diff --git a/backends/conary/Makefile.am b/backends/conary/Makefile.am
index 3f57301..364c93f 100644
--- a/backends/conary/Makefile.am
+++ b/backends/conary/Makefile.am
@@ -2,7 +2,10 @@ helperdir = $(datadir)/PackageKit/helpers/conary
dist_helper_DATA = \
conaryBackend.py \
conaryFilter.py \
- conaryCallback.py
+ conaryCallback.py \
+ conaryInit.py \
+ Cache.py \
+ pkConaryLog.py
plugindir = $(PK_PLUGIN_DIR)
plugin_LTLIBRARIES = libpk_backend_conary.la
diff --git a/backends/conary/conaryBackend.py b/backends/conary/conaryBackend.py
index e39b606..07bb779 100644
--- a/backends/conary/conaryBackend.py
+++ b/backends/conary/conaryBackend.py
@@ -17,6 +17,7 @@
#
# Copyright (C) 2007 Ken VanDine <ken at vandine.org>
# Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
+# Copyright (C) 2008 Andres Vargas <zodman at foresightlinux.org>
import sys
import os
@@ -24,7 +25,6 @@ import re
from conary import errors
from conary.deps import deps
-from conary import conarycfg, conaryclient
from conary import dbstore, queryrep, versions, updatecmd
from conary.local import database
from conary import trove
@@ -33,9 +33,17 @@ from packagekit.backend import *
from packagekit.package import *
from conaryCallback import UpdateCallback
from conaryFilter import *
+#from XMLCache import XMLCache as Cache
+
+# zodman fix
+from Cache import Cache
+from conaryInit import init_conary_config, init_conary_client
+from conary import conarycfg, conaryclient
pkpackage = PackagekitPackage()
+from pkConaryLog import log,pdb
+
groupMap = {
'2DGraphics' : GROUP_GRAPHICS,
'Accessibility' : GROUP_ACCESSIBILITY,
@@ -151,13 +159,10 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
def __init__(self, args):
PackageKitBaseBackend.__init__(self, args)
-
- self.cfg = conarycfg.ConaryConfiguration(True)
- self.cfg.initializeFlavors()
- self.cfg.autoResolve = True
- self.cfg.keepRequired = True
-
- self.client = conaryclient.ConaryClient(self.cfg)
+
+ # conary configurations
+ self.cfg = init_conary_config()
+ self.client = init_conary_client()
self.callback = UpdateCallback(self, self.cfg)
self.client.setUpdateCallback(self.callback)
@@ -188,23 +193,32 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
@ExceptionHandler
def get_package_from_id(self, id):
- name, verString, archString, data = \
- pkpackage.get_package_from_id(id)
-
+ """ id(string) =
+ "pastebinit;0.7-1-1;x86;/foresight.rpath.org at fl:2-qa/1222042924.172:0.7-1-1,1#x86"
+ """
+ log.info(id)
+ name, verString, archString, data = pkpackage.get_package_from_id(id)
version, flavor = self._thawData(data)
-
return name, version, flavor
def _do_search(self, searchlist, filters):
+ """
+ searchlist(str)ist as the package for search like
+ filters(str) as the filter
+ """
fltlist = filters.split(';')
pkgfilter = ConaryFilter(fltlist)
+ #pkgfilter = ConaryFilter()
+
troveSpecs = [ updatecmd.parseTroveSpec(searchlist,
allowEmptyName=False) ]
# get a hold of cached data
cache = Cache()
+ log.debug((searchlist,fltlist))
try:
troveTupleList = cache.search(searchlist)
+ log.info("FOUND!!!!!! %s"% str(troveTupleList))
finally:
pass
@@ -217,7 +231,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
del tempDict # move on to the next method
else:
troveTupleList = tempDict.keys()
-
+
# Get the latest first
troveTupleList.sort()
troveTupleList.reverse()
@@ -228,14 +242,20 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
version = versions.ThawVersion(troveTuple[1])
flavor = deps.ThawFlavor(troveTuple[2])
troveTuple = tuple([name, version, flavor])
+ log.info("TROVETUPLE %s" % str(troveTuple))
installed = self.check_installed(troveTuple)
- if installed:
+
+ if installed is "installed":
pkgfilter.add_installed([troveTuple])
+ log.info(" === Installed ========= %s" % name)
else:
pkgfilter.add_available([troveTuple])
+ log.info("=== Available====== %s" % name)
# we couldn't do this when generating the list
+
package_list = pkgfilter.post_process()
+ log.info("package_list %s" %package_list)
self._show_package_list(package_list)
def _get_update(self, applyList, cache=True):
@@ -278,10 +298,18 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
- self._do_search(package, filter)
+ log.info("======== resolve =========")
+ log.info("filter: %s package:%s "%(filter,package))
+ if len(package):
+ for i in package:
+ self._do_search(i, filter)
+ else:
+ self._do_search(package,filter)
@ExceptionHandler
def check_installed(self, troveTuple):
+ log.debug("============check installed =========")
+ log.info(troveTuple)
db = conaryclient.ConaryClient(self.cfg).db
try:
troveTuple = troveTuple[0], troveTuple[1], troveTuple[2]
@@ -289,6 +317,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
installed = INFO_INSTALLED
except:
installed = INFO_AVAILABLE
+ log.info(installed)
return installed
def _pkg_is_installed(self, pkg):
@@ -337,15 +366,22 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
# we couldn't do this when generating the list
package_list = pkgfilter.post_process()
+ log.info("package_list %s" % package_list)
self._show_package_list(package_list)
def _show_package_list(self, lst):
- for (troveTuple, status) in lst:
+ log.info("------------- show_package_list ----------")
+ log.info(lst)
+ for troveTuple, status in lst:
name = troveTuple[0]
version = troveTuple[1]
flavor = troveTuple[2]
package_id = self.get_package_id(name, version, flavor)
+ log.info("pkg id")
+ log.info(package_id)
summary = self._get_metadata(package_id, 'shortDesc') or " "
+ #summary = " "
+ log.info("####Package %s %s %s" % (package_id, status, summary ))
self.package(package_id, status, summary)
@ExceptionHandler
@@ -356,7 +392,8 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_QUERY)
-
+ log.info("============= search_name ========")
+ log.info("options: %s searchlist:%s "%(options,searchlist))
self._do_search(searchlist, options)
def search_details(self, opt, key):
@@ -422,10 +459,13 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
@ExceptionHandler
def refresh_cache(self):
+ #log.debug("refresh-cache command ")
self.percentage()
self.status(STATUS_REFRESH_CACHE)
cache = Cache()
- cache.populate_database()
+ if not cache.is_populate_database:
+ self.status(STATUS_WAIT)
+ cache.populate_database()
@ExceptionHandler
def update(self, packages):
@@ -443,13 +483,22 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
else:
self.error(ERROR_PACKAGE_ALREADY_INSTALLED, 'No available updates')
+ def install_packages(self, packages_ids):
+ """
+ alias of update_packages
+ """
+ self.update_packages(packages_ids)
@ExceptionHandler
def update_packages(self, package_ids):
'''
Implement the {backend}-{install, update}-packages functionality
'''
- for package_id in package_ids.split('%'):
+ log.info(package_ids)
+ #for package_id in package_ids.split('%'):
+ for package_id in package_ids:
+ log.info(package_id)
name, version, flavor, installed = self._findPackage(package_id)
+ log.info((name,version))
self.allow_cancel(True)
self.percentage(0)
@@ -474,8 +523,9 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.allow_cancel(True)
self.percentage(0)
self.status(STATUS_RUNNING)
-
- for package_id in package_ids.split('%'):
+ log.info("========== Remove Packages ============ ")
+ #for package_id in package_ids.split('%'):
+ for package_id in package_ids:
name, version, flavor, installed = self._findPackage(package_id)
if name:
@@ -506,9 +556,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_QUERY)
-
n, v, f = self.get_package_from_id(id)
-
trvList = self.client.repos.findTrove(self.cfg.installLabelPath,
(n, v, f),
defaultFlavor = self.cfg.flavor)
@@ -584,6 +632,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.percentage(None)
self.status(STATUS_INFO)
+ id=id[0]
name, version, flavor, installed = self._findPackage(id)
if name:
@@ -649,6 +698,8 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'''
find a package based on a package id (name;version;arch;repoid)
'''
+ log.info("========== _findPackage ==========")
+ log.info(id)
name, version, flavor = self.get_package_from_id(id)
troveTuple = (name, version, flavor)
installed = self.check_installed(troveTuple)
@@ -672,315 +723,10 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'''
-class Cache(object):
- # Database name and path
- dbName = 'cache.db'
- # Someday we might want to make this writable by users
- #if 'HOME' in os.environ:
- # dbPath = '%s/.conary/cache/data/' % os.environ['HOME']
- #else:
- # dbPath = '/var/cache/conary/'
- dbPath = '/var/cache/conary/'
- jobPath = dbPath + 'jobs'
-
- def __init__(self):
- """ Class to retrieve and cache package information from label. """
- if not os.path.isdir(self.dbPath):
- os.makedirs(self.dbPath)
- if not os.path.isdir(self.jobPath):
- os.mkdir(self.jobPath)
-
- self.conn = dbstore.connect(os.path.join(self.dbPath, self.dbName))
- self.cursor = self.conn.cursor()
- self.cursor.execute("PRAGMA count_changes=0", start_transaction=False)
-
- if os.path.isfile(os.path.join(self.dbPath, self.dbName)):
- self._validate_tables()
-
- def _validate_tables(self):
- """ Validates that all tables are up to date. """
- backend = PackageKitBaseBackend(self)
- stmt = ("select tbl_name from sqlite_master "
- "where type = 'table' and tbl_name like 'conary_%'")
- self.cursor.execute(stmt)
- # List of all tables with names that start with "conary_"
- tbllist = self.cursor.fetchall()
- if tbllist == [('conary_packages',)]:
- self.cursor.execute('DROP TABLE conary_packages')
- self.conn.commit()
- tbllist = []
- if tbllist != []:
- return True
- #print "Verified packages table"
- else:
- #print "Creating packages table..."
- # Create all tables if database is empty
- if len(tbllist) == 0:
- self._create_database()
- backend.status(STATUS_WAIT)
- self.populate_database()
- return True
-
- def _getJobCachePath(self, applyList):
- from conary.lib import sha1helper
- applyStr = '\0'.join(['%s=%s[%s]--%s[%s]%s' % (x[0], x[1][0], x[1][1], x[2][0], x[2][1], x[3]) for x in applyList])
- return self.jobPath + '/' + sha1helper.sha1ToString(sha1helper.sha1String(applyStr))
-
- def checkCachedUpdateJob(self, applyList):
- jobPath = self._getJobCachePath(applyList)
- if os.path.exists(jobPath):
- return jobPath
-
- def cacheUpdateJob(self, applyList, updJob):
- jobPath = self._getJobCachePath(applyList)
- if os.path.exists(jobPath):
- from conary.lib import util
- util.rmtree(jobPath)
- os.mkdir(jobPath)
- updJob.freeze(jobPath)
-
- def conaryquery(self):
- self.cfg = conarycfg.ConaryConfiguration()
- self.client = conaryclient.ConaryClient(self.cfg)
- self.cfg.readFiles()
- self.cfg.initializeFlavors()
- self.repos = self.client.getRepos()
- self.db = conaryclient.ConaryClient(self.cfg).db
-
- troves = queryrep.getTrovesToDisplay(self.repos, None, None, None,
- queryrep.VERSION_FILTER_LEAVES, queryrep.FLAVOR_FILTER_BEST,
- self.cfg.installLabelPath, self.cfg.flavor, None)
-
- packages = []
-
- for troveTuple in troves:
- # troveTuple is probably what we want to store in the cachedb
- # Then use the below methods to present them in a nicer fashion
- if troveTuple[0].endswith(':source'):
- continue
- if ":" in troveTuple[0]:
- fragments = troveTuple[0].split(":")
- trove = fragments[0]
- component = fragments[1]
- else:
- trove = troveTuple[0]
- component = ""
-
- installed = 0
- flavor = troveTuple[2].freeze()
- fullVersion = troveTuple[1].freeze()
- label = str(troveTuple[1].branch().label())
- description = ""
- category = ""
- packagegroup = ""
- size = ""
- packages.append([trove, component, fullVersion, label, flavor,
- description, category, packagegroup, size])
-
- return packages
-
- def connect_memory(self):
- return sqlite.connect(':memory:')
-
- def cursor(self, connection):
- return connection.cursor()
-
- def _create_database(self):
- #FIXME: delete the category column. it's not useful
-
- """ Creates a blank database. """
- sql = '''CREATE TABLE conary_packages (
- packageId INTEGER,
- trove text,
- component text,
- version text,
- label text,
- flavor text,
- description text,
- category text,
- packagegroup text,
- size text)'''
-
- self.cursor.execute(sql)
-
- sql = '''CREATE TABLE conary_categories (
- categoryId INTEGER,
- categoryName text)'''
-
- self.cursor.execute(sql)
-
- sql = '''CREATE TABLE conary_category_package_map (
- categoryId INTEGER,
- packageId INTEGER)'''
-
- self.cursor.execute(sql)
-
- sql = '''CREATE TABLE conary_licenses (
- licenseId INTEGER,
- licenseName text)'''
-
- self.cursor.execute(sql)
-
- sql = '''CREATE TABLE conary_license_package_map (
- licenseId INTEGER,
- packageId INTEGER)'''
-
- self.cursor.execute(sql)
-
- #self.conn.createIndex('conary_catagories', 'conary_category_name_idx', ['categoryName'])
- #self.conn.createIndex('conary_catagories', 'conary_category_id_idx', ['categoryId'])
-
-
-
- def commit(self):
- self.cursor.commit()
-
- def getTroves(self, label=None):
- """
- Returns all troves for now. Add filtering capability.
- """
- stmt = ("select distinct trove, version, flavor, description, "
- "category, packagegroup, size from conary_packages")
-
- self.cursor.execute(stmt)
- return self.cursor.fetchall()
-
- def search(self, package, fullVersion=None):
- """
- Returns all troves for now. Add filtering capability.
- """
- stmt = ("select distinct trove, version, flavor, description, "
- "category, packagegroup, size from conary_packages")
-
- if package and fullVersion:
- stmt = ("select distinct trove, version, flavor from "
- "conary_packages where trove ='%s' and version = '%s'"
- % (package, fullVersion))
- elif package:
- stmt += (" where trove like '%%%s%%' and component = '' order by "
- "version desc" % package)
-
- try:
- self.cursor.execute(stmt)
- results = self.cursor.fetchall()
- return results
- except Exception, e:
- print str(e)
- return None
-
- def searchByGroups(self, groups):
- """
- Returns all troves for given groups. (trove, version, flavor)
- Needs filtering capability.
- ['all'] means all packages
- FIXME: No filtering done on group text - SQL injection
- """
- if not groups:
- groups = ["all"]
-
- if "all" in groups:
- stmt = ("SELECT DISTINCT CP.trove, CP.version, CP.flavor, CC.categoryName"
- " FROM conary_packages CP, conary_categories CC, conary_category_package_map CCMap"
- " WHERE CCMap.packageId = CP.packageId"
- " AND CCMap.categoryId = CC.categoryId"
- " GROUP BY CP.trove, CP.version, CP.flavor"
- " ORDER BY CP.trove, CP.version DESC, CP.flavor")
- else:
- group_string = ", ".join(groups)
- stmt = ("SELECT DISTINCT CP.trove, CP.version, CP.flavor, CC.categoryName"
- " FROM conary_packages CP, conary_categories CC, conary_category_package_map CCMap"
- " WHERE CC.categoryName IN (%s)"
- " AND CCMap.packageId = CP.packageId"
- " AND CCMap.categoryId = CC.categoryId"
- " GROUP BY CP.trove, CP.version, CP.flavor"
- " ORDER BY CP.trove, CP.version DESC, CP.flavor" % group_string)
-
- try:
- self.cursor.execute(stmt)
- return self.cursor.fetchall()
- except Exception, e:
- print str(e)
- return None
-
- def _insert(self, trove):
- """
- Insert trove into database.
- """
- res = self.cursor.execute("SELECT COALESCE(max(packageId), 0) + 1 FROM conary_packages")
- pkgId = res.fetchone()[0] + 1
- trove = [pkgId] + trove[:]
-
- values = [str(field) for field in trove]
- cols = ", ".join("?" * len(trove))
- sql = "INSERT INTO conary_packages VALUES (%s)" % cols
-
- try:
- self.cursor.execute(sql, values)
- self.conn.commit()
- except Exception, e:
- print str(e)
-
- def _clear_table(self, tableName='conary_packages'):
- """
- Deletes * records from table.
- """
- stmt = "DELETE FROM %s" % tableName
- try:
- self.cursor.execute(stmt)
- except dbstore.sqlerrors.InvalidTable:
- pass
-
- def populate_database(self):
- packages = self.conaryquery()
- # Clear table first
- for tblName in ('conary_packages', 'conary_category_package_map',
- 'conary_categories'):
- self._clear_table(tblName)
- for package in packages:
- self._insert(package)
-
- def _addPackageCategory(self, trv, category):
- res = self.cursor.execute( \
- 'SELECT packageId FROM conary_packages WHERE trove=? and version=? and flavor = ?', trv.getName(), trv.getVersion().freeze(), trv.getFlavor().freeze())
- res = res.fetchone()
- if res:
- # we have a packageID
- pkgId = res[0]
- else:
- # we really should have had this data
- raise RuntimeError
-
- # now look up/make the categoryId
- res = self.cursor.execute('SELECT categoryId FROM conary_categories WHERE categoryName=?', category)
- res = res.fetchone()
- if not res:
- res = self.cursor.execute('SELECT COALESCE(MAX(categoryId), 0) + 1 FROM conary_categories')
- catId = res.fetchone()[0]
- self.cursor.execute('INSERT INTO conary_categories VALUES(?, ?)',
- catId, category)
- else:
- catId = category
-
- self.cursor.execute("INSERT INTO conary_category_package_map VALUES(?, ?)", catId, pkgId)
- self.conn.commit()
-
- def populate_metadata(self, csList):
- for cs in csList:
- for troveCS in cs.iterNewTroveList():
- trv = trove.Trove(troveCS)
- if ':' in trv.getName():
- # components aren't tracked at the moment
- continue
- metadata = trv.getMetadata()
- categories = metadata.get('categories', [])
- for category in categories:
- self._addPackageCategory(trv, category)
- #licenses = metadata.get('licenses', [])
- #for license in licenses:
- # self._addPackageLicense(trv, license)
-
def main():
backend = PackageKitConaryBackend('')
+ log.info("======== argv =========== ")
+ log.info(sys.argv)
backend.dispatcher(sys.argv[1:])
if __name__ == "__main__":
diff --git a/backends/conary/conaryCallback.py b/backends/conary/conaryCallback.py
index 7700853..84b574a 100644
--- a/backends/conary/conaryCallback.py
+++ b/backends/conary/conaryCallback.py
@@ -20,6 +20,7 @@
from conary import callbacks
from packagekit.backend import *
+from pkConaryLog import log
class UpdateCallback(callbacks.UpdateCallback):
def resolvingDependencies(self):
@@ -28,29 +29,42 @@ class UpdateCallback(callbacks.UpdateCallback):
def creatingRollback(self):
#self.backend.status('Creating Rollback')
+ log.info("Callback ........ STATUS_ROLLBACK ")
self.backend.status(STATUS_ROLLBACK)
def committingTransaction(self):
#self.backend.status('Committing Transaction')
+ log.info("Callback ........ STATUS_COMMIT ")
+
self.backend.status(STATUS_COMMIT)
def downloadingFileContents(self, got, need):
#self.backend.status('Downloading files for changeset')
+ log.info("Callback ........ STATUS_DOWNLOAD ")
self.backend.status(STATUS_DOWNLOAD)
def downloadingChangeSet(self, got, need):
+ log.info("Callback ........ STATUS_DOWNLOAD changeset")
self.backend.status(STATUS_DOWNLOAD)
def requestingFileContents(self):
#self.backend.status('Requesting File Contents')
+ log.info("Callback ........ STATUS_REQUEST ")
self.backend.status(STATUS_REQUEST)
def requestingChangeSet(self):
#self.backend.status('Requesting Changeset')
+ log.info("Callback ........ STATUS_REQUEST changeset ")
self.backend.status(STATUS_REQUEST)
+ def removeFiles(self, filenum, total):
+ log.info("Callback ........ STATUS_REMOVE")
+ self.backend.status(STATUS_REMOVE)
+ self.preparingUpdate(filenum, total, add=total)
def done(self):
#self.backend.status('Done')
+
+ log.info("Callback ........ done! ")
pass
def preparingUpdate(self, troveNum, troveCount, add=0):
@@ -71,16 +85,19 @@ class UpdateCallback(callbacks.UpdateCallback):
name = job[0]
oldVersion, oldFlavor = job[1]
newVersion, newFlavor = job[2]
-
+ log.info((oldVersion,newVersion))
if oldVersion and newVersion:
+ log.info("Callback ........ STATUS_UPDATE ")
self.backend.status(STATUS_UPDATE)
id = self.backend.get_package_id(name, newVersion, newFlavor)
self.backend.package(id, INFO_UPDATING, '')
elif oldVersion and not newVersion:
+ log.info("Callback ........ STATUS_REMOVE ")
self.backend.status(STATUS_REMOVE)
id = self.backend.get_package_id(name, oldVersion, oldFlavor)
self.backend.package(id, INFO_REMOVING, '')
elif not oldVersion and newVersion:
+ log.info("Callback ........ STATUS_INSTALL ")
self.backend.status(STATUS_INSTALL)
id = self.backend.get_package_id(name, newVersion, newFlavor)
self.backend.package(id, INFO_INSTALLING, '')
@@ -116,6 +133,7 @@ class UpdateCallback(callbacks.UpdateCallback):
def __init__(self, backend, cfg=None):
callbacks.UpdateCallback.__init__(self)
+ log.info("==== callback ==== ")
if cfg:
self.setTrustThreshold(cfg.trustThreshold)
diff --git a/backends/conary/conaryFilter.py b/backends/conary/conaryFilter.py
index f2b1a0b..1237987 100644
--- a/backends/conary/conaryFilter.py
+++ b/backends/conary/conaryFilter.py
@@ -17,12 +17,14 @@
# Copyright (C) 2008
# Richard Hughes <richard at hughsie.com>
+# Andres Vargas <zodman at foresightlinux.org>
# imports
from packagekit.filter import *
import re
-
+from pkConaryLog import log
+from conaryInit import conary_db
class ConaryFilter(PackagekitFilter):
def _pkg_get_unique(self, pkg):
@@ -38,3 +40,24 @@ class ConaryFilter(PackagekitFilter):
regex = re.compile(r'(:devel)')
return regex.search(pkg.name)
+ def _pkg_is_installed(self,pkg):
+ '''
+ Return if the packages are installed
+ '''
+ log.info("======= FILTER ===== " )
+ log.info(pkg)
+ troveTuple=pkg
+ db = conary_db()
+ try:
+ troveTuple = troveTuple[0], troveTuple[1], troveTuple[2]
+ localInstall = db.findTrove(None, troveTuple)
+ installed = True
+ except:
+ installed = False
+ log.info("Installed ???")
+ log.info(installed)
+ return installed
+
+
+
+
diff --git a/backends/conary/conaryInit.py b/backends/conary/conaryInit.py
new file mode 100644
index 0000000..e46f1b0
--- /dev/null
+++ b/backends/conary/conaryInit.py
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+from conary import conarycfg, conaryclient
+
+
+
+
+def init_conary_config():
+ cfg = conarycfg.ConaryConfiguration(True)
+ cfg.initializeFlavors()
+ cfg.autoResolve = True
+ cfg.keepRequired = True
+ return cfg
+
+def init_conary_client():
+ cfg = init_conary_config()
+ return conaryclient.ConaryClient(cfg)
+
+
+def conary_db():
+ client = init_conary_client()
+ return client.db
diff --git a/backends/conary/pk-backend-conary.c b/backends/conary/pk-backend-conary.c
index d09af36..2227f47 100644
--- a/backends/conary/pk-backend-conary.c
+++ b/backends/conary/pk-backend-conary.c
@@ -152,6 +152,11 @@ backend_get_update_detail (PkBackend *backend, gchar **package_ids)
/**
* backend_install_packages:
*/
+
+/*
+python conaryBackend.py update-packages "gimp;2.4.6-0.2-1;x86;/foresight.rpath.org at fl:devel//2-qa/1222042924.132:2.4.6-0.2-1,1#x86"
+
+ */
static void
backend_install_packages (PkBackend *backend, gchar **package_ids)
{
@@ -204,6 +209,13 @@ backend_refresh_cache (PkBackend *backend, gboolean force)
/**
* pk_backend_remove_packages:
*/
+
+/*
+ zodman notes:
+ python conaryBackend.py remove-packages none "pastebinit;0.7-1-1;x86;/foresight.rpath.org at fl:2-qa/1222042924.172:0.7-1-1,1#x86"
+
+
+ */
static void
backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove)
{
@@ -242,9 +254,9 @@ backend_update_packages (PkBackend *backend, gchar **package_ids)
pk_backend_finished (backend);
return;
}
-
/* send the complete list as stdin */
package_ids_temp = pk_package_ids_to_text (package_ids);
+ egg_debug("Updates Packages");
pk_backend_spawn_helper (spawn, "conaryBackend.py", "update-packages", package_ids_temp, NULL);
g_free (package_ids_temp);
}
@@ -261,6 +273,21 @@ backend_update_system (PkBackend *backend)
/**
* pk_backend_resolve:
*/
+
+/* zodman note
+
+# python conaryBackend.py resolve installed pastebinit
+allow-cancel true
+no-percentage-updates
+status info
+allow-cancel true
+no-percentage-updates
+status query
+package available pastebinit;0.7-1-1;x86;/foresight.rpath.org at fl:2-qa/1222042924.172:0.7-1-1,1#x86
+finished
+
+
+ */
static void
backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
{
@@ -272,7 +299,8 @@ backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
PK_BACKEND_OPTIONS (
"Conary", /* description */
- "Ken VanDine <ken at vandine.org>", /* author */
+ "Ken VanDine <ken at vandine.org>",
+ /* author */
backend_initialize, /* initalize */
backend_destroy, /* destroy */
backend_get_groups, /* get_groups */
diff --git a/backends/conary/pkConaryLog.py b/backends/conary/pkConaryLog.py
new file mode 100644
index 0000000..5f0b3f4
--- /dev/null
+++ b/backends/conary/pkConaryLog.py
@@ -0,0 +1,9 @@
+#!/usr/bin/python
+
+import logging as log
+import pdb
+log.basicConfig(level=log.DEBUG,
+ format='%(asctime)s %(levelname)s %(message)s\t\t\t',
+ filename='/tmp/conarybackend.log',
+ filemode='a'
+ )
commit 2682d38fbc1a89ca49e9c43228aa6f2029948738
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Nov 17 14:10:40 2008 +0000
trivial: whitespace changes
diff --git a/client/pk-monitor.c b/client/pk-monitor.c
index 662f416..58572d8 100644
--- a/client/pk-monitor.c
+++ b/client/pk-monitor.c
@@ -87,11 +87,10 @@ pk_connection_changed_cb (PkConnection *pconnection, gboolean connected, gpointe
static void
pk_monitor_locked_cb (PkControl *control, gboolean is_locked, gpointer data)
{
- if (is_locked) {
+ if (is_locked)
g_print ("locked\n");
- } else {
+ else
g_print ("unlocked\n");
- }
}
/**
@@ -118,9 +117,8 @@ main (int argc, char *argv[])
{ NULL}
};
- if (! g_thread_supported ()) {
+ if (! g_thread_supported ())
g_thread_init (NULL);
- }
dbus_g_thread_init ();
g_type_init ();
@@ -159,13 +157,14 @@ main (int argc, char *argv[])
g_signal_connect (tlist, "status-changed",
G_CALLBACK (pk_monitor_task_list_changed_cb), NULL);
+
egg_debug ("refreshing task list");
ret = pk_task_list_refresh (tlist);
- if (ret == FALSE) {
+ if (!ret)
g_error ("cannot refresh transaction list");
- }
pk_task_list_print (tlist);
+ /* spin */
g_main_loop_run (loop);
g_object_unref (control);
commit f80072ccc07a639ed1aded743d5345508aeaaaef
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Nov 17 14:10:27 2008 +0000
bugfix: if we call pk_control_transaction_list_get() after pk_control_new() we have not run the idle callback and return NULL
Ensure we have valid data before returning the data array. Fixes pkmon
diff --git a/lib/packagekit-glib/pk-control.c b/lib/packagekit-glib/pk-control.c
index d98b7d2..4952677 100644
--- a/lib/packagekit-glib/pk-control.c
+++ b/lib/packagekit-glib/pk-control.c
@@ -680,7 +680,26 @@ pk_control_transaction_list_refresh_idle_cb (PkControl *control)
const gchar **
pk_control_transaction_list_get (PkControl *control)
{
+ gboolean ret;
+ GError *error = NULL;
+
g_return_val_if_fail (PK_IS_CONTROL (control), NULL);
+
+ /* we might not have refreshed this ever */
+ if (control->priv->array == NULL) {
+ ret = pk_control_transaction_list_refresh (control, &error);
+ if (!ret) {
+ egg_warning ("failed to get list: %s", error->message);
+ g_error_free (error);
+ }
+
+ /* no need to do this twice at startup */
+ if (control->priv->idle_id != 0) {
+ g_source_remove (control->priv->idle_id);
+ control->priv->idle_id = 0;
+ }
+ }
+
return (const gchar **) control->priv->array;
}
commit a5ad710d3fbc0dd151d8658cbd98ef11a76f94fc
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Nov 17 11:57:01 2008 +0000
trivial: you can't handle the truth
diff --git a/docs/html/pk-profiles.html b/docs/html/pk-profiles.html
index 00161f3..8a8b299 100644
--- a/docs/html/pk-profiles.html
+++ b/docs/html/pk-profiles.html
@@ -85,7 +85,7 @@ Bevan has a unlimited bandwidth high speed broadband internet connection.
<td><img src="img/profile-graham.png"/></td>
<td>
<p>
-<b>Graham is a 55 year old retired policeman.</b>
+<b>Graham is a 55 year old retired painter and decorator.</b>
Graham's son has installed Linux on their new computer and moved away to university.
Graham does not know much about computers, and gets quite confused when
application icons change or if the start button is moved.
commit 205b970928602e2a0e3c5da80ba60b208e4b1c7a
Author: Adrien BUSTANY <madcat at mymadcat.com>
Date: Mon Nov 17 09:13:44 2008 +0100
QPackageKit : Behave better if PolKit is not present
diff --git a/lib/packagekit-qt/CMakeLists.txt b/lib/packagekit-qt/CMakeLists.txt
index 0379fea..50a27e4 100644
--- a/lib/packagekit-qt/CMakeLists.txt
+++ b/lib/packagekit-qt/CMakeLists.txt
@@ -7,13 +7,9 @@ set (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
find_package(Qt4 REQUIRED)
add_definitions(${QT_DEFINITIONS})
-include(FindPkgConfig)
-pkg_check_modules(POLKIT polkit-dbus)
+add_subdirectory(src)
+add_subdirectory(modules)
-if( POLKIT_FOUND)
- add_subdirectory(src)
- if(BUILD_TESTS)
- add_subdirectory(test)
- endif(BUILD_TESTS)
- add_subdirectory(modules)
-endif(POLKIT_FOUND)
+if(BUILD_TESTS)
+ add_subdirectory(test)
+endif(BUILD_TESTS)
commit af753cf53db413333205794b6043afd61fb5c493
Author: sebastian Heinlein <devel at glatzor.de>
Date: Sun Nov 16 07:44:22 2008 +0100
Python client: Trivial fix of the previous commit
diff --git a/lib/python/packagekit/client.py b/lib/python/packagekit/client.py
index 428457c..d6af446 100644
--- a/lib/python/packagekit/client.py
+++ b/lib/python/packagekit/client.py
@@ -52,7 +52,7 @@ class PackageKitError(Exception):
self.details = details
def __str__(self):
- return "%s: %s" % (self.error, self.desc)
+ return "%s: %s" % (self.code, self.details)
class PackageKitTransaction:
'''
@@ -132,7 +132,7 @@ class PackageKitTransaction:
def _on_error(self, code, details):
'''Callback for ErrorCode signal'''
- self._error_code = enum
+ self._error_code = code
self._error_details = details
def _on_finished(self, exit, runtime):
commit 75a406f6117e5b0873b0cd7f5596c57fc4206655
Author: sebastian Heinlein <devel at glatzor.de>
Date: Sun Nov 16 07:35:15 2008 +0100
Python client: use error naming of the ErrorCode signal
diff --git a/lib/python/packagekit/client.py b/lib/python/packagekit/client.py
index 51fa676..428457c 100644
--- a/lib/python/packagekit/client.py
+++ b/lib/python/packagekit/client.py
@@ -47,9 +47,9 @@ class PackageKitError(Exception):
http://www.packagekit.org/pk-reference.html#introduction-errors for details
and possible values.
'''
- def __init__(self, error, desc=None):
- self.error = error
- self.desc = desc
+ def __init__(self, code, details=None):
+ self.code = code
+ self.details = details
def __str__(self):
return "%s: %s" % (self.error, self.desc)
@@ -61,8 +61,8 @@ class PackageKitTransaction:
'''
def __init__(self, tid, iface):
self.tid = tid
- self._error_enum = None
- self._error_desc = None
+ self._error_code = None
+ self._error_details = None
self._exit_status = None
self._allow_cancel = False
self._method = None
@@ -130,10 +130,10 @@ class PackageKitTransaction:
'''Callback for AllowCancel signal'''
self._allow_cancel = allow
- def _on_error(self, enum, desc):
+ def _on_error(self, code, details):
'''Callback for ErrorCode signal'''
- self._error_enum = enum
- self._error_desc = desc
+ self._error_code = enum
+ self._error_details = details
def _on_finished(self, exit, runtime):
'''Callback for Finished signal'''
@@ -156,8 +156,8 @@ class PackageKitTransaction:
polkit_auth_wrapper(self._method, *self._args)
if not self._exit_handler:
self._main_loop.run()
- if self._error_enum:
- raise PackageKitError(self._error_enum, self._error_desc)
+ if self._error_code:
+ raise PackageKitError(self._error_code, self._error_details)
return self.result
def set_locale(self, code):
@@ -191,8 +191,8 @@ class PackageKitTransaction:
def get_error(self):
'''Returns the PackageKitError of a failed transaction'''
- if self._error_enum:
- return PackageKitError(self._error_enum, self._error_desc)
+ if self._error_code:
+ return PackageKitError(self._error_code, self._error_details)
else:
return None
@@ -432,7 +432,7 @@ class PackageKitClient:
'org.freedesktop.PackageKit.Transaction')
trans = PackageKitTransaction(tid, iface)
if self._locale:
- trans.SetLocale(self._locale)
+ trans.set_locale(self._locale)
trans.set_method(method_name, *args)
if exit_handler:
trans._exit_handler = exit_handler
commit 398884887b637c1809cba766daa9404702b6e1b2
Author: Piotr DrÄ
g <piotrdrag at gmail.com>
Date: Sat Nov 15 23:19:46 2008 +0000
Updated Polish translation
Transmitted-via: Transifex (translate.fedoraproject.org)
diff --git a/po/pl.po b/po/pl.po
index 5caf9bd..b223b75 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -5,8 +5,8 @@ msgid ""
msgstr ""
"Project-Id-Version: pl\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-10-26 22:46+0100\n"
-"PO-Revision-Date: 2008-10-26 22:47+0100\n"
+"POT-Creation-Date: 2008-11-16 00:10+0100\n"
+"PO-Revision-Date: 2008-11-16 00:11+0100\n"
"Last-Translator: Piotr DrÄ
g <piotrdrag at gmail.com>\n"
"Language-Team: Polish <pl at li.org>\n"
"MIME-Version: 1.0\n"
@@ -45,8 +45,8 @@ msgstr "Nie można zainstalowaÄ pakietu \"%s\": %s"
#. TRANSLATORS: There was a programming error that shouldn't happen. The detailed error follows
#: ../client/pk-console.c:613 ../client/pk-console.c:640
#: ../client/pk-console.c:736 ../client/pk-console.c:853
-#: ../client/pk-tools-common.c:55 ../client/pk-tools-common.c:74
-#: ../client/pk-tools-common.c:81
+#: ../client/pk-tools-common.c:61 ../client/pk-tools-common.c:79
+#: ../client/pk-tools-common.c:86
#, c-format
msgid "Internal error: %s"
msgstr "WewnÄtrzny bÅÄ
d: %s"
@@ -221,7 +221,7 @@ msgstr "Interfejs konsoli PackageKit"
msgid "Subcommands:"
msgstr "Podpolecenia:"
-#: ../client/pk-console.c:1404 ../client/pk-generate-pack.c:182
+#: ../client/pk-console.c:1404 ../client/pk-generate-pack.c:183
#: ../client/pk-monitor.c:115 ../src/pk-main.c:196
msgid "Show extra debugging information"
msgstr "WyÅwietla dodatkowe informacje o debugowaniu"
@@ -243,181 +243,186 @@ msgstr "WyÅÄ
cza bez oczekiwania na zakoÅczenie dziaÅaÅ"
msgid "This tool could not connect to system DBUS."
msgstr "To narzÄdzie nie może poÅÄ
czyÄ siÄ z systemowym D-Bus."
-#: ../client/pk-console.c:1527
+#. TRANSLATORS: The user specified an incorrect filter
+#: ../client/pk-console.c:1517
+msgid "The filter specified was invalid"
+msgstr "Podany filtr jest nieprawidÅowy"
+
+#: ../client/pk-console.c:1534
msgid "You need to specify a search type, e.g. name"
msgstr "Należy podaÄ typ wyszukiwania, np. po nazwie"
-#: ../client/pk-console.c:1532 ../client/pk-console.c:1539
-#: ../client/pk-console.c:1546 ../client/pk-console.c:1553
-#: ../client/pk-console.c:1664 ../client/pk-console.c:1674
-#: ../client/pk-console.c:1681 ../client/pk-console.c:1688
+#: ../client/pk-console.c:1539 ../client/pk-console.c:1546
+#: ../client/pk-console.c:1553 ../client/pk-console.c:1560
+#: ../client/pk-console.c:1671 ../client/pk-console.c:1681
+#: ../client/pk-console.c:1688 ../client/pk-console.c:1695
msgid "You need to specify a search term"
msgstr "Należy podaÄ termin wyszukiwania"
-#: ../client/pk-console.c:1558
+#: ../client/pk-console.c:1565
msgid "Invalid search type"
msgstr "NieprawidÅowy typ wyszukiwania"
-#: ../client/pk-console.c:1563
+#: ../client/pk-console.c:1570
msgid "You need to specify a package or file to install"
msgstr "Należy podaÄ pakiet lub plik do zainstalowania"
-#: ../client/pk-console.c:1570
+#: ../client/pk-console.c:1577
msgid "You need to specify a type, key_id and package_id"
msgstr "Należy podaÄ typ, key_id i package_id"
-#: ../client/pk-console.c:1577
+#: ../client/pk-console.c:1584
msgid "You need to specify a package to remove"
msgstr "Należy podaÄ pakiet do usuniÄcia"
-#: ../client/pk-console.c:1583
+#: ../client/pk-console.c:1590
msgid ""
"You need to specify the destination directory and then the packages to "
"download"
msgstr "Należy podaÄ katalog docelowy, a nastÄpnie pakiety do pobrania"
-#: ../client/pk-console.c:1588
+#: ../client/pk-console.c:1595
msgid "Directory not found"
msgstr "Nie znaleziono katalogu"
-#: ../client/pk-console.c:1594
+#: ../client/pk-console.c:1601
msgid "You need to specify a licence identifier (eula-id)"
msgstr "Należy podaÄ identyfikator licencji (eula-id)"
-#: ../client/pk-console.c:1610
+#: ../client/pk-console.c:1617
msgid "You need to specify a package name to resolve"
msgstr "Należy podaÄ nazwÄ pakietu do rozwiÄ
zania"
-#: ../client/pk-console.c:1619 ../client/pk-console.c:1626
+#: ../client/pk-console.c:1626 ../client/pk-console.c:1633
msgid "You need to specify a repository name"
msgstr "Należy podaÄ nazwÄ repozytorium"
-#: ../client/pk-console.c:1633
+#: ../client/pk-console.c:1640
msgid "You need to specify a repo name/parameter and value"
msgstr "Należy podaÄ nazwÄ/parametr repozytorium i wartoÅÄ"
-#: ../client/pk-console.c:1646
+#: ../client/pk-console.c:1653
msgid "You need to specify an action, e.g. 'update-system'"
msgstr "Należy podaÄ dziaÅanie, np. \"update-system\""
-#: ../client/pk-console.c:1651
+#: ../client/pk-console.c:1658
msgid "You need to specify a correct role"
msgstr "Należy podaÄ poprawnÄ
rolÄ"
-#: ../client/pk-console.c:1656
+#: ../client/pk-console.c:1663
msgid "Failed to get last time"
msgstr "Uzyskanie ostatniego czasu nie powiodÅo siÄ"
-#: ../client/pk-console.c:1695
+#: ../client/pk-console.c:1702
msgid "You need to specify a package to find the details for"
msgstr "Należy podaÄ pakiet do znalezienia szczegóÅów dla"
-#: ../client/pk-console.c:1702
+#: ../client/pk-console.c:1709
msgid "You need to specify a package to find the files for"
msgstr "Należy podaÄ pakiet do znalezienia plików dla"
#. TRANSLATORS: The user tried to use an unsupported option on the command line
-#: ../client/pk-console.c:1755
+#: ../client/pk-console.c:1762
#, c-format
msgid "Option '%s' is not supported"
msgstr "Opcja \"%s\" nie jest obsÅugiwana"
#. TRANSLATORS: User does not have permission to do this
-#: ../client/pk-console.c:1768
+#: ../client/pk-console.c:1775
msgid "You don't have the necessary privileges for this operation"
msgstr "Nie posiadasz niezbÄdnych uprawnieÅ dla tej operacji"
#. TRANSLATORS: Generic failure of what they asked to do
-#: ../client/pk-console.c:1771
+#: ../client/pk-console.c:1778
msgid "Command failed"
msgstr "Polecenie nie powiodÅo siÄ"
#. TRANSLATORS: This is the state of the transaction
-#: ../client/pk-generate-pack.c:98
+#: ../client/pk-generate-pack.c:99
msgid "Downloading"
msgstr "Pobieranie"
#. TRANSLATORS: This is when the main packages are being downloaded
-#: ../client/pk-generate-pack.c:118
+#: ../client/pk-generate-pack.c:119
msgid "Downloading packages"
msgstr "Pobieranie pakietów"
#. TRANSLATORS: This is when the dependency packages are being downloaded
-#: ../client/pk-generate-pack.c:123
+#: ../client/pk-generate-pack.c:124
msgid "Downloading dependencies"
msgstr "Pobieranie zależnoÅci"
-#: ../client/pk-generate-pack.c:184
+#: ../client/pk-generate-pack.c:185
msgid "Set the file name of dependencies to be excluded"
msgstr "ProszÄ ustawiÄ nazwy plików zależnoÅci do wykluczenia"
-#: ../client/pk-generate-pack.c:186
+#: ../client/pk-generate-pack.c:187
msgid "The output directory (the current directory is used if ommitted)"
msgstr ""
"Katalog wyjÅcia (użyty zostanie bieżÄ
cy katalog, jeÅli zostanie pominiÄty)"
-#: ../client/pk-generate-pack.c:188
+#: ../client/pk-generate-pack.c:189
msgid "The package to be put into the service pack"
msgstr "Pakiet do umieszczenia w pakiecie serwisowym"
-#: ../client/pk-generate-pack.c:190
+#: ../client/pk-generate-pack.c:191
msgid "Put all updates available in the service pack"
msgstr "Wszystkie dostÄpne aktualizacje w pakiecie serwisowym"
#. TRANSLATORS: This is when the user fails to supply the correct arguments
-#: ../client/pk-generate-pack.c:213
+#: ../client/pk-generate-pack.c:214
msgid "Neither --package or --updates option selected."
msgstr "Nie wybrano żadnej z opcji --package lub --updates."
#. TRANSLATORS: This is when the user fails to supply just one argument
-#: ../client/pk-generate-pack.c:221
+#: ../client/pk-generate-pack.c:222
msgid "Both options selected."
msgstr "Wybrano obie opcje."
#. TRANSLATORS: This is when file already exists
-#: ../client/pk-generate-pack.c:254
+#: ../client/pk-generate-pack.c:255
msgid "A pack with the same name already exists, do you want to overwrite it?"
msgstr "Pakiet serwisowy o tej samej nazwie już istnieje, zastÄ
piÄ go?"
#. TRANSLATORS: This is when the pack was not overwritten
-#: ../client/pk-generate-pack.c:257
+#: ../client/pk-generate-pack.c:258
msgid "The pack was not overwritten."
msgstr "Pakiet nie zostaÅ zastÄ
piony."
#. TRANSLATORS: This is when the temporary directory cannot be created, the directory name follows
-#: ../client/pk-generate-pack.c:269
+#: ../client/pk-generate-pack.c:270
msgid "Failed to create directory:"
msgstr "Utworzenie katalogu nie powiodÅo siÄ:"
#. TRANSLATORS: This is when the list of packages from the remote computer cannot be opened
-#: ../client/pk-generate-pack.c:278
+#: ../client/pk-generate-pack.c:279
msgid "Failed to open package list."
msgstr "Otwarcie listy pakietów nie powiodÅo siÄ."
#. TRANSLATORS: The package name is being matched up to available packages
-#: ../client/pk-generate-pack.c:288
+#: ../client/pk-generate-pack.c:289
msgid "Finding package name."
msgstr "Wyszukiwanie nazwy pakietu."
#. TRANSLATORS: This is when the package cannot be found in any software source. The detailed error follows
-#: ../client/pk-generate-pack.c:292
+#: ../client/pk-generate-pack.c:293
#, c-format
msgid "Failed to find package '%s': %s"
msgstr "Nie można znaleÅºÄ pakietu \"%s\": %s"
#. TRANSLATORS: This is telling the user we are in the process of making the pack
-#: ../client/pk-generate-pack.c:308
+#: ../client/pk-generate-pack.c:309
msgid "Creating service pack..."
msgstr "Tworzenie pakietu serwisowego..."
#. TRANSLATORS: we succeeded in making the file
-#: ../client/pk-generate-pack.c:315
+#: ../client/pk-generate-pack.c:316
#, c-format
msgid "Service pack created '%s'"
msgstr "Utworzono pakiet serwisowy \"%s\""
#. TRANSLATORS: we failed to make te file
-#: ../client/pk-generate-pack.c:319
+#: ../client/pk-generate-pack.c:320
#, c-format
msgid "Failed to create '%s': %s"
msgstr "Utworzenie \"%s\" nie powiodÅo siÄ: %s"
@@ -427,76 +432,76 @@ msgid "PackageKit Monitor"
msgstr "Monitor PackageKit"
#. TRANSLATORS: The package was not found in any software sources
-#: ../client/pk-tools-common.c:108
+#: ../client/pk-tools-common.c:114
#, c-format
msgid "The package could not be found"
msgstr "Nie można znaleÅºÄ pakietu"
#. TRANSLATORS: more than one package could be found that matched, to follow is a list of possible packages
-#: ../client/pk-tools-common.c:119
+#: ../client/pk-tools-common.c:125
msgid "More than one package matches:"
msgstr "Pasuje wiÄcej niż jeden pakiet:"
#. TRANSLATORS: This finds out which package in the list to use
-#: ../client/pk-tools-common.c:126
+#: ../client/pk-tools-common.c:132
msgid "Please choose the correct package: "
msgstr "ProszÄ wybraÄ poprawny pakiet: "
-#: ../client/pk-tools-common.c:152
+#: ../client/pk-tools-common.c:158
#, c-format
msgid "Please enter a number from 1 to %i: "
msgstr "ProszÄ podaÄ numer od 1 do %i: "
#. TRANSLATORS: when we are getting data from the daemon
-#: ../contrib/packagekit-plugin/src/contents.cpp:299
+#: ../contrib/packagekit-plugin/src/contents.cpp:291
msgid "Getting package information..."
msgstr "Uzyskiwanie informacji o pakiecie..."
#. TRANSLATORS: run an applicaiton
-#: ../contrib/packagekit-plugin/src/contents.cpp:305
+#: ../contrib/packagekit-plugin/src/contents.cpp:297
#, c-format
msgid "Run %s"
msgstr "Uruchom %s"
#. TRANSLATORS: show the installed version of a package
-#: ../contrib/packagekit-plugin/src/contents.cpp:311
+#: ../contrib/packagekit-plugin/src/contents.cpp:303
msgid "Installed version"
msgstr "Zainstalowana wersja"
#. TRANSLATORS: run the application now
-#: ../contrib/packagekit-plugin/src/contents.cpp:319
+#: ../contrib/packagekit-plugin/src/contents.cpp:311
#, c-format
msgid "Run version %s now"
msgstr "Uruchom wersjÄ %s"
-#: ../contrib/packagekit-plugin/src/contents.cpp:325
+#: ../contrib/packagekit-plugin/src/contents.cpp:317
msgid "Run now"
msgstr "Uruchom teraz"
#. TRANSLATORS: update to a new version of the package
-#: ../contrib/packagekit-plugin/src/contents.cpp:330
+#: ../contrib/packagekit-plugin/src/contents.cpp:323
#, c-format
msgid "Update to version %s"
msgstr "Zaktualizuj do wersji %s"
#. TRANSLATORS: To install a package
-#: ../contrib/packagekit-plugin/src/contents.cpp:336
+#: ../contrib/packagekit-plugin/src/contents.cpp:329
#, c-format
msgid "Install %s now"
msgstr "Zainstaluj %s"
#. TRANSLATORS: the version of the package
-#: ../contrib/packagekit-plugin/src/contents.cpp:339
+#: ../contrib/packagekit-plugin/src/contents.cpp:332
msgid "Version"
msgstr "Wersja"
#. TRANSLATORS: noting found, so can't install
-#: ../contrib/packagekit-plugin/src/contents.cpp:344
+#: ../contrib/packagekit-plugin/src/contents.cpp:337
msgid "No packages found for your system"
msgstr "Nie znaleziono pakietów dla systemu"
#. TRANSLATORS: package is being installed
-#: ../contrib/packagekit-plugin/src/contents.cpp:349
+#: ../contrib/packagekit-plugin/src/contents.cpp:342
msgid "Installing..."
msgstr "Instalowanie..."
commit c44167eb0a2ba247f9a8b8cb19802f217a3a864a
Author: Richard Hughes <richard at hughsie.com>
Date: Sat Nov 15 12:09:31 2008 +0000
feature: add three commands to pkcon: list-create, list-diff and list-install
diff --git a/client/pk-console.c b/client/pk-console.c
index 4edb135..e393ba2 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -1023,6 +1023,244 @@ pk_console_get_files (PkClient *client, const gchar *package, GError **error)
}
/**
+ * pk_console_list_create:
+ **/
+static gboolean
+pk_console_list_create (PkClient *client, const gchar *file, GError **error)
+{
+ gboolean ret;
+ GError *error_local = NULL;
+ PkPackageList *list;
+
+ /* file exists */
+ ret = g_file_test (file, G_FILE_TEST_EXISTS);
+ if (ret) {
+ /* TRANSLATORS: There was an error getting the list of packages. The filename follows */
+ *error = g_error_new (1, 0, _("File already exists: %s"), file);
+ return FALSE;
+ }
+
+ /* TRANSLATORS: follows a list of packages to install */
+ g_print ("%s...\n", _("Getting package list"));
+
+ /* get all installed packages and save it to disk */
+ ret = pk_client_get_packages (client_task, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), &error_local);
+ if (!ret) {
+ /* TRANSLATORS: There was an error getting the list of packages. The detailed error follows */
+ *error = g_error_new (1, 0, _("This tool could not get package list: %s"), error_local->message);
+ g_error_free (error_local);
+ return FALSE;
+ }
+
+ /* save list to disk */
+ list = pk_client_get_package_list (client_task);
+ ret = pk_obj_list_to_file (PK_OBJ_LIST(list), file);
+ g_object_unref (list);
+ if (!ret) {
+ /* TRANSLATORS: There was an error saving the list */
+ *error = g_error_new (1, 0, _("Failed to save to disk"));
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
+ * pk_console_package_obj_name_equal:
+ **/
+static gboolean
+pk_console_package_obj_name_equal (const PkPackageObj *obj1, const PkPackageObj *obj2)
+{
+ return (g_strcmp0 (obj1->id->name, obj2->id->name) == 0);
+}
+
+/**
+ * pk_console_list_diff:
+ **/
+static gboolean
+pk_console_list_diff (PkClient *client, const gchar *file, GError **error)
+{
+ gboolean ret;
+ GError *error_local = NULL;
+ PkPackageList *list;
+ PkPackageList *list_copy;
+ PkPackageList *new;
+ const PkPackageObj *obj;
+ guint i;
+ guint length;
+
+ /* file exists */
+ ret = g_file_test (file, G_FILE_TEST_EXISTS);
+ if (!ret) {
+ /* TRANSLATORS: There was an error getting the list. The filename follows */
+ *error = g_error_new (1, 0, _("File does not exist: %s"), file);
+ return FALSE;
+ }
+
+ /* TRANSLATORS: follows a list of packages to install */
+ g_print ("%s...\n", _("Getting package list"));
+
+ /* get all installed packages */
+ ret = pk_client_get_packages (client_task, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), &error_local);
+ if (!ret) {
+ /* TRANSLATORS: There was an error getting the list of packages. The detailed error follows */
+ *error = g_error_new (1, 0, _("This tool could not get package list: %s"), error_local->message);
+ g_error_free (error_local);
+ return FALSE;
+ }
+
+ /* get two copies of the list */
+ list = pk_client_get_package_list (client_task);
+ list_copy = pk_package_list_new ();
+ pk_obj_list_add_list (PK_OBJ_LIST(list_copy), PK_OBJ_LIST(list));
+
+ /* get installed copy */
+ new = pk_package_list_new ();
+ pk_obj_list_from_file (PK_OBJ_LIST(new), file);
+
+ /* only compare the name */
+ pk_obj_list_set_equal (PK_OBJ_LIST(list), (PkObjListCompareFunc) pk_console_package_obj_name_equal);
+ pk_obj_list_set_equal (PK_OBJ_LIST(new), (PkObjListCompareFunc) pk_console_package_obj_name_equal);
+ pk_obj_list_remove_list (PK_OBJ_LIST(list), PK_OBJ_LIST(new));
+ pk_obj_list_remove_list (PK_OBJ_LIST(new), PK_OBJ_LIST(list_copy));
+
+ /* TRANSLATORS: header to a list of packages newly added */
+ g_print ("%s:\n", _("Packages to add"));
+ length = PK_OBJ_LIST(list)->len;
+ for (i=0; i<length; i++) {
+ obj = pk_package_list_get_obj (list, i);
+ g_print ("%i\t%s\n", i+1, obj->id->name);
+ }
+
+ /* TRANSLATORS: header to a list of packages removed */
+ g_print ("%s:\n", _("Packages to remove"));
+ length = PK_OBJ_LIST(new)->len;
+ for (i=0; i<length; i++) {
+ obj = pk_package_list_get_obj (new, i);
+ g_print ("%i\t%s\n", i+1, obj->id->name);
+ }
+
+ g_object_unref (list);
+ g_object_unref (list_copy);
+ g_object_unref (new);
+ return TRUE;
+}
+
+/**
+ * pk_console_list_install:
+ **/
+static gboolean
+pk_console_list_install (PkClient *client, const gchar *file, GError **error)
+{
+ gboolean ret = FALSE;
+ GError *error_local = NULL;
+ PkPackageList *list;
+ PkPackageList *new;
+ PkBitfield filters;
+ const PkPackageObj *obj;
+ guint i;
+ guint length;
+ gchar *package_id;
+ gchar **package_ids = NULL;
+ GPtrArray *array;
+
+ /* file exists */
+ ret = g_file_test (file, G_FILE_TEST_EXISTS);
+ if (!ret) {
+ /* TRANSLATORS: There was an error getting the list. The filename follows */
+ *error = g_error_new (1, 0, _("File does not exist: %s"), file);
+ return FALSE;
+ }
+
+ /* TRANSLATORS: follows a list of packages to install */
+ g_print ("%s...\n", _("Getting package list"));
+
+ /* get all installed packages */
+ ret = pk_client_get_packages (client_task, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), &error_local);
+ if (!ret) {
+ /* TRANSLATORS: There was an error getting the list of packages. The detailed error follows */
+ *error = g_error_new (1, 0, _("This tool could not get package list: %s"), error_local->message);
+ g_error_free (error_local);
+ return FALSE;
+ }
+
+ /* get two copies of the list */
+ list = pk_client_get_package_list (client_task);
+
+ /* get installed copy */
+ new = pk_package_list_new ();
+ pk_obj_list_from_file (PK_OBJ_LIST(new), file);
+
+ /* only compare the name */
+ pk_obj_list_set_equal (PK_OBJ_LIST(new), (PkObjListCompareFunc) pk_console_package_obj_name_equal);
+ pk_obj_list_remove_list (PK_OBJ_LIST(new), PK_OBJ_LIST(list));
+ array = g_ptr_array_new ();
+
+
+ /* nothing to do */
+ length = PK_OBJ_LIST(new)->len;
+ if (length == 0) {
+ /* TRANSLATORS: We didn't find any differences */
+ *error = g_error_new (1, 0, _("No new packages need to be installed"));
+ ret = FALSE;
+ goto out;
+ }
+
+ /* TRANSLATORS: follows a list of packages to install */
+ g_print ("%s:\n", _("To install"));
+ for (i=0; i<length; i++) {
+ obj = pk_package_list_get_obj (new, i);
+ g_print ("%i\t%s\n", i+1, obj->id->name);
+ }
+
+ /* resolve */
+ filters = pk_bitfield_from_enums (PK_FILTER_ENUM_NOT_INSTALLED, PK_FILTER_ENUM_NEWEST, -1);
+ for (i=0; i<length; i++) {
+ obj = pk_package_list_get_obj (new, i);
+ /* TRANSLATORS: searching takes some time.... */
+ g_print ("%.0f%%\t%s '%s'...", (100.0f/length)*i, _("Searching for package: "), obj->id->name);
+ package_id = pk_console_perhaps_resolve (client, filters, obj->id->name, &error_local);
+ if (package_id == NULL) {
+ /* TRANSLATORS: package was not found -- this is the end of a string ended in ... */
+ g_print (" %s\n", _("not found."));
+ } else {
+ g_print (" %s\n", package_id);
+ g_ptr_array_add (array, package_id);
+ /* no need to free */
+ }
+ }
+
+ /* nothing to do */
+ if (array->len == 0) {
+ /* TRANSLATORS: We didn't find any packages to install */
+ *error = g_error_new (1, 0, _("No packages can be found to install"));
+ ret = FALSE;
+ goto out;
+ }
+
+ /* TRANSLATORS: installing new packages from package list */
+ g_print ("%s...\n", _("Installing packages"));
+
+ /* install packages */
+ package_ids = pk_package_ids_from_array (array);
+ ret = pk_client_install_packages (client, package_ids, &error_local);
+ if (!ret) {
+ /* TRANSLATORS: There was an error installing the packages. The detailed error follows */
+ *error = g_error_new (1, 0, _("This tool could not install the packages: %s"), error_local->message);
+ g_error_free (error_local);
+ goto out;
+ }
+
+out:
+ g_ptr_array_foreach (array, (GFunc) g_free, NULL);
+ g_ptr_array_free (array, TRUE);
+ g_strfreev (package_ids);
+
+ g_object_unref (list);
+ g_object_unref (new);
+ return ret;
+}
+
+/**
* pk_console_get_update_detail
**/
static gboolean
@@ -1711,6 +1949,29 @@ main (int argc, char *argv[])
}
ret = pk_console_get_files (client_async, value, &error);
+ } else if (strcmp (mode, "list-create") == 0) {
+ if (value == NULL) {
+ error = g_error_new (1, 0, "%s", _("You need to specify a list file to create"));
+ goto out;
+ }
+ ret = pk_console_list_create (client_async, value, &error);
+ maybe_sync = FALSE;
+
+ } else if (strcmp (mode, "list-diff") == 0) {
+ if (value == NULL) {
+ error = g_error_new (1, 0, "%s", _("You need to specify a list file to open"));
+ goto out;
+ }
+ ret = pk_console_list_diff (client_async, value, &error);
+ maybe_sync = FALSE;
+
+ } else if (strcmp (mode, "list-install") == 0) {
+ if (value == NULL) {
+ error = g_error_new (1, 0, "%s", _("You need to specify a list file to open"));
+ goto out;
+ }
+ ret = pk_console_list_install (client_async, value, &error);
+
} else if (strcmp (mode, "get-updates") == 0) {
ret = pk_client_get_updates (client_async, filters, &error);
diff --git a/contrib/pk-completion.bash b/contrib/pk-completion.bash
index c2ec252..732f7eb 100755
--- a/contrib/pk-completion.bash
+++ b/contrib/pk-completion.bash
@@ -33,6 +33,9 @@ __pkcon_commandlist="
get-update-detail
get-updates
get-categories
+ list-create
+ list-diff
+ list-install
install
refresh
remove
commit 2dd58043aa1d4421de5bcca9dde59fb84167983a
Author: Richard Hughes <richard at hughsie.com>
Date: Sat Nov 15 12:07:20 2008 +0000
bugfix: fix a segfault in the error path when files could not be installed with pkcon
diff --git a/client/pk-console.c b/client/pk-console.c
index 6424cdf..4edb135 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -615,7 +615,7 @@ pk_console_install_stuff (PkClient *client, gchar **packages, GError **error)
goto out;
}
- ret = pk_client_install_packages (client, package_ids, error);
+ ret = pk_client_install_packages (client, package_ids, &error_local);
if (!ret) {
/* TRANSLATORS: There was an error installing the packages. The detailed error follows */
*error = g_error_new (1, 0, _("This tool could not install the packages: %s"), error_local->message);
commit a0cbe3d20b8a7a8ed92502f23f09cf0530c9d05e
Author: Richard Hughes <richard at hughsie.com>
Date: Sat Nov 15 12:06:09 2008 +0000
trivial: whitespace fix
diff --git a/lib/packagekit-glib/pk-client.h b/lib/packagekit-glib/pk-client.h
index f14eb3a..0eda682 100644
--- a/lib/packagekit-glib/pk-client.h
+++ b/lib/packagekit-glib/pk-client.h
@@ -240,7 +240,7 @@ gboolean pk_client_get_depends (PkClient *client,
GError **error)
G_GNUC_WARN_UNUSED_RESULT;
gboolean pk_client_get_packages (PkClient *client,
- PkBitfield filters,
+ PkBitfield filters,
GError **error)
G_GNUC_WARN_UNUSED_RESULT;
gboolean pk_client_get_update_detail (PkClient *client,
@@ -248,7 +248,7 @@ gboolean pk_client_get_update_detail (PkClient *client,
GError **error)
G_GNUC_WARN_UNUSED_RESULT;
gboolean pk_client_get_requires (PkClient *client,
- PkBitfield filters,
+ PkBitfield filters,
gchar **package_ids,
gboolean recursive,
GError **error)
More information about the PackageKit-commit
mailing list