jordansissel/fpm — Issue #127: File paths for RPM target are not correctly handled
Author: ohookins
Created: 2011-11-26 21:42:44+00:00
State: open

RPMs use the generic package path handling:

```ruby
def render_spec
# find all files in paths given.
paths = []
@source.paths.each do |path|
Find.find(path) { |p| paths << p }
end
#@logger.info(:paths => paths.sort)
template.result(binding)
end # def render_spec
```

However in the RPM specfile template:
```ruby
<%= @source.paths.collect { |p| p.gsub(/^\.\//, "/").gsub(/^[^\/]/, "/\\0") }.join("\n") %>
```

So, an array is generated which should contain an explicit list of all files under the source path, but it is not used. This ends up being a good thing as the Find.find is run on the real path (e.g. /usr/lib/ruby/gems/1.8) and so will be populated with a list of files that won't be in the buildroot.

The solution is probably to pass both the path list as is currently done, and the buildroot which can be prepended to the path list to generate the directory to traverse with Find.find. This generated list will then need the buildroot chopped off the beginning to yield the actual file list for RPM.

I'm not sure how this affects other package types (it probably doesn't) but it's a pretty big problem for RPM right now if an external file list and config file listings are to be supported.