fpm 0.3.11 → 0.4.0pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELIST +15 -0
- data/bin/fpm +2 -15
- data/lib/fpm.rb +5 -12
- data/lib/fpm/command.rb +323 -0
- data/lib/fpm/errors.rb +1 -0
- data/lib/fpm/namespace.rb +2 -11
- data/lib/fpm/package.rb +255 -100
- data/lib/fpm/package/deb.rb +367 -0
- data/lib/fpm/package/dir.rb +86 -0
- data/lib/fpm/package/gem.rb +162 -0
- data/lib/fpm/{source → package}/npm.rb +3 -3
- data/lib/fpm/package/pear.rb +41 -0
- data/lib/fpm/{target → package}/puppet.rb +1 -3
- data/lib/fpm/{source → package}/pyfpm/__init__.py +0 -0
- data/lib/fpm/package/pyfpm/__init__.pyc +0 -0
- data/lib/fpm/{source → package}/pyfpm/get_metadata.py +15 -3
- data/lib/fpm/package/pyfpm/get_metadata.pyc +0 -0
- data/lib/fpm/package/python.rb +125 -0
- data/lib/fpm/package/rpm.rb +132 -0
- data/lib/fpm/{target → package}/solaris.rb +3 -2
- data/lib/fpm/package/tar.rb +62 -0
- data/lib/fpm/util.rb +56 -7
- data/templates/deb.erb +12 -12
- data/templates/rpm.erb +32 -38
- data/templates/solaris.erb +1 -1
- metadata +119 -78
- data/lib/fpm/builder.rb +0 -220
- data/lib/fpm/flags.rb +0 -20
- data/lib/fpm/program.rb +0 -273
- data/lib/fpm/rubyfixes.rb +0 -11
- data/lib/fpm/source.rb +0 -155
- data/lib/fpm/source/dir.rb +0 -59
- data/lib/fpm/source/gem.rb +0 -162
- data/lib/fpm/source/python.rb +0 -137
- data/lib/fpm/source/rpm.rb +0 -28
- data/lib/fpm/source/tar.rb +0 -50
- data/lib/fpm/target/deb.rb +0 -184
- data/lib/fpm/target/rpm.rb +0 -68
- data/lib/rpm/header.rb +0 -89
- data/lib/rpm/lead.rb +0 -48
- data/lib/rpm/namespace.rb +0 -1
- data/lib/rpm/rpmfile.rb +0 -81
- data/lib/rpm/tag.rb +0 -304
data/lib/rpm/namespace.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
class RPMFile; end
|
data/lib/rpm/rpmfile.rb
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
require "ap"
|
2
|
-
require File.join(File.dirname(__FILE__), "namespace")
|
3
|
-
require File.join(File.dirname(__FILE__), "header")
|
4
|
-
require File.join(File.dirname(__FILE__), "lead")
|
5
|
-
require File.join(File.dirname(__FILE__), "tag")
|
6
|
-
|
7
|
-
# Much of the code here is derived from knowledge gained by reading the rpm
|
8
|
-
# source code, but mostly it started making more sense after reading this site:
|
9
|
-
# http://www.rpm.org/max-rpm/s1-rpm-file-format-rpm-file-format.html
|
10
|
-
|
11
|
-
class RPMFile
|
12
|
-
attr_reader :file
|
13
|
-
|
14
|
-
def initialize(file)
|
15
|
-
if file.is_a?(String)
|
16
|
-
file = File.new(file, "r")
|
17
|
-
end
|
18
|
-
@file = file
|
19
|
-
|
20
|
-
# Make sure we're at the beginning of the file.
|
21
|
-
@file.seek(0, IO::SEEK_SET)
|
22
|
-
end # def initialize
|
23
|
-
|
24
|
-
public
|
25
|
-
def lead
|
26
|
-
if @lead.nil?
|
27
|
-
@lead = ::RPMFile::Lead.new(self)
|
28
|
-
@lead.read
|
29
|
-
end
|
30
|
-
return @lead
|
31
|
-
end # def lead
|
32
|
-
|
33
|
-
public
|
34
|
-
def signature
|
35
|
-
lead # Make sure we've parsed the lead...
|
36
|
-
|
37
|
-
# If signature_type is not 5 (HEADER_SIGNED_TYPE), no signature.
|
38
|
-
if @lead.signature_type != Header::HEADER_SIGNED_TYPE
|
39
|
-
@signature = false
|
40
|
-
return
|
41
|
-
end
|
42
|
-
|
43
|
-
if @signature.nil?
|
44
|
-
@signature = ::RPMFile::Header.new(self)
|
45
|
-
@signature.read
|
46
|
-
end
|
47
|
-
|
48
|
-
return @signature
|
49
|
-
end # def signature
|
50
|
-
|
51
|
-
public
|
52
|
-
def header
|
53
|
-
signature
|
54
|
-
|
55
|
-
# Skip 4 bytes of nulls
|
56
|
-
# Why? I have no idea yet.
|
57
|
-
if @file.read(4) != "\0\0\0\0"
|
58
|
-
raise "Expected 4 nulls."
|
59
|
-
end
|
60
|
-
|
61
|
-
if @header.nil?
|
62
|
-
@header = ::RPMFile::Header.new(self)
|
63
|
-
@header.read
|
64
|
-
end
|
65
|
-
return @header
|
66
|
-
end
|
67
|
-
|
68
|
-
# Returns a file descriptor. On first invocation, it seeks to the start of the payload
|
69
|
-
public
|
70
|
-
def payload
|
71
|
-
header
|
72
|
-
if @payload.nil?
|
73
|
-
@payload = @file.clone
|
74
|
-
# TODO(sissel): Why +20? I have no idea. Needs more digging. Clearly I'm missing a part
|
75
|
-
# of the file here.
|
76
|
-
@payload.seek(@lead.length + @signature.length + @header.length + 20, IO::SEEK_SET)
|
77
|
-
end
|
78
|
-
|
79
|
-
return @payload
|
80
|
-
end # def payload
|
81
|
-
end # class RPMFile
|
data/lib/rpm/tag.rb
DELETED
@@ -1,304 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "namespace")
|
2
|
-
|
3
|
-
class RPMFile::Tag
|
4
|
-
attr_accessor :tag
|
5
|
-
attr_accessor :type
|
6
|
-
attr_accessor :offset
|
7
|
-
attr_accessor :count
|
8
|
-
attr_accessor :value
|
9
|
-
|
10
|
-
# This data can be found mostly in rpmtag.h
|
11
|
-
TAG = {
|
12
|
-
61 => :headerimage,
|
13
|
-
62 => :headersignatures,
|
14
|
-
63 => :headerimmutable,
|
15
|
-
64 => :headerregions,
|
16
|
-
100 => :headeri18ntable,
|
17
|
-
256 => :sig_base,
|
18
|
-
|
19
|
-
257 => :sigsize,
|
20
|
-
258 => :siglemd5_1,
|
21
|
-
259 => :sigpgp,
|
22
|
-
260 => :siglemd5_2,
|
23
|
-
261 => :sigmd5,
|
24
|
-
262 => :siggpg,
|
25
|
-
263 => :sigpgp5,
|
26
|
-
264 => :badsha1_1,
|
27
|
-
265 => :badsha1_2,
|
28
|
-
266 => :pubkeys,
|
29
|
-
267 => :dsaheader,
|
30
|
-
268 => :rsaheader,
|
31
|
-
269 => :sha1header,
|
32
|
-
270 => :longsigsize,
|
33
|
-
271 => :longarchivesize,
|
34
|
-
|
35
|
-
1000 => :name,
|
36
|
-
1001 => :version,
|
37
|
-
1002 => :release,
|
38
|
-
1003 => :epoch,
|
39
|
-
1004 => :summary,
|
40
|
-
1005 => :description,
|
41
|
-
1006 => :buildtime,
|
42
|
-
1007 => :buildhost,
|
43
|
-
1008 => :installtime,
|
44
|
-
1009 => :size,
|
45
|
-
1010 => :distribution,
|
46
|
-
1011 => :vendor,
|
47
|
-
1012 => :gif,
|
48
|
-
1013 => :xpm,
|
49
|
-
1014 => :license,
|
50
|
-
1015 => :packager,
|
51
|
-
1016 => :group,
|
52
|
-
1017 => :changelog,
|
53
|
-
1018 => :source,
|
54
|
-
1019 => :patch,
|
55
|
-
1020 => :url,
|
56
|
-
1021 => :os,
|
57
|
-
1022 => :arch,
|
58
|
-
1023 => :prein,
|
59
|
-
1024 => :postin,
|
60
|
-
1025 => :preun,
|
61
|
-
1026 => :postun,
|
62
|
-
1027 => :oldfilenames,
|
63
|
-
1028 => :filesizes,
|
64
|
-
1029 => :filestates,
|
65
|
-
1030 => :filemodes,
|
66
|
-
1031 => :fileuids,
|
67
|
-
1032 => :filegids,
|
68
|
-
1033 => :filerdevs,
|
69
|
-
1034 => :filemtimes,
|
70
|
-
1035 => :filedigests,
|
71
|
-
1036 => :filelinktos,
|
72
|
-
1037 => :fileflags,
|
73
|
-
1038 => :root,
|
74
|
-
1039 => :fileusername,
|
75
|
-
1040 => :filegroupname,
|
76
|
-
1041 => :exclude,
|
77
|
-
1042 => :exclusive,
|
78
|
-
1043 => :icon,
|
79
|
-
1044 => :sourcerpm,
|
80
|
-
1045 => :fileverifyflags,
|
81
|
-
1046 => :archivesize,
|
82
|
-
1047 => :providename,
|
83
|
-
1048 => :requireflags,
|
84
|
-
1049 => :requirename,
|
85
|
-
1050 => :requireversion,
|
86
|
-
1051 => :nosource,
|
87
|
-
1052 => :nopatch,
|
88
|
-
1053 => :conflictflags,
|
89
|
-
1054 => :conflictname,
|
90
|
-
1055 => :conflictversion,
|
91
|
-
1056 => :defaultprefix,
|
92
|
-
1057 => :buildroot,
|
93
|
-
1058 => :installprefix,
|
94
|
-
1059 => :excludearch,
|
95
|
-
1060 => :excludeos,
|
96
|
-
1061 => :exclusivearch,
|
97
|
-
1062 => :exclusiveos,
|
98
|
-
1063 => :autoreqprov,
|
99
|
-
1064 => :rpmversion,
|
100
|
-
1065 => :triggerscripts,
|
101
|
-
1066 => :triggername,
|
102
|
-
1067 => :triggerversion,
|
103
|
-
1068 => :triggerflags,
|
104
|
-
1069 => :triggerindex,
|
105
|
-
1079 => :verifyscript,
|
106
|
-
1080 => :changelogtime,
|
107
|
-
1081 => :changelogname,
|
108
|
-
1082 => :changelogtext,
|
109
|
-
1083 => :brokenmd5,
|
110
|
-
1084 => :prereq,
|
111
|
-
1085 => :preinprog,
|
112
|
-
1086 => :postinprog,
|
113
|
-
1087 => :preunprog,
|
114
|
-
1088 => :postunprog,
|
115
|
-
1089 => :buildarchs,
|
116
|
-
1090 => :obsoletename,
|
117
|
-
1091 => :verifyscriptprog,
|
118
|
-
1092 => :triggerscriptprog,
|
119
|
-
1093 => :docdir,
|
120
|
-
1094 => :cookie,
|
121
|
-
1095 => :filedevices,
|
122
|
-
1096 => :fileinodes,
|
123
|
-
1097 => :filelangs,
|
124
|
-
1098 => :prefixes,
|
125
|
-
1099 => :instprefixes,
|
126
|
-
1100 => :triggerin,
|
127
|
-
1101 => :triggerun,
|
128
|
-
1102 => :triggerpostun,
|
129
|
-
1103 => :autoreq,
|
130
|
-
1104 => :autoprov,
|
131
|
-
1105 => :capability,
|
132
|
-
1106 => :sourcepackage,
|
133
|
-
1107 => :oldorigfilenames,
|
134
|
-
1108 => :buildprereq,
|
135
|
-
1109 => :buildrequires,
|
136
|
-
1110 => :buildconflicts,
|
137
|
-
1111 => :buildmacros,
|
138
|
-
1112 => :provideflags,
|
139
|
-
1113 => :provideversion,
|
140
|
-
1114 => :obsoleteflags,
|
141
|
-
1115 => :obsoleteversion,
|
142
|
-
1116 => :dirindexes,
|
143
|
-
1117 => :basenames,
|
144
|
-
1118 => :dirnames,
|
145
|
-
1119 => :origdirindexes,
|
146
|
-
1120 => :origbasenames,
|
147
|
-
1121 => :origdirnames,
|
148
|
-
1122 => :optflags,
|
149
|
-
1123 => :disturl,
|
150
|
-
1124 => :payloadformat,
|
151
|
-
1125 => :payloadcompressor,
|
152
|
-
1126 => :payloadflags,
|
153
|
-
1127 => :installcolor,
|
154
|
-
1128 => :installtid,
|
155
|
-
1129 => :removetid,
|
156
|
-
1130 => :sha1rhn,
|
157
|
-
1131 => :rhnplatform,
|
158
|
-
1132 => :platform,
|
159
|
-
1133 => :patchesname,
|
160
|
-
1134 => :patchesflags,
|
161
|
-
1135 => :patchesversion,
|
162
|
-
1136 => :cachectime,
|
163
|
-
1137 => :cachepkgpath,
|
164
|
-
1138 => :cachepkgsize,
|
165
|
-
1139 => :cachepkgmtime,
|
166
|
-
1140 => :filecolors,
|
167
|
-
1141 => :fileclass,
|
168
|
-
1142 => :classdict,
|
169
|
-
1143 => :filedependsx,
|
170
|
-
1144 => :filedependsn,
|
171
|
-
1145 => :dependsdict,
|
172
|
-
1146 => :sourcepkgid,
|
173
|
-
1147 => :filecontexts,
|
174
|
-
1148 => :fscontexts,
|
175
|
-
1149 => :recontexts,
|
176
|
-
1150 => :policies,
|
177
|
-
1151 => :pretrans,
|
178
|
-
1152 => :posttrans,
|
179
|
-
1153 => :pretransprog,
|
180
|
-
1154 => :posttransprog,
|
181
|
-
1155 => :disttag,
|
182
|
-
1156 => :suggestsname,
|
183
|
-
1157 => :suggestsversion,
|
184
|
-
1158 => :suggestsflags,
|
185
|
-
1159 => :enhancesname,
|
186
|
-
1160 => :enhancesversion,
|
187
|
-
1161 => :enhancesflags,
|
188
|
-
1162 => :priority,
|
189
|
-
1163 => :cvsid,
|
190
|
-
1164 => :blinkpkgid,
|
191
|
-
1165 => :blinkhdrid,
|
192
|
-
1166 => :blinknevra,
|
193
|
-
1167 => :flinkpkgid,
|
194
|
-
1168 => :flinkhdrid,
|
195
|
-
1169 => :flinknevra,
|
196
|
-
1170 => :packageorigin,
|
197
|
-
1171 => :triggerprein,
|
198
|
-
1172 => :buildsuggests,
|
199
|
-
1173 => :buildenhances,
|
200
|
-
1174 => :scriptstates,
|
201
|
-
1175 => :scriptmetrics,
|
202
|
-
1176 => :buildcpuclock,
|
203
|
-
1177 => :filedigestalgos,
|
204
|
-
1178 => :variants,
|
205
|
-
1179 => :xmajor,
|
206
|
-
1180 => :xminor,
|
207
|
-
1181 => :repotag,
|
208
|
-
1182 => :keywords,
|
209
|
-
1183 => :buildplatforms,
|
210
|
-
1184 => :packagecolor,
|
211
|
-
1185 => :packageprefcolor,
|
212
|
-
1186 => :xattrsdict,
|
213
|
-
1187 => :filexattrsx,
|
214
|
-
1188 => :depattrsdict,
|
215
|
-
1189 => :conflictattrsx,
|
216
|
-
1190 => :obsoleteattrsx,
|
217
|
-
1191 => :provideattrsx,
|
218
|
-
1192 => :requireattrsx,
|
219
|
-
1193 => :buildprovides,
|
220
|
-
1194 => :buildobsoletes,
|
221
|
-
1195 => :dbinstance,
|
222
|
-
1196 => :nvra,
|
223
|
-
5000 => :filenames,
|
224
|
-
5001 => :fileprovide,
|
225
|
-
5002 => :filerequire,
|
226
|
-
5003 => :fsnames,
|
227
|
-
5004 => :fssizes,
|
228
|
-
5005 => :triggerconds,
|
229
|
-
5006 => :triggertype,
|
230
|
-
5007 => :origfilenames,
|
231
|
-
5008 => :longfilesizes,
|
232
|
-
5009 => :longsize,
|
233
|
-
5010 => :filecaps,
|
234
|
-
5011 => :filedigestalgo,
|
235
|
-
5012 => :bugurl,
|
236
|
-
5013 => :evr,
|
237
|
-
5014 => :nvr,
|
238
|
-
5015 => :nevr,
|
239
|
-
5016 => :nevra,
|
240
|
-
5017 => :headercolor,
|
241
|
-
5018 => :verbose,
|
242
|
-
5019 => :epochnum,
|
243
|
-
}
|
244
|
-
|
245
|
-
# See 'rpmTagType' enum in rpmtag.h
|
246
|
-
TYPE = {
|
247
|
-
0 => :null,
|
248
|
-
1 => :char,
|
249
|
-
2 => :int8,
|
250
|
-
3 => :int16,
|
251
|
-
4 => :int32,
|
252
|
-
5 => :int64,
|
253
|
-
6 => :string,
|
254
|
-
7 => :binary,
|
255
|
-
8 => :string_array,
|
256
|
-
9 => :i18nstring,
|
257
|
-
}
|
258
|
-
|
259
|
-
def initialize(tag_id, type, offset, count, data)
|
260
|
-
@tag = tag_id
|
261
|
-
@type = type
|
262
|
-
@offset = offset
|
263
|
-
@count = count
|
264
|
-
|
265
|
-
@data = data
|
266
|
-
end # def initialize
|
267
|
-
|
268
|
-
def tag
|
269
|
-
TAG[@tag] or @tag
|
270
|
-
end # def tag
|
271
|
-
|
272
|
-
def tag_as_int
|
273
|
-
@tag
|
274
|
-
end
|
275
|
-
|
276
|
-
def type
|
277
|
-
TYPE[@type] or @type
|
278
|
-
end # def type
|
279
|
-
|
280
|
-
def value
|
281
|
-
if !@value
|
282
|
-
# TODO(sissel): Handle @count of string_array, int32, etc?
|
283
|
-
case type
|
284
|
-
when :string
|
285
|
-
# string at offset up to first null
|
286
|
-
@value = @data[@offset .. -1][/^[^\0]+/]
|
287
|
-
when :i18nstring
|
288
|
-
# string at offset up to first null
|
289
|
-
@value = @data[@offset .. -1][/^[^\0]+/]
|
290
|
-
when :string_array
|
291
|
-
@value = @data[@offset .. -1].split("\0")[0 ... @count]
|
292
|
-
when :binary
|
293
|
-
@value = @data[@offset, @count]
|
294
|
-
when :int32
|
295
|
-
@value = @data[@offset, 4 * count].unpack("N" * count)
|
296
|
-
when :int16
|
297
|
-
@value = @data[@offset, 2 * count].unpack("n" * count)
|
298
|
-
end # case type
|
299
|
-
end # if !@value
|
300
|
-
|
301
|
-
return @value
|
302
|
-
end # def value
|
303
|
-
end # class RPMFile::Tag
|
304
|
-
|