5

%*RESOURCES as a dynamic variable gives you access to every one of the Distribution::Resource objects within a specific distribution. These objects are installed along with it, so they're just there, available.

However, I can't find a documented, not to mention specced way, to access from one distribution the resources of a different one. Say, for instance, you want to access from Foo the data installed as resource for distribution Bar. I can imagine instantiating a Distribution::Resources object; in order to instantiate that, you need the repo (OK, I can live with that), but then the dist-id. There's very possible a spec way to obtain dist-id from dist-name... But I get lost here. Can anyone help?

Update: I'm checking this out, and it boils down to: use zef. It includes logic for "finding" where a "identity" (distro identified by name and meta data) is located, and from there you can probably locate the ID by parsing output. However, no documentation there and not clear either what's the public API for it, other than it might be somewhere in this code.

It's entirely clear, however, that first you have to locate the distribution you need the resources, from where you will obtain an ID, and then use that ID to instantiate the object above. Ish.

jjmerelo
  • 22,578
  • 8
  • 40
  • 86

1 Answers1

5

There is no public way to do this. The dist-id is an implementation detail, hence it not being in the docs or specced. It’s not obvious because you simply shouldn’t do it. Yes, zef uses it but that’s a special case not an example.

ugexe
  • 5,297
  • 1
  • 28
  • 49
  • Any chance this has become more possible over the past 20 months? – StevieD Jun 20 '22 at 22:20
  • 1
    No, and I'm not sure how it would really be possible when thinking about it more than surface level. For instance what single distribution (of the many included in the roast) would a given roast test use for `$?DISTRIBUTION`? – ugexe Jun 22 '22 at 00:17
  • I guess only way would be to use zef to download and install distro manually and gather up the files in resources that way into a data structure. Would have to cache those values to be practical. – StevieD Jun 22 '22 at 00:41