Exemplo n.º 1
0
def copy_osg_post_scripts(stage_dir_abs, post_scripts_dir, dver, basearch):
    """Copy osg scripts from post_scripts_dir to the stage2 directory"""

    if not os.path.isdir(post_scripts_dir):
        raise Error("script directory (%r) not found" % post_scripts_dir)

    post_scripts_dir_abs = os.path.abspath(post_scripts_dir)
    dest_dir = os.path.join(stage_dir_abs, "osg")
    safe_makedirs(dest_dir)

    for script_name in 'osg-post-install', 'osgrun.in':
        script_path = os.path.join(post_scripts_dir_abs, script_name)
        dest_path = os.path.join(dest_dir, script_name)
        try:
            shutil.copyfile(script_path, dest_path)
            os.chmod(dest_path, 0755)
        except EnvironmentError as err:
            raise Error("unable to copy script (%r) to (%r): %s" %
                        (script_path, dest_dir, str(err)))

    try:
        envsetup.write_setup_in_files(dest_dir, dver, basearch)
    except EnvironmentError as err:
        raise Error(
            "unable to create environment script templates (setup.csh.in, setup.sh.in): %s"
            % str(err))
Exemplo n.º 2
0
def fix_gsissh_config_dir(stage_dir_abs):
    """A hack to fix gsissh, which looks for $GLOBUS_LOCATION/etc/ssh.
    The actual files are in $OSG_LOCATION/etc/gsissh, so make a symlink.
    Make it a relative symlink so we don't have to fix it in post-install.

    """
    if not os.path.isdir(os.path.join(stage_dir_abs, 'etc/gsissh')):
        return

    try:
        usr_etc = os.path.join(stage_dir_abs, 'usr/etc')
        safe_makedirs(usr_etc)
        os.symlink('../../etc/gsissh', os.path.join(usr_etc, 'ssh'))
    except EnvironmentError as err:
        raise Error("unable to fix gsissh config dir: %s" % str(err))
Exemplo n.º 3
0
def fix_gsissh_config_dir(stage_dir_abs):
    """A hack to fix gsissh, which looks for $GLOBUS_LOCATION/etc/ssh.
    The actual files are in $OSG_LOCATION/etc/gsissh, so make a symlink.
    Make it a relative symlink so we don't have to fix it in post-install.

    """
    if not os.path.isdir(os.path.join(stage_dir_abs, 'etc/gsissh')):
        return

    try:
        usr_etc = os.path.join(stage_dir_abs, 'usr/etc')
        safe_makedirs(usr_etc)
        os.symlink('../../etc/gsissh', os.path.join(usr_etc, 'ssh'))
    except EnvironmentError as err:
        raise Error("unable to fix gsissh config dir: %s" % str(err))
Exemplo n.º 4
0
def remove_empty_dirs_from_tarball(tarball, topdir):
    tarball_abs = os.path.abspath(tarball)
    tarball_base = os.path.basename(tarball)
    extract_dir = tempfile.mkdtemp()
    oldcwd = os.getcwd()
    try:
        os.chdir(extract_dir)
        subprocess.check_call(['tar', '-xzf', tarball_abs])
        subprocess.call(['find', topdir, '-type', 'd', '-empty', '-delete'])
        # hack to preserve these directories
        safe_makedirs(os.path.join(topdir, 'var/lib/osg-ca-certs'))
        safe_makedirs(os.path.join(topdir, 'etc/fetch-crl.d'))
        subprocess.check_call(['tar', '-czf', tarball_base, topdir])
        shutil.copy(tarball_base, tarball_abs)
    finally:
        os.chdir(oldcwd)
        shutil.rmtree(extract_dir)
Exemplo n.º 5
0
def remove_empty_dirs_from_tarball(tarball, topdir, recreate_dirs=None):
    recreate_dirs = recreate_dirs or []
    tarball_abs = os.path.abspath(tarball)
    tarball_base = os.path.basename(tarball)
    extract_dir = tempfile.mkdtemp()
    oldcwd = os.getcwd()
    try:
        os.chdir(extract_dir)
        subprocess.check_call(['tar', '-xzf', tarball_abs])
        subprocess.call(['find', topdir, '-type', 'd', '-empty', '-delete'])
        # hack to preserve these directories
        for rdir in recreate_dirs:
            safe_makedirs(os.path.join(topdir, rdir.lstrip('/')))
        subprocess.check_call(['tar', '-czf', tarball_base, topdir])
        shutil.copy(tarball_base, tarball_abs)
    finally:
        os.chdir(oldcwd)
        shutil.rmtree(extract_dir)
Exemplo n.º 6
0
def copy_osg_post_scripts(stage_dir_abs, post_scripts_dir, dver, basearch):
    """Copy osg scripts from post_scripts_dir to the stage2 directory"""

    if not os.path.isdir(post_scripts_dir):
        raise Error("script directory (%r) not found" % post_scripts_dir)

    post_scripts_dir_abs = os.path.abspath(post_scripts_dir)
    dest_dir = os.path.join(stage_dir_abs, "osg")
    safe_makedirs(dest_dir)

    for script_name in 'osg-post-install', 'osgrun.in':
        script_path = os.path.join(post_scripts_dir_abs, script_name)
        dest_path = os.path.join(dest_dir, script_name)
        try:
            shutil.copyfile(script_path, dest_path)
            os.chmod(dest_path, 0755)
        except EnvironmentError as err:
            raise Error("unable to copy script (%r) to (%r): %s" % (script_path, dest_dir, str(err)))

    try:
        envsetup.write_setup_in_files(dest_dir, dver, basearch)
    except EnvironmentError as err:
        raise Error("unable to create environment script templates (setup.csh.in, setup.sh.in): %s" % str(err))