]> pd.if.org Git - zpackage/blob - DATABASE
remove stray debug fprintf
[zpackage] / DATABASE
1 Packages are sqlite databases
2
3 get application id and userver
4
5 Primitive operations:
6
7 add blob to repo
8 add path to repo
9 associate path with package
10 associate blob with path?
11 extract blob to a path
12 compare blob to filesystem path
13 create package with info
14
15 Extra primitives:
16
17 record elf information about blob
18 compress blob
19 uncompress blob
20 sign a package?  What are we verifying?
21
22 Signatures
23 ----------
24
25 things:
26
27 files, just a table of file contents, hash to content,
28 avoids redundancy.  possibly type? size? internal compression?
29 blobs might make more sense as a name.
30
31 package files: table of pathnames in a package, with metadata
32 file hash, type (directory, file, symlink, etc), permissions,
33 owner, group, acls?, config file, and package name...
34
35 create table paths (
36         path    text,
37         mode    integer, -- perms, use text for octal rep?
38         hash    text, -- what should go here, null for dir
39         mtime   integer -- seconds since epoch, but allow finer?
40 );
41
42 create table packagefiles (
43         package text,
44         subpackage      text, -- libs, dev, client, server, whatever
45         path    text,
46         filetype        text -- e.g. config, etc?
47 );
48
49 -- TODO just elf information?
50 create table libraries (
51         package text,
52         subpackage      text,
53         path    text,
54         soname  text
55 );
56
57 create table librarydeps (
58         package text,
59         subpackage      text,
60         path    text,
61         soname  text -- soname of dependency
62 );
63
64 -- package scripts: table of package, stage, file
65 create table scripts (
66         package text,
67         subpackage      text,
68         hash    text
69 );
70
71 -- package dependencies: table of package, dependency, dep type (package, soname)
72 create table packagedeps (
73         package text,
74         subpackage      text,
75         requires        text, -- package name
76         subreq  text, -- if requires only a sub package, probably most common for libs
77         minversion      text,
78         maxversion      text
79 );
80
81 -- capability labels
82 create table provides (
83         package text,
84         subpackage      text,
85         label   text -- a capability label
86 );
87
88 create table requires (
89         package text,
90         subpackage      text,
91         label   text -- a capability label
92 );
93
94 create table packages (
95         package text,
96         version text, -- the upstream version string
97         release integer, -- the local release number
98         description     text,
99         architecture    text,
100         url     text,
101         licenses        text, -- hash of actual license?  need table for more than one?
102         packager        text,
103         build_date      integer,
104         install_date    integer
105 );
106
107 create table packagegroups (
108         package text,
109         group   text
110 );
111
112 packages: table of package info
113 name, version, release,
114 tied package?  i.e. another package/version/release this one goes with.
115
116 Actual Package Install DB:
117 --------------------------
118
119 packages table:
120 package, name, version, release, install ts, uninstall/upgrade ts
121
122 contents table:
123 from package files table in package, plus install info
124
125 Installing a Package
126 --------------------
127
128 insert into DB.packages the package info from the .zpkg file, leave install date null
129 extract the pre-install script and run it.  abort if exit failure
130 insert into the contents table info from the ZP.packagefiles table
131 for each file in the new contents, extract the file to a temporary location
132 in the same directory, rename into place, update as installed
133 for each file in the old contents, remove the file if it's not in the new contents
134 delete the row from the contents table
135 update the uninstall and install ts as a single transaction
136 extract and run post-install script
137
138 pre/post install scripts get arguments:
139 package name, new version, new release, old version, old release
140 old version/release only if upgrade.