summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2013-12-16 15:17:26 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2013-12-16 15:17:26 +0000
commitd376ea935cb537811b60d64d034a54da021fd6f2 (patch)
treee182ab7557f8f706cc34f15c3ffdc92df3bfc51a
parentfd1cfa9c6e09c316dce0bbb338bd32e9b1023d84 (diff)
downloadlua-aports-d376ea935cb537811b60d64d034a54da021fd6f2.tar.bz2
lua-aports-d376ea935cb537811b60d64d034a54da021fd6f2.tar.xz
aports.lua: replace foreach_remote_source API with iterator
-rwxr-xr-xaports.lua17
1 files 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)