-
Notifications
You must be signed in to change notification settings - Fork 50
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
rattler-build-ic way to test the existence of installed files? #1213
Comments
Tricky question. We have one implicit underspecified behavior in hte requirements section where lists are always flattened. We could potentially do something like this in the files section, too, so that if the Jinja emits something that looks like a valid YAML list, it would be flattened into the list. E.g.
However, logic like this could also be easily expressed as a Python script in the tests... |
I feel it would be a useful feature to add the behavior to the |
Yes, I can see the usefulness. Note that globs are perfectly OK (e.g. The downside of this idea is that the recipe becomes less statically known / validated. |
Right, if you select the files, then you would less likely need to test their existence in the installed package. In this particular case, I failed to get the common build to work, so I build within each package, so I can't select the files. I should resolve this little nag today with the python call and point you to the recipe for your review/suggestions. Thank you |
FYI, I made progress, but it is quite a bit trickier then I thought, there seems to be update of " and ', which create some difficult diagnosis of python failure, but this worked:
gives:
of course, this is not a 'test' but it should only take the addition of |
Sorry, I think I wasn't clear enough. There are two ways this could be done right now: tests:
# note that this is a YAML block element
- script: |
{% set qemu_libs = ["foo", "bar"] %}
# or any other bash like code
{% for lib in qemu_libs %}
test -f /usr/lib/qemu/${{ lib }}.so
{% endfor %} The other way would be with a Python script like this: tests:
- script:
interpreter: python
content: |
from pathlib import Path
qemu_libs = ["foo", "bar"]
for lib in qemu_libs:
assert Path(f"/usr/lib/qemu/{lib}.so").exists()
requirements:
run:
- python |
Although it is possible that option 1 is currently broken. |
My initial version had a little bug in the jinja. We configured Jinja comments to look like |
Oh, I see. Option 1 probably works, but I want to define the array (or string with all the elements) at the top, so that the definition of the list doesn't blob-up the testing actions, plus I would have to repeat it (unless jinja is allowed at any place, but I had some initial syntax error when trying to use jinja) Option2 is neat, though , in this case I prefer the one-liner. When trying to create the array with ${{ array | split() |list }} injected into the python -c ... the quotes disappeared, which is the tricky part that I had not paid attention to - I surmise, it will work much more naturally for Option 2 With Option 2, can there be several |
FYI, this is the recipe that I am working on. It is a qemu with the execve() patch. This was needed for cross-building ZIG with CMake, since when it rebuilds itself in stage3, it emits an execve() call that would fail. Also, I seem to have made some progress on the ZIG PPC64LE, thanks to Alexrp comment on one of the PRs |
You can have as many independent tests as you like (ie. separate script fields). |
Somehow, there is an odd error when using the
Also, the |
I seem to run into an odd issue with the tests. I create the qemu-user, compile cross-compile for the target then try to run the code. It fails:
However, when I manually run it it works fine. One issue was initially that the QEMU_LD_PREFIX set with the activate script was wrong, but now I cannot understand why it fails, there seem to be no information as to why it failed. |
Sometimes, stderr and stdout are interleaved in weird ways, and the output of the process is visible above the printline of the executed command. Could that help? |
I wonder if there is a way to implement a for loop with filters?
I have:
(I do not seem to be able to declare an array directly in context section)
I tried:
in the hope that it would insert a list in the files list
I also tried to use a for loop, but likely need to do a bash-c '...'?
The text was updated successfully, but these errors were encountered: