From 99d1005fbb03d2a6c5a1f1a90a61ccef140a5d3c Mon Sep 17 00:00:00 2001 From: Luka Vandervelden Date: Sat, 3 Aug 2019 13:01:29 +0200 Subject: [PATCH] Slightly improved apk backend. --- src/context.cr | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/context.cr b/src/context.cr index 711f885..e44d7b3 100644 --- a/src/context.cr +++ b/src/context.cr @@ -4,15 +4,30 @@ def pkginfo(package) du = `du -sk #{package.fake_root_directory}` size = du.sub(/[ \t].*/, "").to_i * 1024 - %{ # Generated by `package`. - pkgname = #{package.name} - pkgver = #{package.version}-r#{package.release} - url = #{package.url || ""} - size = #{size} - origin = #{package.recipe.name} - buildtype = host - builddate = #{Time.utc.to_unix} - }.gsub /^ */m, "" + lines = [] of String + + lines << "# Generated by `package`." + lines << "pkgname = #{package.name}" + lines << "pkgver = #{package.version}-r#{package.release}" + lines << "url = #{package.url || ""} " + lines << "size = #{size}" + lines << "origin = #{package.recipe.name}" + lines << "buildtype = host" # This’ll need to be imported from Context. + lines << "builddate = #{Time.utc.to_unix}" + + package.dependencies.each do |atom| + lines << "depends = #{atom.to_s}" + end + + package.provides.each do |atom| + lines << "provides = #{atom.to_s}" + end + + package.conflicts.each do |atom| + lines << "conflicts = #{atom.to_s}" + end + + lines.join "\n" end class Package::Backend::Packaging