@@ -16,7 +16,7 @@ fn main() {
1616 // Display start time
1717 let start_ts = timestamp();
1818 let start_time = datetime_local();
19- print(` Starting at ${start_time}`);
19+ debug(`info| Starting at ${start_time}`);
2020
2121 let conf = process_cli(argv);
2222 switch type_of(conf) {
@@ -58,7 +58,7 @@ fn main() {
5858 print(`The SP probably needs to be reset before continuing`);
5959 print(`Trying to abort the update with id=${id}`);
6060 let r = faux_mgs(["update-abort", component, `${id}`]);
61- debug(`update-abort = ${r}`);
61+ debug(`info| update-abort = ${r}`);
6262 }
6363 }
6464 if problems == 0 {
@@ -107,7 +107,7 @@ fn main() {
107107 }
108108
109109 // Update RoT with baseline image
110- debug(`Flash baseline rot hubris`);
110+ debug(`info| Flash baseline rot hubris`);
111111 if flash_rot && !update_rot_hubris(conf.base.rot_a, conf.base.rot_b) {
112112 return 1
113113 }
@@ -120,7 +120,7 @@ fn main() {
120120 let result = image_check("base", images);
121121 if result?.error != () || result.ok.sp || result.ok.rot {
122122 // Not able to check images or one or both base images not installed.
123- debug(`image_check error or failed BASE image updates: ${result}`);
123+ debug(`warn| image_check error or failed BASE image updates: ${result}`);
124124 return 1;
125125 }
126126 }
@@ -144,25 +144,25 @@ fn main() {
144144 "rot_b_path": conf.base.rot_b,
145145 }
146146 ] {
147- print("");
148- print(`## ${v.up_down} to ${v.label} images`);
149- debug(`${v.up_down} SP Hubris to ${v.label} image`);
150- if !update_sp(v.sp_path) {
151- print(`Failed to ${v.up_down} SP Hubris to ${v.label} image`);
152- return 1;
153- }
154- debug(`${v.up_down} Rot Hubris to ${v.label} image`);
147+ debug(`info|${v.up_down} Rot Hubris to ${v.label} image`);
155148 if !update_rot_hubris(v.rot_a_path, v.rot_b_path) {
156- print(` Failed to ${v.up_down} RoT Hubris to ${v.label} image: ${r}`);
149+ debug(`error| Failed to ${v.up_down} RoT Hubris to ${v.label} image: ${r}`);
157150 return 1
158151 }
152+
153+ debug(`info|${v.up_down} SP Hubris to ${v.label} image`);
154+ if !update_sp(v.sp_path) {
155+ debug(`error|Failed to ${v.up_down} SP Hubris to ${v.label} image: ${r}`);
156+ return 1;
157+ }
158+
159159 let result = image_check(v.branch, images);
160160 if result?.error != () || result.ok.sp || result.ok.rot {
161161 // Not able to check images or one or both ${branch} images not installed.
162- debug(`image_check error or failed ${label} image updates: ${result}`);
162+ debug(`error| image_check error or failed ${label} image updates: ${result}`);
163163 return 1;
164164 }
165- print(` ### SUCCESS: ${v.up_down} to SP and RoT ${v.label} images`);
165+ debug(`info| ### SUCCESS: ${v.up_down} to SP and RoT ${v.label} images`);
166166 }
167167
168168 print("");
@@ -242,15 +242,37 @@ fn process_cli(argv) {
242242 print(`No configuration for image ${branch}.${image}`);
243243 } else {
244244 conf[branch][image] = zip_path;
245- debug(`conf.${branch}.${image}=${zip_path}`);
245+ debug(`info| conf.${branch}.${image}=${zip_path}`);
246246 }
247247 };
248248 }
249249
250+ // If ipcc has been specified, then include that as well
251+ let faux_ipcc_path = config?.ipcc?.faux_ipcc;
252+ let x = 1;
253+ let a = if x == 2 {
254+ 3
255+ } else {
256+ 4
257+ };
258+ print(x);
259+ conf.ipcc = if faux_ipcc_path != () {
260+ #{
261+ "use_ipcc": true,
262+ "faux_ipcc": util::env_expand(config.ipcc.faux_ipcc, config),
263+ "port": util::env_expand(config.ipcc?.port, config),
264+ }
265+ } else {
266+ #{
267+ "use_ipcc": false,
268+ }
269+ };
270+
250271 if conf.verbose {
251272 print("");
252273 print(`Parsed conf=${conf}`);
253274 }
275+
254276 conf
255277}
256278
@@ -350,7 +372,7 @@ fn check_update_in_progress(component) {
350372 let r = faux_mgs(["update-status", component]);
351373 debug(`update_status(${component})=${r}`);
352374 if r?.Err != () {
353- debug(`failed update-status: ${r}`);
375+ debug(`error| failed update-status: ${r}`);
354376 return r;
355377 }
356378 if r?.Ok == "None" {
@@ -374,7 +396,7 @@ fn check_update_in_progress(component) {
374396 "id": util::to_hexstring(r.Complete),
375397 };
376398 }
377- debug(`update-status: ${r}`);
399+ debug(`error| update-status: ${r}`);
378400 return #{"Err": `unknown update-status: ${r}`};
379401}
380402
@@ -388,7 +410,7 @@ fn update_sp(sp_zip) {
388410 if r?.ack == "updated" {
389411 print("flash_sp updated");
390412 } else {
391- debug("#### FAILED flash_sp update");
413+ debug("error| #### FAILED flash_sp update");
392414 print("FAIL\n");
393415 return false;
394416 }
@@ -404,7 +426,7 @@ fn update_sp(sp_zip) {
404426 let r = faux_mgs(["component-active-slot", "--persist", "-s", "0", "sp"]);
405427 debug(`persist result = ${r}`);
406428 if r?["ack"] == () || r.ack != "set" || r.slot != 0 {
407- debug("Failed to persist");
429+ debug("error| Failed to persist");
408430 print("FAIL\n");
409431 return false;
410432 }
@@ -414,7 +436,7 @@ fn update_sp(sp_zip) {
414436 let r = faux_mgs(["reset"]);
415437 debug(`faux-mgs reset => ${r}`);
416438 if r?.ack != "reset" {
417- debug(`unexpected sp reset response: ${r}`);
439+ debug(`warn| unexpected sp reset response: ${r}`);
418440 print("FAIL\n");
419441 return false;
420442 }
@@ -463,13 +485,13 @@ fn update_rot_hubris(path_a, path_b) {
463485 let r = faux_mgs(["component-active-slot", "-p", "-s", `${rot_update_slot}`, "rot"]);
464486 debug(`persist result = ${r}`);
465487 if r?.ack == () || r.ack != "set" || r.slot != rot_update_slot {
466- debug(`Failed to persist rot: r=${r}`);
488+ debug(`error| Failed to persist rot: r=${r}`);
467489 print("");
468490 return false;
469491 }
470492 let r = faux_mgs(["reset-component", "rot"]);
471493 if r?.ack != "reset" {
472- debug(`reset failed: ${r}`);
494+ debug(`error| reset failed: ${r}`);
473495 print("");
474496 return false;
475497 }
@@ -535,7 +557,7 @@ fn image_check(branch, images) {
535557
536558 let need_flash = rot_needs_flashing(`${branch}`, images.by_gitc);
537559 if need_flash?.error != () {
538- debug(`Error: ${need_flash}`);
560+ debug(`error| ${need_flash}`);
539561 error["rot"] = `${flash_rot}`;
540562 } else {
541563 ok["rot"] = need_flash.ok;
@@ -583,13 +605,13 @@ fn rot_needs_flashing(branch, gitc) {
583605 debug(`gitc[${rot_gitc}]=${gitc?[rot_gitc]}`);
584606 let known_gitc = gitc?[rot_gitc];
585607 if known_gitc == () {
586- print(" the RoT is not running a BASE or UNDER-TEST image.");
608+ debug("info| the RoT is not running a BASE or UNDER-TEST image.");
587609 #{"ok": true}
588610 } else if branch_rot_name in known_gitc {
589- debug(`${branch_rot_name} IS in ${known_gitc}`);
611+ debug(`info| ${branch_rot_name} IS in ${known_gitc}`);
590612 #{"ok": false}
591613 } else {
592- debug(`${branch_rot_name} IS NOT in ${known_gitc}`);
614+ debug(`info| ${branch_rot_name} IS NOT in ${known_gitc}`);
593615 #{"ok": true}
594616 }
595617}
0 commit comments