Skip to content

Commit

Permalink
Add resque clause to patched? method. Fix #29.
Browse files Browse the repository at this point in the history
  • Loading branch information
axilleas committed Aug 30, 2014
1 parent 8bf87a4 commit 33c5c36
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions app/models/fedora_rpm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,14 @@ def retrieve_version(fedora_version)
rpm = Pkgwat.get_releases(name).select do |r|
r['release'] == fedora_version
end
if !!(rpm.first['stable_version'].match(/href/))
rpm.first['stable_version'].scan(/>.*-/)[0].gsub(/[>-]/, '')
version = rpm.first['stable_version']

if !!(version.match(/href/))
version.scan(/>.*-/)[0].gsub(/[>-]/, '')
elsif version.include?('-')
version.split('-').first
else
rpm.first['stable_version'].split('-').first
version
end
end

Expand Down Expand Up @@ -174,9 +178,13 @@ def any_patched?
# - "fN" where N the Fedora version number, eg: 22,21,20,19,etc.
# If no parameter is passed, it defaults to master.
def patched?(version_git = 'master')
spec_url = "#{base_uri}#{name}.git/plain/#{name}.spec?h=#{version_git}"
rpm_spec = open(spec_url).read
rpm_spec.scan(/\nPatch0:\s*.*\n/).size != 0

url = "#{spec_uri}?h=#{version_git}"
begin
open(url).read.scan(/\nPatch0:\s*.*\n/).size != 0
rescue OpenURI::HTTPError
false
end
end

# Get the alias mail for the package.
Expand Down

0 comments on commit 33c5c36

Please sign in to comment.