From 3d08c7ecff02da117b650e6e1e80b4a9ef1d0d81 Mon Sep 17 00:00:00 2001 From: Luka Vandervelden Date: Wed, 3 Jul 2019 04:24:33 +0200 Subject: [PATCH] More metadata available to Recipe and Package. --- src/main.cr | 4 ++++ src/package.cr | 16 ++++++++++++++-- src/recipe.cr | 30 ++++++++++++++++++++++++------ 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/src/main.cr b/src/main.cr index f200cbc..31df186 100644 --- a/src/main.cr +++ b/src/main.cr @@ -16,6 +16,10 @@ Context.new().tap do |context| #recipe.instructions.build << "cd hello-#{recipe.version} && make" recipe.instructions.install << "cd hello-#{recipe.version} && make DESTDIR='${PKG}' install" + recipe.url = "https://www.gnu.org/software/hello/" + recipe.description = "The GNU Hello program produces a familiar, friendly greeting." + recipe.dependencies << "gettext" + recipe.download recipe.extract diff --git a/src/package.cr b/src/package.cr index 26fc3ef..802b885 100644 --- a/src/package.cr +++ b/src/package.cr @@ -11,10 +11,22 @@ class Package::Package def {{attribute.var.id}} : {{attribute.type.id}} @{{attribute.var.id}} || @recipe.{{attribute.var.id}} end + + def {{attribute.var.id}}=(new_value : {{attribute.type.id}}) + @{{attribute.var.id}} = new_value + end end - inherit name : String - inherit version : String + inherit name : String + inherit version : String + inherit release : Int32 + + inherit url : String? + inherit description : String + + inherit dependencies : Array(String) + inherit conflicts : Array(String) + inherit provides : Array(String) # Internals inherit fake_root_directory : String diff --git a/src/recipe.cr b/src/recipe.cr index 794f860..7fc2f3b 100644 --- a/src/recipe.cr +++ b/src/recipe.cr @@ -18,14 +18,32 @@ end class Package::Recipe @context : Context - getter name : String - getter version : String - getter dirname : String? + # Core recipe informations. + getter name : String + getter version : String + getter release = 1 - getter sources : Sources - getter packages : Array(Package) + property url : String? + property description : String = "" + + # Informations not specific to individual packages. + getter sources : Sources + getter packages : Array(Package) + + property packager : String? + property maintainer : String? + getter contributors = Array(String).new + + # Relations to other packages. + # FIXME: `dependencies` needs splitting between run-time and build-time. + getter dependencies = Array(String).new + getter provides = Array(String).new + getter conflicts = Array(String).new + + # Build instructions, helpers and other build-only data. + setter dirname : String? # matching getter defined manually later. + getter instructions = Instructions.new - getter instructions = Instructions.new def initialize(@context, @name, @version) @sources = Sources.new @packages = [] of Package