Permalink
Browse files

- fix some failing tests introduced by #230 (regression check on quoted

  filenames, etc)
- Prefer File.join() when joining paths
  • Loading branch information...
1 parent d6dddf2 commit 6f3cd25ccb657b1bbf666125549a36fcd4975d61 @jordansissel committed Jul 22, 2012
Showing with 5 additions and 5 deletions.
  1. +2 −2 lib/fpm/package/rpm.rb
  2. +3 −3 templates/rpm.erb
View
@@ -205,11 +205,11 @@ def output(output_path)
end # def output
def prefix
- return attributes[:prefix]
+ return (attributes[:prefix] or "/")
end # def prefix
def build_sub_dir
- return "BUILD" + prefix
+ return File.join("BUILD", prefix)
end # def prefix
View
@@ -27,7 +27,7 @@ AutoReqProv: no
# Seems specifying BuildRoot is required on older rpmbuild (like on CentOS 5)
# fpm passes '--define buildroot ...' on the commandline, so just reuse that.
BuildRoot: %buildroot
-<% if !prefix.empty? %>
+<% if !prefix.nil? and !prefix.empty? %>
Prefix: <%= prefix %>
<% end -%>
@@ -104,7 +104,7 @@ fi
%defattr(-,<%= attributes[:rpm_user] %>,<%= attributes[:rpm_group] %>,-)
<%# Output config files and then regular files. -%>
<% config_files.each do |path| -%>
-%config(noreplace) <%= path.gsub(/^/,prefix) %>
+%config(noreplace) <%= File.join(prefix, path) %>
<% end -%>
<%# list only files, not directories? -%>
<%=
@@ -117,10 +117,10 @@ fi
# Replace * with [*] to make rpm not use globs
files.collect { |f| "/#{f}" } \
.reject { |f| config_files.include?(f) } \
+ .collect { |f| File.join(prefix, f) } \
.collect { |f| f[/\s/] and "\"#{f}\"" or f } \
.collect { |f| f.gsub("[", "[\\[]") } \
.collect { |f| f.gsub("*", "[*]") } \
- .collect { |f| f.gsub(/^/, prefix ) } \
.join("\n")
%>

0 comments on commit 6f3cd25

Please sign in to comment.