mirror of
https://github.com/vishapoberon/vipak.git
synced 2026-04-05 20:42:26 +00:00
build of git deps works, while https deps are detected, build is not implemented yet.
This commit is contained in:
parent
4b74e7567d
commit
1a4b4bd988
5 changed files with 161 additions and 24 deletions
|
|
@ -10,7 +10,7 @@ CONST
|
|||
|
||||
PROCEDURE mkConfContent(VAR path: ARRAY OF CHAR);
|
||||
(* constructing the line like:
|
||||
{"path" : "https://github.com/vishaps/vipackTree"}, "type" : "git"}
|
||||
{"Path" : "https://github.com/vishaps/vipackTree"}, "Type" : "git"}
|
||||
*)
|
||||
BEGIN
|
||||
COPY("", path);
|
||||
|
|
|
|||
|
|
@ -111,7 +111,11 @@ BEGIN
|
|||
REPEAT
|
||||
dep := vpkdepTree.Get(depTree, i);
|
||||
vpkJsonDepRetriever.getURIandType(dep, URI, typ, branch);
|
||||
Out.String("aftergetURIandType"); Out.Ln;
|
||||
Out.String("got uri: "); Out.String(URI); Out.Ln;
|
||||
Out.String("got type: "); Out.String(typ); Out.Ln;
|
||||
extractDomainFromUrl(URI, domain);
|
||||
Out.String("extracted domain; "); Out.String(domain); Out.Ln;
|
||||
vpkSyncer.fetch(dep.name^, URI, domain, typ, prefix, branch);
|
||||
b := FALSE;
|
||||
b := vpkJsonDepRetriever.getBuildInfo(dep, keys, values);
|
||||
|
|
|
|||
|
|
@ -73,11 +73,16 @@ END getBuildInfo;
|
|||
PROCEDURE getURIandType*(VAR d: vpkdepTree.Tdep; VAR URI: ARRAY OF CHAR; VAR type: ARRAY OF CHAR; VAR branch: ARRAY OF CHAR);
|
||||
VAR
|
||||
jsonstr, errstr: strUtils.pstring;
|
||||
tree, singleValue, remoteValue, uriValue, typeValue, branchValue: Json.Value;
|
||||
rootObj, someObj, remoteObj: Json.Obj;
|
||||
tree, singleValue, remoteValue: Json.Value;
|
||||
rootObj, someObj, remoteObj, fileObj, authObj: Json.Obj;
|
||||
filesArray, fileObjValue: Json.Value;
|
||||
fileValue, urlValue, authTypeValue, md5Value, authCredsValue, userValue, passwordValue: Json.Value;
|
||||
err: ARRAY ErrmessSize OF CHAR;
|
||||
b, fndRemSec: BOOLEAN;
|
||||
key, val, u, t, br, remote: Json.jString;
|
||||
b, fndRemSec, fndTypeHttps, fndFiles: BOOLEAN;
|
||||
key, val, u, t, br, remote,
|
||||
url, urlStr, authType, authTypeStr,
|
||||
md5, md5Str, authCr, authCrStr,
|
||||
user, userStr, password, passwordStr: Json.jString;
|
||||
BEGIN
|
||||
strUtils.zeroStr(URI);
|
||||
strUtils.zeroStr(type);
|
||||
|
|
@ -96,6 +101,7 @@ BEGIN
|
|||
NEW(remote, Strings.Length(vpkSettings.rmtType)+1);
|
||||
COPY(vpkSettings.rmtType, remote^);
|
||||
fndRemSec := FALSE;
|
||||
fndTypeHttps := FALSE;
|
||||
REPEAT
|
||||
IF rootObj.name^ = remote^ THEN
|
||||
fndRemSec := TRUE;
|
||||
|
|
@ -108,18 +114,113 @@ BEGIN
|
|||
remoteValue := rootObj.value;
|
||||
IF remoteValue IS Json.Obj THEN
|
||||
singleValue := remoteValue(Json.Obj);
|
||||
|
||||
IF singleValue IS Json.Obj THEN
|
||||
someObj := singleValue(Json.Obj);
|
||||
key := someObj.name;
|
||||
Out.String("key: "); Out.String(key^); Out.Ln;
|
||||
IF someObj.value IS Json.Str THEN
|
||||
val := someObj.value(Json.Str).str;
|
||||
IF key^ = vpkSettings.rmtTypKey THEN (* type *)
|
||||
COPY(val^, type);
|
||||
Out.String("type found: "); Out.String(type); Out.Ln;
|
||||
IF val^ = vpkSettings.rmtTypHttpsVal THEN
|
||||
|
||||
WHILE singleValue # NIL DO
|
||||
someObj := singleValue(Json.Obj);
|
||||
|
||||
IF someObj.value IS Json.Arr THEN
|
||||
|
||||
filesArray := someObj.value(Json.Arr);
|
||||
Out.String("assigned"); Out.Ln;
|
||||
WHILE filesArray # NIL DO
|
||||
IF filesArray IS Json.Arr THEN
|
||||
Out.String(" files array is json.arr "); Out.Ln;
|
||||
fileObjValue := filesArray(Json.Arr).value;
|
||||
Out.String("fileobjval := filesArray(json.obj).value");
|
||||
Out.Ln;
|
||||
IF fileObjValue IS Json.Obj THEN
|
||||
fileObj := fileObjValue(Json.Obj);
|
||||
(* extract url *)
|
||||
NEW(url, Strings.Length(vpkSettings.rmtFileURL)+1);
|
||||
COPY(vpkSettings.rmtFileURL, url^);
|
||||
IF Json.ObjSelect(urlValue, fileObj, url) & (urlValue IS Json.Str) THEN
|
||||
urlStr := urlValue(Json.Str).str;
|
||||
Out.String("url: "); Out.String(urlStr^); Out.Ln;
|
||||
END;
|
||||
(* extract authtype *)
|
||||
NEW(authType, Strings.Length(vpkSettings.rmtFileAuthType)+1);
|
||||
COPY(vpkSettings.rmtFileAuthType, authType^);
|
||||
IF Json.ObjSelect(authTypeValue, fileObj, authType)
|
||||
& (authTypeValue IS Json.Str) THEN
|
||||
authTypeStr := authTypeValue(Json.Str).str;
|
||||
Out.String("authtype: "); Out.String(authTypeStr^); Out.Ln;
|
||||
END;
|
||||
(* extract auth credentials *)
|
||||
NEW(authCr, Strings.Length(vpkSettings.rmtFileAuthCreds)+1);
|
||||
COPY(vpkSettings.rmtFileAuthCreds, authCr^);
|
||||
Out.String("searching for authcreds"); Out.Ln;
|
||||
IF Json.ObjSelect(authCredsValue, fileObj, authCr) & (authCredsValue IS Json.Obj) THEN
|
||||
Out.String("found auth creds"); Out.Ln;
|
||||
IF authCredsValue IS Json.Obj THEN
|
||||
authObj := authCredsValue(Json.Obj);
|
||||
Out.String("authcredsval is json.obj"); Out.Ln;
|
||||
NEW(user, Strings.Length(vpkSettings.rmtFileAuthUsr) + 1);
|
||||
COPY(vpkSettings.rmtFileAuthUsr, user^);
|
||||
IF Json.ObjSelect(userValue, authObj, user) & (userValue IS Json.Str) THEN
|
||||
userStr := userValue(Json.Str).str;
|
||||
Out.String("user: "); Out.String(userStr^); Out.Ln;
|
||||
END;
|
||||
NEW(password, Strings.Length(vpkSettings.rmtFileAuthPwd) + 1);
|
||||
COPY(vpkSettings.rmtFileAuthPwd, password^);
|
||||
IF Json.ObjSelect(passwordValue, authObj, password) & (passwordValue IS Json.Str) THEN
|
||||
passwordStr := passwordValue(Json.Str).str;
|
||||
Out.String("pw: "); Out.String(passwordStr^); Out.Ln;
|
||||
END;
|
||||
END; (* if authcradsvalue is json.obj *)
|
||||
END; (* if json objselect authcredsval *)
|
||||
(* extract md5 *)
|
||||
NEW(md5, Strings.Length(vpkSettings.rmtFileMD5)+1);
|
||||
COPY(vpkSettings.rmtFileMD5, md5^);
|
||||
IF Json.ObjSelect(md5Value, fileObj, md5) & (md5Value IS Json.Str) THEN
|
||||
md5Str := md5Value(Json.Str).str;
|
||||
Out.String("md5: "); Out.String(md5Str^); Out.Ln;
|
||||
END;
|
||||
END; (*fileobj is json.obj *)
|
||||
END; (*filesarray is json arr *)
|
||||
filesArray := filesArray(Json.Arr).next;
|
||||
END; (* while filesarray # nil *)
|
||||
|
||||
|
||||
END;
|
||||
singleValue := someObj.next;
|
||||
END;
|
||||
|
||||
|
||||
|
||||
ELSIF val^ = vpkSettings.rmtTypGitVal THEN
|
||||
WHILE singleValue # NIL DO
|
||||
IF singleValue IS Json.Obj THEN
|
||||
someObj := singleValue(Json.Obj);
|
||||
key := someObj.name;
|
||||
Out.String("git key: "); Out.String(key^); Out.Ln;
|
||||
val := someObj.value(Json.Str).str;
|
||||
IF key^ = vpkSettings.rmtTypKey THEN COPY(val^, type) END;
|
||||
IF key^ = vpkSettings.rmtTreeBranchKey THEN COPY(val^, branch) END;
|
||||
IF key^ = vpkSettings.rmtTreeKey THEN COPY(val^, URI) END;
|
||||
END; (* if singlevalue is json.obj *)
|
||||
IF key^ = vpkSettings.rmtTreeKey THEN
|
||||
COPY(val^, URI);
|
||||
Out.String("uri found: "); Out.String(URI); Out.Ln;
|
||||
END;
|
||||
END;
|
||||
singleValue := someObj.next;
|
||||
END (* while singlevalue # nil *)
|
||||
END;
|
||||
ELSE
|
||||
Out.String("unhandled remote type"); Out.Ln; HALT(5);
|
||||
END;
|
||||
END;
|
||||
END;
|
||||
END; (* if single value is json.obj *)
|
||||
END; (* if remotevalue is json.obj *)
|
||||
|
||||
rootObj := rootObj.next
|
||||
END; (* while rootObj # NIL *)
|
||||
ELSE
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@ VAR
|
|||
vpkConfDir-, vpkConfFile-, vpkTreeDir-, vpkPkgDir-, vpkDepDir-, vpkBldDir-,
|
||||
graphName-,
|
||||
rmtType-, rmtTypKey-, rmtTypGitVal-, rmtTypHttpVal-, rmtTypHttpsVal-,
|
||||
rmtTypGemiVal-, rmtTreeKey-, rmtTreeBranchKey-,
|
||||
rmtTypGemiVal-, rmtTreeKey-, rmtTreeBranchKey-, rmtTreeTagKey-,
|
||||
rmtFiles-, rmtFileURL-, rmtFileAuthType-, rmtFileAuthCreds-, rmtFileMD5-,
|
||||
rmtFileAuthUsr-, rmtFileAuthPwd-,
|
||||
bldType-, bldCommand-, bldFile-,
|
||||
defTreeVal-, confTreeVal-,
|
||||
defTypVal-, pkgTypKey-, depTypKey-, packageFileName-,
|
||||
|
|
@ -35,16 +37,24 @@ BEGIN
|
|||
graphName := "deps.dot";
|
||||
|
||||
rmtType := "Remote";
|
||||
rmtTypKey := "type";
|
||||
rmtTypKey := "Type";
|
||||
rmtTypGitVal := "git";
|
||||
rmtTypHttpVal := "http";
|
||||
rmtTypHttpsVal := "https";
|
||||
rmtTypGemiVal := "gemini";
|
||||
rmtTreeKey := "path";
|
||||
rmtTreeBranchKey := "branch";
|
||||
rmtTreeKey := "Path";
|
||||
rmtTreeBranchKey := "Branch";
|
||||
rmtTreeTagKey := "Tag";
|
||||
rmtFiles := "Files";
|
||||
rmtFileURL := "URL";
|
||||
rmtFileAuthType := "AuthType";
|
||||
rmtFileAuthCreds := "AuthCredentials";
|
||||
rmtFileAuthUsr := "User";
|
||||
rmtFileAuthPwd := "Password";
|
||||
rmtFileMD5 := "MD5";
|
||||
bldType := "Build";
|
||||
bldCommand := "command";
|
||||
bldFile := "file";
|
||||
bldCommand := "Command";
|
||||
bldFile := "File";
|
||||
defTreeVal := "https://github.com/vishaps/vipackTree";
|
||||
(*defTreeVal := "git@github.com:vishaps/vipackTree";*)
|
||||
confTreeVal := defTreeVal;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
MODULE vpkdepTree;
|
||||
IMPORT Out, Strings, strUtils, StringList;
|
||||
IMPORT Out, Strings,
|
||||
strUtils, List, StringList,
|
||||
vpkSettings;
|
||||
TYPE
|
||||
|
||||
pstring = strUtils.pstring;
|
||||
|
|
@ -25,6 +27,19 @@ TYPE
|
|||
|
||||
retriever- = PROCEDURE (VAR d: Tdep; VAR strlist: StringList.TStringList): LONGINT;
|
||||
|
||||
(* to be added to Tdep?
|
||||
bldSeq* = POINTER TO bldSeqDesc;
|
||||
bldSeqDesc* = RECORD
|
||||
cmd*, file*: StringList.TStringList;
|
||||
END;
|
||||
|
||||
file* = POINTER to fileDesc;
|
||||
fileDesc* = RECORD
|
||||
url*, authType*, MD5*: ARRAY 512 OF CHAR;
|
||||
authUsr*, authPwd*: ARRAY 64 OF CHAR;
|
||||
END;
|
||||
files* = List.TList;
|
||||
*)
|
||||
TdepDesc* = RECORD
|
||||
prev-, next-: Tdep;
|
||||
name- : pstring;
|
||||
|
|
@ -33,6 +48,13 @@ TYPE
|
|||
AssignDeps* : PROCEDURE (VAR d: Tdep; VAR deps: Tdeps);
|
||||
RetrieveDeps- : retriever;
|
||||
InstallRetriever*: PROCEDURE(VAR d: Tdep; r: retriever);
|
||||
|
||||
Type* : LONGINT; (* from vpkSettings http=0, https=1, gemini=2, git=3 *)
|
||||
(*
|
||||
gitPath* : ARRAY 256 OF CHAR;
|
||||
gitTag* : ARRAY 64 OF CHAR;
|
||||
bldSequence*: bldSeq;:
|
||||
*)
|
||||
END;
|
||||
|
||||
PROCEDURE AssignDeps*(VAR d: Tdep; VAR deps: Tdeps);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue