From d376ea935cb537811b60d64d034a54da021fd6f2 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Mon, 16 Dec 2013 15:17:26 +0000 Subject: aports.lua: replace foreach_remote_source API with iterator --- aports.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/aports.lua b/aports.lua index 004e87e..88ffed4 100755 --- a/aports.lua +++ b/aports.lua @@ -135,17 +135,18 @@ function M.is_remote(url) return false end --- iterate over all entries in source and execute the function for remote -function M.foreach_remote_source(p, func) - local _,s +-- iterator for all remote sources of given pkg/aport +function M.remote_sources(p) if p == nil or type(p.source) ~= "table" then - return + return nil end - for _,url in pairs(p.source) do - if M.is_remote(url) then - func(url) + return coroutine.wrap(function() + for _,url in pairs(p.source) do + if M.is_remote(url) then + coroutine.yield(url) + end end - end + end) end function M.get_maintainer(pkg) -- cgit v1.2.3