Mailinglist Archive: yast-commit (1771 mails)

< Previous Next >
[yast-commit] <rest-service> basesystem : packages module: compare installed packages with vendor list (on rest-service)
  • From: Bjoern Geuken <bgeuken@xxxxxxx>
  • Date: Fri, 28 Aug 2009 16:45:34 +0200
  • Message-id: <E1Mj7Ka-0002ps-Ew@xxxxxxxxxxxxxxxx>
ref: refs/heads/basesystem
commit cddddcc11c0d9e7f04d9f2fca0ded04e50a71a45
Author: Bjoern Geuken <bgeuken@xxxxxxx>
Date: Fri Aug 28 16:45:34 2009 +0200

packages module: compare installed packages with vendor list (on
rest-service)
---
.../patches/app/controllers/packages_controller.rb | 25 ++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/plugins/patches/app/controllers/packages_controller.rb
b/plugins/patches/app/controllers/packages_controller.rb
index e3e9718..e2b46ca 100644
--- a/plugins/patches/app/controllers/packages_controller.rb
+++ b/plugins/patches/app/controllers/packages_controller.rb
@@ -40,11 +40,36 @@ class PackagesController < ApplicationController

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"]
+
+ package_list.each {|pk_name|
+ packages.each {|p|
+ # package installed?
+ if p.name == pk_name
+ # store version and name
+ vendor_packages["package"] = {:name => "#{p.name}", :version =>
"#{p.version}"}
+ end
+ }
+ unless vendor_packages.has_key? pk_name
+ vendor_packages["package"] = {"#{pk_name}" => "not installed"}
+ end
+ }
+ # puts vendor_packages.inspect
+ vendor_packages
+ end
+
# GET /patch_updates
# GET /patch_updates.xml
def index
# note: permission check was performed in :before_filter
@packages = Package.find(:installed)
+ if params[:filter] == "custom"
+ @packages = compare_lists(@packages)
+ end
respond_to do |format|
format.html { render :xml => @packages.to_xml( :root => "packages",
:dasherize => false ) }
format.xml { render :xml => @packages.to_xml( :root => "packages",
:dasherize => false ) }
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages