From 856eb04e6e829efdd58a8bf21bcb0039c9e54a99 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Tue, 8 Apr 2008 15:12:11 +0000 Subject: [PATCH] - Fix some Patch and Pattern attributes. - Prepare Patch and Pattern contents. --- zypp/CMakeLists.txt | 3 ++ zypp/Capability.h | 1 - zypp/Locale.h | 2 +- zypp/Message.h | 1 + zypp/Patch.cc | 95 +++++++++++--------------------------------- zypp/Patch.h | 71 +++++++++++++++++++-------------- zypp/Pattern.cc | 24 ++++++----- zypp/Pattern.h | 67 +++++++++++++++++-------------- zypp/ResObject.h | 3 +- zypp/base/LogTools.h | 4 +- zypp/base/Tr1hash.h | 55 +++++++++++++++++++++++++ zypp/pool/PoolTraits.h | 3 +- zypp/sat/SolvAttr.cc | 4 +- zypp/sat/SolvAttr.h | 2 + zypp/sat/Solvable.h | 3 ++ zypp/sat/SolvableSet.cc | 41 +++++++++++++++++++ zypp/sat/SolvableSet.h | 93 +++++++++++++++++++++++++++++++++++++++++++ zypp/sat/WhatProvides.cc | 1 - zypp/sat/detail/PoolImpl.h | 2 +- zypp/sat/detail/PoolMember.h | 11 +---- zypp/ui/PatternExpander.cc | 23 ++++++----- 21 files changed, 339 insertions(+), 170 deletions(-) create mode 100644 zypp/base/Tr1hash.h create mode 100644 zypp/sat/SolvableSet.cc create mode 100644 zypp/sat/SolvableSet.h diff --git a/zypp/CMakeLists.txt b/zypp/CMakeLists.txt index b3c8658..d4136a3 100644 --- a/zypp/CMakeLists.txt +++ b/zypp/CMakeLists.txt @@ -242,6 +242,7 @@ SET( zypp_base_HEADERS base/String.h base/Regex.h base/Sysconfig.h + base/Tr1hash.h base/Unit.h base/WatchFile.h ) @@ -513,6 +514,7 @@ INSTALL( FILES SET( zypp_sat_SRCS sat/Pool.cc sat/Solvable.cc + sat/SolvableSet.cc sat/WhatProvides.cc sat/LocaleSupport.cc sat/LookupAttr.cc @@ -523,6 +525,7 @@ SET( zypp_sat_SRCS SET( zypp_sat_HEADERS sat/Pool.h sat/Solvable.h + sat/SolvableSet.h sat/WhatProvides.h sat/LocaleSupport.h sat/LookupAttr.h diff --git a/zypp/Capability.h b/zypp/Capability.h index 7493690..99d4349 100644 --- a/zypp/Capability.h +++ b/zypp/Capability.h @@ -13,7 +13,6 @@ #define ZYPP_CAPABILITY_H #include -#include #include "zypp/base/SafeBool.h" #include "zypp/base/Deprecated.h" diff --git a/zypp/Locale.h b/zypp/Locale.h index 4540077..d75ffd8 100644 --- a/zypp/Locale.h +++ b/zypp/Locale.h @@ -13,9 +13,9 @@ #define ZYPP_LOCALE_H #include -#include #include "zypp/base/PtrTypes.h" +#include "zypp/base/Tr1hash.h" #include "zypp/IdString.h" #include "zypp/LanguageCode.h" diff --git a/zypp/Message.h b/zypp/Message.h index 0d70b53..3eeb4c8 100644 --- a/zypp/Message.h +++ b/zypp/Message.h @@ -12,6 +12,7 @@ #ifndef ZYPP_MESSAGE_H #define ZYPP_MESSAGE_H +#include "zypp/TranslatedText.h" #include "zypp/ResObject.h" /////////////////////////////////////////////////////////////////// diff --git a/zypp/Patch.cc b/zypp/Patch.cc index 04dd40b..5c35074 100644 --- a/zypp/Patch.cc +++ b/zypp/Patch.cc @@ -10,6 +10,7 @@ * */ #include "zypp/Patch.h" +#include "zypp/Message.h" /////////////////////////////////////////////////////////////////// namespace zypp @@ -40,89 +41,41 @@ namespace zypp // /////////////////////////////////////////////////////////////////// - std::string Patch::id() const - { return std::string(); } - - Date Patch::timestamp() const - { return Date(); } - std::string Patch::category() const - { return std::string(); } + { return lookupStrAttribute( sat::SolvAttr::patchcategory ); } bool Patch::reboot_needed() const - { return false; } + { return lookupBoolAttribute( sat::SolvAttr::needReboot ); } bool Patch::affects_pkg_manager() const - { return false; } + { return lookupBoolAttribute( sat::SolvAttr::needRestart ); } -#warning Implement PATCH::ATOMS -#if 0 - Patch::AtomList Patch::atoms() const + bool Patch::interactive() const { - if ( ! _atomlist ) + if ( reboot_needed() + || ! licenseToConfirm().empty() ) + { + return true; + } + + Patch::Contents c( contents() ); + for_( it, c.begin(), c.end() ) + { + if ( it->isKind( ResKind::message ) + || ! licenseToConfirm().empty() ) { - if ( ! hasBackRef() ) - { - // We are not jet connected to the Resolvable that - // contains our dependencies. - return AtomList(); - } - - // lazy init - _atomlist.reset( new AtomList ); - - // Build the list using the repositories resolvables. - // Installed Patches (no repository) have this method overloaded. - if ( repository() ) - { - const CapSet & requires( self()->dep( Dep::REQUIRES ) ); - const ResStore & store( repository().resolvables() ); - - for_( req, requires.begin(), requires.end() ) - { - // lookup Patch requirements that refer to an Atom, Script or Message. - if ( refersTo( *req ) || refersTo