Commit c42c6aee authored by Nicolas Wavrant's avatar Nicolas Wavrant

clean install directory if it already exists during recipe's installation

parent ba793c61
......@@ -335,11 +335,12 @@ class Recipe(object):
compile_dir = self.options['path']
current_dir = os.getcwd()
try:
os.mkdir(self.options['default-location'])
except OSError as e:
if e.errno == errno.EEXIST:
pass
location = self.options['default-location']
# Clean the install directory if it already exists as it is
# a remain from a previous failed installation
if os.path.exists(location):
shutil.rmtree(location)
os.mkdir(location)
os.chdir(compile_dir)
tmp_path = self.environ['TMP']
shutil.rmtree(tmp_path, True)
......@@ -451,11 +452,11 @@ class Recipe(object):
del self.options['compile-directory']
if self.options['shared'] == '':
parts.append(self.options['default-location'])
parts.append(location)
self.fix_shebang(self.options['default-location'])
self.fix_shebang(location)
if self.options['shared']:
slapos.recipe.downloadunpacked.make_read_only_recursively(self.options['default-location'])
slapos.recipe.downloadunpacked.make_read_only_recursively(location)
return parts
def fix_shebang(self, location):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment