Esempio n. 1
0
 def run(self,
         path,
         package=None,
         system_config=None,
         erlang_vsn: str = None) -> bool:
     enot_cache = system_config.cache.official_cache
     rel_dir = self.params['rel_dir']
     erts_tarball = None
     try:
         erts_tarball, erts_path = Release.__download_erts(
             enot_cache, package.path, erlang_vsn)
         compiler = RelxCompiler(package)
         compiler.ensure_tool(system_config.cache.local_cache)
         if not compiler.compile(params=['-i', package.path],
                                 erts=erts_path):
             return False
         local = join(rel_dir, '_rel')
         remove_dir(local)
         shutil.copytree(join(package.path, '_rel'), local)
         return True
     except subprocess.CalledProcessError as e:
         error(str(e))
         return False
     except RuntimeError as e:
         error(str(e))
         return False
     finally:
         if erts_tarball is not None:
             remove(erts_tarball)
Esempio n. 2
0
 def fetch_package(self, dep: Package):
     temp_path = join(self.temp_dir, dep.name)
     info('fetch ' + temp_path)
     remove_dir(temp_path)
     vsn, need_lock = self.__get_vsn(dep)
     hash_str = LocalCache.fetch(dep.url, vsn, temp_path)
     dep.update_from_cache(temp_path)
     if need_lock:
         self.set_lock(dep, hash_str)
Esempio n. 3
0
 def __rescan_deps(self):
     deps_dir = join(self.project.path, 'deps')
     deps = listdir(deps_dir)
     for dep in deps:  # TODO clear old locks too?
         if dep not in self.packages:
             dep_path = join(deps_dir, dep)
             info('Drop dead dep: ' + dep_path)
             if os.path.islink(dep_path):
                 os.remove(dep_path)
             else:
                 remove_dir(dep_path)
Esempio n. 4
0
 def test_add_from_package(self, mock_conf):
     mock_conf.return_value = self.conf_file
     pack_path = join(self.test_dir, 'test_app')
     set_git_url(pack_path, 'http://github/comtihon/test_app')
     set_git_tag(pack_path, '1.0.0')
     builder = Builder.init_from_path(pack_path)
     self.assertEqual(True, builder.build())
     builder.package()
     new_package_path = join(self.test_dir, 'test_app.ep')
     # remove source project, test should work only with enot package
     copy_file(join(pack_path, 'test_app.ep'), new_package_path)
     remove_dir(pack_path)
     package = Package.from_package(new_package_path)
     self.assertEqual(False, builder.system_config.cache.exists_local(package))
     # local cache is used here to determine tmp dir
     local_cache = builder.system_config.cache.local_cache
     builder.system_config.cache.add_fetched(local_cache, package)
     self.assertEqual(True, builder.system_config.cache.exists_local(package))
Esempio n. 5
0
 def tearDown(self):
     remove_dir(test.get_test_dir(self.test_name))
Esempio n. 6
0
 def tearDown(self):
     super().tearDown()
     remove_dir(join(self.test_dir, 'conf'))