Beispiel #1
0
def _link_existing_install(env_path, existing_install):
    """
    Reuse an existing S2E installation at ```existing_install``` in the new
    environment at ```env_path```.
    """
    # Check that the expected S2E installation directories exist
    for dir_ in ('bin', os.path.join('share', 'libs2e')):
        if not os.path.isdir(os.path.join(existing_install, dir_)):
            raise CommandError('Invalid S2E installation - ``%s`` does not '
                               'exist. Are you sure that this directory '
                               'contains a valid S2E installation?' % dir_)

    logger.info('Using existing S2E installation at %s', existing_install)

    # Clear out anything that may exist in the new environment's install dir
    new_install = os.path.join(env_path, 'install')
    shutil.rmtree(new_install, True)

    # We must use an absolute path for symlinks
    os.symlink(os.path.abspath(existing_install), new_install)

    # We still need to clone guest-images repo, because it contains info about
    # the location of images
    guest_images_repo = CONSTANTS['repos']['images']['build']
    repos.git_clone_to_source(env_path, guest_images_repo)
Beispiel #2
0
def _get_img_sources(env_path):
    """
    Download the S2E image repositories.
    """
    git_repos = CONSTANTS['repos']['images'].values()

    for git_repo in git_repos:
        repos.git_clone_to_source(env_path, git_repo)
Beispiel #3
0
    def _clone_kernel(self):
        kernels_root = self.source_path(CONSTANTS['repos']['images']['linux'])
        if os.path.exists(kernels_root):
            logger.info('Kernel repository already exists in %s', kernels_root)
            return

        logger.info('Cloning kernels repository to %s', kernels_root)

        kernels_repo = CONSTANTS['repos']['images']['linux']
        repos.git_clone_to_source(self.env_path(), kernels_repo)
Beispiel #4
0
def _install_binary_dist(env_path, prefix):
    # We must use an absolute path because of symlinks
    prefix = os.path.abspath(prefix)

    logger.info('Using S2E installation in %s', prefix)
    install = os.path.join(env_path, 'install')
    shutil.rmtree(install, True)
    os.symlink(prefix, install)

    # We still need to clone guest-images repo, because it contains info about
    # the location of images
    guest_images_repo = CONSTANTS['repos']['images']['build']
    repos.git_clone_to_source(env_path, guest_images_repo)
Beispiel #5
0
    def _update_repo(self, git_repo):
        git_repo_dir = self.env_path('source', git_repo)

        if not os.path.isdir(git_repo_dir):
            logger.warning('%s does not exist. Cloning.', git_repo)
            repos.git_clone_to_source(self._env_dir, git_repo)
            return

        try:
            logger.info('Updating %s', git_repo)
            git.bake(C=git_repo_dir).pull(_out=sys.stdout,
                                          _err=sys.stderr,
                                          _fg=True)
        except ErrorReturnCode as e:
            raise CommandError(e)

        # Success!
        logger.info('Updated %s', git_repo)
Beispiel #6
0
def _get_testsuite_sources(env_path):
    """
    Download the testsuite repository
    """
    git_repo = CONSTANTS['repos']['testsuite']
    repos.git_clone_to_source(env_path, git_repo)