logging.debug('%s: got file list %s', chunk_git_url,
                          toplevel_file_list)
            build_system = detect_build_system(toplevel_file_list)

            chunk_ref['build-system'] = build_system.name
            move_dict_entry_last(chunk_ref, 'build-depends')

            changed = True

    return changed


try:
    if migrations.check_definitions_version(TO_VERSION - 1):
        success = migrations.process_definitions(
            kinds=['stratum'],
            validate_cb=validate_chunk_refs,
            modify_cb=ensure_buildsystem_defined_where_needed)
        if not success:
            sys.stderr.write("Migration failed due to one or more warnings.\n")
            sys.exit(1)
        else:
            migrations.set_definitions_version(TO_VERSION)
            sys.stderr.write("Migration completed successfully.\n")
            sys.exit(0)
    else:
        sys.stderr.write("Nothing to do.\n")
        sys.exit(0)
except RuntimeError as e:
    sys.stderr.write("Error: %s\n" % e.message)
    sys.exit(1)
Beispiel #2
0
        if 'morph' in chunk_ref:
            chunk_path = os.path.join('.', chunk_ref['morph'])
            if not os.path.exists(chunk_path):
                # There's no way we can really fix this, so
                # just warn and say the migration failed.
                warnings.warn(
                    "%s points to non-existant file %s" %
                    (contents['name'], chunk_ref['morph']))
                valid = False

    return valid


try:
    if migrations.check_definitions_version(TO_VERSION - 1):
        safe_to_migrate = migrations.process_definitions(
            kinds=['stratum'], validate_cb=check_missing_chunk_morphs)

        if not safe_to_migrate:
            sys.stderr.write(
                "Migration failed due to one or more warnings.\n")
            sys.exit(1)
        else:
            migrations.set_definitions_version(TO_VERSION)
            sys.stdout.write("Migration completed successfully.\n")
            sys.exit(0)
    else:
        sys.stdout.write("Nothing to do.\n")
        sys.exit(0)
except RuntimeError as e:
    sys.stderr.write("Error: %s\n" % e.message)
    sys.exit(1)
Beispiel #3
0
    valid = True

    for extension in contents.get('configuration-extensions', []):
        if extension == 'install-essential-files':
            warnings.warn(
                "%s uses install-essential-files.configure extension, which "
                "was not present in morph.git until commit 423dc974a61f1c0 "
                "(tag baserock-definitions-v3)." % filename)
            valid = False

    return valid


try:
    if migrations.check_definitions_version(TO_VERSION - 1):
        safe_to_migrate = migrations.process_definitions(
            kinds=['system'], validate_cb=check_arch)
        safe_to_migrate = migrations.process_definitions(
            kinds=['system'], validate_cb=check_configuration_extensions)

        if not safe_to_migrate:
            sys.stderr.write(
                "Migration failed due to one or more warnings.\n")
            sys.exit(1)
        else:
            migrations.set_definitions_version(TO_VERSION)
            sys.stdout.write("Migration completed successfully.\n")
            sys.exit(0)
    else:
        sys.stdout.write("Nothing to do.\n")
        sys.exit(0)
except RuntimeError as e:
    assert contents['kind'] == 'stratum'

    changed = False
    for chunk_ref in contents.get('chunks', []):
        if 'build-depends' in chunk_ref:
            if len(chunk_ref['build-depends']) == 0:
                del chunk_ref['build-depends']
                changed = True

    return changed


try:
    if migrations.check_definitions_version(TO_VERSION - 1):
        success = migrations.process_definitions(
            path='.', kinds=['stratum'],
            validate_cb=check_empty_build_depends,
            modify_cb=remove_empty_build_depends)
        if success:
            migrations.set_definitions_version(TO_VERSION)
            sys.stdout.write("Migration completed successfully.\n")
            sys.exit(0)
        else:
            sys.stderr.write("Migration failed due to warnings.\n")
            sys.exit(1)
    else:
        sys.stdout.write("Nothing to do.\n")
        sys.exit(0)
except RuntimeError as e:
    sys.stderr.write("Error: %s\n" % e.message)
    sys.exit(1)
            logging.debug(
                '%s: got file list %s', chunk_git_url, toplevel_file_list)
            build_system = detect_build_system(toplevel_file_list)

            chunk_ref['build-system'] = build_system.name
            move_dict_entry_last(chunk_ref, 'build-depends')

            changed = True

    return changed


try:
    if migrations.check_definitions_version(TO_VERSION - 1):
        success = migrations.process_definitions(
            kinds=['stratum'],
            validate_cb=validate_chunk_refs,
            modify_cb=ensure_buildsystem_defined_where_needed)
        if not success:
            sys.stderr.write(
                "Migration failed due to one or more warnings.\n")
            sys.exit(1)
        else:
            migrations.set_definitions_version(TO_VERSION)
            sys.stderr.write("Migration completed successfully.\n")
            sys.exit(0)
    else:
        sys.stderr.write("Nothing to do.\n")
        sys.exit(0)
except RuntimeError as e:
    sys.stderr.write("Error: %s\n" % e.message)
    sys.exit(1)
    assert contents['kind'] == 'chunk'

    valid = True

    if 'strip-commands' in contents:
        warnings.warn(
            "%s has strip-commands, which are not valid until version 5" %
            filename)
        valid = False

    return valid


try:
    if migrations.check_definitions_version(TO_VERSION - 1):
        safe_to_migrate = migrations.process_definitions(
            kinds=['chunk'], validate_cb=check_strip_commands)

        if not safe_to_migrate:
            sys.stderr.write(
                "Migration failed due to one or more warnings.\n")
            sys.exit(1)
        else:
            migrations.set_definitions_version(TO_VERSION)
            sys.stdout.write("Migration completed successfully.\n")
            sys.exit(0)
    else:
        sys.stdout.write("Nothing to do.\n")
        sys.exit(0)
except RuntimeError as e:
    sys.stderr.write("Error: %s\n" % e.message)
    sys.exit(1)
def check_strip_commands(contents, filename):
    assert contents["kind"] == "chunk"

    valid = True

    if "strip-commands" in contents:
        warnings.warn("%s has strip-commands, which are not valid until version 5" % filename)
        valid = False

    return valid


try:
    if migrations.check_definitions_version(TO_VERSION - 1):
        safe_to_migrate = migrations.process_definitions(kinds=["chunk"], validate_cb=check_strip_commands)

        if not safe_to_migrate:
            sys.stderr.write("Migration failed due to one or more warnings.\n")
            sys.exit(1)
        else:
            migrations.set_definitions_version(TO_VERSION)
            sys.stdout.write("Migration completed successfully.\n")
            sys.exit(0)
    else:
        sys.stdout.write("Nothing to do.\n")
        sys.exit(0)
except RuntimeError as e:
    sys.stderr.write("Error: %s\n" % e.message)
    sys.exit(1)