-
Notifications
You must be signed in to change notification settings - Fork 3
Clarify core data model, we're in a data muddle #35
Description
When working on better information messages from apt info command I realized I've made a muddle:
4b9190f The main data tables need clear separation, "package names and version available on server" and "what is actually locally installed". The old functions actually maintained this better before I started messing with them. (In my defense, they were horribly opaque tho'.)
For instance I grew the idea that
apt ballreconstructed the version name from the currently available archive filename on the server. Yes, get_ball() constructs from the filename, but not from the filename in setup.ini, it's actually from the name in installed.db -- a crucial difference!TODO: rescue good parts of old functions, clearly separate local/server info, dump overlapping dict records.
So something like
SETUP = parse_setup_ini()
INSTALLED = parse_installed_db()
I want to think carefully about the names though. We'll be using them frequently. They should make intuitive sense when read, while being short enough to cause no typing strain and keep our code phrases short and fast to read.
ALLCAPSis out; no shouting.setup_iniis being used (but could be moved, with some effort)setup_d,installed_d?sini_d,inst_d?ini_d,inst_d?S,I? (is this still shouting?)- ...?
A couple of spelled out phrases:
p = packagename
server_ver = sini_d[p]['version']
local_ver = inst_d[p]['version']
server_ver = S[p]['version']
local_ver = I[p]['version']
if sini_d[p]['version'] > inst_d[p]['version']:
do_upgrade(p)
if S[p]['version'] > I[p]['version']:
do_upgrade(p)