rpm2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.github/CODEOWNERS +1 -0
  3. data/.github/workflows/ci.yaml +25 -0
  4. data/.gitignore +8 -0
  5. data/.rubocop.yml +1 -0
  6. data/.rubocop_todo.yml +111 -0
  7. data/.whitesource +3 -0
  8. data/CHANGELOG.md +66 -0
  9. data/Gemfile +9 -0
  10. data/MIT-LICENSE +23 -0
  11. data/README.md +374 -0
  12. data/Rakefile +58 -0
  13. data/_docker/Dockerfile.ubi8 +8 -0
  14. data/_docker/Dockerfile.ubi9 +8 -0
  15. data/lib/rpm/c/header.rb +36 -0
  16. data/lib/rpm/c/rpmcallback.rb +27 -0
  17. data/lib/rpm/c/rpmcli.rb +6 -0
  18. data/lib/rpm/c/rpmdb.rb +20 -0
  19. data/lib/rpm/c/rpmds.rb +43 -0
  20. data/lib/rpm/c/rpmfi.rb +31 -0
  21. data/lib/rpm/c/rpmio.rb +17 -0
  22. data/lib/rpm/c/rpmlib.rb +12 -0
  23. data/lib/rpm/c/rpmlog.rb +23 -0
  24. data/lib/rpm/c/rpmmacro.rb +33 -0
  25. data/lib/rpm/c/rpmprob.rb +53 -0
  26. data/lib/rpm/c/rpmps.rb +11 -0
  27. data/lib/rpm/c/rpmtag.rb +304 -0
  28. data/lib/rpm/c/rpmtd.rb +34 -0
  29. data/lib/rpm/c/rpmts.rb +69 -0
  30. data/lib/rpm/c/rpmtypes.rb +28 -0
  31. data/lib/rpm/c.rb +49 -0
  32. data/lib/rpm/compat.rb +40 -0
  33. data/lib/rpm/db.rb +117 -0
  34. data/lib/rpm/dependency.rb +120 -0
  35. data/lib/rpm/file.rb +134 -0
  36. data/lib/rpm/gem_version.rb +7 -0
  37. data/lib/rpm/match_iterator.rb +66 -0
  38. data/lib/rpm/package.rb +332 -0
  39. data/lib/rpm/problem.rb +65 -0
  40. data/lib/rpm/transaction.rb +268 -0
  41. data/lib/rpm/utils.rb +7 -0
  42. data/lib/rpm/version.rb +146 -0
  43. data/lib/rpm.rb +88 -0
  44. data/lib/rpm2.rb +1 -0
  45. data/rpm2.gemspec +29 -0
  46. data/test/data/a.spec +49 -0
  47. data/test/data/simple-1.0-0.i586.rpm +0 -0
  48. data/test/data/simple.spec +38 -0
  49. data/test/data/simple_with_deps-1.0-0.i586.rpm +0 -0
  50. data/test/data/simple_with_deps.spec +41 -0
  51. data/test/helper.rb +7 -0
  52. data/test/test_dependency.rb +28 -0
  53. data/test/test_file.rb +36 -0
  54. data/test/test_lib.rb +33 -0
  55. data/test/test_package.rb +76 -0
  56. data/test/test_problem.rb +18 -0
  57. data/test/test_rpm.rb +33 -0
  58. data/test/test_transaction.rb +156 -0
  59. data/test/test_version.rb +64 -0
  60. metadata +133 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 297bf3934e3aa92ed045b10c069f100044567ed9c18630861cf8efe24072ab37
4
+ data.tar.gz: a2e66b665ef636ed114f2fee6dd72b31196da1e05952173ad6600aa861677f66
5
+ SHA512:
6
+ metadata.gz: 3fe6c774b023db7eef7a20fe9bdfae968140eee0c9be4120af4d62db8e34b9fb99adcee93f0a7c2a8844950dad155db4b4ae79b632414f4e3fe0ed3b185ee9f0
7
+ data.tar.gz: 1c3fb8e5302cb60eca09958729ed1a234bb14d2e0bbaa29c6c4e2d798deb7bee37fdd80f69b1b0ed440b31200383abb983be6c283e0520a341674511871da929
@@ -0,0 +1 @@
1
+ * @agrare @Fryguy
@@ -0,0 +1,25 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ schedule:
7
+ - cron: '0 0 * * 0'
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ ci:
12
+ timeout-minutes: 5
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ platform:
18
+ - ubi8
19
+ - ubi9
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - name: Build docker image
23
+ run: rake docker_images[${{ matrix.platform }}]
24
+ - name: Run tests
25
+ run: rake docker_test[${{ matrix.platform }}]
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ *.rbc
6
+ .yardoc
7
+ .idea
8
+ test/test_many_files.rb
data/.rubocop.yml ADDED
@@ -0,0 +1 @@
1
+ inherit_from: .rubocop_todo.yml
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,111 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2016-07-09 11:50:54 +0200 using RuboCop version 0.41.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 6
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: AlignWith, SupportedStyles, AutoCorrect.
12
+ # SupportedStyles: keyword, variable, start_of_line
13
+ Lint/EndAlignment:
14
+ Exclude:
15
+ - 'lib/rpm/dependency.rb'
16
+ - 'lib/rpm/file.rb'
17
+ - 'lib/rpm/package.rb'
18
+ - 'lib/rpm/transaction.rb'
19
+ - 'test/test_transaction.rb'
20
+
21
+ # Offense count: 1
22
+ Lint/UnreachableCode:
23
+ Exclude:
24
+ - 'lib/rpm/transaction.rb'
25
+
26
+ # Offense count: 11
27
+ Lint/UselessAssignment:
28
+ Exclude:
29
+ - 'lib/rpm.rb'
30
+ - 'lib/rpm/package.rb'
31
+ - 'lib/rpm/transaction.rb'
32
+ - 'lib/rpm/version.rb'
33
+
34
+ # Offense count: 1
35
+ Lint/Void:
36
+ Exclude:
37
+ - 'test/test_rpm.rb'
38
+
39
+ # Offense count: 17
40
+ Metrics/AbcSize:
41
+ Max: 74
42
+
43
+ # Offense count: 1
44
+ Metrics/BlockNesting:
45
+ Max: 4
46
+
47
+ # Offense count: 3
48
+ # Configuration parameters: CountComments.
49
+ Metrics/ClassLength:
50
+ Max: 225
51
+
52
+ # Offense count: 3
53
+ Metrics/CyclomaticComplexity:
54
+ Max: 17
55
+
56
+ # Offense count: 66
57
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
58
+ # URISchemes: http, https
59
+ Metrics/LineLength:
60
+ Max: 129
61
+
62
+ # Offense count: 21
63
+ # Configuration parameters: CountComments.
64
+ Metrics/MethodLength:
65
+ Max: 57
66
+
67
+ # Offense count: 1
68
+ # Configuration parameters: CountComments.
69
+ Metrics/ModuleLength:
70
+ Max: 295
71
+
72
+ # Offense count: 4
73
+ # Configuration parameters: CountKeywordArgs.
74
+ Metrics/ParameterLists:
75
+ Max: 11
76
+
77
+ # Offense count: 2
78
+ Metrics/PerceivedComplexity:
79
+ Max: 19
80
+
81
+ # Offense count: 2
82
+ Style/AccessorMethodName:
83
+ Exclude:
84
+ - 'lib/rpm/match_iterator.rb'
85
+
86
+ # Offense count: 1
87
+ Style/AsciiComments:
88
+ Exclude:
89
+ - 'lib/rpm/file.rb'
90
+
91
+ # Offense count: 34
92
+ Style/Documentation:
93
+ Enabled: false
94
+
95
+ # Offense count: 2
96
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
97
+ # SupportedStyles: snake_case, camelCase
98
+ Style/MethodName:
99
+ Exclude:
100
+ - 'lib/rpm/c/rpmprob.rb'
101
+ - 'lib/rpm/c/rpmtag.rb'
102
+
103
+ # Offense count: 3
104
+ # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
105
+ # NamePrefix: is_, has_, have_
106
+ # NamePrefixBlacklist: is_, has_, have_
107
+ # NameWhitelist: is_a?
108
+ Style/PredicateName:
109
+ Exclude:
110
+ - 'spec/**/*'
111
+ - 'lib/rpm/file.rb'
data/.whitesource ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "settingsInheritedFrom": "ManageIQ/whitesource-config@master"
3
+ }
data/CHANGELOG.md ADDED
@@ -0,0 +1,66 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ This project adheres to [Semantic Versioning](http://semver.org/).
5
+
6
+ ## [Unreleased]
7
+
8
+ ## [0.1.0] - 2025-02-03
9
+ ### Added
10
+ - Detect librpm.so.8
11
+ - Make rpm_version_macro available in c/rpmmacro
12
+ - Attach addMacro/delMacro as rpmPushMacro and rpmPopMacro in >= 4.14.0
13
+ - Detect librpm.so.9 ([#5](https://github.com/ManageIQ/ruby-rpm-ffi2/pull/5))
14
+
15
+ ### Changed
16
+ - MiniTest::Unit::TestCase is now Minitest::Test
17
+ - Rename rpm gem to rpm2 ([#1](https://github.com/ManageIQ/ruby-rpm-ffi2/pull/1))
18
+ - Replace TravisCI with Github Actions ([#3](https://github.com/ManageIQ/ruby-rpm-ffi2/pull/3))
19
+
20
+ ### Fixed
21
+ - Do not attach deprecated headerNVR on >= 4.14.0
22
+ - Handle deprecated addMacro/delMacro
23
+ - Do not use headerNVR in Package.version ([#4](https://github.com/ManageIQ/ruby-rpm-ffi2/pull/4))
24
+ - Use rpmExpandMacros on rpm v4.14+ for `RPM#[]` ([#12](https://github.com/ManageIQ/ruby-rpm-ffi2/pull/12))
25
+
26
+ ## [0.0.5] - 2016-07-09
27
+ ### Added
28
+ - Add rake for travis
29
+ - Search for librpm.so.3 too
30
+
31
+ ### Changed
32
+ - Moved to minitest
33
+ - ruby 1.9.x not supported anymore
34
+
35
+ ## [0.0.4] - 2013-10-24
36
+ ### Fixed
37
+ - Bugfix: too many open files on transaction with blocks
38
+ - Fixing the access to FileAttrs and FileState constants from RPM::File
39
+
40
+ ## [0.0.3] - 2012-02-23
41
+ ### Changed
42
+ - RPM::FFI module is now RPM::C
43
+
44
+ ### Added
45
+ - implement Trasaction#commit, Trasaction#install, Trasaction#upgrade,
46
+
47
+ ## [0.0.2] - 2012-01-04
48
+ ### Added
49
+ - Add MatchIterator support and expose it in Transaction
50
+ - Implement transaction callback
51
+ - Implemented RPM::File
52
+ - implement RPM#[]=
53
+
54
+ ### Changed
55
+ - Renamed RPM::Header to RPM::Package
56
+
57
+ ### Fixed
58
+ - Fix name not getting set. Better use headerPutString
59
+ - Fix RPM#[]
60
+
61
+ [Unreleased]: https://github.com/ManageIQ/ruby-rpm-ffi2/compare/v0.1.0...HEAD
62
+ [0.1.0]: https://github.com/ManageIQ/ruby-rpm-ffi2/compare/v0.0.5...v0.1.0
63
+ [0.0.5]: https://github.com/ManageIQ/ruby-rpm-ffi2/compare/v0.0.4...v0.0.5
64
+ [0.0.4]: https://github.com/ManageIQ/ruby-rpm-ffi2/compare/v0.0.3...v0.0.4
65
+ [0.0.3]: https://github.com/ManageIQ/ruby-rpm-ffi2/compare/v0.0.2...v0.0.3
66
+ [0.0.2]: https://github.com/ManageIQ/ruby-rpm-ffi2/compare/aa5c84efc5...v0.0.2
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rpm.gemspec
4
+ gemspec
5
+
6
+ group :test do
7
+ gem 'minitest'
8
+ gem 'rake'
9
+ end
data/MIT-LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ Copyright © 2025 ManageIQ Authors
2
+ Copyright © 2011 Duncan Mac-Vicar Prett <dmacvicar@suse.de>
3
+ Copyright © 2011 SUSE Linux Products GmbH
4
+ Copyright © 2002 Kenta Murata
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ "Software"), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,374 @@
1
+
2
+ # RPM bindings for ruby
3
+
4
+ [![CI](https://github.com/ManageIQ/ruby-rpm-ffi2/actions/workflows/ci.yaml/badge.svg)](https://github.com/ManageIQ/ruby-rpm-ffi2/actions/workflows/ci.yaml)
5
+
6
+ # WARNING
7
+
8
+ This is an alpha release! There is still work to be done
9
+
10
+ # Quickstart
11
+
12
+ ## Working with RPM package files
13
+
14
+ ```ruby
15
+ require 'rpm'
16
+
17
+ pkg = RPM::Package.open("file.rpm")
18
+ pkg.arch => "x86_64"
19
+
20
+ pkg.files.each do |file|
21
+ puts file.path
22
+ end
23
+
24
+ pkg.changelog.each do |entry|
25
+ puts "#{entry.name} #{entry.time} #{entry.text}"
26
+ end
27
+ ```
28
+
29
+ ## Querying the rpm database
30
+
31
+ ```ruby
32
+ require 'rpm'
33
+
34
+ RPM.transaction do |ts|
35
+ ts.each do |pkg|
36
+ puts pkg
37
+ end
38
+ end
39
+ ```
40
+
41
+ ## Install a package
42
+
43
+ ```ruby
44
+ require 'rpm'
45
+
46
+ pkg = RPM::Package.open('foo.rpm')
47
+
48
+ RPM.transaction(rootdir) do |t|
49
+ t.install(pkg, 'foo.rpm')
50
+ t.commit
51
+ end
52
+ ```
53
+
54
+ ## Introduction
55
+
56
+ This library is a replacement for the ruby-rpm gem, originally
57
+ writen by Kenta Murata around 2002 for the Kondara distribution. Later
58
+ mantained by David Lutterkort and myself.
59
+
60
+ Why?
61
+
62
+ * The original gem supports ancient rpm versions not in use anymore
63
+ * The original gem was written in C using MRI API
64
+ * The #ifdef'ing required to support multiple rpm versions made the code
65
+ hard to maintain
66
+
67
+ This gem:
68
+
69
+ * Is pure ruby
70
+ * Is documented
71
+ * Has as a goal to support only the latest rpm version plus the ones in
72
+ use some releases back in popular rpm based distros
73
+ * Uses FFI, so it should work with other interpreters
74
+ (Because https://github.com/rubinius/rubinius/issues/682 it currently does
75
+ not work on Rubinius)
76
+ * Does not target rpm5, but it may support it someday
77
+
78
+ As an example the code that implements RPM::Package was reduced
79
+ from 1130 lines of code to 320.
80
+
81
+ # Architecture
82
+
83
+ The gem is divided in two modules:
84
+
85
+ * RPM::C:: which contains the 1:1 mapping to the librpm API
86
+ Not all functions are attached, only the ones we actually use.
87
+ * RPM:: contains the actual higher level API
88
+
89
+ # Status, Compatibility and Differences with ruby-rpm
90
+
91
+ * Only rpm 4.11.x or later will be supported
92
+ * You can use symbols: instead of RPM::TAG_DESCRIPTION you
93
+ can use just :description. 'rpm/compat' is by default loaded
94
+ and provides compatibility with the RPM::TAG_* style constants
95
+ * RPM::DB is not supported. Use RPM::Transaction
96
+ * Spec and Source classes are not implemented yet
97
+
98
+ ## TESTING
99
+
100
+ Unit tests can be run using the `rake test` command.
101
+
102
+ ### Docker tests
103
+
104
+ In order to not damage your system, you can run the testsuite under docker:
105
+
106
+ * Build the docker images:
107
+
108
+ ```console
109
+ rake docker_images
110
+ ```
111
+
112
+ * Run the testsuite under Docker
113
+
114
+ ```console
115
+ rake docker_test
116
+ ```
117
+
118
+ ## TODO
119
+
120
+ * Check Package#signature should return String?
121
+ => ruby-rpm seems to return symbol
122
+ * Food for thought: Package dependencies and changelog
123
+ methods could just use []. Calling headerGet directly saves
124
+ us from doing one iteration per attribute
125
+ * Not sure if Spec can be implemented as it was before with
126
+ newer rpms.
127
+
128
+ ## API Checklist and TODO
129
+
130
+ ### Low level 1:1 RPM::C API
131
+
132
+ * http://rpm.org/wiki/Releases/4.14.0
133
+ - [ ] Add rpmfiVerify() and rpmfilesVerify()
134
+ - [ ] Add pmsqPoll(), rpmsqActivate(), rpmsqSetAction(), rpmsqBlock()
135
+ - [ ] Add rpmDigestBundleAddID()
136
+ - [ ] Add RPMTRANS_FLAG_NOCAPS flag to disable file capabilities
137
+ - [ ] Add RPMVSF_NOPAYLOAD flag to disable payload digest verification
138
+ - [ ] Add pgpPubkeyKeyID()
139
+ - [X] Add rpmPushMacro() and rpmPopMacro() (to replace addMacro() and delMacro())
140
+ - [ ] Remove headerNVR(), headerNEVRA(), headerGetNEVR(), headerGetNEVRA(), headerGetEVR(), headerGetColor(), rpmfiMD5(), expandMacros(), addMacro(), delMacro()
141
+
142
+ * http://rpm.org/wiki/Releases/4.13.0
143
+ - [ ] Add rpmsqSetInterruptSafety()
144
+ - [ ] Add/Change rpmPkgSign()
145
+ - [ ] Add RPMCALLBACK_ELEM_PROGRESS callback type
146
+ - [ ] Add rpmExpandMacros()
147
+
148
+ * http://rpm.org/wiki/Releases/4.12.0
149
+ - [ ] Add rpmtxnBegin() and rpmtxnEnd()
150
+ - [ ] Add rpmtsImportHeader()
151
+ - [ ] Add rpmtsAddReinstallElement()
152
+ - [ ] Add rpmdbIndexIteratorNextTd()
153
+ - [ ] Add file info set iterator functions: rpmfiFLinks(), rpmfiFindFN(), rpmfiStat()
154
+ - [ ] Add rpmfiOFN(), rpmfiOBN(), rpmfiODN(), rpmfiFindOFN()
155
+ - [ ] Add rpmteFiles()
156
+ - [ ] Add rpmdsTagF(), rpmdsTagEVR(), rpmdsD(), rpmdsPutToHeader(), rpmdsTi(), rpmdsTagTi() and rpmdsSinglePoolTix()
157
+
158
+ * http://rpm.org/wiki/Releases/4.11.0
159
+ - [ ] Add rpmstrPool object + associated functions
160
+ - [ ] Add rpmIsGlob()
161
+ - [ ] Add rpmtdToPool()
162
+ - [ ] Add rpmGetArchColor()
163
+
164
+ ### RPM
165
+
166
+ - [ ] RPM#expand
167
+ - [X] RPM#[]
168
+ - [X] RPM#[]=
169
+ - [ ] RPM#readrc
170
+ - [ ] RPM#init_macros
171
+ - [ ] RPM#verbosity
172
+ - [ ] RPM#verbosity=
173
+
174
+ ### RPM::Package
175
+
176
+ - [X] Package#open
177
+ - [X] Package#new
178
+ - [X] Package#create
179
+ - [ ] Package#load
180
+ - [ ] Package#clear_cache
181
+ - [ ] Package#use_cache
182
+ - [X] Package#[]
183
+ - [ ] Package#delete_tag
184
+ - [X] Package#sprintf
185
+ [?] Package#signature
186
+ - [X] Package#arch
187
+ - [X] Package#name
188
+ - [X] Package#version
189
+ - [X] Package#files
190
+ - [X] Package#provides
191
+ - [X] Package#requires
192
+ - [X] Package#conflicts
193
+ - [X] Package#obsoletes
194
+ - [X] Package#changelog
195
+ - [ ] Package#add_dependency
196
+ - [ ] Package#add_string
197
+ - [ ] Package#add_string_array
198
+ - [ ] Package#add_int32
199
+ - [ ] Package#dump
200
+ - [X] Package#to_s
201
+ - [ ] Package#inspect
202
+ - [ ] Package#copy_to
203
+
204
+ ### RPM::Dependency
205
+
206
+ - [X] Dependency#initialize
207
+ - [X] Dependency#name
208
+ - [X] Dependency#version
209
+ - [X] Dependency#flags
210
+ - [X] Dependency#owner
211
+ - [X] Dependency#lt?
212
+ - [X] Dependency#gt?
213
+ - [X] Dependency#eq?
214
+ - [X] Dependency#le?
215
+ - [X] Dependency#ge?
216
+ - [X] Dependency#satisfy?
217
+ - [X] Dependency#nametag
218
+ - [X] Dependency#versiontag
219
+ - [X] Dependency#flagstag
220
+
221
+ ### RPM::Provide
222
+
223
+ - [X] Provide#initialize
224
+
225
+ ### RPM::Require
226
+
227
+ - [X] Require#initialize
228
+ - [ ] Require#pre?
229
+
230
+ ### RPM::Conflict
231
+
232
+ - [X] Conflict#initialize
233
+
234
+ ### RPM::Obsolete
235
+
236
+ - [X] Obsolete#initialize
237
+
238
+ ### RPM::ChangeLog
239
+
240
+ - [X] ChangeLog#time
241
+ - [X] ChangeLog#name
242
+ - [X] ChangeLog#text
243
+
244
+ ### RPM::Version
245
+
246
+ - [X] Version (Comparable)
247
+ - [X] Version#initialize
248
+ - [X] Version#<=>
249
+ - [X] Version#newer?
250
+ - [X] Version#older?
251
+ - [X] Version#v
252
+ - [X] Version#r
253
+ - [X] Version#e
254
+ - [X] Version#to_s
255
+ - [X] Version#to_vre
256
+ - [X] Version#inspect
257
+ - [X] Version#hash
258
+
259
+ ### RPM::File
260
+
261
+ - [X] File#initialize
262
+ - [X] File#path
263
+ - [ ] File#to_s (alias path)
264
+ - [X] File#md5sum
265
+ - [X] File#link_to
266
+ - [X] File#size
267
+ - [X] File#mtime
268
+ - [X] File#owner
269
+ - [X] File#group
270
+ - [X] File#rdev
271
+ - [X] File#mode
272
+ - [X] File#attr
273
+ - [X] File#state
274
+ - [X] File#symlink?
275
+ - [X] File#config?
276
+ - [X] File#doc?
277
+ - [X] File#donotuse?
278
+ - [X] File#missingok?
279
+ - [X] File#specfile?
280
+ - [X] File#ghost?
281
+ - [X] File#license?
282
+ - [X] File#readme?
283
+ - [X] File#exclude?
284
+ - [X] File#replaced?
285
+ - [X] File#notinstalled?
286
+ - [X] File#netshared?
287
+
288
+ ### RPM::DB
289
+
290
+ - [ ] DB (Enumerable)
291
+ - [ ] DB#new
292
+ - [ ] DB#open
293
+ - [ ] DB#init
294
+ - [ ] DB#rebuild
295
+ - [ ] DB#close
296
+ - [ ] DB#closed?
297
+ - [ ] DB#root
298
+ - [ ] DB#home
299
+ - [ ] DB#writable?
300
+ - [ ] DB#each_match
301
+ - [ ] DB#each
302
+ - [ ] DB#transaction
303
+ - [ ] DB#init_iterator
304
+ - [ ] DB#dup
305
+ - [ ] DB#clone
306
+
307
+ ### RPM::MatchIterator
308
+
309
+ - [X] MatchIterator (Enumerable)
310
+ - [X] MatchIterator#each
311
+ - [X] MatchIterator#next_iterator
312
+ - [X] MatchIterator#offset
313
+ - [X] MatchIterator#set_iterator_re
314
+ - [X] MatchIterator#regexp
315
+ - [X] MatchIterator#set_iterator_version
316
+ - [X] MatchIterator#version
317
+ - [X] MatchIterator#get_iterator_count
318
+ - [X] MatchIterator#length
319
+
320
+ ### RPM::Transaction
321
+
322
+ - [ ] Transaction#db
323
+ - [ ] Transaction#script_file
324
+ - [ ] Transaction#script_file=
325
+ - [ ] Transaction#install
326
+ - [ ] Transaction#upgrade
327
+ - [ ] Transaction#available
328
+ - [ ] Transaction#delete
329
+ - [ ] Transaction#check
330
+ - [ ] Transaction#order
331
+ - [ ] Transaction#keys
332
+ - [ ] Transaction#commit
333
+ - [ ] Transaction#abort
334
+ - [ ] Transaction#dup
335
+ - [ ] Transaction#clone
336
+
337
+ ### RPM::Source
338
+
339
+ - [ ] Source#initialize
340
+ - [ ] Source#fullname
341
+ - [ ] Source#to_s (alias fullname)
342
+ - [ ] Source#num
343
+ - [ ] Source#no?
344
+
345
+ ### RPM::Patch
346
+
347
+ ### RPM::Icon
348
+
349
+ ### RPM::Spec
350
+
351
+ - [ ] Spec#open
352
+ - [ ] Spec#new
353
+ - [ ] Spec#buildroot
354
+ - [ ] Spec#buildsubdir
355
+ - [ ] Spec#buildarchs
356
+ - [ ] Spec#buildrequires
357
+ - [ ] Spec#build_restrictions
358
+ - [ ] Spec#sources
359
+ - [ ] Spec#packages
360
+ - [ ] Spec#build
361
+ - [ ] Spec#expand_macros
362
+ - [ ] Spec#dup
363
+ - [ ] Spec#clone
364
+
365
+ # LICENSE
366
+
367
+ * Copyright © 2025 ManageIQ Authors
368
+ * Copyright © 2011 Duncan Mac-Vicar Prett <dmacvicar@suse.de>
369
+ * Copyright © 2011 SUSE Linux Products GmbH
370
+
371
+ * This gem is a pure-ruby rewrite of ruby-rpm:
372
+ Copyright © 2002 Kenta Murata. Relicensed with his permission.
373
+
374
+ Licensed under the MIT license. See MIT-LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,58 @@
1
+ $LOAD_PATH.push(File.join(File.dirname(__FILE__), 'lib'))
2
+ require 'bundler/gem_tasks'
3
+ require 'rpm/gem_version'
4
+ require 'rake/testtask'
5
+
6
+ task default: [:test]
7
+
8
+ Rake::TestTask.new do |t|
9
+ t.libs << File.expand_path('../test', __FILE__)
10
+ t.libs << File.expand_path('../', __FILE__)
11
+ t.test_files = FileList['test/test*.rb']
12
+ t.verbose = true
13
+ t.loader = :direct
14
+ end
15
+
16
+ extra_docs = ['README*', 'TODO*', 'CHANGELOG*']
17
+
18
+ begin
19
+ require 'yard'
20
+ YARD::Rake::YardocTask.new(:doc) do |t|
21
+ t.files = ['lib/**/*.rb', *extra_docs]
22
+ t.options = ['--no-private']
23
+ end
24
+ rescue LoadError
25
+ STDERR.puts 'Install yard if you want prettier docs'
26
+ begin
27
+ require 'rdoc/task'
28
+ Rake::RDocTask.new(:doc) do |rdoc|
29
+ rdoc.rdoc_dir = 'doc'
30
+ rdoc.title = "rpm for Ruby #{RPM::GEM_VERSION}"
31
+ extra_docs.each { |ex| rdoc.rdoc_files.include ex }
32
+ end
33
+ rescue LoadError
34
+ STDERR.puts 'rdoc not available'
35
+ end
36
+ end
37
+
38
+ def each_dockerfile(platform)
39
+ platform ||= "*"
40
+ Dir.glob("_docker/Dockerfile.#{platform}").each do |dockerfile|
41
+ tag = "localhost/ruby-rpm-ffi:#{File.extname(dockerfile).delete('.')}"
42
+ yield dockerfile, tag
43
+ end
44
+ end
45
+
46
+ desc "Build the docker images for test"
47
+ task :docker_images, [:platform] do |_t, args|
48
+ each_dockerfile(args[:platform]) do |dockerfile, tag|
49
+ sh "podman build --platform=linux/amd64 -f #{dockerfile} -t #{tag} ."
50
+ end
51
+ end
52
+
53
+ desc "Run the tests from within the docker images"
54
+ task :docker_test, [:platform] do |_t, args|
55
+ each_dockerfile(args[:platform]) do |dockerfile, tag|
56
+ sh "podman run --platform=linux/amd64 --rm -ti -v #{Dir.pwd}:/src #{tag} rake test"
57
+ end
58
+ end
@@ -0,0 +1,8 @@
1
+ FROM registry.access.redhat.com/ubi8/ubi
2
+ RUN dnf module -y enable ruby:3.1
3
+ RUN dnf install -y ruby git
4
+ RUN gem install bundler
5
+ WORKDIR /src
6
+ RUN ls -lR
7
+ COPY ../ /src
8
+ RUN bundle install