From e7ecc2183ced0503c4f9662339f5ab98dc1606ee Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Tue, 9 Aug 2011 17:10:09 +0100 Subject: More inproved comments about loops. --- apt-pkg/orderlist.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'apt-pkg/orderlist.h') diff --git a/apt-pkg/orderlist.h b/apt-pkg/orderlist.h index bbceb3879..2f5c6d0d1 100644 --- a/apt-pkg/orderlist.h +++ b/apt-pkg/orderlist.h @@ -74,7 +74,12 @@ class pkgOrderList : protected pkgCache::Namespace typedef Package **iterator; - // State flags + /* State flags + The Loop flag can be set on a package that is currently being processed by either SmartConfigure or + SmartUnPack. This allows the package manager to tell when a loop has been formed as it will try to + SmartUnPack or SmartConfigure a package with the Loop flag set. It will then either stop (as it knows + that the operation is unnecessary as its already in process), or in the case of the conflicts resolution + in SmartUnPack, use EarlyRemove to resolve the situation. */ enum Flags {Added = (1 << 0), AddPending = (1 << 1), Immediate = (1 << 2), Loop = (1 << 3), UnPacked = (1 << 4), Configured = (1 << 5), @@ -89,6 +94,7 @@ class pkgOrderList : protected pkgCache::Namespace void Flag(PkgIterator Pkg,unsigned long State, unsigned long F) {Flags[Pkg->ID] = (Flags[Pkg->ID] & (~F)) | State;}; inline void Flag(PkgIterator Pkg,unsigned long F) {Flags[Pkg->ID] |= F;}; inline void Flag(Package *Pkg,unsigned long F) {Flags[Pkg->ID] |= F;}; + // IsNow will return true if the Pkg has been not been either configured or unpacked inline bool IsNow(PkgIterator Pkg) {return (Flags[Pkg->ID] & (States & (~Removed))) == 0;}; bool IsMissing(PkgIterator Pkg); void WipeFlags(unsigned long F); -- cgit v1.2.3 From cbea0578989754f70874bf49946b84bf4f7a567e Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 11 Aug 2011 15:35:54 +0100 Subject: Added a RmFlag function to remvoe the loop flag, this should prevent any errors or wierd behaviour because of the loop flag being used at mutiple stages in both SmartUnpack and SmartConfigure. --- apt-pkg/orderlist.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'apt-pkg/orderlist.h') diff --git a/apt-pkg/orderlist.h b/apt-pkg/orderlist.h index 2f5c6d0d1..4e5ea1654 100644 --- a/apt-pkg/orderlist.h +++ b/apt-pkg/orderlist.h @@ -94,6 +94,8 @@ class pkgOrderList : protected pkgCache::Namespace void Flag(PkgIterator Pkg,unsigned long State, unsigned long F) {Flags[Pkg->ID] = (Flags[Pkg->ID] & (~F)) | State;}; inline void Flag(PkgIterator Pkg,unsigned long F) {Flags[Pkg->ID] |= F;}; inline void Flag(Package *Pkg,unsigned long F) {Flags[Pkg->ID] |= F;}; + // RmFlag removes a flag from a package + inline void RmFlag(Package *Pkg,unsigned long F) {Flags[Pkg->ID] &= ~F;}; // IsNow will return true if the Pkg has been not been either configured or unpacked inline bool IsNow(PkgIterator Pkg) {return (Flags[Pkg->ID] & (States & (~Removed))) == 0;}; bool IsMissing(PkgIterator Pkg); -- cgit v1.2.3