pub struct PkgManager { /* private fields */ }Expand description
A structure of package manager.
The package manager is used to install packages and remove package. Default sources can be used to download and extract the packages by the package manager. The package manager installs the packages to the Unlab-gpu home directory by default where they are available for a user. Also, the packages can be installed as dependencies of current package by default.
Implementations§
Source§impl PkgManager
impl PkgManager
Sourcepub fn new(
home_dir: PathBuf,
work_dir: PathBuf,
bin_dir: PathBuf,
lib_dir: PathBuf,
doc_dir: PathBuf,
src_factories: Vec<Arc<dyn SourceCreate + Send + Sync>>,
printer: Arc<dyn Print + Send + Sync>,
) -> Result<Self>
pub fn new( home_dir: PathBuf, work_dir: PathBuf, bin_dir: PathBuf, lib_dir: PathBuf, doc_dir: PathBuf, src_factories: Vec<Arc<dyn SourceCreate + Send + Sync>>, printer: Arc<dyn Print + Send + Sync>, ) -> Result<Self>
Creates a package manager.
This method takes paths to the Unlab-gpu home directory, the work directory, the binary dirtectory, the library directory, and the documentation directory. The factories of default soruces which allows to access to the package. Also, this method takes the printer that prints messages. If the packages isn’t installed as the dependencies for the current package, the path of work directory should be the path to the the Unlab-gpu home directory.
Sourcepub fn set_locks(&mut self, locks: HashMap<PkgName, Version>)
pub fn set_locks(&mut self, locks: HashMap<PkgName, Version>)
Sets the locked versions of packages.
Sourcepub fn load_locks(&mut self) -> Result<()>
pub fn load_locks(&mut self) -> Result<()>
Loads the locked versions of packages.
Sourcepub fn save_locks(&self) -> Result<()>
pub fn save_locks(&self) -> Result<()>
Saves the locked versions of packages.
Sourcepub fn save_locks_from_pkg_versions(&self) -> Result<()>
pub fn save_locks_from_pkg_versions(&self) -> Result<()>
Saves the locked version packages from the database.
Sourcepub fn constraints(&self) -> &Arc<HashMap<PkgName, VersionReq>>
pub fn constraints(&self) -> &Arc<HashMap<PkgName, VersionReq>>
Returns the constraints.
Sourcepub fn set_constraints(
&mut self,
constraints: Arc<HashMap<PkgName, VersionReq>>,
)
pub fn set_constraints( &mut self, constraints: Arc<HashMap<PkgName, VersionReq>>, )
Sets the constraints.
Sourcepub fn load_constraints(&mut self) -> Result<()>
pub fn load_constraints(&mut self) -> Result<()>
Loads the constraints.
Sourcepub fn set_sources(&mut self, sources: Arc<HashMap<PkgName, SrcInfo>>)
pub fn set_sources(&mut self, sources: Arc<HashMap<PkgName, SrcInfo>>)
Sets the custom sources.
Sourcepub fn load_sources(&mut self) -> Result<()>
pub fn load_sources(&mut self) -> Result<()>
Loads the custom sources.
Sourcepub fn src_factories(&self) -> &[Arc<dyn SourceCreate + Send + Sync>]
pub fn src_factories(&self) -> &[Arc<dyn SourceCreate + Send + Sync>]
Returns the factories of sources.
Sourcepub fn save_manifest(manifest: &Manifest) -> Result<()>
pub fn save_manifest(manifest: &Manifest) -> Result<()>
Saves the manifest of current package.
Sourcepub fn constraints_file(&self) -> PathBuf
pub fn constraints_file(&self) -> PathBuf
Returns the path to the constraints.
Sourcepub fn sources_file(&self) -> PathBuf
pub fn sources_file(&self) -> PathBuf
Returns the path to the custom sources.
Sourcepub fn work_var_dir(&self) -> PathBuf
pub fn work_var_dir(&self) -> PathBuf
Returns the path to the variable directory in the work directory.
Sourcepub fn work_tmp_dir(&self) -> PathBuf
pub fn work_tmp_dir(&self) -> PathBuf
Returns the path to the temporary directory in the work directory.
Sourcepub fn new_part_info_dir(&self) -> PathBuf
pub fn new_part_info_dir(&self) -> PathBuf
Returns the path to the information directory while pre-installing.
Sourcepub fn new_info_dir(&self) -> PathBuf
pub fn new_info_dir(&self) -> PathBuf
Returns the path to the information directory while installing.
Sourcepub fn pkg_info_dir(&self, name: &PkgName) -> PathBuf
pub fn pkg_info_dir(&self, name: &PkgName) -> PathBuf
Returns the path to the information directory for the specified package.
Sourcepub fn pkg_new_part_info_dir(&self, name: &PkgName) -> PathBuf
pub fn pkg_new_part_info_dir(&self, name: &PkgName) -> PathBuf
Returns the path to the information directory while pre-installing for the specified package.
Sourcepub fn pkg_new_info_dir(&self, name: &PkgName) -> PathBuf
pub fn pkg_new_info_dir(&self, name: &PkgName) -> PathBuf
Returns the path to the information directory while installing for the specified package.
Sourcepub fn pkg_tmp_doc_dir(&self, name: &PkgName, version: &Version) -> PathBuf
pub fn pkg_tmp_doc_dir(&self, name: &PkgName, version: &Version) -> PathBuf
Returns the path to the documentation directory in the temporary directory for the specified package.
Sourcepub fn create_source(
&self,
name: &PkgName,
) -> Result<Box<dyn Source + Send + Sync>>
pub fn create_source( &self, name: &PkgName, ) -> Result<Box<dyn Source + Send + Sync>>
Creates a source for the specified package.
Sourcepub fn pkg_versions_in<F>(&self, f: F) -> Result<()>
pub fn pkg_versions_in<F>(&self, f: F) -> Result<()>
Calls the function for each package version.
Sourcepub fn pkg_version(&self, name: &PkgName) -> Result<Option<Version>>
pub fn pkg_version(&self, name: &PkgName) -> Result<Option<Version>>
Returns the package version if the package is installed, otherwise None.
Sourcepub fn pkg_manifest(&self, name: &PkgName) -> Result<Option<Manifest>>
pub fn pkg_manifest(&self, name: &PkgName) -> Result<Option<Manifest>>
Returns the package manifest if the package is installed, otherwise None.
Sourcepub fn pkg_dependents(
&self,
name: &PkgName,
) -> Result<Option<HashMap<PkgName, VersionReq>>>
pub fn pkg_dependents( &self, name: &PkgName, ) -> Result<Option<HashMap<PkgName, VersionReq>>>
Returns the package dependents if the package is installed, otherwise None.
Sourcepub fn pkg_paths(&self, name: &PkgName) -> Result<Option<Paths>>
pub fn pkg_paths(&self, name: &PkgName) -> Result<Option<Paths>>
Returns the package paths if the package is installed, otherwise None.
Sourcepub fn install(
&mut self,
names: &[PkgName],
is_update: bool,
is_force: bool,
is_doc: bool,
) -> Result<()>
pub fn install( &mut self, names: &[PkgName], is_update: bool, is_force: bool, is_doc: bool, ) -> Result<()>
Installs the specified packages with depedencies.
This method overwrites the versions of packages if the update flag is set, otherwise the versions of the packages aren’t updated. If the force flag is set, the packages with the dependencies are reinstalled. The documentations are installed for the packages if the documentation is set, otherwise the documentation aren’t installed.
Sourcepub fn install_deps(
&mut self,
is_update: bool,
is_force: bool,
is_doc: bool,
) -> Result<()>
pub fn install_deps( &mut self, is_update: bool, is_force: bool, is_doc: bool, ) -> Result<()>
Installs the dependencies for the current package.
The unused packages are automatically removed from the work directory. See also install.
Sourcepub fn check_last_op(&self, are_deps: bool) -> Result<()>
pub fn check_last_op(&self, are_deps: bool) -> Result<()>
Checks whether the preparation to the last operation or the last operations was interrupted.
If the preparation to the last operation or the last operation was interrupted, this method returns an error with the appropriate message.
Sourcepub fn cont(&self, is_doc: bool, are_deps: bool) -> Result<()>
pub fn cont(&self, is_doc: bool, are_deps: bool) -> Result<()>
Continues the interrupted last operation.
Sourcepub fn clean(&self) -> Result<()>
pub fn clean(&self) -> Result<()>
Cleans after the interrupted preparation to the last operation.
Sourcepub fn update_all(&self) -> Result<()>
pub fn update_all(&self) -> Result<()>
Updates the versions of all packages.
Sourcepub fn install_all(
&mut self,
is_update: bool,
is_force: bool,
is_doc: bool,
) -> Result<()>
pub fn install_all( &mut self, is_update: bool, is_force: bool, is_doc: bool, ) -> Result<()>
Reinstalls all packages.
See install.
Sourcepub fn generate_doc(&self) -> Result<()>
pub fn generate_doc(&self) -> Result<()>
Generates a documentation for the current package.
Sourcepub fn generate_std_doc(&self) -> Result<()>
pub fn generate_std_doc(&self) -> Result<()>
Generates a documentation of the standard built-in functions.
Trait Implementations§
Source§impl Clone for PkgManager
impl Clone for PkgManager
Source§fn clone(&self) -> PkgManager
fn clone(&self) -> PkgManager
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for PkgManager
impl !UnwindSafe for PkgManager
impl Freeze for PkgManager
impl Send for PkgManager
impl Sync for PkgManager
impl Unpin for PkgManager
impl UnsafeUnpin for PkgManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.