Menu

#11 Merge key with multiple levels, invalid merge-expand output

open
nobody
None
minor
bug
2022-08-03
2022-08-02
No

Hi! I noticed tool doesnt produce correct results on a bit complex YAML key merge operation.
yaml merge-expand 1.yaml output.yaml

In attached example chromeos_nocompress_variants supposed to have override of default variables.

1 Attachments

Discussion

  • Anthon van der Neut

    Any indication of what is incorrect and/or a program to reproduce that?
    Doesn't it load, do you get wrong data, do you get wrong output when dumped?

     
  • Anthon van der Neut

    • status: open --> pending
     
  • Denys Fedoryshchenko

    It generate wrong data, here is example what is in output:

    chromeos_nocompress_variants:
    <skipped some lines>
          x86_64:
            base_defconfig: cros://chromeos-5.10/x86_64/chromiumos-x86_64.flavour.config
            fragments: [x86-chromebook]
            extra_configs:
            - cros://chromeos-5.10/x86_64/chromeos-amd-stoneyridge.flavour.config+x86-chromebook
            - cros://chromeos-5.10/x86_64/chromeos-intel-denverton.flavour.config+x86-chromebook
            - cros://chromeos-5.10/x86_64/chromeos-intel-pineview.flavour.config+x86-chromebook
            - cros://chromeos-5.10/x86_64/chromiumos-x86_64.flavour.config+x86-chromebook
    

    but supposed to be

    chromeos_nocompress_variants:
    <skipped some lines>
          x86_64:
            base_defconfig: cros://chromeos-5.10/x86_64/chromiumos-x86_64.flavour.config
            fragments: [x86-chromebook]
            extra_configs:
            - cros://chromeos-5.10/x86_64/chromeos-amd-stoneyridge.flavour.config+x86-chromebook+CONFIG_MODULE_COMPRESS=n
            - cros://chromeos-5.10/x86_64/chromeos-intel-denverton.flavour.config+x86-chromebook+CONFIG_MODULE_COMPRESS=n
            - cros://chromeos-5.10/x86_64/chromeos-intel-pineview.flavour.config+x86-chromebook+CONFIG_MODULE_COMPRESS=n
            - cros://chromeos-5.10/x86_64/chromiumos-x86_64.flavour.config+x86-chromebook+CONFIG_MODULE_COMPRESS=n
    
     

    Last edit: Denys Fedoryshchenko 2022-08-02
  • Denys Fedoryshchenko

    import yaml
    with open("1.yaml") as f:
        y = yaml.safe_load(f)
    #    print(y)
    with open(r'merged.yaml', 'w') as file:
        yaml.dump(y, file)
    

    python yaml have different opinion:
    you can just run that and view merged result, which does replace values such as "cros://chromeos-5.10/x86_64/chromeos-amd-stoneyridge.flavour.config+x86-chromebook" to "cros://chromeos-5.10/x86_64/chromeos-amd-stoneyridge.flavour.config+x86-chromebook+CONFIG_MODULE_COMPRESS=n"
    and compare it with result your tool is generating on

    yaml merge-expand 1.yaml merged2.yaml
    
     
  • Denys Fedoryshchenko

    To remove unnecessary noise, here is a bit different example that can be compared same way:

     

Log in to post a comment.