pub struct SourcesManager { /* private fields */ }Expand description
Manager for APT sources and keyrings
Implementations§
Source§impl SourcesManager
impl SourcesManager
Sourcepub fn new(
sources_dir: impl Into<PathBuf>,
keyring_dir: impl Into<PathBuf>,
) -> Self
pub fn new( sources_dir: impl Into<PathBuf>, keyring_dir: impl Into<PathBuf>, ) -> Self
Create a new SourcesManager with custom directories
Sourcepub fn sources_dir(&self) -> &Path
pub fn sources_dir(&self) -> &Path
Get the path to the sources directory
Sourcepub fn keyring_dir(&self) -> &Path
pub fn keyring_dir(&self) -> &Path
Get the path to the keyring directory
Sourcepub fn generate_filename(&self, name: &str, format: FileFormat) -> String
pub fn generate_filename(&self, name: &str, format: FileFormat) -> String
Generate a filename for a repository
Sourcepub fn get_repository_path(&self, filename: &str) -> PathBuf
pub fn get_repository_path(&self, filename: &str) -> PathBuf
Get the full path for a repository file
Sourcepub fn get_keyring_path(&self, filename: &str) -> PathBuf
pub fn get_keyring_path(&self, filename: &str) -> PathBuf
Get the full path for a keyring file
Sourcepub fn write_repositories(
&self,
path: &Path,
repositories: &Repositories,
) -> Result<()>
pub fn write_repositories( &self, path: &Path, repositories: &Repositories, ) -> Result<()>
Write repositories to a file
Sourcepub fn read_repositories(&self, path: &Path) -> Result<Repositories, String>
pub fn read_repositories(&self, path: &Path) -> Result<Repositories, String>
Read repositories from a file
Sourcepub fn list_repository_files(&self) -> Result<Vec<PathBuf>>
pub fn list_repository_files(&self) -> Result<Vec<PathBuf>>
List all repository files in the sources directory
Sourcepub fn scan_all_repositories(
&self,
) -> Result<Vec<(PathBuf, Repositories)>, String>
pub fn scan_all_repositories( &self, ) -> Result<Vec<(PathBuf, Repositories)>, String>
Scan all repository files and return their contents
Sourcepub fn repository_exists(
&self,
repository: &Repository,
) -> Result<Option<PathBuf>, String>
pub fn repository_exists( &self, repository: &Repository, ) -> Result<Option<PathBuf>, String>
Check if a repository already exists in any file
Sourcepub fn ensure_directories(&self) -> Result<()>
pub fn ensure_directories(&self) -> Result<()>
Ensure the sources and keyring directories exist
Sourcepub fn add_repository(
&self,
repository: &Repository,
filename: &str,
) -> Result<(), String>
pub fn add_repository( &self, repository: &Repository, filename: &str, ) -> Result<(), String>
Add a repository to a file, creating the file if it doesn’t exist
Sourcepub fn remove_repository(&self, repository: &Repository) -> Result<bool, String>
pub fn remove_repository(&self, repository: &Repository) -> Result<bool, String>
Remove a repository from all files
Sourcepub fn set_repository_enabled(
&self,
repository: &Repository,
enabled: bool,
) -> Result<bool, String>
pub fn set_repository_enabled( &self, repository: &Repository, enabled: bool, ) -> Result<bool, String>
Enable or disable a repository
Sourcepub fn add_component_to_repositories(
&self,
component: &str,
filter: impl Fn(&Repository) -> bool,
) -> Result<u32, String>
pub fn add_component_to_repositories( &self, component: &str, filter: impl Fn(&Repository) -> bool, ) -> Result<u32, String>
Add a component to all matching repositories
Sourcepub fn enable_source_repositories(
&self,
create_if_missing: bool,
) -> Result<(u32, u32), String>
pub fn enable_source_repositories( &self, create_if_missing: bool, ) -> Result<(u32, u32), String>
Enable source repositories
Sourcepub fn list_all_repositories(
&self,
) -> Result<Vec<(PathBuf, Repository)>, String>
pub fn list_all_repositories( &self, ) -> Result<Vec<(PathBuf, Repository)>, String>
List all repositories with their file paths
Sourcepub fn generate_keyring_filename(&self, repository_name: &str) -> String
pub fn generate_keyring_filename(&self, repository_name: &str) -> String
Generate a keyring filename for a repository
Trait Implementations§
Source§impl Clone for SourcesManager
impl Clone for SourcesManager
Source§fn clone(&self) -> SourcesManager
fn clone(&self) -> SourcesManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more