| 1 | module vmakepkg |
| 2 | |
| 3 | // the build process owns the VM or compiled V script. only data crosses into |
| 4 | // the archive writer; callbacks stay with the recipe that defines them. |
| 5 | struct NativeRecipe { |
| 6 | pub: |
| 7 | spec Spec |
| 8 | licenses []string |
| 9 | hook_files []string |
| 10 | phases []string |
| 11 | dynamic bool |
| 12 | } |
| 13 | |
| 14 | fn (m PackageMeta) items(key string) ![]string { |
| 15 | if !m.has(key) { return []string{} } |
| 16 | return recipe_items_of(m.get(key), key) |
| 17 | } |
| 18 | |
| 19 | fn native_description(m PackageMeta) !NativeRecipe { |
| 20 | dynamic := !m.has('pkgver') || m.get('pkgver').kind() != .string |
| 21 | return NativeRecipe{ |
| 22 | spec: Spec{ |
| 23 | pkgnames: m.items('pkgname')! |
| 24 | pkgver: if dynamic { '' } else { m.get('pkgver').as_string()! } |
| 25 | pkgrel: m.get('pkgrel').as_integer()! |
| 26 | epoch: if m.has('epoch') { m.get('epoch').as_integer()! } else { 0 } |
| 27 | pkgdesc: m.get('pkgdesc').as_string()! |
| 28 | arch: m.items('arch')! |
| 29 | url: if m.has('url') { m.get('url').as_string()! } else { '' } |
| 30 | |
| 31 | depends: m.items('depends')! |
| 32 | makedepends: m.items('makedepends')! |
| 33 | checkdepends: m.items('checkdepends')! |
| 34 | optdepends: m.items('optdepends')! |
| 35 | provides: m.items('provides')! |
| 36 | conflicts: m.items('conflicts')! |
| 37 | backup: m.items('backup')! |
| 38 | options: (m.items('options')!).map(recipe_option(it)) |
| 39 | source: m.items('source')! |
| 40 | validpgpkeys: m.items('validpgpkeys')! |
| 41 | b2sums: m.items('b2sums')! |
| 42 | sha256sums: m.items('sha256sums')! |
| 43 | hooks: recipe_hooks.filter(m.has(it)) |
| 44 | } |
| 45 | hook_files: m.items('hook-files')! |
| 46 | licenses: m.items('license')! |
| 47 | phases: recipe_phases.filter(m.has(it)) |
| 48 | dynamic: dynamic |
| 49 | } |
| 50 | } |
| 51 | |