mirror of
https://github.com/jordansissel/fpm
synced 2025-08-30 04:10:42 +02:00
122 lines
3.4 KiB
Plaintext
122 lines
3.4 KiB
Plaintext
# Disable the stupid stuff rpm distros include in the build process by default:
|
|
<% %w(prep build install clean).each do |step| -%>
|
|
<%# These definitions have to be non-empty... I guess... -%>
|
|
# Disable any <%= step %> shell actions. replace them with simply 'true'
|
|
%define __spec_<%= step %>_post true
|
|
%define __spec_<%= step %>_pre true
|
|
<% end -%>
|
|
# Disable checking for unpackaged files ?
|
|
#%undefine __check_files
|
|
|
|
# Use <%= attributes[:rpm_digest] %> file digest method
|
|
%define _binary_filedigest_algorithm <%= digest_algorithm %>
|
|
|
|
# Use <%= attributes[:rpm_compression] %> payload compression
|
|
%define _binary_payload <%= payload_compression %>
|
|
|
|
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.empty? ? "_" : description.split("\n").first %>
|
|
BuildArch: <%= architecture %>
|
|
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
|
|
|
|
Group: <%= category %>
|
|
License: <%= license %>
|
|
Vendor: <%= vendor %>
|
|
URL: <%= url or "http://nourlgiven.example.com/" %>
|
|
Packager: <%= maintainer %>
|
|
|
|
<% dependencies.each do |req| -%>
|
|
Requires: <%= req %>
|
|
<% end -%>
|
|
<% provides.each do |prov| -%>
|
|
Provides: <%= prov %>
|
|
<% end -%>
|
|
<% conflicts.each do |conflict| -%>
|
|
Conflicts: <%= conflict %>
|
|
<% 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
|
|
# noop
|
|
|
|
%install
|
|
<% files.each do |path| -%>
|
|
<% source = Shellwords.shellescape(File.join(staging_path, path)) -%>
|
|
<% # Copy to the build_path/BUILD/ to make rpmbuild happy -%>
|
|
<% target = Shellwords.shellescape(File.join(build_path, "BUILD", path)) -%>
|
|
<% dir = File.dirname(target) %>
|
|
mkdir -p <%= dir %>
|
|
if [ -f <%= source %> ] || [ -h <%= source %> ] ; then
|
|
cp -d <%= source %> <%= target %>
|
|
elif [ -d <%= source %> ] ; then
|
|
mkdir <%= target %>
|
|
fi
|
|
<% end %>
|
|
|
|
%clean
|
|
# noop
|
|
|
|
<% if scripts[:before_install] -%>
|
|
%pre
|
|
<%= scripts[:before_install] %>
|
|
|
|
<% end -%>
|
|
<% if scripts[:after_install] -%>
|
|
%post
|
|
<%= scripts[:after_install] %>
|
|
|
|
<% end -%>
|
|
<% if scripts[:before_remove] -%>
|
|
%preun
|
|
<%= scripts[:before_remove] %>
|
|
|
|
<% end -%>
|
|
<% if scripts[:after_remove] -%>
|
|
%postun
|
|
<%= scripts[:after_remove] %>
|
|
|
|
<% end -%>
|
|
%files
|
|
%defattr(-,root,root,-)
|
|
<%# Output config files and then regular files. -%>
|
|
<% config_files.each do |path| -%>
|
|
%config(noreplace) <%= path %>
|
|
<% end -%>
|
|
<%# list only files, not directories? -%>
|
|
<%=
|
|
# Reject config files already listed or parent directories, then prefix files
|
|
# with "/", then make sure paths with spaces are quoted. I hate rpm so much.
|
|
|
|
# 'files' here is the method FPM::Package#files.
|
|
# The 'files' section of rpm can be
|
|
# Replace [ with [\[] to make rpm not use globs
|
|
# Replace * with [*] to make rpm not use globs
|
|
files.collect { |f| "/#{f}" } \
|
|
.reject { |f| config_files.include?(f) } \
|
|
.collect { |f| f[/\s/] and "\"#{f}\"" or f } \
|
|
.collect { |f| f.gsub("[", "[\\[]") } \
|
|
.collect { |f| f.gsub("*", "[*]") } \
|
|
.join("\n")
|
|
%>
|
|
|
|
%changelog
|