diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d44d6d15b2358022e84f58d348051e8231c36799..7c4bc11d8dd8321528bb295d867197554abfa320 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -294,8 +294,7 @@ test-patch-picodata: pull_policy: always script: - PIPENV_VENV_IN_PROJECT=1 PIP_NO_CACHE_DIR=true python3.10 -m pipenv install --deploy - - ./tools/prepare_source_tree_for_stat_analysis.py svace - - ./tools/prepare_source_tree_for_stat_analysis.py gamayun + - ./tools/prepare_source_tree_for_stat_analysis.py apply - cargo build --locked --release --features dynamic_build - cargo build -p testplug --release @@ -443,8 +442,7 @@ gamayun-run: - | # svace patches is more iportant than gamayun and order of applying is important # first - svace, second - gamayun - ./tools/prepare_source_tree_for_stat_analysis.py svace - ./tools/prepare_source_tree_for_stat_analysis.py gamayun + ./tools/prepare_source_tree_for_stat_analysis.py apply - | # TODO consider moving this to the script as well, this may delete some html # license files which is probably not intended diff --git a/tools/prepare_source_tree_for_stat_analysis.py b/tools/prepare_source_tree_for_stat_analysis.py index 63915d14e264ad99d87789db2a8a0a9d9fee1e89..3d114f2c4f07dde9e4c025b0bd65dc2c3ccf0087 100755 --- a/tools/prepare_source_tree_for_stat_analysis.py +++ b/tools/prepare_source_tree_for_stat_analysis.py @@ -25,7 +25,7 @@ DEBUG = os.getenv("DEBUG") DEAD_LIST = [ # from 6b2a88b551e6940089cf248d88b050b65ab67262 "tarantool-sys/vendor/icu4c-71_1/source/python/icutools/databuilder/renderers/common_exec.py", - # static build doesn't work without this file. We build dynamically, so it's fine + # static build doesn't work without this file. We build dynamically, so it's fine "tarantool-sys/third_party/nghttp2/script/fetch-ocsp-response", "tarantool-sys/vendor/openssl-1.1.1q/fuzz/helper.py", "tarantool-sys/third_party/zstd/.circleci/images/primary/Dockerfile", @@ -61,24 +61,11 @@ def cd(target: Path): def apply(patch: Path): - # todo: https://git.picodata.io/picodata/picodata/picodata/-/issues/577 - with open(patch) as f: - line = f.readline() - # here we parse something like "diff --git a/src/box/alter.cc b/src/box/alter.cc" - # and want to get "src/box/alter.cc" - # so, get second elt and skip "a/" - file_to_patch = line.split(" ", maxsplit=4)[2][2:] - if not Path(file_to_patch).exists: - return - subprocess.check_call(["git", "apply", str(patch)]) # nosec def apply_from_dir(path: Path): for patch in path.iterdir(): - if not path.exists: - continue - patch = patch.resolve() print("Applying:", patch) @@ -99,7 +86,11 @@ def apply_from_dir(path: Path): apply(patch) -def prepare_for_gamayun(): +def apply_patches(): + print("For svace:") + apply_from_dir(SVACE_PATCHES) + + print("For gamayun:") for glob_pattern in DEAD_LIST: for fname in glob.glob(glob_pattern): print("Removing:", REPO_DIR / fname) @@ -109,10 +100,6 @@ def prepare_for_gamayun(): apply_from_dir(GAMAYUN_PATCHES) -def prepare_for_svace(): - apply_from_dir(SVACE_PATCHES) - - def restore(): subprocess.check_call( "git submodule foreach --recursive git restore .", @@ -125,16 +112,14 @@ if __name__ == "__main__": "Apply various certification induced transformations to source tree" ) subparsers = parser.add_subparsers(dest="command") - subparsers.add_parser("gamayun", help="Prepare for gamayun analysis") - subparsers.add_parser("svace", help="Prepare for svace analysis") + subparsers.add_parser("apply", help="Prepare for analysis by applying patches") subparsers.add_parser( "restore", help="Restore all changes applied by 'svace' or(and) 'gamayun' commands", ) commands = { - "gamayun": prepare_for_gamayun, - "svace": prepare_for_svace, + "apply": apply_patches, "restore": restore, }