Hello community,
here is the log from the commit of package yast2-pkg-bindings
checked in at Mon Oct 6 16:06:34 CEST 2008.
--------
--- yast2-pkg-bindings/yast2-pkg-bindings.changes 2008-09-29 15:54:49.000000000 +0200
+++ /mounts/work_src_done/STABLE/yast2-pkg-bindings/yast2-pkg-bindings.changes 2008-10-03 16:44:07.401940000 +0200
@@ -1,0 +2,23 @@
+Fri Oct 3 13:56:41 CEST 2008 - lslezak@suse.cz
+
+- fixed Pkg::PkgReset() - reset the status (instead of unselect)
+ (bnc#431565)
+- service handling related fixes (bnc#427728)
+- 2.17.17
+
+-------------------------------------------------------------------
+Thu Oct 2 12:50:39 CEST 2008 - lslezak@suse.cz
+
+- removed Pkg::ServicesSave(), Pkg::ServicesLoad() and
+ Pkg::ServicesReset() - the functionality has been moved to
+ Pkg::SourceSaveAll(), Pkg::SourceRestore() and
+ Pkg::SourceFinishAll(). The reason is to descrease the amount
+ exported functions and lower the required changes in YCP code.
+
+-------------------------------------------------------------------
+Wed Oct 1 13:02:00 CEST 2008 - lslezak@suse.cz
+
+- fixed Pkg::ServiceRefresh() - search for the service URL and pass
+ it to libzypp
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
yast2-pkg-bindings-2.17.16.tar.bz2
New:
----
yast2-pkg-bindings-2.17.17.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-pkg-bindings-devel-doc.spec ++++++
--- /var/tmp/diff_new_pack.r20545/_old 2008-10-06 16:04:07.000000000 +0200
+++ /var/tmp/diff_new_pack.r20545/_new 2008-10-06 16:04:07.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-pkg-bindings-devel-doc (Version 2.17.16)
+# spec file for package yast2-pkg-bindings-devel-doc (Version 2.17.17)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -19,12 +19,12 @@
Name: yast2-pkg-bindings-devel-doc
-Version: 2.17.16
+Version: 2.17.17
Release: 1
License: GPL v2 or later
Group: Documentation/HTML
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-pkg-bindings-2.17.16.tar.bz2
+Source0: yast2-pkg-bindings-2.17.17.tar.bz2
Prefix: %_prefix
# same as in the main package (because we use the same configure.in.in)
BuildRequires: blocxx-devel docbook-xsl-stylesheets doxygen gcc-c++ libgcrypt-devel libxcrypt-devel libxslt libzypp-devel perl-XML-Writer sgml-skel yast2-core-devel yast2-devtools
@@ -45,7 +45,7 @@
Ladislav Slez�k
%prep
-%setup -n yast2-pkg-bindings-2.17.16
+%setup -n yast2-pkg-bindings-2.17.17
# build only documentation, ignore all other directories
echo "doc" > SUBDIRS
++++++ yast2-pkg-bindings.spec ++++++
--- /var/tmp/diff_new_pack.r20545/_old 2008-10-06 16:04:07.000000000 +0200
+++ /var/tmp/diff_new_pack.r20545/_new 2008-10-06 16:04:07.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-pkg-bindings (Version 2.17.16)
+# spec file for package yast2-pkg-bindings (Version 2.17.17)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -19,12 +19,12 @@
Name: yast2-pkg-bindings
-Version: 2.17.16
+Version: 2.17.17
Release: 1
License: GPL v2 or later
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-pkg-bindings-2.17.16.tar.bz2
+Source0: yast2-pkg-bindings-2.17.17.tar.bz2
Prefix: /usr
BuildRequires: blocxx-devel docbook-xsl-stylesheets doxygen gcc-c++ libgcrypt-devel libxcrypt-devel libxslt perl-XML-Writer sgml-skel yast2-core-devel yast2-devtools
BuildRequires: libzypp-devel >= 5.10.0
@@ -47,7 +47,7 @@
Stanislav Visnovsky
%prep
-%setup -n yast2-pkg-bindings-2.17.16
+%setup -n yast2-pkg-bindings-2.17.17
# build only the library, ignore documentation (it is in devel-doc package)
echo "src" > SUBDIRS
@@ -79,6 +79,20 @@
%{_libdir}/YaST2/plugin/libpy2Pkg.so
%doc %{prefix}/share/doc/packages/yast2-pkg-bindings
%changelog
+* Fri Oct 03 2008 lslezak@suse.cz
+- fixed Pkg::PkgReset() - reset the status (instead of unselect)
+ (bnc#431565)
+- service handling related fixes (bnc#427728)
+- 2.17.17
+* Thu Oct 02 2008 lslezak@suse.cz
+- removed Pkg::ServicesSave(), Pkg::ServicesLoad() and
+ Pkg::ServicesReset() - the functionality has been moved to
+ Pkg::SourceSaveAll(), Pkg::SourceRestore() and
+ Pkg::SourceFinishAll(). The reason is to descrease the amount
+ exported functions and lower the required changes in YCP code.
+* Wed Oct 01 2008 lslezak@suse.cz
+- fixed Pkg::ServiceRefresh() - search for the service URL and pass
+ it to libzypp
* Mon Sep 29 2008 lslezak@suse.cz
- do not autorefresh remote repositories when there is no network
connection (affected calls Pkg::SourceLoad(),
++++++ yast2-pkg-bindings-2.17.16.tar.bz2 -> yast2-pkg-bindings-2.17.17.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.16/configure new/yast2-pkg-bindings-2.17.17/configure
--- old/yast2-pkg-bindings-2.17.16/configure 2008-09-29 15:53:54.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.17/configure 2008-10-03 16:42:04.000000000 +0200
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for yast2-pkg-bindings 2.17.16.
+# Generated by GNU Autoconf 2.61 for yast2-pkg-bindings 2.17.17.
#
# Report bugs to http://bugs.opensuse.org/.
#
@@ -728,8 +728,8 @@
# Identity of this package.
PACKAGE_NAME='yast2-pkg-bindings'
PACKAGE_TARNAME='yast2-pkg-bindings'
-PACKAGE_VERSION='2.17.16'
-PACKAGE_STRING='yast2-pkg-bindings 2.17.16'
+PACKAGE_VERSION='2.17.17'
+PACKAGE_STRING='yast2-pkg-bindings 2.17.17'
PACKAGE_BUGREPORT='http://bugs.opensuse.org/'
ac_unique_file="RPMNAME"
@@ -1453,7 +1453,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-pkg-bindings 2.17.16 to adapt to many kinds of systems.
+\`configure' configures yast2-pkg-bindings 2.17.17 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1524,7 +1524,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of yast2-pkg-bindings 2.17.16:";;
+ short | recursive ) echo "Configuration of yast2-pkg-bindings 2.17.17:";;
esac
cat <<\_ACEOF
@@ -1636,7 +1636,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-yast2-pkg-bindings configure 2.17.16
+yast2-pkg-bindings configure 2.17.17
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1650,7 +1650,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-pkg-bindings $as_me 2.17.16, which was
+It was created by yast2-pkg-bindings $as_me 2.17.17, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -2471,7 +2471,7 @@
# Define the identity of the package.
PACKAGE='yast2-pkg-bindings'
- VERSION='2.17.16'
+ VERSION='2.17.17'
cat >>confdefs.h <<_ACEOF
@@ -2699,7 +2699,7 @@
-VERSION="2.17.16"
+VERSION="2.17.17"
RPMNAME="yast2-pkg-bindings"
MAINTAINER="Ladislav Slezák "
@@ -21700,7 +21700,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by yast2-pkg-bindings $as_me 2.17.16, which was
+This file was extended by yast2-pkg-bindings $as_me 2.17.17, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -21753,7 +21753,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-yast2-pkg-bindings config.status 2.17.16
+yast2-pkg-bindings config.status 2.17.17
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.16/configure.in new/yast2-pkg-bindings-2.17.17/configure.in
--- old/yast2-pkg-bindings-2.17.16/configure.in 2008-09-29 15:53:41.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.17/configure.in 2008-10-03 16:41:50.000000000 +0200
@@ -3,7 +3,7 @@
dnl -- This file is generated by y2autoconf 2.17.3 - DO NOT EDIT! --
dnl (edit configure.in.in instead)
-AC_INIT(yast2-pkg-bindings, 2.17.16, http://bugs.opensuse.org/, yast2-pkg-bindings)
+AC_INIT(yast2-pkg-bindings, 2.17.17, http://bugs.opensuse.org/, yast2-pkg-bindings)
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="2.17.16"
+VERSION="2.17.17"
RPMNAME="yast2-pkg-bindings"
MAINTAINER="Ladislav Slezák "
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.16/src/Package.cc new/yast2-pkg-bindings-2.17.17/src/Package.cc
--- old/yast2-pkg-bindings-2.17.16/src/Package.cc 2008-09-25 17:51:25.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.17/src/Package.cc 2008-10-03 13:28:14.000000000 +0200
@@ -1799,46 +1799,28 @@
return YCPBoolean(ret);
}
-void ResetAll(const zypp::ResStatus::TransactByValue &level)
+template <class T>
+inline void ResetAllKind(zypp::ResPoolProxy &proxy, const zypp::ResStatus::TransactByValue &level)
{
- // access to the Pool of Selectables
- zypp::ResPoolProxy selectablePool(zypp::ResPool::instance().proxy());
-
- // unset all packages, patterns...
- for_(it, selectablePool.byKindBeginzypp::Package(),
- selectablePool.byKindEndzypp::Package())
- {
- zypp::ui::Selectable::Ptr s = (*it);
- if (s) s->unset(level);
- }
-
- for_(it, selectablePool.byKindBeginzypp::Pattern(),
- selectablePool.byKindEndzypp::Pattern())
+ for_(it, proxy.byKindBegin<T>(), proxy.byKindEnd<T>())
{
zypp::ui::Selectable::Ptr s = (*it);
- if (s) s->unset(level);
+ if (s) s->theObj().status().resetTransact(level);
}
+}
- for_(it, selectablePool.byKindBeginzypp::Patch(),
- selectablePool.byKindEndzypp::Patch())
- {
- zypp::ui::Selectable::Ptr s = (*it);
- if (s) s->unset(level);
- }
- for_(it, selectablePool.byKindBeginzypp::Product(),
- selectablePool.byKindEndzypp::Product())
- {
- zypp::ui::Selectable::Ptr s = (*it);
- if (s) s->unset(level);
- }
+void ResetAll(const zypp::ResStatus::TransactByValue &level)
+{
+ // access to the Pool of Selectables
+ zypp::ResPoolProxy selectablePool(zypp::ResPool::instance().proxy());
- for_(it, selectablePool.byKindBeginzypp::SrcPackage(),
- selectablePool.byKindEndzypp::SrcPackage())
- {
- zypp::ui::Selectable::Ptr s = (*it);
- if (s) s->unset(level);
- }
+ // unset all packages, patterns...
+ ResetAllKindzypp::Package(selectablePool, level);
+ ResetAllKindzypp::Pattern(selectablePool, level);
+ ResetAllKindzypp::Patch(selectablePool, level);
+ ResetAllKindzypp::Product(selectablePool, level);
+ ResetAllKindzypp::SrcPackage(selectablePool, level);
}
/**
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.16/src/PkgFunctions.h new/yast2-pkg-bindings-2.17.17/src/PkgFunctions.h
--- old/yast2-pkg-bindings-2.17.16/src/PkgFunctions.h 2008-09-29 14:54:51.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.17/src/PkgFunctions.h 2008-10-02 12:33:23.000000000 +0200
@@ -787,14 +787,8 @@
YCPValue ServiceGet(const YCPString&);
/* TYPEINFO: boolean(string,map)*/
YCPValue ServiceSet(const YCPString&, const YCPMap&);
- /* TYPEINFO: boolean()*/
- YCPValue ServicesSave();
- /* TYPEINFO: boolean()*/
- YCPValue ServicesLoad();
/* TYPEINFO: boolean(string)*/
YCPValue ServiceRefresh(const YCPString&);
- /* TYPEINFO: void()*/
- YCPValue ServicesReset();
/* TYPEINFO: string(string)*/
YCPValue ServiceURL(const YCPString &alias);
/* TYPEINFO: string(string)*/
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.16/src/PkgService.cc new/yast2-pkg-bindings-2.17.17/src/PkgService.cc
--- old/yast2-pkg-bindings-2.17.16/src/PkgService.cc 2008-08-22 13:27:45.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.17/src/PkgService.cc 2008-10-03 10:33:45.000000000 +0200
@@ -26,7 +26,7 @@
}
PkgService::PkgService(const zypp::ServiceInfo &s, const std::string &old_alias) :
- zypp::ServiceInfo(s), _deleted(false), _old_alias(old_alias.empty() ? s.alias() : old_alias)
+ zypp::ServiceInfo(s), _deleted(false), _old_alias(old_alias)
{
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.16/src/Service.cc new/yast2-pkg-bindings-2.17.17/src/Service.cc
--- old/yast2-pkg-bindings-2.17.16/src/Service.cc 2008-09-19 15:02:55.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.17/src/Service.cc 2008-10-02 17:57:23.000000000 +0200
@@ -74,8 +74,9 @@
return YCPBoolean(service_manager.AddService(alias->value(), url->value()));
}
- catch(...)
+ catch (const zypp::Exception& excpt)
{
+ _last_error.setLastError(ExceptionAsString(excpt));
}
return YCPBoolean(false);
@@ -99,8 +100,9 @@
return YCPBoolean(service_manager.RemoveService(alias->value()));
}
- catch(...)
+ catch (const zypp::Exception& excpt)
{
+ _last_error.setLastError(ExceptionAsString(excpt));
}
return YCPBoolean(false);
@@ -135,7 +137,7 @@
}
/******************************************************************************
- * @builtin SourceURL
+ * @builtin ServiceURL
*
* @short Get full service URL (including password!)
* @param alias alias of the service
@@ -209,46 +211,9 @@
return YCPBoolean(service_manager.SetService(old_alias->value(), s));
}
- catch(...)
- {
- }
-
- return YCPBoolean(false);
-}
-
-/**
- @builtin ServicesSave
- @short Save the current service configuration to disk.
- @return boolean false if failed
-*/
-YCPValue PkgFunctions::ServicesSave()
-{
- try
- {
- zypp::RepoManager repomanager = CreateRepoManager();
- return YCPBoolean(service_manager.SaveServices(repomanager));
- }
- catch(...)
- {
- }
-
- return YCPBoolean(false);
-}
-
-/**
- @builtin ServicesLoad
- @short Load service configurations from disk. If the services have alrady been loaded it does nothing.
- @return boolean false if failed
-*/
-YCPValue PkgFunctions::ServicesLoad()
-{
- try
- {
- zypp::RepoManager repomanager = CreateRepoManager();
- return YCPBoolean(service_manager.LoadServices(repomanager));
- }
- catch(...)
+ catch (const zypp::Exception& excpt)
{
+ _last_error.setLastError(ExceptionAsString(excpt));
}
return YCPBoolean(false);
@@ -273,24 +238,15 @@
zypp::RepoManager repomanager = CreateRepoManager();
return YCPBoolean(service_manager.RefreshService(alias->value(), repomanager));
}
- catch(...)
+ catch (const zypp::Exception& excpt)
{
+ _last_error.setLastError(ExceptionAsString(excpt));
}
return YCPBoolean(false);
}
/**
- @builtin ServicesReset
- @short Reset the list of known services. All changes are lost.
-*/
-YCPValue PkgFunctions::ServicesReset()
-{
- service_manager.Reset();
- return YCPVoid();
-}
-
-/**
@builtin ServiceProbe
@short Probe service type at a URL
@param url URL of the service
@@ -309,8 +265,9 @@
const zypp::RepoManager repomanager = CreateRepoManager();
return YCPString(service_manager.Probe(zypp::Url(url->asString()->value()), repomanager));
}
- catch(...)
+ catch (const zypp::Exception& excpt)
{
+ _last_error.setLastError(ExceptionAsString(excpt));
return YCPVoid();
}
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.16/src/ServiceManager.cc new/yast2-pkg-bindings-2.17.17/src/ServiceManager.cc
--- old/yast2-pkg-bindings-2.17.16/src/ServiceManager.cc 2008-09-19 14:12:19.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.17/src/ServiceManager.cc 2008-10-03 12:45:44.000000000 +0200
@@ -23,6 +23,7 @@
#include "ServiceManager.h"
#include
+#include
ServiceManager::ServiceManager() : _services_loaded(false)
{
@@ -32,99 +33,96 @@
{
}
-bool ServiceManager::LoadServices(const zypp::RepoManager &repomgr)
+void ServiceManager::LoadServices(const zypp::RepoManager &repomgr)
{
- bool ret = true;
-
if (!_services_loaded)
{
- try
+ for_ (it, repomgr.serviceBegin(), repomgr.serviceEnd())
{
- for_ (it, repomgr.serviceBegin(), repomgr.serviceEnd())
- {
- // set the original alias to the current one
- PkgService s(*it, it->alias());
- y2milestone("Loaded service %s (%s)", s.alias().c_str(), s.url().asString().c_str());
- _known_services.insert(std::make_pair(s.alias(), s));
- }
-
- _services_loaded = true;
- }
- catch(...)
- {
- ret = false;
+ // set the original alias to the current one
+ PkgService s(*it, it->alias());
+ y2milestone("Loaded service %s (%s)", s.alias().c_str(), s.url().asString().c_str());
+ _known_services.insert(std::make_pair(s.alias(), s));
}
+
+ _services_loaded = true;
}
else
{
y2warning("Services have already been loaded, skipping load");
}
-
- return ret;
}
-bool ServiceManager::SaveServices(zypp::RepoManager &repomgr) const
+void ServiceManager::SaveServices(zypp::RepoManager &repomgr) const
{
- bool ret = true;
-
for_ (it, _known_services.begin(), _known_services.end())
{
- std::string alias(it->second.alias());
-
- try
- {
- // delete
- if (it->second.isDeleted())
- {
- y2milestone("Removing service %s", alias.c_str());
- repomgr.removeService(alias);
- }
- }
- catch(...)
+ // delete
+ if (it->second.isDeleted())
{
- y2error("Cannot delete service %s", alias.c_str());
- ret = false;
+ std::string alias(it->second.alias());
+ y2milestone("Removing service %s", alias.c_str());
+ repomgr.removeService(alias);
}
}
for_ (it, _known_services.begin(), _known_services.end())
{
- std::string alias(it->second.alias());
-
- try
+ if (!it->second.isDeleted())
{
- // save
- if (!it->second.isDeleted())
+ const PkgService s_known = it->second;
+ const std::string alias(s_known.alias());
+ const zypp::ServiceInfo s_stored = repomgr.getService(alias);
+
+ DBG << "Known Service: " << it->second << std::endl;
+ DBG << "Stored Service: " << repomgr.getService(alias) << std::endl;
+
+ bool modified = (s_stored.url() != s_known.url()
+ || s_stored.name() != s_known.name()
+ || s_stored.enabled() != s_known.enabled()
+ || s_stored.autorefresh() != s_known.autorefresh()
+ );
+
+ if (modified)
{
- if (it->second != repomgr.getService(alias))
+ std::string orig_alias(s_known.origAlias());
+
+ y2internal("orig_alias: %s", orig_alias.c_str());
+
+ // the old alias is empty for new services
+ if (orig_alias.empty())
+ {
+ y2milestone("Adding new service %s", alias.c_str());
+ // add the service
+ repomgr.addService(s_known);
+ }
+ else
{
- y2milestone("Saving modified service %s", alias.c_str());
- // FIXME use old alias
- repomgr.modifyService(alias, it->second);
+ y2milestone("Saving service %s", alias.c_str());
+ // use the old alias
+ repomgr.modifyService(orig_alias, s_known);
}
}
- }
- catch(...)
- {
- y2error("Cannot save service %s", alias.c_str());
- ret = false;
+ else
+ {
+ y2milestone("Service %s has not been modified, not saving", alias.c_str());
+ }
}
}
-
- return ret;
}
-bool ServiceManager::RefreshService(const std::string &alias, zypp::RepoManager &repomgr) const
+bool ServiceManager::RefreshService(const std::string &alias, zypp::RepoManager &repomgr)
{
- try
- {
- repomgr.refreshService(alias);
- return true;
- }
- catch(...)
+ PkgServices::iterator serv_it = _known_services.find(alias);
+
+ if (serv_it == _known_services.end())
{
+ y2error("Service '%s' does not exist", alias.c_str());
return false;
}
+
+ repomgr.refreshService(serv_it->second);
+ return true;
}
ServiceManager::Services ServiceManager::GetServices() const
@@ -145,84 +143,69 @@
bool ServiceManager::AddService(const std::string &alias, const std::string &url)
{
- try
+ if (alias.empty())
{
- if (alias.empty())
- {
- y2error("Empty alias for service %s", url.c_str());
- return false;
- }
+ y2error("Empty alias for service %s", url.c_str());
+ return false;
+ }
- PkgServices::iterator serv_it = _known_services.find(alias);
- std::string orig_alias;
+ PkgServices::iterator serv_it = _known_services.find(alias);
+ std::string orig_alias;
- if (serv_it != _known_services.end())
+ if (serv_it != _known_services.end())
+ {
+ if (serv_it->second.isDeleted())
{
- if (serv_it->second.isDeleted())
- {
- // remember the original alias
- // adding a removed service is the same as changing existing one
- orig_alias = serv_it->second.alias();
-
- // we are adding an already removed service,
- // remove the existing service
- _known_services.erase(serv_it);
- }
- else
- {
- y2error("Service with alias %s already exists", alias.c_str());
- return false;
- }
+ // remember the original alias
+ // adding a removed service is the same as changing existing one
+ orig_alias = serv_it->second.alias();
+
+ // we are adding an already removed service,
+ // remove the existing service
+ _known_services.erase(serv_it);
}
+ else
+ {
+ y2error("Service with alias %s already exists", alias.c_str());
+ return false;
+ }
+ }
- zypp::ServiceInfo info;
- info.setAlias(alias);
- info.setUrl(url);
+ zypp::ServiceInfo info;
+ info.setAlias(alias);
+ info.setUrl(url);
- PkgService srv(info, orig_alias);
+ PkgService srv(info, orig_alias);
+ y2milestone("Adding service %s (orig alias: %s)", alias.c_str(), srv.origAlias().c_str());
- _known_services.insert(std::make_pair(alias, srv));
- }
- catch(...)
- {
- return false;
- }
+ _known_services.insert(std::make_pair(alias, srv));
return true;
}
bool ServiceManager::RemoveService(const std::string &alias)
{
- try
- {
- PkgServices::iterator serv_it = _known_services.find(alias);
+ PkgServices::iterator serv_it = _known_services.find(alias);
- if (serv_it != _known_services.end())
+ if (serv_it != _known_services.end())
+ {
+ if (serv_it->second.isDeleted())
{
- if (serv_it->second.isDeleted())
- {
- y2warning("Service %s has been already removed", alias.c_str());
- return true;
- }
- else
- {
- serv_it->second.setDeleted();
- y2milestone("Service %s has been marked as deleted", alias.c_str());
- return true;
- }
+ y2warning("Service %s has been already removed", alias.c_str());
+ return true;
}
else
{
- y2error("Service %s does not exist", alias.c_str());
- return false;
+ serv_it->second.setDeleted();
+ y2milestone("Service %s has been marked as deleted", alias.c_str());
+ return true;
}
}
- catch(...)
+ else
{
+ y2error("Service %s does not exist", alias.c_str());
return false;
}
-
- return true;
}
void ServiceManager::Reset()
@@ -236,74 +219,54 @@
zypp::ServiceInfo ServiceManager::GetService(const std::string &alias) const
{
- try
- {
- PkgServices::const_iterator serv_it = _known_services.find(alias);
+ PkgServices::const_iterator serv_it = _known_services.find(alias);
- if (serv_it != _known_services.end())
+ if (serv_it != _known_services.end())
+ {
+ if (serv_it->second.isDeleted())
{
- if (serv_it->second.isDeleted())
- {
- y2warning("Service %s has been removed", alias.c_str());
- return zypp::ServiceInfo::noService;
- }
- else
- {
- return serv_it->second;
- }
+ y2warning("Service %s has been removed", alias.c_str());
+ return zypp::ServiceInfo::noService;
}
else
{
- y2error("Service %s does not exist", alias.c_str());
- return zypp::ServiceInfo::noService;
+ return serv_it->second;
}
}
- catch(...)
+ else
{
+ y2error("Service %s does not exist", alias.c_str());
+ return zypp::ServiceInfo::noService;
}
return zypp::ServiceInfo::noService;
}
-bool ServiceManager::SetService(const std::string old_alias, const zypp::ServiceInfo &srv)
+bool ServiceManager::SetService(const std::string &old_alias, const zypp::ServiceInfo &srv)
{
- try
- {
- PkgServices::const_iterator serv_it = _known_services.find(old_alias);
+ PkgServices::const_iterator serv_it = _known_services.find(old_alias);
- if (serv_it != _known_services.end())
+ if (serv_it != _known_services.end())
+ {
+ if (serv_it->second.isDeleted())
{
- if (serv_it->second.isDeleted())
- {
- y2warning("Service %s has been removed", old_alias.c_str());
- return false;
- }
- else
- {
- // if the alias has been already changed then keep the original alias
- if (old_alias == serv_it->second.alias() )
- {
- PkgService s(srv, old_alias);
- _known_services[srv.alias()] = s;
- }
- else
- {
- // keep the old alias
- PkgService s(srv, serv_it->second.origAlias());
- _known_services[srv.alias()] = s;
- }
-
- return true;
- }
+ y2warning("Service %s has been removed", old_alias.c_str());
+ return false;
}
else
{
- y2error("Service %s does not exist", old_alias.c_str());
- return false;
+ // if the alias has been already changed then keep the original alias
+ y2milestone("Setting service: %s (orig alias: %s)", old_alias.c_str(), serv_it->second.origAlias().c_str());
+ DBG << "Properties: " << srv << std::endl;
+ PkgService s(srv, serv_it->second.origAlias());
+ _known_services[srv.alias()] = s;
+ return true;
}
}
- catch(...)
+ else
{
+ y2error("Service %s does not exist", old_alias.c_str());
+ return false;
}
return false;
@@ -318,3 +281,14 @@
return ret;
}
+bool ServiceManager::empty() const
+{
+ return _known_services.empty();
+}
+
+
+ServiceManager::Services::size_type ServiceManager::size() const
+{
+ return _known_services.size();
+}
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.16/src/ServiceManager.h new/yast2-pkg-bindings-2.17.17/src/ServiceManager.h
--- old/yast2-pkg-bindings-2.17.16/src/ServiceManager.h 2008-09-19 14:06:58.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.17/src/ServiceManager.h 2008-10-03 10:21:22.000000000 +0200
@@ -40,9 +40,9 @@
Services GetServices() const;
- bool LoadServices(const zypp::RepoManager &repomgr);
+ void LoadServices(const zypp::RepoManager &repomgr);
- bool SaveServices(zypp::RepoManager &repomgr) const;
+ void SaveServices(zypp::RepoManager &repomgr) const;
bool AddService(const std::string &alias, const std::string &url);
@@ -50,14 +50,20 @@
zypp::ServiceInfo GetService(const std::string &alias) const;
- bool SetService(const std::string old_alias, const zypp::ServiceInfo &srv);
+ bool SetService(const std::string &old_alias, const zypp::ServiceInfo &srv);
- bool RefreshService(const std::string &alias, zypp::RepoManager &repomgr) const;
+ bool RefreshService(const std::string &alias, zypp::RepoManager &repomgr);
std::string Probe(const zypp::Url &url, const zypp::RepoManager &repomgr) const;
void Reset();
+ // is there any service? (incl. deleted!)
+ bool empty() const;
+
+ // number of services (incl. deleted!)
+ Services::size_type size() const;
+
private:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.16/src/Source_Get.cc new/yast2-pkg-bindings-2.17.17/src/Source_Get.cc
--- old/yast2-pkg-bindings-2.17.16/src/Source_Get.cc 2008-09-25 08:57:07.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.17/src/Source_Get.cc 2008-10-01 18:39:49.000000000 +0200
@@ -19,7 +19,7 @@
*/
/*
- File: $Id: Source_Get.cc 51491 2008-09-25 06:57:05Z lslezak $
+ File: $Id: Source_Get.cc 51767 2008-10-01 16:39:48Z lslezak $
Author: Ladislav Slezák
Summary: Functions for reading repository properties
Namespace: Pkg
@@ -370,8 +370,10 @@
* source priority (highest first). A source state is a map:
* $[
* "SrcId" : YCPInteger,
- * "enabled" : YCPBoolean
- * "autorefresh": YCPBoolean
+ * "enabled" : YCPBoolean,
+ * "autorefresh": YCPBoolean,
+ * "name" : YCPString,
+ * "service" : YCPString
* ];
*
* @return list<map> list of source states (map)
@@ -395,6 +397,7 @@
src_map->add(YCPString("autorefresh"), YCPBoolean((*it)->repoInfo().autorefresh()));
src_map->add(YCPString("name"), YCPString((*it)->repoInfo().name()));
src_map->add(YCPString("priority"), YCPInteger((*it)->repoInfo().priority()));
+ src_map->add(YCPString("service"), YCPString((*it)->repoInfo().service()));
ret->add(src_map);
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.16/src/Source_Load.cc new/yast2-pkg-bindings-2.17.17/src/Source_Load.cc
--- old/yast2-pkg-bindings-2.17.16/src/Source_Load.cc 2008-09-29 15:51:38.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.17/src/Source_Load.cc 2008-10-02 15:39:43.000000000 +0200
@@ -19,7 +19,7 @@
*/
/*
- File: $Id: Source_Load.cc 51657 2008-09-29 13:51:36Z lslezak $
+ File: $Id: Source_Load.cc 51795 2008-10-02 13:39:41Z lslezak $
Author: Ladislav Slezák
Summary: Functions for initializing the package manager
Namespace: Pkg
@@ -52,20 +52,74 @@
YCPValue
PkgFunctions::SourceRestore()
{
+ // return value
+ bool success = true;
+
if (repos.size() > 0)
{
y2warning("Number of registered repositories: %zd, skipping repository load!", repos.size());
- return YCPBoolean(true);
+ return YCPBoolean(success);
}
- bool success = true;
-
try
{
zypp::RepoManager repomanager = CreateRepoManager();
+
+ if (!service_manager.empty())
+ {
+ y2warning("Number of known services: %zd, skipping service load!", service_manager.size());
+ }
+ else
+ {
+ try
+ {
+ service_manager.LoadServices(repomanager);
+
+ if (!service_manager.empty())
+ {
+ // refresh services at first
+ ServiceManager::Services services(service_manager.GetServices());
+ bool network_is_running = NetworkDetected();
+
+ for_(srv_it, services.begin(), services.end())
+ {
+ try
+ {
+ if (srv_it->enabled() && srv_it->autorefresh())
+ {
+ zypp::Url url(srv_it->url());
+
+ if (!network_is_running && remoteRepo(url))
+ {
+ y2warning("No network connection, skipping autorefresh of remote service %s (%s)",
+ srv_it->alias().c_str(), url.asString().c_str());
+ }
+ else
+ {
+ y2milestone("Autorefreshing service %s (%s)...", srv_it->alias().c_str(), url.asString().c_str());
+ service_manager.RefreshService(srv_it->alias(), repomanager);
+ }
+ }
+ }
+ catch (const zypp::Exception& excpt)
+ {
+ // service refresh is not fatal, let's continue
+ y2error ("Error in service refresh: %s", excpt.asString().c_str());
+ _last_error.setLastError(ExceptionAsString(excpt));
+ success = false;
+ }
+ }
+ }
+ }
+ catch (const zypp::Exception& excpt)
+ {
+ _last_error.setLastError(ExceptionAsString(excpt));
+ success = false;
+ }
+ }
+
std::listzypp::RepoInfo reps = repomanager.knownRepositories();
- repos.clear();
for (std::listzypp::RepoInfo::iterator it = reps.begin();
it != reps.end(); ++it)
{
@@ -495,7 +549,7 @@
}
/****************************************************************************************
- * @builtin SourceCleanupBroken
+ * @builtin SourceCleanupBroken - obsoleted, do not use!
*
* @short Clean up all sources that were not properly restored on the last
* call of SourceStartManager or SourceStartCache.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.16/src/Source_Save.cc new/yast2-pkg-bindings-2.17.17/src/Source_Save.cc
--- old/yast2-pkg-bindings-2.17.16/src/Source_Save.cc 2008-06-17 14:44:14.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.17/src/Source_Save.cc 2008-10-02 12:54:20.000000000 +0200
@@ -19,7 +19,7 @@
*/
/*
- File: $Id: Source_Save.cc 48353 2008-06-17 12:44:13Z lslezak $
+ File: $Id: Source_Save.cc 51780 2008-10-02 10:54:18Z lslezak $
Author: Ladislav Slezák
Summary: Functions for saving repository configuration
Namespace: Pkg
@@ -77,12 +77,27 @@
PkgFunctions::SourceSaveAll ()
{
y2milestone("Saving the source setup...");
+ bool ret = true;
// nothing to save, return success
- if (repos.size() == 0)
+ if (repos.empty() && service_manager.empty())
{
- y2debug("No repository defined, saving skipped");
- return YCPBoolean(true);
+ y2debug("No repository or service defined, saving skipped");
+ return YCPBoolean(ret);
+ }
+
+ zypp::RepoManager repomanager = CreateRepoManager();
+
+ // save the services
+ try
+ {
+ service_manager.SaveServices(repomanager);
+ y2milestone("All services have been saved");
+ }
+ catch (const zypp::Exception& excpt)
+ {
+ _last_error.setLastError(ExceptionAsString(excpt));
+ ret = false;
}
// count removed repos
@@ -125,8 +140,6 @@
// start the process
pkgprogress.Start(_("Saving Repositories..."), stages, HelpTexts::save_help);
- zypp::RepoManager repomanager = CreateRepoManager();
-
// remove deleted repos (the old configurations) at first
for (RepoCont::iterator it = repos.begin();
it != repos.end(); ++it)
@@ -217,7 +230,7 @@
y2milestone("All sources have been saved");
- return YCPBoolean(true);
+ return YCPBoolean(ret);
}
/****************************************************************************************
@@ -246,6 +259,9 @@
// release all repositories
repos.clear();
+
+ // release all services
+ service_manager.Reset();
}
catch (zypp::Exception & excpt)
{
@@ -254,7 +270,7 @@
return YCPBoolean(false);
}
- y2milestone("All sources have been unregistered");
+ y2milestone("All sources and services have been unregistered");
return YCPBoolean(true);
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.16/VERSION new/yast2-pkg-bindings-2.17.17/VERSION
--- old/yast2-pkg-bindings-2.17.16/VERSION 2008-09-29 15:53:27.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.17/VERSION 2008-10-03 16:40:37.000000000 +0200
@@ -1 +1 @@
-2.17.16
+2.17.17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org