def build_in_docker(destination_path, distribution, top_level, package_uri):
 if (destination_path.exists() and (not destination_path.isdir())):
  raise ValueError('go away')
 volumes = {FilePath('/output'): destination_path, FilePath('/flocker'): top_level}
 if (package_uri == top_level.path):
  package_uri = '/flocker'
 tag = ('clusterhq/build-%s' % (distribution,))
 build_targets_directory = top_level.descendant(BUILD_TARGETS_SEGMENTS)
 build_directory = build_targets_directory.child(distribution)
 requirements_directory = top_level.child('requirements')
 requirements_directory.copyTo(build_directory.child('requirements'))
 return BuildSequence(steps=[DockerBuild(tag=tag, build_directory=build_directory), DockerRun(tag=tag, volumes=volumes, command=[package_uri])])

def build_in_docker ( destination_path , distribution , top_level , package_uri ) : if ( destination_path . exists ( ) and ( not destination_path . isdir ( ) ) ) : raise ValueError ( 'go away' ) volumes = { FilePath ( '/output' ) : destination_path , FilePath ( '/flocker' ) : top_level } if ( package_uri == top_level . path ) : package_uri = '/flocker' tag = ( 'clusterhq/build-%s' % ( distribution , ) ) build_targets_directory = top_level . descendant ( BUILD_TARGETS_SEGMENTS ) build_directory = build_targets_directory . child ( distribution ) requirements_directory = top_level . child ( 'requirements' ) requirements_directory . copyTo ( build_directory . child ( 'requirements' ) ) return BuildSequence ( steps = [ DockerBuild ( tag = tag , build_directory = build_directory ) , DockerRun ( tag = tag , volumes = volumes , command = [ package_uri ] ) ] )
build a flocker package for a given distribution inside a clean docker container of that distribution .