fpm 1.3.3 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELIST +32 -0
- data/CONTRIBUTORS +1 -1
- data/lib/fpm.rb +1 -0
- data/lib/fpm/command.rb +43 -18
- data/lib/fpm/package.rb +13 -13
- data/lib/fpm/package/cpan.rb +29 -17
- data/lib/fpm/package/deb.rb +59 -23
- data/lib/fpm/package/dir.rb +13 -26
- data/lib/fpm/package/empty.rb +6 -0
- data/lib/fpm/package/gem.rb +4 -4
- data/lib/fpm/package/npm.rb +2 -2
- data/lib/fpm/package/osxpkg.rb +3 -3
- data/lib/fpm/package/p5p.rb +124 -0
- data/lib/fpm/package/pyfpm/get_metadata.py +9 -1
- data/lib/fpm/package/python.rb +16 -9
- data/lib/fpm/package/rpm.rb +17 -10
- data/lib/fpm/package/sh.rb +1 -7
- data/lib/fpm/package/solaris.rb +1 -1
- data/lib/fpm/package/virtualenv.rb +136 -0
- data/lib/fpm/package/zip.rb +1 -1
- data/lib/fpm/util.rb +31 -5
- data/lib/fpm/version.rb +1 -1
- data/templates/deb/postinst_upgrade.sh.erb +14 -2
- data/templates/deb/postrm_upgrade.sh.erb +10 -1
- data/templates/deb/preinst_upgrade.sh.erb +11 -2
- data/templates/deb/prerm_upgrade.sh.erb +7 -2
- data/templates/p5p_metadata.erb +12 -0
- data/templates/rpm.erb +34 -5
- data/templates/sh.erb +22 -1
- metadata +8 -7
- data/lib/fpm/package/pyfpm/__init__.pyc +0 -0
- data/lib/fpm/package/pyfpm/get_metadata.pyc +0 -0
data/lib/fpm/version.rb
CHANGED
@@ -1,18 +1,31 @@
|
|
1
|
+
#!/bin/sh
|
1
2
|
after_upgrade() {
|
3
|
+
<%# Making sure that at least one command is in the function -%>
|
4
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
5
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
6
|
+
:
|
2
7
|
<% if script?(:after_upgrade) -%>
|
3
8
|
<%= script(:after_upgrade) %>
|
4
9
|
<% end -%>
|
5
10
|
}
|
6
11
|
|
7
12
|
after_install() {
|
13
|
+
<%# Making sure that at least one command is in the function -%>
|
14
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
15
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
16
|
+
:
|
8
17
|
<% if script?(:after_install) -%>
|
9
18
|
<%= script(:after_install) %>
|
10
19
|
<% end -%>
|
11
20
|
}
|
12
21
|
|
13
|
-
if [ "${1}" = "configure" -a -z "${2}" ]
|
22
|
+
if [ "${1}" = "configure" -a -z "${2}" ] || \
|
23
|
+
[ "${1}" = "abort-remove" ]
|
14
24
|
then
|
15
25
|
# "after install" here
|
26
|
+
# "abort-remove" happens when the pre-removal script failed.
|
27
|
+
# In that case, this script, which should be idemptoent, is run
|
28
|
+
# to ensure a clean roll-back of the removal.
|
16
29
|
after_install
|
17
30
|
elif [ "${1}" = "configure" -a -n "${2}" ]
|
18
31
|
then
|
@@ -28,4 +41,3 @@ then
|
|
28
41
|
echo "Failed to install before the post-installation script was run." >&2
|
29
42
|
exit 1
|
30
43
|
fi
|
31
|
-
|
@@ -1,16 +1,25 @@
|
|
1
|
+
#!/bin/sh
|
1
2
|
after_remove() {
|
3
|
+
<%# Making sure that at least one command is in the function -%>
|
4
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
5
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
6
|
+
:
|
2
7
|
<% if script?(:after_remove) -%>
|
3
8
|
<%= script(:after_remove) %>
|
4
9
|
<% end -%>
|
5
10
|
}
|
6
11
|
|
7
12
|
dummy() {
|
13
|
+
:
|
8
14
|
}
|
9
15
|
|
10
16
|
|
11
|
-
if [ "${1}" = "remove" ]
|
17
|
+
if [ "${1}" = "remove" -o "${1}" = "abort-install" ]
|
12
18
|
then
|
13
19
|
# "after remove" goes here
|
20
|
+
# "abort-install" happens when the pre-installation script failed.
|
21
|
+
# In that case, this script, which should be idemptoent, is run
|
22
|
+
# to ensure a clean roll-back of the installation.
|
14
23
|
after_remove
|
15
24
|
elif [ "${1}" = "purge" -a -z "${2}" ]
|
16
25
|
then
|
@@ -1,10 +1,19 @@
|
|
1
|
+
#!/bin/sh
|
1
2
|
before_upgrade() {
|
3
|
+
<%# Making sure that at least one command is in the function -%>
|
4
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
5
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
6
|
+
:
|
2
7
|
<% if script?(:before_upgrade) -%>
|
3
8
|
<%= script(:before_upgrade) %>
|
4
9
|
<% end -%>
|
5
10
|
}
|
6
11
|
|
7
12
|
before_install() {
|
13
|
+
<%# Making sure that at least one command is in the function -%>
|
14
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
15
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
16
|
+
:
|
8
17
|
<% if script?(:before_install) -%>
|
9
18
|
<%= script(:before_install) %>
|
10
19
|
<% end -%>
|
@@ -16,7 +25,7 @@ then
|
|
16
25
|
elif [ "${1}" = "upgrade" -a -n "${2}" ]
|
17
26
|
then
|
18
27
|
upgradeFromVersion="${2}"
|
19
|
-
before_upgrade "${
|
28
|
+
before_upgrade "${upgradeFromVersion}"
|
20
29
|
elif [ "${1}" = "install" -a -n "${2}" ]
|
21
30
|
then
|
22
31
|
upgradeFromVersion="${2}"
|
@@ -24,7 +33,7 @@ then
|
|
24
33
|
# and a new version is installed.
|
25
34
|
# Looks a _lot_ like an upgrade case, I say we just execute the
|
26
35
|
# same "before upgrade" script as in the previous case
|
27
|
-
before_upgrade "${
|
36
|
+
before_upgrade "${upgradeFromVersion}"
|
28
37
|
elif echo "${1}" | grep -E -q '(fail|abort)'
|
29
38
|
then
|
30
39
|
echo "Failed to install before the pre-installation script was run." >&2
|
@@ -1,10 +1,16 @@
|
|
1
|
+
#!/bin/sh
|
1
2
|
before_remove() {
|
3
|
+
<%# Making sure that at least one command is in the function -%>
|
4
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
5
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
6
|
+
:
|
2
7
|
<% if script?(:before_remove) -%>
|
3
8
|
<%= script(:before_remove) %>
|
4
9
|
<% end -%>
|
5
10
|
}
|
6
11
|
|
7
12
|
dummy() {
|
13
|
+
:
|
8
14
|
}
|
9
15
|
|
10
16
|
if [ "${1}" = "remove" -a -z "${2}" ]
|
@@ -13,13 +19,12 @@ then
|
|
13
19
|
before_remove
|
14
20
|
elif [ "${1}" = "upgrade" ]
|
15
21
|
then
|
16
|
-
upgradeVersionTo="${2}"
|
17
22
|
# Executed before the old version is removed
|
18
23
|
# upon upgrade.
|
19
24
|
# We should generally not do anything here. The newly installed package
|
20
25
|
# should do the upgrade, not the uninstalled one, since it can't anticipate
|
21
26
|
# what new things it will have to do to upgrade for the new version.
|
22
|
-
dummy
|
27
|
+
dummy
|
23
28
|
elif echo "${1}" | grep -E -q "(fail|abort)"
|
24
29
|
then
|
25
30
|
echo "Failed to install before the pre-removal script was run." >&2
|
@@ -0,0 +1,12 @@
|
|
1
|
+
set name=pkg.fmri value="<%=@name%>@<%=@version%>"
|
2
|
+
set name=pkg.summary value="<%=@description%>"
|
3
|
+
set name=pkg.human-version value="<%=@version%>"
|
4
|
+
set name=pkg.description value="<%=@description%>"
|
5
|
+
set name=info.classification value="org.opensolaris.category.2008:<%=@category%>"
|
6
|
+
set name=variant.opensolaris.zone <%= attributes[:p5p_zonetype] %>
|
7
|
+
set name=variant.arch value=<%=@architecture%>
|
8
|
+
<transform file dir -> set owner <%= attributes[:p5p_user] %>>
|
9
|
+
<transform file dir -> set group <%= attributes[:p5p_group] %>>
|
10
|
+
<transform dir path=opt$->drop>
|
11
|
+
<transform dir path=etc$->drop>
|
12
|
+
<transform dir path=usr(?:|/bin)$->drop>
|
data/templates/rpm.erb
CHANGED
@@ -17,8 +17,11 @@
|
|
17
17
|
# Disable checking for unpackaged files ?
|
18
18
|
#%undefine __check_files
|
19
19
|
|
20
|
-
# Use <%= attributes[:rpm_digest] %> file digest method
|
20
|
+
# Use <%= attributes[:rpm_digest] %> file digest method.
|
21
|
+
# The first macro is the one used in RPM v4.9.1.1
|
21
22
|
%define _binary_filedigest_algorithm <%= digest_algorithm %>
|
23
|
+
# This is the macro I find on OSX when Homebrew provides rpmbuild (rpm v5.4.14)
|
24
|
+
%define _build_binary_file_digest_algo <%= digest_algorithm %>
|
22
25
|
|
23
26
|
# Use <%= attributes[:rpm_compression] %> payload compression
|
24
27
|
%define _binary_payload <%= payload_compression %>
|
@@ -38,7 +41,7 @@ Version: <%= version %>
|
|
38
41
|
<% if epoch -%>
|
39
42
|
Epoch: <%= epoch %>
|
40
43
|
<% end -%>
|
41
|
-
Release: <%= iteration or 1 %>
|
44
|
+
Release: <%= iteration or 1 %><%= "%{?dist}" if attributes[:rpm_dist] %>
|
42
45
|
<%# use the first line of the description as the summary -%>
|
43
46
|
Summary: <%= description.split("\n").first.empty? ? "_" : description.split("\n").first %>
|
44
47
|
<% if !attributes[:rpm_autoreqprov?] -%>
|
@@ -120,42 +123,60 @@ Obsoletes: <%= repl %>
|
|
120
123
|
<% if script?(:before_upgrade) or script?(:before_install) -%>
|
121
124
|
%pre
|
122
125
|
upgrade() {
|
126
|
+
<%# Making sure that at least one command is in the function -%>
|
127
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
128
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
129
|
+
:
|
123
130
|
<% if script?(:before_upgrade) -%>
|
124
131
|
<%= script(:before_upgrade) %>
|
125
132
|
<% end -%>
|
126
133
|
}
|
127
134
|
install() {
|
135
|
+
<%# Making sure that at least one command is in the function -%>
|
136
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
137
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
138
|
+
:
|
128
139
|
<% if script?(:before_install) -%>
|
129
140
|
<%= script(:before_install) %>
|
130
141
|
<% end -%>
|
131
142
|
}
|
132
143
|
if [ "${1}" -eq 1 ]
|
133
144
|
then
|
134
|
-
install
|
135
145
|
# "before install" goes here
|
146
|
+
install
|
136
147
|
elif [ "${1}" -gt 1 ]
|
137
148
|
then
|
149
|
+
# "before upgrade" goes here
|
138
150
|
upgrade
|
139
151
|
fi
|
140
152
|
<% end -%>
|
141
153
|
<% if script?(:after_upgrade) or script?(:after_install) -%>
|
142
|
-
%
|
154
|
+
%post
|
143
155
|
upgrade() {
|
156
|
+
<%# Making sure that at least one command is in the function -%>
|
157
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
158
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
159
|
+
:
|
144
160
|
<% if script?(:after_upgrade) -%>
|
145
161
|
<%= script(:after_upgrade) %>
|
146
162
|
<% end -%>
|
147
163
|
}
|
148
164
|
install() {
|
165
|
+
<%# Making sure that at least one command is in the function -%>
|
166
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
167
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
168
|
+
:
|
149
169
|
<% if script?(:after_install) -%>
|
150
170
|
<%= script(:after_install) %>
|
151
171
|
<% end -%>
|
152
172
|
}
|
153
173
|
if [ "${1}" -eq 1 ]
|
154
174
|
then
|
175
|
+
# "after install" goes here
|
155
176
|
install
|
156
|
-
# "before install" goes here
|
157
177
|
elif [ "${1}" -gt 1 ]
|
158
178
|
then
|
179
|
+
# "after upgrade" goes here
|
159
180
|
upgrade
|
160
181
|
fi
|
161
182
|
<% end -%>
|
@@ -163,6 +184,10 @@ fi
|
|
163
184
|
%preun
|
164
185
|
if [ "${1}" -eq 0 ]
|
165
186
|
then
|
187
|
+
<%# Making sure that at least one command is in the function -%>
|
188
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
189
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
190
|
+
:
|
166
191
|
<%= script(:before_remove) %>
|
167
192
|
fi
|
168
193
|
<% end -%>
|
@@ -170,6 +195,10 @@ fi
|
|
170
195
|
%postun
|
171
196
|
if [ "${1}" -eq 0 ]
|
172
197
|
then
|
198
|
+
<%# Making sure that at least one command is in the function -%>
|
199
|
+
<%# avoids a lot of potential errors, including the case that -%>
|
200
|
+
<%# the script is non-empty, but just whitespace and/or comments -%>
|
201
|
+
:
|
173
202
|
<%= script(:after_remove) %>
|
174
203
|
fi
|
175
204
|
<% end -%>
|
data/templates/sh.erb
CHANGED
@@ -27,6 +27,7 @@ function main() {
|
|
27
27
|
wait_for_others
|
28
28
|
kill_others
|
29
29
|
set_owner
|
30
|
+
pre_install
|
30
31
|
unpack_payload
|
31
32
|
|
32
33
|
if [ "$UNPACK_ONLY" == "1" ] ; then
|
@@ -173,6 +174,14 @@ function set_owner(){
|
|
173
174
|
log "Installing as user $OWNER"
|
174
175
|
}
|
175
176
|
|
177
|
+
function pre_install() {
|
178
|
+
# for rationale on the `:`, see #871
|
179
|
+
:
|
180
|
+
<% if script?(:before_install) -%>
|
181
|
+
<%= script(:before_install) %>
|
182
|
+
<% end %>
|
183
|
+
}
|
184
|
+
|
176
185
|
function unpack_payload(){
|
177
186
|
if [ "$FORCE" == "1" ] || [ ! "$(ls -A $INSTALL_DIR)" ] ; then
|
178
187
|
log "Unpacking payload . . ."
|
@@ -242,6 +251,12 @@ function clean_out_old_releases(){
|
|
242
251
|
fi
|
243
252
|
}
|
244
253
|
|
254
|
+
function print_package_metadata(){
|
255
|
+
local metadata_line=$(grep -a -n -m1 '__METADATA__$' $0 | sed 's/:.*//')
|
256
|
+
local archive_line=$(grep -a -n -m1 '__ARCHIVE__$' $0 | sed 's/:.*//')
|
257
|
+
sed -n "$((metadata_line + 1)),$((archive_line - 1)) p" $0
|
258
|
+
}
|
259
|
+
|
245
260
|
function print_usage(){
|
246
261
|
echo "Usage: `basename $0` [options]"
|
247
262
|
echo "Install this package"
|
@@ -275,7 +290,7 @@ function log(){
|
|
275
290
|
}
|
276
291
|
|
277
292
|
function parse_args() {
|
278
|
-
args=`getopt
|
293
|
+
args=`getopt mi:o:rfuyvh $*`
|
279
294
|
|
280
295
|
if [ $? != 0 ] ; then
|
281
296
|
print_usage
|
@@ -286,6 +301,10 @@ function parse_args() {
|
|
286
301
|
do
|
287
302
|
case "$i"
|
288
303
|
in
|
304
|
+
-m)
|
305
|
+
print_package_metadata
|
306
|
+
exit 0
|
307
|
+
shift;;
|
289
308
|
-r)
|
290
309
|
USE_FLAT_RELEASE_DIRECTORY=1
|
291
310
|
shift;;
|
@@ -331,4 +350,6 @@ main
|
|
331
350
|
save_environment $(fpm_metadata_file)
|
332
351
|
exit 0
|
333
352
|
|
353
|
+
__METADATA__
|
354
|
+
<%= package_metadata if respond_to?(:package_metadata) %>
|
334
355
|
__ARCHIVE__
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan Sissel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.0.
|
61
|
+
version: 0.0.10
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.0.
|
68
|
+
version: 0.0.10
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: clamp
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -189,18 +189,18 @@ files:
|
|
189
189
|
- lib/fpm/package/gem.rb
|
190
190
|
- lib/fpm/package/npm.rb
|
191
191
|
- lib/fpm/package/osxpkg.rb
|
192
|
+
- lib/fpm/package/p5p.rb
|
192
193
|
- lib/fpm/package/pear.rb
|
193
194
|
- lib/fpm/package/pkgin.rb
|
194
195
|
- lib/fpm/package/puppet.rb
|
195
196
|
- lib/fpm/package/pyfpm/__init__.py
|
196
|
-
- lib/fpm/package/pyfpm/__init__.pyc
|
197
197
|
- lib/fpm/package/pyfpm/get_metadata.py
|
198
|
-
- lib/fpm/package/pyfpm/get_metadata.pyc
|
199
198
|
- lib/fpm/package/python.rb
|
200
199
|
- lib/fpm/package/rpm.rb
|
201
200
|
- lib/fpm/package/sh.rb
|
202
201
|
- lib/fpm/package/solaris.rb
|
203
202
|
- lib/fpm/package/tar.rb
|
203
|
+
- lib/fpm/package/virtualenv.rb
|
204
204
|
- lib/fpm/package/zip.rb
|
205
205
|
- lib/fpm/util.rb
|
206
206
|
- lib/fpm/version.rb
|
@@ -212,6 +212,7 @@ files:
|
|
212
212
|
- templates/deb/preinst_upgrade.sh.erb
|
213
213
|
- templates/deb/prerm_upgrade.sh.erb
|
214
214
|
- templates/osxpkg.erb
|
215
|
+
- templates/p5p_metadata.erb
|
215
216
|
- templates/puppet/package.pp.erb
|
216
217
|
- templates/puppet/package/remove.pp.erb
|
217
218
|
- templates/rpm.erb
|
@@ -239,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
240
|
version: '0'
|
240
241
|
requirements: []
|
241
242
|
rubyforge_project:
|
242
|
-
rubygems_version: 2.
|
243
|
+
rubygems_version: 2.4.8
|
243
244
|
signing_key:
|
244
245
|
specification_version: 4
|
245
246
|
summary: fpm - package building and mangling
|
Binary file
|
Binary file
|