fixed the json processing bug(s). processing is not case sensitive now.

This commit is contained in:
Norayr Chilingarian 2024-07-16 01:34:11 +04:00
parent 519db9223c
commit 35edaa5033
3 changed files with 206 additions and 191 deletions

View file

@ -62,15 +62,15 @@ END fetch;
PROCEDURE build*(VAR package: ARRAY OF CHAR; prefix: ARRAY OF CHAR; VAR tree: ARRAY OF CHAR; a : BOOLEAN);
VAR
depTree: vpkdepTree.TdepTree;
dep: vpkdepTree.Tdep;
i, j: LONGINT;
keys, values: StringList.TStringList;
k, v: StringList.pstring;
b: BOOLEAN;
builddir, cmd, srcPath: StringList.pstring;
res: INTEGER;
domain: ARRAY 256 OF CHAR;
node: List.Node;
dep: vpkdepTree.Tdep;
i, j: LONGINT;
keys, values: StringList.TStringList;
k, v: StringList.pstring;
b: BOOLEAN;
builddir, cmd, srcPath: StringList.pstring;
res: INTEGER;
domain: ARRAY 256 OF CHAR;
node: List.Node;
BEGIN
IF prefix # "" THEN
builddir := vpkEnv.mkBldDir(prefix)
@ -87,8 +87,23 @@ BEGIN
b := FALSE;
b := vpkJsonDepRetriever.getBuildInfo(dep, keys, values);
IF b THEN
Out.String("Build info found for the package: "); Out.String(dep.name^); Out.Ln;
(* Ensure keys and values are not NIL *)
IF keys = NIL THEN
Out.String("Error: keys list is NIL."); Out.Ln;
HALT(10);
END;
IF values = NIL THEN
Out.String("Error: values list is NIL."); Out.Ln;
HALT(10);
END;
Out.String("keys.Count = "); Out.Int(keys.Count, 0); Out.Ln;
Out.String("values.Count = "); Out.Int(values.Count, 0); Out.Ln;
j := 0;
REPEAT
Out.String("Processing build step "); Out.Int(j, 0); Out.Ln;
IF dep^.rmt IS vpkdepTree.RemoteGit THEN
vpkTools.extractDomainFromUrl(dep^.rmt.URI, domain);
ELSIF dep^.rmt IS vpkdepTree.RemoteHttps THEN
@ -97,25 +112,32 @@ BEGIN
ELSE
Out.String("WARNING: building for neither git nor https sources not supported yet"); Out.Ln;
END;
k := keys.GetString(keys, j);
IF j >= keys.Count THEN
Out.String("Index out of bounds: keys.Count = "); Out.Int(keys.Count, 0); Out.String(", j = "); Out.Int(j, 0); Out.Ln;
HALT(10);
END;
k := keys.GetString(keys, j);
v := values.GetString(values, j);
Out.String("Got key: "); Out.String(k^); Out.Ln;
Out.String("Got value: "); Out.String(v^); Out.Ln;
srcPath := vpkEnv.getSrcRelPath(dep.name^, domain, v^);
cmd := vpkEnv.mkCmd(k^, srcPath^);
Out.String(cmd^); Out.Ln;
Out.String("building in "); Out.String(builddir^); Out.Ln;
Out.String("Command: "); Out.String(cmd^); Out.Ln;
Out.String("Building in "); Out.String(builddir^); Out.Ln;
res := Platform.Chdir(builddir^);
IF res # 0 THEN
Out.String("failed to change directory to "); Out.String(builddir^); Out.Ln; Out.String("this should never happen."); Out.Ln; HALT(66);
Out.String("Failed to change directory to "); Out.String(builddir^); Out.Ln; Out.String("This should never happen."); Out.Ln; HALT(66);
END;
res := Platform.System(cmd^);
IF res # 0 THEN Out.String("failed to run build command"); Out.Ln END;
IF res # 0 THEN Out.String("Failed to run build command"); Out.Ln END;
INC(j)
UNTIL j = keys.Count;
ELSE
Out.String("no build info found for the package: "); Out.String(dep.name^); Out.Ln;
Out.String("No build info found for the package: "); Out.String(dep.name^); Out.Ln;
END;
INC(i);
UNTIL i = depTree.Count;
END build;
END vpkInstaller.