1 -- --- T2-COPYRIGHT-NOTE-BEGIN ---
2 -- This copyright note is auto-generated by ./scripts/Create-CopyPatch.
4 -- T2 SDE: misc/lua/sde/pkgdb.lua
5 -- Copyright (C) 2005 - 2006 The T2 SDE Project
6 -- Copyright (C) 2005 - 2006 Valentin Ziegler, Juergen "George" Sawinski
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 ---
17 -- - add "update-priority" (like "urgent,security,normal" etc)
18 -- (also needs to go into create_package_db and other places)
21 -- p = pkgdb.parse(line-iterator)
22 -- Parse the package.db (takes a line iterator as input)
26 -- parse all packages.db information into tables
27 -- filelist saving commented out (eats another 30M)
29 local function block_lines()
32 if (line
== nil) or (line
=="\023") then
39 local function read_deps()
42 for line
in block_lines
do
43 _
,_
,dependency
= string.find(line
, "[^ ]* (.*)")
44 table.insert (deps
, dependency
)
50 local function read_flist()
56 for line
in block_lines
do
57 _
,_
,cksum
,size
,file
= string.find(line
, "^([0-9]+) ([0-9]+) (.*)")
58 -- uncomment these lines if you want to save complete file list
59 -- table.insert (files, file);
60 -- table.insert (cksums, 1 * cksum);
61 -- table.insert (sizes, 1 * size);
65 return usage
,files
,cksums
,sizes
68 local function parse(lines
)
71 repeat -- parse packages
78 if lines() ~= "\023" then -- separator line
79 print ("terminating line missing\n")
82 pkg_data
.desc
= desc
.parse (block_lines
)
83 pkg_data
.deps
= read_deps ()
84 pkg_data
.usage
= read_flist ()
86 if lines() ~= "\004" then -- separator line
87 print ("terminating line missing\n")
90 packages
[pkgname
] = pkg_data