Skip to content

_merge_yaml() doesn't work #7924

@citibeth

Description

@citibeth

See lib/spack/spack/config.py. I've added some debugging printout:

    print('----------------- BEGIN')
    for scope in scopes:
        # read potentially cached data from the scope.

        data = scope.get_section(section)

        # Skip empty configs
        if not data or not isinstance(data, dict):
            continue

        if section not in data:
            tty.warn("Skipping bad configuration file: '%s'" % scope.path)
            continue

        print('********* data', data)
        merged_section = _merge_yaml(merged_section, data)



    print('********* result', merged_section)
    print('----------------- END')

See below for what I get. In my case, 4 YAML files are being merged into a final result. The result is obviously wrong. Note that the result has all: version: [develop], which doesn't appear anywhere in the files being merged. And I'm not a happy camper with Spack trying the develop version on everything it can.

----------------- BEGIN
('********* data', {'packages': {'all': {'compiler': ['gcc', 'intel', 'pgi', 'clang', 'xl', 'nag'], 'providers': {'awk': ['gawk'], 'blas': ['openblas'], 'daal': ['intel-daal'], 'elf': ['elfutils'], 'gl': ['mesa', 'opengl'], 'glu': ['mesa-glu', 'openglu'], 'golang': ['gcc'], 'ipp': ['intel-ipp'], 'java': ['jdk'], 'lapack': ['openblas'], 'mkl': ['intel-mkl'], 'mpe': ['mpe2'], 'mpi': ['openmpi', 'mpich'], 'opencl': ['pocl'], 'openfoam': ['openfoam-com', 'openfoam-org', 'foam-extend'], 'pil': ['py-pillow'], 'pkgconfig': ['pkgconf', 'pkg-config'], 'scalapack': ['netlib-scalapack'], 'szip': ['libszip', 'libaec'], 'tbb': ['intel-tbb'], 'jpeg': ['libjpeg-turbo', 'libjpeg']}, 'paths': {}, 'modules': {}, 'buildable': True, 'version': []}}})
('********* data', {'packages': {'foo-a': {'version': ['develop'], 'paths': {}, 'providers': {}, 'modules': {}, 'buildable': True, 'compiler': []}}})
('********* data', {'packages': {'icebin': {'variants': ['+coupler', '+modele', '+pism'], 'paths': {}, 'providers': {}, 'modules': {}, 'buildable': True, 'version': [], 'compiler': []}}})
('********* data', {'packages': {'icebin': {'version': ['develop'], 'paths': {}, 'providers': {}, 'modules': {}, 'buildable': True, 'compiler': []}}})
('********* result', {'packages': {'all': {'compiler': ['gcc', 'intel', 'pgi', 'clang', 'xl', 'nag'], 'providers': {'awk': ['gawk'], 'blas': ['openblas'], 'daal': ['intel-daal'], 'elf': ['elfutils'], 'gl': ['mesa', 'opengl'], 'glu': ['mesa-glu', 'openglu'], 'golang': ['gcc'], 'ipp': ['intel-ipp'], 'java': ['jdk'], 'lapack': ['openblas'], 'mkl': ['intel-mkl'], 'mpe': ['mpe2'], 'mpi': ['openmpi', 'mpich'], 'opencl': ['pocl'], 'openfoam': ['openfoam-com', 'openfoam-org', 'foam-extend'], 'pil': ['py-pillow'], 'pkgconfig': ['pkgconf', 'pkg-config'], 'scalapack': ['netlib-scalapack'], 'szip': ['libszip', 'libaec'], 'tbb': ['intel-tbb'], 'jpeg': ['libjpeg-turbo', 'libjpeg']}, 'paths': {}, 'modules': {}, 'buildable': True, 'version': ['develop']}, 'foo-a': {'version': ['develop'], 'paths': {}, 'providers': {}, 'modules': {}, 'buildable': True, 'compiler': []}, 'icebin': {'variants': ['+coupler', '+modele', '+pism'], 'paths': {}, 'providers': {}, 'modules': {}, 'buildable': True, 'version': ['develop'], 'compiler': []}}})
----------------- END

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions