WIP: dev #6

Closed
李衍志523370910113 wants to merge 131 commits from dev into master
Showing only changes of commit 6ecfeece62 - Show all commits

View File

@ -1,6 +1,7 @@
import hashlib
import shlex
import socket
from pathlib import Path
from joj3_config_generator.models import joj1, repo, result, task
@ -80,7 +81,10 @@ def calc_sha256sum(file_path: str) -> str:
def get_hash(immutable_files: list[str]) -> str: # input should be a list
file_path = "../immutable_file/" # TODO: change this when things are on the server
# FIXME: should be finalized when get into the server
current_file_path = Path(__file__).resolve()
project_root = current_file_path.parents[2]
file_path = f"{project_root}/tests/immutable_file/"

hard coded path not acceptable

hard coded path not acceptable

thats what I wanted to discuss, in what form would be better? @manuel @bomingzh
my suggestions is to add more fields related to this in repo.toml or task.toml, I think store it globally in some *.py file is still hardcoded

thats what I wanted to discuss, in what form would be better? @manuel @bomingzh my suggestions is to add more fields related to this in `repo.toml` or `task.toml`, I think store it globally in some `*.py` file is still hardcoded

just let them enter path relative to project root for immutable files

just let them enter path relative to project root for immutable files

giving prompt? Wouldn't it be better to export field in *.toml file? they may accidnetally input wrong things I guess

giving prompt? Wouldn't it be better to export field in `*.toml` file? they may accidnetally input wrong things I guess

just throw error on wrong input

just throw error on wrong input

I mean, they input \home\tt\.config\ instead of \home\tt\.config\joj such things may happen, but will cost time to figure out what happened? So I think better put them in *.toml.

I mean, they input `\home\tt\.config\` instead of `\home\tt\.config\joj` such things may happen, but will cost time to figure out what happened? So I think better put them in `*.toml`.

just make the dir relative to git repo root, if the file does not exist, throw error

just make the dir relative to git repo root, if the file does not exist, throw error

any path in toml should probably be defined relative to /home/tt/.config/joj and be in a subdirectory. this is where all config must be.
then they can specify projects/p2/.cang-tidy or tool/compile

using project_root as too tricky as it could mean going up (../../) which is hard to read/figure out quickly.

as all JOJ config files must be in $HOME/.config/joj taking it as root makes sense, is general, and consistent with the approach we have used so far

any path in toml should probably be defined relative to `/home/tt/.config/joj` and be in a subdirectory. this is where all config must be. then they can specify `projects/p2/.cang-tidy` or `tool/compile` using `project_root` as too tricky as it could mean going up (`../../`) which is hard to read/figure out quickly. as all JOJ config files must be in `$HOME/.config/joj` taking it as root makes sense, is general, and consistent with the approach we have used so far

bit mixed here, if fixed, can I hardcode it?

bit mixed here, if fixed, can I hardcode it?
immutable_hash = []
for i, file in enumerate(immutable_files):
immutable_files[i] = file_path + file.rsplit("/", 1)[-1]