#180 include manifest size in sizes

This commit is contained in:
Mikayla Fischler 2023-02-27 23:51:26 -05:00
parent 523d478739
commit ae3315e4a0
3 changed files with 60 additions and 240 deletions

View File

@ -20,7 +20,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
local function println(message) print(tostring(message)) end
local function print(message) term.write(tostring(message)) end
local VERSION = "v0.9e"
local VERSION = "v0.9f"
local install_dir = "/.install-cache"
local repo_path = "http://raw.githubusercontent.com/MikaylaFischler/cc-mek-scada/"
@ -350,7 +350,7 @@ elseif mode == "install" or mode == "update" then
-- START INSTALL/UPDATE --
--------------------------
local space_required = 0
local space_required = manifest.sizes.manifest
local space_available = fs.getFreeSpace("/")
local single_file_mode = false
@ -372,7 +372,7 @@ elseif mode == "install" or mode == "update" then
term.setTextColor(colors.yellow)
println("WARNING: Insufficient space available for a full download!")
term.setTextColor(colors.white)
println("Files will be downloaded one by one, so if you are replacing a current install this will not be a problem unless installation fails.")
println("Files can be downloaded one by one, so if you are replacing a current install this will not be a problem unless installation fails.")
println("Do you wish to continue? (y/N)")
local confirm = read()

103
imgen.py
View File

@ -42,54 +42,63 @@ def get_version(path, is_comms = False):
return ver
# installation manifest
manifest = {
"versions" : {
"bootloader" : get_version("."),
"comms" : get_version("./scada-common/comms.lua", True),
"reactor-plc" : get_version("./reactor-plc"),
"rtu" : get_version("./rtu"),
"supervisor" : get_version("./supervisor"),
"coordinator" : get_version("./coordinator"),
"pocket" : get_version("./pocket")
},
"files" : {
# common files
"system" : [ "initenv.lua", "startup.lua" ],
"common" : list_files("./scada-common"),
"graphics" : list_files("./graphics"),
"lockbox" : list_files("./lockbox"),
# platform files
"reactor-plc" : list_files("./reactor-plc"),
"rtu" : list_files("./rtu"),
"supervisor" : list_files("./supervisor"),
"coordinator" : list_files("./coordinator"),
"pocket" : list_files("./pocket"),
},
"depends" : {
"reactor-plc" : [ "system", "common" ],
"rtu" : [ "system", "common" ],
"supervisor" : [ "system", "common" ],
"coordinator" : [ "system", "common", "graphics" ],
"pocket" : [ "system", "common", "graphics" ]
},
"sizes" : {
# common files
"system" : os.path.getsize("initenv.lua") + os.path.getsize("startup.lua"),
"common" : dir_size("./scada-common"),
"graphics" : dir_size("./graphics"),
"lockbox" : dir_size("./lockbox"),
# platform files
"reactor-plc" : dir_size("./reactor-plc"),
"rtu" : dir_size("./rtu"),
"supervisor" : dir_size("./supervisor"),
"coordinator" : dir_size("./coordinator"),
"pocket" : dir_size("./pocket"),
# generate installation manifest object
def make_manifest(size):
manifest = {
"versions" : {
"bootloader" : get_version("."),
"comms" : get_version("./scada-common/comms.lua", True),
"reactor-plc" : get_version("./reactor-plc"),
"rtu" : get_version("./rtu"),
"supervisor" : get_version("./supervisor"),
"coordinator" : get_version("./coordinator"),
"pocket" : get_version("./pocket")
},
"files" : {
# common files
"system" : [ "initenv.lua", "startup.lua" ],
"common" : list_files("./scada-common"),
"graphics" : list_files("./graphics"),
"lockbox" : list_files("./lockbox"),
# platform files
"reactor-plc" : list_files("./reactor-plc"),
"rtu" : list_files("./rtu"),
"supervisor" : list_files("./supervisor"),
"coordinator" : list_files("./coordinator"),
"pocket" : list_files("./pocket"),
},
"depends" : {
"reactor-plc" : [ "system", "common" ],
"rtu" : [ "system", "common" ],
"supervisor" : [ "system", "common" ],
"coordinator" : [ "system", "common", "graphics" ],
"pocket" : [ "system", "common", "graphics" ]
},
"sizes" : {
# manifest file estimate
"manifest" : size,
# common files
"system" : os.path.getsize("initenv.lua") + os.path.getsize("startup.lua"),
"common" : dir_size("./scada-common"),
"graphics" : dir_size("./graphics"),
"lockbox" : dir_size("./lockbox"),
# platform files
"reactor-plc" : dir_size("./reactor-plc"),
"rtu" : dir_size("./rtu"),
"supervisor" : dir_size("./supervisor"),
"coordinator" : dir_size("./coordinator"),
"pocket" : dir_size("./pocket"),
}
}
}
return manifest
# write initial manifest with placeholder size
f = open("install_manifest.json", "w")
json.dump(manifest, f)
json.dump(make_manifest("-----"), f)
f.close()
# calculate file size then regenerate with embedded size
f = open("install_manifest.json", "w")
json.dump(make_manifest(os.path.getsize("install_manifest.json")), f)
f.close()

View File

@ -1,190 +1 @@
{
"versions": {
"bootloader": "0.2",
"comms": "1.4.0",
"reactor-plc": "v0.12.2",
"rtu": "v0.12.3",
"supervisor": "v0.13.4",
"coordinator": "v0.11.6",
"pocket": "alpha-v0.0.0"
},
"files": {
"system": [
"initenv.lua",
"startup.lua"
],
"common": [
"scada-common/crypto.lua",
"scada-common/ppm.lua",
"scada-common/comms.lua",
"scada-common/psil.lua",
"scada-common/tcallbackdsp.lua",
"scada-common/rsio.lua",
"scada-common/constants.lua",
"scada-common/mqueue.lua",
"scada-common/crash.lua",
"scada-common/log.lua",
"scada-common/types.lua",
"scada-common/util.lua"
],
"graphics": [
"graphics/element.lua",
"graphics/flasher.lua",
"graphics/core.lua",
"graphics/elements/textbox.lua",
"graphics/elements/displaybox.lua",
"graphics/elements/pipenet.lua",
"graphics/elements/rectangle.lua",
"graphics/elements/div.lua",
"graphics/elements/tiling.lua",
"graphics/elements/colormap.lua",
"graphics/elements/indicators/alight.lua",
"graphics/elements/indicators/icon.lua",
"graphics/elements/indicators/power.lua",
"graphics/elements/indicators/rad.lua",
"graphics/elements/indicators/state.lua",
"graphics/elements/indicators/light.lua",
"graphics/elements/indicators/vbar.lua",
"graphics/elements/indicators/coremap.lua",
"graphics/elements/indicators/data.lua",
"graphics/elements/indicators/hbar.lua",
"graphics/elements/indicators/trilight.lua",
"graphics/elements/controls/switch_button.lua",
"graphics/elements/controls/spinbox_numeric.lua",
"graphics/elements/controls/hazard_button.lua",
"graphics/elements/controls/push_button.lua",
"graphics/elements/controls/radio_button.lua",
"graphics/elements/controls/multi_button.lua",
"graphics/elements/animations/waiting.lua"
],
"lockbox": [
"lockbox/init.lua",
"lockbox/LICENSE",
"lockbox/kdf/pbkdf2.lua",
"lockbox/util/bit.lua",
"lockbox/util/array.lua",
"lockbox/util/stream.lua",
"lockbox/util/queue.lua",
"lockbox/digest/sha2_224.lua",
"lockbox/digest/sha1.lua",
"lockbox/digest/sha2_256.lua",
"lockbox/cipher/aes128.lua",
"lockbox/cipher/aes256.lua",
"lockbox/cipher/aes192.lua",
"lockbox/cipher/mode/ofb.lua",
"lockbox/cipher/mode/cbc.lua",
"lockbox/cipher/mode/ctr.lua",
"lockbox/cipher/mode/cfb.lua",
"lockbox/mac/hmac.lua",
"lockbox/padding/ansix923.lua",
"lockbox/padding/pkcs7.lua",
"lockbox/padding/zero.lua",
"lockbox/padding/isoiec7816.lua"
],
"reactor-plc": [
"reactor-plc/threads.lua",
"reactor-plc/plc.lua",
"reactor-plc/config.lua",
"reactor-plc/startup.lua"
],
"rtu": [
"rtu/threads.lua",
"rtu/rtu.lua",
"rtu/modbus.lua",
"rtu/config.lua",
"rtu/startup.lua",
"rtu/dev/sps_rtu.lua",
"rtu/dev/envd_rtu.lua",
"rtu/dev/boilerv_rtu.lua",
"rtu/dev/redstone_rtu.lua",
"rtu/dev/sna_rtu.lua",
"rtu/dev/imatrix_rtu.lua",
"rtu/dev/turbinev_rtu.lua"
],
"supervisor": [
"supervisor/supervisor.lua",
"supervisor/unit.lua",
"supervisor/config.lua",
"supervisor/startup.lua",
"supervisor/unitlogic.lua",
"supervisor/facility.lua",
"supervisor/session/coordinator.lua",
"supervisor/session/svqtypes.lua",
"supervisor/session/svsessions.lua",
"supervisor/session/rtu.lua",
"supervisor/session/plc.lua",
"supervisor/session/rsctl.lua",
"supervisor/session/rtu/boilerv.lua",
"supervisor/session/rtu/txnctrl.lua",
"supervisor/session/rtu/unit_session.lua",
"supervisor/session/rtu/turbinev.lua",
"supervisor/session/rtu/envd.lua",
"supervisor/session/rtu/imatrix.lua",
"supervisor/session/rtu/sps.lua",
"supervisor/session/rtu/qtypes.lua",
"supervisor/session/rtu/sna.lua",
"supervisor/session/rtu/redstone.lua"
],
"coordinator": [
"coordinator/coordinator.lua",
"coordinator/renderer.lua",
"coordinator/iocontrol.lua",
"coordinator/sounder.lua",
"coordinator/config.lua",
"coordinator/startup.lua",
"coordinator/apisessions.lua",
"coordinator/process.lua",
"coordinator/ui/dialog.lua",
"coordinator/ui/style.lua",
"coordinator/ui/layout/main_view.lua",
"coordinator/ui/layout/unit_view.lua",
"coordinator/ui/components/reactor.lua",
"coordinator/ui/components/processctl.lua",
"coordinator/ui/components/unit_overview.lua",
"coordinator/ui/components/boiler.lua",
"coordinator/ui/components/unit_detail.lua",
"coordinator/ui/components/imatrix.lua",
"coordinator/ui/components/unit_waiting.lua",
"coordinator/ui/components/turbine.lua"
],
"pocket": [
"pocket/config.lua",
"pocket/startup.lua"
]
},
"depends": {
"reactor-plc": [
"system",
"common"
],
"rtu": [
"system",
"common"
],
"supervisor": [
"system",
"common"
],
"coordinator": [
"system",
"common",
"graphics"
],
"pocket": [
"system",
"common",
"graphics"
]
},
"sizes": {
"system": 1982,
"common": 90550,
"graphics": 99858,
"lockbox": 100797,
"reactor-plc": 75545,
"rtu": 83090,
"supervisor": 271184,
"coordinator": 179394,
"pocket": 335
}
}
{"versions": {"bootloader": "0.2", "comms": "1.4.0", "reactor-plc": "v0.12.2", "rtu": "v0.12.3", "supervisor": "v0.13.4", "coordinator": "v0.11.6", "pocket": "alpha-v0.0.0"}, "files": {"system": ["initenv.lua", "startup.lua"], "common": ["scada-common/crypto.lua", "scada-common/ppm.lua", "scada-common/comms.lua", "scada-common/psil.lua", "scada-common/tcallbackdsp.lua", "scada-common/rsio.lua", "scada-common/constants.lua", "scada-common/mqueue.lua", "scada-common/crash.lua", "scada-common/log.lua", "scada-common/types.lua", "scada-common/util.lua"], "graphics": ["graphics/element.lua", "graphics/flasher.lua", "graphics/core.lua", "graphics/elements/textbox.lua", "graphics/elements/displaybox.lua", "graphics/elements/pipenet.lua", "graphics/elements/rectangle.lua", "graphics/elements/div.lua", "graphics/elements/tiling.lua", "graphics/elements/colormap.lua", "graphics/elements/indicators/alight.lua", "graphics/elements/indicators/icon.lua", "graphics/elements/indicators/power.lua", "graphics/elements/indicators/rad.lua", "graphics/elements/indicators/state.lua", "graphics/elements/indicators/light.lua", "graphics/elements/indicators/vbar.lua", "graphics/elements/indicators/coremap.lua", "graphics/elements/indicators/data.lua", "graphics/elements/indicators/hbar.lua", "graphics/elements/indicators/trilight.lua", "graphics/elements/controls/switch_button.lua", "graphics/elements/controls/spinbox_numeric.lua", "graphics/elements/controls/hazard_button.lua", "graphics/elements/controls/push_button.lua", "graphics/elements/controls/radio_button.lua", "graphics/elements/controls/multi_button.lua", "graphics/elements/animations/waiting.lua"], "lockbox": ["lockbox/init.lua", "lockbox/LICENSE", "lockbox/kdf/pbkdf2.lua", "lockbox/util/bit.lua", "lockbox/util/array.lua", "lockbox/util/stream.lua", "lockbox/util/queue.lua", "lockbox/digest/sha2_224.lua", "lockbox/digest/sha1.lua", "lockbox/digest/sha2_256.lua", "lockbox/cipher/aes128.lua", "lockbox/cipher/aes256.lua", "lockbox/cipher/aes192.lua", "lockbox/cipher/mode/ofb.lua", "lockbox/cipher/mode/cbc.lua", "lockbox/cipher/mode/ctr.lua", "lockbox/cipher/mode/cfb.lua", "lockbox/mac/hmac.lua", "lockbox/padding/ansix923.lua", "lockbox/padding/pkcs7.lua", "lockbox/padding/zero.lua", "lockbox/padding/isoiec7816.lua"], "reactor-plc": ["reactor-plc/threads.lua", "reactor-plc/plc.lua", "reactor-plc/config.lua", "reactor-plc/startup.lua"], "rtu": ["rtu/threads.lua", "rtu/rtu.lua", "rtu/modbus.lua", "rtu/config.lua", "rtu/startup.lua", "rtu/dev/sps_rtu.lua", "rtu/dev/envd_rtu.lua", "rtu/dev/boilerv_rtu.lua", "rtu/dev/redstone_rtu.lua", "rtu/dev/sna_rtu.lua", "rtu/dev/imatrix_rtu.lua", "rtu/dev/turbinev_rtu.lua"], "supervisor": ["supervisor/supervisor.lua", "supervisor/unit.lua", "supervisor/config.lua", "supervisor/startup.lua", "supervisor/unitlogic.lua", "supervisor/facility.lua", "supervisor/session/coordinator.lua", "supervisor/session/svqtypes.lua", "supervisor/session/svsessions.lua", "supervisor/session/rtu.lua", "supervisor/session/plc.lua", "supervisor/session/rsctl.lua", "supervisor/session/rtu/boilerv.lua", "supervisor/session/rtu/txnctrl.lua", "supervisor/session/rtu/unit_session.lua", "supervisor/session/rtu/turbinev.lua", "supervisor/session/rtu/envd.lua", "supervisor/session/rtu/imatrix.lua", "supervisor/session/rtu/sps.lua", "supervisor/session/rtu/qtypes.lua", "supervisor/session/rtu/sna.lua", "supervisor/session/rtu/redstone.lua"], "coordinator": ["coordinator/coordinator.lua", "coordinator/renderer.lua", "coordinator/iocontrol.lua", "coordinator/sounder.lua", "coordinator/config.lua", "coordinator/startup.lua", "coordinator/apisessions.lua", "coordinator/process.lua", "coordinator/ui/dialog.lua", "coordinator/ui/style.lua", "coordinator/ui/layout/main_view.lua", "coordinator/ui/layout/unit_view.lua", "coordinator/ui/components/reactor.lua", "coordinator/ui/components/processctl.lua", "coordinator/ui/components/unit_overview.lua", "coordinator/ui/components/boiler.lua", "coordinator/ui/components/unit_detail.lua", "coordinator/ui/components/imatrix.lua", "coordinator/ui/components/unit_waiting.lua", "coordinator/ui/components/turbine.lua"], "pocket": ["pocket/config.lua", "pocket/startup.lua"]}, "depends": {"reactor-plc": ["system", "common"], "rtu": ["system", "common"], "supervisor": ["system", "common"], "coordinator": ["system", "common", "graphics"], "pocket": ["system", "common", "graphics"]}, "sizes": {"manifest": 0, "system": 1982, "common": 90550, "graphics": 99858, "lockbox": 100797, "reactor-plc": 75545, "rtu": 82913, "supervisor": 271184, "coordinator": 179394, "pocket": 335}}