[PackageKit-commit] packagekit: Branch 'master' - 7 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Thu Sep 9 03:44:24 PDT 2010
RELEASE | 12 +++----
backends/portage/portageBackend.py | 19 ++++++++---
backends/zypp/pk-backend-zypp.cpp | 59 ++++++++++++++++++++++++------------
backends/zypp/zypp-utils.cpp | 60 +++++++++++++++++++++----------------
backends/zypp/zypp-utils.h | 4 +-
configure.ac | 2 -
6 files changed, 96 insertions(+), 60 deletions(-)
New commits:
commit 6114eccbee731b3b6b9e9d5b5b1289377ef5c81c
Author: Fabio Erculiani <lxnay at sabayon.org>
Date: Wed Sep 8 17:38:51 2010 +0200
portage: add compatibility with latest Portage 2.2 rc snapshots
diff --git a/backends/portage/portageBackend.py b/backends/portage/portageBackend.py
index 2dc9b33..aa8f8c4 100755
--- a/backends/portage/portageBackend.py
+++ b/backends/portage/portageBackend.py
@@ -340,6 +340,13 @@ class PackageKitPortageMixin(object):
settings.setcpv(cpv, mydb=metadata)
return settings
+ def _get_internal_package_set_class(self):
+ try:
+ from portage._sets.base import InternalPackageSet
+ except ImportError:
+ from portage.sets.base import InternalPackageSet
+ return InternalPackageSet
+
def _is_installed(self, cpv):
if self.pvar.vardb.cpv_exists(cpv):
return True
@@ -1177,9 +1184,9 @@ class PackageKitPortageBackend(PackageKitPortageMixin, PackageKitBaseBackend):
# get system and world packages
for s in ["system", "world"]:
- set = portage.sets.base.InternalPackageSet(
+ sets = self._get_internal_package_set_class()(
initial_atoms=self.pvar.root_config.setconfig.getSetAtoms(s))
- for atom in set:
+ for atom in sets:
update_candidates.append(atom.cp)
# check if a candidate can be updated
@@ -1242,7 +1249,7 @@ class PackageKitPortageBackend(PackageKitPortageMixin, PackageKitBaseBackend):
cpv_downgra[cp] = dict_down
# get security updates
- for atom in portage.sets.base.InternalPackageSet(
+ for atom in self._get_internal_package_set_class()(
initial_atoms=self.pvar.root_config.setconfig.getSetAtoms("security")):
# send update message and remove atom from cpv_updates
if atom.cp in cpv_updates:
@@ -1409,9 +1416,9 @@ class PackageKitPortageBackend(PackageKitPortageMixin, PackageKitBaseBackend):
system_packages = []
# get system packages
- set = portage.sets.base.InternalPackageSet(
- initial_atoms=self.pvar.root_config.setconfig.getSetAtoms("system"))
- for atom in set:
+ sets = self._get_internal_package_set_class()(
+ initial_atoms=self.pvar.root_config.setconfig.getSetAtoms("system"))
+ for atom in sets:
system_packages.append(atom.cp)
# create cpv_list
commit ab37d0a7c95de3b6334ca1c4b511fa0bbba4e3f6
Author: Michael Meeks <michael.meeks at novell.com>
Date: Tue Sep 7 12:17:31 2010 +0100
cleanup get_packages_by_name callers.
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index d3621ff..c2ca1b4 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -457,9 +457,9 @@ backend_get_details_thread (PkBackend *backend)
std::vector<zypp::sat::Solvable> *v;
std::vector<zypp::sat::Solvable> *v2;
std::vector<zypp::sat::Solvable> *v3;
- v = zypp_get_packages_by_name (backend, (const gchar *)id_parts[PK_PACKAGE_ID_NAME], zypp::ResKind::package, TRUE);
- v2 = zypp_get_packages_by_name (backend, (const gchar *)id_parts[PK_PACKAGE_ID_NAME], zypp::ResKind::patch, TRUE);
- v3 = zypp_get_packages_by_name (backend, (const gchar *)id_parts[PK_PACKAGE_ID_NAME], zypp::ResKind::srcpackage, TRUE);
+ v = zypp_get_packages_by_name (backend, (const gchar *)id_parts[PK_PACKAGE_ID_NAME], zypp::ResKind::package);
+ v2 = zypp_get_packages_by_name (backend, (const gchar *)id_parts[PK_PACKAGE_ID_NAME], zypp::ResKind::patch);
+ v3 = zypp_get_packages_by_name (backend, (const gchar *)id_parts[PK_PACKAGE_ID_NAME], zypp::ResKind::srcpackage);
v->insert (v->end (), v2->begin (), v2->end ());
v->insert (v->end (), v3->begin (), v3->end ());
@@ -774,6 +774,7 @@ backend_install_files_thread (PkBackend *backend)
std::vector<zypp::sat::Solvable> *solvables = 0;
solvables = zypp_get_packages_by_name (backend, rpmHeader->tag_name ().c_str (), zypp::ResKind::package, FALSE);
zypp::PoolItem *item = NULL;
+
gboolean found = FALSE;
for (std::vector<zypp::sat::Solvable>::iterator it = solvables->begin (); it != solvables->end (); it ++) {
@@ -1219,19 +1220,19 @@ backend_resolve_thread (PkBackend *backend)
std::vector<zypp::sat::Solvable> *v;
/* build a list of packages with this name */
- v = zypp_get_packages_by_name (backend, package_ids[i], zypp::ResKind::package, TRUE);
+ v = zypp_get_packages_by_name (backend, package_ids[i], zypp::ResKind::package);
/* add source packages */
if (!pk_bitfield_contain (_filters, PK_FILTER_ENUM_NOT_SOURCE)) {
std::vector<zypp::sat::Solvable> *src;
- src = zypp_get_packages_by_name (backend, package_ids[i], zypp::ResKind::srcpackage, TRUE);
+ src = zypp_get_packages_by_name (backend, package_ids[i], zypp::ResKind::srcpackage);
v->insert (v->end (), src->begin (), src->end ());
delete (src);
}
/* include patches too */
std::vector<zypp::sat::Solvable> *v2;
- v2 = zypp_get_packages_by_name (backend, package_ids[i], zypp::ResKind::patch, TRUE);
+ v2 = zypp_get_packages_by_name (backend, package_ids[i], zypp::ResKind::patch);
v->insert (v->end (), v2->begin (), v2->end ());
delete (v2);
@@ -1515,8 +1516,8 @@ backend_get_files_thread (PkBackend *backend)
std::vector<zypp::sat::Solvable> *v;
std::vector<zypp::sat::Solvable> *v2;
- v = zypp_get_packages_by_name (backend, (const gchar *)id_parts[PK_PACKAGE_ID_NAME], zypp::ResKind::package, TRUE);
- v2 = zypp_get_packages_by_name (backend, (const gchar *)id_parts[PK_PACKAGE_ID_NAME], zypp::ResKind::srcpackage, TRUE);
+ v = zypp_get_packages_by_name (backend, (const gchar *)id_parts[PK_PACKAGE_ID_NAME], zypp::ResKind::package);
+ v2 = zypp_get_packages_by_name (backend, (const gchar *)id_parts[PK_PACKAGE_ID_NAME], zypp::ResKind::srcpackage);
v->insert (v->end (), v2->begin (), v2->end ());
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index 99129c4..0b2dc89 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -156,7 +156,7 @@ zypp_build_pool (PkBackend *backend, gboolean include_local)
zypp::ZYpp::Ptr zypp = get_zypp (backend);
if (include_local) {
- //FIXME have to wait for fix in zypp (repeated loading of target)
+ // FIXME have to wait for fix in zypp (repeated loading of target)
if (zypp::sat::Pool::instance().reposFind( zypp::sat::Pool::systemRepoAlias() ).solvablesEmpty ())
{
// Add local resolvables
@@ -391,8 +391,8 @@ zypp_get_package_by_id (PkBackend *backend, const gchar *package_id)
}
gchar **id_parts = pk_package_id_split(package_id);
- std::vector<zypp::sat::Solvable> *v = zypp_get_packages_by_name (backend, id_parts[PK_PACKAGE_ID_NAME], zypp::ResKind::package, TRUE);
- std::vector<zypp::sat::Solvable> *v2 = zypp_get_packages_by_name (backend, id_parts[PK_PACKAGE_ID_NAME], zypp::ResKind::patch, TRUE);
+ std::vector<zypp::sat::Solvable> *v = zypp_get_packages_by_name (backend, id_parts[PK_PACKAGE_ID_NAME], zypp::ResKind::package);
+ std::vector<zypp::sat::Solvable> *v2 = zypp_get_packages_by_name (backend, id_parts[PK_PACKAGE_ID_NAME], zypp::ResKind::patch);
v->insert (v->end (), v2->begin (), v2->end ());
diff --git a/backends/zypp/zypp-utils.h b/backends/zypp/zypp-utils.h
index 459141c..95d084c 100644
--- a/backends/zypp/zypp-utils.h
+++ b/backends/zypp/zypp-utils.h
@@ -115,7 +115,7 @@ PkGroupEnum get_enum_group (std::string group);
* Returns a list of packages that match the specified package_name.
*/
std::vector<zypp::sat::Solvable> * zypp_get_packages_by_name (PkBackend *backend, const gchar *package_name,
- const zypp::ResKind kind, gboolean include_local);
+ const zypp::ResKind kind, gboolean include_local = TRUE);
/**
* Returns a list of packages that owns the specified file.
commit 4be91a61af938b60dda052e1f3a73b12725be0ef
Author: Michael Meeks <michael.meeks at novell.com>
Date: Tue Sep 7 11:56:17 2010 +0100
Include patches in 'resolve' results so we can:
$ pkcon update <patch>
Fixes bmc#2059, thanks to xiaoqiang0
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 32e0227..d3621ff 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -1218,9 +1218,10 @@ backend_resolve_thread (PkBackend *backend)
for (uint i = 0; package_ids[i]; i++) {
std::vector<zypp::sat::Solvable> *v;
- /* Build a list of packages with this name */
+ /* build a list of packages with this name */
v = zypp_get_packages_by_name (backend, package_ids[i], zypp::ResKind::package, TRUE);
+ /* add source packages */
if (!pk_bitfield_contain (_filters, PK_FILTER_ENUM_NOT_SOURCE)) {
std::vector<zypp::sat::Solvable> *src;
src = zypp_get_packages_by_name (backend, package_ids[i], zypp::ResKind::srcpackage, TRUE);
@@ -1228,6 +1229,12 @@ backend_resolve_thread (PkBackend *backend)
delete (src);
}
+ /* include patches too */
+ std::vector<zypp::sat::Solvable> *v2;
+ v2 = zypp_get_packages_by_name (backend, package_ids[i], zypp::ResKind::patch, TRUE);
+ v->insert (v->end (), v2->begin (), v2->end ());
+ delete (v2);
+
zypp::sat::Solvable newest;
std::vector<zypp::sat::Solvable> pkgs;
commit e2dbeaa07e1bc5b81459aeb8d841b357bc2898bb
Author: Michael Meeks <michael.meeks at novell.com>
Date: Tue Sep 7 11:50:40 2010 +0100
add development package support to filtering
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index 74be3d1..99129c4 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -565,6 +565,17 @@ system_and_package_are_x86 (zypp::sat::Solvable item)
!strcmp (zypp::ZConfig::defaultSystemArchitecture ().asString().c_str(), "i686"));
}
+static gboolean
+zypp_package_is_devel (const zypp::sat::Solvable &item)
+{
+ const std::string &name = item.name();
+ const char *cstr = name.c_str();
+
+ return ( g_str_has_suffix (cstr, "-debuginfo") ||
+ g_str_has_suffix (cstr, "-debugsource") ||
+ g_str_has_suffix (cstr, "-devel") );
+}
+
/* should we filter out this package ? */
gboolean
zypp_filter_solvable (PkBitfield filters, const zypp::sat::Solvable &item)
@@ -573,8 +584,6 @@ zypp_filter_solvable (PkBitfield filters, const zypp::sat::Solvable &item)
if (!filters)
return FALSE;
- //const gchar * myarch = zypp::ZConfig::defaultSystemArchitecture().asString().c_str();
-
for (guint i = 0; i < PK_FILTER_ENUM_LAST; i++) {
if ((filters & pk_bitfield_value (i)) == 0)
continue;
@@ -593,17 +602,18 @@ zypp_filter_solvable (PkBitfield filters, const zypp::sat::Solvable &item)
system_and_package_are_x86 (item))
return TRUE;
}
- if (i == PK_FILTER_ENUM_SOURCE && !(zypp::isKind<zypp::SrcPackage>(item))) {
+ if (i == PK_FILTER_ENUM_SOURCE && !(zypp::isKind<zypp::SrcPackage>(item)))
return TRUE;
- }
- if (i == PK_FILTER_ENUM_NOT_SOURCE && zypp::isKind<zypp::SrcPackage>(item)) {
+ if (i == PK_FILTER_ENUM_NOT_SOURCE && zypp::isKind<zypp::SrcPackage>(item))
+ return TRUE;
+ if (i == PK_FILTER_ENUM_DEVELOPMENT && !zypp_package_is_devel (item))
+ return TRUE;
+ if (i == PK_FILTER_ENUM_NOT_DEVELOPMENT && zypp_package_is_devel (item))
return TRUE;
- }
-
- // FIXME: add enums
- // PK_FILTER_ENUM_DEVELOPMENT,
- // PK_FILTER_ENUM_NOT_DEVELOPMENT,
+ // FIXME: add more enums - cf. libzif logic and pk-enum.h
+ // PK_FILTER_ENUM_SUPPORTED,
+ // PK_FILTER_ENUM_NOT_SUPPORTED,
}
return FALSE;
commit 2f70f1c459cd9028b626a10b122b76dec2b0ae5a
Author: Michael Meeks <michael.meeks at novell.com>
Date: Tue Sep 7 11:27:30 2010 +0100
Calculate sizes for patches correctly: bmo#2281, bnc#559802,
Thanks to Gary Lin and xiaoqiang0
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index d2548ec..32e0227 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -498,13 +498,25 @@ backend_get_details_thread (PkBackend *backend)
(gulong)rpmHeader->tag_archivesize ()); // gulong size
} else {
+ gulong size = 0;
+
+ if (zypp::isKind<zypp::Patch>(package)) {
+ zypp::PoolItem item = zypp::ResPool::instance ().find (package);
+ zypp::Patch::constPtr patch = zypp::asKind<zypp::Patch>(item);
+
+ zypp::sat::SolvableSet content = patch->contents ();
+ for (zypp::sat::SolvableSet::const_iterator it = content.begin (); it != content.end (); it++)
+ size += it->lookupNumAttribute (zypp::sat::SolvAttr::downloadsize);
+ } else
+ size = package.lookupNumAttribute (zypp::sat::SolvAttr::downloadsize);
+
pk_backend_details (backend,
- package_ids[i],
- package.lookupStrAttribute (zypp::sat::SolvAttr::license).c_str (), //pkg->license ().c_str (),
- group,
- package.lookupStrAttribute (zypp::sat::SolvAttr::description).c_str (), //pkg->description ().c_str (),
- "TODO", //pkg->url ().c_str (),
- ((gulong)package.lookupNumAttribute (zypp::sat::SolvAttr::downloadsize) * 1024)); //pkg->size ());
+ package_ids[i],
+ package.lookupStrAttribute (zypp::sat::SolvAttr::license).c_str (),
+ group,
+ package.lookupStrAttribute (zypp::sat::SolvAttr::description).c_str (),
+ "TODO", // pkg->url ().c_str (),
+ size * 1024);
}
} catch (const zypp::target::rpm::RpmException &ex) {
commit b99f29f8b38ed6b6a5958e51cc70fcd4b69b9c1d
Author: Michael Meeks <michael.meeks at novell.com>
Date: Tue Sep 7 11:11:10 2010 +0100
rename to clarify zypp_check_restart method.
remove premature require_restart emission in update_packages_thread
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 4d94fd1..d2548ec 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -846,7 +846,7 @@ backend_get_update_detail_thread (PkBackend *backend)
if (zypp::isKind<zypp::Patch>(solvable)) {
zypp::Patch::constPtr patch = zypp::asKind<zypp::Patch>(item);
- zypp_get_restart (restart, patch);
+ zypp_check_restart (&restart, patch);
// Building links like "http://www.distro-update.org/page?moo;Bugfix release for kernel;http://www.test.de/bgz;test domain"
for (zypp::Patch::ReferenceIterator it = patch->referencesBegin (); it != patch->referencesEnd (); it ++) {
@@ -922,9 +922,8 @@ backend_update_system_thread (PkBackend *backend)
std::set<zypp::PoolItem> *candidates = zypp_get_updates (backend);
- if (_updating_self) {
+ if (_updating_self)
_updating_self = FALSE;
- }
pk_backend_set_percentage (backend, 80);
std::set<zypp::PoolItem>::iterator cb = candidates->begin (), ce = candidates->end (), ci;
@@ -933,7 +932,7 @@ backend_update_system_thread (PkBackend *backend)
zypp::ResStatus &status = ci->status ();
status.setToBeInstalled (zypp::ResStatus::USER);
if (zypp::isKind<zypp::Patch>(ci->resolvable ())) {
- zypp_get_restart (restart, zypp::asKind<zypp::Patch>(ci->resolvable ()));
+ zypp_check_restart (&restart, zypp::asKind<zypp::Patch>(ci->resolvable ()));
}
}
@@ -1600,7 +1599,7 @@ backend_update_packages_thread (PkBackend *backend)
if (_updating_self) {
egg_debug ("updating self and setting restart");
- pk_backend_require_restart (backend, PK_RESTART_ENUM_SESSION, "Package Management System updated - restart needed");
+ restart = PK_RESTART_ENUM_SESSION;
_updating_self = FALSE;
}
for (guint i = 0; package_ids[i]; i++) {
@@ -1608,7 +1607,7 @@ backend_update_packages_thread (PkBackend *backend)
zypp::PoolItem item = zypp::ResPool::instance ().find (solvable);
item.status ().setToBeInstalled (zypp::ResStatus::USER);
zypp::Patch::constPtr patch = zypp::asKind<zypp::Patch>(item.resolvable ());
- zypp_get_restart (restart, patch);
+ zypp_check_restart (&restart, patch);
}
retval = zypp_perform_execution (backend, UPDATE, FALSE);
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index d78b118..74be3d1 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -812,22 +812,22 @@ zypp_get_updates (PkBackend *backend)
return candidates;
}
-gboolean
-zypp_get_restart (PkRestartEnum &restart, zypp::Patch::constPtr patch)
+void
+zypp_check_restart (PkRestartEnum *restart, zypp::Patch::constPtr patch)
{
- if (patch == NULL)
- return false;
+ if (patch == NULL || restart == NULL)
+ return;
// set the restart flag if a restart is needed
- if (restart != PK_RESTART_ENUM_SYSTEM && (patch->reloginSuggested () ||
- patch->restartSuggested () ||
- patch->rebootSuggested ())) {
- if (patch->reloginSuggested () || patch->restartSuggested ())
- restart = PK_RESTART_ENUM_SESSION;
- if (patch->rebootSuggested ())
- restart = PK_RESTART_ENUM_SYSTEM;
+ if (*restart != PK_RESTART_ENUM_SYSTEM &&
+ ( patch->reloginSuggested () ||
+ patch->restartSuggested () ||
+ patch->rebootSuggested ()) ) {
+ if (patch->reloginSuggested () || patch->restartSuggested ())
+ *restart = PK_RESTART_ENUM_SESSION;
+ if (patch->rebootSuggested ())
+ *restart = PK_RESTART_ENUM_SYSTEM;
}
- return true;
}
gboolean
diff --git a/backends/zypp/zypp-utils.h b/backends/zypp/zypp-utils.h
index c1de0ee..459141c 100644
--- a/backends/zypp/zypp-utils.h
+++ b/backends/zypp/zypp-utils.h
@@ -169,7 +169,7 @@ std::set<zypp::PoolItem> * zypp_get_updates (PkBackend *backend);
/**
* Sets the restart flag of a patch
*/
-gboolean zypp_get_restart (PkRestartEnum &restart, zypp::Patch::constPtr patch);
+void zypp_check_restart (PkRestartEnum *restart, zypp::Patch::constPtr patch);
/**
* simulate, or perform changes in pool to the system
commit cddf170210ace28fa8046946456c4c28a4f80497
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 6 17:03:52 2010 +0100
trivial: post release version bump
diff --git a/RELEASE b/RELEASE
index 3023208..f34d672 100644
--- a/RELEASE
+++ b/RELEASE
@@ -2,10 +2,10 @@ PackageKit Release Notes
1. Write NEWS entries for PackageKit in the same format as usual.
-git shortlog PACKAGEKIT_0_6_7.. | grep -i -v trivial | grep -v Merge > NEWS.new
+git shortlog PACKAGEKIT_0_6_8.. | grep -i -v trivial | grep -v Merge > NEWS.new
--------------------------------------------------------------------------------
-Version 0.6.8
+Version 0.6.9
~~~~~~~~~~~~~
Released: 2010-xx-xx
@@ -28,8 +28,8 @@ Bugfixes:
4. Commit changes in PackageKit git:
-git commit -a -m "Release version 0.6.8"
-git tag -s -f -m "Release 0.6.8" PACKAGEKIT_0_6_8
+git commit -a -m "Release version 0.6.9"
+git tag -s -f -m "Release 0.6.9" PACKAGEKIT_0_6_9
<gpg password>
git push --tags
git push
@@ -54,9 +54,9 @@ git push
10. Send an email to packagekit at lists.freedesktop.org
=================================================
-Subject: PackageKit 0.6.8 released!
+Subject: PackageKit 0.6.9 released!
-Today I released PackageKit 0.6.8.
+Today I released PackageKit 0.6.9.
PackageKit release notes: http://cgit.freedesktop.org/packagekit/tree/NEWS
diff --git a/configure.ac b/configure.ac
index 3e9c29e..9c8ed98 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@ AC_PREREQ(2.63)
m4_define([pk_major_version], [0])
m4_define([pk_minor_version], [6])
-m4_define([pk_micro_version], [8])
+m4_define([pk_micro_version], [9])
m4_define([pk_version],
[pk_major_version.pk_minor_version.pk_micro_version])
More information about the PackageKit-commit
mailing list