Skip to content

Commit

Permalink
Merge pull request jordansissel#293 from justintime/patch-1
Browse files Browse the repository at this point in the history
Include subdirs of --directories option as %dir directives in SPEC files
  • Loading branch information
jls committed Nov 27, 2012
2 parents 08bcc09 + 38210e9 commit 157bb8c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions templates/rpm.erb
Expand Up @@ -109,8 +109,15 @@ fi
<% config_files.each do |path| -%>
%config(noreplace) <%= File.join(prefix, path) %>
<% end -%>
<% subdirs = [] -%>
<% directories.each do |path| -%>
%dir <%= File.join(prefix, path) %>
<%# We need to include hidden directories, but exclude . and .. -%>
<% ::Dir.glob("#{path}/**/*/", FNM_DOTMATCH) do |subdir| -%>
<% next if File.basename(subdir) =~ /^\.+$/ -%>
%dir <%= File.join(prefix, subdir) %>
<% subdirs << subdir -%>
<% end -%>
<% end -%>
<%# list only files, not directories? -%>
<%=
Expand All @@ -125,6 +132,7 @@ fi
# Replace % with [%] to make rpm not expand macros
files.collect { |f| "/#{f}" } \
.reject { |f| config_files.include?(f) } \
.reject { |f| subdirs.include?("#{f}/") } \
.collect { |f| f[/\s/] and "\"#{f}\"" or f } \
.collect { |f| f.gsub("[", "[\\[]") } \
.collect { |f| f.gsub("*", "[*]") } \
Expand Down

0 comments on commit 157bb8c

Please sign in to comment.