def checkout(task): pat = 'git --git-dir={git_dir} archive' pat += ' --format=tar --prefix={package}-{version}/ ' pat += ' ' + getattr(info, 'vcs_tag', 'HEAD') # git tag, branch or hash pat += ' | tar -xvf -' cmd = info.format(pat, git_dir=git_dir.abspath()) return exec_command(task, cmd)
def clone_or_update(task): if osp.exists(git_dir.abspath()): cmd = 'git --git-dir={git_dir} fetch --all --tags' else: cmd = 'git clone --bare {source_url} {git_dir}' cmd = info.format(cmd , git_dir=git_dir.abspath()) return exec_command(task, cmd)
def step(self, name, rule, **kwds): ''' Make a worch installation step. This invokes the build context on the rule with the following augmentations: - the given step name is prefixed with the package name - if the rule is a string (scriptlet) then the worch exec_command is used - successful execution of the rule leads to a worch control file being produced. ''' step_name = '%s_%s' % (self.worch.package, name) # append control file as an additional output target = string2list(kwds.get('target', '')) if not isinstance(target, list): target = [target] cn = self.control_node(name) if not cn in target: target.append(cn) kwds['target'] = target kwds.setdefault('env', self.env) cwd = kwds.get('cwd') if not cwd: cwd = default_step_cwd.get(name) if cwd: cwd = self.worch.format(cwd) cwd = self.make_node(cwd) msg.debug('orch: using cwd for step "%s": %s' % (step_name, cwd.abspath())) kwds['cwd'] = cwd.abspath() depends = self.worch.depends_step(name) after = string2list(kwds.get('after',[])) + depends if after: kwds['after'] = after msg.debug('orch: run %s AFTER: %s' % (step_name, after)) # functionalize scriptlet rulefun = rule if isinstance(rule, type('')): rulefun = lambda t: exec_command(t, rule) # curry the real rule function in order to write control file if successful def runit(t): rc = rulefun(t) if not rc: msg.debug('orch: successfully ran %s' % step_name) cn.write(time.asctime(time.localtime()) + '\n') return rc # msg.debug('orch: step "%s" with %s in %s\nsource=%s\ntarget=%s' % \ # (step_name, rulefun, cwd, kwds.get('source'), kwds.get('target'))) # have to switch group each time as steps are called already asynchronously self.bld.set_group(self.worch.group) return self.bld(name=step_name, rule = runit, **kwds)
def apply_patch(task): src = task.inputs[0].abspath() tgt = task.outputs[0].abspath() cmd = "%s %s %s" % ( info.patch_cmd, src, info.patch_cmd_options ) ret = exec_command(task, cmd) if ret != 0: return ret cmd = "touch %s" % tgt ret = task.exec_command(cmd) return ret
def apply_patch(task): src = task.inputs[0].abspath() tgt = task.outputs[0].abspath() cmd = "%s %s %s" % ( tgen.worch.patch_cmd, src, tgen.worch.patch_cmd_options ) ret = exec_command(task, cmd) return ret
def unpack_task(task): cmd = get_unpacker(info.source_archive_file.abspath(), info.source_dir.abspath()) return exec_command(task, cmd)
def task_func(task): cmd = func(info) return exec_command(task, cmd)
def unpack_task(task): cmd = get_unpacker(task.inputs[0].abspath(), tgen.worch.fnal_products_path) return exec_command(task, cmd)
def unpack_task(task): cmd = get_unpacker(task.inputs[0].abspath()) return exec_command(task, cmd)
def install(task): cmdstr = '{install_cmd} {install_cmd_options}' cmd = tgen.worch.format(cmdstr) return exec_command(task, cmd)
def prepare(task): cmdstr = '{prepare_cmd} {srcdir} {prepare_cmd_std_opts} {prepare_cmd_options}' cmd = tgen.worch.format(cmdstr, srcdir=cmkfile.parent.abspath()) return exec_command(task, cmd)
def build(task): cmdstr = '{build_cmd} {build_cmd_options}' cmd = tgen.worch.format(cmdstr) return exec_command(task, cmd)
def install_task(task): cmd = "%s %s" % (info.install_cmd, info.install_cmd_options) return exec_command(task, cmd)
def build_task(task): cmd = "%s %s" % (info.build_cmd, info.build_cmd_options) return exec_command(task, cmd)
def prepare_task(task): cmd = 'cp -a %s/* %s/' % (info.source_unpacked.abspath(), info.build_dir.abspath()) #msg.debug('orch: PYPACKAGE cmd: %r' % (cmd,)) return exec_command(task, cmd)
def prepare_task(task): cmd = "%s %s" % (info.prepare_cmd, info.prepare_cmd_options) return exec_command(task, cmd)