|
@@ -21,6 +21,7 @@ import java.nio.file.StandardCopyOption;
|
|
|
import java.text.DateFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
+import java.util.function.Consumer;
|
|
|
|
|
|
public class FirmwareAutoDumper
|
|
|
{
|
|
@@ -35,6 +36,8 @@ public class FirmwareAutoDumper
|
|
|
private static final String[] hackfixsuffixes = new String[]
|
|
|
{"-rc","rc","-build","build"};
|
|
|
|
|
|
+ private static final Map<String,List<String>> forceVersionsForCheck = new HashMap<>();
|
|
|
+
|
|
|
private static final String[][] indexes = new String[][]
|
|
|
{{
|
|
|
"main","http://firmware.sena.com/senabluetoothmanager/Firmware"},{
|
|
@@ -76,6 +79,22 @@ public class FirmwareAutoDumper
|
|
|
state.setFirmwares(new LinkedHashMap<>());
|
|
|
}
|
|
|
|
|
|
+ BufferedReader fakerfile = new BufferedReader(new FileReader(statefile.toString()+".forced"));
|
|
|
+ fakerfile.lines().forEach((line)->
|
|
|
+ {
|
|
|
+ String[] linesplitted = line.split("::");
|
|
|
+ if(linesplitted.length!=2)
|
|
|
+ {
|
|
|
+ l.warn("Malformed Line at forcefile: "+line);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ forceVersionsForCheck.putIfAbsent(linesplitted[0],new ArrayList<>());
|
|
|
+ List<String> fakeindex = forceVersionsForCheck.get(linesplitted[0]);
|
|
|
+ fakeindex.add(linesplitted[1]);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
state.getFirmwares().forEach((k,v)->
|
|
|
{
|
|
|
v.getVersions().entrySet().removeIf((e)->{
|
|
@@ -118,7 +137,8 @@ public class FirmwareAutoDumper
|
|
|
BufferedReader br = new BufferedReader(new FileReader(fw));
|
|
|
final HashMap<String, String> basenamelookup = new LinkedHashMap<>();
|
|
|
// filename --> real basename
|
|
|
- br.lines().forEach((line) ->
|
|
|
+
|
|
|
+ Consumer<String> linehandler = (line) ->
|
|
|
{
|
|
|
String[] linesplitted = line.split(":");
|
|
|
|
|
@@ -160,7 +180,13 @@ public class FirmwareAutoDumper
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- });
|
|
|
+ };
|
|
|
+
|
|
|
+ br.lines().forEach(linehandler);
|
|
|
+
|
|
|
+ //forcelist entires = index entries with index name prepended with a ::, prefix already removed at this point
|
|
|
+ var forceToCheck = forceVersionsForCheck.getOrDefault(index[0],new ArrayList<String>()); //empty for no forcelist entries
|
|
|
+ forceToCheck.forEach(linehandler);
|
|
|
br.close();
|
|
|
y.dump(state, new FileWriter(statefile));
|
|
|
if (!DUMMY_MODE) {
|
|
@@ -441,7 +467,13 @@ public class FirmwareAutoDumper
|
|
|
{
|
|
|
String lastSuffix = rchackfix?hackfixsuffix:".";
|
|
|
String synthesizedFileName = prefix+(major)+"."+minor+lastSuffix+(patch)+suffix;
|
|
|
- if(!knownVersions.containsKey(synthesizedFileName))
|
|
|
+ boolean nopeOutVersion = false;
|
|
|
+ var fwVersion = knownVersions.getOrDefault(synthesizedFileName,null);
|
|
|
+ if(fwVersion!=null&&fwVersion.isFiller())
|
|
|
+ {
|
|
|
+ nopeOutVersion=true;
|
|
|
+ }
|
|
|
+ if(!knownVersions.containsKey(synthesizedFileName)||nopeOutVersion)
|
|
|
{
|
|
|
FirmwareVersion f = getFirmware(major,minor,patch,false,synthesizedFileName,rchackfix,hackfixsuffix,indexUsed);
|
|
|
f.setSusVersion(useForSusVersion);
|