arr-pm 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of arr-pm might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/arr-pm.gemspec +1 -1
- data/lib/arr-pm/file.rb +15 -3
- data/lib/arr-pm/file/header.rb +12 -2
- data/lib/arr-pm/file/lead.rb +1 -1
- data/lib/arr-pm/file/tag.rb +1 -1
- metadata +9 -17
- data/test/all.rb +0 -24
- data/test/docs.rb +0 -42
- data/test/testing.rb +0 -14
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 21066cda9f121049b636654a435419fe4124cf1e
|
4
|
+
data.tar.gz: 7deb72b24f10f1a8460904dacfcf5985f3074b41
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3b2ef1ec6211fc57cb6b939fd1cb716e442757fae1cf949ecf0569b24d8eef14a9f793813c772a96c6a8a097df9170dd00803a9373c37b2b27097d5123b15f0b
|
7
|
+
data.tar.gz: 4f81f72cf8af0bfb88a1406593fd7c17701bbf1441c9ed3724a5d67197ccd7cb47f0a269599886d236f5aab03c1c2a2b2bf7e53dc408ba84c05a63783e9b16fd
|
data/arr-pm.gemspec
CHANGED
@@ -2,7 +2,7 @@ Gem::Specification.new do |spec|
|
|
2
2
|
files = %x{git ls-files}.split("\n")
|
3
3
|
|
4
4
|
spec.name = "arr-pm"
|
5
|
-
spec.version = "0.0.
|
5
|
+
spec.version = "0.0.8"
|
6
6
|
spec.summary = "RPM reader and writer library"
|
7
7
|
spec.description = "This library allows to you to read and write rpm " \
|
8
8
|
"packages. Written in pure ruby because librpm is not available " \
|
data/lib/arr-pm/file.rb
CHANGED
@@ -99,7 +99,11 @@ class RPM::File
|
|
99
99
|
|
100
100
|
extractor = IO.popen("#{tags[:payloadcompressor]} -d | (cd #{target}; cpio -i --quiet --make-directories)", "w")
|
101
101
|
buffer = ""
|
102
|
-
|
102
|
+
begin
|
103
|
+
buffer.force_encoding("BINARY")
|
104
|
+
rescue NoMethodError
|
105
|
+
# Do Nothing
|
106
|
+
end
|
103
107
|
payload_fd = payload.clone
|
104
108
|
loop do
|
105
109
|
data = payload_fd.read(16384, buffer)
|
@@ -190,7 +194,11 @@ class RPM::File
|
|
190
194
|
|
191
195
|
lister = IO.popen("#{tags[:payloadcompressor]} -d | cpio -it --quiet", "r+")
|
192
196
|
buffer = ""
|
193
|
-
|
197
|
+
begin
|
198
|
+
buffer.force_encoding("BINARY")
|
199
|
+
rescue NoMethodError
|
200
|
+
# Do Nothing
|
201
|
+
end
|
194
202
|
payload_fd = payload.clone
|
195
203
|
output = ""
|
196
204
|
loop do
|
@@ -207,7 +215,11 @@ class RPM::File
|
|
207
215
|
end
|
208
216
|
lister.close_write
|
209
217
|
# Read remaining output
|
210
|
-
|
218
|
+
begin
|
219
|
+
output << lister.read
|
220
|
+
rescue Errno::EAGAIN
|
221
|
+
# Do Nothing
|
222
|
+
end
|
211
223
|
# Split output by newline and strip leading "."
|
212
224
|
@files = output.split("\n").collect { |s| s.gsub(/^\./, "") }
|
213
225
|
return @files
|
data/lib/arr-pm/file/header.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "..", "namespace")
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "namespace"))
|
2
2
|
require File.join(File.dirname(__FILE__), "tag")
|
3
3
|
require "cabin"
|
4
4
|
|
@@ -12,7 +12,17 @@ class RPM::File::Header
|
|
12
12
|
attr_accessor :data_length # rpmlib calls this field 'dl' unhelpfully
|
13
13
|
|
14
14
|
HEADER_SIGNED_TYPE = 5
|
15
|
-
HEADER_MAGIC = "\x8e\xad\xe8\x01\x00\x00\x00\x00"
|
15
|
+
#HEADER_MAGIC = "\x8e\xad\xe8\x01\x00\x00\x00\x00".force_encoding("BINARY")
|
16
|
+
|
17
|
+
if RUBY_VERSION =~ /^2\./
|
18
|
+
# Ruby 2 forces all strings to be UTF-8, so "\x01" becomes "\u0001"
|
19
|
+
# which is two bytes 00 01 which is not what we want. I can't find
|
20
|
+
# a sane way to create a string without this madness in Ruby 2,
|
21
|
+
# so let's just pack two 4-byte integers and go about our day.
|
22
|
+
HEADER_MAGIC = [0x8eade801, 0x00000000].pack("NN")
|
23
|
+
else
|
24
|
+
HEADER_MAGIC = "\x8e\xad\xe8\x01\x00\x00\x00\x00"
|
25
|
+
end
|
16
26
|
# magic + index_count + data_length
|
17
27
|
HEADER_HEADER_LENGTH = HEADER_MAGIC.length + 4 + 4
|
18
28
|
TAG_ENTRY_SIZE = 16 # tag id, type, offset, count == 16 bytes
|
data/lib/arr-pm/file/lead.rb
CHANGED
data/lib/arr-pm/file/tag.rb
CHANGED
metadata
CHANGED
@@ -1,30 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arr-pm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.8
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jordan Sissel
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-03-21 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: cabin
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>'
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>'
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
description: This library allows to you to read and write rpm packages. Written in
|
@@ -53,34 +50,29 @@ files:
|
|
53
50
|
- lib/arr-pm/requires.rb
|
54
51
|
- notify-failure.sh
|
55
52
|
- printrpm.rb
|
56
|
-
- test/all.rb
|
57
|
-
- test/docs.rb
|
58
|
-
- test/testing.rb
|
59
53
|
homepage:
|
60
54
|
licenses:
|
61
55
|
- Apache 2
|
56
|
+
metadata: {}
|
62
57
|
post_install_message:
|
63
58
|
rdoc_options: []
|
64
59
|
require_paths:
|
65
60
|
- lib
|
66
61
|
- lib
|
67
62
|
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
-
none: false
|
69
63
|
requirements:
|
70
|
-
- -
|
64
|
+
- - '>='
|
71
65
|
- !ruby/object:Gem::Version
|
72
66
|
version: '0'
|
73
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
68
|
requirements:
|
76
|
-
- -
|
69
|
+
- - '>='
|
77
70
|
- !ruby/object:Gem::Version
|
78
71
|
version: '0'
|
79
72
|
requirements: []
|
80
73
|
rubyforge_project:
|
81
|
-
rubygems_version:
|
74
|
+
rubygems_version: 2.0.3
|
82
75
|
signing_key:
|
83
|
-
specification_version:
|
76
|
+
specification_version: 4
|
84
77
|
summary: RPM reader and writer library
|
85
78
|
test_files: []
|
86
|
-
has_rdoc:
|
data/test/all.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
require "minitest/spec"
|
3
|
-
require "minitest/autorun"
|
4
|
-
|
5
|
-
# Get coverage report
|
6
|
-
require "simplecov"
|
7
|
-
SimpleCov.start
|
8
|
-
|
9
|
-
# Add '../lib' to the require path.
|
10
|
-
$: << File.join(File.dirname(__FILE__), "..", "lib")
|
11
|
-
|
12
|
-
def use(path)
|
13
|
-
puts "Loading tests from #{path}"
|
14
|
-
require File.expand_path(path)
|
15
|
-
end
|
16
|
-
|
17
|
-
dirname = File.dirname(__FILE__)
|
18
|
-
use File.join(dirname, "docs.rb")
|
19
|
-
|
20
|
-
# Load tests from ./*/**/*.rb (usually ./libraryname/....)
|
21
|
-
glob = File.join(dirname, "*", "**", "*.rb")
|
22
|
-
Dir.glob(glob).each do |path|
|
23
|
-
use path
|
24
|
-
end
|
data/test/docs.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
require "yard"
|
3
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), "testing")
|
4
|
-
|
5
|
-
describe "documentation tests" do
|
6
|
-
before do
|
7
|
-
# Use YARD to parse all ruby files found in '../lib'
|
8
|
-
libdir = File.join(File.dirname(__FILE__), "..", "lib")
|
9
|
-
YARD::Registry.load(Dir.glob(File.join(libdir, "**", "*.rb")))
|
10
|
-
@registry = YARD::Registry.all
|
11
|
-
end
|
12
|
-
|
13
|
-
test "All classes, methods, modules, and constants must be documented" do
|
14
|
-
# YARD's parser works best in ruby 1.9.x, so skip 1.8.x
|
15
|
-
skip if RUBY_VERSION < "1.9.2"
|
16
|
-
# Note, the 'find the undocumented things' code here is
|
17
|
-
# copied mostly from: YARD 0.7.5's lib/yard/cli/stats.rb
|
18
|
-
#
|
19
|
-
# Find all undocumented classes, modules, and constants
|
20
|
-
undocumented = @registry.select do |o|
|
21
|
-
[:class, :module, :constant].include?(o.type) && o.docstring.blank?
|
22
|
-
end
|
23
|
-
|
24
|
-
# Find all undocumented methods
|
25
|
-
methods = @registry.select { |m| m.type == :method }
|
26
|
-
methods.reject! { |m| m.is_alias? || !m.is_explicit? }
|
27
|
-
undocumented += methods.select do |m|
|
28
|
-
m.docstring.blank? && !m.overridden_method
|
29
|
-
end
|
30
|
-
|
31
|
-
if (undocumented.length > 0)
|
32
|
-
message = ["The following are not documented"]
|
33
|
-
undocumented.each do |o|
|
34
|
-
message << "* #{o.type.to_s} #{o.to_s} <#{o.file}:#{o.line}>"
|
35
|
-
end
|
36
|
-
|
37
|
-
flunk(message.join("\n"))
|
38
|
-
else
|
39
|
-
pass
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
data/test/testing.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
require "minitest/spec"
|
3
|
-
|
4
|
-
# Add '../lib' to the require path.
|
5
|
-
$: << File.join(File.dirname(__FILE__), "..", "lib")
|
6
|
-
|
7
|
-
# I don't really like monkeypatching, but whatever, this is probably better
|
8
|
-
# than overriding the 'describe' method.
|
9
|
-
class MiniTest::Spec
|
10
|
-
class << self
|
11
|
-
# 'it' sounds wrong, call it 'test'
|
12
|
-
alias :test :it
|
13
|
-
end
|
14
|
-
end
|