Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

otk: remove otk.define from the target tree #177

Merged
merged 2 commits into from
Jul 10, 2024

Conversation

mvo5
Copy link
Contributor

@mvo5 mvo5 commented Jul 10, 2024

While looking at some output I noticed that an otk.define inside
a target will yield a verbatim otk.define inside the target.

So:

otk.target.osbuild:
 otk.define:
  foo: bar

was yielding:

{
  "sources": {},
  "version": "2",
  "otk.define": {
    "a": "b",
  },
  "a": "b"
}

This is most certainly unwanted. This commit fixes it by simply
removing the otk.define from the processed tree.

Alternatively we could of course force people to use otk.define
only outside of targets but that would feel slightly weird and
would probably not work well when externals are used to define
vars.

Build on top of #175

mvo5 added 2 commits July 10, 2024 16:57
When trying to compile the example in PR#167 I noticed slightly
strange behavior. Currently when doing:
```
otk.target.osbuild:
  otk.include: "16-include-copy/repository-${version}.yaml"
```
the output is
```
{
     'otk.include': '16-include-copy/repository-${version}.yaml',
     'sources': {},
     'version': '2',
}
```
The reason is that we have an extra `tree.copy()` when we process
includes. However in other parts of the code (including accross
recursions) we use "tree.update()" so that the tree we worked
on and the tree that the other parts of the recursion go out of
sync. The easiest fix is to simply drop the copy.
While looking at some output I noticed that an `otk.define` inside
a `target` will yield a verbatim `otk.define` inside the target.

So:
```yaml
otk.target.osbuild:
 otk.define:
  foo: bar
```
was yielding:
```
{
  "sources": {},
  "version": "2",
  "otk.define": {
    "a": "b",
  },
  "a": "b"
}
```

This is most certainly unwanted. This commit fixes it by simply
removing the `otk.define` from the processed tree.

Alternatively we could of course force people to use `otk.define`
only outside of targets but that would feel slightly weird and
would probably not work well when externals are used to define
vars.
@supakeen supakeen added this pull request to the merge queue Jul 10, 2024
Merged via the queue into osbuild:main with commit 00fea2a Jul 10, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants