2 -- --- T2-COPYRIGHT-NOTE-BEGIN ---
3 -- This copyright note is auto-generated by ./scripts/Create-CopyPatch.
5 -- T2 SDE: misc/lua/parse-desc.lua
6 -- Copyright (C) 2005 - 2006 The T2 SDE Project
8 -- More information can be found in the files COPYING and README.
10 -- This program is free software; you can redistribute it and/or modify
11 -- it under the terms of the GNU General Public License as published by
12 -- the Free Software Foundation; version 2 of the License. A copy of the
13 -- GNU General Public License can be found in the file COPYING.
14 -- --- T2-COPYRIGHT-NOTE-END ---
18 -- this file looks quite complicated already, but a comparsion to grep might help:
20 -- time lua misc/lua/parse-desc.lua package/base/*/*.desc > /dev/null
21 -- time grep "^[[]" package/base/*/*.desc > /dev/null
24 require
"misc/lua/sde/desc"
27 print("Usage: lua misc/lua/parse-desc.lua [path-to-desc-file]")
32 io
.write(string.format(unpack(arg
)))
38 for i
,file
in ipairs(arg
) do
40 _
,_
,repo
,pkg
= string.find(file
, "package/([^/]*)/([^/]*)/*");
42 -- put all parsed files into a table
43 pkgs
[pkg
] = desc
.parse(file
)
48 for pkg
,tab
in pairs(pkgs
) do
49 printf("Package %s:\n", pkg
);
51 for k
,v
in pairs(tab
) do
52 if type(v
) == "table" then
53 printf(" %s: %s\n", k
, table.concat(v
,"\n "));
55 printf(" %s: %s\n", k
, v
);