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): ...@@ -335,11 +335,12 @@ class Recipe(object):
compile_dir = self.options['path'] compile_dir = self.options['path']
current_dir = os.getcwd() current_dir = os.getcwd()
try: location = self.options['default-location']
os.mkdir(self.options['default-location']) # Clean the install directory if it already exists as it is
except OSError as e: # a remain from a previous failed installation
if e.errno == errno.EEXIST: if os.path.exists(location):
pass shutil.rmtree(location)
os.mkdir(location)
os.chdir(compile_dir) os.chdir(compile_dir)
tmp_path = self.environ['TMP'] tmp_path = self.environ['TMP']
shutil.rmtree(tmp_path, True) shutil.rmtree(tmp_path, True)
...@@ -451,11 +452,11 @@ class Recipe(object): ...@@ -451,11 +452,11 @@ class Recipe(object):
del self.options['compile-directory'] del self.options['compile-directory']
if self.options['shared'] == '': 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']: 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 return parts
def fix_shebang(self, location): 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