summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2023-08-02 09:24:35 +0200
committerSteve Sakoman <steve@sakoman.com>2023-08-18 03:57:05 -1000
commit9e2b1cdc04cbb8482d032abc9eade4b646c41fc4 (patch)
tree3d2e2a5017cd9181e78c537fa9c43220924a8c85
parentc40f486385c71b9df04cf90515beed7182d4de98 (diff)
downloadpoky-9e2b1cdc04cbb8482d032abc9eade4b646c41fc4.tar.gz
devtool/upgrade: raise an error if extracting source produces more than one directory
This can happen if running unpack task produces unrelated files and directories (e.g. if recipe_qa or other tasks run); in this case it's better to stop, rather than allow devtool to continue and error out much later with a message that has nothing to do with where the problem originated. The idea here was to handle tarballs that don't contain a top level directory and thus the source tree is one level up; this basically never happens, and if it does we should find a less brittle way to handle such tarballs. (From OE-Core rev: 814672f886b5859524dcc0c285d916a1ccca6605) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit b25e922b271794906b22450c7e6cc18fcab51ff8) Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--scripts/lib/devtool/upgrade.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index 6c4a62b558..e015a85982 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -35,6 +35,8 @@ def _get_srctree(tmpdir):
35 dirs = scriptutils.filter_src_subdirs(tmpdir) 35 dirs = scriptutils.filter_src_subdirs(tmpdir)
36 if len(dirs) == 1: 36 if len(dirs) == 1:
37 srctree = os.path.join(tmpdir, dirs[0]) 37 srctree = os.path.join(tmpdir, dirs[0])
38 else:
39 raise DevtoolError("Cannot determine where the source tree is after unpacking in {}: {}".format(tmpdir,dirs))
38 return srctree 40 return srctree
39 41
40def _copy_source_code(orig, dest): 42def _copy_source_code(orig, dest):