1 create view syncinfo as
3 -- paths to libraries we need to keep around
8 join elflibraries EL on EL.file = PFL.hash
9 join elfneeded EN on EN.needed = EL.soname
10 join packagefiles PFN on EN.file = PFN.hash
12 on PFN.package = PN.package and PFN.version = PN.version and PFN.release = PN.release
14 PN.status = 'installing' or PN.status = 'installed'
15 and not (PFN.package = PFL.package and PFN.version = PFN.version and PFN.release = PFL.release)
20 join elflibraries EL on EL.file = PF.hash
21 join elfneeded EN on EN.needed = EL.soname
22 join packagefiles PL on EN.file = PL.hash
24 on PL.path = P.package and PL.version = P.version and PL.release = P.release
26 P.status = 'removing' or P.status = 'installed' or P.status = 'updating'
29 -- every path in 'installing' is either new or update, or no-op
31 case when --PFC.path is null
33 and PFC.path not in (select path from waspreserved)
34 -- if the path is in preserved, this will an update with no old md.
36 when PFI.filetype is PFC.filetype
37 and PFI.mode is PFC.mode and PFI.username is PFC.username
38 and PFI.groupname is PFC.groupname and PFI.hash is PFC.hash
42 printf('%s-%s-%s', PFI.package, PFI.version, PFI.release) as pkgid,
43 PFI.path, PFI.username, PFI.uid, PFI.groupname, PFI.gid, PFI.mode,
44 PFI.filetype, PFI.mtime, PFI.hash,
45 PFI.configuration + case when PFC.configuration = 1 then 2 else 0 end
47 PFI.target, PFI.device, PFC.hash as ohash,
48 printf('%s:%s:%s:%s', PFI.filetype, PFI.mode, PFI.username, PFI.groupname) as mds,
49 printf('%s:%s:%s:%s', PFC.filetype, PFC.mode, PFC.username, PFC.groupname) as omds
53 on PFI.package = PI.package and PFI.version = PI.version and PFI.release = PI.release
54 left join packagefiles PFC on PFI.path = PFC.path
55 and (PFI.package is not PFC.package or PFI.release is not PFC.release or PFC.version is not PFI.version)
57 on PFC.package = P.package and PFC.version = P.version and PFC.release = P.release
58 and P.status in ('installed','removing','updating')
60 PI.status = 'installing'
65 P.status in ('installed','removing','updating')
68 -- every path in updating and removing is either remove or no-op
69 -- not true, could be an update, but should be handled above
72 printf('%s-%s-%s', PFR.package, PFR.version, PFR.release) as pkgid,
74 PFR.username, PFR.uid, PFR.groupname, PFR.gid, PFR.mode, PFR.filetype,
77 --PFR.target, coalesce(P.status, ' null status '), --PFR.device,
78 -- PFI.path, coalesce(PFI.status, ' null status '), --PFR.device,
79 PFR.target, PFR.device,
82 printf('%s:%s:%s:%s', PFR.filetype, PFR.mode, PFR.username, PFR.groupname) as mds,
86 on PFR.package = PU.package and PFR.version = PU.version and PFR.release = PU.release and PU.status in ('removing','updating')
89 not exists (select path from
92 on PFI.package = P.package and PFI.version = P.version and PFI.release = P.release and P.status in ('installing','installed')
93 where PFI.path = PFR.path
97 -- paths in 'installed' or 'updated' are no-ops
101 printf('%s-%s-%s', PFP.package, PFP.version, PFP.release) as pkgid,
103 PFP.username, PFP.uid, PFP.groupname, PFP.gid, PFP.mode, PFP.filetype,
105 PFP.configuration as configuration,
106 PFP.target, PFP.device,
108 printf('%s:%s:%s:%s', PFP.filetype, PFP.mode, PFP.username, PFP.groupname) as mds,
111 -- TODO don't include installed or installing
112 -- left join packages P on P.package = PFP.package ...
113 -- where P.status not in ('installed','installing')