On Fri, 2011-02-11 at 09:29 +0200, Panu Matilainen wrote:
> Push needs to store the previous vsflags value, not the new one,
> so that pop can restore. Also pop was trying to access already removed
> value from the "stack", without much success.

 Nack ... in the case everything goes through the wrapper the code is
functionality identical for those two APIs. It differs if people start
mixing direct calls to setVSFlags() ... which I'm not sure we want to
care about. Also, the current code allows us to see what the current
flags are by looking at tsflags[-1].

> ---
>  rpmUtils/transaction.py |    6 ++----
>  1 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/rpmUtils/transaction.py b/rpmUtils/transaction.py
> index 897c30f..569c8a1 100644
> --- a/rpmUtils/transaction.py
> +++ b/rpmUtils/transaction.py
> @@ -79,12 +79,10 @@ class TransactionWrapper:
>      # set value, and we can potentiall debug a bit
>      # easier
>      def pushVSFlags(self, flags):
> -        self.tsflags.append(flags)
> -        self.ts.setVSFlags(self.tsflags[-1])
> +        self.tsflags.append(self.ts.setVSFlags(flags))

 Before:
   # tsflags = [1,2]
   # current = 2
   push x
   # tsflags = [1,2,x]
   set tsflags[-1] # == set x

 After:

   # tsflags = [1]
   push <ret>
   # tsflags = [1,2]
   set x

>      def popVSFlags(self):
> -        del self.tsflags[-1]
> -        self.ts.setVSFlags(self.tsflags[-1])
> +        self.ts.setVSFlags(self.tsflags.pop())

 Before:
   # tsflags = [1,2,x]
   # current = x
   del tsflags[-1]
   set tsflags[-1]
   # tsflags = [1,2]
   # current = 2

 After:

   # tsflags = [1,2]
   # current = x
   set pop
   # tsflags = [1]
   # current = 2

_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to