pub struct FsWorkspace { /* private fields */ }Expand description
A Workspace backed by a directory on disk.
This is the implementation used by the lintian-brush CLI. The CLI’s
fixer harness materialises the working tree to disk before invoking a
fixer; this workspace then operates on that directory, and breezyshim
picks up the resulting changes outside the fixer.
It contains no breezyshim types and so is safe to depend on from hosts
that don’t want a Python runtime.
Implementations§
Source§impl FsWorkspace
impl FsWorkspace
Sourcepub fn new(
base_path: impl Into<PathBuf>,
package: Option<String>,
version: Option<Version>,
) -> Self
pub fn new( base_path: impl Into<PathBuf>, package: Option<String>, version: Option<Version>, ) -> Self
Create a new tree-backed workspace.
base_path— absolute filesystem path of the package root (the directory containingdebian/).package,version— taken fromdebian/changelogby the caller. PassNonewhen the caller hasn’t read the changelog (e.g. tests, or tools that don’t surface package metadata to their detectors).
Trait Implementations§
Source§impl Workspace for FsWorkspace
impl Workspace for FsWorkspace
Source§fn package(&self) -> Option<&str>
fn package(&self) -> Option<&str>
The source package name, as read from
debian/changelog. Read moreSource§fn current_version(&self) -> Option<&Version>
fn current_version(&self) -> Option<&Version>
The current version of the package, as read from
debian/changelog. Read moreSource§fn parsed_control(&self) -> Result<Control, Error>
fn parsed_control(&self) -> Result<Control, Error>
Read
debian/control and return a parsed value. Read moreSource§fn parsed_changelog(&self) -> Result<ChangeLog, Error>
fn parsed_changelog(&self) -> Result<ChangeLog, Error>
Read
debian/changelog and return a parsed value. Read moreSource§fn parsed_copyright(&self) -> Result<Copyright, Error>
fn parsed_copyright(&self) -> Result<Copyright, Error>
Read
debian/copyright and return a parsed value. Read moreSource§fn parsed_upstream_metadata(&self) -> Result<YamlFile, Error>
fn parsed_upstream_metadata(&self) -> Result<YamlFile, Error>
Read
debian/upstream/metadata and return its parsed YAML. Read moreSource§fn parsed_watch(&self) -> Result<ParsedWatchFile, Error>
fn parsed_watch(&self) -> Result<ParsedWatchFile, Error>
Read
debian/watch and return a parsed value. Read moreSource§fn parsed_rules(&self) -> Result<Makefile, Error>
fn parsed_rules(&self) -> Result<Makefile, Error>
Read
debian/rules and return the parsed Makefile. Read moreSource§fn source_format(&self) -> Result<Option<String>, Error>
fn source_format(&self) -> Result<Option<String>, Error>
Read the trimmed contents of
debian/source/format. Read moreSource§fn control(&self) -> Result<Box<dyn Editor<Control> + '_>, Error>
fn control(&self) -> Result<Box<dyn Editor<Control> + '_>, Error>
Open
debian/control for editing. Read moreSource§fn changelog(&self) -> Result<Box<dyn Editor<ChangeLog> + '_>, Error>
fn changelog(&self) -> Result<Box<dyn Editor<ChangeLog> + '_>, Error>
Open
debian/changelog for editing. See control.Source§fn debcargo(&self) -> Result<Option<Box<dyn Editor<DocumentMut> + '_>>, Error>
fn debcargo(&self) -> Result<Option<Box<dyn Editor<DocumentMut> + '_>>, Error>
Open
debian/debcargo.toml for editing. Read moreSource§fn read_file(&self, rel: &Path) -> Result<Option<Cow<'_, [u8]>>, Error>
fn read_file(&self, rel: &Path) -> Result<Option<Cow<'_, [u8]>>, Error>
Read raw bytes of an arbitrary file relative to the package root. Read more
Source§fn write_file(&self, rel: &Path, content: &[u8]) -> Result<(), Error>
fn write_file(&self, rel: &Path, content: &[u8]) -> Result<(), Error>
Write raw bytes to an arbitrary file relative to the package root. Read more
Source§fn list_dir(&self, rel: &Path) -> Result<Option<Vec<String>>, Error>
fn list_dir(&self, rel: &Path) -> Result<Option<Vec<String>>, Error>
List the entries of a directory relative to the package root. Read more
Source§fn walk_dir(&self, rel: &Path) -> Result<Option<Vec<PathBuf>>, Error>
fn walk_dir(&self, rel: &Path) -> Result<Option<Vec<PathBuf>>, Error>
Recursively walk
rel, returning the relative paths of every
regular file beneath it (paths are relative to the package root,
not to rel). Read moreSource§fn parsed_patches_series(&self) -> Result<Option<Series>, Error>
fn parsed_patches_series(&self) -> Result<Option<Series>, Error>
Read and parse
debian/patches/series, the quilt patch series. Read moreSource§fn parsed_patch(
&self,
rel: &Path,
) -> Result<Option<(Option<PatchHeader>, Patch)>, Error>
fn parsed_patch( &self, rel: &Path, ) -> Result<Option<(Option<PatchHeader>, Patch)>, Error>
Read a quilt patch file and return its parsed DEP-3 header
together with the parsed diff. Read more
Source§fn parsed_debcargo(&self) -> Result<Option<DocumentMut>, Error>
fn parsed_debcargo(&self) -> Result<Option<DocumentMut>, Error>
Read
debian/debcargo.toml and return a parsed TOML document. Read moreAuto Trait Implementations§
impl Freeze for FsWorkspace
impl RefUnwindSafe for FsWorkspace
impl Send for FsWorkspace
impl Sync for FsWorkspace
impl Unpin for FsWorkspace
impl UnsafeUnpin for FsWorkspace
impl UnwindSafe for FsWorkspace
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
Mutably borrows from an owned value. Read more