[Rpm-metadata] replacing os.chdir calls with basedir config option

Dennis Gregorovic dgregor at redhat.com
Fri Nov 11 18:33:21 UTC 2005


On Fri, 2005-11-11 at 13:17 -0500, Paul Nasrat wrote:
> On Fri, 2005-11-11 at 08:44 -0500, Dennis Gregorovic wrote:
> > I've started using createrepo as a library instead of a standalone app.
> > The only issue that I've run into so far is that the os.chdir() calls
> > can cause problems, especially if you have multiple threads using
> > createrepo in parallel.
> > 
> > Attached is a patch that removes the os.chdir() calls and introduces a
> > 'basedir' config option, settable with --basedir and defaulting to
> > os.getcwd().
> 
> There seems to be some whitespace damage in your patches:
> 
> 
> -    def __init__(self, ts, filename, options):
> +    def __init__(self, ts, basedir, filename, options):
>          try:
> -            stats = os.stat(filename)
> +            stats = os.stat(os.path.join(basedir, filename))
>              self.size = stats[6]
>              self.mtime = stats[8]
>              del stats
> -        except OSError, e:
> -            raise MDError, "Error Stat'ing file %s" % filename
> -
> You remove the exception above yet the following is not indented.
> 
>          self.options = options
>          self.localurl = options['baseurl']
>          self.relativepath = filename
> -        fd = returnFD(filename)
> +            fd = returnFD(os.path.join(basedir, filename))
> This is indented for no reason.
> 
> Please can you rediff.
> 
> Paul

Hi Paul,

Hopefully this patch is better.  I have emacs set up to automatically
remove tabs and trailing whitespace, so I normally diff -w, but that may
have screwed up the first patch.

-- Dennis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: createrepo-basedir.patch
Type: text/x-patch
Size: 17293 bytes
Desc: not available
Url : http://lists.baseurl.org/pipermail/rpm-metadata/attachments/20051111/819ec948/attachment.bin 


More information about the Rpm-metadata mailing list