https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6b0ddf68139a3a244d75df...
commit 6b0ddf68139a3a244d75df274fec2da6eeb8eadd Author: Mark Jansen mark.jansen@reactos.org AuthorDate: Sat Feb 8 22:07:45 2020 +0100 Commit: Colin Finck colin@reactos.org CommitDate: Sat Feb 22 13:48:18 2020 +0100
[LOG2LINES] Remove SVN leftovers --- sdk/tools/log2lines/CMakeLists.txt | 1 - sdk/tools/log2lines/cmd.c | 73 --------- sdk/tools/log2lines/config.h | 4 - sdk/tools/log2lines/help.c | 31 ---- sdk/tools/log2lines/log2lines.c | 27 ---- sdk/tools/log2lines/log2lines.h | 2 - sdk/tools/log2lines/options.c | 17 +-- sdk/tools/log2lines/options.h | 2 - sdk/tools/log2lines/revision.c | 299 ------------------------------------- sdk/tools/log2lines/revision.h | 27 ---- 10 files changed, 1 insertion(+), 482 deletions(-)
diff --git a/sdk/tools/log2lines/CMakeLists.txt b/sdk/tools/log2lines/CMakeLists.txt index bc74e8e8a3a..6d726e7b2f2 100644 --- a/sdk/tools/log2lines/CMakeLists.txt +++ b/sdk/tools/log2lines/CMakeLists.txt @@ -8,7 +8,6 @@ list(APPEND SOURCE log2lines.c match.c options.c - revision.c stat.c util.c)
diff --git a/sdk/tools/log2lines/cmd.c b/sdk/tools/log2lines/cmd.c index 6fd8566a467..51c15a61c1e 100644 --- a/sdk/tools/log2lines/cmd.c +++ b/sdk/tools/log2lines/cmd.c @@ -101,48 +101,6 @@ handle_switch_str(FILE *outFile, char *sw, char *arg, char *desc) return changed; }
-static int -handle_switch_pstr(FILE *outFile, char **psw, char *arg, char *desc) -{ - int changed =0; - - if (arg) - { - if (strcmp(arg,"") != 0) - { - if (strcmp(arg,KDBG_ESC_OFF) == 0) - { - if (*psw) - changed = 1; - free(*psw); - *psw = NULL; - } - else - { - if (!*psw) - { - *psw = malloc(LINESIZE); - **psw = '\0'; - } - - if (strcmp(arg, *psw) != 0) - { - strcpy(*psw, arg); - changed = 1; - } - } - } - } - if (desc) - { - esclog(outFile, "%s is "%s" (%s)\n", desc, *psw, changed ? "changed":"unchanged"); - if (!arg) - esclog(outFile, "(readonly)\n"); - } - - return changed; -} - static int handle_address_cmd(FILE *outFile, char *arg) { @@ -257,36 +215,6 @@ handle_escape_cmd(FILE *outFile, char *Line) case 'r': handle_switch(outFile, &opt_raw, arg, "-r Raw"); break; - case 'R': - changed = handle_switch_pstr(outFile, &opt_Revision, arg, NULL); - opt_Revision_check = 0; - if (opt_Revision) - { - opt_Revision_check = 1; - if (strstr(opt_Revision, "check") == opt_Revision) - { - esclog(outFile, "-R is "%s" (%s)\n", opt_Revision, changed ? "changed":"unchanged"); - } - else if (strstr(opt_Revision, "regscan") == opt_Revision) - { - char *s = strchr(opt_Revision, ','); - - revinfo.range = DEF_RANGE; - if (s) - { - *s++ = '\0'; - revinfo.range = atoi(s); - } - regscan(outFile); - } - else if (strstr(opt_Revision, "regclear") == opt_Revision) - { - list_clear(&sources); - summ.regfound = 0; - esclog(outFile, "cleared regression scan results\n"); - } - } - break; case 's': if (strcmp(arg,"clear") == 0) { @@ -302,7 +230,6 @@ handle_escape_cmd(FILE *outFile, char *Line) { handle_switch(outFile, &opt_undo, "1", "-u Undo"); handle_switch(outFile, &opt_redo, "1", "-U Undo and reprocess"); - opt_Revision_check = 1; } esclog(outFile, "-S Sources option is %d+%d,"%s"\n", opt_Source, opt_SrcPlus, opt_SourcesPath); esclog(outFile, "(Setting source tree not implemented)\n"); diff --git a/sdk/tools/log2lines/config.h b/sdk/tools/log2lines/config.h index e07dfa259b9..18aa7702cea 100644 --- a/sdk/tools/log2lines/config.h +++ b/sdk/tools/log2lines/config.h @@ -5,10 +5,6 @@ #define INVALID_BASE 0xFFFFFFFFL
#define LOGBOTTOM "--------" -#define SVNDB "svndb.log" -#define SVNDB_INX "svndb.inx" -#define DEF_RANGE 500 -#define MAGIC_INX 0x494E585F //'INX_' #define DEF_OPT_DIR "output-i386" #define SOURCES_ENV "_ROSBE_ROSSOURCEDIR" #define CACHEFILE "log2lines.cache" diff --git a/sdk/tools/log2lines/help.c b/sdk/tools/log2lines/help.c index c036d4857c7..90f4dc1d4bb 100644 --- a/sdk/tools/log2lines/help.c +++ b/sdk/tools/log2lines/help.c @@ -64,35 +64,6 @@ char *verboseUsage = " - Input file redirection.\n" " - Pipelining byte streams, needed for the -c option.\n\n" " -r Raw output without translation.\n\n" -" -R <cmd>\n" -" Revision commands interfacing with SVN. <cmd> is one of:\n" -" - check:\n" -" To be combined with -S. Check each source file in the log and issue\n" -" a warning if its revision is higher than that of the tested build.\n" -" Also when the revison of the source tree is lower than that of the\n" -" tested build (for every source file).\n" -" In both cases the source file's -S output would be unreliable.\n" -" - update:\n" -" Updates the SVN log file. Currently only generates the index file\n" -" The SVN log file itself must be generated by hand in the sources\n" -" directory like this (-v is mandatory here):\n" -" svn log -v > svndb.log ('svn log' accepts also a range)\n" -" 'svndb.log' and its index are needed for '-R regscan'\n" -" - regscan[,<range>]:\n" -" Scan for regression candidates. Essentially it tries to find\n" -" matches between the SVN log entries and the sources hit by\n" -" a backtrace (bt) command.\n" -" <range> is the amount of revisions to look back from the build\n" -" revision (default 500)\n" -" The output of '-R regscan' is printed after EOF. The 'Changed path'\n" -" lists will contain only matched files.\n" -" Limitations:\n" -" - The bug should really be a regression.\n" -" - Expect a number of false positives.\n" -" - The offending change must be in the sources hit by the backtrace.\n" -" This mostly excludes changes in headerfiles for example.\n" -" - Must be combined with -S.\n" -" Can be combined with -tTS.\n\n" " -s Statistics. A summary with the following info is printed after EOF:\n" " *** LOG2LINES SUMMARY ***\n" " - Translated: Translated lines.\n" @@ -149,8 +120,6 @@ char *verboseUsage = " - Do a 'mod' first to retrieve relocation info.\n" " - `h : shows this helptext (without exiting)\n" " - `q : quits log2lines\n" -" - `R regscan : the output is printed immediately (do a 'bt' first)\n" -" - `R regclear : clears previous regscan matches\n" " - `s : the output is printed immediately\n" " - `s clear : clears all statistics.\n" " - `S : only <context> and <add> can be set.\n" diff --git a/sdk/tools/log2lines/log2lines.c b/sdk/tools/log2lines/log2lines.c index 54955210579..5d00d991530 100644 --- a/sdk/tools/log2lines/log2lines.c +++ b/sdk/tools/log2lines/log2lines.c @@ -34,7 +34,6 @@ LINEINFO lastLine; FILE *logFile = NULL; LIST cache; SUMM summ; -REVINFO revinfo;
static void @@ -99,7 +98,6 @@ reportSource(FILE *outFile) static void report(FILE *outFile) { - reportRevision(outFile); reportSource(outFile); clearLastLine(); } @@ -535,17 +533,6 @@ translate_files(FILE *inFile, FILE *outFile) } }
- if (opt_Revision && (strstr(opt_Revision, "regscan") == opt_Revision)) - { - char *s = strchr(opt_Revision, ','); - if (s) - { - *s++ = '\0'; - revinfo.range = atoi(s); - } - regscan(outFile); - } - if (opt_stats) { stat_print(outFile, &summ); @@ -571,7 +558,6 @@ main(int argc, const char **argv) memset(&cache, 0, sizeof(LIST)); memset(&sources, 0, sizeof(LIST)); stat_clear(&summ); - memset(&revinfo, 0, sizeof(REVINFO)); clearLastLine();
optInit = optionInit(argc, argv); @@ -585,12 +571,6 @@ main(int argc, const char **argv)
argc -= optCount;
- if (opt_Revision && (strcmp(opt_Revision, "update") == 0)) - { - res = updateSvnlog(); - goto cleanup; - } - if (check_directory(opt_force)) { res = 3; @@ -677,13 +657,6 @@ main(int argc, const char **argv) PCLOSE(dbgIn);
cleanup: - // See optionParse(). - if (opt_Revision) - { - free(opt_Revision); - opt_Revision = NULL; - } - // See optionInit(). if (opt_Pipe) { diff --git a/sdk/tools/log2lines/log2lines.h b/sdk/tools/log2lines/log2lines.h index ae73f96497d..aae92c1cbf5 100644 --- a/sdk/tools/log2lines/log2lines.h +++ b/sdk/tools/log2lines/log2lines.h @@ -5,7 +5,6 @@ #include <rsym.h>
#include "config.h" -#include "revision.h" #include "stat.h" #include "list.h"
@@ -24,7 +23,6 @@ struct lineinfo_struct typedef struct lineinfo_struct LINEINFO;
extern SUMM summ; -extern REVINFO revinfo; extern LIST cache; extern FILE *logFile; extern LINEINFO lastLine; diff --git a/sdk/tools/log2lines/options.c b/sdk/tools/log2lines/options.c index 8fb9bb2b7cd..0796e8158c2 100644 --- a/sdk/tools/log2lines/options.c +++ b/sdk/tools/log2lines/options.c @@ -17,7 +17,7 @@ #include "log2lines.h" #include "options.h"
-char *optchars = "bcd:fFhl:L:mMP:rR:sS:tTuUvz:"; +char *optchars = "bcd:fFhl:L:mMP:rsS:tTuUvz:"; int opt_buffered = 0; // -b int opt_help = 0; // -h int opt_force = 0; // -f @@ -37,8 +37,6 @@ int opt_twice = 0; // -t int opt_Twice = 0; // -T int opt_undo = 0; // -u int opt_redo = 0; // -U -char *opt_Revision = NULL; // -R -int opt_Revision_check = 0; // -R check char opt_dir[PATH_MAX]; // -d <opt_dir> char opt_logFile[PATH_MAX]; // -l|L <opt_logFile> char *opt_mod = NULL; // -mod for opt_logFile @@ -61,10 +59,6 @@ int optionInit(int argc, const char **argv) strcpy(opt_SourcesPath, ""); if ((s = getenv(SOURCES_ENV))) strcpy(opt_SourcesPath, s); - revinfo.rev = getRevision(NULL, 1); - revinfo.range = DEF_RANGE; - revinfo.buildrev = getTBRevision(opt_dir); - l2l_dbg(1, "Trunk build revision: %d\n", revinfo.buildrev);
strcpy(opt_scanned, "");
@@ -164,14 +158,6 @@ int optionParse(int argc, const char **argv) optCount++; //just count, see optionInit() break; - case 'R': - optCount++; - if (!opt_Revision) - opt_Revision = malloc(LINESIZE); - sscanf(optarg, "%s", opt_Revision); - if (strcmp(opt_Revision, "check") == 0) - opt_Revision_check ++; - break; case 's': opt_stats++; break; @@ -186,7 +172,6 @@ int optionParse(int argc, const char **argv) /* need to retranslate for source info: */ opt_undo++; opt_redo++; - opt_Revision_check ++; } break; case 't': diff --git a/sdk/tools/log2lines/options.h b/sdk/tools/log2lines/options.h index a3f2d75ba83..e33d9d0ec6e 100644 --- a/sdk/tools/log2lines/options.h +++ b/sdk/tools/log2lines/options.h @@ -27,8 +27,6 @@ extern int opt_twice; // -t extern int opt_Twice ; // -T extern int opt_undo ; // -u extern int opt_redo ; // -U -extern char *opt_Revision; // -R -extern int opt_Revision_check; // -R check extern char opt_dir[]; // -d <opt_dir> extern char opt_logFile[]; // -l <opt_logFile> extern char *opt_mod; // mod for opt_logFile diff --git a/sdk/tools/log2lines/revision.c b/sdk/tools/log2lines/revision.c deleted file mode 100644 index 82ecb28d2c3..00000000000 --- a/sdk/tools/log2lines/revision.c +++ /dev/null @@ -1,299 +0,0 @@ -/* - * ReactOS log2lines - * Written by Jan Roeloffzen - * - * - SVN interface and revision analysis - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#include "version.h" -#include "compat.h" -#include "util.h" -#include "options.h" -#include "log2lines.h" - -static void -log_rev_check(FILE *outFile, char *fileName, int showfile) -{ - int rev = 0; - char s[LINESIZE]; - - strcpy(s, opt_SourcesPath); - strcat(s, fileName); - rev = getRevision(s, 1); - if (!showfile) - s[0] = '\0'; - if (revinfo.opt_verbose) - log(outFile, "| R--- %s Last Changed Rev: %d\n", s, rev); - - if (rev && opt_Revision_check) - { - if (revinfo.rev < revinfo.buildrev) - { - summ.revconflicts++; - log(outFile, "| R--- Conflict %s: source tree(%d) < build(%d)\n", s, rev, revinfo.buildrev); - } - else if (rev > revinfo.buildrev) - { - summ.revconflicts++; - log(outFile, "| R--- Conflict %s: file(%d) > build(%d)\n", s, rev, revinfo.buildrev); - } - } -} - -static void -logRevCheck(FILE *outFile) -{ - int twice = 0; - - twice = (lastLine.nr2 && strcmp(lastLine.file1, lastLine.file2) != 0); - log_rev_check(outFile, lastLine.file1, twice); - if (twice) - { - log_rev_check(outFile, lastLine.file2, twice); - } -} - -int -getRevision(char *fileName, int lastChanged) -{ - char s[LINESIZE]; - FILE *psvn; - int rev = 0; - - if (!fileName) - fileName = opt_SourcesPath; - sprintf(s, "svn info %s", fileName); - if ((psvn = POPEN(s, "r"))) - { - while (fgets(s, LINESIZE, psvn)) - { - if (lastChanged) - { - if (sscanf(s, "Last Changed Rev: %d", &rev)) - break; - } - else - { - if (sscanf(s, "Revision: %d", &rev)) - break; - } - } - } - else - l2l_dbg(1, "Can't popen: "%s"\n", s); - - if (psvn) - PCLOSE(psvn); - - return rev; -} - -int -getTBRevision(char *fileName) -{ - char *s; - int rev = 0; - - s = strrchr(fileName, PATH_CHAR); - if (s) - s += 1; - else - s = fileName; - - sscanf(s, TRKBUILDPREFIX "%d", &rev); - if (!rev) - { - s = strrchr(fileName, PATH_CHAR); - if (s) - *s = '\0'; // clear, so we have the parent dir - else - { - // where else to look? - fileName = opt_SourcesPath; - } - rev = getRevision(fileName, 1); - if (s) - *s = PATH_CHAR; // restore - } - - l2l_dbg(1, "TBRevision: %d\n", rev); - return rev; -} - - -void -reportRevision(FILE *outFile) -{ - if (opt_Revision_check) - { - if (lastLine.valid) - logRevCheck(outFile); - } -} - -unsigned long -findRev(FILE *finx, int *rev) -{ - unsigned long pos = 0L; - - while (!fseek(finx, (*rev) * sizeof(unsigned long), SEEK_SET)) - { - fread(&pos, sizeof(long), 1, finx); - (*rev)--; - if (pos) - break; - } - return pos; -} - -int -regscan(FILE *outFile) -{ - int res = 0; - char logname[PATH_MAX]; - char inxname[PATH_MAX]; - char line[LINESIZE + 1]; - char line2[LINESIZE + 1]; - FILE *flog = NULL; - FILE *finx = NULL; - unsigned long pos = 0L; - int r; - - sprintf(logname, "%s" PATH_STR "%s", opt_SourcesPath, SVNDB); - sprintf(inxname, "%s" PATH_STR "%s", opt_SourcesPath, SVNDB_INX); - flog = fopen(logname, "rb"); - finx = fopen(inxname, "rb"); - - if (flog && finx) - { - r = revinfo.buildrev; - if (!fread(&pos, sizeof(long), 1, finx)) - { - res = 2; - l2l_dbg(0, "Cannot read magic number\n"); - } - - if (!res) - { - if (pos != MAGIC_INX) - { - res = 3; - l2l_dbg(0, "Incorrect magic number (%lx)\n", pos); - } - } - - if (!res) - { - char flag[2]; - char path[PATH_MAX]; - char path2[PATH_MAX]; - int wflag = 0; - clilog(outFile, "Regression candidates:\n"); - while (( pos = findRev(finx, &r) )) - { - if (r < (revinfo.buildrev - revinfo.range)) - { - l2l_dbg(1, "r%d is outside range of %d revisions\n", r, revinfo.range); - break; - } - fseek(flog, pos, SEEK_SET); - wflag = 1; - fgets(line, LINESIZE, flog); - fgets(line2, LINESIZE, flog); - while (fgets(line2, LINESIZE, flog)) - { - path2[0] = '\0'; - if (sscanf(line2, "%1s %s %s", flag, path, path2) >= 2) - { - if (entry_lookup(&sources, path) || entry_lookup(&sources, path2)) - { - if (wflag == 1) - { - clilog(outFile, "%sChanged paths:\n", line); - summ.regfound++; - wflag = 2; - } - clilog(outFile, "%s", line2); - } - } - else - break; - } - if (wflag == 2) - { - int i = 0; - clilog(outFile, "\n"); - while (fgets(line2, LINESIZE, flog)) - { - i++; - clilog(outFile, "%s", line2); - if (strncmp(LOGBOTTOM, line2, sizeof(LOGBOTTOM) - 1) == 0) - break; - } - } - } - } - } - else - { - res = 1; - l2l_dbg(0, "Cannot open %s or %s\n", logname, inxname); - } - - if (flog) - fclose(flog); - if (finx) - fclose(finx); - - return res; -} - - -int -updateSvnlog(void) -{ - int res = 0; - char logname[PATH_MAX]; - char inxname[PATH_MAX]; - char line[LINESIZE + 1]; - FILE *flog = NULL; - FILE *finx = NULL; - unsigned long pos; - int r, y, m, d; - char name[NAMESIZE]; - - sprintf(logname, "%s" PATH_STR "%s", opt_SourcesPath, SVNDB); - sprintf(inxname, "%s" PATH_STR "%s", opt_SourcesPath, SVNDB_INX); - flog = fopen(logname, "rb"); - finx = fopen(inxname, "wb"); - - if (flog && finx) - { - pos = MAGIC_INX; - fwrite(&pos, sizeof(long), 1, finx); - pos = ftell(flog); - while (fgets(line, LINESIZE, flog)) - { - if (sscanf(line, "r%d | %s | %d-%d-%d", &r, name, &y, &m, &d) == 5) - { - l2l_dbg(1, "%ld r%d | %s | %d-%d-%d\n", pos, r, name, y, m, d); - fseek(finx, r * sizeof(unsigned long), SEEK_SET); - fwrite(&pos, sizeof(unsigned long), 1, finx); - } - pos = ftell(flog); - } - } - - if (flog) - fclose(flog); - if (finx) - fclose(finx); - - return res; -} - -/* EOF */ diff --git a/sdk/tools/log2lines/revision.h b/sdk/tools/log2lines/revision.h deleted file mode 100644 index 54714259180..00000000000 --- a/sdk/tools/log2lines/revision.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * ReactOS log2lines - * Written by Jan Roeloffzen - * - * - SVN interface and revision analysis - */ - -#pragma once - -#include <stdio.h> - -typedef struct revinfo_struct -{ - int rev; - int buildrev; - int range; - int opt_verbose; -} REVINFO, *PREVINFO; - -int getRevision(char *fileName, int lastChanged); -int getTBRevision(char *fileName); -void reportRevision(FILE *outFile); -unsigned long findRev(FILE *finx, int *rev); -int regscan(FILE *outFile); -int updateSvnlog(void); - -/* EOF */