[OE-core] [wic patch 1/5] wic: Catch errors during image files clean-up

Andreas Reichel Andreas.Reichel at tngtech.com
Wed May 3 08:45:52 UTC 2017


On Tue, May 02, 2017 at 03:56:38PM +0300, Ed Bartosh wrote:
> On Fri, Apr 21, 2017 at 02:11:41PM +0200, Andreas J. Reichel wrote:
> > Handle exception if a file could not be deleted during clean-up of
> > unwanted files, thus preventing a failure of wic in this case.
> 
> Can you explain why partition images can't be deleted?
> As wic creates them it's not obvious why it can't remove them.
> 
As part of our internal project, we generate artifacts to be packaged
in further archives and only contain one single partition image. The
image generation process is solely done by wic and post-processing
scripts, therefore we always used the .p2 file for the root partition,
that had already peen patched (for example fstab by wic). Suddenly the
file was missing and CI was not working anymore. Here, instead of
just stating, that *nobody* needs these files, my idea was to
introduce a parameter, so that people can chose if they want them or
not. 
We do not want to generate any image artifacts with bitbake to keep
things separated better.
Just saving space is not a valid argument to me because building
a system with bitbake needs up to 50 GB and if you do it for several
machines, a few hundred MB should not matter. However, no problem for me
to delete them per standard, if you say *most* people don' use them.

> > Signed-off-by: Andreas Reichel <andreas.reichel.ext at siemens.com>
> > Signed-off-by: Jan Kiszka <jan.kiszka at siemens.com>
> > Signed-off-by: Daniel Wagner <daniel.wagner at siemens.com>
> > 
> > ---
> >  scripts/lib/wic/plugins/imager/direct.py | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
> > index f2e6127331..d6b47ff0bb 100644
> > --- a/scripts/lib/wic/plugins/imager/direct.py
> > +++ b/scripts/lib/wic/plugins/imager/direct.py
> > @@ -541,7 +541,12 @@ class PartitionedImage():
> >      def cleanup(self):
> >          # remove partition images
> >          for image in set(self.partimages):
> > -            os.remove(image)
> > +            try:
> > +                os.remove(image)
> > +            except IOError as e:
> > +                logger.warning(
> > +                    "Could not delete file. {0}: I/O error ({1}): {2}\n".format(
> > +                    image, e.errno, e.strerror))
> >  
> >      def assemble(self):
> >          logger.debug("Installing partitions")
> > -- 
> > 2.11.0
> > 
> > -- 
> > _______________________________________________
> > Openembedded-core mailing list
> > Openembedded-core at lists.openembedded.org
> > http://lists.openembedded.org/mailman/listinfo/openembedded-core
> 
> -- 
> --
> Regards,
> Ed

-- 
Andreas Reichel 
Dipl.-Phys. (Univ.) 
Software Consultant

Andreas.Reichel at tngtech.com 
+49-174-3180074

TNG Technology Consulting GmbH, Betastr. 13a, 85774 Unterföhring
Geschäftsführer: Henrik Klagges, Christoph Stock, Dr. Robert Dahlke
Sitz: Unterföhring * Amtsgericht München * HRB 135082
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20170503/a990e4b3/attachment-0002.sig>


More information about the Openembedded-core mailing list