summaryrefslogtreecommitdiff
path: root/src/debian.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-04-22 08:27:04 +0300
committerLars Wirzenius <liw@liw.fi>2021-04-22 08:40:49 +0300
commit24574aef2299925c10eeb9d20a942f36d1d806d4 (patch)
treee05affad9e645047bddee6a93ca69e11445f50fa /src/debian.rs
parent3f68ce4a8e9b295a4b9fc288174f166e229da8b0 (diff)
downloadbumper-rs-24574aef2299925c10eeb9d20a942f36d1d806d4.tar.gz
feat: use project's name in git tag template
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, ""])?;