module vmakepkg // the build process owns the VM or compiled V script. only data crosses into // the archive writer; callbacks stay with the recipe that defines them. struct NativeRecipe { pub: spec Spec licenses []string hook_files []string phases []string dynamic bool } fn (m PackageMeta) items(key string) ![]string { if !m.has(key) { return []string{} } return recipe_items_of(m.get(key), key) } fn native_description(m PackageMeta) !NativeRecipe { dynamic := !m.has('pkgver') || m.get('pkgver').kind() != .string return NativeRecipe{ spec: Spec{ pkgnames: m.items('pkgname')! pkgver: if dynamic { '' } else { m.get('pkgver').as_string()! } pkgrel: m.get('pkgrel').as_integer()! epoch: if m.has('epoch') { m.get('epoch').as_integer()! } else { 0 } pkgdesc: m.get('pkgdesc').as_string()! arch: m.items('arch')! url: if m.has('url') { m.get('url').as_string()! } else { '' } depends: m.items('depends')! makedepends: m.items('makedepends')! checkdepends: m.items('checkdepends')! optdepends: m.items('optdepends')! provides: m.items('provides')! conflicts: m.items('conflicts')! backup: m.items('backup')! options: (m.items('options')!).map(recipe_option(it)) source: m.items('source')! validpgpkeys: m.items('validpgpkeys')! b2sums: m.items('b2sums')! sha256sums: m.items('sha256sums')! hooks: recipe_hooks.filter(m.has(it)) } hook_files: m.items('hook-files')! licenses: m.items('license')! phases: recipe_phases.filter(m.has(it)) dynamic: dynamic } }