OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.5 KiB

  1. #!/usr/bin/env lua
  2. -- --- T2-COPYRIGHT-NOTE-BEGIN ---
  3. -- This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. --
  5. -- T2 SDE: misc/lua/parse-desc.lua
  6. -- Copyright (C) 2005 - 2006 The T2 SDE Project
  7. --
  8. -- More information can be found in the files COPYING and README.
  9. --
  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 ---
  15. -- try this:
  16. --
  17. -- this file looks quite complicated already, but a comparsion to grep might help:
  18. --
  19. -- time lua misc/lua/parse-desc.lua package/base/*/*.desc > /dev/null
  20. -- time grep "^[[]" package/base/*/*.desc > /dev/null
  21. --
  22. require "misc/lua/sde/desc"
  23. if #arg < 1 then
  24. print("Usage: lua misc/lua/parse-desc.lua [path-to-desc-file]")
  25. os.exit(1)
  26. end
  27. function printf(...)
  28. io.write(string.format(unpack(arg)))
  29. end
  30. -- parse all files
  31. pkgs = {}
  32. for i,file in ipairs(arg) do
  33. if i > 0 then
  34. _,_,repo,pkg = string.find(file, "package/([^/]*)/([^/]*)/*");
  35. -- put all parsed files into a table
  36. pkgs[pkg] = desc.parse(file)
  37. end
  38. end
  39. -- output
  40. for pkg,tab in pairs(pkgs) do
  41. printf("Package %s:\n", pkg);
  42. for k,v in pairs(tab) do
  43. if type(v) == "table" then
  44. printf(" %s: %s\n", k, table.concat(v,"\n "));
  45. else
  46. printf(" %s: %s\n", k, v);
  47. end
  48. end
  49. end