Skip to content

Commit 6b722c0

Browse files
authored
Loosen image version check (#681)
The 2024 beta 1 image doesn't have an "FRC_" prefix. Also use name-capturing group for version.
1 parent e6d1839 commit 6b722c0

File tree

1 file changed

+2
-2
lines changed
  • src/main/java/edu/wpi/first/gradlerio/deploy/roborio

1 file changed

+2
-2
lines changed

src/main/java/edu/wpi/first/gradlerio/deploy/roborio/RoboRIO.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private boolean verifyOnlyIf(DeployContext ctx) {
125125

126126
private void readAndVerifyImage(DeployContext context) {
127127
final String imageFile = "/etc/natinst/share/scs_imagemetadata.ini";
128-
final Pattern pattern = Pattern.compile("^IMAGEVERSION\\s*=\\s*\\\"FRC_roboRIO2?_(\\d{4}_v\\d+(?:\\.\\d+)?)\\\"");
128+
final Pattern pattern = Pattern.compile("^IMAGEVERSION\\s*=\\s*\\\"(FRC_)?roboRIO2?_(?<version>\\d{4}_v\\d+(?:\\.\\d+)?)\\\"");
129129

130130
String content = context.execute("cat " + imageFile).getResult();
131131
log.info("Received Image File: ");
@@ -136,7 +136,7 @@ private void readAndVerifyImage(DeployContext context) {
136136
log.info(line);
137137
Matcher matcher = pattern.matcher(line.trim());
138138
if (matcher.matches()) {
139-
String imageGroup = matcher.group(1);
139+
String imageGroup = matcher.group("version");
140140
log.info("Matched version: " + imageGroup);
141141
verifyImageVersion(imageGroup);
142142
imageFound = true;

0 commit comments

Comments
 (0)