Пример #1
0
    def get_recipe(self, conan_reference, remote):
        """
        Read the conans from remotes
        Will iterate the remotes to find the conans unless remote was specified

        returns (dict relative_filepath:abs_path , remote_name)"""
        self._hook_manager.execute("pre_download_recipe", reference=conan_reference, remote=remote)
        dest_folder = self._client_cache.export(conan_reference)
        rmdir(dest_folder)

        t1 = time.time()
        tmp = self._call_remote(remote, "get_recipe", conan_reference, dest_folder)
        zipped_files, conan_reference, rev_time = tmp
        duration = time.time() - t1
        log_recipe_download(conan_reference, duration, remote.name, zipped_files)

        unzip_and_get_files(zipped_files, dest_folder, EXPORT_TGZ_NAME, output=self._output)
        # Make sure that the source dir is deleted
        rm_conandir(self._client_cache.source(conan_reference))
        touch_folder(dest_folder)
        conanfile_path = self._client_cache.conanfile(conan_reference)
        self._hook_manager.execute("post_download_recipe", conanfile_path=conanfile_path,
                                   reference=conan_reference, remote=remote)

        with self._client_cache.update_metadata(conan_reference) as metadata:
            metadata.recipe.revision = conan_reference.revision
            metadata.recipe.time = rev_time

        return conan_reference
Пример #2
0
    def get_recipe(self, conan_reference, remote):
        """
        Read the conans from remotes
        Will iterate the remotes to find the conans unless remote was specified

        returns (dict relative_filepath:abs_path , remote_name)"""
        dest_folder = self._client_cache.export(conan_reference)
        rmdir(dest_folder)

        def filter_function(urls):
            if CONANFILE not in list(urls.keys()):
                raise NotFoundException("Conan '%s' doesn't have a %s!"
                                        % (conan_reference, CONANFILE))
            urls.pop(EXPORT_SOURCES_TGZ_NAME, None)
            return urls

        t1 = time.time()
        urls = self._call_remote(remote, "get_recipe_urls", conan_reference)
        urls = filter_function(urls)
        if not urls:
            return conan_reference

        zipped_files = self._call_remote(remote, "download_files_to_folder", urls, dest_folder)

        duration = time.time() - t1
        log_recipe_download(conan_reference, duration, remote, zipped_files)

        unzip_and_get_files(zipped_files, dest_folder, EXPORT_TGZ_NAME)
        # Make sure that the source dir is deleted
        rm_conandir(self._client_cache.source(conan_reference))
        touch_folder(dest_folder)
Пример #3
0
    def get_recipe(self, conan_reference, dest_folder, remote):
        """
        Read the conans from remotes
        Will iterate the remotes to find the conans unless remote was specified

        returns (dict relative_filepath:abs_path , remote_name)"""
        rmdir(dest_folder)  # Remove first the destination folder
        t1 = time.time()

        def filter_function(urls):
            if CONANFILE not in list(urls.keys()):
                raise NotFoundException("Conan '%s' doesn't have a %s!" %
                                        (conan_reference, CONANFILE))
            urls.pop(EXPORT_SOURCES_TGZ_NAME, None)
            return urls

        zipped_files = self._call_remote(remote, "get_recipe", conan_reference,
                                         dest_folder, filter_function)
        duration = time.time() - t1
        log_recipe_download(conan_reference, duration, remote, zipped_files)

        unzip_and_get_files(zipped_files, dest_folder, EXPORT_TGZ_NAME)
        # Make sure that the source dir is deleted
        rm_conandir(self._client_cache.source(conan_reference))
        for dirname, _, filenames in os.walk(dest_folder):
            for fname in filenames:
                touch(os.path.join(dirname, fname))
Пример #4
0
    def get_recipe(self, conan_reference, remote):
        """
        Read the conans from remotes
        Will iterate the remotes to find the conans unless remote was specified

        returns (dict relative_filepath:abs_path , remote_name)"""
        dest_folder = self._client_cache.export(conan_reference)
        rmdir(dest_folder)

        def filter_function(urls):
            if CONANFILE not in list(urls.keys()):
                raise NotFoundException("Conan '%s' doesn't have a %s!"
                                        % (conan_reference, CONANFILE))
            urls.pop(EXPORT_SOURCES_TGZ_NAME, None)
            return urls

        t1 = time.time()
        urls = self._call_remote(remote, "get_recipe_urls", conan_reference)
        urls = filter_function(urls)
        if not urls:
            return conan_reference

        zipped_files = self._call_remote(remote, "download_files_to_folder", urls, dest_folder)

        duration = time.time() - t1
        log_recipe_download(conan_reference, duration, remote, zipped_files)

        unzip_and_get_files(zipped_files, dest_folder, EXPORT_TGZ_NAME)
        # Make sure that the source dir is deleted
        rm_conandir(self._client_cache.source(conan_reference))
        touch_folder(dest_folder)
Пример #5
0
    def get_recipe(self, conan_reference, dest_folder, remote):
        """
        Read the conans from remotes
        Will iterate the remotes to find the conans unless remote was specified

        returns (dict relative_filepath:abs_path , remote_name)"""
        rmdir(dest_folder)  # Remove first the destination folder
        t1 = time.time()

        def filter_function(urls):
            if CONANFILE not in list(urls.keys()):
                raise NotFoundException("Conan '%s' doesn't have a %s!"
                                        % (conan_reference, CONANFILE))
            urls.pop(EXPORT_SOURCES_TGZ_NAME, None)
            return urls

        zipped_files = self._call_remote(remote, "get_recipe", conan_reference, dest_folder,
                                         filter_function)
        duration = time.time() - t1
        log_recipe_download(conan_reference, duration, remote, zipped_files)

        unzip_and_get_files(zipped_files, dest_folder, EXPORT_TGZ_NAME)
        # Make sure that the source dir is deleted
        rm_conandir(self._client_cache.source(conan_reference))
        for dirname, _, filenames in os.walk(dest_folder):
            for fname in filenames:
                touch(os.path.join(dirname, fname))
Пример #6
0
    def get_recipe(self, ref, remote):
        """
        Read the conans from remotes
        Will iterate the remotes to find the conans unless remote was specified

        returns (dict relative_filepath:abs_path , remote_name)"""

        self._hook_manager.execute("pre_download_recipe", reference=ref, remote=remote)
        dest_folder = self._cache.package_layout(ref).export()
        rmdir(dest_folder)

        ref = self._resolve_latest_ref(ref, remote)

        t1 = time.time()
        zipped_files = self._call_remote(remote, "get_recipe", ref, dest_folder)
        duration = time.time() - t1
        log_recipe_download(ref, duration, remote.name, zipped_files)

        unzip_and_get_files(zipped_files, dest_folder, EXPORT_TGZ_NAME, output=self._output)
        # Make sure that the source dir is deleted
        package_layout = self._cache.package_layout(ref)
        rm_conandir(package_layout.source())
        touch_folder(dest_folder)
        conanfile_path = package_layout.conanfile()

        with package_layout.update_metadata() as metadata:
            metadata.recipe.revision = ref.revision

        self._hook_manager.execute("post_download_recipe", conanfile_path=conanfile_path,
                                   reference=ref, remote=remote)

        return ref
Пример #7
0
    def get_recipe(self, ref, remote):
        """
        Read the conans from remotes
        Will iterate the remotes to find the conans unless remote was specified

        returns (dict relative_filepath:abs_path , remote_name)"""

        self._hook_manager.execute("pre_download_recipe",
                                   reference=ref,
                                   remote=remote)
        package_layout = self._cache.package_layout(ref)
        package_layout.export_remove()

        ref = self._resolve_latest_ref(ref, remote)

        t1 = time.time()
        download_export = package_layout.download_export()
        zipped_files = self._call_remote(remote, "get_recipe", ref,
                                         download_export)
        duration = time.time() - t1
        log_recipe_download(ref, duration, remote.name, zipped_files)

        recipe_checksums = calc_files_checksum(zipped_files)

        export_folder = package_layout.export()
        tgz_file = zipped_files.pop(EXPORT_TGZ_NAME, None)
        check_compressed_files(EXPORT_TGZ_NAME, zipped_files)
        if tgz_file:
            uncompress_file(tgz_file, export_folder, output=self._output)
        mkdir(export_folder)
        for file_name, file_path in zipped_files.items():  # copy CONANFILE
            shutil.move(file_path, os.path.join(export_folder, file_name))

        # Make sure that the source dir is deleted
        rm_conandir(package_layout.source())
        touch_folder(export_folder)
        conanfile_path = package_layout.conanfile()

        with package_layout.update_metadata() as metadata:
            metadata.recipe.revision = ref.revision
            metadata.recipe.checksums = recipe_checksums
            metadata.recipe.remote = remote.name

        self._hook_manager.execute("post_download_recipe",
                                   conanfile_path=conanfile_path,
                                   reference=ref,
                                   remote=remote)

        return ref
Пример #8
0
    def get_recipe(self, conan_reference, remote):
        """
        Read the conans from remotes
        Will iterate the remotes to find the conans unless remote was specified

        returns (dict relative_filepath:abs_path , remote_name)"""
        dest_folder = self._client_cache.export(conan_reference)
        rmdir(dest_folder)

        t1 = time.time()
        zipped_files, conan_reference = self._call_remote(remote, "get_recipe", conan_reference,
                                                          dest_folder)
        duration = time.time() - t1
        log_recipe_download(conan_reference, duration, remote.name, zipped_files)

        unzip_and_get_files(zipped_files, dest_folder, EXPORT_TGZ_NAME)
        # Make sure that the source dir is deleted
        rm_conandir(self._client_cache.source(conan_reference))
        touch_folder(dest_folder)
        return conan_reference