mirror of
https://github.com/jordansissel/fpm
synced 2025-08-26 03:34:35 +02:00
100 lines
2.6 KiB
Plaintext
100 lines
2.6 KiB
Plaintext
Name: <%= name %>
|
|
Version: <%= version %>
|
|
<% if epoch -%>
|
|
Epoch: <%= epoch %>
|
|
<% end -%>
|
|
Release: <%= iteration or 1 %>
|
|
<%# use the first line of the description as the summary -%>
|
|
Summary: <%= description.split("\n").first %>
|
|
BuildArch: <%= architecture %>
|
|
AutoReqProv: no
|
|
|
|
Group: <%= category %>
|
|
<%#
|
|
TODO: [Jay] rpms require a license
|
|
let's detect it intelligently
|
|
-%>
|
|
License: <%= license %>
|
|
URL: <%= url or "http://nourlgiven.example.com/" %>
|
|
Source0: %{_sourcedir}/data.tar.gz
|
|
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
|
|
|
<% if !dependencies.empty? -%>
|
|
<%
|
|
properdeps = dependencies.collect do |d|
|
|
# Convert gem ~> X.Y.Z to '>= X.Y.Z' and < X.Y+1.0
|
|
if d =~ /\~>/
|
|
name, version = d.gsub(/[()~>]/, "").split(/ +/)[0..1]
|
|
nextversion = version.split(".").collect { |v| v.to_i }
|
|
l = nextversion.length
|
|
nextversion[l-2] += 1
|
|
nextversion[l-1] = 0
|
|
nextversion = nextversion.join(".")
|
|
["#{name} >= #{version}", "#{name} < #{nextversion}"]
|
|
# Convert gem >= A.B.C <= X.Y.Z to '>= A.B.C' and '<= X.Y.Z'
|
|
elsif d =~ /\d [<>]=? \d/
|
|
puts d
|
|
# split out version numbers with their equality sign
|
|
name, lower_version, upper_version = d.scan(/([\w-]+) ([<>]=? [\d\.]+) ([<>]=? [\d\.]+)/)[0]
|
|
["#{name} #{lower_version}", "#{name} #{upper_version}"]
|
|
else
|
|
d
|
|
end
|
|
end
|
|
-%>Requires: <%= properdeps.join(", ") %>
|
|
<% end -%>
|
|
<% provides.each do |prov| -%>
|
|
Provides: <%= prov %>
|
|
<% end -%>
|
|
<% replaces.each do |repl| -%>
|
|
<%# The closes equivalent in RPM to "replaces" is "Obsoletes" -%>
|
|
Obsoletes: <%= repl %>
|
|
<% end -%>
|
|
<%# rpm rejects descriptions with blank lines (even between content), so hack
|
|
around it by replacing blank lines with ' .' -%>
|
|
%description
|
|
<%= description.gsub(/^\s*$/, " .") %>
|
|
|
|
%prep
|
|
# noop
|
|
|
|
%build
|
|
# some rpm implementations delete the build dir and then recreate it by
|
|
# default, for some reason. Whatever, let's work around it.
|
|
cd $RPM_BUILD_ROOT
|
|
tar -zxf %SOURCE0
|
|
|
|
%install
|
|
#noop
|
|
|
|
%clean
|
|
rm -rf $RPM_BUILD_ROOT
|
|
|
|
<% if scripts["pre-install"] -%>
|
|
%pre
|
|
<%= File.read(scripts["pre-install"]) %>
|
|
|
|
<% end -%>
|
|
<% if scripts["post-install"] -%>
|
|
%post
|
|
<%= File.read(scripts["post-install"]) %>
|
|
|
|
<% end -%>
|
|
<% if scripts["pre-uninstall"] -%>
|
|
%preun
|
|
<%= File.read(scripts["pre-uninstall"]) %>
|
|
|
|
<% end -%>
|
|
<% if scripts["post-uninstall"] -%>
|
|
%postun
|
|
<%= File.read(scripts["post-uninstall"]) %>
|
|
|
|
<% end -%>
|
|
%files
|
|
%defattr(-,root,root,-)
|
|
<%# Trim leading '.' from paths if they are './blah...' -%>
|
|
<%# Also ensure paths start with '/' -%>
|
|
<%= @source.paths.collect { |p| p.gsub(/^\.\//, "/").gsub(/^[^\/]/, "/\\0") }.join("\n") %>
|
|
|
|
%changelog
|