def regenerate_manifests(
     self, regen_dict, image_owner='allenh1', image_name='ros_gentoo_base'
 ):
     info(
         "Pulling docker image '%s/%s:latest'..." % (
             image_owner, image_name
         )
     )
     dock = Docker()
     dock.pull(image_owner, image_name)
     info('Running docker image...')
     info('Generating manifests...')
     dock.map_directory(
         '/home/%s/.gnupg' % os.getenv('USER'),
         '/root/.gnupg'
     )
     dock.map_directory(self.repo.repo_dir, '/tmp/ros-overlay')
     for key in regen_dict.keys():
         for pkg in regen_dict[key]:
             pkg_dir = '/tmp/ros-overlay/ros-{0}/{1}'.format(key, pkg)
             dock.add_bash_command('cd {0}'.format(pkg_dir))
             dock.add_bash_command('repoman manifest')
     try:
         dock.run(show_cmd=True)
     except docker.errors.ContainerError:
         print(dock.log)
         raise
Beispiel #2
0
def set_up_container():
    d = Docker()
    curr = os.getcwd()
    try:
        d.pull('allenh1', 'asw_test_env')
    except:
        d.build(os.path.realpath("../docker/Dockerfile"))
    info("Using repo in directory '%s'" % os.path.realpath(".."))
    d.map_directory(os.path.realpath(".."), repo_location)
    return d
Beispiel #3
0
 def test_map_dir(self):
     """Test Docker mount directory map"""
     docker_instance = Docker()
     docker_instance.map_directory('/tmp/host', '/tmp/container')
     tmp = dict()
     tmp['/tmp/host'] = dict()
     tmp['/tmp/host']['bind'] = '/tmp/container'
     tmp['/tmp/host']['mode'] = 'rw'
     self.assertEqual(docker_instance.directory_map, tmp)
     docker_instance = Docker()
     docker_instance.map_directory('/tmp/host')
     tmp = dict()
     tmp['/tmp/host'] = dict()
     tmp['/tmp/host']['bind'] = '/tmp/host'
     tmp['/tmp/host']['mode'] = 'rw'
     self.assertEqual(docker_instance.directory_map, tmp)
Beispiel #4
0
 def regenerate_manifests(self, regen_dict):
     info('Building docker image...')
     docker_file = resource_filename('repoman_docker', 'Dockerfile')
     dock = Docker(docker_file, 'gentoo_repoman')
     dock.build()
     info('Running docker image...')
     info('Generating manifests...')
     dock.map_directory('/home/%s/.gnupg' % os.getenv('USER'),
                        '/root/.gnupg')
     dock.map_directory(self.repo.repo_dir, '/tmp/ros-overlay')
     for key in regen_dict.keys():
         for pkg in regen_dict[key]:
             pkg_dir = '/tmp/ros-overlay/ros-{0}/{1}'.format(key, pkg)
             dock.add_bash_command('cd {0}'.format(pkg_dir))
             dock.add_bash_command('repoman manifest')
             dock.add_bash_command('cd /tmp/ros-overlay')
     dock.run(show_cmd=True)