From 6d4c08189a4974d91378590e798ea52efadc3a19 Mon Sep 17 00:00:00 2001 From: Ramazan Ibragimov <130592661+miskeens@users.noreply.github.com> Date: Mon, 11 Nov 2024 13:28:28 +0300 Subject: [PATCH] GH-126: avoid fake package call; keep solid artifacts packed for subsequent runs --- crosspm/adapters/artifactoryaql.py | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/crosspm/adapters/artifactoryaql.py b/crosspm/adapters/artifactoryaql.py index e7f51e4..9a96f9a 100644 --- a/crosspm/adapters/artifactoryaql.py +++ b/crosspm/adapters/artifactoryaql.py @@ -69,7 +69,6 @@ def get_packages(self, source, parser, downloader, list_or_file_path, property_v _packages_found = OrderedDict() _pkg_name_old = "" _packed_exist = False - _packed_cache_params = None self._log.info('parser: {}'.format(parser._name)) for _paths in parser.get_paths(list_or_file_path, source): @@ -118,11 +117,8 @@ def get_packages(self, source, parser, downloader, list_or_file_path, property_v _packed_exist = os.path.isfile(_path_packed) if _packed_exist: self._log.info("Skip searching, use package cache in path {}".format(_path_packed)) - _packed_cache_params = param break # break check local cache - if _packed_exist: - break # break connect to artifactory - # ------ END ---- + # ------ END ---- _path_fixed, _path_pattern, _file_name_pattern = parser.split_fixed_pattern_with_file_name(_path) try: _artifactory_server = _tmp_params['server'] @@ -218,17 +214,6 @@ def get_packages(self, source, parser, downloader, list_or_file_path, property_v last_error = msg _package = None - - # HACK for prefer-local - if _packed_exist: - # HACK - Normalize params for cached archive - for key, value in _packed_cache_params.items(): - if isinstance(value, list): - value = ['' if x is None else x for x in value] - _packed_cache_params[key] = value - _package = Package(_pkg_name, None, _paths['params'], downloader, self, parser, - _packed_cache_params, list_or_file_path['raw'], {}, in_cache=True) - # END HACK if _packages: _tmp = copy.deepcopy(_params_found) _packages = parser.filter_one(_packages, _paths['params'], _tmp) @@ -272,10 +257,10 @@ def get_packages(self, source, parser, downloader, list_or_file_path, property_v if _added and (_package is not None): if downloader.do_load: _package.download() - _deps_file = _package.get_file(self._config.deps_lock_file_name) - if not _deps_file: - _deps_file = _package.get_file(CROSSPM_DEPENDENCY_LOCK_FILENAME) if downloader.recursive: + _deps_file = _package.get_file(self._config.deps_lock_file_name) + if not _deps_file: + _deps_file = _package.get_file(CROSSPM_DEPENDENCY_LOCK_FILENAME) if _deps_file: _package.find_dependencies(_deps_file, property_validate=False) elif self._config.deps_file_name: