[Yum-devel] [PATCH 1/3] Use TMPDIR, if set, for save_ts. BZ 723280.

James Antill james at fedoraproject.org
Tue Jul 19 22:28:13 UTC 2011


On Tue, 2011-07-19 at 23:38 +0300, Ville Skyttä wrote:
> On 07/19/2011 10:53 PM, James Antill wrote:
> > ---
> >  yum/__init__.py |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> > 
> > diff --git a/yum/__init__.py b/yum/__init__.py
> > index 12c2bdd..3f7f619 100644
> > --- a/yum/__init__.py
> > +++ b/yum/__init__.py
> > @@ -5242,7 +5242,8 @@ class YumBase(depsolve.Depsolve):
> >          
> >          if not filename:
> >              prefix = 'yum_save_tx-%s' % time.strftime('%Y-%m-%d-%H-%M')
> > -            fd,filename = tempfile.mkstemp(suffix='.yumtx', prefix=prefix)
> > +            fd,filename = tempfile.mkstemp(suffix='.yumtx', prefix=prefix,
> > +                                           dir=os.getenv('TMPDIR'))
> 
> I think mkstemp() takes TMPDIR into account automatically.
> 
> $ TMPDIR= python -c "import tempfile; print tempfile.mkstemp()"
> (3, '/tmp/tmpGLrxRr')
> 
> $ TMPDIR=/var/tmp python -c "import tempfile; print tempfile.mkstemp()"
> (3, '/var/tmp/tmpI5k6CO')

 Yeh, looking at the code it should work ... but there's a lot of magic
involved (testing it with yum did DTRT though).
 I've removed the patch for now, and I'll ask the pungi guys if they
know what the problem is.



More information about the Yum-devel mailing list