From: Stefan Schubert Date: Thu, 27 Mar 2008 16:52:14 +0000 (+0000) Subject: - Added new state: WeakField The solvable will be recommended/suggested by X-Git-Tag: 6.6.0~1201 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c6a52f9dde605a4e1f7a89667b41f7e208fb40c;p=platform%2Fupstream%2Flibzypp.git - Added new state: WeakField The solvable will be recommended/suggested by a to be installed/deleted solvable. - Removed not needed state. --- diff --git a/zypp/ResStatus.cc b/zypp/ResStatus.cc index 77a06636c..a0fa4b0fb 100644 --- a/zypp/ResStatus.cc +++ b/zypp/ResStatus.cc @@ -23,9 +23,7 @@ namespace zypp const ResStatus ResStatus::toBeInstalled (UNINSTALLED, UNDETERMINED, TRANSACT); const ResStatus ResStatus::toBeInstalledSoft (UNINSTALLED, UNDETERMINED, TRANSACT, SOFT_INSTALL); const ResStatus ResStatus::toBeUninstalled (INSTALLED, UNDETERMINED, TRANSACT); - const ResStatus ResStatus::impossible (UNINSTALLED, UNDETERMINED, KEEP_STATE, EXPLICIT_INSTALL, EXPLICIT_REMOVE, IMPOSSIBLE); const ResStatus ResStatus::toBeUninstalledSoft (INSTALLED, UNDETERMINED, TRANSACT, EXPLICIT_INSTALL, SOFT_REMOVE); - const ResStatus ResStatus::toBeUninstalledDueToUnlink (INSTALLED, UNDETERMINED, TRANSACT, EXPLICIT_INSTALL, DUE_TO_UNLINK); const ResStatus ResStatus::toBeUninstalledDueToObsolete(INSTALLED, UNDETERMINED, TRANSACT, EXPLICIT_INSTALL, DUE_TO_OBSOLETE); const ResStatus ResStatus::toBeUninstalledDueToUpgrade (INSTALLED, UNDETERMINED, TRANSACT, EXPLICIT_INSTALL, DUE_TO_UPGRADE); const ResStatus ResStatus::installed (INSTALLED, UNDETERMINED); @@ -99,12 +97,14 @@ namespace zypp else if (obj.isByUser()) str << "u"; str << (obj.isToBeUninstalledDueToObsolete() ? "O" : - ( obj.isToBeUninstalledDueToUnlink() ? "L" : ( obj.isToBeUninstalledDueToUpgrade() ? "U" : - ( obj.isToBeInstalledSoft() ? "S" : "_" ) ) ) ); + ( obj.isToBeInstalledSoft() ? "S" : "_" ) ) ); - str << (obj.isSeen() ? "@" : - ( obj.isImpossible() ? "X" : "" ) ); + str << (obj.isSeen() ? "@" : "" ); + + str << (obj.isRecommended() ? "r" : "" ); + + str << (obj.isSuggested() ? "s" : "" ); return str; } diff --git a/zypp/ResStatus.h b/zypp/ResStatus.h index 799641e3b..58040b93e 100644 --- a/zypp/ResStatus.h +++ b/zypp/ResStatus.h @@ -42,6 +42,8 @@ namespace zypp * \li \c TransactDetailField Reason why the Resolvable transacts. * Splitted into \c InstallDetailValue and \c RemoveDetailValue * dependent on the kind of transaction. + * \li \c WeakField The solvable will be recommended/suggested by + * a to be installed/deleted solvable. * */ class ResStatus @@ -59,13 +61,14 @@ namespace zypp typedef uint16_t FieldType; typedef bit::BitField BitFieldType; // Bit Ranges within FieldType defined by 1st bit and size: - typedef bit::Range StateField; - typedef bit::Range EstablishField; - typedef bit::Range TransactField; - typedef bit::Range TransactByField; - typedef bit::Range TransactDetailField; - typedef bit::Range SolverStateField; - typedef bit::Range LicenceConfirmedField; + typedef bit::Range StateField; + typedef bit::Range EstablishField; + typedef bit::Range TransactField; + typedef bit::Range TransactByField; + typedef bit::Range TransactDetailField; + typedef bit::Range SolverStateField; + typedef bit::Range LicenceConfirmedField; + typedef bit::Range WeakField; // enlarge FieldType if more bit's needed. It's not yet // checked by the compiler. //@} @@ -120,14 +123,12 @@ namespace zypp EXPLICIT_REMOVE = bit::RangeValue::value, SOFT_REMOVE = bit::RangeValue::value, DUE_TO_OBSOLETE = bit::RangeValue::value, - DUE_TO_UNLINK = bit::RangeValue::value, - DUE_TO_UPGRADE = bit::RangeValue::value + DUE_TO_UPGRADE = bit::RangeValue::value }; enum SolverStateValue { NORMAL = bit::RangeValue::value, // default, notthing special SEEN = bit::RangeValue::value, // already seen during ResolverUpgrade - IMPOSSIBLE = bit::RangeValue::value // impossible to install }; enum LicenceConfirmedValue @@ -135,6 +136,14 @@ namespace zypp LICENCE_UNCONFIRMED = bit::RangeValue::value, LICENCE_CONFIRMED = bit::RangeValue::value }; + + enum WeakValue + { + NO_WEAK = bit::RangeValue::value, + SUGGESTED = bit::RangeValue::value, + RECOMMENDED = bit::RangeValue::value, + SUGGESTED_AND_RECOMMENDED = bit::RangeValue::value + }; //@} public: @@ -164,6 +173,28 @@ namespace zypp void setLicenceConfirmed( bool toVal_r = true ) { fieldValueAssign( toVal_r ? LICENCE_CONFIRMED : LICENCE_UNCONFIRMED ); } + public: + + bool isRecommended() const + { return fieldValueIs( RECOMMENDED ); } + + bool isSuggested() const + { return fieldValueIs( SUGGESTED ); } + + void setRecommended( bool toVal_r = true ) + { if (isSuggested()) + fieldValueAssign( toVal_r ? SUGGESTED_AND_RECOMMENDED : SUGGESTED ); + else + fieldValueAssign( toVal_r ? RECOMMENDED : NO_WEAK ); + } + + void setSuggested( bool toVal_r = true ) + { if (isRecommended()) + fieldValueAssign( toVal_r ? SUGGESTED_AND_RECOMMENDED : RECOMMENDED ); + else + fieldValueAssign( toVal_r ? SUGGESTED : NO_WEAK ); + } + public: // These two are IMMUTABLE! @@ -249,9 +280,6 @@ namespace zypp bool isToBeUninstalledDueToObsolete () const { return isToBeUninstalled() && fieldValueIs( DUE_TO_OBSOLETE ); } - bool isToBeUninstalledDueToUnlink() const - { return isToBeUninstalled() && fieldValueIs( DUE_TO_UNLINK ); } - bool isToBeUninstalledDueToUpgrade() const { return isToBeUninstalled() && fieldValueIs( DUE_TO_UPGRADE ); } @@ -488,13 +516,6 @@ namespace zypp return true; } - bool setToBeUninstalledDueToUnlink ( ) - { - if (!setToBeUninstalled (SOLVER)) return false; - fieldValueAssign(DUE_TO_UNLINK); - return true; - } - bool setToBeUninstalledDueToObsolete ( ) { if (!setToBeUninstalled (SOLVER)) return false; @@ -582,21 +603,12 @@ namespace zypp bool isSeen () const { return fieldValueIs( SEEN ); } - bool isImpossible () const - { return fieldValueIs( IMPOSSIBLE ); } - bool setSeen (bool value) { fieldValueAssign( value ? SEEN : NORMAL ); return true; } - bool setImpossible (bool value) - { - fieldValueAssign( value ? IMPOSSIBLE : NORMAL ); - return true; - } - bool setStatus( ResStatus newStatus_r ) { // State field is immutable! @@ -627,7 +639,6 @@ namespace zypp static const ResStatus unneeded; // uninstalled, unneeded static const ResStatus needed; // uninstalled, incomplete static const ResStatus incomplete; // installed, incomplete - static const ResStatus impossible; // uninstallable //@} private: