<html><head></head><body><div>On Tue, 2016-02-23 at 18:23 +0000, Burton, Ross wrote:</div><blockquote type="cite"><div dir="ltr"><div><br><div class="gmail_quote">On 23 February 2016 at 18:01, Christopher Larson <span dir="ltr"><<a href="mailto:clarson@kergoth.com" target="_blank">clarson@kergoth.com</a>></span> wrote:<br><blockquote type="cite">db isn't the only recipe doing that. The fetcher unpack method knows where it's unpacking to, I think if anyone should be clearing out the destination first, it should. <br></blockquote></div><div class="gmail_extra"><br></div>If that's true for tarballs, I agree. I was also wondering if this should just be unpack[cleandirs] = ${S}</div></div></blockquote><div><br></div><div>The problem is that the fetcher does not now the target directory, i.e. it does not examine the content of tar/zip. Implementing that logic for different archive formats would require a lot more work.</div><div><br></div><div>Using cleandirs sounds good to me. I.e. something like:</div><div>diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass</div><div>index 1372f38..aa107d4 100644</div><div>--- a/meta/classes/base.bbclass</div><div>+++ b/meta/classes/base.bbclass</div><div>@@ -133,23 +133,15 @@ python base_do_fetch() {</div><div> </div><div> addtask unpack after do_fetch</div><div> do_unpack[dirs] = "${WORKDIR}"</div><div>+do_unpack[cleandirs] = "<a href="mailto:${@d.getVar">${@d.getVar</a>('S', True) if d.getVar('S', True) != d.getVar('WORKDIR', True) else ''}"</div><div> python base_do_unpack() {</div><div> src_uri = (d.getVar('SRC_URI', True) or "").split()</div><div> if len(src_uri) == 0:</div><div> return</div><div> </div><div>- rootdir = d.getVar('WORKDIR', True)</div><div>-</div><div>- # Ensure that we cleanup ${S}/patches</div><div>- # TODO: Investigate if we can remove</div><div>- # the entire ${S} in this case.</div><div>- s_dir = d.getVar('S', True)</div><div>- p_dir = os.path.join(s_dir, 'patches')</div><div>- bb.utils.remove(p_dir, True)</div><div>-</div><div> try:</div><div> fetcher = bb.fetch2.Fetch(src_uri, d)</div><div>- fetcher.unpack(rootdir)</div><div>+ fetcher.unpack(d.getVar('WORKDIR', True))</div><div> except bb.fetch2.BBFetchException as e:</div><div> raise bb.build.FuncFailed(e)</div><div> }</div></body></html>