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
|
||||
DPS := $(mkfile_dir_path)/$(DPD)
|
||||
endif
|
||||
all: get_deps build_deps buildThis
|
||||
#all: get_deps build_deps buildThis
|
||||
all: build_deps buildThis
|
||||
|
||||
get_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/vpkConf.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/vpkDot.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/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 "________________________________________"
|
||||
|
||||
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;
|
||||
IMPORT Strings, Out,
|
||||
StringList, strUtils, Json, vpkStorage, vpkSettings, vpkdepTree;
|
||||
List, StringList, strUtils, Json, vpkStorage, vpkSettings, vpkdepTree;
|
||||
|
||||
CONST
|
||||
ErrmessSize = 4096;
|
||||
|
|
@ -80,10 +80,11 @@ VAR
|
|||
err: ARRAY ErrmessSize OF CHAR;
|
||||
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;
|
||||
url, authType, authTypeStr,
|
||||
md5, authCr, authCrStr,
|
||||
user, password : Json.jString;
|
||||
httpsRemote: vpkdepTree.RemoteHttps; gitRemote: vpkdepTree.RemoteGit;
|
||||
httpsFile: vpkdepTree.File;
|
||||
BEGIN
|
||||
jsonstr := NIL;
|
||||
vpkStorage.json2pstring(d.name^, jsonstr);
|
||||
|
|
@ -121,8 +122,11 @@ BEGIN
|
|||
val := someObj.value(Json.Str).str;
|
||||
IF key^ = vpkSettings.rmtTypKey THEN (* type *)
|
||||
IF val^ = vpkSettings.rmtTypHttpsVal THEN
|
||||
|
||||
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
|
||||
someObj := singleValue(Json.Obj);
|
||||
|
||||
|
|
@ -138,12 +142,14 @@ BEGIN
|
|||
Out.Ln;
|
||||
IF fileObjValue IS Json.Obj THEN
|
||||
fileObj := fileObjValue(Json.Obj);
|
||||
NEW(httpsFile);
|
||||
httpsFile^.auth := FALSE; (* default *)
|
||||
(* 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;
|
||||
COPY(urlValue(Json.Str).str^, httpsFile^.URI);
|
||||
Out.String("url: "); Out.String(httpsFile^.URI); Out.Ln;
|
||||
END;
|
||||
(* extract authtype *)
|
||||
NEW(authType, Strings.Length(vpkSettings.rmtFileAuthType)+1);
|
||||
|
|
@ -152,6 +158,11 @@ BEGIN
|
|||
& (authTypeValue IS Json.Str) THEN
|
||||
authTypeStr := authTypeValue(Json.Str).str;
|
||||
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;
|
||||
(* extract auth credentials *)
|
||||
NEW(authCr, Strings.Length(vpkSettings.rmtFileAuthCreds)+1);
|
||||
|
|
@ -165,14 +176,14 @@ BEGIN
|
|||
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;
|
||||
COPY(userValue(Json.Str).str^, httpsFile^.username);
|
||||
Out.String("user: "); Out.String(httpsFile^.username); 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;
|
||||
COPY(passwordValue(Json.Str).str^, httpsFile^.password);
|
||||
Out.String("pw: "); Out.String(httpsFile^.password); Out.Ln;
|
||||
END;
|
||||
END; (* if authcradsvalue is json.obj *)
|
||||
END; (* if json objselect authcredsval *)
|
||||
|
|
@ -180,15 +191,18 @@ BEGIN
|
|||
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;
|
||||
COPY(md5Value(Json.Str).str^, httpsFile^.md5);
|
||||
Out.String("md5: "); Out.String(httpsFile^.md5); Out.Ln;
|
||||
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; (*filesarray is json arr *)
|
||||
filesArray := filesArray(Json.Arr).next;
|
||||
END; (* while filesarray # nil *)
|
||||
|
||||
|
||||
END;
|
||||
singleValue := someObj.next;
|
||||
END;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ VAR
|
|||
rmtType-, rmtTypKey-, rmtTypGitVal-, rmtTypHttpVal-, rmtTypHttpsVal-,
|
||||
rmtTypGemiVal-, rmtTreeKey-, rmtTreeBranchKey-, rmtTreeTagKey-,
|
||||
rmtFiles-, rmtFileURL-, rmtFileAuthType-, rmtFileAuthCreds-, rmtFileMD5-,
|
||||
rmtFileAuthUsr-, rmtFileAuthPwd-,
|
||||
rmtFileAuthValBasic-, rmtFileAuthValNone-, rmtFileAuthUsr-, rmtFileAuthPwd-,
|
||||
bldType-, bldCommand-, bldFile-,
|
||||
defTreeVal-, confTreeVal-,
|
||||
defTypVal-, pkgTypKey-, depTypKey-, packageFileName-,
|
||||
|
|
@ -49,6 +49,8 @@ BEGIN
|
|||
rmtFiles := "Files";
|
||||
rmtFileURL := "URL";
|
||||
rmtFileAuthType := "AuthType";
|
||||
rmtFileAuthValBasic := "BasicAuth";
|
||||
rmtFileAuthValNone := "None";
|
||||
rmtFileAuthCreds := "AuthCredentials";
|
||||
rmtFileAuthUsr := "User";
|
||||
rmtFileAuthPwd := "Password";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
MODULE vpkSyncer;
|
||||
IMPORT Strings, Out,
|
||||
strUtils,
|
||||
vpkSettings, vpkEnv, vpkConf, vpkGit, vpkdepTree, vpkTools;
|
||||
strUtils, List,
|
||||
vpkSettings, vpkEnv, vpkConf, vpkGit, vpkdepTree, vpkTools, vpkHttps;
|
||||
|
||||
PROCEDURE mkTreePath(VAR path: ARRAY OF CHAR);
|
||||
BEGIN
|
||||
|
|
@ -37,8 +37,12 @@ BEGIN
|
|||
IF dep^.rmt # NIL THEN
|
||||
IF dep^.rmt IS vpkdepTree.RemoteGit THEN
|
||||
vpkGit.fetchRepo(dep^.rmt^.URI, dst, dep^.rmt(vpkdepTree.RemoteGit).branch);
|
||||
ELSIF dep^.rmt IS vpkdepTree.RemoteHttps THEN
|
||||
vpkHttps.fetchFiles(dep, dst);
|
||||
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
|
||||
ELSE
|
||||
Out.String("deps remote is not set, this should not happen"); Out.Ln;
|
||||
|
|
|
|||
|
|
@ -42,22 +42,22 @@ TYPE
|
|||
tag* : ARRAY 16 OF CHAR;
|
||||
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;
|
||||
RemoteHttpDesc* = RECORD(RemoteDesc)
|
||||
HttpAuth* : BOOLEAN;
|
||||
files* : StringList.TStringList;
|
||||
usernames* : StringList.TStringList;
|
||||
passwords* : StringList.TStringList;
|
||||
hashes* : StringList.TStringList;
|
||||
Files* : List.TList;
|
||||
END;
|
||||
|
||||
RemoteHttps* = POINTER TO RemoteHttpDesc;
|
||||
RemoteHttpsDesc* = RECORD(RemoteDesc)
|
||||
HttpAuth* : BOOLEAN;
|
||||
files* : StringList.TStringList;
|
||||
usernames* : StringList.TStringList;
|
||||
passwords* : StringList.TStringList;
|
||||
hashes* : StringList.TStringList;
|
||||
Files* : List.TList;
|
||||
END;
|
||||
|
||||
TdepDesc* = RECORD
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue