03520c90b5f9aef5fc6389a4d0b99637fc627a92
[packages/precise/mcollective.git] / plugins / mcollective / pluginpackager / templates / redhat / rpm_spec.erb
1 Summary: <%= @plugin.metadata[:description] %>
2 Name: <%= @current_package_name%>
3 Version: <%= @plugin.metadata[:version] %>
4 Release: <%= @plugin.iteration %>
5 License: <%= @plugin.metadata[:license] %>
6 URL: <%= @plugin.metadata[:url] %>
7 Vendor: <%= @plugin.vendor %>
8 Packager: <%= @plugin.metadata[:author] %>
9 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
10 BuildArch: noarch
11 Group: System Tools
12 Source0: <%= "#{@current_package_name}-#{@plugin.metadata[:version]}.tgz" %>
13 <% @current_package_data[:dependencies].each do |dep|-%>
14 Requires: <%= dep[:name] -%> <%= ">= #{dep[:version]}" if dep[:version]%><%="-#{dep[:iteration]}" if dep[:iteration]%>
15 <% end -%>
16 <% if @current_package_data[:plugindependency] %>
17 Requires: <%= @current_package_data[:plugindependency][:name] -%> = <%= @current_package_data[:plugindependency][:version]%>-<%= @current_package_data[:plugindependency][:iteration]%>
18 <% end %>
19
20 %description
21 <%= @plugin.metadata[:description] %>
22
23 %prep
24 %setup
25
26 %build
27
28 %install
29 <% @dirs = [] -%>
30 <% @package_files = [] -%>
31 <% @current_package_data[:files].each do |file| -%>
32 <% @dirs << File.dirname(File.join(@libdir, File.expand_path(file).gsub(/#{File.expand_path(plugin.path)}|\.\//, ''))) -%>
33 <% @package_files << File.join(@libdir, File.expand_path(file).gsub(/#{File.expand_path(plugin.path)}|\.\//, '')) -%>
34 <% end -%>
35 rm -rf %{buildroot}
36 <% @dirs.uniq.each do |dir| -%>
37 %{__install} -d -m0755 %{buildroot}<%= dir%>
38 <% end -%>
39 <% @package_files -=  @dirs %>
40 <% @package_files.each do |package_file| -%>
41 %{__install} -m0644 <%= (package_file[0].chr == '/') ? package_file[1..package_file.size-1]: package_file%> %{buildroot}<%=package_file %>
42 <% end -%>
43
44 %files
45 %defattr(-,root,root,-)
46 <% @package_files.each do |file| -%>
47 <%= file %>
48 <% end -%>
49
50 <% if @plugin.preinstall -%>
51 %pre
52 <%= @plugin.preinstall %>
53 <% end -%>
54 <% if @plugin.postinstall -%>
55 %post
56 <%= @plugin.postinstall%>
57 <% end -%>
58
59 %changelog
60 * <%= Time.now.strftime("%a %b %d %Y") -%> <%= @plugin.metadata[:author]%> - <%= @plugin.metadata[:version]%>-<%= @plugin.iteration%>
61 - Built Package <%= @current_package_name-%>