Skip to content

Commit 7f542e8

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

File tree

1 file changed

+23
-6
lines changed
  • resources/puppetlabs/lein-ezbake/template/global/ext

1 file changed

+23
-6
lines changed

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)