Skip to content

Commit 6e05b90

Browse files
committed
Add ability to specify replace-pkgs with an empty version
1 parent fe035de commit 6e05b90

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

resources/puppetlabs/lein-ezbake/template/global/controller.sh.erb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,14 @@ fi
152152
params+=('--logrotate')
153153
<% end -%>
154154

155-
<% EZBake::Config[:replaces_pkgs].each do |package, version| -%>
155+
# In this part, we should really be fixing the use of as-ruby-literal
156+
# rather than messing with quotes here. But someone more familiar with
157+
# Clojure than I can do that.
158+
#<% EZBake::Config[:replaces_pkgs].each do |package, version| -%>
159+
#<% munged_package = package.delete_prefix("'").delete_suffix("'") %>
160+
#<% munged_version = version.nil? ? '' : version.delete_prefix("'").delete_suffix("'") %>
161+
#<% replaces_str = munged_version.empty? ? "#{munged_package}" : "#{munged_package} #{munged_version}" %>
162+
#params+=('--replaces' "<%= replaces_str -%>")
156163
params+=('--replaces' "<%= package -%>,<%= version -%>")
157164
<% end %>
158165

resources/puppetlabs/lein-ezbake/template/global/ext/fpm.rb

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,15 +351,32 @@
351351
shared_opts << "--architecture all"
352352

353353
options.replaces.each do |pkg, version|
354+
# Strip the surrounding quotes since we add them in a certain way here.
355+
# We should probably just fix this in the core code by being smarter with
356+
# as-ruby-literaly, but someone more familiar with Clojure can do that part.
357+
pkg = pkg.delete_prefix("'").delete_suffix("'")
358+
version = version.delete_prefix("'").delete_suffix("'") unless version.nil?
354359
if options.output_type == 'rpm'
355-
fpm_opts << "--replaces '#{pkg} <= #{version}-1'"
356-
fpm_opts << "--conflicts '#{pkg} <= #{version}-1'"
360+
val = if version.nil? || version.empty?
361+
"'#{pkg}'"
362+
else
363+
"'#{pkg} <= #{version}-1'"
364+
end
365+
fpm_opts << "--replaces #{val}"
366+
fpm_opts << "--conflicts #{val}"
357367
elsif options.output_type == 'deb'
358368
# why debian, why.
359-
fpm_opts << "--replaces '#{pkg} (<< #{version}-1openvox1)'"
360-
fpm_opts << "--conflicts '#{pkg} (<< #{version}-1openvox1)'"
361-
fpm_opts << "--replaces '#{pkg} (<< #{version}-1#{options.dist})'"
362-
fpm_opts << "--conflicts '#{pkg} (<< #{version}-1#{options.dist})'"
369+
if version.nil? || version.empty?
370+
fpm_opts << "--replaces '#{pkg}'"
371+
fpm_opts << "--conflicts '#{pkg}'"
372+
else
373+
fpm_opts << "--replaces '#{pkg} (<< #{version}-1voxpupuli1)'"
374+
fpm_opts << "--conflicts '#{pkg} (<< #{version}-1voxpupuli1)'"
375+
fpm_opts << "--replaces '#{pkg} (<< #{version}-1puppetlabs1)'"
376+
fpm_opts << "--conflicts '#{pkg} (<< #{version}-1puppetlabs1)'"
377+
fpm_opts << "--replaces '#{pkg} (<< #{version}-1#{options.dist})'"
378+
fpm_opts << "--conflicts '#{pkg} (<< #{version}-1#{options.dist})'"
379+
end
363380
end
364381
end
365382

0 commit comments

Comments
 (0)