shared-repo-pack: Move out any existing build directory to the trash delection handler

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2018-01-24 14:05:20 +00:00
parent 98f101ee93
commit f92af9cb9a
2 changed files with 8 additions and 0 deletions

View File

@ -6,6 +6,7 @@
"BUILD_HISTORY_FORKPUSH" : {"poky-contrib:ross/mut" : "poky:master", "poky:master-next" : "poky:master"},
"REPO_STASH_DIR" : "/home/pokybuild/git/mirror",
"TRASH_DIR" : "/home/pokybuild/git/trash",
"defaults" : {
"NEEDREPOS" : ["poky"],

View File

@ -29,12 +29,19 @@ scriptsdir = os.path.dirname(os.path.realpath(__file__))
ourconfig = utils.loadconfig(__file__)
stashdir = ourconfig["REPO_STASH_DIR"]
trashdir = ourconfig["TRASH_DIR"]
needrepos = utils.getconfigvar("NEEDREPOS", ourconfig, target, None)
with open(repojson) as f:
repos = json.load(f)
# Move any existing directory to the trash collection directory (deferred ionice deletion)
if os.path.exists(targetdir):
trashdest = trashdir + "/" + target + "/" + str(int(time.time())) + '-' + str(random.randrange(100, 100000, 2))
utils.mkdir(trashdest)
subprocess.check_call(['mv', targetdir, trashdest])
for repo in sorted(repos.keys()):
if repo not in needrepos:
continue