my_addons.ves collector leaf node

my_addons.ves

import
    bash = bash.ves;
    perl = perl.ves;
{
        return [ contents = [ addons = [ bash, perl ] ];
}

contents is a collector keyword meaning leaf node and can't be changed.

The collector allows leaf sources to be organized by arbitrary keys. addon is such a key. The collector is agnostic about these key names. The std_env addon system, however, recognizes addon and so it can't be changed.

perl.ves (aka addon.ves)

perl.ves - I would perfer to call this perl/1/addon.ves

from /vesta/example.project.com/some/path/components/ import
  component_models = [ perl/1 ]; // perl 5.8.5

{
  root = <"perl">;
  return [component_models,
          root,
         ];
}

the import line defaults to importing filename build.ves when none is specified, as above.

The return value is keyed by component_models and root. These are both keywords to std_env addon as described in StdEnvAddonTmp. It means that the imported perl/1/build.ves gets evaluated and results added to ./components and the string list <"perl"> gets added directly to the ./root binding.

perl/1/build.ves

perl/1/build.ves

//
// Model generated by rpm2vesta, Wed Jun 26 13:57:38 EDT 2002
//
import
  root_func = root.ves;
{
  result = [
    // Main RPM installed into this package
    name = "perl",
    version = "5.8.5",
    arch = "i386",
    // All RPMs installed into this package
    // rpms = < "perl-5.6.0-12.i386.rpm" >,
    // Alternate names for this, based on the other installed RPMs
    all_names = < "perl",  >,
    // Tree of installed files
    root = root_func
  ];

  return [ "perl" = result,  ];
}

The root = root_func in here is what is read by ./build_root() (defined here: /vesta/vestasys.org/platforms/linux/redhat/i686/std_env/latest/build.ves).

root_func here is the function representing the imported model file root.ves (below). This is a nice extra layer, because root_func is small, but it returns a huge binding.

perl/1/root.ves

perl/1/root.ves

files
  root;
{
  return root;
}

This files clause readds the dir tree that exists in perl/1/root/ and stores in a Vesta SDL binding var root. This model file then returns that binding keyed by [ root = {root tree here} ].

Note that this root.ves is a small file, and the function that's made out of it is also small, and can be passed around a lot cheaply. What this function returns, however, is quite large.

So it's best to evaluate this model file function as late as possible.