Mailinglist Archive: yast-commit (1771 mails)

< Previous Next >
[yast-commit] <rest-service> basesystem : patches module: fixed vendor package list. #TODO: read real yml file, add tests
  • From: Bjoern Geuken <bgeuken@xxxxxxx>
  • Date: Mon, 31 Aug 2009 17:42:44 +0200
  • Message-id: <E1Mj7Kc-0002s3-Bj@xxxxxxxxxxxxxxxx>
ref: refs/heads/basesystem
commit 576fcd2127a2d10f936f61800da6d37749fe4186
Author: Bjoern Geuken <bgeuken@xxxxxxx>
Date: Mon Aug 31 17:42:44 2009 +0200

patches module: fixed vendor package list. #TODO: read real yml file, add
tests
---
.../patches/app/controllers/packages_controller.rb | 30 ++++++++++---------
plugins/patches/app/models/package.rb | 7 ----
2 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/plugins/patches/app/controllers/packages_controller.rb
b/plugins/patches/app/controllers/packages_controller.rb
index e2b46ca..38d8bfd 100644
--- a/plugins/patches/app/controllers/packages_controller.rb
+++ b/plugins/patches/app/controllers/packages_controller.rb
@@ -38,30 +38,32 @@ class PackagesController < ApplicationController
end
end

- public
-
def compare_lists(packages)
- vendor_packages = Hash.new
- # yml datei auslesen: ["packages"] => ["yast-core", "ruby-dbus", ...]
- package_list = Array.new
- package_list << ["yast2-users", "3ddiag", "foo"]
+ vendor_packages = Array.new
+ #TODO: replace by real yml file
+ package_list = ["3ddiag", "foo", "yast2-users", "yast2-network"]

package_list.each {|pk_name|
- packages.each {|p|
+ p = nil
+ for i in 0..packages.size-1
# package installed?
- if p.name == pk_name
- # store version and name
- vendor_packages["package"] = {:name => "#{p.name}", :version =>
"#{p.version}"}
+ if pk_name == packages[i].name
+ # store package
+ p = packages[i]
+ break
end
- }
- unless vendor_packages.has_key? pk_name
- vendor_packages["package"] = {"#{pk_name}" => "not installed"}
+ end
+ if p
+ vendor_packages << p
+ else
+ vendor_packages << Package.new(:resolvable_id => 0, :name => pk_name,
:version => "not_installed")
end
}
- # puts vendor_packages.inspect
vendor_packages
end

+ public
+
# GET /patch_updates
# GET /patch_updates.xml
def index
diff --git a/plugins/patches/app/models/package.rb
b/plugins/patches/app/models/package.rb
index cd9b67d..96e10e6 100644
--- a/plugins/patches/app/models/package.rb
+++ b/plugins/patches/app/models/package.rb
@@ -6,13 +6,6 @@ class Package < PackageKitModule
:name,
:version

-=begin
- def initialize(attributes)
- attributes.each do |key, value|
- instance_variable_set("@#{key}", value)
- end
- end
-=end
def to_xml( options = {} )
xml = options[:builder] ||= Builder::XmlMarkup.new(options)
xml.instruct! unless options[:skip_instruct]
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages