canonical/chisel

content.list() fails with "cannot read file not selected" in every case

woky opened this issue · 2 comments

woky commented

I've tried to use content.list() in ca-certificates_data slice. Below are several variants I've tried, none of which worked. (For text: todo please see #6).

$ cat slices/ca-certificates.yaml
package: ca-certificates
slices:
  data:
    contents:
      /etc/ssl/certs/ca-certificates.crt: { text: todo, mutable: true }
      /usr/share/ca-certificates/mozilla/*.crt:
    mutate: |
      certs = [content.read(path) for path in content.list("/usr/share/ca-certificates/mozilla/")]
      content.write("/etc/ssl/certs/ca-certificates.crt", "".join(certs))
$ chisel cut --release $PWD --root ~/tmp/chisel-out ca-certificates_data
...
2022/06/10 09:14:23 Extracting files from package "ca-certificates"...
error: slice ca-certificates_data: cannot read file not selected: /usr/share/ca-certificates/mozilla

More variants of contents that produce the same error:

    contents:
      /etc/ssl/certs/ca-certificates.crt: { text: todo, mutable: true }
      /usr/share/ca-certificates/mozilla/:
      /usr/share/ca-certificates/mozilla/*.crt:
    contents:
      /etc/ssl/certs/ca-certificates.crt: { text: todo, mutable: true }
      /usr/share/ca-certificates/mozilla/:
      /usr/share/ca-certificates/mozilla/ISRG_Root_X1.crt:
woky commented

The variant

    contents:
      /etc/ssl/certs/ca-certificates.crt: { text: todo, mutable: true }
      /usr/share/ca-certificates/mozilla/:
      /usr/share/ca-certificates/mozilla/*.crt:

now works. Pretty sure I've tried it before. Maybe I was using relative --root. Is the directory supposed to be listed explicitly when I want to list() it?

woky commented

It works now as said in previous comment. Closing...