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
data/CHANGELOG.rdoc
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
== 0.4 (not released)
|
3
|
+
|
4
|
+
* improved logger support
|
5
|
+
* --split-updates, patch by Jordi Massaguer Pla
|
6
|
+
* primary data generation (EXPERIMENTAL)
|
7
|
+
* allows to generate metadata to a separate directory
|
8
|
+
* product metadata generation extracted from *-release rpm packages
|
9
|
+
* benchmark feature
|
10
|
+
* speed improvements
|
11
|
+
|
12
|
+
== 0.3.2
|
13
|
+
|
14
|
+
* patch generation support
|
15
|
+
|
16
|
+
== 0.3.1
|
17
|
+
|
18
|
+
* deltarpm support
|
data/Manifest.txt
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
lib/enhance_repo.rb
|
2
|
+
lib/tempdir/tempfile.rb
|
3
|
+
lib/enhance_repo/xml_comparer.rb
|
4
|
+
lib/enhance_repo/rpm_md.rb
|
5
|
+
lib/enhance_repo/package_id.rb
|
6
|
+
lib/enhance_repo/rpm_md/update.rb
|
7
|
+
lib/enhance_repo/rpm_md/suse_data.rb
|
8
|
+
lib/enhance_repo/rpm_md/primary.rb
|
9
|
+
lib/enhance_repo/rpm_md/resource.rb
|
10
|
+
lib/enhance_repo/rpm_md/data.rb
|
11
|
+
lib/enhance_repo/rpm_md/delta_info.rb
|
12
|
+
lib/enhance_repo/rpm_md/suse_info.rb
|
13
|
+
lib/enhance_repo/rpm_md/other.rb
|
14
|
+
lib/enhance_repo/rpm_md/index.rb
|
15
|
+
lib/enhance_repo/rpm_md/update_smart_fields.rb
|
16
|
+
lib/enhance_repo/rpm_md/update_info.rb
|
17
|
+
lib/enhance_repo/rpm_md/file_lists.rb
|
18
|
+
lib/enhance_repo/rpm_md/repo.rb
|
19
|
+
lib/enhance_repo/rpm_md/products.rb
|
20
|
+
lib/enhance_repo/rpm_md/extra_primary_data.rb
|
21
|
+
lib/enhance_repo/other.rb
|
22
|
+
lib/enhance_repo/cli.rb
|
23
|
+
lib/enhance_repo/product_id.rb
|
24
|
+
lib/enhance_repo/logger.rb
|
25
|
+
lib/enhance_repo/config_opts.rb
|
26
|
+
lib/tempdir.rb
|
27
|
+
test/repo_test.rb
|
28
|
+
test/susedata_test.rb
|
29
|
+
test/updateinfo_test.rb
|
30
|
+
test/tempdir_test.rb
|
31
|
+
test/products_test.rb
|
32
|
+
test/primary_test.rb
|
33
|
+
test/rpmmd_test.rb
|
34
|
+
test/test_helper.rb
|
35
|
+
test/repomdindex_test.rb
|
36
|
+
test/all_tests.rb
|
37
|
+
test/index_test.rb
|
38
|
+
test/deltainfo_test.rb
|
39
|
+
test/extensions_test.rb
|
40
|
+
test/update_test.rb
|
41
|
+
test/data/rpms/repo-1/repodata/susedata.xml.gz
|
42
|
+
test/data/rpms/repo-1/repodata/filelists.xml.gz
|
43
|
+
test/data/rpms/repo-1/repodata/deltainfo.xml.gz.gz
|
44
|
+
test/data/rpms/repo-1/repodata/deltainfo.xml.gz
|
45
|
+
test/data/rpms/repo-1/repodata/other.xml.gz
|
46
|
+
test/data/rpms/repo-1/repodata/updateinfo.xml.gz
|
47
|
+
test/data/rpms/repo-1/repodata/repomd.xml
|
48
|
+
test/data/rpms/repo-1/repodata/primary.xml.gz
|
49
|
+
test/data/rpms/repo-1/a-1.0-0.x86_64.rpm
|
50
|
+
test/data/rpms/repo-1/a-2.0-0.x86_64.rpm
|
51
|
+
test/data/rpms/repo-1/a-1.0_2.0-0_0.x86_64.delta.rpm
|
52
|
+
test/data/rpms/repo-1/repoparts/update-a-1.xml
|
53
|
+
test/data/rpms/repo-with-product/repodata/filelists.xml.gz
|
54
|
+
test/data/rpms/repo-with-product/repodata/products.xml.gz
|
55
|
+
test/data/rpms/repo-with-product/repodata/other.xml.gz
|
56
|
+
test/data/rpms/repo-with-product/repodata/repomd.xml
|
57
|
+
test/data/rpms/repo-with-product/repodata/primary.xml.gz
|
58
|
+
test/data/rpms/repo-with-product/a-1.0-0.x86_64.rpm
|
59
|
+
test/data/rpms/repo-with-product/openSUSE-release-11.2-1.6.i586.rpm
|
60
|
+
test/data/rpms/repo-with-product/openSUSE-release-dvd-11.2-1.6.i586.rpm
|
61
|
+
test/data/rpms/update-test-factory/update-test-reboot-needed-0-9999.1.2.noarch.rpm
|
62
|
+
test/data/rpms/update-test-factory/update-test-security-0-9999.1.2.noarch.rpm
|
63
|
+
test/data/rpms/update-test-factory/update-test-affects-package-manager-0-9999.1.2.noarch.rpm
|
64
|
+
test/data/rpms/update-test-factory/update-test-interactive-0-9999.1.2.noarch.rpm
|
65
|
+
test/data/rpms/update-test-factory/update-test-relogin-suggested-0-9999.1.2.noarch.rpm
|
66
|
+
test/data/rpms/update-test-factory/update-test-optional-0-9999.1.2.noarch.rpm
|
67
|
+
test/data/rpms/update-test-11.1/update-test-trival.rpm
|
68
|
+
test/data/rpms/update-test-11.1/update-test-optional.rpm
|
69
|
+
test/data/rpms/update-test-11.1/update-test-security.rpm
|
70
|
+
test/data/rpms/update-test-11.1/update-test-reboot-needed.rpm
|
71
|
+
test/data/rpms/update-test-11.1/update-test-affects-package-manager.rpm
|
72
|
+
test/data/rpms/update-test-11.1/update-test-interactive.rpm
|
73
|
+
test/data/repodata/update-test-11.1/filelists.xml.gz
|
74
|
+
test/data/repodata/update-test-11.1/other.xml.gz
|
75
|
+
test/data/repodata/update-test-11.1/repomd.xml
|
76
|
+
test/data/repodata/update-test-11.1/primary.xml.gz
|
77
|
+
test/data/packages/a-2.0.spec
|
78
|
+
test/data/packages/a-1.0.spec
|
79
|
+
test/data/repomd.xml
|
80
|
+
Rakefile
|
81
|
+
README
|
82
|
+
README.rdoc
|
83
|
+
CHANGELOG.rdoc
|
84
|
+
bin/enhancerepo
|
85
|
+
Manifest.txt
|
data/README
ADDED
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
$: << File.join(File.dirname(__FILE__), "test")
|
2
|
+
require 'rubygems'
|
3
|
+
gem 'hoe', '>= 2.1.0'
|
4
|
+
require 'hoe'
|
5
|
+
|
6
|
+
task :default => [:docs, :test]
|
7
|
+
|
8
|
+
Hoe.plugin :yard
|
9
|
+
|
10
|
+
HOE = Hoe.spec 'enhancerepo' do
|
11
|
+
developer('Duncan Mac-Vicar P.', 'dmacvicar@suse.de')
|
12
|
+
# s.homepage = "http://en.opensuse.org/Enhancerepo"
|
13
|
+
self.summary = "Adds additional information to repomd repositories"
|
14
|
+
self.description = "enhancerepo adds additional metadata to repommd repositories and
|
15
|
+
servers as the testbed for the specification"
|
16
|
+
self.readme_file = ['README', ENV['HLANG'], 'rdoc'].compact.join('.')
|
17
|
+
self.history_file = ['CHANGELOG', ENV['HLANG'], 'rdoc'].compact.join('.')
|
18
|
+
self.extra_rdoc_files = FileList['*.rdoc']
|
19
|
+
|
20
|
+
self.extra_deps << ['trollop', '>= 1.0.5']
|
21
|
+
self.extra_deps << ['log4r', '>= 1.0.5']
|
22
|
+
self.extra_deps << ['nokogiri', '>= 1.4']
|
23
|
+
self.extra_deps << ['activesupport', '>= 2.3']
|
24
|
+
|
25
|
+
self.extra_dev_deps << ['shoulda', '>= 0']
|
26
|
+
self.extra_dev_deps << ['mocha', '>= 0']
|
27
|
+
self.extra_dev_deps << ['yard', '>= 0']
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "Insert GPL into all source files"
|
31
|
+
task :GPL do
|
32
|
+
gpl = File.readlines('GPL_header.txt')
|
33
|
+
FileList['**/*.rb'].each do |filename|
|
34
|
+
File.open(filename, 'r+') do |file|
|
35
|
+
lines = file.readlines
|
36
|
+
# Skip shebang line
|
37
|
+
i = (lines[0].index('#!') == 0) ? 1 : 0
|
38
|
+
# Already have header?
|
39
|
+
next if lines[i].index('#--') == 0
|
40
|
+
|
41
|
+
puts "Liberating #{filename}"
|
42
|
+
|
43
|
+
file.pos = 0
|
44
|
+
file.print lines.insert(i, gpl).flatten
|
45
|
+
file.truncate(file.pos)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/TODO.rdoc
ADDED
data/bin/enhancerepo
ADDED
data/lib/enhance_repo.rb
ADDED
@@ -0,0 +1,36 @@
|
|
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
|
+
module EnhanceRepo
|
26
|
+
VERSION = "0.4.1"
|
27
|
+
end
|
28
|
+
|
29
|
+
lib = File.dirname(__FILE__)
|
30
|
+
|
31
|
+
require File.join(lib, 'enhance_repo', 'logger.rb')
|
32
|
+
require File.join(lib, 'enhance_repo', 'config_opts.rb')
|
33
|
+
require File.join(lib, 'enhance_repo', 'rpm_md.rb')
|
34
|
+
|
35
|
+
|
36
|
+
|
@@ -0,0 +1,150 @@
|
|
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 'trollop'
|
27
|
+
require 'enhance_repo'
|
28
|
+
require 'pathname'
|
29
|
+
require 'benchmark'
|
30
|
+
require 'fileutils'
|
31
|
+
|
32
|
+
EnhanceRepo::enable_logger
|
33
|
+
|
34
|
+
opts = Trollop::options do
|
35
|
+
version "enhancerepo #{EnhanceRepo::VERSION}"
|
36
|
+
banner <<-EOS
|
37
|
+
enhancerepo is a rpm-md metadata tool
|
38
|
+
|
39
|
+
Usage:
|
40
|
+
enhancerepo [options] DIR
|
41
|
+
|
42
|
+
DIR: The repo base directory ( where repodata/ directory is located )
|
43
|
+
EOS
|
44
|
+
opt :help, 'Show help'
|
45
|
+
opt :outputdir, 'Generate metadata to a different directory', :short => :o
|
46
|
+
opt :index, "Reindex the metadata and regenerates repomd.xml, even if nothing was changed using enhancerepo. Use this if you did manual changes to the metadata", :short => :x
|
47
|
+
opt :benchmark, 'Show benchmark statistics at the end'
|
48
|
+
|
49
|
+
opt :primary, 'Add data from rpm files and generate primary.xml (EXPERIMENTAL)', :short => :p
|
50
|
+
opt :sign, 'Generates signature for the repository using key keyid', :short => :s, :type => :string
|
51
|
+
opt :updates, 'Add updates from *.updates files and generate updateinfo.xml', :short => :u
|
52
|
+
opt :generate_update, 'Generates an update from the given package list comparing package\'s last version changes', :type => :strings
|
53
|
+
opt :updates_base_dir, 'Looks for package also in <dir> Useful if you keep old packages in a different repos and updates in this one.', :type => :string
|
54
|
+
opt :split_updates, 'Splits current updateinfo.xml into update parts files in repoparts/'
|
55
|
+
opt :indent, 'Generate indented xml. Default: no', :short => :i
|
56
|
+
|
57
|
+
opt :expire, 'Set repository expiration hint (Can be used to detect dead mirrors)', :type => :date, :short => :e
|
58
|
+
opt :repo_product, 'Adds product compatibility information', :type => :strings
|
59
|
+
opt :repo_keyword, 'Tags repository with keyword', :type => :strings
|
60
|
+
|
61
|
+
# === SUSE specific package data (susedata.xml)
|
62
|
+
|
63
|
+
opt :eulas, 'Reads packagename.eula files and add the information to susedata.xml', :short => :l
|
64
|
+
opt :keywords, 'Reads packagename.keywords files and add keyword metadata to susedata.xml', :short => :k
|
65
|
+
opt :disk_usage, 'Reads rpm packages, generates disk usage information on susedata.xml', :short => :d
|
66
|
+
|
67
|
+
# Note: your .eula or .keywords file will be added to
|
68
|
+
# a package if it matches its name. If you want to add
|
69
|
+
# the attributes to a specific package, name the file
|
70
|
+
# name-version, name-version-release or
|
71
|
+
# name-version-release.arch
|
72
|
+
|
73
|
+
# === Package deltas support
|
74
|
+
opt :'create-deltas',
|
75
|
+
'Create [num] deltas for different versions of a package. If there is foo-1.rpm, foo-2.rpm, foo-3.rpm, foo-4.rpm num=1 will create a delta to go from version 3 to 4, while num=2 will create one from 2 to 4 too. This does not index the deltas. Use --deltas for that.', :default => 1
|
76
|
+
opt :deltas, 'Reads all *.delta.rpm files and add the information to deltainfo.xml. This indexes existing deltas, but won\'t create them. See --create-deltas for deltas creation.'
|
77
|
+
|
78
|
+
# === Product information support
|
79
|
+
|
80
|
+
opt :products, 'Reads release packages and generating product information in products.xml based on the information contained in the .prod files included in the packages.'
|
81
|
+
|
82
|
+
# other
|
83
|
+
opt :debug, 'Show debug information'
|
84
|
+
end
|
85
|
+
|
86
|
+
config = EnhanceRepo::ConfigOpts.new(opts)
|
87
|
+
dir = ARGV.shift
|
88
|
+
config.dir = Pathname.new(dir) if not dir.nil?
|
89
|
+
|
90
|
+
# Check if dir is given
|
91
|
+
if config.dir.nil?
|
92
|
+
EnhanceRepo.logger.fatal "Missing dir argument (try --help)"
|
93
|
+
exit 0
|
94
|
+
end
|
95
|
+
|
96
|
+
repomd = EnhanceRepo::RpmMd::Repo.new(config)
|
97
|
+
|
98
|
+
# perform the operations in a rescue block
|
99
|
+
|
100
|
+
time = Benchmark.measure do
|
101
|
+
begin
|
102
|
+
if config.primary
|
103
|
+
repomd.primary.read_packages
|
104
|
+
repomd.filelists.read
|
105
|
+
repomd.other.read
|
106
|
+
end
|
107
|
+
|
108
|
+
# merge keywords and products to suseinfo
|
109
|
+
repomd.suseinfo.products.merge(config.repoproducts)
|
110
|
+
repomd.suseinfo.keywords.merge(config.repokeywords)
|
111
|
+
|
112
|
+
repomd.susedata.add_eulas if config.eulas
|
113
|
+
repomd.susedata.add_keywords if config.keywords
|
114
|
+
repomd.susedata.add_disk_usage if config.diskusage
|
115
|
+
|
116
|
+
if not config.generate_update.nil?
|
117
|
+
repomd.updateinfo.generate_update(config.generate_update, File.join(config.outputdir, 'repoparts') )
|
118
|
+
end
|
119
|
+
|
120
|
+
repomd.updateinfo.read_repoparts if config.updates
|
121
|
+
repomd.updateinfo.split_updates(File.join(config.outputdir, 'repoparts')) if config.split_updates
|
122
|
+
|
123
|
+
repomd.deltainfo.create_deltas(:outputdir => config.outputdir, :n => config.create_deltas) if config.create_deltas
|
124
|
+
repomd.deltainfo.add_deltas if config.deltas
|
125
|
+
|
126
|
+
repomd.products.read_packages if config.products
|
127
|
+
|
128
|
+
# add expiration date
|
129
|
+
repomd.suseinfo.expire = config.expire if not config.expire.nil?
|
130
|
+
|
131
|
+
# index if requested
|
132
|
+
repomd.index if config.index
|
133
|
+
|
134
|
+
# write the repository out
|
135
|
+
repomd.write
|
136
|
+
|
137
|
+
# perform signature of the repository
|
138
|
+
repomd.sign(config.signkey) if not config.signkey.nil?
|
139
|
+
rescue Exception => excp
|
140
|
+
EnhanceRepo.logger.fatal excp.message
|
141
|
+
if EnhanceRepo::enable_debug
|
142
|
+
EnhanceRepo.logger.fatal excp.class
|
143
|
+
EnhanceRepo.logger.fatal(excp.backtrace.join("\n"))
|
144
|
+
else
|
145
|
+
EnhanceRepo.logger.info "Pass --debug for more information..."
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|
150
|
+
EnhanceRepo.logger.info(time) if config.benchmark
|
@@ -0,0 +1,98 @@
|
|
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 'set'
|
26
|
+
|
27
|
+
module EnhanceRepo
|
28
|
+
|
29
|
+
# Configuration class to hold the options
|
30
|
+
# passed from the command line to the
|
31
|
+
# components doing the work
|
32
|
+
#
|
33
|
+
|
34
|
+
class ConfigOpts
|
35
|
+
attr_accessor :index
|
36
|
+
attr_accessor :indent
|
37
|
+
attr_accessor :repoproducts
|
38
|
+
attr_accessor :repokeywords
|
39
|
+
attr_accessor :dir
|
40
|
+
# output dir, if specified, if not
|
41
|
+
# we use dir
|
42
|
+
attr_writer :outputdir
|
43
|
+
attr_accessor :signkey
|
44
|
+
attr_accessor :expire
|
45
|
+
attr_accessor :primary
|
46
|
+
attr_accessor :updates
|
47
|
+
attr_accessor :generate_update
|
48
|
+
attr_accessor :split_updates
|
49
|
+
attr_accessor :updatesbasedir
|
50
|
+
attr_accessor :eulas
|
51
|
+
attr_accessor :keywords
|
52
|
+
attr_accessor :diskusage
|
53
|
+
# wether to create delta rpm files
|
54
|
+
# and how many
|
55
|
+
attr_accessor :create_deltas
|
56
|
+
# whether to index delta rpms
|
57
|
+
attr_accessor :deltas
|
58
|
+
|
59
|
+
attr_accessor :products
|
60
|
+
|
61
|
+
attr_accessor :benchmark
|
62
|
+
|
63
|
+
def outputdir
|
64
|
+
return @dir if @outputdir.nil?
|
65
|
+
return @outputdir
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
def initialize(opts)
|
70
|
+
@repoproducts = Set.new
|
71
|
+
@repokeywords = Set.new
|
72
|
+
read_opts(opts)
|
73
|
+
end
|
74
|
+
|
75
|
+
def read_opts(opts)
|
76
|
+
@index = opts[:index]
|
77
|
+
@expire = opts[:expire]
|
78
|
+
@primary = opts[:primary]
|
79
|
+
@repoproducts = @repoproducts.merge([*opts[:repo_products]])
|
80
|
+
@repokeywords = @repokeywords.merge([*opts[:repo_keywords]])
|
81
|
+
@signkey = opts[:sign]
|
82
|
+
@updates = opts[:updates]
|
83
|
+
@split_updates = opts[:split_updates]
|
84
|
+
@generate_update = opts[:generate_update]
|
85
|
+
@eulas = opts[:eulas]
|
86
|
+
@keywords = opts[:keywords]
|
87
|
+
@diskusage = opts[:disk_usage]
|
88
|
+
@deltas = opts[:deltas]
|
89
|
+
@create_deltas = opts[:create_deltas]
|
90
|
+
@products = opts[:products]
|
91
|
+
@benchmark = opts[:benchmark]
|
92
|
+
@updatesbasedir = Pathname.new(opts[:updates_base_dir]) if opts[:updates_base_dir]
|
93
|
+
@outputdir = Pathname.new(opts[:outputdir]) if opts[:outputdir]
|
94
|
+
@dir = Pathname.new(opts[:dir]) if opts[:dir]
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
end
|