[bitbake-devel] [PATCH] bb/utils.py: add break_hardlinks helper

richard.purdie at linuxfoundation.org richard.purdie at linuxfoundation.org
Thu Aug 16 08:52:02 UTC 2018


On Thu, 2018-08-16 at 10:38 +0200, Rasmus Villemoes wrote:
> On 2018-07-10 14:03, Rasmus Villemoes wrote:
> > bb.utils.copyfile is called in a few places with identical src and
> > dst
> > in order to create an st_nlinks==1 version of the file. That that
> > even
> > works relies on an implementation detail of copyfile (namely, that
> > it
> > creates a temporary file and then does a rename). Moreover, it's a
> > waste
> > of time if the file already has st_nlinks==1.
> > 
> > So create a helper that optimizes away the copy in the st_nlinks==1
> > case. Of course, this helper relies on the same implementation
> > detail,
> > but that's now contained within bb.utils itself.
> > 
> > To test that we do at least sometimes hit the no-copy path, I
> > tested
> > locally with
> > 
> >      if sstat[stat.ST_NLINK] == 1:
> > +        bb.note("Woohoo, 2*%d bytes I/O avoided" %
> > sstat[stat.ST_SIZE])
> >          return True
> > 
> > (and the obvious places in oe-core patched), and the do_package log
> > files
> > are indeed filled with woohoo notes.
> 
> Ping.

Merged, sorry about the delay. Was there a corresponding OE-Core patch?
Also, for new API like this we might want to consider adding some tests
to bitbake-selftest...

Cheers,

Richard



More information about the bitbake-devel mailing list