Skip to content

Commit

Permalink
Make systemd use deb name, not crate name
Browse files Browse the repository at this point in the history
Fixes #150
  • Loading branch information
kornelski committed Jan 6, 2025
1 parent 63e8260 commit ec30375
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub enum ExtendedDescription {
#[non_exhaustive]
pub struct PackageConfig {
/// The name of the project to build
pub name: String,
pub cargo_crate_name: String,
/// The name to give the Debian package; usually the same as the Cargo project name
pub deb_name: String,
/// The version to give the Debian package; usually the same as the Cargo version
Expand Down Expand Up @@ -524,7 +524,7 @@ impl Config {
.or(package_deb.maintainer_scripts_rel_path.as_ref());
if let Some(unit_dir) = units_dir_option {
let search_path = self.path_in_package(unit_dir);
let package = &package_deb.name;
let package = &package_deb.deb_name;
let unit_name = config.unit_name.as_deref();

let units = dh_installsystemd::find_units(&search_path, package, unit_name);
Expand Down Expand Up @@ -568,7 +568,7 @@ impl Config {

/// Store intermediate files here
pub(crate) fn deb_temp_dir(&self, package_deb: &PackageConfig) -> PathBuf {
self.target_dir.join("debian").join(&package_deb.name)
self.target_dir.join("debian").join(&package_deb.cargo_crate_name)
}

/// Save final .deb here
Expand Down Expand Up @@ -639,7 +639,7 @@ impl PackageConfig {
deb_version,
default_timestamp,
raw_assets: deb.assets.take(),
name: cargo_package.name.clone(),
cargo_crate_name: cargo_package.name.clone(),
deb_name: deb.name.take().unwrap_or_else(|| debian_package_name(&cargo_package.name)),
license,
license_file_rel_path,
Expand Down Expand Up @@ -936,7 +936,7 @@ impl PackageConfig {

pub(crate) fn append_copyright_metadata(&self, copyright: &mut Vec<u8>) -> Result<(), CargoDebError> {
writeln!(copyright, "Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/")?;
writeln!(copyright, "Upstream-Name: {}", self.name)?;
writeln!(copyright, "Upstream-Name: {}", self.cargo_crate_name)?;
if let Some(source) = self.repository.as_deref().or(self.homepage.as_deref()) {
writeln!(copyright, "Source: {source}")?;
}
Expand Down
4 changes: 2 additions & 2 deletions src/deb/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl<'l, W: Write> ControlArchiveBuilder<'l, W> {
// Select and populate autoscript templates relevant to the unit
// file(s) in this package and the configuration settings chosen.
scripts = dh_installsystemd::generate(
&package_deb.name,
&package_deb.deb_name,
&package_deb.assets.resolved,
&dh_installsystemd::Options::from(systemd_units_config),
self.listener,
Expand All @@ -82,7 +82,7 @@ impl<'l, W: Write> ControlArchiveBuilder<'l, W> {
dh_lib::apply(
&maintainer_scripts_dir,
&mut scripts,
&package_deb.name,
&package_deb.deb_name,
unit_name,
self.listener,
)?;
Expand Down

0 comments on commit ec30375

Please sign in to comment.