mirror of
https://github.com/vishapoberon/vipak.git
synced 2026-04-05 20:42:26 +00:00
compiles, moving forward.
This commit is contained in:
parent
b6f55b8a5f
commit
b65fcc69de
6 changed files with 78 additions and 30 deletions
|
|
@ -15,7 +15,8 @@ DPD = deps
|
||||||
ifndef DPS
|
ifndef DPS
|
||||||
DPS := $(mkfile_dir_path)/$(DPD)
|
DPS := $(mkfile_dir_path)/$(DPD)
|
||||||
endif
|
endif
|
||||||
all: get_deps build_deps buildThis
|
#all: get_deps build_deps buildThis
|
||||||
|
all: build_deps buildThis
|
||||||
|
|
||||||
get_deps:
|
get_deps:
|
||||||
@echo "getting deps"
|
@echo "getting deps"
|
||||||
|
|
@ -59,12 +60,15 @@ buildThis:
|
||||||
cd $(BUILD) && $(VOC) -s $(mkfile_dir_path)/src/vpkStorage.Mod
|
cd $(BUILD) && $(VOC) -s $(mkfile_dir_path)/src/vpkStorage.Mod
|
||||||
cd $(BUILD) && $(VOC) -s $(mkfile_dir_path)/src/vpkConf.Mod
|
cd $(BUILD) && $(VOC) -s $(mkfile_dir_path)/src/vpkConf.Mod
|
||||||
cd $(BUILD) && $(VOC) -s $(mkfile_dir_path)/src/vpkdepTree.Mod
|
cd $(BUILD) && $(VOC) -s $(mkfile_dir_path)/src/vpkdepTree.Mod
|
||||||
|
cd $(BUILD) && $(VOC) -s $(mkfile_dir_path)/src/vpkHttps.Mod
|
||||||
cd $(BUILD) && $(VOC) -s $(mkfile_dir_path)/src/vpkSyncer.Mod
|
cd $(BUILD) && $(VOC) -s $(mkfile_dir_path)/src/vpkSyncer.Mod
|
||||||
cd $(BUILD) && $(VOC) -s $(mkfile_dir_path)/src/vpkDot.Mod
|
cd $(BUILD) && $(VOC) -s $(mkfile_dir_path)/src/vpkDot.Mod
|
||||||
cd $(BUILD) && $(VOC) -s $(mkfile_dir_path)/src/vpkResolver.Mod
|
cd $(BUILD) && $(VOC) -s $(mkfile_dir_path)/src/vpkResolver.Mod
|
||||||
cd $(BUILD) && $(VOC) -s $(mkfile_dir_path)/src/vpkJsonDepRetriever.Mod
|
cd $(BUILD) && $(VOC) -s $(mkfile_dir_path)/src/vpkJsonDepRetriever.Mod
|
||||||
cd $(BUILD) && $(VOC) -s $(mkfile_dir_path)/src/vpkInstaller.Mod
|
cd $(BUILD) && $(VOC) -s $(mkfile_dir_path)/src/vpkInstaller.Mod
|
||||||
cd $(BUILD) && $(VOC) $(mkfile_dir_path)/src/vipack.Mod -m
|
cd $(BUILD) && $(VOC) $(mkfile_dir_path)/src/vipack.Mod -cm
|
||||||
|
cd $(BUILD) && rm testHttps.o
|
||||||
|
cd $(BUILD) && gcc -o vipack *.o -static -L/opt/voc/lib -lvoc-O2 /opt/voc/lib/libvoc-O2.a -L. -lmbedtls -lmbedcrypto -lmbedx509 libmbedcrypto.a libmbedtls.a libmbedx509.a
|
||||||
@echo "________________________________________"
|
@echo "________________________________________"
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
|
|
|
||||||
24
src/vpkHttps.Mod
Normal file
24
src/vpkHttps.Mod
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
MODULE vpkHttps;
|
||||||
|
IMPORT Out,
|
||||||
|
List, https,
|
||||||
|
vpkdepTree;
|
||||||
|
|
||||||
|
PROCEDURE fetchFiles*(VAR dep: vpkdepTree.Tdep; dst: ARRAY OF CHAR);
|
||||||
|
VAR
|
||||||
|
i: LONGINT;
|
||||||
|
node: List.Node;
|
||||||
|
BEGIN
|
||||||
|
Out.String("fetching ");
|
||||||
|
Out.Int(dep^.rmt(vpkdepTree.RemoteHttps)^.Files.Count, 0); Out.String(" files"); Out.Ln;
|
||||||
|
i := 0;
|
||||||
|
|
||||||
|
REPEAT
|
||||||
|
node := dep^.rmt(vpkdepTree.RemoteHttps)^.Files.Get(dep^.rmt(vpkdepTree.RemoteHttps)^.Files, i);
|
||||||
|
Out.String("file: "); Out.String(node^.obj(vpkdepTree.File)^.URI); Out.Ln;
|
||||||
|
|
||||||
|
INC(i)
|
||||||
|
UNTIL i = dep^.rmt(vpkdepTree.RemoteHttps)^.Files.Count;
|
||||||
|
|
||||||
|
END fetchFiles;
|
||||||
|
|
||||||
|
END vpkHttps.
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
MODULE vpkJsonDepRetriever;
|
MODULE vpkJsonDepRetriever;
|
||||||
IMPORT Strings, Out,
|
IMPORT Strings, Out,
|
||||||
StringList, strUtils, Json, vpkStorage, vpkSettings, vpkdepTree;
|
List, StringList, strUtils, Json, vpkStorage, vpkSettings, vpkdepTree;
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
ErrmessSize = 4096;
|
ErrmessSize = 4096;
|
||||||
|
|
@ -80,10 +80,11 @@ VAR
|
||||||
err: ARRAY ErrmessSize OF CHAR;
|
err: ARRAY ErrmessSize OF CHAR;
|
||||||
b, fndRemSec, fndTypeHttps, fndFiles: BOOLEAN;
|
b, fndRemSec, fndTypeHttps, fndFiles: BOOLEAN;
|
||||||
key, val, u, t, br, remote,
|
key, val, u, t, br, remote,
|
||||||
url, urlStr, authType, authTypeStr,
|
url, authType, authTypeStr,
|
||||||
md5, md5Str, authCr, authCrStr,
|
md5, authCr, authCrStr,
|
||||||
user, userStr, password, passwordStr: Json.jString;
|
user, password : Json.jString;
|
||||||
httpsRemote: vpkdepTree.RemoteHttps; gitRemote: vpkdepTree.RemoteGit;
|
httpsRemote: vpkdepTree.RemoteHttps; gitRemote: vpkdepTree.RemoteGit;
|
||||||
|
httpsFile: vpkdepTree.File;
|
||||||
BEGIN
|
BEGIN
|
||||||
jsonstr := NIL;
|
jsonstr := NIL;
|
||||||
vpkStorage.json2pstring(d.name^, jsonstr);
|
vpkStorage.json2pstring(d.name^, jsonstr);
|
||||||
|
|
@ -121,8 +122,11 @@ BEGIN
|
||||||
val := someObj.value(Json.Str).str;
|
val := someObj.value(Json.Str).str;
|
||||||
IF key^ = vpkSettings.rmtTypKey THEN (* type *)
|
IF key^ = vpkSettings.rmtTypKey THEN (* type *)
|
||||||
IF val^ = vpkSettings.rmtTypHttpsVal THEN
|
IF val^ = vpkSettings.rmtTypHttpsVal THEN
|
||||||
|
|
||||||
NEW(httpsRemote); d^.rmt := httpsRemote;
|
NEW(httpsRemote); d^.rmt := httpsRemote;
|
||||||
d^.Type := vpkSettings.https;
|
d^.Type := vpkSettings.https;
|
||||||
|
httpsRemote^.Files := List.Create();
|
||||||
|
d^.Type := vpkSettings.https;
|
||||||
WHILE singleValue # NIL DO
|
WHILE singleValue # NIL DO
|
||||||
someObj := singleValue(Json.Obj);
|
someObj := singleValue(Json.Obj);
|
||||||
|
|
||||||
|
|
@ -138,12 +142,14 @@ BEGIN
|
||||||
Out.Ln;
|
Out.Ln;
|
||||||
IF fileObjValue IS Json.Obj THEN
|
IF fileObjValue IS Json.Obj THEN
|
||||||
fileObj := fileObjValue(Json.Obj);
|
fileObj := fileObjValue(Json.Obj);
|
||||||
|
NEW(httpsFile);
|
||||||
|
httpsFile^.auth := FALSE; (* default *)
|
||||||
(* extract url *)
|
(* extract url *)
|
||||||
NEW(url, Strings.Length(vpkSettings.rmtFileURL)+1);
|
NEW(url, Strings.Length(vpkSettings.rmtFileURL)+1);
|
||||||
COPY(vpkSettings.rmtFileURL, url^);
|
COPY(vpkSettings.rmtFileURL, url^);
|
||||||
IF Json.ObjSelect(urlValue, fileObj, url) & (urlValue IS Json.Str) THEN
|
IF Json.ObjSelect(urlValue, fileObj, url) & (urlValue IS Json.Str) THEN
|
||||||
urlStr := urlValue(Json.Str).str;
|
COPY(urlValue(Json.Str).str^, httpsFile^.URI);
|
||||||
Out.String("url: "); Out.String(urlStr^); Out.Ln;
|
Out.String("url: "); Out.String(httpsFile^.URI); Out.Ln;
|
||||||
END;
|
END;
|
||||||
(* extract authtype *)
|
(* extract authtype *)
|
||||||
NEW(authType, Strings.Length(vpkSettings.rmtFileAuthType)+1);
|
NEW(authType, Strings.Length(vpkSettings.rmtFileAuthType)+1);
|
||||||
|
|
@ -152,6 +158,11 @@ BEGIN
|
||||||
& (authTypeValue IS Json.Str) THEN
|
& (authTypeValue IS Json.Str) THEN
|
||||||
authTypeStr := authTypeValue(Json.Str).str;
|
authTypeStr := authTypeValue(Json.Str).str;
|
||||||
Out.String("authtype: "); Out.String(authTypeStr^); Out.Ln;
|
Out.String("authtype: "); Out.String(authTypeStr^); Out.Ln;
|
||||||
|
IF authTypeValue(Json.Str).str^ = vpkSettings.rmtFileAuthValBasic THEN
|
||||||
|
httpsFile^.auth := TRUE;
|
||||||
|
ELSE
|
||||||
|
httpsFile^.auth := FALSE;
|
||||||
|
END
|
||||||
END;
|
END;
|
||||||
(* extract auth credentials *)
|
(* extract auth credentials *)
|
||||||
NEW(authCr, Strings.Length(vpkSettings.rmtFileAuthCreds)+1);
|
NEW(authCr, Strings.Length(vpkSettings.rmtFileAuthCreds)+1);
|
||||||
|
|
@ -165,14 +176,14 @@ BEGIN
|
||||||
NEW(user, Strings.Length(vpkSettings.rmtFileAuthUsr) + 1);
|
NEW(user, Strings.Length(vpkSettings.rmtFileAuthUsr) + 1);
|
||||||
COPY(vpkSettings.rmtFileAuthUsr, user^);
|
COPY(vpkSettings.rmtFileAuthUsr, user^);
|
||||||
IF Json.ObjSelect(userValue, authObj, user) & (userValue IS Json.Str) THEN
|
IF Json.ObjSelect(userValue, authObj, user) & (userValue IS Json.Str) THEN
|
||||||
userStr := userValue(Json.Str).str;
|
COPY(userValue(Json.Str).str^, httpsFile^.username);
|
||||||
Out.String("user: "); Out.String(userStr^); Out.Ln;
|
Out.String("user: "); Out.String(httpsFile^.username); Out.Ln;
|
||||||
END;
|
END;
|
||||||
NEW(password, Strings.Length(vpkSettings.rmtFileAuthPwd) + 1);
|
NEW(password, Strings.Length(vpkSettings.rmtFileAuthPwd) + 1);
|
||||||
COPY(vpkSettings.rmtFileAuthPwd, password^);
|
COPY(vpkSettings.rmtFileAuthPwd, password^);
|
||||||
IF Json.ObjSelect(passwordValue, authObj, password) & (passwordValue IS Json.Str) THEN
|
IF Json.ObjSelect(passwordValue, authObj, password) & (passwordValue IS Json.Str) THEN
|
||||||
passwordStr := passwordValue(Json.Str).str;
|
COPY(passwordValue(Json.Str).str^, httpsFile^.password);
|
||||||
Out.String("pw: "); Out.String(passwordStr^); Out.Ln;
|
Out.String("pw: "); Out.String(httpsFile^.password); Out.Ln;
|
||||||
END;
|
END;
|
||||||
END; (* if authcradsvalue is json.obj *)
|
END; (* if authcradsvalue is json.obj *)
|
||||||
END; (* if json objselect authcredsval *)
|
END; (* if json objselect authcredsval *)
|
||||||
|
|
@ -180,15 +191,18 @@ BEGIN
|
||||||
NEW(md5, Strings.Length(vpkSettings.rmtFileMD5)+1);
|
NEW(md5, Strings.Length(vpkSettings.rmtFileMD5)+1);
|
||||||
COPY(vpkSettings.rmtFileMD5, md5^);
|
COPY(vpkSettings.rmtFileMD5, md5^);
|
||||||
IF Json.ObjSelect(md5Value, fileObj, md5) & (md5Value IS Json.Str) THEN
|
IF Json.ObjSelect(md5Value, fileObj, md5) & (md5Value IS Json.Str) THEN
|
||||||
md5Str := md5Value(Json.Str).str;
|
COPY(md5Value(Json.Str).str^, httpsFile^.md5);
|
||||||
Out.String("md5: "); Out.String(md5Str^); Out.Ln;
|
Out.String("md5: "); Out.String(httpsFile^.md5); Out.Ln;
|
||||||
END;
|
END;
|
||||||
|
httpsRemote^.Files.Append(httpsRemote^.Files, httpsFile);
|
||||||
|
Out.String("appending "); Out.String(httpsFile^.URI); Out.Ln;
|
||||||
|
Out.String("list count is :");
|
||||||
|
Out.Int(d^.rmt(vpkdepTree.RemoteHttps)^.Files.Count, 0); Out.Ln;
|
||||||
END; (*fileobj is json.obj *)
|
END; (*fileobj is json.obj *)
|
||||||
END; (*filesarray is json arr *)
|
END; (*filesarray is json arr *)
|
||||||
filesArray := filesArray(Json.Arr).next;
|
filesArray := filesArray(Json.Arr).next;
|
||||||
END; (* while filesarray # nil *)
|
END; (* while filesarray # nil *)
|
||||||
|
|
||||||
|
|
||||||
END;
|
END;
|
||||||
singleValue := someObj.next;
|
singleValue := someObj.next;
|
||||||
END;
|
END;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ VAR
|
||||||
rmtType-, rmtTypKey-, rmtTypGitVal-, rmtTypHttpVal-, rmtTypHttpsVal-,
|
rmtType-, rmtTypKey-, rmtTypGitVal-, rmtTypHttpVal-, rmtTypHttpsVal-,
|
||||||
rmtTypGemiVal-, rmtTreeKey-, rmtTreeBranchKey-, rmtTreeTagKey-,
|
rmtTypGemiVal-, rmtTreeKey-, rmtTreeBranchKey-, rmtTreeTagKey-,
|
||||||
rmtFiles-, rmtFileURL-, rmtFileAuthType-, rmtFileAuthCreds-, rmtFileMD5-,
|
rmtFiles-, rmtFileURL-, rmtFileAuthType-, rmtFileAuthCreds-, rmtFileMD5-,
|
||||||
rmtFileAuthUsr-, rmtFileAuthPwd-,
|
rmtFileAuthValBasic-, rmtFileAuthValNone-, rmtFileAuthUsr-, rmtFileAuthPwd-,
|
||||||
bldType-, bldCommand-, bldFile-,
|
bldType-, bldCommand-, bldFile-,
|
||||||
defTreeVal-, confTreeVal-,
|
defTreeVal-, confTreeVal-,
|
||||||
defTypVal-, pkgTypKey-, depTypKey-, packageFileName-,
|
defTypVal-, pkgTypKey-, depTypKey-, packageFileName-,
|
||||||
|
|
@ -49,6 +49,8 @@ BEGIN
|
||||||
rmtFiles := "Files";
|
rmtFiles := "Files";
|
||||||
rmtFileURL := "URL";
|
rmtFileURL := "URL";
|
||||||
rmtFileAuthType := "AuthType";
|
rmtFileAuthType := "AuthType";
|
||||||
|
rmtFileAuthValBasic := "BasicAuth";
|
||||||
|
rmtFileAuthValNone := "None";
|
||||||
rmtFileAuthCreds := "AuthCredentials";
|
rmtFileAuthCreds := "AuthCredentials";
|
||||||
rmtFileAuthUsr := "User";
|
rmtFileAuthUsr := "User";
|
||||||
rmtFileAuthPwd := "Password";
|
rmtFileAuthPwd := "Password";
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
MODULE vpkSyncer;
|
MODULE vpkSyncer;
|
||||||
IMPORT Strings, Out,
|
IMPORT Strings, Out,
|
||||||
strUtils,
|
strUtils, List,
|
||||||
vpkSettings, vpkEnv, vpkConf, vpkGit, vpkdepTree, vpkTools;
|
vpkSettings, vpkEnv, vpkConf, vpkGit, vpkdepTree, vpkTools, vpkHttps;
|
||||||
|
|
||||||
PROCEDURE mkTreePath(VAR path: ARRAY OF CHAR);
|
PROCEDURE mkTreePath(VAR path: ARRAY OF CHAR);
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
@ -37,8 +37,12 @@ BEGIN
|
||||||
IF dep^.rmt # NIL THEN
|
IF dep^.rmt # NIL THEN
|
||||||
IF dep^.rmt IS vpkdepTree.RemoteGit THEN
|
IF dep^.rmt IS vpkdepTree.RemoteGit THEN
|
||||||
vpkGit.fetchRepo(dep^.rmt^.URI, dst, dep^.rmt(vpkdepTree.RemoteGit).branch);
|
vpkGit.fetchRepo(dep^.rmt^.URI, dst, dep^.rmt(vpkdepTree.RemoteGit).branch);
|
||||||
|
ELSIF dep^.rmt IS vpkdepTree.RemoteHttps THEN
|
||||||
|
vpkHttps.fetchFiles(dep, dst);
|
||||||
ELSE
|
ELSE
|
||||||
Out.String("TODO: not a git url"); Out.Ln
|
Out.String("TODO: neither git nor https url"); Out.Ln;
|
||||||
|
Out.String("not handled");
|
||||||
|
Out.Ln;
|
||||||
END
|
END
|
||||||
ELSE
|
ELSE
|
||||||
Out.String("deps remote is not set, this should not happen"); Out.Ln;
|
Out.String("deps remote is not set, this should not happen"); Out.Ln;
|
||||||
|
|
|
||||||
|
|
@ -42,22 +42,22 @@ TYPE
|
||||||
tag* : ARRAY 16 OF CHAR;
|
tag* : ARRAY 16 OF CHAR;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
|
File* = POINTER TO FileDesc;
|
||||||
|
FileDesc* = RECORD (List.TObjectDesc)
|
||||||
|
URI* : ARRAY 256 OF CHAR;
|
||||||
|
auth* : BOOLEAN;
|
||||||
|
username*, password*: ARRAY 32 OF CHAR;
|
||||||
|
md5* : ARRAY 33 OF CHAR;
|
||||||
|
END;
|
||||||
|
|
||||||
RemoteHttp* = POINTER TO RemoteHttpDesc;
|
RemoteHttp* = POINTER TO RemoteHttpDesc;
|
||||||
RemoteHttpDesc* = RECORD(RemoteDesc)
|
RemoteHttpDesc* = RECORD(RemoteDesc)
|
||||||
HttpAuth* : BOOLEAN;
|
Files* : List.TList;
|
||||||
files* : StringList.TStringList;
|
|
||||||
usernames* : StringList.TStringList;
|
|
||||||
passwords* : StringList.TStringList;
|
|
||||||
hashes* : StringList.TStringList;
|
|
||||||
END;
|
END;
|
||||||
|
|
||||||
RemoteHttps* = POINTER TO RemoteHttpDesc;
|
RemoteHttps* = POINTER TO RemoteHttpDesc;
|
||||||
RemoteHttpsDesc* = RECORD(RemoteDesc)
|
RemoteHttpsDesc* = RECORD(RemoteDesc)
|
||||||
HttpAuth* : BOOLEAN;
|
Files* : List.TList;
|
||||||
files* : StringList.TStringList;
|
|
||||||
usernames* : StringList.TStringList;
|
|
||||||
passwords* : StringList.TStringList;
|
|
||||||
hashes* : StringList.TStringList;
|
|
||||||
END;
|
END;
|
||||||
|
|
||||||
TdepDesc* = RECORD
|
TdepDesc* = RECORD
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue