enhancerepo 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +27 -0
- data/bin/enhancerepo +2 -3
- data/lib/enhance_repo.rb +8 -13
- data/lib/enhance_repo/array_arg.rb +85 -0
- data/lib/enhance_repo/cli.rb +23 -78
- data/lib/enhance_repo/config_opts.rb +207 -13
- data/lib/enhance_repo/logger.rb +14 -10
- data/lib/enhance_repo/other.rb +11 -12
- data/lib/enhance_repo/package_id.rb +21 -12
- data/lib/enhance_repo/pattern.rb +50 -0
- data/lib/enhance_repo/product_id.rb +3 -1
- data/lib/enhance_repo/rpm_md.rb +3 -1
- data/lib/enhance_repo/rpm_md/data.rb +6 -7
- data/lib/enhance_repo/rpm_md/delta_info.rb +58 -67
- data/lib/enhance_repo/rpm_md/extra_primary_data.rb +4 -4
- data/lib/enhance_repo/rpm_md/file_lists.rb +12 -13
- data/lib/enhance_repo/rpm_md/index.rb +32 -27
- data/lib/enhance_repo/rpm_md/other.rb +7 -8
- data/lib/enhance_repo/rpm_md/pattern_writer.rb +131 -0
- data/lib/enhance_repo/rpm_md/patterns.rb +158 -0
- data/lib/enhance_repo/rpm_md/primary.rb +32 -33
- data/lib/enhance_repo/rpm_md/products.rb +19 -24
- data/lib/enhance_repo/rpm_md/repo.rb +33 -36
- data/lib/enhance_repo/rpm_md/resource.rb +6 -6
- data/lib/enhance_repo/rpm_md/suse_data.rb +41 -50
- data/lib/enhance_repo/rpm_md/suse_info.rb +12 -15
- data/lib/enhance_repo/rpm_md/update.rb +65 -36
- data/lib/enhance_repo/rpm_md/update_info.rb +38 -42
- data/lib/enhance_repo/rpm_md/update_smart_fields.rb +24 -24
- data/lib/enhance_repo/susetags/pattern_reader.rb +142 -0
- data/lib/enhance_repo/version.rb +5 -0
- data/lib/enhance_repo/xml_comparer.rb +28 -24
- metadata +190 -221
- data/CHANGELOG.rdoc +0 -18
- data/Manifest.txt +0 -85
- data/README +0 -10
- data/README.rdoc +0 -15
- data/Rakefile +0 -48
- data/TODO.rdoc +0 -4
- data/lib/tempdir.rb +0 -62
- data/lib/tempdir/tempfile.rb +0 -21
- data/test/all_tests.rb +0 -27
- data/test/data/packages/a-1.0.spec +0 -19
- data/test/data/packages/a-2.0.spec +0 -24
- data/test/data/repodata/update-test-11.1/filelists.xml.gz +0 -0
- data/test/data/repodata/update-test-11.1/other.xml.gz +0 -0
- data/test/data/repodata/update-test-11.1/primary.xml.gz +0 -0
- data/test/data/repodata/update-test-11.1/repomd.xml +0 -21
- data/test/data/repomd.xml +0 -21
- data/test/data/rpms/repo-1/a-1.0-0.x86_64.rpm +0 -0
- data/test/data/rpms/repo-1/a-1.0_2.0-0_0.x86_64.delta.rpm +0 -0
- data/test/data/rpms/repo-1/a-2.0-0.x86_64.rpm +0 -0
- data/test/data/rpms/repo-1/repodata/deltainfo.xml.gz +0 -0
- data/test/data/rpms/repo-1/repodata/deltainfo.xml.gz.gz +0 -0
- data/test/data/rpms/repo-1/repodata/filelists.xml.gz +0 -0
- data/test/data/rpms/repo-1/repodata/other.xml.gz +0 -0
- data/test/data/rpms/repo-1/repodata/primary.xml.gz +0 -0
- data/test/data/rpms/repo-1/repodata/repomd.xml +0 -45
- data/test/data/rpms/repo-1/repodata/susedata.xml.gz +0 -0
- data/test/data/rpms/repo-1/repodata/updateinfo.xml.gz +0 -0
- data/test/data/rpms/repo-1/repoparts/update-a-1.xml +0 -22
- data/test/data/rpms/repo-with-product/a-1.0-0.x86_64.rpm +0 -0
- data/test/data/rpms/repo-with-product/openSUSE-release-11.2-1.6.i586.rpm +0 -0
- data/test/data/rpms/repo-with-product/openSUSE-release-dvd-11.2-1.6.i586.rpm +0 -0
- data/test/data/rpms/repo-with-product/repodata/filelists.xml.gz +0 -0
- data/test/data/rpms/repo-with-product/repodata/other.xml.gz +0 -0
- data/test/data/rpms/repo-with-product/repodata/primary.xml.gz +0 -0
- data/test/data/rpms/repo-with-product/repodata/products.xml.gz +0 -0
- data/test/data/rpms/repo-with-product/repodata/repomd.xml +0 -27
- data/test/data/rpms/update-test-11.1/update-test-affects-package-manager.rpm +0 -0
- data/test/data/rpms/update-test-11.1/update-test-interactive.rpm +0 -0
- data/test/data/rpms/update-test-11.1/update-test-optional.rpm +0 -0
- data/test/data/rpms/update-test-11.1/update-test-reboot-needed.rpm +0 -0
- data/test/data/rpms/update-test-11.1/update-test-security.rpm +0 -0
- data/test/data/rpms/update-test-11.1/update-test-trival.rpm +0 -0
- data/test/data/rpms/update-test-factory/update-test-affects-package-manager-0-9999.1.2.noarch.rpm +0 -0
- data/test/data/rpms/update-test-factory/update-test-interactive-0-9999.1.2.noarch.rpm +0 -0
- data/test/data/rpms/update-test-factory/update-test-optional-0-9999.1.2.noarch.rpm +0 -0
- data/test/data/rpms/update-test-factory/update-test-reboot-needed-0-9999.1.2.noarch.rpm +0 -0
- data/test/data/rpms/update-test-factory/update-test-relogin-suggested-0-9999.1.2.noarch.rpm +0 -0
- data/test/data/rpms/update-test-factory/update-test-security-0-9999.1.2.noarch.rpm +0 -0
- data/test/deltainfo_test.rb +0 -50
- data/test/extensions_test.rb +0 -31
- data/test/index_test.rb +0 -51
- data/test/primary_test.rb +0 -51
- data/test/products_test.rb +0 -51
- data/test/repo_test.rb +0 -72
- data/test/repomdindex_test.rb +0 -58
- data/test/rpmmd_test.rb +0 -60
- data/test/susedata_test.rb +0 -53
- data/test/tempdir_test.rb +0 -62
- data/test/test_helper.rb +0 -53
- data/test/update_test.rb +0 -80
- data/test/updateinfo_test.rb +0 -59
@@ -1,5 +1,7 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
|
1
3
|
#--
|
2
|
-
#
|
4
|
+
#
|
3
5
|
# enhancerepo is a rpm-md repository metadata tool.
|
4
6
|
# Copyright (C) 2008, 2009 Novell Inc.
|
5
7
|
#
|
@@ -26,7 +28,6 @@
|
|
26
28
|
|
27
29
|
module EnhanceRepo
|
28
30
|
module RpmMd
|
29
|
-
|
30
31
|
module UpdateSmartFields
|
31
32
|
# detects references for the given
|
32
33
|
# configuration
|
@@ -44,15 +45,15 @@ module EnhanceRepo
|
|
44
45
|
# :type => 'bugzilla'
|
45
46
|
# type is just passed and set in the reference that match
|
46
47
|
# this options
|
47
|
-
def each_reference_for(opts={})
|
48
|
+
def each_reference_for(opts = {})
|
48
49
|
update = self
|
49
50
|
keywords = Set.new
|
50
|
-
keywords << opts[:keyword] if opts.
|
51
|
-
keywords = keywords.merge(opts[:keywords].to_set) if opts.
|
51
|
+
keywords << opts[:keyword] if opts.key?(:keyword)
|
52
|
+
keywords = keywords.merge(opts[:keywords].to_set) if opts.key?(:keywords)
|
52
53
|
|
53
54
|
regexps = []
|
54
55
|
keywords.each do |keyword|
|
55
|
-
specifier = keyword.each_char.map{|x| "#{x}\\\.?"}.join
|
56
|
+
specifier = keyword.each_char.map { |x| "#{x}\\\.?" }.join
|
56
57
|
regexps << "#{specifier}[-|\\\s#|\\\s|#](\\\d+[-|\\\d+]*)"
|
57
58
|
end
|
58
59
|
|
@@ -61,9 +62,9 @@ module EnhanceRepo
|
|
61
62
|
references.each do |ref_id|
|
62
63
|
ref = Reference.new
|
63
64
|
ref.referenceid = ref_id.first
|
64
|
-
ref.href = opts[:href].gsub(/:id/, ref_id.join) if opts.
|
65
|
-
ref.title = opts[:title].gsub(/:id/, ref_id.join) if opts.
|
66
|
-
ref.type = opts[:type] if opts.
|
65
|
+
ref.href = opts[:href].gsub(/:id/, ref_id.join) if opts.key?(:href)
|
66
|
+
ref.title = opts[:title].gsub(/:id/, ref_id.join) if opts.key?(:title)
|
67
|
+
ref.type = opts[:type] if opts.key?(:type)
|
67
68
|
yield ref
|
68
69
|
end
|
69
70
|
end
|
@@ -74,14 +75,14 @@ module EnhanceRepo
|
|
74
75
|
# ones
|
75
76
|
# in the update description
|
76
77
|
def each_detected_reference
|
77
|
-
each_reference_for(:
|
78
|
-
each_reference_for(:
|
79
|
-
each_reference_for(:
|
80
|
-
each_reference_for(:
|
81
|
-
each_reference_for(:
|
82
|
-
each_reference_for(:
|
78
|
+
each_reference_for(keyword: 'bnc', href: 'http://bugzilla.novell.com/:id', title: 'Novell bugzilla #:id', type: 'bugzilla') { |x| yield x }
|
79
|
+
each_reference_for(keywords: %w[rh rhbz], href: 'http://bugzilla.redhat.com/:id', title: 'Redhat bugzilla #:id', type: 'bugzilla') { |x| yield x }
|
80
|
+
each_reference_for(keyword: 'bgo', href: 'http://bugzilla.gnome.org/:id', title: 'Gnome bug #:id', type: 'bugzilla') { |x| yield x }
|
81
|
+
each_reference_for(keyword: 'kde', href: 'http://bugs.kde.org/:id', title: 'KDE bug #:id', type: 'bugzilla') { |x| yield x }
|
82
|
+
each_reference_for(keyword: 'kde', href: 'http://bugs.kde.org/:id', title: 'KDE bug #:id', type: 'bugzilla') { |x| yield x }
|
83
|
+
each_reference_for(keyword: 'cve', href: 'http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-:id', title: 'CVE-:id', type: 'cve') { |x| yield x }
|
83
84
|
end
|
84
|
-
|
85
|
+
|
85
86
|
# automatically set empty fields
|
86
87
|
# needs the description to be set to
|
87
88
|
# be somehow smart
|
@@ -95,33 +96,32 @@ module EnhanceRepo
|
|
95
96
|
end
|
96
97
|
|
97
98
|
update.title = "#{update.type} update #{update.version} "
|
98
|
-
|
99
|
+
|
99
100
|
# now figure out the title
|
100
101
|
# if there is only package
|
101
102
|
if update.packages.size == 1
|
102
103
|
# then name the fix according to the package, and the type
|
103
104
|
update.title << "for #{update.packages.first.name}"
|
104
105
|
update.updateid = update.packages.first.name
|
105
|
-
elsif update.packages.
|
106
|
+
elsif update.packages.empty?
|
106
107
|
# do nothing, it is may be just a message
|
107
108
|
else
|
108
109
|
# figure out what the multiple packages are
|
109
110
|
if update.packages.grep(/kde/).size > 1
|
110
111
|
# assume it is a KDE update
|
111
|
-
update.title <<
|
112
|
+
update.title << 'for KDE'
|
112
113
|
# KDE 3 or KDE4
|
113
|
-
update.updateid =
|
114
|
-
update.updateid =
|
114
|
+
update.updateid = 'KDE3' if update.packages.grep(/kde(.+)3$/).size > 1
|
115
|
+
update.updateid = 'KDE4' if update.packages.grep(/kde(.+)4$/).size > 1
|
115
116
|
elsif update.packages.grep(/kernel/).size > 1
|
116
|
-
update.title <<
|
117
|
+
update.title << 'for the Linux kernel'
|
117
118
|
update.updateid = 'kernel'
|
118
119
|
end
|
119
120
|
end
|
120
121
|
|
121
122
|
# now figure out and fill references
|
122
|
-
each_detected_reference { |ref| update.references << ref }
|
123
|
+
each_detected_reference { |ref| update.references << ref }
|
123
124
|
end
|
124
|
-
|
125
125
|
end
|
126
126
|
end
|
127
127
|
end
|
@@ -0,0 +1,142 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
|
3
|
+
require 'enhance_repo/pattern'
|
4
|
+
|
5
|
+
module EnhanceRepo
|
6
|
+
module Susetags
|
7
|
+
module PatternReader
|
8
|
+
def self.read_patterns_from_tags(io)
|
9
|
+
pats = []
|
10
|
+
pattern = nil
|
11
|
+
|
12
|
+
in_des = false
|
13
|
+
in_req = false
|
14
|
+
in_rec = false
|
15
|
+
in_sug = false
|
16
|
+
in_sup = false
|
17
|
+
in_con = false
|
18
|
+
in_prv = false
|
19
|
+
in_ext = false
|
20
|
+
in_inc = false
|
21
|
+
kind = 'package'
|
22
|
+
cur_lang = ''
|
23
|
+
description = ''
|
24
|
+
requires = []
|
25
|
+
recommends = []
|
26
|
+
suggests = []
|
27
|
+
io.each_line do |line|
|
28
|
+
if line.start_with?('=Pat:')
|
29
|
+
# save the previous one
|
30
|
+
pats << pattern unless pattern.nil?
|
31
|
+
# a new patern starts here
|
32
|
+
pattern = Pattern.new
|
33
|
+
v = line.split(/:\s*/, 2)
|
34
|
+
a = v[1].chomp.split(/\s/, 4)
|
35
|
+
pattern.name = a[0] if a.length >= 1
|
36
|
+
pattern.version = a[1] if a.length >= 2
|
37
|
+
pattern.release = a[2] if a.length >= 3
|
38
|
+
pattern.architecture = a[3] if a.length >= 4
|
39
|
+
elsif line.start_with?('=Cat')
|
40
|
+
v = line.match(/=Cat\.?(\w*):\s*(.*)$/)
|
41
|
+
pattern.category[(v[1]).to_s] = v[2].chomp
|
42
|
+
elsif line.start_with?('=Sum')
|
43
|
+
v = line.match(/=Sum\.?(\w*):\s*(.*)$/)
|
44
|
+
pattern.summary[(v[1]).to_s] = v[2].chomp
|
45
|
+
elsif line.start_with?('=Ico:')
|
46
|
+
v = line.split(/:\s*/, 2)
|
47
|
+
pattern.icon = v[1].chomp
|
48
|
+
elsif line.start_with?('=Ord:')
|
49
|
+
v = line.split(/:\s*/, 2)
|
50
|
+
pattern.order = v[1].chomp.to_i
|
51
|
+
elsif line.start_with?('=Vis:')
|
52
|
+
pattern.visible = if line.include?('true')
|
53
|
+
true
|
54
|
+
else
|
55
|
+
false
|
56
|
+
end
|
57
|
+
elsif line.start_with?('+Des')
|
58
|
+
in_des = true
|
59
|
+
cur_lang = line.match(/\+Des\.?(\w*):/)[1]
|
60
|
+
elsif line.start_with?('-Des')
|
61
|
+
in_des = false
|
62
|
+
pattern.description[cur_lang] = description.lstrip
|
63
|
+
cur_lang = ''
|
64
|
+
description = ''
|
65
|
+
elsif line.start_with?('+Req:')
|
66
|
+
in_req = true
|
67
|
+
kind = 'pattern'
|
68
|
+
elsif line.start_with?('-Req:')
|
69
|
+
in_req = false
|
70
|
+
kind = 'package'
|
71
|
+
elsif line.start_with?('+Sup:')
|
72
|
+
in_sup = true
|
73
|
+
kind = 'pattern'
|
74
|
+
elsif line.start_with?('-Sup:')
|
75
|
+
in_sup = false
|
76
|
+
kind = 'package'
|
77
|
+
elsif line.start_with?('+Con:')
|
78
|
+
in_con = true
|
79
|
+
kind = 'pattern'
|
80
|
+
elsif line.start_with?('-Con:')
|
81
|
+
in_con = false
|
82
|
+
kind = 'package'
|
83
|
+
elsif line.start_with?('+Prv:')
|
84
|
+
in_prv = true
|
85
|
+
kind = 'pattern'
|
86
|
+
elsif line.start_with?('-Prv:')
|
87
|
+
in_prv = false
|
88
|
+
kind = 'package'
|
89
|
+
elsif line.start_with?('+Prc:')
|
90
|
+
in_rec = true
|
91
|
+
kind = 'package'
|
92
|
+
elsif line.start_with?('-Prc:')
|
93
|
+
in_rec = false
|
94
|
+
elsif line.start_with?('+Prq:')
|
95
|
+
in_req = true
|
96
|
+
kind = 'package'
|
97
|
+
elsif line.start_with?('-Prq:')
|
98
|
+
in_req = false
|
99
|
+
elsif line.start_with?('+Psg:')
|
100
|
+
in_sug = true
|
101
|
+
kind = 'package'
|
102
|
+
elsif line.start_with?('-Psg:')
|
103
|
+
in_sug = false
|
104
|
+
elsif line.start_with?('+Ext:')
|
105
|
+
in_ext = true
|
106
|
+
kind = 'pattern'
|
107
|
+
elsif line.start_with?('-Ext:')
|
108
|
+
in_ext = false
|
109
|
+
kind = 'package'
|
110
|
+
elsif line.start_with?('+Inc:')
|
111
|
+
in_req = true
|
112
|
+
kind = 'pattern'
|
113
|
+
elsif line.start_with?('-Inc:')
|
114
|
+
in_inc = false
|
115
|
+
kind = 'package'
|
116
|
+
elsif in_des
|
117
|
+
description << line
|
118
|
+
elsif in_con
|
119
|
+
pattern.conflicts[line.chomp] = kind
|
120
|
+
elsif in_sup
|
121
|
+
pattern.supplements[line.chomp] = kind
|
122
|
+
elsif in_prv
|
123
|
+
pattern.provides[line.chomp] = kind
|
124
|
+
elsif in_req
|
125
|
+
pattern.requires[line.chomp] = kind
|
126
|
+
elsif in_rec
|
127
|
+
pattern.recommends[line.chomp] = kind
|
128
|
+
elsif in_sug
|
129
|
+
pattern.suggests[line.chomp] = kind
|
130
|
+
elsif in_ext
|
131
|
+
pattern.extends[line.chomp] = kind
|
132
|
+
elsif in_inc
|
133
|
+
pattern.includes[line.chomp] = kind
|
134
|
+
end
|
135
|
+
end
|
136
|
+
# the last pattern
|
137
|
+
pats << pattern unless pattern.nil?
|
138
|
+
pats
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
@@ -1,24 +1,29 @@
|
|
1
|
+
# Encoding: utf-8
|
2
|
+
|
3
|
+
#
|
1
4
|
# The MIT License
|
2
5
|
#
|
3
6
|
# Copyright (c) 2009:
|
4
7
|
#
|
5
8
|
# Thilo Utke (thilo[at]upstream-berlin[dot]com)
|
6
9
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
7
|
-
#
|
10
|
+
#
|
8
11
|
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
9
|
-
#
|
12
|
+
#
|
10
13
|
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
11
|
-
#
|
14
|
+
#
|
12
15
|
require 'nokogiri'
|
16
|
+
require 'active_support/core_ext/hash/keys'
|
13
17
|
|
14
18
|
class XmlComparer
|
15
19
|
attr_reader :missing_nodes, :different_nodes, :superfluous_nodes
|
16
|
-
|
20
|
+
|
17
21
|
def initialize(options = {})
|
18
22
|
options.symbolize_keys!
|
19
23
|
@custom_matcher = options.delete(:custom_matcher)
|
20
24
|
@show_messages = options.delete(:show_messages)
|
21
25
|
end
|
26
|
+
|
22
27
|
def compare(target, sample)
|
23
28
|
@target_doc = Nokogiri::XML::Document.parse(target, nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS)
|
24
29
|
@sample_doc = Nokogiri::XML::Document.parse(sample, nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS)
|
@@ -30,78 +35,77 @@ class XmlComparer
|
|
30
35
|
p result_messages if @show_messages
|
31
36
|
are_equal?
|
32
37
|
end
|
33
|
-
|
38
|
+
|
34
39
|
def result_messages
|
35
40
|
missing_result_messages
|
36
41
|
superfluous_nodes_messages
|
37
42
|
different_nodes_messages
|
38
43
|
end
|
39
|
-
|
44
|
+
|
40
45
|
private
|
41
|
-
|
46
|
+
|
42
47
|
def are_equal?
|
43
48
|
@missing_nodes.empty? && @different_nodes.empty? && @superfluous_nodes.empty?
|
44
49
|
end
|
45
|
-
|
50
|
+
|
46
51
|
def missing_result_messages
|
47
52
|
puts "\nFollowing nodes are missing:\n" unless @missing_nodes.empty?
|
48
53
|
@missing_nodes.each do |node|
|
49
|
-
puts "#{node
|
54
|
+
puts "#{node} at #{node.path}\n"
|
50
55
|
end
|
51
56
|
end
|
52
|
-
|
57
|
+
|
53
58
|
def superfluous_nodes_messages
|
54
59
|
puts "\nFollowing nodes are superfluous:\n" unless @superfluous_nodes.empty?
|
55
60
|
@superfluous_nodes.each do |node|
|
56
|
-
puts "#{node
|
61
|
+
puts "#{node} at #{node.path}\n"
|
57
62
|
end
|
58
63
|
end
|
59
|
-
|
64
|
+
|
60
65
|
def different_nodes_messages
|
61
66
|
puts "\nFollowing nodes are different:\n" unless @different_nodes.empty?
|
62
67
|
@different_nodes.each do |node_pair|
|
63
|
-
puts "#{node_pair[0]
|
68
|
+
puts "#{node_pair[0]} vs #{node_pair[1]} at #{node_pair[0].path}\n"
|
64
69
|
end
|
65
70
|
end
|
66
|
-
|
67
|
-
|
71
|
+
|
68
72
|
def standard_traverse_and_compare
|
69
73
|
traverse_and_compare(@target_doc, @sample_doc)
|
70
74
|
end
|
71
|
-
|
75
|
+
|
72
76
|
def reverse_traverse_and_compare
|
73
77
|
traverse_and_compare(@sample_doc, @target_doc)
|
74
78
|
end
|
75
|
-
|
79
|
+
|
76
80
|
def traverse_and_compare(doc, other_doc)
|
77
81
|
doc.root.traverse do |node|
|
78
82
|
other_node = find_sibling_in_other_doc(node, other_doc)
|
79
83
|
if other_node.nil?
|
80
84
|
add_to_missing_or_superfluous(node, doc)
|
81
85
|
else
|
82
|
-
@different_nodes << [node, other_node] unless in_reverse_traverse?(doc) || equal_nodes?(node, other_node)
|
86
|
+
@different_nodes << [node, other_node] unless in_reverse_traverse?(doc) || equal_nodes?(node, other_node)
|
83
87
|
end
|
84
88
|
end
|
85
89
|
end
|
86
|
-
|
90
|
+
|
87
91
|
def find_sibling_in_other_doc(node, doc)
|
88
92
|
sibling_in_other_doc = doc.search(node.path).first
|
89
93
|
sibling_in_other_doc
|
90
94
|
end
|
91
|
-
|
95
|
+
|
92
96
|
def add_to_missing_or_superfluous(node, doc)
|
93
97
|
(in_reverse_traverse?(doc) ? @superfluous_nodes : @missing_nodes) << node
|
94
98
|
end
|
95
|
-
|
99
|
+
|
96
100
|
def in_reverse_traverse?(doc)
|
97
101
|
doc == @sample_doc
|
98
102
|
end
|
99
|
-
|
103
|
+
|
100
104
|
def equal_nodes?(node, other_node)
|
101
105
|
return false unless node && other_node
|
102
106
|
standard_compare(node, other_node) || custom_compare(node, other_node)
|
103
107
|
end
|
104
|
-
|
108
|
+
|
105
109
|
def standard_compare(node, other_node)
|
106
110
|
if node.text?
|
107
111
|
node.text.strip == other_node.text.strip
|
@@ -109,7 +113,7 @@ class XmlComparer
|
|
109
113
|
Set.new(node.keys) == Set.new(other_node.keys) && Set.new(node.values) == Set.new(other_node.values)
|
110
114
|
end
|
111
115
|
end
|
112
|
-
|
116
|
+
|
113
117
|
def custom_compare(node, other_node)
|
114
118
|
return false unless @custom_matcher
|
115
119
|
@custom_matcher.call(node) && @custom_matcher.call(other_node)
|
metadata
CHANGED
@@ -1,267 +1,236 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: enhancerepo
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
7
|
-
- Duncan Mac-Vicar
|
6
|
+
authors:
|
7
|
+
- Duncan Mac-Vicar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
date: 2017-09-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rpm
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
17
20
|
type: :runtime
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
21
24
|
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: builder
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
27
34
|
type: :runtime
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
31
38
|
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
|
35
|
-
- !ruby/object:Gem::Dependency
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
36
42
|
name: nokogiri
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
37
48
|
type: :runtime
|
38
|
-
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
|
-
requirements:
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: trollop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
41
59
|
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version:
|
44
|
-
|
45
|
-
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: log4r
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
46
84
|
name: activesupport
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
47
90
|
type: :runtime
|
48
|
-
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
51
94
|
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version:
|
54
|
-
|
55
|
-
|
56
|
-
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.49.1
|
57
104
|
type: :development
|
58
|
-
|
59
|
-
version_requirements: !ruby/object:Gem::Requirement
|
60
|
-
requirements:
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.49.1
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: bundler
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
61
115
|
- - ">="
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version:
|
64
|
-
version:
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: gemcutter
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.0.rc.2
|
67
118
|
type: :development
|
68
|
-
|
69
|
-
version_requirements: !ruby/object:Gem::Requirement
|
70
|
-
requirements:
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
71
122
|
- - ">="
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
version: 0.
|
74
|
-
|
75
|
-
- !ruby/object:Gem::Dependency
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.0.rc.2
|
125
|
+
- !ruby/object:Gem::Dependency
|
76
126
|
name: yard
|
77
|
-
|
78
|
-
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
81
129
|
- - ">="
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: 0.5
|
84
|
-
version:
|
85
|
-
- !ruby/object:Gem::Dependency
|
86
|
-
name: hoe-yard
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.5'
|
87
132
|
type: :development
|
88
|
-
|
89
|
-
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
requirements:
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
91
136
|
- - ">="
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: 0.
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
version_requirement:
|
99
|
-
version_requirements: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.5'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: diffy
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
101
143
|
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version:
|
104
|
-
version:
|
105
|
-
- !ruby/object:Gem::Dependency
|
106
|
-
name: mocha
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
107
146
|
type: :development
|
108
|
-
|
109
|
-
version_requirements: !ruby/object:Gem::Requirement
|
110
|
-
requirements:
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
111
150
|
- - ">="
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
version:
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
version_requirement:
|
119
|
-
version_requirements: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: equivalent-xml
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
121
157
|
- - ">="
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version:
|
124
|
-
version:
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: hoe
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
127
160
|
type: :development
|
128
|
-
|
129
|
-
version_requirements: !ruby/object:Gem::Requirement
|
130
|
-
requirements:
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
131
164
|
- - ">="
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version:
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
servers as the testbed for the specification
|
138
|
-
email:
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
description: enhancerepo adds additional metadata to repommd repositories and serves
|
168
|
+
as the testbed for the specification
|
169
|
+
email:
|
139
170
|
- dmacvicar@suse.de
|
140
|
-
executables:
|
171
|
+
executables:
|
141
172
|
- enhancerepo
|
142
173
|
extensions: []
|
143
|
-
|
144
|
-
|
145
|
-
-
|
146
|
-
-
|
147
|
-
- CHANGELOG.rdoc
|
148
|
-
- TODO.rdoc
|
149
|
-
files:
|
174
|
+
extra_rdoc_files: []
|
175
|
+
files:
|
176
|
+
- README.md
|
177
|
+
- bin/enhancerepo
|
150
178
|
- lib/enhance_repo.rb
|
151
|
-
- lib/
|
152
|
-
- lib/enhance_repo/
|
153
|
-
- lib/enhance_repo/
|
179
|
+
- lib/enhance_repo/array_arg.rb
|
180
|
+
- lib/enhance_repo/cli.rb
|
181
|
+
- lib/enhance_repo/config_opts.rb
|
182
|
+
- lib/enhance_repo/logger.rb
|
183
|
+
- lib/enhance_repo/other.rb
|
154
184
|
- lib/enhance_repo/package_id.rb
|
155
|
-
- lib/enhance_repo/
|
156
|
-
- lib/enhance_repo/
|
157
|
-
- lib/enhance_repo/rpm_md
|
158
|
-
- lib/enhance_repo/rpm_md/resource.rb
|
185
|
+
- lib/enhance_repo/pattern.rb
|
186
|
+
- lib/enhance_repo/product_id.rb
|
187
|
+
- lib/enhance_repo/rpm_md.rb
|
159
188
|
- lib/enhance_repo/rpm_md/data.rb
|
160
189
|
- lib/enhance_repo/rpm_md/delta_info.rb
|
161
|
-
- lib/enhance_repo/rpm_md/
|
162
|
-
- lib/enhance_repo/rpm_md/other.rb
|
163
|
-
- lib/enhance_repo/rpm_md/index.rb
|
164
|
-
- lib/enhance_repo/rpm_md/update_smart_fields.rb
|
165
|
-
- lib/enhance_repo/rpm_md/update_info.rb
|
190
|
+
- lib/enhance_repo/rpm_md/extra_primary_data.rb
|
166
191
|
- lib/enhance_repo/rpm_md/file_lists.rb
|
167
|
-
- lib/enhance_repo/rpm_md/
|
192
|
+
- lib/enhance_repo/rpm_md/index.rb
|
193
|
+
- lib/enhance_repo/rpm_md/other.rb
|
194
|
+
- lib/enhance_repo/rpm_md/pattern_writer.rb
|
195
|
+
- lib/enhance_repo/rpm_md/patterns.rb
|
196
|
+
- lib/enhance_repo/rpm_md/primary.rb
|
168
197
|
- lib/enhance_repo/rpm_md/products.rb
|
169
|
-
- lib/enhance_repo/rpm_md/
|
170
|
-
- lib/enhance_repo/
|
171
|
-
- lib/enhance_repo/
|
172
|
-
- lib/enhance_repo/
|
173
|
-
- lib/enhance_repo/
|
174
|
-
- lib/enhance_repo/
|
175
|
-
- lib/
|
176
|
-
-
|
177
|
-
-
|
178
|
-
-
|
179
|
-
- test/tempdir_test.rb
|
180
|
-
- test/products_test.rb
|
181
|
-
- test/primary_test.rb
|
182
|
-
- test/rpmmd_test.rb
|
183
|
-
- test/test_helper.rb
|
184
|
-
- test/repomdindex_test.rb
|
185
|
-
- test/all_tests.rb
|
186
|
-
- test/index_test.rb
|
187
|
-
- test/deltainfo_test.rb
|
188
|
-
- test/extensions_test.rb
|
189
|
-
- test/update_test.rb
|
190
|
-
- test/data/rpms/repo-1/repodata/susedata.xml.gz
|
191
|
-
- test/data/rpms/repo-1/repodata/filelists.xml.gz
|
192
|
-
- test/data/rpms/repo-1/repodata/deltainfo.xml.gz.gz
|
193
|
-
- test/data/rpms/repo-1/repodata/deltainfo.xml.gz
|
194
|
-
- test/data/rpms/repo-1/repodata/other.xml.gz
|
195
|
-
- test/data/rpms/repo-1/repodata/updateinfo.xml.gz
|
196
|
-
- test/data/rpms/repo-1/repodata/repomd.xml
|
197
|
-
- test/data/rpms/repo-1/repodata/primary.xml.gz
|
198
|
-
- test/data/rpms/repo-1/a-1.0-0.x86_64.rpm
|
199
|
-
- test/data/rpms/repo-1/a-2.0-0.x86_64.rpm
|
200
|
-
- test/data/rpms/repo-1/a-1.0_2.0-0_0.x86_64.delta.rpm
|
201
|
-
- test/data/rpms/repo-1/repoparts/update-a-1.xml
|
202
|
-
- test/data/rpms/repo-with-product/repodata/filelists.xml.gz
|
203
|
-
- test/data/rpms/repo-with-product/repodata/products.xml.gz
|
204
|
-
- test/data/rpms/repo-with-product/repodata/other.xml.gz
|
205
|
-
- test/data/rpms/repo-with-product/repodata/repomd.xml
|
206
|
-
- test/data/rpms/repo-with-product/repodata/primary.xml.gz
|
207
|
-
- test/data/rpms/repo-with-product/a-1.0-0.x86_64.rpm
|
208
|
-
- test/data/rpms/repo-with-product/openSUSE-release-11.2-1.6.i586.rpm
|
209
|
-
- test/data/rpms/repo-with-product/openSUSE-release-dvd-11.2-1.6.i586.rpm
|
210
|
-
- test/data/rpms/update-test-factory/update-test-reboot-needed-0-9999.1.2.noarch.rpm
|
211
|
-
- test/data/rpms/update-test-factory/update-test-security-0-9999.1.2.noarch.rpm
|
212
|
-
- test/data/rpms/update-test-factory/update-test-affects-package-manager-0-9999.1.2.noarch.rpm
|
213
|
-
- test/data/rpms/update-test-factory/update-test-interactive-0-9999.1.2.noarch.rpm
|
214
|
-
- test/data/rpms/update-test-factory/update-test-relogin-suggested-0-9999.1.2.noarch.rpm
|
215
|
-
- test/data/rpms/update-test-factory/update-test-optional-0-9999.1.2.noarch.rpm
|
216
|
-
- test/data/rpms/update-test-11.1/update-test-trival.rpm
|
217
|
-
- test/data/rpms/update-test-11.1/update-test-optional.rpm
|
218
|
-
- test/data/rpms/update-test-11.1/update-test-security.rpm
|
219
|
-
- test/data/rpms/update-test-11.1/update-test-reboot-needed.rpm
|
220
|
-
- test/data/rpms/update-test-11.1/update-test-affects-package-manager.rpm
|
221
|
-
- test/data/rpms/update-test-11.1/update-test-interactive.rpm
|
222
|
-
- test/data/repodata/update-test-11.1/filelists.xml.gz
|
223
|
-
- test/data/repodata/update-test-11.1/other.xml.gz
|
224
|
-
- test/data/repodata/update-test-11.1/repomd.xml
|
225
|
-
- test/data/repodata/update-test-11.1/primary.xml.gz
|
226
|
-
- test/data/packages/a-2.0.spec
|
227
|
-
- test/data/packages/a-1.0.spec
|
228
|
-
- test/data/repomd.xml
|
229
|
-
- Rakefile
|
230
|
-
- README
|
231
|
-
- README.rdoc
|
232
|
-
- CHANGELOG.rdoc
|
233
|
-
- bin/enhancerepo
|
234
|
-
- Manifest.txt
|
235
|
-
- TODO.rdoc
|
236
|
-
has_rdoc: yard
|
198
|
+
- lib/enhance_repo/rpm_md/repo.rb
|
199
|
+
- lib/enhance_repo/rpm_md/resource.rb
|
200
|
+
- lib/enhance_repo/rpm_md/suse_data.rb
|
201
|
+
- lib/enhance_repo/rpm_md/suse_info.rb
|
202
|
+
- lib/enhance_repo/rpm_md/update.rb
|
203
|
+
- lib/enhance_repo/rpm_md/update_info.rb
|
204
|
+
- lib/enhance_repo/rpm_md/update_smart_fields.rb
|
205
|
+
- lib/enhance_repo/susetags/pattern_reader.rb
|
206
|
+
- lib/enhance_repo/version.rb
|
207
|
+
- lib/enhance_repo/xml_comparer.rb
|
237
208
|
homepage: http://en.opensuse.org/Enhancerepo
|
238
209
|
licenses: []
|
210
|
+
metadata: {}
|
211
|
+
post_install_message: |2+
|
212
|
+
____
|
213
|
+
/@ ~-.
|
214
|
+
/ __ .- | remember to have fun!
|
215
|
+
// // @
|
239
216
|
|
240
|
-
|
241
|
-
|
242
|
-
- --title
|
243
|
-
- Enhancerepo Documentation
|
244
|
-
- --quiet
|
245
|
-
require_paths:
|
217
|
+
rdoc_options: []
|
218
|
+
require_paths:
|
246
219
|
- lib
|
247
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
248
|
-
requirements:
|
220
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
221
|
+
requirements:
|
249
222
|
- - ">="
|
250
|
-
- !ruby/object:Gem::Version
|
251
|
-
version:
|
252
|
-
|
253
|
-
|
254
|
-
requirements:
|
223
|
+
- !ruby/object:Gem::Version
|
224
|
+
version: '0'
|
225
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
255
227
|
- - ">="
|
256
|
-
- !ruby/object:Gem::Version
|
257
|
-
version:
|
258
|
-
version:
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: 1.3.6
|
259
230
|
requirements: []
|
260
|
-
|
261
|
-
|
262
|
-
rubygems_version: 1.3.5
|
231
|
+
rubyforge_project:
|
232
|
+
rubygems_version: 2.6.11
|
263
233
|
signing_key:
|
264
|
-
specification_version:
|
265
|
-
summary:
|
266
|
-
test_files:
|
267
|
-
- test/test_helper.rb
|
234
|
+
specification_version: 4
|
235
|
+
summary: Tool to add additional information to repomd repositories
|
236
|
+
test_files: []
|