ruby-rpm 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +14 -0
- data/ext/rpm/db.c +119 -9
- data/ext/rpm/dependency.c +35 -0
- data/ext/rpm/extconf.rb +3 -3
- data/ext/rpm/file.c +86 -0
- data/ext/rpm/package.c +104 -10
- data/ext/rpm/private.h +30 -3
- data/ext/rpm/rpm.c +37 -3
- data/ext/rpm/source.c +34 -0
- data/ext/rpm/spec.c +80 -8
- data/ext/rpm/version.c +71 -0
- data/lib/rpm.rb +23 -1
- data/lib/rpm/version.rb +1 -1
- metadata +39 -19
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
2011-08-20 Duncan Mac-Vicar P. <dmacvicar@suse.de>
|
2
|
+
|
3
|
+
* Release 1.3.1
|
4
|
+
* Move the japanese guide to in-source documentation that can
|
5
|
+
be generated
|
6
|
+
* Use bundler tasks
|
7
|
+
* Specify version for gem dependencies
|
8
|
+
* patches from Anders F Bjorklund (2):
|
9
|
+
- stpcpy declaration clashing with darwin's <string.h>
|
10
|
+
- use rbconfig to get DLEXT instead of hardcoding .so
|
11
|
+
- patches for rpm 4.4.6, 4.4.8 and 5
|
12
|
+
* patches from Lubomir Rintel (1):
|
13
|
+
- Add a missing header that caused compile to fail
|
14
|
+
|
1
15
|
2010-08-19 Duncan Mac-Vicar P. <dmacvicar@suse.de>
|
2
16
|
|
3
17
|
* build system cleanup
|
data/ext/rpm/db.c
CHANGED
@@ -50,6 +50,20 @@ db_free(rpm_db_t* db)
|
|
50
50
|
db_unref(db);
|
51
51
|
}
|
52
52
|
|
53
|
+
/*
|
54
|
+
* The package database is opened, but transactional processing
|
55
|
+
* (@see RPM::DB#transaction) cannot be done for when +writable+ is false.
|
56
|
+
* When +writable+ is +false+ then the generated object gets freezed.
|
57
|
+
* @param [Boolean] writable Whether the database is writable. Default is +false+.
|
58
|
+
* @param [String] root Root path for the database, default is empty.
|
59
|
+
* @return [RPM::DB]
|
60
|
+
*
|
61
|
+
* @example
|
62
|
+
* db = RPM::DB.open
|
63
|
+
* db.each do |pkg|
|
64
|
+
* puts pkg.name
|
65
|
+
* end
|
66
|
+
*/
|
53
67
|
static VALUE
|
54
68
|
db_s_open(int argc, VALUE* argv, VALUE obj)
|
55
69
|
{
|
@@ -107,6 +121,13 @@ rpm_db_open(int writable, const char* root)
|
|
107
121
|
return db_s_open(2, argv, rpm_cDB);
|
108
122
|
}
|
109
123
|
|
124
|
+
/*
|
125
|
+
* Initialize the package database
|
126
|
+
* The database {RPM::DB#root} / var / lib /rpm is created.
|
127
|
+
*
|
128
|
+
* @param [String] root Root of the database
|
129
|
+
* @param [Boolean] writable Whether the database is writable. Default +false+.
|
130
|
+
*/
|
110
131
|
static VALUE
|
111
132
|
db_s_init(int argc, VALUE* argv, VALUE obj)
|
112
133
|
{
|
@@ -140,6 +161,9 @@ db_s_init(int argc, VALUE* argv, VALUE obj)
|
|
140
161
|
return Qnil;
|
141
162
|
}
|
142
163
|
|
164
|
+
/*
|
165
|
+
* See RPM::DB#init
|
166
|
+
*/
|
143
167
|
void
|
144
168
|
rpm_db_init(const char* root, int writable)
|
145
169
|
{
|
@@ -149,6 +173,11 @@ rpm_db_init(const char* root, int writable)
|
|
149
173
|
db_s_init(2, argv, rpm_cDB);
|
150
174
|
}
|
151
175
|
|
176
|
+
/*
|
177
|
+
* Rebuild the package database
|
178
|
+
* It should reside in +root+ / var / lib /rpm
|
179
|
+
* @param [String] root Root path of the database
|
180
|
+
*/
|
152
181
|
static VALUE
|
153
182
|
db_s_rebuild(int argc, VALUE* argv, VALUE obj)
|
154
183
|
{
|
@@ -175,8 +204,10 @@ db_s_rebuild(int argc, VALUE* argv, VALUE obj)
|
|
175
204
|
|
176
205
|
#if RPM_VERSION_CODE < RPM_VERSION(4,1,0)
|
177
206
|
ret = rpmdbRebuild(root);
|
178
|
-
#
|
207
|
+
#elif RPM_VERSION_CODE < RPM_VERSION(5,0,0)
|
179
208
|
ret = rpmdbRebuild(root, NULL, NULL);
|
209
|
+
#else
|
210
|
+
ret = rpmdbRebuild(root, NULL);
|
180
211
|
#endif
|
181
212
|
if (ret) {
|
182
213
|
rb_raise(rb_eRuntimeError, "can not rebuild database in %s",
|
@@ -195,6 +226,9 @@ rpm_db_rebuild(const char* root)
|
|
195
226
|
db_s_rebuild(1, argv, rpm_cDB);
|
196
227
|
}
|
197
228
|
|
229
|
+
/*
|
230
|
+
* Closes the database
|
231
|
+
*/
|
198
232
|
VALUE
|
199
233
|
rpm_db_close(VALUE db)
|
200
234
|
{
|
@@ -204,6 +238,9 @@ rpm_db_close(VALUE db)
|
|
204
238
|
return Qnil;
|
205
239
|
}
|
206
240
|
|
241
|
+
/*
|
242
|
+
* @return [Boolean] +true+ if the database is closed
|
243
|
+
*/
|
207
244
|
VALUE
|
208
245
|
rpm_db_is_closed(VALUE vdb)
|
209
246
|
{
|
@@ -219,6 +256,9 @@ check_closed(VALUE db)
|
|
219
256
|
}
|
220
257
|
|
221
258
|
#ifndef RPMDB_OPAQUE
|
259
|
+
/*
|
260
|
+
* @return [String] The root path of the database
|
261
|
+
*/
|
222
262
|
VALUE
|
223
263
|
rpm_db_get_root(VALUE db)
|
224
264
|
{
|
@@ -226,6 +266,9 @@ rpm_db_get_root(VALUE db)
|
|
226
266
|
return rb_str_new2(RPM_DB(db)->db_root);
|
227
267
|
}
|
228
268
|
|
269
|
+
/*
|
270
|
+
* @return [String] The home path of the database
|
271
|
+
*/
|
229
272
|
VALUE
|
230
273
|
rpm_db_get_home(VALUE db)
|
231
274
|
{
|
@@ -234,6 +277,9 @@ rpm_db_get_home(VALUE db)
|
|
234
277
|
}
|
235
278
|
#endif
|
236
279
|
|
280
|
+
/*
|
281
|
+
* @return [Boolean] +true+ if the database is writable
|
282
|
+
*/
|
237
283
|
VALUE
|
238
284
|
rpm_db_is_writable(VALUE db)
|
239
285
|
{
|
@@ -241,6 +287,15 @@ rpm_db_is_writable(VALUE db)
|
|
241
287
|
return OBJ_FROZEN(db) ? Qfalse : Qtrue;
|
242
288
|
}
|
243
289
|
|
290
|
+
/*
|
291
|
+
* @yield [Package] Called for each match
|
292
|
+
* @param [Number] key RPM tag key
|
293
|
+
* @param [String] val Value to match
|
294
|
+
* @example
|
295
|
+
* db.each_match(RPM::TAG_ARCH, "x86_64") do |pkg|
|
296
|
+
* puts pkg.name
|
297
|
+
* end
|
298
|
+
*/
|
244
299
|
VALUE
|
245
300
|
rpm_db_each_match(VALUE db, VALUE key, VALUE val)
|
246
301
|
{
|
@@ -255,6 +310,13 @@ rpm_db_each_match(VALUE db, VALUE key, VALUE val)
|
|
255
310
|
return Qnil;
|
256
311
|
}
|
257
312
|
|
313
|
+
/*
|
314
|
+
* @yield [Package] Called for each package in the database
|
315
|
+
* @example
|
316
|
+
* db.each do |pkg|
|
317
|
+
* puts pkg.name
|
318
|
+
* end
|
319
|
+
*/
|
258
320
|
VALUE
|
259
321
|
rpm_db_each(VALUE db)
|
260
322
|
{
|
@@ -342,18 +404,30 @@ rpm_db_transaction(int argc, VALUE* argv, VALUE db)
|
|
342
404
|
return rb_ivar_get(trans, id_pl);
|
343
405
|
}
|
344
406
|
|
407
|
+
/*
|
408
|
+
* @return [RPM::DB] The database associated with this transaction
|
409
|
+
*/
|
345
410
|
VALUE
|
346
411
|
rpm_transaction_get_db(VALUE trans)
|
347
412
|
{
|
348
413
|
return rb_ivar_get(trans, id_db);
|
349
414
|
}
|
350
415
|
|
416
|
+
/*
|
417
|
+
* @return [File] Get transaction script file handle
|
418
|
+
* i.e stdout/stderr on scriptlet execution
|
419
|
+
*/
|
351
420
|
VALUE
|
352
421
|
rpm_transaction_get_script_file(VALUE trans)
|
353
422
|
{
|
354
423
|
return rb_ivar_get(trans, id_sf);
|
355
424
|
}
|
356
425
|
|
426
|
+
/*
|
427
|
+
* Set the transaction script file handle
|
428
|
+
* i.e stdout/stderr on scriptlet execution
|
429
|
+
* @param [File] file File handle
|
430
|
+
*/
|
357
431
|
VALUE
|
358
432
|
rpm_transaction_set_script_file(VALUE trans, VALUE file)
|
359
433
|
{
|
@@ -370,6 +444,10 @@ rpm_transaction_set_script_file(VALUE trans, VALUE file)
|
|
370
444
|
return Qnil;
|
371
445
|
}
|
372
446
|
|
447
|
+
/*
|
448
|
+
* Add a install operation to the transaction
|
449
|
+
* @param [Package] pkg Package to install
|
450
|
+
*/
|
373
451
|
VALUE
|
374
452
|
rpm_transaction_install(VALUE trans, VALUE pkg, VALUE key)
|
375
453
|
{
|
@@ -402,6 +480,10 @@ rpm_transaction_install(VALUE trans, VALUE pkg, VALUE key)
|
|
402
480
|
return Qnil;
|
403
481
|
}
|
404
482
|
|
483
|
+
/*
|
484
|
+
* Add a upgrade operation to the transaction
|
485
|
+
* @param [Package] pkg Package to upgrade
|
486
|
+
*/
|
405
487
|
VALUE
|
406
488
|
rpm_transaction_upgrade(VALUE trans, VALUE pkg, VALUE key)
|
407
489
|
{
|
@@ -468,6 +550,10 @@ rpm_transaction_available(VALUE trans, VALUE pkg, VALUE key)
|
|
468
550
|
}
|
469
551
|
#endif /* RPMTS_AVAILABLE */
|
470
552
|
|
553
|
+
/*
|
554
|
+
* Add a delete operation to the transaction
|
555
|
+
* @param [String, Package, Dependency] pkg Package to delete
|
556
|
+
*/
|
471
557
|
VALUE
|
472
558
|
rpm_transaction_delete(VALUE trans, VALUE pkg)
|
473
559
|
{
|
@@ -601,7 +687,11 @@ package_new_from_NEVR(const char* nevr)
|
|
601
687
|
}
|
602
688
|
#endif
|
603
689
|
|
604
|
-
|
690
|
+
/*
|
691
|
+
* Check the dependencies.
|
692
|
+
* @return [Array<Dependency>, +nil+] If dependencies are not met returns an
|
693
|
+
* array with dependencies. Otherwise +nil+.
|
694
|
+
*/
|
605
695
|
VALUE
|
606
696
|
rpm_transaction_check(VALUE trans)
|
607
697
|
{
|
@@ -797,6 +887,9 @@ rpm_transaction_check(VALUE trans)
|
|
797
887
|
#endif
|
798
888
|
}
|
799
889
|
|
890
|
+
/*
|
891
|
+
* To determine the processing order.
|
892
|
+
*/
|
800
893
|
VALUE
|
801
894
|
rpm_transaction_order(VALUE trans)
|
802
895
|
{
|
@@ -808,6 +901,10 @@ rpm_transaction_order(VALUE trans)
|
|
808
901
|
return Qnil;
|
809
902
|
}
|
810
903
|
|
904
|
+
/*
|
905
|
+
* @return [Array<String>] an array of keys corresponding to all transactions
|
906
|
+
* that have been added.
|
907
|
+
*/
|
811
908
|
VALUE
|
812
909
|
rpm_transaction_keys(VALUE trans)
|
813
910
|
{
|
@@ -815,16 +912,16 @@ rpm_transaction_keys(VALUE trans)
|
|
815
912
|
}
|
816
913
|
|
817
914
|
#if RPM_VERSION_CODE < RPM_VERSION(4,4,5)
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
fnpyKey key, rpmCallbackData data)
|
915
|
+
typedef unsigned long rpmCallbackSize_t;
|
916
|
+
#elif RPM_VERSION(5,0,0) <= RPM_VERSION_CODE
|
917
|
+
typedef uint64_t rpmCallbackSize_t;
|
822
918
|
#else
|
919
|
+
typedef unsigned long long rpmCallbackSize_t;
|
920
|
+
#endif
|
823
921
|
static void*
|
824
922
|
transaction_callback(const void* hd, const rpmCallbackType type,
|
825
|
-
const
|
923
|
+
const rpmCallbackSize_t amount, const rpmCallbackSize_t total,
|
826
924
|
fnpyKey key, rpmCallbackData data)
|
827
|
-
#endif
|
828
925
|
{
|
829
926
|
VALUE trans = (VALUE)data;
|
830
927
|
FD_t fdt;
|
@@ -859,6 +956,15 @@ transaction_callback(const void* hd, const rpmCallbackType type,
|
|
859
956
|
return NULL;
|
860
957
|
}
|
861
958
|
|
959
|
+
/*
|
960
|
+
* Performs the transaction.
|
961
|
+
* @param [Number] flag Transaction flags, default +RPM::TRANS_FLAG_NONE+
|
962
|
+
* @param [Number] filter Transaction filter, default +RPM::PROB_FILTER_NONE+
|
963
|
+
* @example
|
964
|
+
* transaction.commit do |sig|
|
965
|
+
* end
|
966
|
+
* @yield [CallbackData] sig Transaction progress
|
967
|
+
*/
|
862
968
|
VALUE
|
863
969
|
rpm_transaction_commit(int argc, VALUE* argv, VALUE trans)
|
864
970
|
{
|
@@ -1020,6 +1126,9 @@ rpm_transaction_commit(int argc, VALUE* argv, VALUE trans)
|
|
1020
1126
|
return Qnil; /* NOT REACHED */
|
1021
1127
|
}
|
1022
1128
|
|
1129
|
+
/*
|
1130
|
+
* To abort the transaction. Database is not changed.
|
1131
|
+
*/
|
1023
1132
|
VALUE
|
1024
1133
|
rpm_transaction_abort(VALUE trans)
|
1025
1134
|
{
|
@@ -1190,8 +1299,9 @@ Init_rpm_transaction(void)
|
|
1190
1299
|
rb_undef_method(rpm_cTransaction, "dup");
|
1191
1300
|
rb_undef_method(rpm_cTransaction, "clone");
|
1192
1301
|
|
1193
|
-
|
1302
|
+
rpm_sCallbackData = rb_struct_define(NULL, "type", "key", "package",
|
1194
1303
|
"amount", "total", NULL);
|
1304
|
+
|
1195
1305
|
rb_define_const(rpm_mRPM, "CallbackData", rpm_sCallbackData);
|
1196
1306
|
|
1197
1307
|
rpm_sProblem = rb_struct_define(NULL, "type", "key", "package",
|
data/ext/rpm/dependency.c
CHANGED
@@ -159,6 +159,10 @@ rpm_obsolete_new(const char* name, VALUE version, int flags, VALUE target)
|
|
159
159
|
return obso;
|
160
160
|
}
|
161
161
|
|
162
|
+
/*
|
163
|
+
* @param [Package, Dependency, Version] other
|
164
|
+
* @return [Boolean] true if +other+ satisfies this dependency
|
165
|
+
*/
|
162
166
|
VALUE
|
163
167
|
rpm_dependency_is_satisfy(VALUE dep,VALUE other)
|
164
168
|
{
|
@@ -209,30 +213,43 @@ rpm_dependency_is_satisfy(VALUE dep,VALUE other)
|
|
209
213
|
return Qfalse;
|
210
214
|
}
|
211
215
|
|
216
|
+
/*
|
217
|
+
* @return [String] dependency name
|
218
|
+
*/
|
212
219
|
VALUE
|
213
220
|
rpm_dependency_get_name(VALUE dep)
|
214
221
|
{
|
215
222
|
return rb_ivar_get(dep, id_name);
|
216
223
|
}
|
217
224
|
|
225
|
+
/*
|
226
|
+
* @return [String] dependency version
|
227
|
+
*/
|
218
228
|
VALUE
|
219
229
|
rpm_dependency_get_version(VALUE dep)
|
220
230
|
{
|
221
231
|
return rb_ivar_get(dep, id_ver);
|
222
232
|
}
|
223
233
|
|
234
|
+
/*
|
235
|
+
* @return [Number] dependency flags
|
236
|
+
*/
|
224
237
|
VALUE
|
225
238
|
rpm_dependency_get_flags(VALUE dep)
|
226
239
|
{
|
227
240
|
return rb_ivar_get(dep, id_flags);
|
228
241
|
}
|
229
242
|
|
243
|
+
/*
|
244
|
+
* @return [Package] package this dependency belongs to
|
245
|
+
*/
|
230
246
|
VALUE
|
231
247
|
rpm_dependency_get_owner(VALUE dep)
|
232
248
|
{
|
233
249
|
return rb_ivar_get(dep, id_owner);
|
234
250
|
}
|
235
251
|
|
252
|
+
|
236
253
|
VALUE
|
237
254
|
rpm_dependency_get_nametag(VALUE dep)
|
238
255
|
{
|
@@ -251,24 +268,36 @@ rpm_dependency_get_flagstag(VALUE dep)
|
|
251
268
|
return rb_ivar_get(dep, id_flagstag);
|
252
269
|
}
|
253
270
|
|
271
|
+
/*
|
272
|
+
* @return [Boolean] true if '<' or '=<' are used to compare the version
|
273
|
+
*/
|
254
274
|
VALUE
|
255
275
|
rpm_dependency_is_lt(VALUE dep)
|
256
276
|
{
|
257
277
|
return (NUM2INT(rb_ivar_get(dep, id_flags)) & RPMSENSE_LESS) ? Qtrue : Qfalse;
|
258
278
|
}
|
259
279
|
|
280
|
+
/*
|
281
|
+
* @return [Boolean] true if '>' or '>=' are used to compare the version
|
282
|
+
*/
|
260
283
|
VALUE
|
261
284
|
rpm_dependency_is_gt(VALUE dep)
|
262
285
|
{
|
263
286
|
return (NUM2INT(rb_ivar_get(dep, id_flags)) & RPMSENSE_GREATER) ? Qtrue : Qfalse;
|
264
287
|
}
|
265
288
|
|
289
|
+
/*
|
290
|
+
* @return [Boolean] true if '=', '=<' or '>=' are used to compare the version
|
291
|
+
*/
|
266
292
|
VALUE
|
267
293
|
rpm_dependency_is_eq(VALUE dep)
|
268
294
|
{
|
269
295
|
return (NUM2INT(rb_ivar_get(dep, id_flags)) & RPMSENSE_EQUAL) ? Qtrue : Qfalse;
|
270
296
|
}
|
271
297
|
|
298
|
+
/*
|
299
|
+
* @return [Boolean] true if '=<' is used to compare the version
|
300
|
+
*/
|
272
301
|
VALUE
|
273
302
|
rpm_dependency_is_le(VALUE dep)
|
274
303
|
{
|
@@ -276,6 +305,9 @@ rpm_dependency_is_le(VALUE dep)
|
|
276
305
|
return ((flags & RPMSENSE_LESS) && (flags & RPMSENSE_EQUAL)) ? Qtrue : Qfalse;
|
277
306
|
}
|
278
307
|
|
308
|
+
/*
|
309
|
+
* @return [Boolean] true if '>=' is used to compare the version
|
310
|
+
*/
|
279
311
|
VALUE
|
280
312
|
rpm_dependency_is_ge(VALUE dep)
|
281
313
|
{
|
@@ -283,6 +315,9 @@ rpm_dependency_is_ge(VALUE dep)
|
|
283
315
|
return ((flags & RPMSENSE_GREATER) && (flags & RPMSENSE_EQUAL)) ? Qtrue : Qfalse;
|
284
316
|
}
|
285
317
|
|
318
|
+
/*
|
319
|
+
* @return [Boolean] true if this is a pre-requires
|
320
|
+
*/
|
286
321
|
VALUE
|
287
322
|
rpm_require_is_pre(VALUE req)
|
288
323
|
{
|
data/ext/rpm/extconf.rb
CHANGED
@@ -43,18 +43,18 @@ def check_db
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def check_rpm
|
46
|
-
return false unless check_db
|
47
46
|
# Set things up manually
|
48
47
|
dir_config("rpm")
|
49
48
|
$libs = append_library($libs, 'rpmdb') if rpm_version < rpm_version([4,6,0])
|
50
49
|
$libs = append_library($libs, 'rpm')
|
50
|
+
have_library('rpmbuild', 'getBuildTime')
|
51
51
|
if rpm_version >= rpm_version([4,6,0])
|
52
52
|
$defs << "-D_RPM_4_4_COMPAT"
|
53
53
|
return true
|
54
54
|
end
|
55
55
|
if have_header('rpm/rpmlib.h') and
|
56
|
-
|
57
|
-
have_library('
|
56
|
+
check_db and
|
57
|
+
have_library('rpmio') then
|
58
58
|
true
|
59
59
|
else
|
60
60
|
STDERR.puts "rpm library not found"
|
data/ext/rpm/file.c
CHANGED
@@ -78,54 +78,84 @@ rpm_file_new(const char* path, const char* md5sum, const char* link_to,
|
|
78
78
|
return file;
|
79
79
|
}
|
80
80
|
|
81
|
+
/*
|
82
|
+
* @return [String] file path
|
83
|
+
*/
|
81
84
|
VALUE
|
82
85
|
rpm_file_get_path(VALUE file)
|
83
86
|
{
|
84
87
|
return rb_ivar_get(file, id_path);
|
85
88
|
}
|
86
89
|
|
90
|
+
/*
|
91
|
+
* @return [String] md5sum as string
|
92
|
+
*/
|
87
93
|
VALUE
|
88
94
|
rpm_file_get_md5sum(VALUE file)
|
89
95
|
{
|
90
96
|
return rb_ivar_get(file, id_md5sum);
|
91
97
|
}
|
92
98
|
|
99
|
+
/*
|
100
|
+
* @return [String] Path to the destination if the file is a symbolic link
|
101
|
+
* @note
|
102
|
+
* This path is sometimes relative. To convert an absolute path from relative path:
|
103
|
+
* File.expand_path (file.link_to, File.dirname (file.path))
|
104
|
+
*/
|
93
105
|
VALUE
|
94
106
|
rpm_file_get_link_to(VALUE file)
|
95
107
|
{
|
96
108
|
return rb_ivar_get(file, id_link_to);
|
97
109
|
}
|
98
110
|
|
111
|
+
/*
|
112
|
+
* @return [Number] File size
|
113
|
+
*/
|
99
114
|
VALUE
|
100
115
|
rpm_file_get_size(VALUE file)
|
101
116
|
{
|
102
117
|
return rb_ivar_get(file, id_size);
|
103
118
|
}
|
104
119
|
|
120
|
+
/*
|
121
|
+
* @return [Time] File modification time.
|
122
|
+
*/
|
105
123
|
VALUE
|
106
124
|
rpm_file_get_mtime(VALUE file)
|
107
125
|
{
|
108
126
|
return rb_ivar_get(file, id_mtime);
|
109
127
|
}
|
110
128
|
|
129
|
+
/*
|
130
|
+
* @return [String] File owner. Nil may be returned.
|
131
|
+
*/
|
111
132
|
VALUE
|
112
133
|
rpm_file_get_owner(VALUE file)
|
113
134
|
{
|
114
135
|
return rb_ivar_get(file, id_owner);
|
115
136
|
}
|
116
137
|
|
138
|
+
/*
|
139
|
+
* @return [String] Group that owns the file. Nil may be returned.
|
140
|
+
*/
|
117
141
|
VALUE
|
118
142
|
rpm_file_get_group(VALUE file)
|
119
143
|
{
|
120
144
|
return rb_ivar_get(file, id_group);
|
121
145
|
}
|
122
146
|
|
147
|
+
/*
|
148
|
+
* @return [Number] Device type of the file
|
149
|
+
*/
|
123
150
|
VALUE
|
124
151
|
rpm_file_get_rdev(VALUE file)
|
125
152
|
{
|
126
153
|
return rb_ivar_get(file, id_rdev);
|
127
154
|
}
|
128
155
|
|
156
|
+
/*
|
157
|
+
* @return [Number] File permissions
|
158
|
+
*/
|
129
159
|
VALUE
|
130
160
|
rpm_file_get_mode(VALUE file)
|
131
161
|
{
|
@@ -144,24 +174,36 @@ rpm_file_get_state(VALUE file)
|
|
144
174
|
return rb_ivar_get(file, id_state);
|
145
175
|
}
|
146
176
|
|
177
|
+
/*
|
178
|
+
* @return [Boolean] True if the file is a symbolic link
|
179
|
+
*/
|
147
180
|
VALUE
|
148
181
|
rpm_file_is_symlink(VALUE file)
|
149
182
|
{
|
150
183
|
return NIL_P(rb_ivar_get(file, id_link_to)) ? Qfalse : Qtrue;
|
151
184
|
}
|
152
185
|
|
186
|
+
/*
|
187
|
+
* @return [Boolean] True if the file is marked as a configuration file
|
188
|
+
*/
|
153
189
|
VALUE
|
154
190
|
rpm_file_is_config(VALUE file)
|
155
191
|
{
|
156
192
|
return (NUM2INT(rb_ivar_get(file, id_attr)) & RPMFILE_CONFIG) ? Qtrue : Qfalse;
|
157
193
|
}
|
158
194
|
|
195
|
+
/*
|
196
|
+
* @return [Boolean] True if the file is marked as documentation
|
197
|
+
*/
|
159
198
|
VALUE
|
160
199
|
rpm_file_is_doc(VALUE file)
|
161
200
|
{
|
162
201
|
return (NUM2INT(rb_ivar_get(file, id_attr)) & RPMFILE_DOC) ? Qtrue : Qfalse;
|
163
202
|
}
|
164
203
|
|
204
|
+
/*
|
205
|
+
* @return [Boolean] True if the file is marked as do not use
|
206
|
+
*/
|
165
207
|
VALUE
|
166
208
|
rpm_file_is_donotuse(VALUE file)
|
167
209
|
{
|
@@ -172,48 +214,86 @@ rpm_file_is_donotuse(VALUE file)
|
|
172
214
|
#endif
|
173
215
|
}
|
174
216
|
|
217
|
+
/*
|
218
|
+
* @return [Boolean] True if the file is marked that can be missing on disk
|
219
|
+
*
|
220
|
+
* This modifier is used for files or links that are created during the %post scripts
|
221
|
+
* but will need to be removed if the package is removed
|
222
|
+
*/
|
175
223
|
VALUE
|
176
224
|
rpm_file_is_missingok(VALUE file)
|
177
225
|
{
|
178
226
|
return (NUM2INT(rb_ivar_get(file, id_attr)) & RPMFILE_MISSINGOK) ? Qtrue : Qfalse;
|
179
227
|
}
|
180
228
|
|
229
|
+
/*
|
230
|
+
* @return [Boolean] True if the file is marked as configuration not to be replaced
|
231
|
+
*
|
232
|
+
* This flag is used to protect local modifications.
|
233
|
+
* If used, the file will not overwrite an existing file that has been modified.
|
234
|
+
* If the file has not been modified on disk, the rpm command will overwrite the file. But,
|
235
|
+
* if the file has been modified on disk, the rpm command will copy the new file with an extra
|
236
|
+
* file-name extension of .rpmnew.
|
237
|
+
*/
|
181
238
|
VALUE
|
182
239
|
rpm_file_is_noreplace(VALUE file)
|
183
240
|
{
|
184
241
|
return (NUM2INT(rb_ivar_get(file, id_attr)) & RPMFILE_NOREPLACE) ? Qtrue : Qfalse;
|
185
242
|
}
|
186
243
|
|
244
|
+
/*
|
245
|
+
* @return [Boolean] True if the file is marked as a spec file
|
246
|
+
*/
|
187
247
|
VALUE
|
188
248
|
rpm_file_is_specfile(VALUE file)
|
189
249
|
{
|
190
250
|
return (NUM2INT(rb_ivar_get(file, id_attr)) & RPMFILE_SPECFILE) ? Qtrue : Qfalse;
|
191
251
|
}
|
192
252
|
|
253
|
+
/*
|
254
|
+
* @return [Boolean] True if the file is marked as ghost
|
255
|
+
*
|
256
|
+
* This flag indicates the file should not be included in the package.
|
257
|
+
* It can be used to name the needed attributes for a file that the program, when installed,
|
258
|
+
* will create.
|
259
|
+
* For example, you may want to ensure that a program’s log file has certain attributes.
|
260
|
+
*/
|
193
261
|
VALUE
|
194
262
|
rpm_file_is_ghost(VALUE file)
|
195
263
|
{
|
196
264
|
return (NUM2INT(rb_ivar_get(file, id_attr)) & RPMFILE_GHOST) ? Qtrue : Qfalse;
|
197
265
|
}
|
198
266
|
|
267
|
+
/*
|
268
|
+
* @return [Boolean] True if the file is a license
|
269
|
+
*/
|
199
270
|
VALUE
|
200
271
|
rpm_file_is_license(VALUE file)
|
201
272
|
{
|
202
273
|
return (NUM2INT(rb_ivar_get(file, id_attr)) & RPMFILE_LICENSE) ? Qtrue : Qfalse;
|
203
274
|
}
|
204
275
|
|
276
|
+
/*
|
277
|
+
* @return [Boolean] True if the file is a README
|
278
|
+
*/
|
205
279
|
VALUE
|
206
280
|
rpm_file_is_readme(VALUE file)
|
207
281
|
{
|
208
282
|
return (NUM2INT(rb_ivar_get(file, id_attr)) & RPMFILE_README) ? Qtrue : Qfalse;
|
209
283
|
}
|
210
284
|
|
285
|
+
/*
|
286
|
+
* @return [Boolean] True if the file is listed in the exlude section
|
287
|
+
*/
|
211
288
|
VALUE
|
212
289
|
rpm_file_is_exclude(VALUE file)
|
213
290
|
{
|
214
291
|
return (NUM2INT(rb_ivar_get(file, id_attr)) & RPMFILE_EXCLUDE) ? Qtrue : Qfalse;
|
215
292
|
}
|
216
293
|
|
294
|
+
/*
|
295
|
+
* @return [Boolean] True if the file is replaced during installation
|
296
|
+
*/
|
217
297
|
VALUE
|
218
298
|
rpm_file_is_replaced(VALUE file)
|
219
299
|
{
|
@@ -221,6 +301,9 @@ rpm_file_is_replaced(VALUE file)
|
|
221
301
|
== RPMFILE_STATE_REPLACED) ? Qtrue : Qfalse;
|
222
302
|
}
|
223
303
|
|
304
|
+
/*
|
305
|
+
* @return [Boolean] True if the file is not installed
|
306
|
+
*/
|
224
307
|
VALUE
|
225
308
|
rpm_file_is_notinstalled(VALUE file)
|
226
309
|
{
|
@@ -228,6 +311,9 @@ rpm_file_is_notinstalled(VALUE file)
|
|
228
311
|
== RPMFILE_STATE_NOTINSTALLED) ? Qtrue : Qfalse;
|
229
312
|
}
|
230
313
|
|
314
|
+
/*
|
315
|
+
* @return [Boolean] True if the file is shared over the network
|
316
|
+
*/
|
231
317
|
VALUE
|
232
318
|
rpm_file_is_netshared(VALUE file)
|
233
319
|
{
|