bliss

KISS in Lua
git clone git://bvnf.space/bliss.git
Log | Files | Refs | README | LICENSE

commit 971f99b9bb8d369c91369c40a9f8fb7a2ab64b22
parent 804fd43615c59396872a8575168b208662fa03ef
Author: phoebos <ben@bvnf.space>
Date:   Mon,  3 Jul 2023 17:54:01 +0100

add pkg.iscached

Diffstat:
Mbliss/pkg.lua | 16++++++++++++++++
1 file changed, 16 insertions(+), 0 deletions(-)

diff --git a/bliss/pkg.lua b/bliss/pkg.lua @@ -1,5 +1,6 @@ local utils = require "bliss.utils" local tsort = require "bliss.tsort" +local glob = require "posix.glob" local sys_stat = require "posix.sys.stat" local function read_lines(file) @@ -31,6 +32,20 @@ local function isinstalled(env, name) return not not sb end +local function iscached(env, pkg, version) + local f = env.bin_dir .. "/" .. pkg .. "@" .. version[1] .. "-" .. version[2] .. ".tar." + local myglob = f .. "*" + local f = f .. env.COMPRESS + + local sb = sys_stat.stat(f) + if sb then + return true + else + local g = glob.glob(myglob, 0) + return not not g + end +end + local function find_version(pkg, repo_dir) local v = repo_dir .. "/version" @@ -139,6 +154,7 @@ end local M = { find = find, isinstalled = isinstalled, + iscached = iscached, find_version = find_version, find_checksums = find_checksums, find_depends = find_depends,