enhancerepo 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +18 -0
- data/Manifest.txt +85 -0
- data/README +10 -0
- data/README.rdoc +15 -0
- data/Rakefile +48 -0
- data/TODO.rdoc +4 -0
- data/bin/enhancerepo +4 -0
- data/lib/enhance_repo.rb +36 -0
- data/lib/enhance_repo/cli.rb +150 -0
- data/lib/enhance_repo/config_opts.rb +98 -0
- data/lib/enhance_repo/logger.rb +67 -0
- data/lib/enhance_repo/other.rb +80 -0
- data/lib/enhance_repo/package_id.rb +81 -0
- data/lib/enhance_repo/product_id.rb +30 -0
- data/lib/enhance_repo/rpm_md.rb +27 -0
- data/lib/enhance_repo/rpm_md/data.rb +55 -0
- data/lib/enhance_repo/rpm_md/delta_info.rb +205 -0
- data/lib/enhance_repo/rpm_md/extra_primary_data.rb +45 -0
- data/lib/enhance_repo/rpm_md/file_lists.rb +81 -0
- data/lib/enhance_repo/rpm_md/index.rb +144 -0
- data/lib/enhance_repo/rpm_md/other.rb +69 -0
- data/lib/enhance_repo/rpm_md/primary.rb +123 -0
- data/lib/enhance_repo/rpm_md/products.rb +142 -0
- data/lib/enhance_repo/rpm_md/repo.rb +202 -0
- data/lib/enhance_repo/rpm_md/resource.rb +44 -0
- data/lib/enhance_repo/rpm_md/suse_data.rb +191 -0
- data/lib/enhance_repo/rpm_md/suse_info.rb +88 -0
- data/lib/enhance_repo/rpm_md/update.rb +141 -0
- data/lib/enhance_repo/rpm_md/update_info.rb +244 -0
- data/lib/enhance_repo/rpm_md/update_smart_fields.rb +127 -0
- data/lib/enhance_repo/xml_comparer.rb +117 -0
- data/lib/tempdir.rb +62 -0
- data/lib/tempdir/tempfile.rb +21 -0
- data/test/all_tests.rb +27 -0
- data/test/data/packages/a-1.0.spec +19 -0
- data/test/data/packages/a-2.0.spec +24 -0
- 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 +21 -0
- data/test/data/repomd.xml +21 -0
- 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 +45 -0
- 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 +22 -0
- 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 +27 -0
- 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 +50 -0
- data/test/extensions_test.rb +31 -0
- data/test/index_test.rb +51 -0
- data/test/primary_test.rb +51 -0
- data/test/products_test.rb +51 -0
- data/test/repo_test.rb +72 -0
- data/test/repomdindex_test.rb +58 -0
- data/test/rpmmd_test.rb +60 -0
- data/test/susedata_test.rb +53 -0
- data/test/tempdir_test.rb +62 -0
- data/test/test_helper.rb +53 -0
- data/test/update_test.rb +80 -0
- data/test/updateinfo_test.rb +59 -0
- metadata +267 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
#--
|
2
|
+
#
|
3
|
+
# enhancerepo is a rpm-md repository metadata tool.
|
4
|
+
# Copyright (C) 2008, 2009 Novell Inc.
|
5
|
+
# Author: Duncan Mac-Vicar P. <dmacvicar@suse.de>
|
6
|
+
#
|
7
|
+
# This program is free software; you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation; either version 2 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with this program; if not, write to the Free Software
|
19
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
20
|
+
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
21
|
+
# also available at http://www.gnu.org/copyleft/gpl.html.
|
22
|
+
#
|
23
|
+
#++
|
24
|
+
#
|
25
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
26
|
+
require 'enhance_repo'
|
27
|
+
|
28
|
+
class TC_RepoMdIndex < Test::Unit::TestCase
|
29
|
+
|
30
|
+
# def assert_not_diff(one, second, message = nil)
|
31
|
+
#
|
32
|
+
# message = build_message message, '<?> is not false or nil.', boolean
|
33
|
+
# assert_block message do
|
34
|
+
# not boolean
|
35
|
+
# end
|
36
|
+
# end
|
37
|
+
|
38
|
+
def setup
|
39
|
+
@index = EnhanceRepo::RpmMd::Index.new
|
40
|
+
end
|
41
|
+
|
42
|
+
# def teardown
|
43
|
+
# end
|
44
|
+
|
45
|
+
def test_read_write
|
46
|
+
repomdpath = test_data('repomd.xml')
|
47
|
+
index_content = File.new(repomdpath).read
|
48
|
+
@index.read_file(File.new(repomdpath))
|
49
|
+
|
50
|
+
# now that the file is parsed, lets test wether it
|
51
|
+
# is parsed correctly
|
52
|
+
assert_equal(3, @index.resources.size)
|
53
|
+
|
54
|
+
dump_content = String.new
|
55
|
+
@index.write(dump_content)
|
56
|
+
assert_xml_equal(index_content, dump_content)
|
57
|
+
end
|
58
|
+
end
|
data/test/rpmmd_test.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
#--
|
2
|
+
#
|
3
|
+
# enhancerepo is a rpm-md repository metadata tool.
|
4
|
+
# Copyright (C) 2008, 2009 Novell Inc.
|
5
|
+
# Author: Duncan Mac-Vicar P. <dmacvicar@suse.de>
|
6
|
+
#
|
7
|
+
# This program is free software; you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation; either version 2 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with this program; if not, write to the Free Software
|
19
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
20
|
+
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
21
|
+
# also available at http://www.gnu.org/copyleft/gpl.html.
|
22
|
+
#
|
23
|
+
#++
|
24
|
+
#
|
25
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
26
|
+
require 'tmpdir'
|
27
|
+
require 'pathname'
|
28
|
+
require 'rubygems'
|
29
|
+
require 'enhance_repo'
|
30
|
+
require 'stringio'
|
31
|
+
|
32
|
+
class RpmMd_test < Test::Unit::TestCase
|
33
|
+
|
34
|
+
def setup
|
35
|
+
rpms = Pathname.new(File.join(File.dirname(__FILE__), 'data', 'rpms'))
|
36
|
+
@rpms1 = rpms + 'update-test-11.1'
|
37
|
+
@rpms3 = rpms + 'update-test-factory'
|
38
|
+
end
|
39
|
+
|
40
|
+
# def teardown
|
41
|
+
# end
|
42
|
+
|
43
|
+
def test_disk_info
|
44
|
+
config = EnhanceRepo::ConfigOpts.new
|
45
|
+
config.outputdir = Pathname.new(File.join(Dir.tmpdir, 'enhancerepo#{Time.now.to_i}'))
|
46
|
+
config.dir = @rpms1
|
47
|
+
@repo = EnhanceRepo::RpmMd::Repo.new(config)
|
48
|
+
@repo.primary.read_packages
|
49
|
+
out = StringIO.new
|
50
|
+
@repo.primary.write(out)
|
51
|
+
#puts out.string
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_update_info
|
56
|
+
#config.generate_update = packages
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
#--
|
2
|
+
#
|
3
|
+
# enhancerepo is a rpm-md repository metadata tool.
|
4
|
+
# Copyright (C) 2008, 2009 Novell Inc.
|
5
|
+
# Author: Duncan Mac-Vicar P. <dmacvicar@suse.de>
|
6
|
+
#
|
7
|
+
# This program is free software; you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation; either version 2 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with this program; if not, write to the Free Software
|
19
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
20
|
+
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
21
|
+
# also available at http://www.gnu.org/copyleft/gpl.html.
|
22
|
+
#
|
23
|
+
#++
|
24
|
+
#
|
25
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
26
|
+
require 'tmpdir'
|
27
|
+
require 'enhance_repo'
|
28
|
+
require 'stringio'
|
29
|
+
require 'zlib'
|
30
|
+
|
31
|
+
class SuseData_test < Test::Unit::TestCase
|
32
|
+
|
33
|
+
def setup
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_xml_output
|
37
|
+
susedata = EnhanceRepo::RpmMd::SuseData.new(test_data('rpms/repo-1'))
|
38
|
+
susedata.add_disk_usage
|
39
|
+
susedata.add_keywords
|
40
|
+
susedata.add_eulas
|
41
|
+
|
42
|
+
assert ! susedata.empty?
|
43
|
+
|
44
|
+
assert_equal 3, susedata.size
|
45
|
+
|
46
|
+
Zlib::GzipReader.open(test_data('rpms/repo-1/repodata/susedata.xml.gz')) do |expected_susedata|
|
47
|
+
|
48
|
+
buffer = StringIO.new
|
49
|
+
susedata.write(buffer)
|
50
|
+
assert_xml_equal(expected_susedata.read, buffer.string)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Author:: Yuichi Tateno <hotchpotch@gmail.com>
|
2
|
+
# Copyright:: Copyright (c) 2008 Yuichi Tateno
|
3
|
+
# License:: MIT
|
4
|
+
|
5
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
6
|
+
|
7
|
+
require "test/unit"
|
8
|
+
require "tempdir"
|
9
|
+
require "tempdir/tempfile"
|
10
|
+
|
11
|
+
class TempdirTest < Test::Unit::TestCase
|
12
|
+
def test_open
|
13
|
+
_dir = nil
|
14
|
+
Tempdir.open do |dir|
|
15
|
+
assert dir.directory?
|
16
|
+
assert_equal dir.class, Pathname
|
17
|
+
_dir = dir.clone
|
18
|
+
end
|
19
|
+
assert !_dir.directory?
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_tempdir
|
23
|
+
begin
|
24
|
+
assert_equal Tempdir.tmpdir.to_s, Dir.tmpdir.to_s
|
25
|
+
Tempdir.tmpdir = Dir.tmpdir + '/foobar'
|
26
|
+
assert_equal Tempdir.tmpdir.to_s, Pathname.new(Dir.tmpdir + '/foobar').to_s
|
27
|
+
ensure
|
28
|
+
Tempdir.tmpdir = Dir.tmpdir
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_new
|
33
|
+
tmpdir = Tempdir.new
|
34
|
+
assert tmpdir.dir.directory?
|
35
|
+
_dir = tmpdir.dir.clone
|
36
|
+
tmpdir.close
|
37
|
+
assert !_dir.directory?
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_open_with_name
|
41
|
+
_dir = nil
|
42
|
+
Tempdir.open('adfklvucoiae89u893qakj') do |dir|
|
43
|
+
assert dir.directory?
|
44
|
+
_dir = dir.clone
|
45
|
+
end
|
46
|
+
assert !_dir.directory?
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_new_with_name
|
50
|
+
tmpdir = Tempdir.new('asdfkjvijoaeeeeeegvafkldj12839uy')
|
51
|
+
assert tmpdir.dir.directory?
|
52
|
+
_dir = tmpdir.dir.clone
|
53
|
+
tmpdir.close
|
54
|
+
assert !_dir.directory?
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_tempfile
|
58
|
+
Tempdir::Tempfile.open {|f|
|
59
|
+
assert f
|
60
|
+
}
|
61
|
+
end
|
62
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
#--
|
2
|
+
#
|
3
|
+
# enhancerepo is a rpm-md repository metadata tool.
|
4
|
+
# Copyright (C) 2008, 2009 Novell Inc.
|
5
|
+
# Author: Duncan Mac-Vicar P. <dmacvicar@suse.de>
|
6
|
+
#
|
7
|
+
# This program is free software; you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation; either version 2 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# This program is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with this program; if not, write to the Free Software
|
19
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
20
|
+
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
21
|
+
# also available at http://www.gnu.org/copyleft/gpl.html.
|
22
|
+
#
|
23
|
+
#++
|
24
|
+
#
|
25
|
+
require 'rubygems'
|
26
|
+
require 'test/unit'
|
27
|
+
require 'shoulda'
|
28
|
+
require 'mocha'
|
29
|
+
|
30
|
+
$: << File.join(File.dirname(__FILE__), "..", "lib")
|
31
|
+
require 'enhance_repo'
|
32
|
+
require 'enhance_repo/xml_comparer'
|
33
|
+
require 'active_support'
|
34
|
+
|
35
|
+
EnhanceRepo::enable_logger
|
36
|
+
|
37
|
+
def test_data(name)
|
38
|
+
File.join(File.dirname(__FILE__), "data", name)
|
39
|
+
end
|
40
|
+
|
41
|
+
# compare xml files
|
42
|
+
module Test
|
43
|
+
module Unit
|
44
|
+
module Assertions
|
45
|
+
def assert_xml_equal(expected, result)
|
46
|
+
comparer = XmlComparer.new(:show_messages => true)
|
47
|
+
assert comparer.compare(expected, result)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
|
data/test/update_test.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
|
2
|
+
#--
|
3
|
+
#
|
4
|
+
# enhancerepo is a rpm-md repository metadata tool.
|
5
|
+
# Copyright (C) 2008, 2009 Novell Inc.
|
6
|
+
# Author: Duncan Mac-Vicar P. <dmacvicar@suse.de>
|
7
|
+
#
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program; if not, write to the Free Software
|
20
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
21
|
+
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
22
|
+
# also available at http://www.gnu.org/copyleft/gpl.html.
|
23
|
+
#
|
24
|
+
#++
|
25
|
+
#
|
26
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
27
|
+
require 'enhance_repo'
|
28
|
+
require 'enhance_repo/rpm_md/update'
|
29
|
+
|
30
|
+
require 'tempdir'
|
31
|
+
require 'stringio'
|
32
|
+
|
33
|
+
class Update_test < Test::Unit::TestCase
|
34
|
+
|
35
|
+
def setup
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_smart_fill_blanks
|
39
|
+
update = EnhanceRepo::RpmMd::Update.new
|
40
|
+
|
41
|
+
update.description = "fix crash on exit"
|
42
|
+
#assert_equal "recommended", update
|
43
|
+
|
44
|
+
# simple test
|
45
|
+
update.description = "bnc#1245 b.nc-4566 BNC 123 cve-3443-434 CVE-3333 bug 1234"
|
46
|
+
refs = []
|
47
|
+
update.each_reference_for(:keyword => 'bnc', :href => 'http://novell.com/:id', :title => 'novell bug #:id') do |r|
|
48
|
+
refs << r
|
49
|
+
end
|
50
|
+
refs.each { |r| puts r.inspect }
|
51
|
+
assert_equal 3, refs.size, "3 references should be detected"
|
52
|
+
|
53
|
+
# test for FOO xxxx-yyyy
|
54
|
+
refs = []
|
55
|
+
update.each_reference_for(:keyword => 'cve', :href => 'http://cve.com/:id', :title => 'cve advisory #:id') do |r|
|
56
|
+
refs << r
|
57
|
+
end
|
58
|
+
refs.each { |r| puts r.inspect }
|
59
|
+
assert_equal 2, refs.size, "2 CVE references should be detected"
|
60
|
+
|
61
|
+
# test for multiple keywords
|
62
|
+
refs = []
|
63
|
+
update.each_reference_for(:keywords => ['bug', 'bnc'], :href => 'http://novell.com/:id', :title => 'bug #:id') do |r|
|
64
|
+
refs << r
|
65
|
+
end
|
66
|
+
refs.each { |r| puts r.inspect }
|
67
|
+
assert_equal 4, refs.size, "4 bugs should be detected"
|
68
|
+
|
69
|
+
# test the pre-configured reference detectors
|
70
|
+
refs = []
|
71
|
+
update.each_detected_reference do |r|
|
72
|
+
refs << r
|
73
|
+
end
|
74
|
+
puts
|
75
|
+
refs.each { |r| puts r.inspect }
|
76
|
+
assert_equal 5, refs.size, "4 bugs should be detected"
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
|
2
|
+
#--
|
3
|
+
#
|
4
|
+
# enhancerepo is a rpm-md repository metadata tool.
|
5
|
+
# Copyright (C) 2008, 2009 Novell Inc.
|
6
|
+
# Author: Duncan Mac-Vicar P. <dmacvicar@suse.de>
|
7
|
+
#
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
10
|
+
# the Free Software Foundation; either version 2 of the License, or
|
11
|
+
# (at your option) any later version.
|
12
|
+
#
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
+
# GNU General Public License for more details.
|
17
|
+
#
|
18
|
+
# You should have received a copy of the GNU General Public License
|
19
|
+
# along with this program; if not, write to the Free Software
|
20
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
21
|
+
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
22
|
+
# also available at http://www.gnu.org/copyleft/gpl.html.
|
23
|
+
#
|
24
|
+
#++
|
25
|
+
#
|
26
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
27
|
+
require 'enhance_repo'
|
28
|
+
require 'tempdir'
|
29
|
+
require 'stringio'
|
30
|
+
|
31
|
+
class UpdateInfo_test < Test::Unit::TestCase
|
32
|
+
|
33
|
+
def setup
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_xml_output
|
37
|
+
config = EnhanceRepo::ConfigOpts.new
|
38
|
+
config.dir = test_data('rpms/repo-1')
|
39
|
+
updateinfo = EnhanceRepo::RpmMd::UpdateInfo.new(config)
|
40
|
+
|
41
|
+
Tempdir.open do |dir|
|
42
|
+
updateinfo.generate_update(['a', 'b'], File.join(dir, 'repoparts'))
|
43
|
+
puts Dir[File.join(dir, '*')]
|
44
|
+
|
45
|
+
updateinfo.read_repoparts(:repoparts_path => File.join(dir, 'repoparts'))
|
46
|
+
|
47
|
+
assert ! updateinfo.empty?, "updateinfo can't be empty"
|
48
|
+
assert_equal 1, updateinfo.size, "updateinfo contains 1 update"
|
49
|
+
|
50
|
+
Zlib::GzipReader.open(test_data('rpms/repo-1/repodata/updateinfo.xml.gz')) do |expected_updateinfo|
|
51
|
+
buffer = StringIO.new
|
52
|
+
updateinfo.write(buffer)
|
53
|
+
# assert_xml_equal(expected_updateinfo.read, buffer.string)
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
metadata
ADDED
@@ -0,0 +1,267 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: enhancerepo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Duncan Mac-Vicar P.
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-02-17 00:00:00 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: trollop
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.0.5
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: log4r
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.5
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: nokogiri
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "1.4"
|
44
|
+
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: activesupport
|
47
|
+
type: :runtime
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "2.3"
|
54
|
+
version:
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubyforge
|
57
|
+
type: :development
|
58
|
+
version_requirement:
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 2.0.3
|
64
|
+
version:
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: gemcutter
|
67
|
+
type: :development
|
68
|
+
version_requirement:
|
69
|
+
version_requirements: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: 0.3.0
|
74
|
+
version:
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: yard
|
77
|
+
type: :development
|
78
|
+
version_requirement:
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 0.5.3
|
84
|
+
version:
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: hoe-yard
|
87
|
+
type: :development
|
88
|
+
version_requirement:
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.1.1
|
94
|
+
version:
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: shoulda
|
97
|
+
type: :development
|
98
|
+
version_requirement:
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: "0"
|
104
|
+
version:
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: mocha
|
107
|
+
type: :development
|
108
|
+
version_requirement:
|
109
|
+
version_requirements: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: "0"
|
114
|
+
version:
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: yard
|
117
|
+
type: :development
|
118
|
+
version_requirement:
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: "0"
|
124
|
+
version:
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: hoe
|
127
|
+
type: :development
|
128
|
+
version_requirement:
|
129
|
+
version_requirements: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 2.5.0
|
134
|
+
version:
|
135
|
+
description: |-
|
136
|
+
enhancerepo adds additional metadata to repommd repositories and
|
137
|
+
servers as the testbed for the specification
|
138
|
+
email:
|
139
|
+
- dmacvicar@suse.de
|
140
|
+
executables:
|
141
|
+
- enhancerepo
|
142
|
+
extensions: []
|
143
|
+
|
144
|
+
extra_rdoc_files:
|
145
|
+
- Manifest.txt
|
146
|
+
- README.rdoc
|
147
|
+
- CHANGELOG.rdoc
|
148
|
+
- TODO.rdoc
|
149
|
+
files:
|
150
|
+
- lib/enhance_repo.rb
|
151
|
+
- lib/tempdir/tempfile.rb
|
152
|
+
- lib/enhance_repo/xml_comparer.rb
|
153
|
+
- lib/enhance_repo/rpm_md.rb
|
154
|
+
- lib/enhance_repo/package_id.rb
|
155
|
+
- lib/enhance_repo/rpm_md/update.rb
|
156
|
+
- lib/enhance_repo/rpm_md/suse_data.rb
|
157
|
+
- lib/enhance_repo/rpm_md/primary.rb
|
158
|
+
- lib/enhance_repo/rpm_md/resource.rb
|
159
|
+
- lib/enhance_repo/rpm_md/data.rb
|
160
|
+
- lib/enhance_repo/rpm_md/delta_info.rb
|
161
|
+
- lib/enhance_repo/rpm_md/suse_info.rb
|
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
|
166
|
+
- lib/enhance_repo/rpm_md/file_lists.rb
|
167
|
+
- lib/enhance_repo/rpm_md/repo.rb
|
168
|
+
- lib/enhance_repo/rpm_md/products.rb
|
169
|
+
- lib/enhance_repo/rpm_md/extra_primary_data.rb
|
170
|
+
- lib/enhance_repo/other.rb
|
171
|
+
- lib/enhance_repo/cli.rb
|
172
|
+
- lib/enhance_repo/product_id.rb
|
173
|
+
- lib/enhance_repo/logger.rb
|
174
|
+
- lib/enhance_repo/config_opts.rb
|
175
|
+
- lib/tempdir.rb
|
176
|
+
- test/repo_test.rb
|
177
|
+
- test/susedata_test.rb
|
178
|
+
- test/updateinfo_test.rb
|
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
|
237
|
+
homepage: http://en.opensuse.org/Enhancerepo
|
238
|
+
licenses: []
|
239
|
+
|
240
|
+
post_install_message:
|
241
|
+
rdoc_options:
|
242
|
+
- --title
|
243
|
+
- Enhancerepo Documentation
|
244
|
+
- --quiet
|
245
|
+
require_paths:
|
246
|
+
- lib
|
247
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
248
|
+
requirements:
|
249
|
+
- - ">="
|
250
|
+
- !ruby/object:Gem::Version
|
251
|
+
version: "0"
|
252
|
+
version:
|
253
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
254
|
+
requirements:
|
255
|
+
- - ">="
|
256
|
+
- !ruby/object:Gem::Version
|
257
|
+
version: "0"
|
258
|
+
version:
|
259
|
+
requirements: []
|
260
|
+
|
261
|
+
rubyforge_project: enhancerepo
|
262
|
+
rubygems_version: 1.3.5
|
263
|
+
signing_key:
|
264
|
+
specification_version: 3
|
265
|
+
summary: Adds additional information to repomd repositories
|
266
|
+
test_files:
|
267
|
+
- test/test_helper.rb
|