Skip to content

Commit

Permalink
cosmetic change
Browse files Browse the repository at this point in the history
Summary:
The second component of the version is a week number.

derp-cat

Test Plan:
```
0 ~/local/openbmc/tools/flashy $ ./build.sh; echo $?
0
0 ~/local/openbmc/tools/flashy $ go test ./...
?       github.com/facebook/openbmc/tools/flashy/flash_procedure        [no test files]
?       github.com/facebook/openbmc/tools/flashy/lib/logger     [no test files]
?       github.com/facebook/openbmc/tools/flashy/tests  [no test files]
?       github.com/facebook/openbmc/tools/flashy/utilities      [no test files]
ok      github.com/facebook/openbmc/tools/flashy        3.367s
ok      github.com/facebook/openbmc/tools/flashy/checks_and_remediations/bletchley      0.007s
ok      github.com/facebook/openbmc/tools/flashy/checks_and_remediations/common 0.290s
ok      github.com/facebook/openbmc/tools/flashy/checks_and_remediations/galaxy100      0.012s
ok      github.com/facebook/openbmc/tools/flashy/checks_and_remediations/wedge100       0.012s
ok      github.com/facebook/openbmc/tools/flashy/checks_and_remediations/yamp   0.011s
ok      github.com/facebook/openbmc/tools/flashy/install        0.009s
ok      github.com/facebook/openbmc/tools/flashy/lib/fileutils  0.015s
ok      github.com/facebook/openbmc/tools/flashy/lib/flash      0.015s
ok      github.com/facebook/openbmc/tools/flashy/lib/flash/flashcp      0.017s
ok      github.com/facebook/openbmc/tools/flashy/lib/flash/flashutils   0.010s
ok      github.com/facebook/openbmc/tools/flashy/lib/flash/flashutils/devices   0.011s
ok      github.com/facebook/openbmc/tools/flashy/lib/step       0.014s
ok      github.com/facebook/openbmc/tools/flashy/lib/utils      0.452s
ok      github.com/facebook/openbmc/tools/flashy/lib/validate   0.016s
ok      github.com/facebook/openbmc/tools/flashy/lib/validate/image     0.013s
ok      github.com/facebook/openbmc/tools/flashy/lib/validate/partition 0.030s
```

Reviewed By: lsiudut

Differential Revision: D50081770

fbshipit-source-id: 30b0ca964d8e63da29dd62110a9347c4f6ae69d6
  • Loading branch information
doranand authored and facebook-github-bot committed Oct 9, 2023
1 parent 7f9c8ee commit 3c90630
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func checkVersion(stepParams step.StepParams) step.StepExitError {
return step.ExitUnsafeToReboot{Err: errMsg}
}

const re = `bletchley-v(?P<year>[0-9]+).(?P<month>[0-9]+)`
const re = `bletchley-v(?P<year>[0-9]+).(?P<week>[0-9]+)`
versionMap, err := utils.GetRegexSubexpMap(re, version)
if err != nil {
errMsg := errors.Errorf("Unable to parse version info: %v", err)
Expand All @@ -51,13 +51,13 @@ func checkVersion(stepParams step.StepParams) step.StepExitError {
return step.ExitUnsafeToReboot{Err: errMsg}
}

month, err := strconv.Atoi(versionMap["month"])
week, err := strconv.Atoi(versionMap["week"])
if err != nil {
errMsg := errors.Errorf("Unable to parse version info: %v", err)
return step.ExitUnsafeToReboot{Err: errMsg}
}

if year < 2023 || (year == 2023 && month < 07) {
if year < 2023 || (year == 2023 && week < 07) {
errMsg := errors.Errorf("Cannot upgrade this version: %v", version)
return step.ExitUnsafeToReboot{Err: errMsg}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestCheckVersion(t *testing.T) {
version: "garbage",
err: nil,
want: step.ExitUnsafeToReboot{
errors.Errorf("Unable to parse version info: No match for regex 'bletchley-v(?P<year>[0-9]+).(?P<month>[0-9]+)' for input 'garbage'"),
errors.Errorf("Unable to parse version info: No match for regex 'bletchley-v(?P<year>[0-9]+).(?P<week>[0-9]+)' for input 'garbage'"),
},
},
{
Expand Down

0 comments on commit 3c90630

Please sign in to comment.