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
Binary file
|
Binary file
|
@@ -1,22 +0,0 @@
|
|
1
|
-
<update from="duncan@tarro" version="1" type="security" status="stable">
|
2
|
-
<title>Untitled updatesecurity update 1 for a</title>
|
3
|
-
<id>a</id>
|
4
|
-
<issued>1259968029</issued>
|
5
|
-
<release>no release</release>
|
6
|
-
<description>- second change fixes bnc#1111 and
|
7
|
-
kde #3444 and CVE-3333
|
8
|
-
- first change
|
9
|
-
</description>
|
10
|
-
<references>
|
11
|
-
<reference href="http://bugzilla.novell.com/1111" title="bug number 1111" id="1111" type="bugzilla"/>
|
12
|
-
<reference href="http://bugzilla.novell.comhttp://bugs.kde.org/3444" title="KDE bug number 3444" id="3444" type="bugzilla"/>
|
13
|
-
<reference href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-3333" title="CVE number 3333" id="3333" type="cve"/>
|
14
|
-
</references>
|
15
|
-
<pkglist>
|
16
|
-
<collection>
|
17
|
-
<package name="a" arch="x86_64" version="2.0" release="0">
|
18
|
-
<filename>a-2.0-0.x86_64.rpm</filename>
|
19
|
-
</package>
|
20
|
-
</collection>
|
21
|
-
</pkglist>
|
22
|
-
</update>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,27 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<repomd xmlns="http://linux.duke.edu/metadata/repo">
|
3
|
-
<data type="other">
|
4
|
-
<location href="repodata/other.xml.gz"/>
|
5
|
-
<checksum type="sha">9899e20c75356fa1a00556f1fac498a21ec2e0b9</checksum>
|
6
|
-
<timestamp>1259968072</timestamp>
|
7
|
-
<open-checksum type="sha">0278debe71befb06c79dfc0ba1785aa328931664</open-checksum>
|
8
|
-
</data>
|
9
|
-
<data type="filelists">
|
10
|
-
<location href="repodata/filelists.xml.gz"/>
|
11
|
-
<checksum type="sha">5c558dadfd0b5ec24546878b70d96a79fd2f00e7</checksum>
|
12
|
-
<timestamp>1259968072</timestamp>
|
13
|
-
<open-checksum type="sha">10e3518206fcf6767eb895b4c0643b5e32640a1f</open-checksum>
|
14
|
-
</data>
|
15
|
-
<data type="primary">
|
16
|
-
<location href="repodata/primary.xml.gz"/>
|
17
|
-
<checksum type="sha">7a921bd8f6d54b66c414c628a60213f7e8102990</checksum>
|
18
|
-
<timestamp>1259968072</timestamp>
|
19
|
-
<open-checksum type="sha">c8a944dbc07ec3aef02cda461e503895ee585d08</open-checksum>
|
20
|
-
</data>
|
21
|
-
<data type="products">
|
22
|
-
<location href="repodata/products.xml.gz"/>
|
23
|
-
<checksum type="sha">200e2f86adb7ae53e3470ca8f2dbf482d7ff63a8</checksum>
|
24
|
-
<timestamp>1259968098</timestamp>
|
25
|
-
<open-checksum type="sha">20297c5c2b6476c62bc1c66cb722c5839524f2c0</open-checksum>
|
26
|
-
</data>
|
27
|
-
</repomd>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/test/data/rpms/update-test-factory/update-test-affects-package-manager-0-9999.1.2.noarch.rpm
DELETED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/test/deltainfo_test.rb
DELETED
@@ -1,50 +0,0 @@
|
|
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 'stringio'
|
29
|
-
|
30
|
-
class DeltaInfo_test < Test::Unit::TestCase
|
31
|
-
|
32
|
-
def setup
|
33
|
-
end
|
34
|
-
|
35
|
-
def test_xml_output
|
36
|
-
deltainfo = EnhanceRepo::RpmMd::DeltaInfo.new(test_data('rpms/repo-1'))
|
37
|
-
deltainfo.add_deltas
|
38
|
-
|
39
|
-
assert ! deltainfo.empty?
|
40
|
-
assert_equal 1, deltainfo.delta_count
|
41
|
-
|
42
|
-
Zlib::GzipReader.open(test_data('rpms/repo-1/repodata/deltainfo.xml.gz')) do |expected_deltainfo|
|
43
|
-
|
44
|
-
buffer = StringIO.new
|
45
|
-
deltainfo.write(buffer)
|
46
|
-
|
47
|
-
assert_xml_equal(expected_deltainfo.read, buffer.string)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
data/test/extensions_test.rb
DELETED
@@ -1,31 +0,0 @@
|
|
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 Extensions_test < Test::Unit::TestCase
|
29
|
-
def setup
|
30
|
-
end
|
31
|
-
end
|
data/test/index_test.rb
DELETED
@@ -1,51 +0,0 @@
|
|
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
|
-
require 'stringio'
|
28
|
-
require 'zlib'
|
29
|
-
require 'nokogiri'
|
30
|
-
|
31
|
-
class Index_test < Test::Unit::TestCase
|
32
|
-
|
33
|
-
def setup
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_reading_existing_index
|
37
|
-
index = EnhanceRepo::RpmMd::Index.new
|
38
|
-
repomdfile = File.join(test_data('rpms/repo-with-product'), index.metadata_filename)
|
39
|
-
index.read_file(File.new(repomdfile))
|
40
|
-
|
41
|
-
assert_equal 4, index.resources.size
|
42
|
-
|
43
|
-
# now test that saving back produces the same result
|
44
|
-
buffer = StringIO.new
|
45
|
-
index.write(buffer)
|
46
|
-
|
47
|
-
File.open(repomdfile) do |f|
|
48
|
-
assert_xml_equal(f.read, buffer.string)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
data/test/primary_test.rb
DELETED
@@ -1,51 +0,0 @@
|
|
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 Primary_test < Test::Unit::TestCase
|
32
|
-
|
33
|
-
def setup
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_xml_output
|
37
|
-
primary = EnhanceRepo::RpmMd::Primary.new(test_data('rpms/repo-1'))
|
38
|
-
primary.read_packages
|
39
|
-
|
40
|
-
assert ! primary.empty?
|
41
|
-
assert_equal 3, primary.size
|
42
|
-
|
43
|
-
Zlib::GzipReader.open(test_data('rpms/repo-1/repodata/primary.xml.gz')) do |expected_primary|
|
44
|
-
|
45
|
-
buffer = StringIO.new
|
46
|
-
primary.write(buffer)
|
47
|
-
# assert_equal(expected_primary.read, buffer.string)
|
48
|
-
# assert_xml_equal(expected_primary, buffer.string)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
data/test/products_test.rb
DELETED
@@ -1,51 +0,0 @@
|
|
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 Products_test < Test::Unit::TestCase
|
32
|
-
|
33
|
-
def setup
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_xml_output
|
37
|
-
products = EnhanceRepo::RpmMd::Products.new(test_data('rpms/repo-with-product'))
|
38
|
-
products.read_packages
|
39
|
-
|
40
|
-
assert ! products.empty?
|
41
|
-
|
42
|
-
assert_equal 1, products.size
|
43
|
-
|
44
|
-
Zlib::GzipReader.open(test_data('rpms/repo-with-product/repodata/products.xml.gz')) do |expected_products|
|
45
|
-
|
46
|
-
buffer = StringIO.new
|
47
|
-
products.write(buffer)
|
48
|
-
assert_xml_equal(expected_products.read, buffer.string)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
data/test/repo_test.rb
DELETED
@@ -1,72 +0,0 @@
|
|
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
|
-
require 'stringio'
|
28
|
-
require 'zlib'
|
29
|
-
require 'nokogiri'
|
30
|
-
require 'tempdir'
|
31
|
-
require 'fileutils'
|
32
|
-
|
33
|
-
class Repo_test < Test::Unit::TestCase
|
34
|
-
|
35
|
-
def setup
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_reading_existing_repo
|
39
|
-
Tempdir.open do |dir|
|
40
|
-
# copy the repodata of a repository to a temp directory
|
41
|
-
FileUtils.cp_r File.join(test_data('rpms/repo-with-product/repodata')), dir
|
42
|
-
|
43
|
-
config = EnhanceRepo::ConfigOpts.new
|
44
|
-
config.outputdir = dir
|
45
|
-
config.dir = dir
|
46
|
-
|
47
|
-
repo = EnhanceRepo::RpmMd::Repo.new(config)
|
48
|
-
assert_equal 4, repo.index.resources.size, "repository index has 4 resources"
|
49
|
-
FileUtils.rm File.join(dir, 'repodata/filelists.xml.gz')
|
50
|
-
repo.write
|
51
|
-
|
52
|
-
# start again
|
53
|
-
repo = EnhanceRepo::RpmMd::Repo.new(config)
|
54
|
-
assert_equal 3, repo.index.resources.size, "repository index has 3 resources, after deleting one"
|
55
|
-
|
56
|
-
['newdata1.xml', 'newdata2.xml'].each do |newdata|
|
57
|
-
Zlib::GzipWriter.open(File.join(dir, "repodata/#{newdata}.xml.gz")) do |f|
|
58
|
-
f.write('<xml></xml>')
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
File.open(File.join(dir, "repodata/newdata3.xml"), 'w') do |f|
|
63
|
-
f.write('<xml></xml>')
|
64
|
-
end
|
65
|
-
|
66
|
-
repo.write
|
67
|
-
|
68
|
-
repo = EnhanceRepo::RpmMd::Repo.new(config)
|
69
|
-
assert_equal 6, repo.index.resources.size, "repository index has 6 resources, after adding three"
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
data/test/repomdindex_test.rb
DELETED
@@ -1,58 +0,0 @@
|
|
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
|