pkgwat 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/pkgwat.rb +62 -0
  2. data/lib/pkgwat/version.rb +1 -1
  3. metadata +4 -4
@@ -17,8 +17,13 @@ module Pkgwat
17
17
  PACKAGES_URL_LIST = "https://apps.fedoraproject.org/packages/fcomm_connector/xapian/query/search_packages"
18
18
  BUGS_URL = "https://apps.fedoraproject.org/packages/fcomm_connector/bugzilla/query/query_bugs"
19
19
  BUILDS_URL = "https://apps.fedoraproject.org/packages/fcomm_connector/koji/query/query_builds"
20
+ CHANGELOG_URL = "https://apps.fedoraproject.org/packages/fcomm_connector/koji/query/query_changelogs"
21
+ CONTENT_URL = "https://apps.fedoraproject.org/packages/fcomm_connector/yum/get_file_tree"
22
+ UPDATES_URL = "https://apps.fedoraproject.org/packages/fcomm_connector/bodhi/query/query_updates"
20
23
  KOJI_BUILD_STATES = ["all" => "", "f17" =>"17", "f16" => "16", "f15" => "15", "e16" => "16", "e15" => "15"]
21
24
  BUGZILLA_RELEASEA = ["all" => "", "building" =>"0", "success" => "1", "failed" => "2", "cancelled" => "3", "deleted" => "4"]
25
+ BODHI_REALEASE = ["all", "f17", "f16", "f15", "e16", "e15"]
26
+ BODHI_ARCH = ["x86_64", "i686"]
22
27
 
23
28
  def self.check_gem(name, version, distros = DEFAULT_DISTROS, throw_ex = false)
24
29
  puts "Checking #{name} #{version}...\n"
@@ -95,6 +100,59 @@ module Pkgwat
95
100
  parse_results(response.body)
96
101
  end
97
102
 
103
+ def self.get_changelog(pattern, num=nil, start=0)
104
+ num ||= total_rows(pattern, "builds", BUILDS_URL)
105
+ build_id = get_builds(pattern)[0]['build_id']
106
+ query = {"filters"=> {"build_id"=> build_id}, "rows_per_page"=> num, "start_row"=> start}
107
+ url = CHANGELOG_URL + "/" + query.to_json
108
+ uri = URI.parse(URI.escape(url))
109
+ response = submit_request(uri)
110
+ parse_results(response.body)
111
+ end
112
+
113
+ def self.get_contents(pattern, arch='x86_64', release='Rawhide')
114
+ if !BODHI_ARCH.include? arch
115
+ return "Invalid yum arch."
116
+ end
117
+ if !BODHI_REALEASE.include? release
118
+ return "Invalid bodhi release."
119
+ end
120
+ url = CONTENT_URL + "?package=#{pattern}&arch=#{arch}&repo=#{release}"
121
+ uri = URI.parse(URI.escape(url))
122
+ response = submit_request(uri)
123
+ JSON.parse(response.body)
124
+ end
125
+
126
+ def self.get_releases(pattern, num=nil, start=0)
127
+ num ||= total_rows(pattern, "releases", PACKAGES_URL)
128
+ query = {"filters"=> {"package"=> pattern}, "rows_per_page"=> num, "start_row"=> start}
129
+ url = PACKAGES_URL + "/" + query.to_json
130
+ uri = URI.parse(URI.escape(url))
131
+ response = submit_request(uri)
132
+ parse_results(response.body)
133
+ end
134
+
135
+ def self.get_updates(pattern, status, release, num=nil, start=0)
136
+ num ||= total_rows(pattern, "updates", UPDATES_URL)
137
+ if !BODHI_REALEASE.include? status
138
+ return "Invalid bodhi state."
139
+ end
140
+ if !BODHI_REALEASE.include? release
141
+ return "Invalid bodhi release."
142
+ end
143
+ if status == "all"
144
+ status = ""
145
+ end
146
+ if release == "all"
147
+ release = ""
148
+ end
149
+ query = {"rows_per_page"=> num, "start_row"=> start, "filters"=> {"package"=> pattern, "release" => release, "state"=> status}}
150
+ url = PACKAGES_URL + "/" + query.to_json
151
+ uri = URI.parse(URI.escape(url))
152
+ response = submit_request(uri)
153
+ parse_results(response.body)
154
+ end
155
+
98
156
  def self.search_params(gem)
99
157
  filters = { :package => package_name(gem) }
100
158
  { :filters => filters }
@@ -128,6 +186,10 @@ module Pkgwat
128
186
  query = {"rows_per_page"=> 10, "start_row"=> 0, "filters"=> {"state"=> "", "package"=> pattern}}
129
187
  elsif type == "bugs"
130
188
  query = {"filters"=> {"package"=> pattern, "version"=> ""}, "rows_per_page"=> 10, "start_row"=> 0}
189
+ elsif type == "releases"
190
+ query = {"filters"=> {"package"=> pattern}, "rows_per_page"=> 10, "start_row"=> 0}
191
+ elsif type == "updates"
192
+ query = {"rows_per_page"=> 10, "start_row"=> 0, "filters"=> {"package"=> pattern, "release" => "all", "state"=> "all"}}
131
193
  end
132
194
  url = type_url + "/" + query.to_json
133
195
  uri = URI.parse(URI.escape(url))
@@ -1,3 +1,3 @@
1
1
  module Pkgwat
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pkgwat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-02 00:00:00.000000000 Z
12
+ date: 2013-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -139,7 +139,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
139
139
  version: '0'
140
140
  segments:
141
141
  - 0
142
- hash: 3460093334398033452
142
+ hash: 2352334897922640855
143
143
  required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  none: false
145
145
  requirements:
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  segments:
150
150
  - 0
151
- hash: 3460093334398033452
151
+ hash: 2352334897922640855
152
152
  requirements: []
153
153
  rubyforge_project: pkgwat
154
154
  rubygems_version: 1.8.24