/// Fetch all base packages needed by the target OS.
Fetch all base packages needed by the target OS.
Fetch all base packages needed by the target OS .
async fn fetch_packages(
        &mut self,
        co: &mut async_generator::Yield<State>,
        state: &mut state::Fetch,
        packages_to_fetch: Vec<PkgUrl>,
        mode: UpdateMode,
    ) -> Result<Vec<DirectoryProxy>, FetchError> {
        let mut packages = Vec::with_capacity(packages_to_fetch.len());
        let package_dir_futs =
            resolver::resolve_packages(&self.env.pkg_resolver, packages_to_fetch.iter());
        futures::pin_mut!(package_dir_futs);
        while let Some(package_dir) =
            package_dir_futs.try_next().await.map_err(FetchError::Resolve)?
        {
            packages.push(package_dir);
            state.add_progress(co, 1).await;
        }
        match mode {
            UpdateMode::Normal => {
                sync_package_cache(&self.env.pkg_cache).await.map_err(FetchError::Sync)?
            }
            UpdateMode::ForceRecovery => {}
        }
        Ok(packages)
    }
async fn fetch_packages ( & mut self , co : & mut async_generator :: Yield < State > , state : & mut state :: Fetch , packages_to_fetch : Vec < PkgUrl > , mode : UpdateMode , ) -> Result < Vec < DirectoryProxy > , FetchError > { let mut packages = Vec :: with_capacity ( packages_to_fetch . len ( ) ) ; let package_dir_futs = resolver :: resolve_packages ( & self . env . pkg_resolver , packages_to_fetch . iter ( ) ) ; futures :: pin_mut ! ( package_dir_futs ) ; while let Some ( package_dir ) = package_dir_futs . try_next ( ) . await . map_err ( FetchError :: Resolve ) ? { packages . push ( package_dir ) ; state . add_progress ( co , 1 ) . await ; } match mode { UpdateMode :: Normal => { sync_package_cache ( & self . env . pkg_cache ) . await . map_err ( FetchError :: Sync ) ? } UpdateMode :: ForceRecovery => { } } Ok ( packages ) }
Fetch all base packages needed by the target OS.
Fetch all base packages needed by the target OS .
&mut self
co
&mut async_generator::Yield<State>
state
&mut state::Fetch
packages_to_fetch
Vec<PkgUrl>
mode
UpdateMode