polisher 0.5.1 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,9 @@
3
3
  # Licensed under the MIT license
4
4
  # Copyright (C) 2013 Red Hat, Inc.
5
5
 
6
+ require 'gem2rpm'
7
+ require 'active_support/core_ext'
8
+
6
9
  require 'polisher/core'
7
10
 
8
11
  module Polisher
@@ -16,7 +19,7 @@ module Polisher
16
19
  SPEC_RELEASE_MATCHER = /^Release:\s*(.*)$/
17
20
  SPEC_REQUIRES_MATCHER = /^Requires:\s*(.*)$/
18
21
  SPEC_BUILD_REQUIRES_MATCHER = /^BuildRequires:\s*(.*)$/
19
- SPEC_GEM_REQ_MATCHER = /^.*\s*rubygem\((.*)\)$/
22
+ SPEC_GEM_REQ_MATCHER = /^.*\s*rubygem\((.*)\)(\s*(.*))?$/
20
23
  SPEC_SUBPACKAGE_MATCHER = /^%package\s(.*)$/
21
24
  SPEC_CHANGELOG_MATCHER = /^%changelog$/
22
25
  SPEC_FILES_MATCHER = /^%files$/
@@ -144,8 +147,10 @@ module Polisher
144
147
  @metadata[:requires].each { |r|
145
148
  if r !~ SPEC_GEM_REQ_MATCHER
146
149
  non_gem_requires << r
147
- elsif !new_source.deps.include?($1)
150
+ elsif !new_source.deps.any? { |d| d.name == $1 }
148
151
  extra_gem_requires << r
152
+ #else
153
+ # spec_version = $2
149
154
  end
150
155
  }
151
156
 
@@ -153,18 +158,33 @@ module Polisher
153
158
  @metadata[:build_requires].each { |r|
154
159
  if r !~ SPEC_GEM_REQ_MATCHER
155
160
  non_gem_brequires << r
156
- elsif !new_source.dev_deps.include?($1)
161
+ elsif !new_source.deps.any? { |d| d.name == $1 }
157
162
  extra_gem_brequires << r
163
+ #else
164
+ # spec_version = $2
158
165
  end
159
166
  }
160
167
 
168
+ # TODO detect if req is same as @version, swap out w/ %{version} macro ?
169
+
161
170
  @metadata[:requires] =
162
171
  non_gem_requires + extra_gem_requires +
163
- new_source.deps.collect { |r| "rubygem(#{r})" }
172
+ new_source.deps.collect { |r|
173
+ r.requirement.to_s.split(',').collect { |req|
174
+ expanded = Gem2Rpm::Helpers.expand_requirement [req.split]
175
+ expanded.collect { |e|
176
+ "rubygem(#{r.name}) #{e.first} #{e.last}"
177
+ }
178
+ }
179
+ }.flatten
164
180
 
165
181
  @metadata[:build_requires] =
166
182
  non_gem_brequires + extra_gem_brequires +
167
- new_source.dev_deps.collect { |r| "rubygem(#{r})" }
183
+ new_source.dev_deps.collect { |r|
184
+ r.requirement.to_s.split(',').collect { |req|
185
+ "rubygem(#{r.name}) #{req}"
186
+ }
187
+ }.flatten
168
188
  end
169
189
 
170
190
  def update_files_from(new_source)
@@ -0,0 +1,3 @@
1
+ class Polisher
2
+ VERSION = "0.6.1"
3
+ end
@@ -3,7 +3,7 @@
3
3
  # Licensed under the MIT license
4
4
  # Copyright (C) 2013 Red Hat, Inc.
5
5
 
6
- require 'pkgwat'
6
+ require 'awesome_spawn'
7
7
 
8
8
  module Polisher
9
9
  class Yum
@@ -16,7 +16,9 @@ module Polisher
16
16
  # @returns [String] version of gem in yum or nil if not found
17
17
  def self.version_for(name, &bl)
18
18
  version = nil
19
- out=`#{YUM_CMD} info rubygem-#{name} 2> /dev/null`
19
+ result = AwesomeSpawn.run "#{YUM_CMD} info rubygem-#{name}"
20
+ out = result.output
21
+
20
22
  if out.include?("Version")
21
23
  version = out.lines.to_a.find { |l| l =~ /^Version.*/ }
22
24
  version = version.split(':').last.strip
@@ -0,0 +1,32 @@
1
+ # Polisher Bodhi Spec
2
+ #
3
+ # Licensed under the MIT license
4
+ # Copyright (C) 2013 Red Hat, Inc.
5
+
6
+ require 'polisher/bodhi'
7
+
8
+ module Polisher
9
+ describe Bodhi do
10
+ describe "#versions_for" do
11
+ before(:each) do
12
+ end
13
+
14
+ it "uses pkgwat to retreive updates" do
15
+ Pkgwat.should_receive(:get_updates).with("rubygem-rails", "all", "all").and_return([])
16
+ described_class.versions_for "rails"
17
+ end
18
+
19
+ it "returns versions" do
20
+ Pkgwat.should_receive(:get_updates).and_return([{'stable_version' => '1.0.0'}])
21
+ described_class.versions_for("rails").should == ['1.0.0']
22
+ end
23
+
24
+ it "invokes block with versions" do
25
+ cb = proc {}
26
+ cb.should_receive(:call).with(:bodhi, 'rails', ['1.0.0'])
27
+ Pkgwat.should_receive(:get_updates).and_return([{'stable_version' => '1.0.0'}])
28
+ described_class.versions_for("rails", &cb)
29
+ end
30
+ end
31
+ end # describe Koji
32
+ end # module Polisher
@@ -0,0 +1,5 @@
1
+ source :rubygems
2
+
3
+ # only this really need to be present on the system
4
+ gem 'rubygems'
5
+ gem 'cinch'
@@ -0,0 +1,40 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "mysql"
5
+ s.version = "2.9.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["TOMITA Masahiro"]
9
+ s.date = "2013-02-16"
10
+ s.description = "This is the MySQL API module for Ruby. It provides the same functions for Ruby\nprograms that the MySQL C API provides for C programs.\n\nThis package is offered as gem for easy installation using RubyGems. It wraps\nunmodified tmtm's mysql-ruby extension into a proper gem.\n\nPlease note that tmtm (Tomita Mashahiro) has deprecated development of this\nextension and only update it for bug fixes."
11
+ s.email = ["tommy@tmtm.org"]
12
+ s.extensions = ["ext/mysql_api/extconf.rb"]
13
+ s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
14
+ s.files = ["History.txt", "Manifest.txt", "README.txt", "ext/mysql_api/extconf.rb"]
15
+ s.homepage = "http://github.com/luislavena/mysql-gem"
16
+ s.rdoc_options = ["--main", "README.txt"]
17
+ s.require_paths = ["lib"]
18
+ s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
19
+ s.rubyforge_project = "mysql-win"
20
+ s.rubygems_version = "1.8.24"
21
+ s.summary = "This is the MySQL API module for Ruby"
22
+
23
+ if s.respond_to? :specification_version then
24
+ s.specification_version = 3
25
+
26
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
+ s.add_development_dependency(%q<rdoc>, ["~> 3.10"])
28
+ s.add_development_dependency(%q<rake-compiler>, ["~> 0.8.1"])
29
+ s.add_development_dependency(%q<hoe>, ["~> 3.5"])
30
+ else
31
+ s.add_dependency(%q<rdoc>, ["~> 3.10"])
32
+ s.add_dependency(%q<rake-compiler>, ["~> 0.8.1"])
33
+ s.add_dependency(%q<hoe>, ["~> 3.5"])
34
+ end
35
+ else
36
+ s.add_dependency(%q<rdoc>, ["~> 3.10"])
37
+ s.add_dependency(%q<rake-compiler>, ["~> 0.8.1"])
38
+ s.add_dependency(%q<hoe>, ["~> 3.5"])
39
+ end
40
+ end
@@ -0,0 +1 @@
1
+ {"name":"rails","downloads":29534537,"version":"4.0.1","version_downloads":113942,"platform":"ruby","authors":"David Heinemeier Hansson","info":"Ruby on Rails is a full-stack web framework optimized for programmer happiness and sustainable productivity. It encourages beautiful code by favoring convention over configuration.","licenses":["MIT"],"project_uri":"http://rubygems.org/gems/rails","gem_uri":"http://rubygems.org/gems/rails-4.0.1.gem","homepage_uri":"http://www.rubyonrails.org","wiki_uri":"http://wiki.rubyonrails.org","documentation_uri":"http://api.rubyonrails.org","mailing_list_uri":"http://groups.google.com/group/rubyonrails-talk","source_code_uri":"http://github.com/rails/rails","bug_tracker_uri":"http://github.com/rails/rails/issues","dependencies":{"development":[],"runtime":[{"name":"actionmailer","requirements":"= 4.0.1"},{"name":"actionpack","requirements":"= 4.0.1"},{"name":"activerecord","requirements":"= 4.0.1"},{"name":"activesupport","requirements":"= 4.0.1"},{"name":"bundler","requirements":"< 2.0, >= 1.3.0"},{"name":"railties","requirements":"= 4.0.1"},{"name":"sprockets-rails","requirements":"~> 2.0.0"}]}}
@@ -0,0 +1 @@
1
+ {"name":"rspec","downloads":11691288,"version":"2.12.0","version_downloads":1133260,"platform":"ruby","authors":"Steven Baker, David Chelimsky","info":"BDD for Ruby","licenses":["MIT"],"project_uri":"http://rubygems.org/gems/rspec","gem_uri":"http://rubygems.org/gems/rspec-2.14.1.gem","homepage_uri":"http://github.com/rspec","wiki_uri":"","documentation_uri":"http://relishapp.com/rspec","mailing_list_uri":"http://rubyforge.org/mailman/listinfo/rspec-users","source_code_uri":"http://github.com/rspec/rspec","bug_tracker_uri":"","dependencies":{"development":[],"runtime":[{"name":"rspec-core","requirements":"~> 2.14.0"},{"name":"rspec-expectations","requirements":"~> 2.14.0"},{"name":"rspec-mocks","requirements":"~> 2.14.0"}]}}
@@ -0,0 +1,238 @@
1
+ %global gem_name activesupport
2
+
3
+ Summary: Support and utility classes used by the Rails framework
4
+ Name: rubygem-%{gem_name}
5
+ Epoch: 1
6
+ Version: 4.0.0
7
+ Release: 1%{?dist}
8
+ Group: Development/Languages
9
+ License: MIT
10
+ URL: http://www.rubyonrails.org
11
+
12
+ Source0: http://rubygems.org/downloads/activesupport-%{version}.gem
13
+
14
+ # Also the activesupport gem doesn't ship with the test suite like the other
15
+ # Rails rpms, you may check it out like so
16
+ # git clone http://github.com/rails/rails.git
17
+ # cd rails/activesupport/
18
+ # git checkout v4.0.0
19
+ # tar czvf activesupport-4.0.0-tests.tgz test/
20
+ Source2: activesupport-%{version}-tests.tgz
21
+
22
+ # Removes code which breaks the test suite due to a
23
+ # dependency on a file in the greater rails proj
24
+ Patch1: activesupport-tests-fix.patch
25
+
26
+ # We need to add the bigdecimal dependency to gemspec, otherwise it won't be
27
+ # loaded. The reason for this is unbundling it from ruby libdir and moving
28
+ # it under %%{gem_dir} (therefore if not in Gemfile, it won't be found).
29
+ Patch4: activesupport-add-bigdecimal-dependency.patch
30
+
31
+ Requires: ruby(rubygems)
32
+ Requires: ruby(release)
33
+ # Let's keep Requires and BuildRequires sorted alphabeticaly
34
+ Requires: rubygem(bigdecimal)
35
+ Requires: rubygem(dalli)
36
+ Requires: rubygem(i18n) >= 0.6
37
+ Requires: rubygem(i18n) < 1.0
38
+ Requires: rubygem(minitest) >= 4.2
39
+ Requires: rubygem(minitest) < 5
40
+ Requires: rubygem(multi_json) >= 1.0
41
+ Requires: rubygem(multi_json) < 2
42
+ Requires: rubygem(rack)
43
+ Requires: rubygem(thread_safe)
44
+ Requires: rubygem(tzinfo) >= 0.3.37
45
+ Requires: rubygem(tzinfo) < 0.4.0
46
+ BuildRequires: rubygems-devel
47
+ BuildRequires: rubygem(bigdecimal)
48
+ BuildRequires: rubygem(builder)
49
+ BuildRequires: rubygem(dalli)
50
+ BuildRequires: rubygem(i18n) >= 0.6
51
+ BuildRequires: rubygem(i18n) < 1.0
52
+ BuildRequires: rubygem(minitest)
53
+ BuildRequires: rubygem(mocha)
54
+ BuildRequires: rubygem(multi_json) >= 1.0
55
+ BuildRequires: rubygem(multi_json) < 2
56
+ BuildRequires: rubygem(rack)
57
+ BuildRequires: rubygem(thread_safe)
58
+ BuildRequires: rubygem(tzinfo) >= 0.3.37
59
+ BuildRequires: rubygem(tzinfo) < 0.4.0
60
+ BuildArch: noarch
61
+ Provides: rubygem(%{gem_name}) = %{version}
62
+
63
+ %description
64
+ Utility library which carries commonly used classes and
65
+ goodies from the Rails framework
66
+
67
+ %prep
68
+ %setup -q -c -T
69
+ %gem_install -n %{SOURCE0}
70
+
71
+ # move the tests into place
72
+ tar xzvf %{SOURCE2} -C .%{gem_instdir}
73
+
74
+
75
+ pushd .%{gem_instdir}
76
+ %patch1 -p0
77
+ popd
78
+
79
+ pushd .%{gem_dir}
80
+ #%%patch4 -p1
81
+ popd
82
+
83
+ %build
84
+
85
+ %install
86
+ rm -rf %{buildroot}
87
+ mkdir -p %{buildroot}%{gem_dir}
88
+ cp -a .%{gem_dir}/* %{buildroot}%{gem_dir}
89
+
90
+ %check
91
+ pushd %{buildroot}%{gem_instdir}
92
+
93
+ ruby -Ilib:test -e "Dir.glob('./test/**/*_test.rb').each {|t| require t}"
94
+ popd
95
+
96
+ %files
97
+ %dir %{gem_instdir}
98
+ %doc %{gem_instdir}/CHANGELOG.md
99
+ %{gem_libdir}
100
+ %doc %{gem_instdir}/MIT-LICENSE
101
+ %doc %{gem_instdir}/README.rdoc
102
+ %doc %{gem_docdir}
103
+ %{gem_cache}
104
+ %{gem_spec}
105
+ %{gem_instdir}/test
106
+
107
+
108
+ %changelog
109
+ * Fri Aug 09 2013 Josef Stribny <jstribny@redhat.com> - 1:4.0.0-2
110
+ - Fix: add minitest to requires
111
+
112
+ * Tue Jul 30 2013 Josef Stribny <jstribny@redhat.com> - 1:4.0.0-1
113
+ - Update to ActiveSupport 4.0.0.
114
+
115
+ * Tue Mar 19 2013 Vít Ondruch <vondruch@redhat.com> - 1:3.2.13-1
116
+ - Update to ActiveSupport 3.2.13.
117
+
118
+ * Fri Mar 01 2013 Vít Ondruch <vondruch@redhat.com> - 1:3.2.12-2
119
+ - Rebuild for https://fedoraproject.org/wiki/Features/Ruby_2.0.0
120
+
121
+ * Tue Feb 12 2013 Vít Ondruch <vondruch@redhat.com> - 1:3.2.12-1
122
+ - Update to ActiveSupport 3.2.12.
123
+
124
+ * Wed Jan 09 2013 Vít Ondruch <vondruch@redhat.com> - 1:3.2.11-1
125
+ - Update to ActiveSupport 3.2.11.
126
+
127
+ * Thu Jan 03 2013 Vít Ondruch <vondruch@redhat.com> - 1:3.2.10-1
128
+ - Update to ActiveSupport 3.2.10.
129
+
130
+ * Mon Aug 13 2012 Vít Ondruch <vondruch@redhat.com> - 1:3.2.8-1
131
+ - Update to ActiveSupport 3.2.8.
132
+
133
+ * Mon Jul 30 2012 Vít Ondruch <vondruch@redhat.com> - 1:3.2.7-1
134
+ - Update to ActiveSupport 3.2.7.
135
+
136
+ * Wed Jul 18 2012 Bohuslav Kabrda <bkabrda@redhat.com> - 1:3.2.6-1
137
+ - Update to ActiveSupport 3.2.6.
138
+ - Removed unneeded BuildRoot tag.
139
+ - Tests no longer fail with newer versions of Mocha, remove workaround.
140
+
141
+ * Fri Jun 15 2012 Vít Ondruch <vondruch@redhat.com> - 1:3.0.15-1
142
+ - Update to ActiveSupport 3.0.15.
143
+
144
+ * Fri Jun 01 2012 Vít Ondruch <vondruch@redhat.com> - 1:3.0.13-1
145
+ - Update to ActiveSupport 3.0.13.
146
+
147
+ * Wed Apr 18 2012 Bohuslav Kabrda <bkabrda@redhat.com> - 1:3.0.11-5
148
+ - Add the bigdecimal dependency to gemspec.
149
+
150
+ * Fri Mar 16 2012 Bohuslav Kabrda <bkabrda@redhat.com> - 1:3.0.11-4
151
+ - The CVE patch name now contains the CVE id.
152
+
153
+ * Mon Mar 05 2012 Bohuslav Kabrda <bkabrda@redhat.com> - 1:3.0.11-3
154
+ - Patch for CVE-2012-1098
155
+
156
+ * Tue Jan 24 2012 Bohuslav Kabrda <bkabrda@redhat.com> - 1:3.0.11-1
157
+ - Rebuilt for Ruby 1.9.3.
158
+ - Update to ActiveSupport 3.0.11.
159
+
160
+ * Mon Aug 22 2011 Vít Ondruch <vondruch@redhat.com> - 1:3.0.10-1
161
+ - Update to ActiveSupport 3.0.10
162
+
163
+ * Fri Jul 01 2011 Vít Ondruch <vondruch@redhat.com> - 1:3.0.9-1
164
+ - Update to ActiveSupport 3.0.9
165
+ - Changed %%define into %%global
166
+ - Removed unnecessary %%clean section
167
+
168
+ * Thu Jun 16 2011 Mo Morsi <mmorsi@redhat.com> - 1:3.0.5-3
169
+ - Reverting accidental change adding a few gem flags
170
+
171
+ * Thu Jun 16 2011 Mo Morsi <mmorsi@redhat.com> - 1:3.0.5-2
172
+ - Include fix for CVE-2011-2197
173
+
174
+ * Thu Mar 24 2011 Vít Ondruch <vondruch@redhat.com> - 1:3.0.5-1
175
+ - Update to ActiveSupport 3.0.5
176
+ - Remove Rake dependnecy
177
+
178
+ * Mon Feb 14 2011 Mohammed Morsi <mmorsi@redhat.com> - 1:3.0.3-4
179
+ - fix bad dates in the spec changelog
180
+
181
+ * Thu Feb 10 2011 Mohammed Morsi <mmorsi@redhat.com> - 1:3.0.3-3
182
+ - include i18n runtime dependency
183
+
184
+ * Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1:3.0.3-2
185
+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
186
+
187
+ * Mon Jan 10 2011 Mohammed Morsi <mmorsi@redhat.com> - 1:3.0.3-1
188
+ - update to rails 3
189
+
190
+ * Wed Aug 25 2010 Mohammed Morsi <mmorsi@redhat.com> - 1:2.3.8-2
191
+ - bumped version
192
+
193
+ * Wed Aug 04 2010 Mohammed Morsi <mmorsi@redhat.com> - 1:2.3.8-1
194
+ - Update to 2.3.8
195
+ - Added check section with rubygem-mocha dependency
196
+ - Added upsteam Rakefile and test suite to run tests
197
+
198
+ * Thu Jan 28 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 1:2.3.5-1
199
+ - Update to 2.3.5
200
+
201
+ * Wed Oct 7 2009 David Lutterkort <lutter@redhat.com> - 1:2.3.4-2
202
+ - Bump Epoch to ensure upgrade path from F-11
203
+
204
+ * Mon Sep 7 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 2.3.4-1
205
+ - Update to 2.3.4 (bug 520843, CVE-2009-3009)
206
+
207
+ * Sun Jul 26 2009 Jeroen van Meeuwen <j.van.meeuwen@ogd.nl> - 2.3.3-1
208
+ - New upstream version
209
+
210
+ * Mon Mar 16 2009 Jeroen van Meeuwen <kanarip@fedoraproject.org> - 2.3.2-1
211
+ - New upstream version
212
+
213
+ * Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.2-2
214
+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
215
+
216
+ * Mon Nov 24 2008 Jeroen van Meeuwen <kanarip@fedoraproject.org> - 2.2.2-1
217
+ - New upstream version
218
+
219
+ * Tue Sep 16 2008 David Lutterkort <dlutter@redhat.com> - 2.1.1-1
220
+ - New version (fixes CVE-2008-4094)
221
+
222
+ * Thu Jul 31 2008 Michael Stahnke <stahnma@fedoraproject.org> - 2.1.0-1
223
+ - New Upstream
224
+
225
+ * Mon Apr 07 2008 David Lutterkort <dlutter@redhat.com> - 2.0.2-1
226
+ - New version
227
+
228
+ * Mon Dec 10 2007 David Lutterkort <dlutter@redhat.com> - 2.0.1-1
229
+ - New version
230
+
231
+ * Wed Nov 28 2007 David Lutterkort <dlutter@redhat.com> - 1.4.4-3
232
+ - Fix buildroot
233
+
234
+ * Tue Nov 13 2007 David Lutterkort <dlutter@redhat.com> - 1.4.4-2
235
+ - Install README and CHANGELOG in _docdir
236
+
237
+ * Tue Oct 30 2007 David Lutterkort <dlutter@redhat.com> - 1.4.4-1
238
+ - Initial package
@@ -0,0 +1,43 @@
1
+ # Polisher Errata Spec
2
+ #
3
+ # Licensed under the MIT license
4
+ # Copyright (C) 2013 Red Hat, Inc.
5
+
6
+ require 'polisher/errata'
7
+
8
+ module Polisher
9
+ describe Errata do
10
+ describe "#versions_for" do
11
+ before(:each) do
12
+ @result = double(Curl::Easy.new)
13
+ @result.should_receive(:body_str).and_return({'tag' => [['rubygem-rails-1.0.0-1']]}.to_json)
14
+ end
15
+
16
+ it "uses curl to retreive updates" do
17
+ client = Curl::Easy.new
18
+ described_class.should_receive(:client).with('http://errata.url/builds').and_return(client)
19
+ client.should_receive(:get).and_return(@result)
20
+
21
+ described_class.versions_for('http://errata.url', 'rails')
22
+ end
23
+
24
+ it "returns versions" do
25
+ client = Curl::Easy.new
26
+ described_class.should_receive(:client).and_return(client)
27
+ client.should_receive(:get).and_return(@result)
28
+
29
+ described_class.versions_for('http://errata.url', 'rails').should == ['1.0.0']
30
+ end
31
+
32
+ it "invokes block with versions" do
33
+ client = Curl::Easy.new
34
+ described_class.should_receive(:client).and_return(client)
35
+ client.should_receive(:get).and_return(@result)
36
+
37
+ cb = proc {}
38
+ cb.should_receive(:call).with(:errata, 'rails', ['1.0.0'])
39
+ described_class.versions_for('http://errata.url', 'rails', &cb)
40
+ end
41
+ end
42
+ end # describe Koji
43
+ end # module Polisher