summaryrefslogtreecommitdiff
path: root/depstage.lua
blob: 249d1ab72f78779e70663ab9e757e699b987c25b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env lua
local lapp = require "pl.lapp"
local dir = require "pl.dir"
local path = require "pl.path"
local pretty = require "pl.pretty"
local srcinfo = require "srcinfo"
local args = lapp [[
Finds dependencies from .SRCINFO files and lists them in buildable stages.

Usage: depstage [-h] [<pathname>]
	-h, --help  Display this help message and exit.
	<pathname>  (default '.')  Optional path to directory to start recursive transversal from.
]]
for root, dirs, files in dir.walk(args.pathname) do
	for _, file in pairs(files) do
		if file == ".SRCINFO" then
			local pathname = path.normpath(path.join(root, file))
			local handle<close> = io.open(pathname)
			io.write(pathname, " ")
			pretty.dump(srcinfo(handle))
			print()
			-- From this, find {,make,check}depends and group packages into stages.
		end
	end
end