예제 #1
0
    def git_install(self,
                    local_directory,
                    repository,
                    install_commands,
                    branch='master',
                    configure_options=None,
                    make_options=None):

        get_terminal_screen()
        git_exec = find('git')
        system('%s clone %s --single-branch --branch %s %s' %
               (git_exec, repository, branch, local_directory))

        chdir(local_directory)
        for cmd in install_commands:
            if cmd == './configure' and configure_options is not None:
                res = system(cmd + ' ' + configure_options)
            elif cmd == 'make' and make_options is not None:
                res = system(cmd + ' ' + make_options)
            else:
                res = system(cmd)
            if res != 0:
                sleep(2)
                raise Exception('Executing install command \'%s\' failed' %
                                cmd)

        exec_path = '%s/%s' % (self.install_dir,
                               TARGETS[self.current_target]['rel_path'])
        if exists(exec_path):
            self.config.set('TARGETS', self.current_target, exec_path)
예제 #2
0
 def apt_install(self, package):
     get_terminal_screen()
     res = system('sudo apt-get install %s' % package)
     sleep(1.5)
     if res == 0:
         self.config.set('TARGETS', self.current_target, package)
         return True
     else:
         return False
예제 #3
0
    def git_install(self, local_directory, repository, install_commands,
                    branch='master', apt_deps=None, configure_options=None,
                    make_options=None, install_script=None):

        get_terminal_screen()

        if apt_deps != '':
            system('echo')
            system('echo [*] Installing dependencies...')
            res = system('sudo apt-get install %s' % apt_deps)
            sleep(1.5)
            if res != 0:
                raise Exception('Fail to install dependencies %s' % apt_deps)

        system('echo')
        system('echo [*] Installing from git...')
        git_exec = find('git')
        system('%s clone %s --single-branch --branch %s %s'  % 
               (git_exec, repository, branch, local_directory) )

        chdir(local_directory)

        if install_script is None or install_script.strip() == '':
            for cmd in install_commands:
                if cmd == './configure' and configure_options is not None:
                    res = system(cmd + ' ' + configure_options)
                elif cmd == 'make' and make_options is not None:
                    res = system(cmd + ' ' + make_options)
                else:
                    res = system(cmd)
                if res != 0:
                    sleep(2)
                    raise Exception('Executing install command \'%s\' failed' % cmd)

        else:
            res = system('echo ' + install_script + ' ' + configure_options)
            res = system(install_script + ' ' + configure_options)
            if res != 0:
                raise Exception('Install script %s failed' % install_script)

        exec_path = '%s/%s' % (self.install_dir,
                               TARGETS[self.current_target]['rel_path'])
        if exists(exec_path):
            self.config.set('TARGETS', self.current_target, exec_path)