Ejemplo n.º 1
0
			exit(p.returncode)
		elif options.read_pipe_path:
			with open(options.read_pipe_path, 'r') \
			  as rpipe:
				_detach_and_poll(rpipe,
				                 chain(repo.fds, fds))
		else:
			assert False
tempcloneparser = subparsers.add_parser('clone-temporary')
tempcloneparser.add_argument('repo_url')
tempcloneparser.add_argument('destination', nargs='?')
tempcloneparser.add_argument('--checkout', default=None,
                             help='Must be a branch defined in --ref')
tempcloneparser.add_argument('--ref', action='append', dest='refs',
                             metavar='REF', default=None)
tempcloneparser.add_argument('--describeable', default=False,
                             action='store_true')
group = tempcloneparser.add_mutually_exclusive_group(required=True)
group.add_argument(
    '--read-pipe-path', metavar='FIFO',
    help='Start a background process that will clean up repository '
         'when the pipe is closed.')
group.add_argument(
    '--execute', '-x', nargs=REMAINDER, default=(), metavar='ARGV',
    help='Run %(metavar)s inside the repository and clean up on exit.')
tempcloneparser.set_defaults(func=tempclonerepo)

options = parser.parse_args()
gitcache = load(**vars(options))
options.func(options, gitcache)
Ejemplo n.º 2
0
#!/usr/bin/python

from sys import stdout

import yamlconfig
import configsearch
import gitcache
import yamldoctree
import brdefinitions

# Generates a config file parser
parser = yamlconfig.load(join(dirname(m.__file__), 'config-schema.yaml')
                         for m in (gitcache, yamldoctree, brdefinitions)
                         if exists(join(dirname(m.__file__),
                                        'config-schema.yaml'))
# Generates a command-line parser
parser = parser.parse_files(configsearch.find_config('byod'))
options = parser.parse_argv()

with brdefinitions.load_file_tree(options) as filetree:
	yaml_tree = yamldoctree.YAMLTree(filetree)
	defs = brdefinitions.Definitions(yaml_tree)
	# Resolve refs and generate instructions,
	# including cache IDs for produced artifacts.
	with gitcache.load(options.gitcache) as git_cache:
		build_graph = defs.resolve_build_graph(options.targets, git_cache)

build_graph.serialize(stdout)