def reprocess(target, source, umask=None):
    target = os.path.abspath(target)
    with utils.ChangeDir(source):
        if umask is not None:
            os.umask(umask)

        print('starting processing of all recipes')
        common.clean_output_dir(target)
        files = git.ls_tree('HEAD')

        # do a dry run to catch errors
        for f in files:
            file = ' '.join(f[3:])
            obj_id = f[2]

            if file.split('.')[-1] != 'rmd':
                continue

            r = common.process(obj_id, '/dev/null', settings.XSLT)

        # do a real run
        for f in files:
            file = f[3]
            obj_id = f[2]

            if file.split('.')[-1] != 'rmd':
                continue

            print('P {}'.format(file))
            common.process(obj_id, common.xml_filename(file, target),
                           settings.XSLT)

        print('finished processing of files')
def reprocess(target, source, umask = None):
  target = os.path.abspath(target)
  with utils.ChangeDir(source):
    if umask is not None:
      os.umask(umask)

    print('starting processing of all recipes')
    common.clean_output_dir(target)
    files = git.ls_tree('HEAD')

    # do a dry run to catch errors
    for f in files:
      file = ' '.join(f[3:])
      obj_id = f[2]

      if file.split('.')[-1] != 'rmd':
        continue

      r = common.process(obj_id, '/dev/null', settings.XSLT)

    # do a real run
    for f in files:
      file = f[3]
      obj_id = f[2]

      if file.split('.')[-1] != 'rmd':
        continue

      print('P {}'.format(file))
      common.process(obj_id, common.xml_filename(file, target), settings.XSLT)

    print('finished processing of files')
Example #3
0
def main():
    os.umask(settings.UMASK)
    (ref, old, new) = sys.argv[1:4]

    print('starting processing of commit')

    cf = git.changed_files(old, new)

    # do a dry run to catch errors
    for f in cf:
        action = f[4]
        file = f[5]
        obj_id = f[3]

        if file.split('.')[-1] != settings.EXTENSION:
            continue

        if action == 'M' or action == 'A' or action == 'C':
            r = common.process(obj_id, '/dev/null', settings.XSLT)

    # do a real run
    for c in cf:
        action = c[4]
        file = c[5]
        obj_id = c[3]

        if file.split('.')[-1] != settings.EXTENSION:
            continue

        filename = common.xml_filename(file, settings.TARGET)

        if action == 'D':
            print('D {}'.format(file))
            try:
                os.remove(filename)
            except FileNotFoundError:
                print(
                    'file to be removed, but could not be found'.format(file))

        elif action == 'M' or action == 'A' or action == 'C':
            print('C {}'.format(file))
            common.process(obj_id, filename, settings.XSLT)

        else:
            print('unknown git status {} of <{}>'.format(action, file),
                  file=sys.stderr)

    index.update_index(settings.TARGET)
    index.update_json(settings.TARGET)

    print('finished processing of commits')
Example #4
0
def main():
    os.umask(settings.UMASK)
    (ref,old,new) = sys.argv[1:4]

    print('starting processing of commit')

    cf = git.changed_files(old,new)

    # do a dry run to catch errors
    for f in cf:
        action = f[4]
        file = f[5]
        obj_id = f[3]
        
        if file.split('.')[-1] != settings.EXTENSION:
            continue

        if action == 'M' or action == 'A' or action == 'C':
            r = common.process(obj_id, '/dev/null', settings.XSLT)

    # do a real run
    for c in cf:
        action = c[4]
        file = c[5]
        obj_id = c[3]
        
        if file.split('.')[-1] != settings.EXTENSION:
            continue

        filename = common.xml_filename(file, settings.TARGET)

        if action == 'D':
            print('D {}'.format(file))
            try:
                os.remove(filename)
            except FileNotFoundError:
                print('file to be removed, but could not be found'.format(file))

        elif action == 'M' or action == 'A' or action == 'C':
            print('C {}'.format(file))
            common.process(obj_id, filename, settings.XSLT)

        else:
            print('unknown git status {} of <{}>'.format(action, file), file=sys.stderr)

    index.update_index(settings.TARGET)
    index.update_json(settings.TARGET)

    print('finished processing of commits')