[packagekit] packagekit: Branch 'master' - 3 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Wed Oct 3 13:19:20 PDT 2007
backends/alpm/pk-backend-alpm.c | 4 -
backends/conary/helpers/conaryBackend.py | 4 -
backends/yum/helpers/yumBackend.py | 100 +++++++++++++++----------------
libgbus/libgbus.c | 2
libpackagekit/pk-client.c | 4 -
python/packagekit/backend.py | 14 ++--
python/packagekit/frontend.py | 20 +++---
python/pk-frontend-test.py | 6 -
src/pk-backend.c | 4 -
src/pk-conf.c | 2
10 files changed, 81 insertions(+), 79 deletions(-)
New commits:
diff-tree 69f98f3f1547fd3a263635cc4d2c4ac469097d6e (from dfd41d020f0bd187d1c972b42d272048353d0881)
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Oct 3 21:18:57 2007 +0100
remove trailing backspace in all the files
diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index f3ad228..57c21ed 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -544,9 +544,9 @@ backend_remove_package (PkBackend *backe
pk_package_id_free (id);
return;
}
- else if (alpm_list_count (result) != 1 ||
+ else if (alpm_list_count (result) != 1 ||
strcmp (alpm_pkg_get_name(((PackageSource *)result->data)->pkg), id->name) != 0)
- {
+ {
pk_backend_error_code (backend,
PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED,
"Package is not installed");
diff --git a/backends/conary/helpers/conaryBackend.py b/backends/conary/helpers/conaryBackend.py
index 07ddfae..98914ca 100644
--- a/backends/conary/helpers/conaryBackend.py
+++ b/backends/conary/helpers/conaryBackend.py
@@ -236,7 +236,7 @@ class PackageKitConaryBackend(PackageKit
'''
name, version, flavor, installed = self._findPackage(id)
-
+
if name:
shortDesc = self._get_metadata(id, 'shortDesc') or name
@@ -379,7 +379,7 @@ class Cache(object):
self.db = conaryclient.ConaryClient(self.cfg).db
troves = queryrep.getTrovesToDisplay(self.repos, None, None, None,
- queryrep.VERSION_FILTER_LEAVES, queryrep.FLAVOR_FILTER_BEST,
+ queryrep.VERSION_FILTER_LEAVES, queryrep.FLAVOR_FILTER_BEST,
self.cfg.installLabelPath, self.cfg.flavor, None)
packages = []
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 257f19a..80c99f3 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -34,7 +34,7 @@ from yum.callbacks import *
class PackageKitYumBackend(PackageKitBaseBackend):
- # Packages there require a reboot
+ # Packages there require a reboot
rebootpkgs = ("kernel", "kernel-smp", "kernel-xen-hypervisor", "kernel-PAE",
"kernel-xen0", "kernel-xenU", "kernel-xen", "kernel-xen-guest",
"glibc", "hal", "dbus", "xen")
@@ -44,13 +44,13 @@ class PackageKitYumBackend(PackageKitBas
PackageKitBaseBackend.__init__(self,args)
self.yumbase = yum.YumBase()
- def _get_package_ver(self,po):
+ def _get_package_ver(self,po):
''' return the a ver as epoch:version-release or version-release, if epoch=0'''
if po.epoch != '0':
ver = "%s:%s-%s" % (po.epoch,po.version,po.release)
else:
ver = "%s-%s" % (po.version,po.release)
- return ver
+ return ver
def _do_search(self,searchlist,filters,key):
'''
@@ -74,11 +74,11 @@ class PackageKitYumBackend(PackageKitBas
installed = INFO_INSTALLED
else:
installed = INFO_AVAILABLE
-
+
if self._do_filtering(pkg,fltlist,installed):
self._show_package(pkg, installed)
-
+
def _do_filtering(self,pkg,filterList,installed):
''' Filter the package, based on the filter in filterList '''
@@ -98,10 +98,10 @@ class PackageKitYumBackend(PackageKitBas
return self._do_extra_filtering(pkg,filterList)
else:
return do_print
-
+
def _do_extra_filtering(self,pkg,filterList):
''' do extra filtering (gui,devel etc) '''
-
+
for flt in filterList:
if flt == 'installed' or flt =='~installed':
continue
@@ -112,7 +112,7 @@ class PackageKitYumBackend(PackageKitBas
if not self._do_devel_filtering(flt,pkg):
return False
return True
-
+
def _do_gui_filtering(self,flt,pkg):
isGUI = False
if flt == 'gui':
@@ -142,7 +142,7 @@ class PackageKitYumBackend(PackageKitBas
#
#
return isDevel == wantDevel
-
+
def search_name(self,filters,key):
'''
@@ -170,7 +170,7 @@ class PackageKitYumBackend(PackageKitBas
'''
self._setup_yum()
#self.yumbase.conf.cache = 1 # Only look in cache.
- fltlist = filters.split(';')
+ fltlist = filters.split(';')
found = {}
if not '~installed' in fltlist:
# Check installed for file
@@ -181,7 +181,7 @@ class PackageKitYumBackend(PackageKitBas
self._show_package(pkg, INFO_INSTALLED)
found[str(pkg)] = 1
if not 'installed' in fltlist:
- # Check available for file
+ # Check available for file
self.yumbase.repos.populateSack(mdtype='filelists')
for pkg in self.yumbase.pkgSack:
filelist = pkg.filelist
@@ -189,8 +189,8 @@ class PackageKitYumBackend(PackageKitBas
if key in fn and not found.has_key(str(pkg)):
self._show_package(pkg, INFO_AVAILABLE)
found[str(pkg)] = 1
-
-
+
+
def _getEVR(self,idver):
'''
get the e,v,r from the package id version
@@ -203,7 +203,7 @@ class PackageKitYumBackend(PackageKitBas
epoch = '0'
(version,release) = tuple(idver.split('-'))
return epoch,version,release
-
+
def _findPackage(self,id):
'''
find a package based on a packahe id (name;version;arch;repoid)
@@ -224,14 +224,14 @@ class PackageKitYumBackend(PackageKitBas
return pkgs[0],False
else:
return None,False
-
+
def get_requires(self,package):
'''
Print a list of requires for a given package
'''
self.error(ERROR_NOT_SUPPORTED,"This function is not implemented in this backend")
-
+
def get_depends(self,package):
'''
@@ -252,13 +252,13 @@ class PackageKitYumBackend(PackageKitBas
for pkg in results.values():
if pkg.name != name:
- pkgver = self._get_package_ver(pkg)
+ pkgver = self._get_package_ver(pkg)
id = self.get_package_id(pkg.name, pkgver, pkg.arch, pkg.repo)
if pkg.repo == 'installed':
self.package(id, INFO_INSTALLED, pkg.summary)
else:
self.package(id, INFO_AVAILABLE, pkg.summary)
-
+
def update_system(self):
'''
@@ -271,7 +271,7 @@ class PackageKitYumBackend(PackageKitBas
self._runYumTransaction()
else:
self.error(ERROR_INTERNAL_ERROR,"Nothing to do")
-
+
def refresh_cache(self):
'''
Implement the {backend}-refresh_cache functionality
@@ -306,7 +306,7 @@ class PackageKitYumBackend(PackageKitBas
mi = self.yumbase.ts.ts.dbMatch('name', name)
if mi.count() > 0:
return True
- return False
+ return False
def resolve(self, name):
'''
@@ -315,7 +315,7 @@ class PackageKitYumBackend(PackageKitBas
# Get installed packages
installedByKey = self.yumbase.rpmdb.searchNevra(name=name)
for pkg in installedByKey:
- self._show_package(pkg,INFO_INSTALLED)
+ self._show_package(pkg,INFO_INSTALLED)
# Get availabe packages
for pkg in self.yumbase.pkgSack.returnNewestByNameArch():
if pkg.name == name:
@@ -337,17 +337,17 @@ class PackageKitYumBackend(PackageKitBas
pkg,inst = self._findPackage(package)
if pkg:
if inst:
- self.error(ERROR_PACKAGE_ALREADY_INSTALLED,'Package already installed')
+ self.error(ERROR_PACKAGE_ALREADY_INSTALLED,'Package already installed')
try:
txmbr = self.yumbase.install(name=pkg.name)
self._runYumTransaction()
except yum.Errors.InstallError,e:
print e
msgs = ';'.join(e)
- self.error(ERROR_PACKAGE_ALREADY_INSTALLED,msgs)
+ self.error(ERROR_PACKAGE_ALREADY_INSTALLED,msgs)
else:
- self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"Package was not found")
-
+ self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"Package was not found")
+
def update(self, package):
'''
Implement the {backend}-install functionality
@@ -373,7 +373,7 @@ class PackageKitYumBackend(PackageKitBas
if pkg.name in self.rebootpkgs and txmbr.ts_state in TS_INSTALL_STATES:
self.require_restart(RESTART_SYSTEM,"")
break
-
+
def _runYumTransaction(self,removedeps=None):
'''
Run the yum Transaction
@@ -414,7 +414,7 @@ class PackageKitYumBackend(PackageKitBas
self._setup_yum()
self.percentage(0)
pkg,inst = self._findPackage( package)
- if pkg and inst:
+ if pkg and inst:
txmbr = self.yumbase.remove(name=pkg.name)
if txmbr:
if allowdep != 'yes':
@@ -438,8 +438,8 @@ class PackageKitYumBackend(PackageKitBas
id = self.get_package_id(pkg.name, pkgver, pkg.arch, pkg.repo)
desc = pkg.description
desc = desc.replace('\n\n',';')
- desc = desc.replace('\n',' ')
-
+ desc = desc.replace('\n',' ')
+
files = pkg.returnFileEntries('dir')
files.extend(pkg.returnFileEntries()) # regular files
@@ -449,22 +449,22 @@ class PackageKitYumBackend(PackageKitBas
"unknown", desc, pkg.url, pkg.size, file_list)
else:
self.error(ERROR_INTERNAL_ERROR,'Package was not found')
-
+
def _show_package(self,pkg,status):
''' Show info about package'''
pkgver = self._get_package_ver(pkg)
id = self.get_package_id(pkg.name, pkgver, pkg.arch, pkg.repo)
self.package(id,status, pkg.summary)
-
+
def _get_status(self,notice):
ut = notice['type']
# TODO : Add more types to check
if ut == 'security':
return INFO_SECURITY
else:
- return INFO_NORMAL
-
-
+ return INFO_NORMAL
+
+
def get_updates(self):
'''
Implement the {backend}-get-updates functionality
@@ -475,21 +475,21 @@ class PackageKitYumBackend(PackageKitBas
for repo in self.yumbase.repos.listEnabled():
try:
md.add(repo)
- except:
+ except:
pass # No updateinfo.xml.gz in repo
-
+
self.percentage(0)
- ygl = self.yumbase.doPackageLists(pkgnarrow='updates')
+ ygl = self.yumbase.doPackageLists(pkgnarrow='updates')
for pkg in ygl.updates:
# Get info about package in updates info
notice = md.get_notice((pkg.name, pkg.version, pkg.release))
- if notice:
+ if notice:
status = self._get_status(notice)
- self._show_package(pkg,status)
+ self._show_package(pkg,status)
else:
self._show_package(pkg,INFO_NORMAL)
-
-
+
+
def _setup_yum(self):
self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0) # Setup Yum Config
self.dnlCallback = DownloadCallback(self,showNames=True) # Download callback
@@ -514,7 +514,7 @@ class DownloadCallback( BaseMeter ):
self.numPkgs = len(self.pkgs)
self.bump = numPct/self.numPkgs
self.totalPct = startPct
-
+
def _getPackage(self,name):
name = name.split('-')[0]
if self.pkgs:
@@ -522,7 +522,7 @@ class DownloadCallback( BaseMeter ):
if pkg.name == name:
return pkg
return None
-
+
def update( self, amount_read, now=None ):
BaseMeter.update( self, amount_read, now )
@@ -587,7 +587,7 @@ class DownloadCallback( BaseMeter ):
pkg = self._getPackage(name)
if pkg: # show package to download
self.base._show_package(pkg,INFO_DOWNLOADING)
-
+
class PackageKitCallback(RPMBaseCallback):
def __init__(self,base):
@@ -602,11 +602,11 @@ class PackageKitCallback(RPMBaseCallback
bump = float(self.numPct)/ts_total
pct = int(self.startPct + (ts_current * bump))
return pct
-
+
def _showName(self,status):
id = self.base.get_package_id(self.curpkg, '', '', '')
self.base.package(id,status, "")
-
+
def event(self, package, action, te_current, te_total, ts_current, ts_total):
if str(package) != self.curpkg:
@@ -638,7 +638,7 @@ class ProcessTransPackageKitCallback:
self.base.allow_interrupt(True)
self.base.percentage(10)
self.base.status(STATE_DOWNLOAD)
- if state == PT_DOWNLOAD_PKGS: # Packages to download
+ if state == PT_DOWNLOAD_PKGS: # Packages to download
self.base.dnlCallback.setPackages(data,10,30)
elif state == PT_GPGCHECK:
self.base.percentage(40)
diff --git a/libgbus/libgbus.c b/libgbus/libgbus.c
index 096f0e7..6499508 100644
--- a/libgbus/libgbus.c
+++ b/libgbus/libgbus.c
@@ -151,7 +151,7 @@ libgbus_is_connected (LibGBus *libgbus)
gboolean ret;
g_return_val_if_fail (IS_LIBGBUS (libgbus), FALSE);
- /* get raw connection */
+ /* get raw connection */
conn = dbus_g_connection_get_connection (libgbus->priv->connection);
dbus_error_init (&error);
ret = dbus_bus_name_has_owner (conn, libgbus->priv->service, &error);
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index cfe5863..a476f80 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -196,7 +196,7 @@ static const gchar *
pk_client_get_error_name (GError *error)
{
const gchar *name;
- if (error->domain == DBUS_GERROR &&
+ if (error->domain == DBUS_GERROR &&
error->code == DBUS_GERROR_REMOTE_EXCEPTION) {
name = dbus_g_error_get_name (error);
} else {
@@ -1801,7 +1801,7 @@ pk_client_init (PkClient *client)
/* Description */
dbus_g_object_register_marshaller (pk_marshal_VOID__STRING_STRING_STRING_STRING_STRING_STRING_UINT64_STRING,
- G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64,
G_TYPE_STRING, G_TYPE_INVALID);
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index f226ab6..203987c 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -65,7 +65,7 @@ class PackageKitBaseBackend:
self.cmds = cmds
def percentage(self,percent=None):
- '''
+ '''
Write progress percentage
@param percent: Progress percentage
'''
@@ -75,7 +75,7 @@ class PackageKitBaseBackend:
print >> sys.stderr, "no-percentage-updates"
def sub_percentage(self,percent=None):
- '''
+ '''
send 'subpercentage' signal : subprogress percentage
@param percent: subprogress percentage
'''
@@ -83,10 +83,10 @@ class PackageKitBaseBackend:
def error(self,err,description,exit=True):
'''
- send 'error'
- @param err: Error Type (ERROR_NO_NETWORK, ERROR_NOT_SUPPORTED, ERROR_INTERNAL_ERROR)
+ send 'error'
+ @param err: Error Type (ERROR_NO_NETWORK, ERROR_NOT_SUPPORTED, ERROR_INTERNAL_ERROR)
@param description: Error description
- @param exit: exit application with rc=1, if true
+ @param exit: exit application with rc=1, if true
'''
print >> sys.stderr,"error\t%s\t%s" % (err,description)
if exit:
@@ -97,14 +97,14 @@ class PackageKitBaseBackend:
send 'package' signal
@param info: the enumerated INFO_* string
@param id: The package ID name, e.g. openoffice-clipart;2.6.22;ppc64;fedora
- @param summary: The package Summary
+ @param summary: The package Summary
'''
print >> sys.stdout,"package\t%s\t%s\t%s" % (status,id,summary)
def status(self,state):
'''
send 'status' signal
- @param state: STATE_DOWNLOAD, STATE_INSTALL, STATE_UPDATE, STATE_REMOVE
+ @param state: STATE_DOWNLOAD, STATE_INSTALL, STATE_UPDATE, STATE_REMOVE
'''
print >> sys.stderr,"status\t%s" % (state)
diff --git a/python/packagekit/frontend.py b/python/packagekit/frontend.py
index 9f974b7..861e5be 100644
--- a/python/packagekit/frontend.py
+++ b/python/packagekit/frontend.py
@@ -22,7 +22,7 @@ import gobject
class PackageKitException(Exception):
def __init__(self):
Exception.__init__(self)
-
+
def __init__(self,e=None):
Exception.__init__(self)
if e == None:
@@ -33,10 +33,10 @@ class PackageKitException(Exception):
raise Exception,"Can only handle DBusExceptions"
self._pk_name = str(e.get_dbus_name())
self._full_str = str(e)
-
+
def get_backend_name(self):
return self._pk_name
-
+
def __str__(self):
if self._full_str!=None:
return self._full_str
@@ -96,7 +96,7 @@ class PackageKit:
#self.job = None
self.progress = 0.0
bus.add_signal_receiver(self.catchall_signal_handler, interface_keyword='dbus_interface', member_keyword='member',dbus_interface="org.freedesktop.PackageKit")
-
+
def run(self):
self.loop = gobject.MainLoop()
self.loop.run()
@@ -145,19 +145,19 @@ class PackageKit:
running_time # amount of time transaction has been running in seconds
):
pass
-
+
def Percentage(self,
jid, # Job ID
progress # 0.0 - 100.0
):
pass
-
+
def JobStatus(self,
jid, # Job ID
status # enum - invalid, setup, download, install, update, exit
):
pass
-
+
def Package(self,
jid, # Job ID
value, # installed=1, not-installed=0 | security=1, normal=0
@@ -195,7 +195,7 @@ class PackageKit:
details # non-localized details
):
pass
-
+
def RequireRestart(self,
jid, # Job ID
type, # enum - system,application,session
@@ -218,7 +218,7 @@ class PackageKit:
# --- PK Methods ---
## Start a new transaction to do Foo
-
+
@dbusException
@job_id
def GetUpdates(self):
@@ -484,4 +484,4 @@ class DumpingPackageKit(PackageKit):
print " args:"
for arg in args:
print " " + str(arg)
-
+
diff --git a/python/pk-frontend-test.py b/python/pk-frontend-test.py
index 2020d89..40bd9a7 100755
--- a/python/pk-frontend-test.py
+++ b/python/pk-frontend-test.py
@@ -22,10 +22,10 @@ from packagekit.frontend import *
class pkt(PackageKit):
def Percentage(self,jid,progress):
print "Progress: %.2f%%"%progress
-
+
def JobStatus(self,jid,type):
print "Job type: %s"%type
-
+
def Package(self,jid,value,name,summary):
print "Package: %s - %s"%(name,summary)
@@ -78,7 +78,7 @@ def history(*args):
count = 5
if len(args)==1 and len(args[0])==1:
count = args[0][0]
-
+
count = int(count)
if count < 1:
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 28c353d..0f336b7 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -837,7 +837,7 @@ pk_backend_get_role (PkBackend *backend,
/**
* pk_backend_finished_delay:
*
- * We can call into this function if we *know* it's safe.
+ * We can call into this function if we *know* it's safe.
**/
static gboolean
pk_backend_finished_delay (gpointer data)
@@ -1419,7 +1419,7 @@ pk_backend_finalize (GObject *object)
if (backend->desc != NULL) {
if (backend->desc->destroy != NULL) {
backend->desc->destroy (backend);
- }
+ }
}
pk_debug ("freeing %s (%p)", backend->priv->name, backend);
diff --git a/src/pk-conf.c b/src/pk-conf.c
index 66742a8..1ed949f 100644
--- a/src/pk-conf.c
+++ b/src/pk-conf.c
@@ -124,7 +124,7 @@ pk_conf_init (PkConf *conf)
if (g_file_test (path, G_FILE_TEST_EXISTS) == FALSE) {
pk_debug ("config file not found '%s'", path);
g_free (path);
- path = g_build_filename (SYSCONFDIR, "PackageKit", "PackageKit.conf", NULL);
+ path = g_build_filename (SYSCONFDIR, "PackageKit", "PackageKit.conf", NULL);
if (g_file_test (path, G_FILE_TEST_EXISTS) == FALSE) {
pk_error ("config file not found '%s'", path);
}
diff-tree dfd41d020f0bd187d1c972b42d272048353d0881 (from 8f2cdf98e328595092001ae180c703a808651436)
Author: Tim Lauridsen <tla at rasmil.dk>
Date: Wed Oct 3 20:56:31 2007 +0200
Make get depends work right in yum backend
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 8c15ffe..257f19a 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -254,8 +254,11 @@ class PackageKitYumBackend(PackageKitBas
if pkg.name != name:
pkgver = self._get_package_ver(pkg)
id = self.get_package_id(pkg.name, pkgver, pkg.arch, pkg.repo)
- # TODO: we need to find out if this is installed or not...
- self.package(id, PK_INFO_ENUM_UNKNOWN, pkg.summary)
+ if pkg.repo == 'installed':
+ self.package(id, INFO_INSTALLED, pkg.summary)
+ else:
+ self.package(id, INFO_AVAILABLE, pkg.summary)
+
def update_system(self):
'''
diff-tree 8f2cdf98e328595092001ae180c703a808651436 (from 1348b3842532fd5965c3e2dad541ee0d4fdc8f8e)
Author: Tim Lauridsen <tla at rasmil.dk>
Date: Wed Oct 3 20:53:28 2007 +0200
Remove debug output from yum backend
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index cc7be19..8c15ffe 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -213,7 +213,6 @@ class PackageKitYumBackend(PackageKitBas
# get e,v,r from package id version
e,v,r = self._getEVR(idver)
# search the rpmdb for the nevra
- print n,e,v,r,a
pkgs = self.yumbase.rpmdb.searchNevra(name=n,epoch=e,ver=v,rel=r,arch=a)
# if the package is found, then return it
if len(pkgs) != 0:
More information about the PackageKit
mailing list