mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[FIX] runbot: make checkout safer wrt addons layout
Avoid errors/crash when the server/addons directory in the build branch contains symlinks. Exhibited by e.g. odoo/odoo#16720
This commit is contained in:
parent
f889f2095c
commit
63b997a4ed
@ -851,12 +851,16 @@ class runbot_build(osv.osv):
|
|||||||
# move all addons to server addons path
|
# move all addons to server addons path
|
||||||
for module in uniq_list(glob.glob(build._path('addons/*')) + modules_to_move):
|
for module in uniq_list(glob.glob(build._path('addons/*')) + modules_to_move):
|
||||||
basename = os.path.basename(module)
|
basename = os.path.basename(module)
|
||||||
if os.path.exists(build._server('addons', basename)):
|
addon_path = build._server('addons', basename)
|
||||||
|
if os.path.exists(addon_path):
|
||||||
build._log(
|
build._log(
|
||||||
'Building environment',
|
'Building environment',
|
||||||
'You have duplicate modules in your branches "%s"' % basename
|
'You have duplicate modules in your branches "%s"' % basename
|
||||||
)
|
)
|
||||||
shutil.rmtree(build._server('addons', basename))
|
if os.path.islink(addon_path) or os.path.isfile(addon_path):
|
||||||
|
os.remove(addon_path)
|
||||||
|
else:
|
||||||
|
shutil.rmtree(addon_path)
|
||||||
shutil.move(module, build._server('addons'))
|
shutil.move(module, build._server('addons'))
|
||||||
|
|
||||||
available_modules = [
|
available_modules = [
|
||||||
|
Loading…
Reference in New Issue
Block a user