enhancerepo 0.4.1

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.
Files changed (87) hide show
  1. data/CHANGELOG.rdoc +18 -0
  2. data/Manifest.txt +85 -0
  3. data/README +10 -0
  4. data/README.rdoc +15 -0
  5. data/Rakefile +48 -0
  6. data/TODO.rdoc +4 -0
  7. data/bin/enhancerepo +4 -0
  8. data/lib/enhance_repo.rb +36 -0
  9. data/lib/enhance_repo/cli.rb +150 -0
  10. data/lib/enhance_repo/config_opts.rb +98 -0
  11. data/lib/enhance_repo/logger.rb +67 -0
  12. data/lib/enhance_repo/other.rb +80 -0
  13. data/lib/enhance_repo/package_id.rb +81 -0
  14. data/lib/enhance_repo/product_id.rb +30 -0
  15. data/lib/enhance_repo/rpm_md.rb +27 -0
  16. data/lib/enhance_repo/rpm_md/data.rb +55 -0
  17. data/lib/enhance_repo/rpm_md/delta_info.rb +205 -0
  18. data/lib/enhance_repo/rpm_md/extra_primary_data.rb +45 -0
  19. data/lib/enhance_repo/rpm_md/file_lists.rb +81 -0
  20. data/lib/enhance_repo/rpm_md/index.rb +144 -0
  21. data/lib/enhance_repo/rpm_md/other.rb +69 -0
  22. data/lib/enhance_repo/rpm_md/primary.rb +123 -0
  23. data/lib/enhance_repo/rpm_md/products.rb +142 -0
  24. data/lib/enhance_repo/rpm_md/repo.rb +202 -0
  25. data/lib/enhance_repo/rpm_md/resource.rb +44 -0
  26. data/lib/enhance_repo/rpm_md/suse_data.rb +191 -0
  27. data/lib/enhance_repo/rpm_md/suse_info.rb +88 -0
  28. data/lib/enhance_repo/rpm_md/update.rb +141 -0
  29. data/lib/enhance_repo/rpm_md/update_info.rb +244 -0
  30. data/lib/enhance_repo/rpm_md/update_smart_fields.rb +127 -0
  31. data/lib/enhance_repo/xml_comparer.rb +117 -0
  32. data/lib/tempdir.rb +62 -0
  33. data/lib/tempdir/tempfile.rb +21 -0
  34. data/test/all_tests.rb +27 -0
  35. data/test/data/packages/a-1.0.spec +19 -0
  36. data/test/data/packages/a-2.0.spec +24 -0
  37. data/test/data/repodata/update-test-11.1/filelists.xml.gz +0 -0
  38. data/test/data/repodata/update-test-11.1/other.xml.gz +0 -0
  39. data/test/data/repodata/update-test-11.1/primary.xml.gz +0 -0
  40. data/test/data/repodata/update-test-11.1/repomd.xml +21 -0
  41. data/test/data/repomd.xml +21 -0
  42. data/test/data/rpms/repo-1/a-1.0-0.x86_64.rpm +0 -0
  43. data/test/data/rpms/repo-1/a-1.0_2.0-0_0.x86_64.delta.rpm +0 -0
  44. data/test/data/rpms/repo-1/a-2.0-0.x86_64.rpm +0 -0
  45. data/test/data/rpms/repo-1/repodata/deltainfo.xml.gz +0 -0
  46. data/test/data/rpms/repo-1/repodata/deltainfo.xml.gz.gz +0 -0
  47. data/test/data/rpms/repo-1/repodata/filelists.xml.gz +0 -0
  48. data/test/data/rpms/repo-1/repodata/other.xml.gz +0 -0
  49. data/test/data/rpms/repo-1/repodata/primary.xml.gz +0 -0
  50. data/test/data/rpms/repo-1/repodata/repomd.xml +45 -0
  51. data/test/data/rpms/repo-1/repodata/susedata.xml.gz +0 -0
  52. data/test/data/rpms/repo-1/repodata/updateinfo.xml.gz +0 -0
  53. data/test/data/rpms/repo-1/repoparts/update-a-1.xml +22 -0
  54. data/test/data/rpms/repo-with-product/a-1.0-0.x86_64.rpm +0 -0
  55. data/test/data/rpms/repo-with-product/openSUSE-release-11.2-1.6.i586.rpm +0 -0
  56. data/test/data/rpms/repo-with-product/openSUSE-release-dvd-11.2-1.6.i586.rpm +0 -0
  57. data/test/data/rpms/repo-with-product/repodata/filelists.xml.gz +0 -0
  58. data/test/data/rpms/repo-with-product/repodata/other.xml.gz +0 -0
  59. data/test/data/rpms/repo-with-product/repodata/primary.xml.gz +0 -0
  60. data/test/data/rpms/repo-with-product/repodata/products.xml.gz +0 -0
  61. data/test/data/rpms/repo-with-product/repodata/repomd.xml +27 -0
  62. data/test/data/rpms/update-test-11.1/update-test-affects-package-manager.rpm +0 -0
  63. data/test/data/rpms/update-test-11.1/update-test-interactive.rpm +0 -0
  64. data/test/data/rpms/update-test-11.1/update-test-optional.rpm +0 -0
  65. data/test/data/rpms/update-test-11.1/update-test-reboot-needed.rpm +0 -0
  66. data/test/data/rpms/update-test-11.1/update-test-security.rpm +0 -0
  67. data/test/data/rpms/update-test-11.1/update-test-trival.rpm +0 -0
  68. data/test/data/rpms/update-test-factory/update-test-affects-package-manager-0-9999.1.2.noarch.rpm +0 -0
  69. data/test/data/rpms/update-test-factory/update-test-interactive-0-9999.1.2.noarch.rpm +0 -0
  70. data/test/data/rpms/update-test-factory/update-test-optional-0-9999.1.2.noarch.rpm +0 -0
  71. data/test/data/rpms/update-test-factory/update-test-reboot-needed-0-9999.1.2.noarch.rpm +0 -0
  72. data/test/data/rpms/update-test-factory/update-test-relogin-suggested-0-9999.1.2.noarch.rpm +0 -0
  73. data/test/data/rpms/update-test-factory/update-test-security-0-9999.1.2.noarch.rpm +0 -0
  74. data/test/deltainfo_test.rb +50 -0
  75. data/test/extensions_test.rb +31 -0
  76. data/test/index_test.rb +51 -0
  77. data/test/primary_test.rb +51 -0
  78. data/test/products_test.rb +51 -0
  79. data/test/repo_test.rb +72 -0
  80. data/test/repomdindex_test.rb +58 -0
  81. data/test/rpmmd_test.rb +60 -0
  82. data/test/susedata_test.rb +53 -0
  83. data/test/tempdir_test.rb +62 -0
  84. data/test/test_helper.rb +53 -0
  85. data/test/update_test.rb +80 -0
  86. data/test/updateinfo_test.rb +59 -0
  87. metadata +267 -0
@@ -0,0 +1,45 @@
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">c78367c224f85b229aa6d1c16ba1eb5f28435786</checksum>
6
+ <timestamp>1259968015</timestamp>
7
+ <open-checksum type="sha">26405ecdeec3557696349c1e9325a6754b6ed584</open-checksum>
8
+ </data>
9
+ <data type="filelists">
10
+ <location href="repodata/filelists.xml.gz"/>
11
+ <checksum type="sha">68af6fc6b89cf9531ce140f89b11d6dccfabad1c</checksum>
12
+ <timestamp>1259968015</timestamp>
13
+ <open-checksum type="sha">24ba31a04fcb0dd89aa3c5032c14969b89a8d502</open-checksum>
14
+ </data>
15
+ <data type="primary">
16
+ <location href="repodata/primary.xml.gz"/>
17
+ <checksum type="sha">51e59ba5df06511182f1f254a48660908f895b9b</checksum>
18
+ <timestamp>1259968015</timestamp>
19
+ <open-checksum type="sha">c976a494aa2177e8c2646a1162d2d7fc294a8d6e</open-checksum>
20
+ </data>
21
+ <data type="updateinfo">
22
+ <location href="repodata/updateinfo.xml.gz"/>
23
+ <checksum type="sha">83c9778ef4c8291ad1cb73676b2945fa4e6698c4</checksum>
24
+ <timestamp>1259968029</timestamp>
25
+ <open-checksum type="sha">e8a05e79b949bd7f25bce85643e915244a3e46cd</open-checksum>
26
+ </data>
27
+ <data type="susedata">
28
+ <location href="repodata/susedata.xml.gz"/>
29
+ <checksum type="sha">79cc4e11a640a0e2bc2adb1e8216f6b3917011e8</checksum>
30
+ <timestamp>1259968029</timestamp>
31
+ <open-checksum type="sha">05fdff00eba1cf95f391813ce63dbe0b95a6fcae</open-checksum>
32
+ </data>
33
+ <data type="deltainfo">
34
+ <location href="repodata/deltainfo.xml.gz"/>
35
+ <checksum type="sha">08928f1b24ebc198e237237160803410799e8c92</checksum>
36
+ <timestamp>1259968029</timestamp>
37
+ <open-checksum type="sha">5b77c957f06423dd6659a5431e89f9b408a1e296</open-checksum>
38
+ </data>
39
+ <data type="deltainfo.xml">
40
+ <location href="repodata/deltainfo.xml.gz.gz"/>
41
+ <checksum type="sha">c7e547bc99c0f6b8311623f6eee812bd66591008</checksum>
42
+ <timestamp>1259697250</timestamp>
43
+ <open-checksum type="sha">25c9c4541ca4179ef08c67ade93622c06b5afe26</open-checksum>
44
+ </data>
45
+ </repomd>
@@ -0,0 +1,22 @@
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>
@@ -0,0 +1,27 @@
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>
@@ -0,0 +1,50 @@
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
@@ -0,0 +1,31 @@
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
@@ -0,0 +1,51 @@
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
@@ -0,0 +1,51 @@
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
@@ -0,0 +1,51 @@
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 ADDED
@@ -0,0 +1,72 @@
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