summaryrefslogtreecommitdiff
path: root/src/debian.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-04-22 05:43:18 +0000
committerLars Wirzenius <liw@liw.fi>2021-04-22 05:43:18 +0000
commit4427fe12410f911a9c8f18ea7b3c9643c88f6d5f (patch)
treee05affad9e645047bddee6a93ca69e11445f50fa /src/debian.rs
parent1600a727446867029451df6f8a181b5a07709efb (diff)
parent24574aef2299925c10eeb9d20a942f36d1d806d4 (diff)
downloadbumper-rs-4427fe12410f911a9c8f18ea7b3c9643c88f6d5f.tar.gz
Merge branch 'tagname-take2' into 'main'
make git tag name be configurable via a template Closes #1 See merge request larswirzenius/bumper!19
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, ""])?;