Skip to content

orc update minimum version check failing for 3.2.0 #68

@soerlemans

Description

@soerlemans

I install orchestra 3.2.0 via virtual environment.
But I face the following issue whilst trying to build revng from source.

(.venv) [hackerman@droid ~/Projects/Git/Public/revng-orchestra] git(develop)
~> orc update
[+] INFO - This is the first time you run orchestra, welcome!
[+] INFO - Creating default user options in .orchestra/config/user_options.yml
[+] INFO - Populating default remotes for repositories and binary archives
[+] INFO - Remember to run `orc update` next
[+] INFO - Checking for redirects in git@github.com:revng/binary-archives
[+] INFO - Redirecting to https://rev.ng/gitlab/revng/binary-archives.git
[+] ERROR - 'NoneType' object has no attribute 'get'
Traceback (most recent call last):

  File "/home/hackerman/Projects/Git/Public/revng-orchestra/.venv/bin/orc", line 8, in <module>
    sys.exit(main())
  File "/home/hackerman/Projects/Git/Public/revng-orchestra/.venv/lib/python3.13/site-packages/orchestra/__init__.py", line 56, in main
    return _main(sys.argv[1:])
> File "/home/hackerman/Projects/Git/Public/revng-orchestra/.venv/lib/python3.13/site-packages/orchestra/__init__.py", line 42, in _main
    return_code = main_parser.parse_and_execute(argv)
  File "/home/hackerman/Projects/Git/Public/revng-orchestra/.venv/lib/python3.13/site-packages/orchestra/cmds/__init__.py", line 58, in parse_and_execute
    return cmd_parser.handler(parsed_args)
  File "/home/hackerman/Projects/Git/Public/revng-orchestra/.venv/lib/python3.13/site-packages/orchestra/cmds/update.py", line 22, in handle_update
    config = Configuration(use_config_cache=args.config_cache)
  File "/home/hackerman/Projects/Git/Public/revng-orchestra/.venv/lib/python3.13/site-packages/orchestra/model/configuration/configuration.py", line 90, in __init__
    self._check_minimum_version()
  File "/home/hackerman/Projects/Git/Public/revng-orchestra/.venv/lib/python3.13/site-packages/orchestra/model/configuration/configuration.py", line 192, in _check_minimum_version
    min_version = self.parsed_yaml.get("min_orchestra_version")

AttributeError: 'NoneType' object has no attribute 'get'

On closer inspection.

        self._create_default_user_options()
        parsed_yaml, config_hash = generate_yaml_configuration(
            self.config_dir,
            cache_dir=Path(self.cache_dir) if use_config_cache else None,
        )
        self.parsed_yaml = parsed_yaml
        self.config_hash = config_hash

        self._check_minimum_version()

parsed_yaml fails to init properly.
Digging deeper

def run_ytt(config_dir):
    ytt = os.path.join(os.path.dirname(__file__), "..", "..", "support", "ytt")
    env = os.environ.copy()
    env["GOCG"] = "off"
    try:
        expanded_yaml = get_subprocess_output(
            [ytt, "--dangerous-allow-all-symlink-destinations", "-f", config_dir],
            environment=env,
        )
        return expanded_yaml
    except InternalSubprocessException as e:
        raise YTTException from e


def generate_yaml_configuration(
    config_dir,
    cache_dir: Optional[Path] = None,
):
    config_hash = hash_config_dir(config_dir)

    if cache_dir is not None:
        os.makedirs(cache_dir, exist_ok=True)
        config_cache_file = cache_dir / "config_cache.json"
        yaml_config_cache_file = cache_dir / "config_cache.yml"
        if config_cache_file.exists():
            with open(config_cache_file) as f:
                cached_config = json.load(f)
                if config_hash == cached_config.get("config_hash"):
                    return cached_config["config"], config_hash

    expanded_yaml = run_ytt(config_dir)
    parsed_config = yaml.safe_load(expanded_yaml)

    if cache_dir is not None:
        with open(config_cache_file, "w") as f:
            json.dump({"config_hash": config_hash, "config": parsed_config}, f)

        with open(yaml_config_cache_file, "w") as f:
            f.write(expanded_yaml)

    return parsed_config, config_hash

After checking in on the support dir and ensure_ytt.py it seemed to not be installed.
Event after running ensure_ytt.py and rerunning orc update the same error happens.

It does seem like my .orchestra structure is correct.
Note I needed to create .orchestra and .orchestra/config in order to get user_options.yml to generate.
(The docs specify that you do not need to create .orchestra/config)

├── cache
│   ├── config_cache.json
│   └── config_cache.yml
└── config
    └── user_options.yml

3 directories, 3 files

user_options.yml:

#! This file was automatically generated by orchestra
#! Edit it to suit your preferences

#@data/values
---
#@overlay/match missing_ok=True
remote_base_urls:
  - origin: "git@github.com:revng"

#@overlay/match missing_ok=True
binary_archives:
  - origin: "https://rev.ng/gitlab/revng/binary-archives.git"

#@overlay/replace
build_from_source:
  - component-name

config_cache.json:

{"config_hash": "89e38eb1a24f89b45c07533300ad0dba4490073e", "config": null}

config_cache.yml (completely empty):

Doing some debugging it seems that.
cached_config["config"] is None.

 def generate_yaml_configuration(
    config_dir,
    cache_dir: Optional[Path] = None,
):
    config_hash = hash_config_dir(config_dir)

    if cache_dir is not None:
        os.makedirs(cache_dir, exist_ok=True)
        config_cache_file = cache_dir / "config_cache.json"
        yaml_config_cache_file = cache_dir / "config_cache.yml"
        if config_cache_file.exists():
            with open(config_cache_file) as f:
                cached_config = json.load(f)
                if config_hash == cached_config.get("config_hash"):
                    printable = cached_config["config"]
                    print(f'cached_config: {cached_config}')
                    print(f'printable: {printable}')
                    print(f'hash: {config_hash}')
                    return cached_config["config"], config_hash

    expanded_yaml = run_ytt(config_dir)
    parsed_config = yaml.safe_load(expanded_yaml)

    if cache_dir is not None:
        with open(config_cache_file, "w") as f:
            json.dump({"config_hash": config_hash, "config": parsed_config}, f)

        with open(yaml_config_cache_file, "w") as f:
            f.write(expanded_yaml)

    return parsed_config, config_hash
cached_config: {'config_hash': '319a29306a234556262eadd67081ca3a7d3a616e', 'config': None}
printable: None
hash: 319a29306a234556262eadd67081ca3a7d3a616e
[+] ERROR - 'NoneType' object has no attribute 'get'

This aligns with cache/config_cache.json having null for its config field.
I dont think I have done anything wrong following the steps at: https://docs.rev.ng/user-manual/initial-setup/#installing-revng-as-a-developer.
All steps till the orc update are fine.
Is this a case of some missing documentation?

Full debug output:

#~ orc -v DEBUG --no-config-cache update
[+] DEBUG - The following script is going to be executed:
find "/home/hackerman/Projects/Git/Public/revng-orchestra/.orchestra/config" -type f -print0 | sort -z | xargs -0 sha1sum | sha1sum
[+] DEBUG - The following program is going to be executed: ['/home/hackerman/Projects/Git/Public/revng-orchestra/.venv/lib/python3.13/site-packages/orchestra/model/configuration/../../support/ytt', '--dangerous-allow-all-symlink-destinations', '-f', '/home/hackerman/Projects/Git/Public/revng-orchestra/.orchestra/config']
[+] ERROR - 'NoneType' object has no attribute 'get'
Traceback (most recent call last):

  File "/home/hackerman/Projects/Git/Public/revng-orchestra/.venv/bin/orc", line 8, in <module>
    sys.exit(main())
  File "/home/hackerman/Projects/Git/Public/revng-orchestra/.venv/lib/python3.13/site-packages/orchestra/__init__.py", line 56, in main
    return _main(sys.argv[1:])
> File "/home/hackerman/Projects/Git/Public/revng-orchestra/.venv/lib/python3.13/site-packages/orchestra/__init__.py", line 42, in _main
    return_code = main_parser.parse_and_execute(argv)
  File "/home/hackerman/Projects/Git/Public/revng-orchestra/.venv/lib/python3.13/site-packages/orchestra/cmds/__init__.py", line 58, in parse_and_execute
    return cmd_parser.handler(parsed_args)
  File "/home/hackerman/Projects/Git/Public/revng-orchestra/.venv/lib/python3.13/site-packages/orchestra/cmds/update.py", line 22, in handle_update
    config = Configuration(use_config_cache=args.config_cache)
  File "/home/hackerman/Projects/Git/Public/revng-orchestra/.venv/lib/python3.13/site-packages/orchestra/model/configuration/configuration.py", line 90, in __init__
    self._check_minimum_version()
  File "/home/hackerman/Projects/Git/Public/revng-orchestra/.venv/lib/python3.13/site-packages/orchestra/model/configuration/configuration.py", line 192, in _check_minimum_version
    min_version = self.parsed_yaml.get("min_orchestra_version")

AttributeError: 'NoneType' object has no attribute 'get'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions