diff --git a/lib/fpm/cookery/packager.rb b/lib/fpm/cookery/packager.rb index 070ff8a..e3830cf 100644 --- a/lib/fpm/cookery/packager.rb +++ b/lib/fpm/cookery/packager.rb @@ -213,18 +213,19 @@ def build_package(recipe, config) output = input.convert(output_class) + output_filename = output.to_s(recipe.package_name_format) recipe.run_lifecycle_hook(:before_package_create, output) begin - output.output(output.to_s) + output.output(output_filename) recipe.run_lifecycle_hook(:after_package_create, output) rescue FPM::Package::FileAlreadyExists - Log.info "Removing existing package file: #{output.to_s}" - FileUtils.rm_f(output.to_s) + Log.info "Removing existing package file: #{output_filename}" + FileUtils.rm_f(output_filename) retry ensure input.cleanup if input output.cleanup if output - Log.info "Created package: #{File.join(Dir.pwd, output.to_s)}" + Log.info "Created package: #{File.join(Dir.pwd, output_filename)}" end end end diff --git a/lib/fpm/cookery/recipe.rb b/lib/fpm/cookery/recipe.rb index c4c255d..1482754 100644 --- a/lib/fpm/cookery/recipe.rb +++ b/lib/fpm/cookery/recipe.rb @@ -35,7 +35,7 @@ class BaseRecipe :pre_install, :post_install, :pre_uninstall, :post_uninstall, :license, :omnibus_package, :omnibus_dir, :chain_package, :default_prefix, :docker, :docker_image, :dockerfile, - :epoch + :package_name_format, :epoch attr_rw_list :build_depends, :config_files, :conflicts, :depends, :exclude, :patches, :provides, :replaces, :omnibus_recipes,