def upload_recipe(self, conan_reference, remote, retry, retry_wait, ignore_deleted_file, skip_upload=False, no_overwrite=None): """Will upload the conans to the first remote""" t1 = time.time() export_folder = self._client_cache.export(conan_reference) files, symlinks = gather_files(export_folder) if CONANFILE not in files or CONAN_MANIFEST not in files: raise ConanException("Cannot upload corrupted recipe '%s'" % str(conan_reference)) export_src_folder = self._client_cache.export_sources(conan_reference, short_paths=None) src_files, src_symlinks = gather_files(export_src_folder) the_files = _compress_recipe_files(files, symlinks, src_files, src_symlinks, export_folder, self._output) if skip_upload: return None ret = self._call_remote(remote, "upload_recipe", conan_reference, the_files, retry, retry_wait, ignore_deleted_file, no_overwrite) duration = time.time() - t1 log_recipe_upload(conan_reference, duration, the_files, remote) if ret: msg = "Uploaded conan recipe '%s' to '%s'" % (str(conan_reference), remote.name) url = remote.url.replace("https://api.bintray.com/conan", "https://bintray.com") msg += ": %s" % url else: msg = "Recipe is up to date, upload skipped" self._output.info(msg) return ret
def upload_conan(self, conan_reference, remote, retry, retry_wait, ignore_deleted_file): """Will upload the conans to the first remote""" t1 = time.time() export_folder = self._client_cache.export(conan_reference) files = gather_files(export_folder) if CONANFILE not in files or CONAN_MANIFEST not in files: raise ConanException("Cannot upload corrupted recipe '%s'" % str(conan_reference)) the_files = compress_recipe_files(files, export_folder, self._output) ret = self._call_remote(remote, "upload_conan", conan_reference, the_files, retry, retry_wait, ignore_deleted_file) duration = time.time() - t1 log_recipe_upload(conan_reference, duration, the_files) msg = "Uploaded conan recipe '%s' to '%s'" % (str(conan_reference), remote.name) # FIXME: server dependent if remote.url == "https://server.conan.io": msg += ": https://www.conan.io/source/%s" % "/".join( conan_reference) else: msg += ": %s" % remote.url self._output.info(msg) return ret
def upload_recipe(self, conan_reference, remote, retry, retry_wait, ignore_deleted_file, skip_upload=False, no_overwrite=None): """Will upload the conans to the first remote""" t1 = time.time() export_folder = self._client_cache.export(conan_reference) for f in (EXPORT_TGZ_NAME, EXPORT_SOURCES_TGZ_NAME): tgz_path = os.path.join(export_folder, f) if is_dirty(tgz_path): self._output.warn("%s: Removing %s, marked as dirty" % (str(conan_reference), f)) os.remove(tgz_path) clean_dirty(tgz_path) files, symlinks = gather_files(export_folder) if CONANFILE not in files or CONAN_MANIFEST not in files: raise ConanException("Cannot upload corrupted recipe '%s'" % str(conan_reference)) export_src_folder = self._client_cache.export_sources(conan_reference, short_paths=None) src_files, src_symlinks = gather_files(export_src_folder) the_files = _compress_recipe_files(files, symlinks, src_files, src_symlinks, export_folder, self._output) if skip_upload: return None ret, new_ref = self._call_remote(remote, "upload_recipe", conan_reference, the_files, retry, retry_wait, ignore_deleted_file, no_overwrite) duration = time.time() - t1 log_recipe_upload(new_ref, duration, the_files, remote.name) if ret: msg = "Uploaded conan recipe '%s' to '%s'" % (str(new_ref), remote.name) url = remote.url.replace("https://api.bintray.com/conan", "https://bintray.com") msg += ": %s" % url else: msg = "Recipe is up to date, upload skipped" self._output.info(msg) return new_ref
def upload_recipe(self, conan_reference, remote, retry, retry_wait, ignore_deleted_file, skip_upload=False): """Will upload the conans to the first remote""" t1 = time.time() export_folder = self._client_cache.export(conan_reference) files, symlinks = gather_files(export_folder) if CONANFILE not in files or CONAN_MANIFEST not in files: raise ConanException("Cannot upload corrupted recipe '%s'" % str(conan_reference)) the_files = compress_recipe_files(files, symlinks, export_folder, self._output) if skip_upload: return None ret = self._call_remote(remote, "upload_recipe", conan_reference, the_files, retry, retry_wait, ignore_deleted_file) duration = time.time() - t1 log_recipe_upload(conan_reference, duration, the_files, remote) msg = "Uploaded conan recipe '%s' to '%s'" % (str(conan_reference), remote.name) # FIXME: server dependent if remote.url == "https://server.conan.io": msg += ": https://www.conan.io/source/%s" % "/".join(conan_reference) else: msg += ": %s" % remote.url self._output.info(msg) return ret
def _upload_recipe(self, ref, conanfile, retry, retry_wait, policy, remote, remotes): prep = self._preparator.prepare_recipe(ref, conanfile, remote, remotes, policy) if policy == UPLOAD_POLICY_SKIP: return ref files_to_upload, deleted, cache_files, conanfile_path, t1, current_remote_name, layout = prep if files_to_upload or deleted: self._remote_manager.upload_recipe(ref, files_to_upload, deleted, remote, retry, retry_wait) msg = "\rUploaded conan recipe '%s' to '%s': %s" % ( str(ref), remote.name, remote.url) self._output.info(left_justify_message(msg)) else: self._output.info("Recipe is up to date, upload skipped") duration = time.time() - t1 log_recipe_upload(ref, duration, cache_files, remote.name) self._hook_manager.execute("post_upload_recipe", conanfile_path=conanfile_path, reference=ref, remote=remote) # The recipe wasn't in the registry or it has changed the revision field only if not current_remote_name: with layout.update_metadata() as metadata: metadata.recipe.remote = remote.name return ref
def upload_recipe(self, conan_reference, remote, retry, retry_wait, policy, remote_manifest): conanfile_path = self._client_cache.conanfile(conan_reference) self._hook_manager.execute("pre_upload_recipe", conanfile_path=conanfile_path, reference=conan_reference, remote=remote) t1 = time.time() export_folder = self._client_cache.export(conan_reference) for f in (EXPORT_TGZ_NAME, EXPORT_SOURCES_TGZ_NAME): tgz_path = os.path.join(export_folder, f) if is_dirty(tgz_path): self._output.warn("%s: Removing %s, marked as dirty" % (str(conan_reference), f)) os.remove(tgz_path) clean_dirty(tgz_path) files, symlinks = gather_files(export_folder) if CONANFILE not in files or CONAN_MANIFEST not in files: raise ConanException("Cannot upload corrupted recipe '%s'" % str(conan_reference)) export_src_folder = self._client_cache.export_sources(conan_reference, short_paths=None) src_files, src_symlinks = gather_files(export_src_folder) the_files = _compress_recipe_files(files, symlinks, src_files, src_symlinks, export_folder, self._output) if policy == UPLOAD_POLICY_SKIP: return conan_reference ret, rev_time = self._call_remote(remote, "upload_recipe", conan_reference, the_files, retry, retry_wait, policy, remote_manifest) # Update package revision with the rev_time (Created locally but with rev_time None) with self._client_cache.update_metadata(conan_reference) as metadata: metadata.recipe.time = rev_time duration = time.time() - t1 log_recipe_upload(conan_reference, duration, the_files, remote.name) if ret: msg = "Uploaded conan recipe '%s' to '%s'" % (str(conan_reference), remote.name) url = remote.url.replace("https://api.bintray.com/conan", "https://bintray.com") msg += ": %s" % url else: msg = "Recipe is up to date, upload skipped" self._output.info(msg) self._hook_manager.execute("post_upload_recipe", conanfile_path=conanfile_path, reference=conan_reference, remote=remote)
def _upload_recipe(self, ref, conanfile, retry, retry_wait, policy, remote, remotes): current_remote_name = self._cache.package_layout(ref).load_metadata().recipe.remote if remote.name != current_remote_name: complete_recipe_sources(self._remote_manager, self._cache, conanfile, ref, remotes) conanfile_path = self._cache.package_layout(ref).conanfile() self._hook_manager.execute("pre_upload_recipe", conanfile_path=conanfile_path, reference=ref, remote=remote) t1 = time.time() the_files = self._compress_recipe_files(ref) with self._cache.package_layout(ref).update_metadata() as metadata: metadata.recipe.checksums = calc_files_checksum(the_files) local_manifest = FileTreeManifest.loads(load(the_files["conanmanifest.txt"])) remote_manifest = None if policy != UPLOAD_POLICY_FORCE: # Check SCM data for auto fields if hasattr(conanfile, "scm") and ( conanfile.scm.get("url") == "auto" or conanfile.scm.get("revision") == "auto"): raise ConanException("The recipe has 'scm.url' or 'scm.revision' with 'auto' " "values. Use '--force' to ignore this error or export again " "the recipe ('conan export' or 'conan create') in a " "repository with no-uncommitted changes or by " "using the '--ignore-dirty' option") remote_manifest = self._check_recipe_date(ref, remote, local_manifest) if policy == UPLOAD_POLICY_SKIP: return ref files_to_upload, deleted = self._recipe_files_to_upload(ref, policy, the_files, remote, remote_manifest, local_manifest) if files_to_upload or deleted: self._remote_manager.upload_recipe(ref, files_to_upload, deleted, remote, retry, retry_wait) self._upload_recipe_end_msg(ref, remote) else: self._output.info("Recipe is up to date, upload skipped") duration = time.time() - t1 log_recipe_upload(ref, duration, the_files, remote.name) self._hook_manager.execute("post_upload_recipe", conanfile_path=conanfile_path, reference=ref, remote=remote) # The recipe wasn't in the registry or it has changed the revision field only if not current_remote_name: with self._cache.package_layout(ref).update_metadata() as metadata: metadata.recipe.remote = remote.name return ref
def _upload_recipe(self, ref, conanfile, retry, retry_wait, policy, remote, remotes): current_remote_name = self._cache.package_layout( ref).load_metadata().recipe.remote if remote.name != current_remote_name: complete_recipe_sources(self._remote_manager, self._cache, conanfile, ref, remotes) conanfile_path = self._cache.package_layout(ref).conanfile() self._hook_manager.execute("pre_upload_recipe", conanfile_path=conanfile_path, reference=ref, remote=remote) t1 = time.time() the_files = self._compress_recipe_files(ref) local_manifest = FileTreeManifest.loads( load(the_files["conanmanifest.txt"])) remote_manifest = None if policy != UPLOAD_POLICY_FORCE: remote_manifest = self._check_recipe_date(ref, remote, local_manifest) if policy == UPLOAD_POLICY_SKIP: return ref files_to_upload, deleted = self._recipe_files_to_upload( ref, policy, the_files, remote, remote_manifest, local_manifest) if files_to_upload or deleted: self._remote_manager.upload_recipe(ref, files_to_upload, deleted, remote, retry, retry_wait) self._upload_recipe_end_msg(ref, remote) else: self._user_io.out.info("Recipe is up to date, upload skipped") duration = time.time() - t1 log_recipe_upload(ref, duration, the_files, remote.name) self._hook_manager.execute("post_upload_recipe", conanfile_path=conanfile_path, reference=ref, remote=remote) # The recipe wasn't in the registry or it has changed the revision field only if not current_remote_name: with self._cache.package_layout(ref).update_metadata() as metadata: metadata.recipe.remote = remote.name return ref
def _upload_recipe(self, ref, conanfile, retry, retry_wait, policy, remote): if policy != UPLOAD_POLICY_FORCE: remote_manifest = self._check_recipe_date(ref, remote) else: remote_manifest = None current_remote = self._registry.refs.get(ref) if remote != current_remote: complete_recipe_sources(self._remote_manager, self._cache, conanfile, ref) conanfile_path = self._cache.conanfile(ref) self._hook_manager.execute("pre_upload_recipe", conanfile_path=conanfile_path, reference=ref, remote=remote) t1 = time.time() the_files = self._compress_recipe_files(ref) if policy == UPLOAD_POLICY_SKIP: return ref files_to_upload, deleted = self._recipe_files_to_upload( ref, policy, the_files, remote, remote_manifest) if files_to_upload or deleted: self._remote_manager.upload_recipe(ref, files_to_upload, deleted, remote, retry, retry_wait) self._upload_recipe_end_msg(ref, remote) else: self._user_io.out.info("Recipe is up to date, upload skipped") duration = time.time() - t1 log_recipe_upload(ref, duration, the_files, remote.name) self._hook_manager.execute("post_upload_recipe", conanfile_path=conanfile_path, reference=ref, remote=remote) # The recipe wasn't in the registry or it has changed the revision field only if not current_remote: self._registry.refs.set(ref, remote.name) return ref
def _upload_recipe(self, ref, conanfile, retry, retry_wait, policy, remote, remotes): layout = self._cache.package_layout(ref) current_remote_name = layout.load_metadata().recipe.remote if remote.name != current_remote_name: retrieve_exports_sources(self._remote_manager, self._cache, conanfile, ref, remotes) conanfile_path = layout.conanfile() self._hook_manager.execute("pre_upload_recipe", conanfile_path=conanfile_path, reference=ref, remote=remote) t1 = time.time() cache_files = self._compress_recipe_files(layout, ref) with layout.update_metadata() as metadata: metadata.recipe.checksums = calc_files_checksum(cache_files) local_manifest = FileTreeManifest.loads( load(cache_files["conanmanifest.txt"])) remote_manifest = None if policy != UPLOAD_POLICY_FORCE: # Check SCM data for auto fields if hasattr(conanfile, "scm") and (conanfile.scm.get("url") == "auto" or conanfile.scm.get("revision") == "auto" or conanfile.scm.get("type") is None or conanfile.scm.get("url") is None or conanfile.scm.get("revision") is None): raise ConanException( "The recipe contains invalid data in the 'scm' attribute" " (some 'auto' values or missing fields 'type', 'url' or" " 'revision'). Use '--force' to ignore this error or export" " again the recipe ('conan export' or 'conan create') to" " fix these issues.") remote_manifest = self._check_recipe_date(ref, remote, local_manifest) if policy == UPLOAD_POLICY_SKIP: return ref files_to_upload, deleted = self._recipe_files_to_upload( ref, policy, cache_files, remote, remote_manifest, local_manifest) if files_to_upload or deleted: self._remote_manager.upload_recipe(ref, files_to_upload, deleted, remote, retry, retry_wait) self._upload_recipe_end_msg(ref, remote) else: self._output.info("Recipe is up to date, upload skipped") duration = time.time() - t1 log_recipe_upload(ref, duration, cache_files, remote.name) self._hook_manager.execute("post_upload_recipe", conanfile_path=conanfile_path, reference=ref, remote=remote) # The recipe wasn't in the registry or it has changed the revision field only if not current_remote_name: with layout.update_metadata() as metadata: metadata.recipe.remote = remote.name return ref