[PackageKit-commit] packagekit: Branch 'master' - 8 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Tue Jun 9 12:56:15 PDT 2009
backends/apt/aptBackend.py | 134 -------------------------------------
backends/aptcc/matcher.cpp | 1
backends/portage/portageBackend.py | 34 +++------
backends/yum/yumBackend.py | 17 +++-
lib/packagekit-glib/pk-enum.c | 1
lib/packagekit-glib/pk-enum.h | 1
tools/add-error-enum.sh | 2
7 files changed, 32 insertions(+), 158 deletions(-)
New commits:
commit 0c0758d36581efb68ef7841ea50dd9e0a8559458
Merge: 9188411... f52310a...
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Tue Jun 9 14:59:15 2009 +0200
Merge branch 'master' of git+ssh://glatzor@git.packagekit.org/srv/git/PackageKit
commit f52310ab8487a9e6f8e0a6b7f306e588bab24fd6
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jun 9 10:52:58 2009 +0100
yum: use the new update-not-found error enum for missing updates
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 18e5873..b0787a8 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -1795,7 +1795,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
return
txmbrs.extend(txmbr)
else:
- self.error(ERROR_PACKAGE_NOT_FOUND, "cannot find package '%s'" % _format_package_id(package_id), exit=False)
+ self.error(ERROR_UPDATE_NOT_FOUND, "cannot find package '%s'" % _format_package_id(package_id), exit=False)
return
except yum.Errors.RepoError, e:
self.error(ERROR_REPO_NOT_AVAILABLE, _to_unicode(e), exit=False)
commit 5589747edfcb5a63fbd0ff6c43a5d4712a6ff568
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jun 9 10:50:39 2009 +0100
Add another error enum, update-not-found
diff --git a/lib/packagekit-glib/pk-enum.c b/lib/packagekit-glib/pk-enum.c
index 60f404f..26fa376 100644
--- a/lib/packagekit-glib/pk-enum.c
+++ b/lib/packagekit-glib/pk-enum.c
@@ -173,6 +173,7 @@ static const PkEnumMatch enum_error[] = {
{PK_ERROR_ENUM_NO_SPACE_ON_DEVICE, "no-space-on-device"},
{PK_ERROR_ENUM_MEDIA_CHANGE_REQUIRED, "media-change-required"},
{PK_ERROR_ENUM_NOT_AUTHORIZED, "not-authorized"},
+ {PK_ERROR_ENUM_UPDATE_NOT_FOUND, "update-not-found"},
{0, NULL}
};
diff --git a/lib/packagekit-glib/pk-enum.h b/lib/packagekit-glib/pk-enum.h
index b669b27..c32407b 100644
--- a/lib/packagekit-glib/pk-enum.h
+++ b/lib/packagekit-glib/pk-enum.h
@@ -288,6 +288,7 @@ typedef enum {
PK_ERROR_ENUM_NO_SPACE_ON_DEVICE,
PK_ERROR_ENUM_MEDIA_CHANGE_REQUIRED,
PK_ERROR_ENUM_NOT_AUTHORIZED,
+ PK_ERROR_ENUM_UPDATE_NOT_FOUND,
PK_ERROR_ENUM_UNKNOWN
} PkErrorCodeEnum;
diff --git a/tools/add-error-enum.sh b/tools/add-error-enum.sh
index 1d35e6a..850cab7 100755
--- a/tools/add-error-enum.sh
+++ b/tools/add-error-enum.sh
@@ -7,5 +7,5 @@
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-$EDITOR docs/api/spec/pk-concepts.xml lib/packagekit-glib/pk-enum.h lib/packagekit-glib/pk-enum.c ../gnome-packagekit/src/gpk-enum.c ../gnome-packagekit/src/gpk-common.c
+$EDITOR lib/packagekit-glib/pk-enum.h lib/packagekit-glib/pk-enum.c ../gnome-packagekit/src/gpk-enum.c ../gnome-packagekit/src/gpk-enum.h
commit 6134b944fca890549afba2816fc437bf5b0ffbbc
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jun 9 10:20:14 2009 +0100
yum: Correct an error enum for a missing group
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 0101bd1..18e5873 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -893,7 +893,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
self.error(ERROR_INTERNAL_ERROR, _format_str(traceback.format_exc()))
isGroup = True
if isGroup and not grp:
- self.error(ERROR_PACKAGE_NOT_FOUND, "The Group %s dont exist" % name)
+ self.error(ERROR_GROUP_NOT_FOUND, "The Group %s dont exist" % name)
return grp
def _findPackage(self, package_id):
commit 1c6e27ef1dc459eae84d45c9b5969a3fa98853f5
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jun 9 10:17:16 2009 +0100
yum: Format the package_id before showing it in the error detail
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index c7cb458..0101bd1 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -98,6 +98,15 @@ def _get_package_ver(po):
ver = "%s-%s" % (po.version, po.release)
return ver
+def _format_package_id(package_id):
+ """
+ Convert 'hal;0.5.8;i386;fedora' to 'hal-0.5.8-fedora(i386)'
+ """
+ parts = package_id.split(';')
+ if len(parts) != 4:
+ return "incorrect package_id: %s" % package_id
+ return "%s-%s(%s)%s" % (parts[0], parts[1], parts[2], parts[3])
+
def _format_str(text):
"""
Convert a multi line string to a list separated by ';'
@@ -945,7 +954,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
# multiple entries
if len(pkgs) > 1:
- self.error(ERROR_INTERNAL_ERROR, "more than one package match for %s" % package_id)
+ self.error(ERROR_INTERNAL_ERROR, "more than one package match for %s" % _format_package_id(package_id))
return pkgs[0], False
# one NEVRA in a single repo
@@ -1782,11 +1791,11 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
except Exception, e:
self.error(ERROR_INTERNAL_ERROR, _format_str(traceback.format_exc()))
if not txmbr:
- self.error(ERROR_TRANSACTION_ERROR, "could not add package update for %s: %s" % (package_id, pkg), exit=False)
+ self.error(ERROR_TRANSACTION_ERROR, "could not add package update for %s: %s" % (_format_package_id(package_id), pkg), exit=False)
return
txmbrs.extend(txmbr)
else:
- self.error(ERROR_PACKAGE_NOT_FOUND, "cannot find package '%s'" % package_id, exit=False)
+ self.error(ERROR_PACKAGE_NOT_FOUND, "cannot find package '%s'" % _format_package_id(package_id), exit=False)
return
except yum.Errors.RepoError, e:
self.error(ERROR_REPO_NOT_AVAILABLE, _to_unicode(e), exit=False)
commit 5abe4aab5273ec1378f29696b37e63d6cf34d433
Author: volkmar <volkmar at Altdorf.OldWorld>
Date: Tue Jun 9 01:04:02 2009 +0200
portage: better remove-package function
diff --git a/backends/portage/portageBackend.py b/backends/portage/portageBackend.py
index ced28f1..1cd1ee9 100755
--- a/backends/portage/portageBackend.py
+++ b/backends/portage/portageBackend.py
@@ -453,18 +453,18 @@ class PackageKitPortageBackend(PackageKitBaseBackend, PackagekitPackage):
# is package installed
if not self.vardb.match(cpv):
- self.error(ERROR_PACKAGE_NOT_INSTALLED, "Package %s is not installed" % pkg)
+ self.error(ERROR_PACKAGE_NOT_INSTALLED,
+ "Package %s is not installed" % pkg)
continue
- # operation = unmerge
- # PackageUninstall
-# portage.PackageUninstall(
myopts = {} # TODO: --nodepends ?
spinner = ""
favorites = []
settings, trees, mtimedb = _emerge.load_emerge_config()
spinner = _emerge.stdout_spinner()
- rootconfig = _emerge.RootConfig(self.portage_settings, trees["/"], portage._sets.load_default_config(self.portage_settings, trees["/"]))
+ rootconfig = _emerge.RootConfig(self.portage_settings, trees["/"],
+ portage._sets.load_default_config(self.portage_settings, trees["/"])
+ )
if "resume" in mtimedb and \
"mergelist" in mtimedb["resume"] and \
@@ -479,9 +479,13 @@ class PackageKitPortageBackend(PackageKitBaseBackend, PackagekitPackage):
db_keys = list(portage.portdb._aux_cache_keys)
metadata = izip(db_keys, portage.portdb.aux_get(cpv, db_keys))
- package = _emerge.Package(type_name="ebuild",
+ package = _emerge.Package(
+ type_name="ebuild",
+ built=True,
+ installed=True,
root_config=rootconfig,
- cpv=cpv, metadata=metadata,
+ cpv=cpv,
+ metadata=metadata,
operation="uninstall")
# TODO: needed ?
@@ -489,19 +493,9 @@ class PackageKitPortageBackend(PackageKitBaseBackend, PackagekitPackage):
pkgsettings.setcpv(package)
package.metadata['USE'] = pkgsettings['PORTAGE_USE']
- #scheduler = _emerge.QueueScheduler()
- #scheduler = _emerge.Scheduler(settings, trees, mtimedb, myopts, spinner, [package], favorites, package)
- #scheduler = scheduler._sched_iface
- #scheduler._background = scheduler._background_model()
- scheduler = None
-
- #mergetask = _emerge.Scheduler(settings, trees, mtimedb, myopts, spinner, [package], favorites, package)
- #mergetask.merge()
- uninstall = _emerge.PackageUninstall(background=1,
- ldpath_mtimes=mtimedb["ldpath"], opts=myopts,
- pkg=package, scheduler=scheduler, settings=settings)
- uninstall.start()
- uninstall.wait()
+ mergetask = _emerge.Scheduler(settings,
+ trees, mtimedb, myopts, spinner, [package], favorites, package)
+ mergetask.merge()
def resolve(self, filters, pkgs):
# TODO: filters
commit 91884118db2ce2ddf5ed64af4467225ce3682f14
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Sat May 30 22:33:12 2009 +0200
APTCC: Fix missing include
diff --git a/backends/aptcc/matcher.cpp b/backends/aptcc/matcher.cpp
index b474e7b..823b6b9 100644
--- a/backends/aptcc/matcher.cpp
+++ b/backends/aptcc/matcher.cpp
@@ -19,6 +19,7 @@
// Boston, MA 02111-1307, USA.
#include "matcher.h"
+#include <stdio.h>
matcher::matcher(const string &matchers)
: m_hasError(false)
commit c21e68f885cce43bb01074ab227453daa8af93d4
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Sat May 23 08:44:35 2009 +0200
APT: downloading the package changelog was merged into python-apt
diff --git a/backends/apt/aptBackend.py b/backends/apt/aptBackend.py
index e6a7175..339a9c9 100755
--- a/backends/apt/aptBackend.py
+++ b/backends/apt/aptBackend.py
@@ -723,7 +723,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
#FIXME: Replace this method with the python-apt one as soon as the
# consolidate branch gets merged
self.status(STATUS_DOWNLOAD_CHANGELOG)
- changelog = self._get_changelog(pkg)
+ changelog = pkg.getChangelog()
self.status(STATUS_INFO)
bugzilla_url = ";".join(get_bug_urls(changelog))
cve_url = ";".join(get_cve_urls(changelog))
@@ -1744,138 +1744,6 @@ class PackageKitAptBackend(PackageKitBaseBackend):
return []
return files
- def _get_changelog(self, pkg, uri=None, cancel_lock=None):
- """
- Download the changelog of the package and return it as unicode
- string
-
- This method is already part of the consolidate branch of python-apt
-
- uri: Is the uri to the changelog file. The following named variables
- will be substituted: src_section, prefix, src_pkg and src_ver
- For example the Ubuntu changelog:
- uri = "http://changelogs.ubuntu.com/changelogs/pool" \\
- "/%(src_section)s/%(prefix)s/%(src_pkg)s" \\
- "/%(src_pkg)s_%(src_ver)s/changelog"
- cancel_lock: If this threading.Lock() is set, the download will be
- canceled
- """
- if uri == None:
- if pkg.candidateOrigin[0].origin == "Debian":
- uri = "http://packages.debian.org/changelogs/pool" \
- "/%(src_section)s/%(prefix)s/%(src_pkg)s" \
- "/%(src_pkg)s_%(src_ver)s/changelog"
- elif pkg.candidateOrigin[0].origin == "Ubuntu":
- uri = "http://changelogs.ubuntu.com/changelogs/pool" \
- "/%(src_section)s/%(prefix)s/%(src_pkg)s" \
- "/%(src_pkg)s_%(src_ver)s/changelog"
- else:
- return "The list of changes is not available"
-
- # get the src package name
- src_pkg = pkg.sourcePackageName
-
- # assume "main" section
- src_section = "main"
- # use the section of the candidate as a starting point
- section = self._cache._depcache.GetCandidateVer(pkg._pkg).Section
-
- # get the source version, start with the binaries version
- bin_ver = pkg.candidateVersion
- src_ver = pkg.candidateVersion
- #print "bin: %s" % binver
- try:
- # try to get the source version of the pkg, this differs
- # for some (e.g. libnspr4 on ubuntu)
- # this feature only works if the correct deb-src are in the
- # sources.list
- # otherwise we fall back to the binary version number
- src_records = apt_pkg.GetPkgSrcRecords()
- src_rec = src_records.Lookup(src_pkg)
- if src_rec:
- src_ver = src_records.Version
- #if apt_pkg.VersionCompare(binver, srcver) > 0:
- # srcver = binver
- if not src_ver:
- src_ver = bin_ver
- #print "srcver: %s" % src_ver
- section = src_records.Section
- #print "srcsect: %s" % section
- else:
- # fail into the error handler
- raise SystemError
- except SystemError, e:
- src_ver = bin_ver
-
- l = section.split("/")
- if len(l) > 1:
- src_section = l[0]
-
- # lib is handled special
- prefix = src_pkg[0]
- if src_pkg.startswith("lib"):
- prefix = "lib" + src_pkg[3]
-
- # stip epoch
- l = src_ver.split(":")
- if len(l) > 1:
- src_ver = "".join(l[1:])
-
- uri = uri % {"src_section" : src_section,
- "prefix" : prefix,
- "src_pkg" : src_pkg,
- "src_ver" : src_ver}
- try:
- # Check if the download was canceled
- if cancel_lock and cancel_lock.isSet(): return ""
- changelog_file = urllib2.urlopen(uri)
- # do only get the lines that are new
- changelog = ""
- regexp = "^%s \((.*)\)(.*)$" % (re.escape(src_pkg))
-
- i=0
- while True:
- # Check if the download was canceled
- if cancel_lock and cancel_lock.isSet(): return ""
- # Read changelog line by line
- line_raw = changelog_file.readline()
- if line_raw == "":
- break
- # The changelog is encoded in utf-8, but since there isn't any
- # http header, urllib2 seems to treat it as ascii
- line = line_raw.decode("utf-8")
-
- #print line.encode('utf-8')
- match = re.match(regexp, line)
- if match:
- # strip epoch from installed version
- # and from changelog too
- installed = pkg.installedVersion
- if installed and ":" in installed:
- installed = installed.split(":",1)[1]
- changelog_ver = match.group(1)
- if changelog_ver and ":" in changelog_ver:
- changelog_ver = changelog_ver.split(":", 1)[1]
- if installed and \
- apt_pkg.VersionCompare(changelog_ver, installed) <= 0:
- break
- # EOF (shouldn't really happen)
- changelog += line
-
- # Print an error if we failed to extract a changelog
- if len(changelog) == 0:
- changelog = "The list of changes is not available"
- except urllib2.HTTPError,e:
- return "The list of changes is not available yet.\n\n" \
- "Please use http://launchpad.net/ubuntu/+source/%s/%s/" \
- "+changelog\n" \
- "until the changes become available or try again " \
- "later." % (src_pkg, src_ver)
- except IOError, httplib.BadStatusLine:
- return "Failed to download the list of changes.\nPlease " \
- "check your Internet connection."
- return changelog
-
def _get_package_group(self, pkg):
"""
Return the packagekit group corresponding to the package's section
More information about the PackageKit-commit
mailing list