def get_recipe(self, conan_reference): output = ScopedOutput(str(conan_reference), self._out) def _refresh(): export_path = self._client_cache.export(conan_reference) rmdir(export_path) # It might need to remove shortpath rm_conandir(self._client_cache.source(conan_reference)) current_remote, _ = self._get_remote(conan_reference) output.info("Retrieving from remote '%s'..." % current_remote.name) self._remote_manager.get_recipe(conan_reference, export_path, current_remote) if self._update: output.info("Updated!") else: output.info("Installed!") # check if it is in disk conanfile_path = self._client_cache.conanfile(conan_reference) if os.path.exists(conanfile_path): log_recipe_got_from_local_cache(conan_reference) if self._check_updates: ret = self.update_available(conan_reference) if ret != 0: # Found and not equal remote, ref_remote = self._get_remote(conan_reference) if ret == 1: if not self._update: if remote != ref_remote: # Forced new remote output.warn("There is a new conanfile in '%s' remote. " "Execute 'install -u -r %s' to update it." % (remote.name, remote.name)) else: output.warn("There is a new conanfile in '%s' remote. " "Execute 'install -u' to update it." % remote.name) output.warn("Refused to install!") else: if remote != ref_remote: # Delete packages, could be non coherent with new remote DiskRemover(self._client_cache).remove_packages(conan_reference) _refresh() elif ret == -1: if not self._update: output.info("Current conanfile is newer " "than %s's one" % remote.name) else: output.error("Current conanfile is newer than %s's one. " "Run 'conan remove %s' and run install again " "to replace it." % (remote.name, conan_reference)) else: self._retrieve_recipe(conan_reference, output) if self._manifest_manager: # Just make sure that the recipe sources are there to check self.get_recipe_sources(conan_reference) remote = self._registry.get_ref(conan_reference) self._manifest_manager.check_recipe(conan_reference, remote) return conanfile_path
def get_conanfile(self, conan_reference): output = ScopedOutput(str(conan_reference), self._out) def _refresh(): conan_dir_path = self._paths.export(conan_reference) rmdir(conan_dir_path) rmdir(self._paths.source(conan_reference), True) # It might need to remove shortpath current_remote, _ = self._get_remote(conan_reference) output.info("Retrieving from remote '%s'..." % current_remote.name) self._remote_manager.get_conanfile(conan_reference, current_remote) if self._update: output.info("Updated!") else: output.info("Installed!") # check if it is in disk conanfile_path = self._paths.conanfile(conan_reference) path_exist = path_exists(conanfile_path, self._paths.store) if path_exist: if self._check_integrity: # Check if package is corrupted read_manifest, expected_manifest = self._paths.conan_manifests(conan_reference) if read_manifest.file_sums != expected_manifest.file_sums: output.warn("Bad conanfile detected! Removing export directory... ") _refresh() else: # Check for updates if self._check_updates: ret = self.update_available(conan_reference) if ret != 0: # Found and not equal remote, ref_remote = self._get_remote(conan_reference) if ret == 1: if not self._update: if remote != ref_remote: # Forced new remote output.warn("There is a new conanfile in '%s' remote. " "Execute 'install -u -r %s' to update it." % (remote.name, remote.name)) else: output.warn("There is a new conanfile in '%s' remote. " "Execute 'install -u' to update it." % remote.name) output.warn("Refused to install!") else: if remote != ref_remote: # Delete packages, could be non coherent with new remote rmdir(self._paths.packages(conan_reference)) _refresh() elif ret == -1: if not self._update: output.info("Current conanfile is newer " "than %s's one" % remote.name) else: output.error("Current conanfile is newer than %s's one. " "Run 'conan remove %s' and run install again " "to replace it." % (remote.name, conan_reference)) else: self._retrieve_conanfile(conan_reference, output) return conanfile_path
def _get_recipe(self, conan_reference, check_updates, update): output = ScopedOutput(str(conan_reference), self._out) check_updates = check_updates or update # check if it is in disk conanfile_path = self._client_cache.conanfile(conan_reference) if os.path.exists(conanfile_path): if check_updates: ret = self.update_available(conan_reference) if ret != 0: # Found and not equal remote, ref_remote = self._get_remote(conan_reference) if ret == 1: if not update: if remote != ref_remote: # Forced new remote output.warn("There is a new conanfile in '%s' remote. " "Execute 'install -u -r %s' to update it." % (remote.name, remote.name)) else: output.warn("There is a new conanfile in '%s' remote. " "Execute 'install -u' to update it." % remote.name) output.warn("Refused to install!") else: DiskRemover(self._client_cache).remove(conan_reference) output.info("Retrieving from remote '%s'..." % remote.name) self._remote_manager.get_recipe(conan_reference, remote) output.info("Updated!") elif ret == -1: if not update: output.info("Current conanfile is newer than %s's one" % remote.name) else: output.error("Current conanfile is newer than %s's one. " "Run 'conan remove %s' and run install again " "to replace it." % (remote.name, conan_reference)) log_recipe_got_from_local_cache(conan_reference) self._recorder.recipe_fetched_from_cache(conan_reference) else: self._retrieve_recipe(conan_reference, output) if self._manifest_manager: # Just make sure that the recipe sources are there to check conanfile = load_conanfile_class(conanfile_path) complete_recipe_sources(self._remote_manager, self._client_cache, self._registry, conanfile, conan_reference) remote = self._registry.get_ref(conan_reference) self._manifest_manager.check_recipe(conan_reference, remote) return conanfile_path
def _get_recipe(self, conan_reference, check_updates, update): output = ScopedOutput(str(conan_reference), self._out) check_updates = check_updates or update # check if it is in disk conanfile_path = self._client_cache.conanfile(conan_reference) remote = None if os.path.exists(conanfile_path): if check_updates: ret = self.update_available(conan_reference) if ret != 0: # Found and not equal remote, ref_remote = self._get_remote(conan_reference) if ret == 1: if not update: if remote != ref_remote: # Forced new remote output.warn("There is a new conanfile in '%s' remote. " "Execute 'install -u -r %s' to update it." % (remote.name, remote.name)) else: output.warn("There is a new conanfile in '%s' remote. " "Execute 'install -u' to update it." % remote.name) output.warn("Refused to install!") else: DiskRemover(self._client_cache).remove(conan_reference) output.info("Retrieving from remote '%s'..." % remote.name) self._remote_manager.get_recipe(conan_reference, remote) self._registry.set_ref(conan_reference, remote) output.info("Updated!") elif ret == -1: if not update: output.info("Current conanfile is newer than %s's one" % remote.name) else: output.error("Current conanfile is newer than %s's one. " "Run 'conan remove %s' and run install again " "to replace it." % (remote.name, conan_reference)) log_recipe_got_from_local_cache(conan_reference) self._recorder.recipe_fetched_from_cache(conan_reference) else: remote = self._retrieve_recipe(conan_reference, output) if not remote: remote = self._registry.get_ref(conan_reference) return conanfile_path, remote