summaryrefslogtreecommitdiff
path: root/src/debian.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/debian.rs')
-rw-r--r--src/debian.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/debian.rs b/src/debian.rs
index 3f9e01b..15b87ed 100644
--- a/src/debian.rs
+++ b/src/debian.rs
@@ -19,6 +19,24 @@ impl Debian {
Err(BumperError::UnknownProjectKind(dirname.to_path_buf()))
}
+ pub fn name(&self) -> Result<String, BumperError> {
+ let output = Command::new("dpkg-parsechangelog")
+ .arg("-SSource")
+ .current_dir(&self.dirname)
+ .output()
+ .map_err(|err| BumperError::ParseChangelogInvoke(self.dirname.to_path_buf(), err))?;
+ if output.status.success() {
+ let name = String::from_utf8_lossy(&output.stdout).into_owned();
+ Ok(name.trim_end().to_string())
+ } else {
+ let stderr = String::from_utf8_lossy(&output.stderr).into_owned();
+ Err(BumperError::ParseChangelog(
+ self.dirname.to_path_buf(),
+ stderr,
+ ))
+ }
+ }
+
pub fn set_version(&mut self, version: &str) -> Result<String, BumperError> {
let version = format!("{}-1", version);
self.dch(&["-v", &version, ""])?;