Skip to content

Commit

Permalink
- fix some failing tests introduced by #230 (regression check on quoted
Browse files Browse the repository at this point in the history
  filenames, etc)
- Prefer File.join() when joining paths
  • Loading branch information
jordansissel committed Jul 22, 2012
1 parent d6dddf2 commit 6f3cd25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/fpm/package/rpm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
6 changes: 3 additions & 3 deletions templates/rpm.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%>

Expand Down Expand Up @@ -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? -%>
<%=
Expand All @@ -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")
%>

Expand Down

0 comments on commit 6f3cd25

Please sign in to comment.