Exemplo n.º 1
0
 def on_delete(self):
     try:
         util.rmtree(self.prefix)
     except Exception as err:  # pylint: disable=broad-except
         if os.path.exists(self.prefix):
             LOGGER.error("Could not remove experiment data at '%s': %s",
                          self.prefix, err)
Exemplo n.º 2
0
 def _create_project(self, args):
     project_name = args.project_name
     options = [project_name]
     try:
         project_create_cmd.main(options)
     except ConfigurationError:
         PROJECT_STORAGE.disconnect_filesystem()
         util.rmtree(PROJECT_STORAGE.prefix, ignore_errors=True)
         raise
     else:
         project_select_cmd.main([project_name])
Exemplo n.º 3
0
    def destroy(self, *args, **kwargs):
        """Disconnects the database and filesystem and recursively deletes the filesystem.

        Args:
            *args: Passed through to :any:`disconnect_filesystem`.
            **kwargs: Keyword arguments for :any:`disconnect_filesystem` or :any:`shutil.rmtree`.
        """
        self.disconnect_filesystem(*args, **kwargs)
        ignore_errors = kwargs.pop('ignore_errors', False)
        onerror = kwargs.pop('onerror', None)
        if self._prefix:
            util.rmtree(self._prefix, ignore_errors=ignore_errors, onerror=onerror)
            self._prefix = None
Exemplo n.º 4
0
 def run(self):
     from taucmdr import util
     util.rmtree('system', ignore_errors=True)
     # Update package version number
     for line in fileinput.input(os.path.join(PACKAGE_TOPDIR, "packages", "taucmdr", "__init__.py"), inplace=1):
         # fileinput.input with inplace=1 redirects stdout to the input file ... freaky
         sys.stdout.write('__version__ = "%s"\n' % self.distribution.get_version() 
                          if line.startswith('__version__') else line)
     if self.web:
         self._build_web_release()
     elif self.all:
         self._build_all()
     else:
         self._build_target_release()
Exemplo n.º 5
0
 def _create_project(self, args):
     project_name = args.project_name
     options = [project_name]
     if args.tau_options:
         options.append('--force-tau-options')
         options.extend([i for i in args.tau_options])
     try:
         project_create_cmd.main(options)
     except ConfigurationError:
         PROJECT_STORAGE.disconnect_filesystem()
         util.rmtree(PROJECT_STORAGE.prefix, ignore_errors=True)
         raise
     else:
         project_select_cmd.main([project_name])
Exemplo n.º 6
0
 def install(self, force_reinstall=False):
     """Execute the installation sequence in a sanitized environment.
     
     Modifies the system by building and installing software.
     
     Args:
         force_reinstall (bool): If True, reinstall even if the software package passes verification.
         
     Raises:
         SoftwarePackageError: Installation failed.
     """
     for pkg in self.dependencies.itervalues():
         pkg.install(force_reinstall)
     if self.unmanaged or not force_reinstall:
         try:
             return self.verify()
         except SoftwarePackageError as err:
             if self.unmanaged:
                 raise SoftwarePackageError(
                     "%s source package is unavailable and the installation at '%s' "
                     "is invalid: %s" %
                     (self.title, self.install_prefix, err),
                     "Specify source code path or URL to enable package reinstallation."
                 )
             elif not force_reinstall:
                 LOGGER.debug(err)
     LOGGER.info("Installing %s to '%s'", self.title, self.install_prefix)
     if os.path.isdir(self.install_prefix):
         LOGGER.info("Cleaning %s installation prefix '%s'", self.title,
                     self.install_prefix)
         util.rmtree(self.install_prefix, ignore_errors=True)
     with new_os_environ(), util.umask(0o002):
         try:
             self._src_prefix = self._prepare_src()
             self.installation_sequence()
             self.set_group()
         except Exception as err:
             LOGGER.info("%s installation failed: %s", self.title, err)
             #util.add_error_stack(self._src_prefix)
             raise
         else:
             # Delete the decompressed source code to save space. The source archive is retained.
             LOGGER.debug("Deleting '%s'", self._src_prefix)
             util.rmtree(self._src_prefix, ignore_errors=True)
             self._src_prefix = None
     # Verify the new installation
     LOGGER.info("Verifying %s installation...", self.title)
     return self.verify()
Exemplo n.º 7
0
 def run(self):
     from taucmdr import util
     util.rmtree('system', ignore_errors=True)
     # Update package version number
     for line in fileinput.input(os.path.join(PACKAGE_TOPDIR, "packages",
                                              "taucmdr", "__init__.py"),
                                 inplace=1):
         # fileinput.input with inplace=1 redirects stdout to the input file ... freaky
         sys.stdout.write('__version__ = "%s"\n' %
                          self.distribution.get_version() if line.
                          startswith('__version__') else line)
     if self.web:
         self._build_web_release()
     elif self.all:
         self._build_all()
     else:
         self._build_target_release()
Exemplo n.º 8
0
 def install(self, force_reinstall=False):
     """Execute the installation sequence in a sanitized environment.
     
     Modifies the system by building and installing software.
     
     Args:
         force_reinstall (bool): If True, reinstall even if the software package passes verification.
         
     Raises:
         SoftwarePackageError: Installation failed.
     """
     for pkg in self.dependencies.itervalues():
         pkg.install(force_reinstall)
     if self.unmanaged or not force_reinstall:
         try:
             return self.verify()
         except SoftwarePackageError as err:
             if self.unmanaged:
                 raise SoftwarePackageError("%s source package is unavailable and the installation at '%s' "
                                            "is invalid: %s" % (self.title, self.install_prefix, err),
                                            "Specify source code path or URL to enable package reinstallation.")
             elif not force_reinstall:
                 LOGGER.debug(err)
     LOGGER.info("Installing %s to '%s'", self.title, self.install_prefix)
     if os.path.isdir(self.install_prefix):
         LOGGER.info("Cleaning %s installation prefix '%s'", self.title, self.install_prefix)
         util.rmtree(self.install_prefix, ignore_errors=True)
     with new_os_environ(), util.umask(002):
         try:
             self._src_prefix = self._prepare_src()
             self.installation_sequence()
             self.set_group()
         except Exception as err:
             LOGGER.info("%s installation failed: %s", self.title, err)
             #util.add_error_stack(self._src_prefix)
             raise
         else:
             # Delete the decompressed source code to save space. The source archive is retained.
             LOGGER.debug("Deleting '%s'", self._src_prefix)
             util.rmtree(self._src_prefix, ignore_errors=True)
             self._src_prefix = None
     # Verify the new installation
     LOGGER.info("Verifying %s installation...", self.title)
     return self.verify()
Exemplo n.º 9
0
 def on_delete(self):
     util.rmtree(os.path.join(self.storage.prefix, 'bin', self['name']))
Exemplo n.º 10
0
 def on_delete(self):
     util.rmtree(os.path.join(self.storage.prefix, 'bin', self['name']))
Exemplo n.º 11
0
 def on_delete(self):
     try:
         util.rmtree(self.prefix)
     except Exception as err:  # pylint: disable=broad-except
         if os.path.exists(self.prefix):
             LOGGER.error("Could not remove trial data at '%s': %s", self.prefix, err)