diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2022-08-19 09:27:27 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-21 22:51:42 +0100 |
commit | f2fb3c54a34ce925b7d3dff8955b78cb0e54e7f0 (patch) | |
tree | b452661b17739ebd9fda54830495f8ba4fa6c20f /scripts/lib/devtool/standard.py | |
parent | 5aca6cdb59e844e7b573bd669be2e980093bbdb5 (diff) | |
download | poky-f2fb3c54a34ce925b7d3dff8955b78cb0e54e7f0.tar.gz |
devtool: do not leave behind source trees in workspace/sources
These are typically auto-extracted with modify/upgrade from recipes
and can be easily recreated. On the rare occasions where they need
to be reused, they are still available under workspace/attic (which
is already used for old recipes and appends), so nothing gets lost.
This avoids the annoyance of devtool refusing to proceed because
there is a previous source tree in workspace/sources.
For independent source trees behave as before: do nothing.
Adjust the test that previously deleted those trees by hand.
(From OE-Core rev: 9bfb95d070d68d5ab5adfe0ea096f5fbf9cad8b0)
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>
Diffstat (limited to 'scripts/lib/devtool/standard.py')
-rw-r--r-- | scripts/lib/devtool/standard.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index c98bfe8195..e3b74ab8f0 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
@@ -1975,9 +1975,19 @@ def _reset(recipes, no_clean, remove_work, config, basepath, workspace): | |||
1975 | shutil.rmtree(srctreebase) | 1975 | shutil.rmtree(srctreebase) |
1976 | else: | 1976 | else: |
1977 | # We don't want to risk wiping out any work in progress | 1977 | # We don't want to risk wiping out any work in progress |
1978 | logger.info('Leaving source tree %s as-is; if you no ' | 1978 | if srctreebase.startswith(os.path.join(config.workspace_path, 'sources')): |
1979 | 'longer need it then please delete it manually' | 1979 | from datetime import datetime |
1980 | % srctreebase) | 1980 | preservesrc = os.path.join(config.workspace_path, 'attic', 'sources', "{}.{}".format(pn,datetime.now().strftime("%Y%m%d%H%M%S"))) |
1981 | logger.info('Preserving source tree in %s\nIf you no ' | ||
1982 | 'longer need it then please delete it manually.\n' | ||
1983 | 'It is also possible to reuse it via devtool source tree argument.' | ||
1984 | % preservesrc) | ||
1985 | bb.utils.mkdirhier(os.path.dirname(preservesrc)) | ||
1986 | shutil.move(srctreebase, preservesrc) | ||
1987 | else: | ||
1988 | logger.info('Leaving source tree %s as-is; if you no ' | ||
1989 | 'longer need it then please delete it manually' | ||
1990 | % srctreebase) | ||
1981 | else: | 1991 | else: |
1982 | # This is unlikely, but if it's empty we can just remove it | 1992 | # This is unlikely, but if it's empty we can just remove it |
1983 | os.rmdir(srctreebase) | 1993 | os.rmdir(srctreebase) |