Hello community, here is the log from the commit of package yast2-packager for openSUSE:13.1 checked in at 2013-10-17 15:22:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:13.1/yast2-packager (Old) and /work/SRC/openSUSE:13.1/.yast2-packager.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-packager" Changes: -------- --- /work/SRC/openSUSE:13.1/yast2-packager/yast2-packager.changes 2013-09-27 19:41:53.000000000 +0200 +++ /work/SRC/openSUSE:13.1/.yast2-packager.new/yast2-packager.changes 2013-10-19 16:51:03.000000000 +0200 @@ -1,0 +2,8 @@ +Tue Oct 15 07:11:25 UTC 2013 - [email protected] + +- removed non-working *-webpin subpackage (the external service for + package search does not work, without that service it is useless) + (bnc#845622) +- 3.0.6 + +------------------------------------------------------------------- Old: ---- yast2-packager-3.0.5.tar.bz2 New: ---- yast2-packager-3.0.6.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-packager.spec ++++++ --- /var/tmp/diff_new_pack.bhlFWf/_old 2013-10-19 16:51:04.000000000 +0200 +++ /var/tmp/diff_new_pack.bhlFWf/_new 2013-10-19 16:51:04.000000000 +0200 @@ -17,8 +17,8 @@ Name: yast2-packager -Version: 3.0.5 -Release: 0 +Version: 3.0.6 +Release: 5 BuildRoot: %{_tmppath}/%{name}-%{version}-build Source0: yast2-packager-%{version}.tar.bz2 @@ -85,19 +85,15 @@ Obsoletes: yast2-trans-inst-packages Obsoletes: yast2-trans-package-manager +# force *-webpin subpackage removal at upgrade +Obsoletes: yast2-packager-webpin < %version + Requires: yast2-ruby-bindings >= 1.0.0 Summary: YaST2 - Package Library License: GPL-2.0+ Group: System/YaST -%package webpin - -Requires: yast2-ruby-bindings >= 1.0.0 - -Summary: YaST2 - Webpin package search client -Group: System/YaST - %package devel-doc Requires: yast2-packager = %version Summary: YaST2 - Development Documentation @@ -106,10 +102,6 @@ %description This package contains the libraries and modules for software management. -%description webpin -This package contains a client for searching packages in online repositories -(webpin) and installing them via OneClickInstall - %description devel-doc This package contains development documentation for using the API provided by yast2-packager package. @@ -148,9 +140,7 @@ /usr/share/YaST2/include/checkmedia/* /usr/share/YaST2/include/packager/* /usr/share/YaST2/clients/*.rb -%exclude /usr/share/YaST2/clients/webpin_package_search.rb /usr/share/YaST2/modules/* -%exclude /usr/share/YaST2/modules/WebpinPackageSearch.rb %{_prefix}/share/applications/YaST2/*.desktop /usr/share/YaST2/scrconf/* %{_prefix}/lib/YaST2/servers_non_y2/ag_* @@ -161,9 +151,4 @@ %files devel-doc %doc %{_prefix}/share/doc/packages/yast2-packager/autodocs -%files webpin -%defattr(-,root,root) -/usr/share/YaST2/clients/webpin_package_search.rb -/usr/share/YaST2/modules/WebpinPackageSearch.rb - %changelog ++++++ yast2-packager-3.0.5.tar.bz2 -> yast2-packager-3.0.6.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.0.5/Makefile.in new/yast2-packager-3.0.6/Makefile.in --- old/yast2-packager-3.0.5/Makefile.in 2013-09-11 17:44:56.000000000 +0200 +++ new/yast2-packager-3.0.6/Makefile.in 2013-10-15 09:19:02.000000000 +0200 @@ -684,7 +684,7 @@ *.zip*) \ unzip $(distdir).zip ;;\ esac - chmod -R a-w $(distdir); chmod u+w $(distdir) + chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.0.5/VERSION new/yast2-packager-3.0.6/VERSION --- old/yast2-packager-3.0.5/VERSION 2013-09-03 17:06:48.000000000 +0200 +++ new/yast2-packager-3.0.6/VERSION 2013-10-15 09:11:21.000000000 +0200 @@ -1 +1 @@ -3.0.5 +3.0.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.0.5/configure new/yast2-packager-3.0.6/configure --- old/yast2-packager-3.0.5/configure 2013-09-11 17:44:54.000000000 +0200 +++ new/yast2-packager-3.0.6/configure 2013-10-15 09:19:01.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for yast2-packager 3.0.5. +# Generated by GNU Autoconf 2.69 for yast2-packager 3.0.6. # # Report bugs to <http://bugs.opensuse.org/>. # @@ -579,8 +579,8 @@ # Identity of this package. PACKAGE_NAME='yast2-packager' PACKAGE_TARNAME='yast2-packager' -PACKAGE_VERSION='3.0.5' -PACKAGE_STRING='yast2-packager 3.0.5' +PACKAGE_VERSION='3.0.6' +PACKAGE_STRING='yast2-packager 3.0.6' PACKAGE_BUGREPORT='http://bugs.opensuse.org/' PACKAGE_URL='' @@ -1249,7 +1249,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures yast2-packager 3.0.5 to adapt to many kinds of systems. +\`configure' configures yast2-packager 3.0.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1320,7 +1320,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of yast2-packager 3.0.5:";; + short | recursive ) echo "Configuration of yast2-packager 3.0.6:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -yast2-packager configure 3.0.5 +yast2-packager configure 3.0.6 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1417,7 +1417,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by yast2-packager $as_me 3.0.5, which was +It was created by yast2-packager $as_me 3.0.6, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2356,7 +2356,7 @@ # Define the identity of the package. PACKAGE='yast2-packager' - VERSION='3.0.5' + VERSION='3.0.6' cat >>confdefs.h <<_ACEOF @@ -2479,7 +2479,7 @@ -VERSION="3.0.5" +VERSION="3.0.6" RPMNAME="yast2-packager" MAINTAINER="Ladislav Slezak <[email protected]>" @@ -3432,7 +3432,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by yast2-packager $as_me 3.0.5, which was +This file was extended by yast2-packager $as_me 3.0.6, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -3485,7 +3485,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -yast2-packager config.status 3.0.5 +yast2-packager config.status 3.0.6 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.0.5/configure.ac new/yast2-packager-3.0.6/configure.ac --- old/yast2-packager-3.0.5/configure.ac 2013-09-11 17:44:50.000000000 +0200 +++ new/yast2-packager-3.0.6/configure.ac 2013-10-15 09:18:59.000000000 +0200 @@ -3,7 +3,7 @@ dnl -- This file is generated by y2autoconf 3.0.5 - DO NOT EDIT! -- dnl (edit configure.ac.in or configure.in.in instead) -AC_INIT(yast2-packager, 3.0.5, http://bugs.opensuse.org/, yast2-packager) +AC_INIT(yast2-packager, 3.0.6, http://bugs.opensuse.org/, yast2-packager) dnl Check for presence of file 'RPMNAME' AC_CONFIG_SRCDIR([RPMNAME]) @@ -18,7 +18,7 @@ AM_INIT_AUTOMAKE(tar-ustar -Wno-portability) dnl Important YaST2 variables -VERSION="3.0.5" +VERSION="3.0.6" RPMNAME="yast2-packager" MAINTAINER="Ladislav Slezak <[email protected]>" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.0.5/src/Makefile.am new/yast2-packager-3.0.6/src/Makefile.am --- old/yast2-packager-3.0.5/src/Makefile.am 2013-08-02 20:40:25.000000000 +0200 +++ new/yast2-packager-3.0.6/src/Makefile.am 2013-10-15 09:06:04.000000000 +0200 @@ -14,7 +14,6 @@ modules/Packages.rb \ modules/SourceDialogs.rb \ modules/SourceManagerSLP.rb \ - modules/WebpinPackageSearch.rb \ modules/KeyManager.rb \ modules/CheckMedia.rb \ modules/SlideShowCallbacks.rb @@ -43,7 +42,6 @@ clients/inst_desktop.rb \ clients/inst_mediacopy.rb \ clients/wrapper_slideshow_callbacks.rb \ - clients/webpin_package_search.rb \ clients/checkmedia.rb yncludedir = @yncludedir@/packager diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.0.5/src/Makefile.in new/yast2-packager-3.0.6/src/Makefile.in --- old/yast2-packager-3.0.5/src/Makefile.in 2013-09-11 17:44:56.000000000 +0200 +++ new/yast2-packager-3.0.6/src/Makefile.in 2013-10-15 09:19:02.000000000 +0200 @@ -240,7 +240,6 @@ modules/Packages.rb \ modules/SourceDialogs.rb \ modules/SourceManagerSLP.rb \ - modules/WebpinPackageSearch.rb \ modules/KeyManager.rb \ modules/CheckMedia.rb \ modules/SlideShowCallbacks.rb @@ -269,7 +268,6 @@ clients/inst_desktop.rb \ clients/inst_mediacopy.rb \ clients/wrapper_slideshow_callbacks.rb \ - clients/webpin_package_search.rb \ clients/checkmedia.rb ynclude_DATA = \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.0.5/src/clients/webpin_package_search.rb new/yast2-packager-3.0.6/src/clients/webpin_package_search.rb --- old/yast2-packager-3.0.5/src/clients/webpin_package_search.rb 2013-07-30 13:20:09.000000000 +0200 +++ new/yast2-packager-3.0.6/src/clients/webpin_package_search.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,498 +0,0 @@ -# encoding: utf-8 - -# File: webpin_package_search.ycp -# Package: YaST packager - Client using Webpin XML API -# Authors: Katarina Machalkova <[email protected]> -# Lukas Ocilka <[email protected]> -# -# $Id$ -# -# This client provides UI for searching for packages -# via Webpin XML. -# See http://en.opensuse.org/Package_Search/Design for the API. -module Yast - class WebpinPackageSearchClient < Client - def main - Yast.import "UI" - textdomain "packager" - - Yast.import "Label" - Yast.import "Popup" - Yast.import "Progress" - Yast.import "Sequencer" - Yast.import "WebpinPackageSearch" - Yast.import "Wizard" - Yast.import "Directory" - Yast.import "Map" - Yast.import "Report" - - @search_results = {} - @all_selected = {} - - - Wizard.CreateDialog - - @client_ret = MainSequence() - - Wizard.CloseDialog - - @client_ret - end - - def SomethingSelected - @all_selected != {} - end - - def AbortDialog - if SomethingSelected() - return Popup.YesNo(_("All changes will be lost. Really exit?")) - else - return true - end - end - - def Abort - ret = UI.PollInput - - if ret == :abort - return AbortDialog() - else - return false - end - end - - def SearchExpression - ret = Convert.to_string(UI.QueryWidget(Id("search_text"), :Value)) - - if ret == "" - Popup.Message(_("Search expression must not be empty!")) - UI.SetFocus(Id("search_text")) - end - ret - end - - def SearchParameters - p = Convert.to_list(UI.QueryWidget(Id("search_in"), :SelectedItems)) - - ret = Builtins.listmap(["name", "description", "contents"]) do |key| - { key => Builtins.contains(p, key) } - end - #y2internal("%1", ret); - deep_copy(ret) - end - - def CurrentTable - ctable = UI.WidgetExists(Id("results")) ? "results" : "all" - - ctable - end - - def CreatePackageDescription - ctable = CurrentTable() - checksum = Convert.to_string(UI.QueryWidget(Id(ctable), :CurrentItem)) - - citem = ctable == "results" ? - Ops.get(@search_results, checksum, {}) : - Ops.get(@all_selected, checksum, {}) - ret = "" - - if citem != {} - descr = Builtins.sformat( - _("<b>Repository URL:</b> %1<br>"), - Ops.get_string(citem, "repoURL", "") - ) - version = Builtins.sformat( - _("<b>Version:</b> %1<br>"), - Ops.get_string(citem, "version", "") - ) - - archs = Builtins.sformat( - _("<b>Architecture:</b> %1<br>"), - Builtins.mergestring(Ops.get_list(citem, "archs", []), ",") - ) - ret = Ops.add( - Ops.add(Ops.add(Ops.add("<p>", descr), version), archs), - "</p>" - ) - end - - UI.ChangeWidget(Id("description"), :Value, ret) - - nil - end - - def CreatePackageListItems(results) - results = deep_copy(results) - pkg_items = [] - - Builtins.foreach(results) do |iD, pkg_line| - # Webpin seems to return "ppc" arch even for some i386 packages (e.g., "joe") - # doesn't match the architecture - # if (! WebpinPackageSearch::MatchesCurrentArchitecture (it["archs"]:["noarch"])) { - # y2milestone ("Doesn't match the current arch: %1", it); - # return; - # } - pkg_items = Builtins.add( - pkg_items, - Item( - Id(iD), - Ops.add( - Ops.add(Ops.get_string(pkg_line, "name", ""), " - "), - Ops.get_string(pkg_line, "summary", "") - ) - ) - ) - end - deep_copy(pkg_items) - end - - def PopulatePackageList(results) - results = deep_copy(results) - items = CreatePackageListItems(results) - ctable = CurrentTable() - - _IDs = Convert.convert( - Builtins.toset(Map.Keys(results)), - :from => "list", - :to => "list <string>" - ) - wantedIDs = Convert.convert( - Builtins.toset(Map.Keys(@all_selected)), - :from => "list", - :to => "list <string>" - ) - Builtins.y2milestone( - "Package IDs: %1, previously selected: %2", - _IDs, - wantedIDs - ) - - if results != nil - UI.ChangeWidget(Id(ctable), :Items, items) - - if ctable == "all" - UI.ChangeWidget(Id(ctable), :SelectedItems, wantedIDs) - else - UI.ChangeWidget( - Id(ctable), - :SelectedItems, - Builtins::Multiset.intersection(_IDs, wantedIDs) - ) - end - - UI.SetFocus(Id(ctable)) - else - UI.SetFocus(Id("search_text")) - end - - nil - end - - def SelectedPackages - result = [] - - Builtins.foreach(@all_selected) { |s, m| result = Builtins.add(result, m) } - - Builtins.y2milestone("Passing these data to WebPin %1", result) - deep_copy(result) - end - - def AddItemIfNotExists(checksum, data) - data = deep_copy(data) - if !Builtins.haskey(@all_selected, checksum) - Ops.set(@all_selected, checksum, data) - end - - nil - end - - def RemoveItemIfExists(checksum) - if Builtins.haskey(@all_selected, checksum) - @all_selected = Builtins.remove(@all_selected, checksum) - end - - nil - end - - def UpdateSelectedPkgs - ctable = CurrentTable() - selected_items = Builtins.toset( - Convert.convert( - UI.QueryWidget(Id(ctable), :SelectedItems), - :from => "any", - :to => "list <string>" - ) - ) - other_items = [] - - tt = Convert.convert( - UI.QueryWidget(Id(ctable), :Items), - :from => "any", - :to => "list <term>" - ) - Builtins.foreach(tt) do |t| - tmp = Ops.get_string( - Builtins.argsof(Ops.get_term(Builtins.argsof(t), 0, term(:none))), - 0, - "" - ) - if !Builtins.contains(selected_items, tmp) - other_items = Builtins.add(other_items, tmp) - end - end - - other_items = Builtins.toset(other_items) - - Builtins.foreach(selected_items) do |it| - AddItemIfNotExists(it, Ops.get(@search_results, it, {})) - end if ctable == "results" - Builtins.foreach(other_items) { |it| RemoveItemIfExists(it) } - - - Builtins.y2milestone("Selecting these packages: %1", @all_selected) - - nil - end - - def ReadDialog - steps = [ - _("Check Network Configuration"), - _("Initialize Software Manager") - ] - - actions = [ - _("Checking Network Configuration ..."), - _("Initializing Software Manager ... ") - ] - - Progress.New( - _("Reading Package Search Setup..."), - " ", - Builtins.size(steps), - steps, - actions, - _("<p>Packager is initializing...</p>") - ) - - Progress.NextStage - return :abort if Abort() - Builtins.sleep(100) - - Progress.NextStage - return :abort if Abort() - Builtins.sleep(100) - - Progress.Finish - :next - end - - def MainDialog - current_search_box = MultiSelectionBox( - Id("results"), - Opt(:notify, :hstretch), - "", - [] - ) - all_pkgs_box = MultiSelectionBox( - Id("all"), - Opt(:notify, :hstretch), - "", - [] - ) - - Wizard.SetContents( - # TRANSLATORS: dialog caption - _("Package Search"), - VBox( - HBox( - VBox( - HBox( - Bottom( - InputField( - Id("search_text"), - Opt(:hstretch), - _("Search &Expression") - ) - ), - # TRANSLATORS: push button - HSpacing(1), - Bottom(PushButton(Id("search"), Opt(:default), _("&Search"))) - ), - VStretch() - ), #, - MultiSelectionBox( - Id("search_in"), - _("Search &in"), - [ - Item(Id("name"), _("Name"), true), - Item(Id("description"), _("Description"), true), - Item(Id("contents"), _("Contents")) - ] - ) - ), - #`RadioButtonGroup( - # `id(`rb), - # `VBox( - # `Left(`Label( _("Search Repositories"))), - # `Frame( "", - # `VBox( - # `Left(`RadioButton(`id("current_product"),_("Current product") ) ), - # `Left(`RadioButton(`id("factory"),_("Factory") ) ), - # `VStretch() - # ) - # ) - # ) - #) - #) - #), - VWeight( - 2, - DumbTab( - Id("tab_bar"), - [ - Item(Id("search_tab"), _("&Found Packages"), true), - Item(Id("all_tab"), _("&All Selected Packages")) - ], - ReplacePoint(Id(:rp), current_search_box) - ) - ), - #`HBox( - Left(Label(_("Package Description"))), - #`HStretch(), - #`CheckBox(_("Keep Package Repositories Subscribed"), true) - #), - VWeight(1, RichText(Id("description"), "")) - ), - _( - "<p><big><b>Package Search</b></big><br>\nUse the functionality of <i>Webpin package search</i> to search in all known openSUSE build-service and openSUSE community repositories.</p>\n" - ) + - _( - "<p><big><b>Security</b></big><br> The software found is often not part of the\n" + - "distribution itself. You need to decide whether to trust the source of a\n" + - "package. We do not take any responsibility for installing such software.</p>\n" - ), - #We don't need back button - false, - true - ) - - Wizard.SetDesktopTitleAndIcon("webpin") - Wizard.SetAbortButton(:cancel, Label.CancelButton) - - UI.SetFocus(Id("search_text")) - - - dialog_ret = nil - while true - dialog_ret = UI.UserInput - - UpdateSelectedPkgs() if dialog_ret != "results" && dialog_ret != "all" - - if dialog_ret == :next - temporary_xml = Ops.add( - Directory.tmpdir, - "/one_click_install_temporary_file.xml" - ) - - selected_packages = SelectedPackages() - - if selected_packages == nil || Builtins.size(selected_packages) == 0 - Report.Message(_("Select packages to install.")) - UI.SetFocus(Id("results")) - next - end - - WebpinPackageSearch.PrepareOneClickInstallDescription( - selected_packages, - temporary_xml - ) - - oci = WFM.CallFunction("OneClickInstallUI", [temporary_xml]) - Builtins.y2milestone("OneClickInstallUI returned: %1", oci) - break - elsif dialog_ret == "search" - UI.ChangeWidget(Id("tab_bar"), :CurrentItem, "search_tab") - UI.ReplaceWidget(Id(:rp), current_search_box) - search_expr = SearchExpression() - - if search_expr != "" - search_params = SearchParameters() - Popup.ShowFeedback("", _("Searching for packages...")) - tmp_results = WebpinPackageSearch.SearchForPackages( - search_expr, - nil, - search_params - ) - @search_results = Builtins.listmap(tmp_results) do |m| - { Ops.get_string(m, "checksum", "") => m } - end - Popup.ClearFeedback - PopulatePackageList(@search_results) - - if @search_results == nil - # error message - UI.ChangeWidget( - Id("description"), - :Value, - _("<p><b>Search failed</b></p>") - ) - elsif @search_results == {} - UI.ChangeWidget( - Id("description"), - :Value, - _( - "<p><b>No packages matching entered criteria were found.</b></p>" - ) - ) - else - CreatePackageDescription() - end - end - next - elsif dialog_ret == "search_tab" - UI.ReplaceWidget(Id(:rp), current_search_box) - PopulatePackageList(@search_results) - CreatePackageDescription() - elsif dialog_ret == "all_tab" - UI.ReplaceWidget(Id(:rp), all_pkgs_box) - PopulatePackageList(@all_selected) - CreatePackageDescription() - elsif dialog_ret == "results" || dialog_ret == "all" - CreatePackageDescription() - elsif dialog_ret == :abort || dialog_ret == :cancel - if AbortDialog() - dialog_ret = :abort - Builtins.y2milestone("Aborting...") - break - end - else - Builtins.y2error("Unknown ret: %1", dialog_ret) - end - end - Convert.to_symbol(dialog_ret) - end - - def MainSequence - aliases = - # "write" : ``(WriteDialog()) - { "read" => lambda { ReadDialog() }, "main" => lambda { MainDialog() } } - - sequence = - # "write" : $[ - # `abort : `abort, - # `next : `next - # ], - { - "ws_start" => "read", - "read" => { :next => "main", :abort => :abort }, - "main" => { :abort => :abort, :next => :next } - } - - seq_ret = Sequencer.Run(aliases, sequence) - - Convert.to_symbol(seq_ret) - end - end -end - -Yast::WebpinPackageSearchClient.new.main diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-packager-3.0.5/src/modules/WebpinPackageSearch.rb new/yast2-packager-3.0.6/src/modules/WebpinPackageSearch.rb --- old/yast2-packager-3.0.5/src/modules/WebpinPackageSearch.rb 2013-08-22 09:12:13.000000000 +0200 +++ new/yast2-packager-3.0.6/src/modules/WebpinPackageSearch.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,502 +0,0 @@ -# encoding: utf-8 - -# File: -# WebpinPackageSearch.ycp -# -# Module: -# WebpinPackageSearch -# -# Summary: -# YaST API to api.opensuse-community.org -# -# Authors: -# Lukas Ocilka <[email protected]> -# Katarina Machalkova <[email protected]> -require "yast" - -module Yast - class WebpinPackageSearchClass < Module - def main - - textdomain "packager" - - Yast.import "HTTP" - Yast.import "OSRelease" - Yast.import "Directory" - Yast.import "FileUtils" - Yast.import "URL" - Yast.import "Arch" - Yast.import "Report" - - @temporary_file = Ops.add(Directory.tmpdir, "/package_search_webpin.xml") - - # Base search URL, default is "http://api.opensuse-community.org/searchservice/" - @base_url = "http://api.opensuse-community.org/searchservice/" - - # List of architecture dependencies. Every row contains one list - # of dependencies sortred from left (the newest) to right (the oldest). - # Architectures are backward-compatible. - @deps = [ - # i386 and x86 - ["x86_64", "i686", "i586", "i486", "i386", "noarch", "src"], - # PPC - ["ppc64", "ppc", "noarch", "src"], - # s390 - ["s390_64", "s390_32", "noarch", "src"], - # IA-64 - ["ia64", "noarch", "src"], - # Alpha - [ - "alphaev67", - "alphaev6", - "alphapca56", - "alphaev56", - "alphaev5", - "alpha", - "noarch", - "src" - ], - # SPARC - ["sparc64", "sparcv9", "sparcv8", "sparc", "noarch", "src"], - # MIPS - ["mips64", "mips", "noarch", "src"] - ] - - @already_guessed = nil - end - - # Sets base search URL - # WARNING: Use this only if you know what you are doing! - # - # @param string new base_url - def SetBaseSearchURL(new_base_url) - if new_base_url == "" || new_base_url == nil - Builtins.y2error("Wrong base URL: '%1'", new_base_url) - return - end - - @base_url = new_base_url - Builtins.y2milestone("New base URL has been set: %1", @base_url) - - nil - end - - # Returns base search URL - # - # @string current base_url - def GetBaseSearchURL - @base_url - end - - # Returns whether the current architecture matches the list of architectures - # got as a parameter. The current architecture is backward compatible, so - # also dependencies are taken into account. - # - # @param list <string> list of architectures to check - # @return [Boolean] whether they match the current architecture - # - # @example - # // current architecture is "i386" - # MatchesCurrentArchitecture (["noarch", "ppc", "i386"]) -> true - # MatchesCurrentArchitecture (["noarch"]) -> true - # MatchesCurrentArchitecture (["x86_64"]) -> false - # MatchesCurrentArchitecture (["ppc"]) -> false - def MatchesCurrentArchitecture(archs_to_check) - archs_to_check = deep_copy(archs_to_check) - current_arch = Arch.architecture - - matches = false - - # one or more archs supported by source - Builtins.foreach(archs_to_check) do |one_arch_to_check| - # check all arch dependencies - Builtins.foreach(@deps) do |one_archlist| - # both current and checked architectures are in the same list - if Builtins.contains(one_archlist, current_arch) && - Builtins.contains(one_archlist, one_arch_to_check) - cur_arch_row = nil - match_arch_row = nil - - str_offset = -1 - - # find current_architecture in deps - Builtins.foreach(one_archlist) do |one_arch| - str_offset = Ops.add(str_offset, 1) - if one_arch == current_arch - cur_arch_row = str_offset - raise Break - end - end - - str_offset = -1 - - # find architecture_to_check in deps - Builtins.foreach(one_archlist) do |one_arch| - str_offset = Ops.add(str_offset, 1) - if one_arch == one_arch_to_check - match_arch_row = str_offset - raise Break - end - end - - # compare - if Ops.greater_or_equal(match_arch_row, cur_arch_row) - matches = true - raise Break - end - end - end - raise Break if matches - end - - matches - end - - # Guesses the current distribution installed - # - # @return [String] distribution (Webpin format) - # - # @examle - # // Installed openSUSE 11.0 - # GuessCurrentDistribution() -> "openSUSE_110" - def GuessCurrentDistribution - return @already_guessed if @already_guessed != nil - - rel_name = OSRelease.ReleaseName - rel_version = OSRelease.ReleaseVersion - - if Builtins.regexpmatch(rel_version, ".") - rel_version = Builtins.mergestring( - Builtins.splitstring(rel_version, "."), - "" - ) - end - - @already_guessed = Builtins.sformat("%1_%2", rel_name, rel_version) - @already_guessed - end - - # Changes the Webpin distro format to OneClickInstall format. - # - # @param [String] distro - # @return [String] modified distro - # - # @example - # ModifyDistro ("openSUSE_110") -> "openSUSE 11.0" - def ModifyDistro(distro) - if Builtins.regexpmatch(distro, "^.*_[0123456789]+[0123456789]$") - distro = Builtins.regexpsub( - distro, - "^(.*)_([0123456789]+)([0123456789])$", - "\\1 \\2.\\3" - ) - elsif Builtins.regexpmatch(distro, "^.*_[0123456789]+") - distro = Builtins.regexpsub(distro, "^(.*)_([0123456789]+)$", "\\1 \\2") - else - Builtins.y2warning("'%1' doesn't match any known regexp", distro) - end - - distro - end - - # Writes XML configuration file for OnleClickInstall client. - # - # @param [Array<Hash>] packages_to_install (in the same format as got from SearchForPackages function) - # @param [String] save_to_file - # @return [Boolean] if successful - # - # @see SearchForPackages() for the format of <map> package_to_install - def PrepareOneClickInstallDescription(packages_to_install, save_to_file) - packages_to_install = deep_copy(packages_to_install) - if FileUtils.Exists(save_to_file) - Builtins.y2warning("File %1 already exists, removing", save_to_file) - SCR.Execute(path(".target.remove"), save_to_file) - end - - distro = "" - repoURL = "" - - write_xml = { - "metapackage" => { - "xmlns" => "http://opensuse.org/Standards/One_Click_Install" - } - } - - repositories = {} - packages = {} - - Builtins.foreach(packages_to_install) do |one_package| - distro = Ops.get_string(one_package, "distro") do - GuessCurrentDistribution() - end - repoURL = Ops.get_string(one_package, "repoURL", "") - # all repositories - Ops.set( - repositories, - distro, - Builtins.add(Ops.get_list(repositories, distro, []), repoURL) - ) - # all packages - Ops.set( - packages, - distro, - Builtins.add( - Ops.get_list(packages, distro, []), - { - "item" => [ - { - "name" => [ - { "content" => Ops.get_string(one_package, "name", "") } - ], - "summary" => [ - { "content" => Ops.get_string(one_package, "summary", "") } - ], - "description" => [ - { - "content" => Ops.get_locale( - # TRANSLATORS: package description item - one_package, - "description", - Ops.get_locale( - one_package, - "summary", - _("No further information available.") - ) - ) - } - ] - } - ] - } - ) - ) - end - - Builtins.foreach( - Convert.convert( - repositories, - :from => "map", - :to => "map <string, list <string>>" - ) - ) do |distro2, distro_repos| - group = { - "distversion" => ModifyDistro(distro2), - "remainSubscribed" => { "content" => "true" }, - "repositories" => Builtins.toset(Builtins.maplist(distro_repos) do |one_repo| - { - "repository" => [ - { - "name" => [{ "content" => one_repo }], - "url" => [{ "content" => one_repo }], - # TRANSLATORS: repository summary - "summary" => [ - { "content" => _("Unknown repository") } - ], - # TRANSLATORS: repositry description - "description" => [ - { - "content" => _( - "No further information available, use at your own risk." - ) - } - ] - } - ] - } - end), - "software" => Builtins.toset( - Ops.get_list(packages, distro2, []) - ) - } - Ops.set(write_xml, ["metapackage", "group"], group) - end - - Builtins.y2debug("Writing: %1", write_xml) - - success = SCR.Write( - path(".anyxml"), - { - "xml" => write_xml, - "file" => save_to_file, - "args" => { - "RootName" => "metapackage", - "KeepRoot" => true, - "XMLDecl" => "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" - } - } - ) - - if success != true - Builtins.y2error("Unable to write XML to %1", save_to_file) - end - - success - end - - # Searches for packages using Webpin XML API. - # - # @param [String] search_for text - # @param [String] distribution, e.g., openSUSE_10.3, it is guessed from the system if set to nil - # @param [Hash{String => Boolean}] search_in which defines in which sources it searches, - # possible keys: name, description, contents - # - # @example - # SearchForPackages ( - # "desktop", - # nil, - # $[ - # "name" : true, - # "description" : true, - # "contents" : false, - # ] - # ) - # -> - # [ - # ... - # $[ - # "archs":[ - # "ppc" - # ], - # "checksum":"e0cbdbf03ce47dfd5c5f885b86706ddfa023d8dc", - # "distro":"openSUSE_110", - # "name":"xfce4-desktop", - # "priority":"5", - # "repoURL":"http://download.opensuse.org/distribution/11.0/repo/oss/suse", - # "summary":"Desktop manager for the Xfce Desktop Environment", - # "version":"4.4.2" - # ], - # ... - # ] - def SearchForPackages(search_for, distribution, search_in) - search_in = deep_copy(search_in) - Builtins.y2milestone("Searching for %1 in %2", search_for, search_in) - - if search_for == nil || search_for == "" - Builtins.y2error("empty search string") - return [] - end - - # search URL is the same for both - name_or_descr = Ops.get(search_in, "name", false) || - Ops.get(search_in, "description", false) - - search_path = nil - - if Ops.get(search_in, "contents", false) && name_or_descr - search_path = "Search/Simple/" - elsif name_or_descr - search_path = "Search/ByName/" - elsif Ops.get(search_in, "contents", false) - search_path = "Search/ByContents/" - else - Builtins.y2warning("empty search result") - return [] - end - - # if distro string is nil, try to guess the current one - if distribution == nil - distribution = GuessCurrentDistribution() - Builtins.y2milestone( - "Distribution not set, guessing '%1'", - distribution - ) - end - - url = Ops.add( - Ops.add( - Ops.add(Ops.add(GetBaseSearchURL(), search_path), distribution), - "/" - ), - URL.EscapeString(search_for, URL.transform_map_passwd) - ) - - Builtins.y2milestone("HTTP::Get (%1, %2)", url, @temporary_file) - response = HTTP.Get(url, @temporary_file) - Builtins.y2milestone("Server response: %1", response) - - ret_list = [] - - # something's screwed up on server side - this usually means that tmp file - # is full of error messages - we should not let anyxml agent parse those - if Ops.get_integer(response, "code", 0) != 200 - Builtins.y2error("Cannot retrieve search results from the server") - # %1 is HTTP error code like 404 or 503 - Report.Error( - Builtins.sformat( - _("Search failed.\nRemote server returned error code %1"), - Ops.get_integer(response, "code", 0) - ) - ) - return nil - end - - if !FileUtils.Exists(@temporary_file) - Builtins.y2error("Cannot read file: %1", @temporary_file) - return nil - end - - if Ops.less_or_equal(FileUtils.GetSize(@temporary_file), 0) - Builtins.y2milestone("Empty file: %1", @temporary_file) - return nil - end - - search_result = Convert.to_map(SCR.Read(path(".anyxml"), @temporary_file)) - - Builtins.y2debug("Search result: %1", search_result) - - counter = -1 - one_entry = {} - - Builtins.foreach( - Ops.get_list(search_result, ["ns2:packages", 0, "package"], []) - ) do |one_package| - one_entry = {} - Builtins.foreach(one_package) do |key, value| - if Builtins.haskey(Ops.get_map(value, 0, {}), "content") - Ops.set( - one_entry, - key, - Builtins.tostring(Ops.get(value, [0, "content"])) - ) - elsif key == "archs" - Builtins.foreach( - Convert.convert(value, :from => "list", :to => "list <map>") - ) { |one_arch| Builtins.foreach(Ops.get_list(one_arch, "arch", [])) do |xone_arch| - Ops.set( - one_entry, - "archs", - Builtins.add( - Ops.get_list(one_entry, "archs", []), - Ops.get_string(xone_arch, "content", "") - ) - ) - end } - else - Builtins.y2error("Unknown key: %1", key) - end - end - counter = Ops.add(counter, 1) - Ops.set(ret_list, counter, one_entry) - end - - nr_packages_found = Builtins.size(ret_list) - - if nr_packages_found == nil || nr_packages_found == 0 - Builtins.y2warning("Nothing found") - else - Builtins.y2milestone("%1 packages found", nr_packages_found) - end - - deep_copy(ret_list) - end - - publish :function => :SetBaseSearchURL, :type => "void (string)" - publish :function => :GetBaseSearchURL, :type => "string ()" - publish :function => :MatchesCurrentArchitecture, :type => "boolean (list <string>)" - publish :function => :PrepareOneClickInstallDescription, :type => "boolean (list <map>, string)" - publish :function => :SearchForPackages, :type => "list <map> (string, string, map <string, boolean>)" - end - - WebpinPackageSearch = WebpinPackageSearchClass.new - WebpinPackageSearch.main -end -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
