time for VCS_VERSION to go

This commit is contained in:
Andrey 2024-05-29 17:45:41 -04:00
parent 5cab4c441e
commit 5ba6236318
4 changed files with 5 additions and 86 deletions

View File

@ -77,10 +77,10 @@
#include "software_knock.h"
#include "electronic_throttle.h"
#include "live_data.h"
#include "efi_quote.h"
#include <string.h>
#include "bench_test.h"
#include "svnversion.h"
#include "status_loop.h"
#include "mmc_card.h"
@ -413,7 +413,7 @@ static void handleTestCommand(TsChannelBase* tsChannel) {
* extension of the protocol to simplify troubleshooting
*/
tunerStudioDebug(tsChannel, "got T (Test)");
tsChannel->write((const uint8_t*)VCS_VERSION, sizeof(VCS_VERSION));
tsChannel->write((const uint8_t*)QUOTE(SIGNATURE_HASH), sizeof(QUOTE(SIGNATURE_HASH)));
chsnprintf(testOutputBuffer, sizeof(testOutputBuffer), " %d %d", engine->engineState.warnings.lastErrorCode, tsState.testCommandCounter);
tsChannel->write((const uint8_t*)testOutputBuffer, strlen(testOutputBuffer));
@ -650,7 +650,7 @@ extern CommandHandler console_line_callback;
static void handleGetVersion(TsChannelBase* tsChannel) {
char versionBuffer[32];
chsnprintf(versionBuffer, sizeof(versionBuffer), "rusEFI v%d@%s", getRusEfiVersion(), VCS_VERSION);
chsnprintf(versionBuffer, sizeof(versionBuffer), "rusEFI v%d@%s", getRusEfiVersion(), QUOTE(SIGNATURE_HASH));
tsChannel->sendResponse(TS_CRC, (const uint8_t *) versionBuffer, strlen(versionBuffer) + 1);
}

View File

@ -1,3 +1,5 @@
// efi_quote.h
#pragma once
#define Q(x) #x

Binary file not shown.

View File

@ -1,83 +0,0 @@
package com.rusefi;
import java.io.*;
import java.util.Date;
/**
* Andrey Belomutskiy (c) 2014
*/
public class Version2Header {
private static final String NL = "\n";//System.getProperty("line.separator");
private static final String SVN_COMMAND = "svn info ";
private static final String VERSION_MARKER = "Last Changed Rev: ";
private static final String HEADER_TAG = "VCS_VERSION";
private static final String GIT_HASH_TAG = "GIT_HASH";
public static void main(String[] args) throws IOException {
if (args.length != 3) {
System.out.println("offset, URL and githash should be specified");
System.exit(-1);
}
int versionOffsetValue = Integer.parseInt(args[0]);
String url = args[1];
String gitHash = args[2];
System.out.println("Hi, it's " + new Date());
if (url.isEmpty()) {
System.out.println("Looking for local version");
} else {
System.out.println("Looking for remove version: " + url);
}
String command = SVN_COMMAND + url;
System.out.println("Working with " + NL.length() + " line ends, offset " + versionOffsetValue);
Process simulatorProcess = null;
try {
System.out.println("Executing [" + command + "]");
simulatorProcess = Runtime.getRuntime().exec(command);
BufferedReader stdout =
new BufferedReader(new InputStreamReader(simulatorProcess.getInputStream()));
int counter = 0;
String line;
while ((line = stdout.readLine()) != null) {
System.out.println("from " + command + ": " + line);
counter++;
if (line.startsWith(VERSION_MARKER)) {
String ver = line.substring(VERSION_MARKER.length());
System.out.println("Version [" + ver + "]");
int version = Integer.parseInt(ver);
writeFile(versionOffsetValue + version, gitHash);
}
}
System.out.println("Got " + counter + " lines of stdout");
while ((line = stdout.readLine()) != null) {
System.out.println("Stderr: " + line);
}
} catch (Throwable e) {
System.err.println("Ops: " + e);
e.printStackTrace();
} finally {
if (simulatorProcess != null)
simulatorProcess.destroy();
}
}
private static void writeFile(int version, String gitHash) throws IOException {
BufferedWriter bw = new BufferedWriter(new FileWriter("svnversion.h"));
bw.write("// This file was generated by Version2Header" + NL);
bw.write("// " + new Date() + NL);
bw.write(NL + NL);
bw.write("#ifndef " + GIT_HASH_TAG + NL);
bw.write("#define " + GIT_HASH_TAG + " \"" + gitHash + "\"" + NL);
bw.write("#endif" + NL);
bw.write(NL + NL);
bw.write("#ifndef " + HEADER_TAG + NL);
bw.write("#define " + HEADER_TAG + " \"" + version + "\"" + NL);
bw.write("#endif" + NL);
bw.close();
}
}