]> code.ossystems Code Review - openembedded-core.git/commitdiff
recipetool: create: don't create extra files directory unconditionally
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Sun, 13 Mar 2016 19:59:03 +0000 (08:59 +1300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 20 Mar 2016 07:44:01 +0000 (07:44 +0000)
The extra directory next to the recipe should only be created if there
are files to put into it; currently only the npm plugin does this. I
didn't notice the issue earlier because the test was actually able to
succeed under these circumstances if the recipe file came first in the
directory listing, which was a fault in my original oe-selftest test;
apparently on some YP autobuilder machines the order came out reversed.

With this change we can put the oe-selftest test that highlighted the
issue back to the way it was, with an extra check to reinforce that only
a single file should be created.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/selftest/recipetool.py
scripts/lib/recipetool/create.py

index 72ee11087611c2fa23d5fa7c1ef76aeb05c92b51..a04ee87db2b03f1fe7de3738a27d6d2bbd1ad9b8 100644 (file)
@@ -410,9 +410,11 @@ class RecipetoolTests(RecipetoolBase):
         srcuri = 'http://www.dest-unreach.org/socat/download/socat-%s.tar.bz2' % pv
         result = runCmd('recipetool create %s -o %s' % (srcuri, temprecipe))
         dirlist = os.listdir(temprecipe)
-        if len(dirlist) < 1 or not os.path.isfile(os.path.join(temprecipe, 'socat_%s.bb' % pv)):
+        if len(dirlist) > 1:
+            self.fail('recipetool created more than just one file; output:\n%s\ndirlist:\n%s' % (result.output, str(dirlist)))
+        if len(dirlist) < 1 or not os.path.isfile(os.path.join(temprecipe, dirlist[0])):
             self.fail('recipetool did not create recipe file; output:\n%s\ndirlist:\n%s' % (result.output, str(dirlist)))
-        self.assertIn('socat_%s.bb' % pv, dirlist, 'Recipe file incorrectly named')
+        self.assertEqual(dirlist[0], 'socat_%s.bb' % pv, 'Recipe file incorrectly named')
         checkvars = {}
         checkvars['LICENSE'] = set(['Unknown', 'GPLv2'])
         checkvars['LIC_FILES_CHKSUM'] = set(['file://COPYING.OpenSSL;md5=5c9bccc77f67a8328ef4ebaf468116f4', 'file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263'])
index 1649e406e9226482ee12b0f5c9fea1949d438a69..bb9fb9b049272a27b18405fbd523a9591738c281 100644 (file)
@@ -604,13 +604,14 @@ def create_recipe(args):
                 sys.exit(1)
 
     # Move any extra files the plugins created to a directory next to the recipe
-    if outfile == '-':
-        extraoutdir = pn
-    else:
-        extraoutdir = os.path.join(os.path.dirname(outfile), pn)
-    bb.utils.mkdirhier(extraoutdir)
-    for destfn, extrafile in extrafiles.iteritems():
-        shutil.move(extrafile, os.path.join(extraoutdir, destfn))
+    if extrafiles:
+        if outfile == '-':
+            extraoutdir = pn
+        else:
+            extraoutdir = os.path.join(os.path.dirname(outfile), pn)
+        bb.utils.mkdirhier(extraoutdir)
+        for destfn, extrafile in extrafiles.iteritems():
+            shutil.move(extrafile, os.path.join(extraoutdir, destfn))
 
     lines = lines_before
     lines_before = []