Hello community,
here is the log from the commit of package yast2-pkg-bindings
checked in at Thu Oct 23 12:39:26 CEST 2008.
--------
--- yast2-pkg-bindings/yast2-pkg-bindings.changes 2008-10-09 15:31:10.000000000 +0200
+++ /mounts/work_src_done/STABLE/yast2-pkg-bindings/yast2-pkg-bindings.changes 2008-10-21 16:06:30.395367000 +0200
@@ -1,0 +2,28 @@
+Tue Oct 21 11:08:21 CEST 2008 - lslezak@suse.cz
+
+- fixed ResolvableProperties() - correctly iterate over all
+ available/installed objects (bnc#436842)
+- added Pkg::CreateSolverTestcase() debugging function to create
+ a solver testcase from YCP code
+- 2.17.21
+
+-------------------------------------------------------------------
+Fri Oct 17 12:06:44 CEST 2008 - lslezak@suse.cz
+
+- ServiceGet()/ServiceSet() - query/set ReposToEnable and
+ ReposToDisable (bnc#435669)
+- added ServiceSave() function (bnc#435669)
+- fixed ServiceDelete() - delete also the repositories belonging
+ to the deleted service, similar fix in enabling/disabling
+ a service via ServiceSet() (bnc#435711)
+- fixed network detection command (bnc#435970)
+- 2.17.20
+
+-------------------------------------------------------------------
+Wed Oct 15 10:56:06 CEST 2008 - lslezak@suse.cz
+
+- report SourceChanged callback also during package installation
+ (bnc#362003)
+- 2.17.19
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
yast2-pkg-bindings-2.17.18.tar.bz2
New:
----
yast2-pkg-bindings-2.17.21.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-pkg-bindings-devel-doc.spec ++++++
--- /var/tmp/diff_new_pack.xo9741/_old 2008-10-23 12:37:31.000000000 +0200
+++ /var/tmp/diff_new_pack.xo9741/_new 2008-10-23 12:37:31.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-pkg-bindings-devel-doc (Version 2.17.18)
+# spec file for package yast2-pkg-bindings-devel-doc (Version 2.17.21)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -19,12 +19,12 @@
Name: yast2-pkg-bindings-devel-doc
-Version: 2.17.18
+Version: 2.17.21
Release: 1
License: GPL v2 or later
Group: Documentation/HTML
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-pkg-bindings-2.17.18.tar.bz2
+Source0: yast2-pkg-bindings-2.17.21.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.18
+%setup -n yast2-pkg-bindings-2.17.21
# build only documentation, ignore all other directories
echo "doc" > SUBDIRS
@@ -76,6 +76,7 @@
%dir %{prefix}/share/doc/packages/yast2-pkg-bindings
%exclude %{prefix}/share/doc/packages/yast2-pkg-bindings/COPYING
%exclude %{prefix}/share/doc/packages/yast2-pkg-bindings/README
+
%changelog
* Fri May 16 2008 lslezak@suse.cz
- documented lock API
++++++ yast2-pkg-bindings.spec ++++++
--- /var/tmp/diff_new_pack.xo9741/_old 2008-10-23 12:37:31.000000000 +0200
+++ /var/tmp/diff_new_pack.xo9741/_new 2008-10-23 12:37:31.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-pkg-bindings (Version 2.17.18)
+# spec file for package yast2-pkg-bindings (Version 2.17.21)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -19,12 +19,12 @@
Name: yast2-pkg-bindings
-Version: 2.17.18
+Version: 2.17.21
Release: 1
License: GPL v2 or later
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-pkg-bindings-2.17.18.tar.bz2
+Source0: yast2-pkg-bindings-2.17.21.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.18
+%setup -n yast2-pkg-bindings-2.17.21
# build only the library, ignore documentation (it is in devel-doc package)
echo "src" > SUBDIRS
@@ -78,7 +78,27 @@
%{_libdir}/YaST2/plugin/libpy2Pkg.so.*
%{_libdir}/YaST2/plugin/libpy2Pkg.so
%doc %{prefix}/share/doc/packages/yast2-pkg-bindings
+
%changelog
+* Tue Oct 21 2008 lslezak@suse.cz
+- fixed ResolvableProperties() - correctly iterate over all
+ available/installed objects (bnc#436842)
+- added Pkg::CreateSolverTestcase() debugging function to create
+ a solver testcase from YCP code
+- 2.17.21
+* Fri Oct 17 2008 lslezak@suse.cz
+- ServiceGet()/ServiceSet() - query/set ReposToEnable and
+ ReposToDisable (bnc#435669)
+- added ServiceSave() function (bnc#435669)
+- fixed ServiceDelete() - delete also the repositories belonging
+ to the deleted service, similar fix in enabling/disabling
+ a service via ServiceSet() (bnc#435711)
+- fixed network detection command (bnc#435970)
+- 2.17.20
+* Wed Oct 15 2008 lslezak@suse.cz
+- report SourceChanged callback also during package installation
+ (bnc#362003)
+- 2.17.19
* Thu Oct 09 2008 lslezak@suse.cz
- do not print anything on the stdout when detecting network
status (bnc#433458)
++++++ yast2-pkg-bindings-2.17.18.tar.bz2 -> yast2-pkg-bindings-2.17.21.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.18/configure new/yast2-pkg-bindings-2.17.21/configure
--- old/yast2-pkg-bindings-2.17.18/configure 2008-10-09 15:30:14.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.21/configure 2008-10-21 16:02:33.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.18.
+# Generated by GNU Autoconf 2.61 for yast2-pkg-bindings 2.17.21.
#
# 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.18'
-PACKAGE_STRING='yast2-pkg-bindings 2.17.18'
+PACKAGE_VERSION='2.17.21'
+PACKAGE_STRING='yast2-pkg-bindings 2.17.21'
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.18 to adapt to many kinds of systems.
+\`configure' configures yast2-pkg-bindings 2.17.21 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.18:";;
+ short | recursive ) echo "Configuration of yast2-pkg-bindings 2.17.21:";;
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.18
+yast2-pkg-bindings configure 2.17.21
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.18, which was
+It was created by yast2-pkg-bindings $as_me 2.17.21, 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.18'
+ VERSION='2.17.21'
cat >>confdefs.h <<_ACEOF
@@ -2699,7 +2699,7 @@
-VERSION="2.17.18"
+VERSION="2.17.21"
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.18, which was
+This file was extended by yast2-pkg-bindings $as_me 2.17.21, 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.18
+yast2-pkg-bindings config.status 2.17.21
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.18/configure.in new/yast2-pkg-bindings-2.17.21/configure.in
--- old/yast2-pkg-bindings-2.17.18/configure.in 2008-10-09 15:30:01.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.21/configure.in 2008-10-21 16:02:20.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.18, http://bugs.opensuse.org/, yast2-pkg-bindings)
+AC_INIT(yast2-pkg-bindings, 2.17.21, 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.18"
+VERSION="2.17.21"
RPMNAME="yast2-pkg-bindings"
MAINTAINER="Ladislav Slezák "
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.18/src/Callbacks.cc new/yast2-pkg-bindings-2.17.21/src/Callbacks.cc
--- old/yast2-pkg-bindings-2.17.18/src/Callbacks.cc 2008-09-22 13:54:50.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.21/src/Callbacks.cc 2008-10-15 10:43:43.000000000 +0200
@@ -256,10 +256,11 @@
struct InstallPkgReceive : public Recipient, public zypp::callback::ReceiveReportzypp::target::rpm::InstallResolvableReport
{
zypp::Resolvable::constPtr _last;
+ PkgFunctions &_pkg_ref;
int last_reported;
time_t last_reported_time;
- InstallPkgReceive(RecipientCtl & construct_r) : Recipient(construct_r)
+ InstallPkgReceive(RecipientCtl & construct_r, PkgFunctions &pk) : Recipient(construct_r), _last(NULL), _pkg_ref(pk)
{
}
@@ -285,6 +286,22 @@
if( _last == resolvable )
return;
+ // convert the repo ID
+ PkgFunctions::RepoId source_id = _pkg_ref.logFindAlias(res->repoInfo().alias());
+ int media_nr = res->mediaNr();
+
+ if( source_id != _pkg_ref.LastReportedRepo() || media_nr != _pkg_ref.LastReportedMedium())
+ {
+ CB callback( ycpcb( YCPCallbacks::CB_SourceChange ) );
+ if (callback._set) {
+ callback.addInt( source_id );
+ callback.addInt( media_nr );
+ callback.evaluate();
+ }
+
+ _pkg_ref.SetReportedSource(source_id, media_nr);
+ }
+
CB callback( ycpcb( YCPCallbacks::CB_StartPackage ) );
if (callback._set) {
callback.addStr(res->location().filename());
@@ -495,11 +512,9 @@
///////////////////////////////////////////////////////////////////
struct DownloadResolvableReceive : public Recipient, public zypp::callback::ReceiveReportzypp::repo::DownloadResolvableReport
{
- static int last_source_id;
- static int last_source_media;
- const PkgFunctions &_pkg_ref;
+ PkgFunctions &_pkg_ref;
- DownloadResolvableReceive( RecipientCtl & construct_r, const PkgFunctions &pk ) : Recipient( construct_r ), _pkg_ref(pk) {}
+ DownloadResolvableReceive( RecipientCtl & construct_r, PkgFunctions &pk ) : Recipient( construct_r ), _pkg_ref(pk) {}
int last_reported;
time_t last_reported_time;
@@ -534,10 +549,10 @@
size = pkg->downloadSize();
// convert the repo ID
- long long source_id = _pkg_ref.logFindAlias(pkg->repoInfo().alias());
+ PkgFunctions::RepoId source_id = _pkg_ref.logFindAlias(pkg->repoInfo().alias());
int media_nr = pkg->mediaNr();
- if( source_id != last_source_id || media_nr != last_source_media )
+ if( source_id != _pkg_ref.LastReportedRepo() || media_nr != _pkg_ref.LastReportedMedium())
{
CB callback( ycpcb( YCPCallbacks::CB_SourceChange ) );
if (callback._set) {
@@ -545,8 +560,7 @@
callback.addInt( media_nr );
callback.evaluate();
}
- last_source_id = source_id;
- last_source_media = media_nr;
+ _pkg_ref.SetReportedSource(source_id, media_nr);
}
}
@@ -783,10 +797,6 @@
};
- int DownloadResolvableReceive::last_source_id = -1;
- int DownloadResolvableReceive::last_source_media = -1;
-
-
///////////////////////////////////////////////////////////////////
// DownloadProgressReceive
///////////////////////////////////////////////////////////////////
@@ -1833,12 +1843,12 @@
public:
- ZyppReceive( const YCPCallbacks & ycpcb_r, const PkgFunctions &pkg)
+ ZyppReceive( const YCPCallbacks & ycpcb_r, PkgFunctions &pkg)
: RecipientCtl( ycpcb_r )
, _convertDbReceive( *this )
, _rebuildDbReceive( *this )
, _scanDbReceive( *this )
- , _installPkgReceive( *this )
+ , _installPkgReceive( *this, pkg )
, _removePkgReceive( *this )
, _providePkgReceive( *this, pkg )
, _mediaChangeReceive( *this )
@@ -1913,7 +1923,7 @@
// METHOD NAME : PkgFunctions::CallbackHandler::CallbackHandler
// METHOD TYPE : Constructor
//
-PkgFunctions::CallbackHandler::CallbackHandler(const PkgFunctions &pk)
+PkgFunctions::CallbackHandler::CallbackHandler(PkgFunctions &pk)
: _ycpCallbacks( *new YCPCallbacks() )
, _zyppReceive( *new ZyppReceive(_ycpCallbacks, pk) )
{
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.18/src/Callbacks.h new/yast2-pkg-bindings-2.17.21/src/Callbacks.h
--- old/yast2-pkg-bindings-2.17.18/src/Callbacks.h 2008-01-03 08:08:44.000000000 +0100
+++ new/yast2-pkg-bindings-2.17.21/src/Callbacks.h 2008-10-15 10:34:40.000000000 +0200
@@ -87,7 +87,7 @@
* Constructor. Setup handler and redirect Y2PMCallbacks
* to the ZyppReceiver.
**/
- CallbackHandler(const PkgFunctions &);
+ CallbackHandler(PkgFunctions &);
/**
* Destructor. Reset Y2PMCallbacks to it's defaults.
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.18/src/Network.cc new/yast2-pkg-bindings-2.17.21/src/Network.cc
--- old/yast2-pkg-bindings-2.17.18/src/Network.cc 2008-10-09 15:25:22.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.21/src/Network.cc 2008-10-17 10:58:32.000000000 +0200
@@ -46,9 +46,17 @@
bool PkgFunctions::NetworkDetected()
{
y2milestone("Checking the network status...");
- int result = ::system("ip addr|grep -v 'inet6 ::1\\|inet6 fe80'|grep -q inet6 &> /dev/null");
+ // check IPv4 network
+ int result = ::system("ip addr|grep -v '127.0.0\\|inet6'|grep -q inet &> /dev/null");
y2milestone("Network is running: %s", (result == 0) ? "yes" : "no");
+ if (!result)
+ {
+ // IPv4 not detected, try IPv6
+ result = ::system("ip addr|grep -v 'inet6 ::1\\|inet6 fe80'|grep -q inet6 &> /dev/null");
+ y2milestone("Network (IPv6) is running: %s", (result == 0) ? "yes" : "no");
+ }
+
return !result;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.18/src/Package.cc new/yast2-pkg-bindings-2.17.21/src/Package.cc
--- old/yast2-pkg-bindings-2.17.18/src/Package.cc 2008-10-09 07:53:30.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.21/src/Package.cc 2008-10-21 15:35:25.000000000 +0200
@@ -1505,7 +1505,7 @@
/**
* @builtin PkgUpdateAll
- * @param map update_options Options for the solver. All parameters are optional, if a parameter is missing the default value from the package manager (libzypp) is used. Currently supported options: <tt>$["delete_unmaintained":boolean, "silent_downgrades":boolean, "keep_installed_patches":boolean]</tt>
+ * @param map update_options Options for the solver. All parameters are optional, if a parameter is missing the default value from the package manager (libzypp) is used. Currently supported options: <tt>$["silent_downgrades":boolean] </tt>
* @short Update installed packages
* @description
* Mark all packages for installation which are installed and have
@@ -2071,6 +2071,10 @@
try
{
+ // reset the values for SourceChanged callback
+ last_reported_repo = -1;
+ last_reported_mediumnr = 1;
+
zypp::ZYppCommitPolicy policy;
policy.restrictToMedia( medianr );
result = zypp_ptr()->commit(policy);
@@ -2464,3 +2468,20 @@
return true;
}
+
+YCPValue PkgFunctions::CreateSolverTestCase(const YCPString &dir)
+{
+ if (dir.isNull())
+ {
+ y2error("Pkg::CreateSolverTestcase(): nil parameter!");
+ return YCPBoolean(false);
+ }
+
+ std::string testcase_dir(dir->value());
+ y2milestone("Creating a solver test case in directory %s", testcase_dir.c_str());
+ bool success = zypp_ptr()->resolver()->createSolverTestcase(testcase_dir);
+ y2milestone("Testcase saved: %s", success ? "true" : "false");
+
+ return YCPBoolean(success);
+}
+
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.18/src/PkgFunctions.cc new/yast2-pkg-bindings-2.17.21/src/PkgFunctions.cc
--- old/yast2-pkg-bindings-2.17.18/src/PkgFunctions.cc 2008-09-25 17:51:03.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.21/src/PkgFunctions.cc 2008-10-15 10:36:39.000000000 +0200
@@ -259,3 +259,18 @@
return ret;
}
+PkgFunctions::RepoId PkgFunctions::LastReportedRepo() const
+{
+ return last_reported_repo;
+}
+
+int PkgFunctions::LastReportedMedium() const
+{
+ return last_reported_mediumnr;
+}
+
+void PkgFunctions::SetReportedSource(RepoId repo, int medium)
+{
+ last_reported_repo = repo;
+ last_reported_mediumnr = medium;
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.18/src/PkgFunctions.h new/yast2-pkg-bindings-2.17.21/src/PkgFunctions.h
--- old/yast2-pkg-bindings-2.17.18/src/PkgFunctions.h 2008-10-02 12:33:23.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.21/src/PkgFunctions.h 2008-10-21 15:35:09.000000000 +0200
@@ -95,10 +95,12 @@
// container for the internal structure
typedef std::vector RepoCont;
+
+ public:
+
// ID type
typedef RepoCont::size_type RepoId;
-
private: // source related
// all known installation sources
@@ -110,6 +112,9 @@
// flag for skipping autorefresh
volatile bool autorefresh_skipped;
+ RepoId last_reported_repo;
+ int last_reported_mediumnr;
+
YCPValue SourceRefreshHelper(const YCPInteger &id, bool forced = false);
// helper - is the network running?
@@ -180,6 +185,8 @@
bool CreateBaseProductSymlink();
+ YCPMap Resolvable2YCPMap(const zypp::PoolItem &item, const std::string &req_kind, bool dependencies);
+
private:
/**
@@ -670,6 +677,8 @@
YCPValue PkgApplReset ();
/* TYPEINFO: boolean(boolean)*/
YCPBoolean PkgSolve (const YCPBoolean& filter);
+ /* TYPEINFO: boolean(string)*/
+ YCPValue CreateSolverTestCase(const YCPString &dir);
/* TYPEINFO: boolean()*/
YCPBoolean PkgEstablish ();
/* TYPEINFO: boolean()*/
@@ -793,6 +802,8 @@
YCPValue ServiceURL(const YCPString &alias);
/* TYPEINFO: string(string)*/
YCPValue ServiceProbe(const YCPString &url);
+ /* TYPEINFO: boolean(string)*/
+ YCPValue ServiceSave(const YCPString &alias);
YCPValue ResolvablePropertiesEx(const YCPString& name, const YCPSymbol& kind_r, const YCPString& version, bool dependencies);
@@ -811,5 +822,8 @@
// must be public, used in callbacks
RepoId logFindAlias(const std::string &alias) const;
+ RepoId LastReportedRepo() const;
+ int LastReportedMedium() const;
+ void SetReportedSource(RepoId repo, int medium);
};
#endif // PkgFunctions_h
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.18/src/Resolvable_Properties.cc new/yast2-pkg-bindings-2.17.21/src/Resolvable_Properties.cc
--- old/yast2-pkg-bindings-2.17.18/src/Resolvable_Properties.cc 2008-09-26 08:48:36.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.21/src/Resolvable_Properties.cc 2008-10-21 15:55:30.000000000 +0200
@@ -174,6 +174,278 @@
return ret;
}
+YCPMap PkgFunctions::Resolvable2YCPMap(const zypp::PoolItem &item, const std::string &req_kind, bool dependencies)
+{
+ YCPMap info;
+
+ info->add(YCPString("name"), YCPString(item->name()));
+ info->add(YCPString("version"), YCPString(item->edition().asString()));
+ info->add(YCPString("arch"), YCPString(item->arch().asString()));
+ info->add(YCPString("description"), YCPString(item->description()));
+
+ std::string resolvable_summary = item->summary();
+ if (resolvable_summary.size() > 0)
+ {
+ info->add(YCPString("summary"), YCPString(resolvable_summary));
+ }
+
+ // status
+ std::string stat;
+
+ zypp::ResStatus status = item.status();
+
+ if (status.isInstalled() || status.isSatisfied())
+ {
+ if (status.isToBeUninstalled())
+ {
+ stat = "removed";
+ info->add(YCPString("transact_by"), YCPSymbol(TransactToString(status.getTransactByValue())));
+ }
+ else
+ {
+ stat = "installed";
+ }
+ }
+ else if (status.isToBeInstalled())
+ {
+ stat = "selected";
+ info->add(YCPString("transact_by"), YCPSymbol(TransactToString(status.getTransactByValue())));
+ }
+ else
+ {
+ stat = "available";
+ }
+
+ info->add(YCPString("status"), YCPSymbol(stat));
+
+ // is the resolvable locked? (Locked or Taboo in the UI)
+ info->add(YCPString("locked"), YCPBoolean(status.isLocked()));
+
+ // source
+ info->add(YCPString("source"), YCPInteger(logFindAlias(item->repoInfo().alias())));
+
+ // add license info if it is defined
+ std::string license = item->licenseToConfirm();
+ if (!license.empty())
+ {
+ info->add(YCPString("license_confirmed"), YCPBoolean(item.status().isLicenceConfirmed()));
+ info->add(YCPString("license"), YCPString(license));
+ }
+
+ info->add(YCPString("download_size"), YCPInteger(item->downloadSize()));
+ info->add(YCPString("inst_size"), YCPInteger(item->installSize()));
+
+ info->add(YCPString("medium_nr"), YCPInteger(item->mediaNr()));
+ info->add(YCPString("vendor"), YCPString(item->vendor()));
+
+
+ // package specific info
+ if( req_kind == "package" )
+ {
+ zypp::Package::constPtr pkg = boost::dynamic_pointer_cast<const zypp::Package>(item.resolvable());
+ if ( pkg )
+ {
+ std::string tmp = pkg->location().filename().asString();
+ if (!tmp.empty())
+ {
+ info->add(YCPString("path"), YCPString(tmp));
+ }
+
+ tmp = pkg->location().filename().basename();
+ if (!tmp.empty())
+ {
+ info->add(YCPString("location"), YCPString(tmp));
+ }
+ } else
+ {
+ y2error("package %s is not a package", item->name().c_str() );
+ }
+ }
+ // product specific info
+ else if( req_kind == "product" ) {
+ zypp::Product::constPtr product = boost::dynamic_pointer_cast<const zypp::Product>(item.resolvable());
+ if ( !product )
+ {
+ y2error("product %s is not a product", item->name().c_str() );
+ return YCPMap();
+ }
+
+ std::string category(product->isTargetDistribution() ? "base" : "addon");
+
+ info->add(YCPString("category"), YCPString(category));
+ info->add(YCPString("type"), YCPString(category));
+ info->add(YCPString("relnotes_url"), YCPString(product->releaseNotesUrls().first().asString()));
+
+ std::string product_summary = product->summary();
+ if (product_summary.size() > 0)
+ {
+ info->add(YCPString("display_name"), YCPString(product_summary));
+ }
+
+ std::string product_shortname = product->shortName();
+ if (product_shortname.size() > 0)
+ {
+ info->add(YCPString("short_name"), YCPString(product_shortname));
+ }
+ // use summary for the short name if it's defined
+ else if (product_summary.size() > 0)
+ {
+ info->add(YCPString("short_name"), YCPString(product_summary));
+ }
+
+ YCPList updateUrls;
+ zypp::Product::UrlList pupdateUrls = product->updateUrls();
+ for_( it, pupdateUrls.begin(), pupdateUrls.end() )
+ {
+ updateUrls->add(YCPString(it->asString()));
+ }
+ info->add(YCPString("update_urls"), updateUrls);
+
+ YCPList flags;
+ std::liststd::string pflags = product->flags();
+ for (std::liststd::string::const_iterator flag_it = pflags.begin();
+ flag_it != pflags.end(); ++flag_it)
+ {
+ flags->add(YCPString(*flag_it));
+ }
+ info->add(YCPString("flags"), flags);
+
+ YCPList extraUrls( asYCPList(product->extraUrls()) );
+ if ( extraUrls.size() )
+ {
+ info->add(YCPString("extra_urls"), extraUrls);
+ }
+
+ YCPList optionalUrls( asYCPList(product->optionalUrls()) );
+ if ( optionalUrls.size() )
+ {
+ info->add(YCPString("optional_urls"), optionalUrls);
+ }
+
+ YCPList registerUrls( asYCPList(product->registerUrls()) );
+ if ( registerUrls.size() )
+ {
+ info->add(YCPString("register_urls"), registerUrls);
+ }
+
+ YCPList smoltUrls( asYCPList(product->smoltUrls()) );
+ if ( smoltUrls.size() )
+ {
+ info->add(YCPString("smolt_urls"), smoltUrls);
+ }
+
+ // registration data
+ info->add(YCPString("register_target"), YCPString(product->registerTarget()));
+ info->add(YCPString("register_release"), YCPString(product->registerRelease()));
+
+ // Live CD, FTP Edition...
+ info->add(YCPString("flavor"), YCPString(product->flavor()));
+
+ // get the installed Products it would replace.
+ zypp::Product::ReplacedProducts replaced(product->replacedProducts());
+
+ if (!replaced.empty())
+ {
+ YCPList rep_prods;
+
+ // add the products to the list
+ for_( it, replaced.begin(), replaced.end() )
+ {
+ // The current replaced Product.
+ zypp::Product::constPtr replacedProduct(*it);
+
+ if (!replacedProduct) continue;
+
+ YCPMap rprod;
+ rprod->add(YCPString("name"), YCPString(replacedProduct->name()));
+ rprod->add(YCPString("version"), YCPString(replacedProduct->edition().asString()));
+ rprod->add(YCPString("arch"), YCPString(replacedProduct->arch().asString()));
+ rprod->add(YCPString("description"), YCPString(replacedProduct->description()));
+
+ std::string product_summary = replacedProduct->summary();
+ if (product_summary.size() > 0)
+ {
+ rprod->add(YCPString("display_name"), YCPString(product_summary));
+ }
+
+ std::string product_shortname = replacedProduct->shortName();
+ if (product_shortname.size() > 0)
+ {
+ rprod->add(YCPString("short_name"), YCPString(product_shortname));
+ }
+ // use summary for the short name if it's defined
+ else if (product_summary.size() > 0)
+ {
+ rprod->add(YCPString("short_name"), YCPString(product_summary));
+ }
+ }
+
+ info->add(YCPString("replaces"), rep_prods);
+ }
+ }
+ // pattern specific info
+ else if ( req_kind == "pattern" ) {
+ zypp::Pattern::constPtr pattern = boost::dynamic_pointer_cast<const zypp::Pattern>(item.resolvable());
+ info->add(YCPString("category"), YCPString(pattern->category()));
+ info->add(YCPString("user_visible"), YCPBoolean(pattern->userVisible()));
+ info->add(YCPString("default"), YCPBoolean(pattern->isDefault()));
+ info->add(YCPString("icon"), YCPString(pattern->icon().asString()));
+ info->add(YCPString("script"), YCPString(pattern->script().asString()));
+ info->add(YCPString("order"), YCPString(pattern->order()));
+ }
+ // patch specific info
+ else if ( req_kind == "patch" )
+ {
+ zypp::Patch::constPtr patch_ptr = boost::dynamic_pointer_cast<const zypp::Patch>(item.resolvable());
+
+ info->add(YCPString("interactive"), YCPBoolean(patch_ptr->interactive()));
+ info->add(YCPString("reboot_needed"), YCPBoolean(patch_ptr->rebootSuggested()));
+ info->add(YCPString("relogin_needed"), YCPBoolean(patch_ptr->reloginSuggested()));
+ info->add(YCPString("affects_pkg_manager"), YCPBoolean(patch_ptr->restartSuggested()));
+ info->add(YCPString("is_needed"), YCPBoolean(item.isBroken()));
+ }
+
+ // dependency info
+ if (dependencies)
+ {
+ std::setstd::string _kinds;
+ _kinds.insert("provides");
+ _kinds.insert("prerequires");
+ _kinds.insert("requires");
+ _kinds.insert("conflicts");
+ _kinds.insert("obsoletes");
+ _kinds.insert("recommends");
+ _kinds.insert("suggests");
+ _kinds.insert("enhances");
+ _kinds.insert("supplements");
+ YCPList ycpdeps;
+ for (std::setstd::string::const_iterator kind_it = _kinds.begin();
+ kind_it != _kinds.end(); ++kind_it)
+ {
+ try {
+ zypp::Dep depkind(*kind_it);
+ zypp::Capabilities deps = item.resolvable()->dep(depkind);
+
+ zypp::sat::WhatProvides prv(deps);
+
+ for (zypp::sat::WhatProvides::const_iterator d = prv.begin(); d != prv.end(); ++d)
+ {
+ YCPMap ycpdep;
+ ycpdep->add (YCPString ("res_kind"), YCPString (d->kind().asString()));
+ ycpdep->add (YCPString ("name"), YCPString (d->name()));
+ ycpdep->add (YCPString ("dep_kind"), YCPString (*kind_it));
+ ycpdeps->add (ycpdep);
+ }
+ }
+ catch (...)
+ {}
+ }
+ info->add (YCPString ("dependencies"), ycpdeps);
+ }
+
+ return info;
+}
+
YCPValue
PkgFunctions::ResolvablePropertiesEx(const YCPString& name, const YCPSymbol& kind_r, const YCPString& version, bool dependencies)
{
@@ -236,279 +508,35 @@
it != zypp_ptr()->poolProxy().byKindEnd(kind);
++it)
{
- if ((nm.empty() || nm == (*it)->theObj()->name())
- && (vers.empty() || vers == (*it)->theObj()->edition().asString()))
- {
- YCPMap info;
-
- info->add(YCPString("name"), YCPString((*it)->theObj()->name()));
- info->add(YCPString("version"), YCPString((*it)->theObj()->edition().asString()));
- info->add(YCPString("arch"), YCPString((*it)->theObj()->arch().asString()));
- info->add(YCPString("description"), YCPString((*it)->theObj()->description()));
-
- std::string resolvable_summary = (*it)->theObj()->summary();
- if (resolvable_summary.size() > 0)
- {
- info->add(YCPString("summary"), YCPString(resolvable_summary));
- }
+ zypp::ui::Selectable::Ptr s = (*it);
- // status
- std::string stat;
-
- // selectable status
- zypp::ui::Status status = (*it)->status();
-
- switch((*it)->fate())
- {
- case zypp::ui::Selectable::TO_INSTALL:
- stat = "selected";
- // add the transaction data
- info->add(YCPString("transact_by"), YCPSymbol(TransactToString((*it)->theObj().status().getTransactByValue())));
- break;
- case zypp::ui::Selectable::TO_DELETE:
- stat = "removed";
- // add the transaction data
- info->add(YCPString("transact_by"), YCPSymbol(TransactToString((*it)->theObj().status().getTransactByValue())));
- break;
- case zypp::ui::Selectable::UNMODIFIED:
- stat = (status == zypp::ui::S_KeepInstalled
- || status == zypp::ui::S_Protected) ? "installed" : "available";
- break;
- }
-
- info->add(YCPString("status"), YCPSymbol(stat));
-
- // the current (string) status in libzypp
- // `S_Protected, `S_Taboo, `S_Del, `S_Update, `S_Install, `S_AutoDel,
- // `S_AutoUpdate, `S_AutoInstall, `S_KeepInstalled, or `S_NoInst
- info->add(YCPString("status_detail"), YCPSymbol(zypp::ui::asString(status)));
-
- // is the resolvable locked? (Locked or Taboo in the UI)
- info->add(YCPString("locked"), YCPBoolean(status == zypp::ui::S_Protected
- || status == zypp::ui::S_Taboo));
-
- // source
- info->add(YCPString("source"), YCPInteger(logFindAlias((*it)->theObj()->repoInfo().alias())));
-
- // add license info if it is defined
- std::string license = (*it)->theObj()->licenseToConfirm();
- if (!license.empty())
- {
- info->add(YCPString("license_confirmed"), YCPBoolean((*it)->theObj().status().isLicenceConfirmed()));
- info->add(YCPString("license"), YCPString(license));
- }
-
- info->add(YCPString("download_size"), YCPInteger((*it)->theObj()->downloadSize()));
- info->add(YCPString("inst_size"), YCPInteger((*it)->theObj()->installSize()));
-
- info->add(YCPString("medium_nr"), YCPInteger((*it)->theObj()->mediaNr()));
- info->add(YCPString("vendor"), YCPString((*it)->theObj()->vendor()));
-
-
- // package specific info
- if( req_kind == "package" )
+ if (nm.empty() || nm == s->name())
+ {
+ if (!s->installedEmpty())
{
- zypp::Package::constPtr pkg = boost::dynamic_pointer_cast<const zypp::Package>((*it)->theObj().resolvable());
- if ( pkg )
- {
- std::string tmp = pkg->location().filename().asString();
- if (!tmp.empty())
- {
- info->add(YCPString("path"), YCPString(tmp));
- }
-
- tmp = pkg->location().filename().basename();
- if (!tmp.empty())
- {
- info->add(YCPString("location"), YCPString(tmp));
- }
- } else
- {
- y2error("package %s is not a package", (*it)->name().c_str() );
- }
- }
- // product specific info
- else if( req_kind == "product" ) {
- zypp::Product::constPtr product = boost::dynamic_pointer_cast<const zypp::Product>((*it)->theObj().resolvable());
- if ( !product )
- {
- y2error("product %s is not a product", (*it)->name().c_str() );
- continue;
- }
-
- std::string category(product->isTargetDistribution() ? "base" : "addon");
-
- info->add(YCPString("category"), YCPString(category));
- info->add(YCPString("type"), YCPString(category));
- info->add(YCPString("relnotes_url"), YCPString(product->releaseNotesUrls().first().asString()));
-
- std::string product_summary = product->summary();
- if (product_summary.size() > 0)
- {
- info->add(YCPString("display_name"), YCPString(product_summary));
- }
-
- std::string product_shortname = product->shortName();
- if (product_shortname.size() > 0)
- {
- info->add(YCPString("short_name"), YCPString(product_shortname));
- }
- // use summary for the short name if it's defined
- else if (product_summary.size() > 0)
- {
- info->add(YCPString("short_name"), YCPString(product_summary));
- }
-
- YCPList updateUrls;
- zypp::Product::UrlList pupdateUrls = product->updateUrls();
- for_( it, pupdateUrls.begin(), pupdateUrls.end() )
- {
- updateUrls->add(YCPString(it->asString()));
- }
- info->add(YCPString("update_urls"), updateUrls);
-
- YCPList flags;
- std::liststd::string pflags = product->flags();
- for (std::liststd::string::const_iterator flag_it = pflags.begin();
- flag_it != pflags.end(); ++flag_it)
- {
- flags->add(YCPString(*flag_it));
- }
- info->add(YCPString("flags"), flags);
-
- YCPList extraUrls( asYCPList(product->extraUrls()) );
- if ( extraUrls.size() )
- {
- info->add(YCPString("extra_urls"), extraUrls);
- }
-
- YCPList optionalUrls( asYCPList(product->optionalUrls()) );
- if ( optionalUrls.size() )
- {
- info->add(YCPString("optional_urls"), optionalUrls);
- }
-
- YCPList registerUrls( asYCPList(product->registerUrls()) );
- if ( registerUrls.size() )
- {
- info->add(YCPString("register_urls"), registerUrls);
- }
-
- YCPList smoltUrls( asYCPList(product->smoltUrls()) );
- if ( smoltUrls.size() )
- {
- info->add(YCPString("smolt_urls"), smoltUrls);
- }
-
- // registration data
- info->add(YCPString("register_target"), YCPString(product->registerTarget()));
- info->add(YCPString("register_release"), YCPString(product->registerRelease()));
-
- // Live CD, FTP Edition...
- info->add(YCPString("flavor"), YCPString(product->flavor()));
-
- // get the installed Products it would replace.
- zypp::Product::ReplacedProducts replaced(product->replacedProducts());
-
- if (!replaced.empty())
+ // iterate over all installed packages
+ for_(inst_it, s->installedBegin(), s->installedEnd())
{
- YCPList rep_prods;
-
- // add the products to the list
- for_( it, replaced.begin(), replaced.end() )
+ // check version if required
+ if (vers.empty() || vers == inst_it->resolvable()->edition().asString())
{
- // The current replaced Product.
- zypp::Product::constPtr replacedProduct(*it);
-
- if (!replacedProduct) continue;
-
- YCPMap rprod;
- rprod->add(YCPString("name"), YCPString(replacedProduct->name()));
- rprod->add(YCPString("version"), YCPString(replacedProduct->edition().asString()));
- rprod->add(YCPString("arch"), YCPString(replacedProduct->arch().asString()));
- rprod->add(YCPString("description"), YCPString(replacedProduct->description()));
-
- std::string product_summary = replacedProduct->summary();
- if (product_summary.size() > 0)
- {
- rprod->add(YCPString("display_name"), YCPString(product_summary));
- }
-
- std::string product_shortname = replacedProduct->shortName();
- if (product_shortname.size() > 0)
- {
- rprod->add(YCPString("short_name"), YCPString(product_shortname));
- }
- // use summary for the short name if it's defined
- else if (product_summary.size() > 0)
- {
- rprod->add(YCPString("short_name"), YCPString(product_summary));
- }
+ ret->add(Resolvable2YCPMap(*inst_it, req_kind, dependencies));
}
-
- info->add(YCPString("replaces"), rep_prods);
}
}
- // pattern specific info
- else if ( req_kind == "pattern" ) {
- zypp::Pattern::constPtr pattern = boost::dynamic_pointer_cast<const zypp::Pattern>((*it)->theObj().resolvable());
- info->add(YCPString("category"), YCPString(pattern->category()));
- info->add(YCPString("user_visible"), YCPBoolean(pattern->userVisible()));
- info->add(YCPString("default"), YCPBoolean(pattern->isDefault()));
- info->add(YCPString("icon"), YCPString(pattern->icon().asString()));
- info->add(YCPString("script"), YCPString(pattern->script().asString()));
- info->add(YCPString("order"), YCPString(pattern->order()));
- }
- // patch specific info
- else if ( req_kind == "patch" )
- {
- zypp::Patch::constPtr patch_ptr = boost::dynamic_pointer_cast<const zypp::Patch>((*it)->theObj().resolvable());
-
- info->add(YCPString("interactive"), YCPBoolean(patch_ptr->interactive()));
- info->add(YCPString("reboot_needed"), YCPBoolean(patch_ptr->rebootSuggested()));
- info->add(YCPString("relogin_needed"), YCPBoolean(patch_ptr->reloginSuggested()));
- info->add(YCPString("affects_pkg_manager"), YCPBoolean(patch_ptr->restartSuggested()));
- info->add(YCPString("is_needed"), YCPBoolean((*it)->theObj().isBroken()));
- }
- // dependency info
- if (dependencies)
+ if (!s->availableEmpty())
{
- std::setstd::string _kinds;
- _kinds.insert("provides");
- _kinds.insert("prerequires");
- _kinds.insert("requires");
- _kinds.insert("conflicts");
- _kinds.insert("obsoletes");
- _kinds.insert("recommends");
- _kinds.insert("suggests");
- _kinds.insert("enhances");
- _kinds.insert("supplements");
- YCPList ycpdeps;
- for (std::setstd::string::const_iterator kind_it = _kinds.begin();
- kind_it != _kinds.end(); ++kind_it)
+ // iterate over all available packages
+ for_(avail_it, s->availableBegin(), s->availableEnd())
{
- try {
- zypp::Dep depkind(*kind_it);
- zypp::Capabilities deps = (*it)->theObj().resolvable()->dep(depkind);
-
- zypp::sat::WhatProvides prv(deps);
-
- for (zypp::sat::WhatProvides::const_iterator d = prv.begin(); d != prv.end(); ++d)
- {
- YCPMap ycpdep;
- ycpdep->add (YCPString ("res_kind"), YCPString (d->kind().asString()));
- ycpdep->add (YCPString ("name"), YCPString (d->name()));
- ycpdep->add (YCPString ("dep_kind"), YCPString (*kind_it));
- ycpdeps->add (ycpdep);
- }
+ // check version if required
+ if (vers.empty() || vers == avail_it->resolvable()->edition().asString())
+ {
+ ret->add(Resolvable2YCPMap(*avail_it, req_kind, dependencies));
}
- catch (...)
- {}
}
- info->add (YCPString ("dependencies"), ycpdeps);
}
- ret->add(info);
}
}
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.18/src/Service.cc new/yast2-pkg-bindings-2.17.21/src/Service.cc
--- old/yast2-pkg-bindings-2.17.18/src/Service.cc 2008-10-02 17:57:23.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.21/src/Service.cc 2008-10-17 15:10:01.000000000 +0200
@@ -98,7 +98,27 @@
return YCPBoolean(false);
}
- return YCPBoolean(service_manager.RemoveService(alias->value()));
+ std::string service_alias = alias->value();
+ bool ret = service_manager.RemoveService(service_alias);
+
+ if (ret)
+ {
+ RepoId index = 0;
+ // delete the repositories that belong to the service
+ for( RepoCont::const_iterator it = repos.begin(); it != repos.end() ; ++it, ++index )
+ {
+ YRepo_Ptr repo = *it;
+ if (repo->repoInfo().service() == service_alias)
+ {
+ std::string repo_alias = repo->repoInfo().alias();
+ y2milestone("Removing repository %zd (%s) belonging to service %s",
+ index, repo_alias.c_str(), service_alias.c_str());
+ repo->setDeleted();
+ }
+ }
+ }
+
+ return YCPBoolean(ret);
}
catch (const zypp::Exception& excpt)
{
@@ -110,10 +130,42 @@
/**
+ * @builtin ServiceSave
+ * @short Save a service to .service file
+ * All services are saved/updated/removed in Pkg::SourceSaveAll()
+ * @param alias alias of the service to remove
+ * @return boolean false if failed
+*/
+YCPValue PkgFunctions::ServiceSave(const YCPString &alias)
+{
+ try
+ {
+ if (alias.isNull())
+ {
+ y2error("Found nil parameter in Pkg::ServiceSave()");
+ return YCPBoolean(false);
+ }
+
+ std::string service_alias = alias->value();
+ zypp::RepoManager repomanager = CreateRepoManager();
+ y2milestone("Saving service %s", service_alias.c_str());
+
+ bool ret = service_manager.SaveService(service_alias, repomanager);
+ return YCPBoolean(ret);
+ }
+ catch (const zypp::Exception& excpt)
+ {
+ _last_error.setLastError(ExceptionAsString(excpt));
+ }
+
+ return YCPBoolean(false);
+}
+
+/**
@builtin ServiceGet
@short Get detailed properties of a service
@param alias alias of the service
- @return map Service data in map $[ "alias":string, "name":string, "url":string, "autorefresh":boolean, "enabled":boolean, "file":string ]. "file" is name of the file from which the service has been read, it is empty if the service has not been saved yet
+ @return map Service data in map $[ "alias":string, "name":string, "url":string, "autorefresh":boolean, "enabled":boolean, "file":string, "repos_to_disable" : list<string>, "repos_to_enable" : list<string> ]. "file" is name of the file from which the service has been read, it is empty if the service has not been saved yet
*/
YCPValue PkgFunctions::ServiceGet(const YCPString &alias)
{
@@ -133,6 +185,30 @@
ret->add(YCPString("enabled"), YCPBoolean(s.enabled()));
ret->add(YCPString("file"), YCPString(s.filepath().asString()));
+ if (s.reposToDisableSize() > 0)
+ {
+ YCPList lst;
+
+ for_(it, s.reposToDisableBegin(), s.reposToDisableEnd())
+ {
+ lst->add(YCPString(*it));
+ }
+
+ ret->add(YCPString("repos_to_disable"), lst);
+ }
+
+ if (s.reposToEnableSize() > 0)
+ {
+ YCPList lst;
+
+ for_(it, s.reposToEnableBegin(), s.reposToEnableEnd())
+ {
+ lst->add(YCPString(*it));
+ }
+
+ ret->add(YCPString("repos_to_enable"), lst);
+ }
+
return ret;
}
@@ -174,6 +250,7 @@
try
{
+ std::string old_alias_str(old_alias->value());
zypp::ServiceInfo s(service_manager.GetService(old_alias->value()));
YCPValue v;
@@ -204,7 +281,67 @@
v = service->value(YCPString("enabled"));
if(!v.isNull() && v->isBoolean())
{
- s.setEnabled(v->asBoolean()->value());
+ bool enabled = v->asBoolean()->value();
+ s.setEnabled(enabled);
+
+ // enable/disable the repositories belonging to the service
+ RepoId index = 0;
+ for( RepoCont::const_iterator it = repos.begin(); it != repos.end() ; ++it, ++index )
+ {
+ YRepo_Ptr repo = *it;
+ if (repo->repoInfo().enabled() != enabled && repo->repoInfo().service() == old_alias_str
+ && !repo->isDeleted())
+ {
+ std::string repo_alias = repo->repoInfo().alias();
+
+ y2milestone("%s repository %zd (%s) belonging to service %s",
+ enabled ? "Enabling" : "Disabling", index, repo_alias.c_str(), old_alias_str.c_str());
+
+ repo->repoInfo().setEnabled(enabled);
+ }
+ }
+ }
+
+ v = service->value(YCPString("repos_to_disable"));
+ if(!v.isNull() && v->isList())
+ {
+ // clear the list
+ s.clearReposToDisable();
+
+ YCPList lst = v->asList();
+
+ for (int index = 0; index < lst->size(); ++index)
+ {
+ if( ! lst->value(index)->isString() )
+ {
+ y2error( "repos_to_disable: value at index %d is not a string: %s", index, lst->toString().c_str());
+ }
+
+ std::string disable_alias(lst->value(index)->asString()->value());
+ y2milestone("Adding repository to disable: %s", disable_alias.c_str());
+ s.addRepoToDisable(disable_alias);
+ }
+ }
+
+ v = service->value(YCPString("repos_to_enable"));
+ if(!v.isNull() && v->isList())
+ {
+ // clear the list
+ s.clearReposToEnable();
+
+ YCPList lst = v->asList();
+
+ for (int index = 0; index < lst->size(); ++index)
+ {
+ if( ! lst->value(index)->isString() )
+ {
+ y2error( "repos_to_enable: value at index %d is not a string: %s", index, lst->toString().c_str());
+ }
+
+ std::string enable_alias(lst->value(index)->asString()->value());
+ y2milestone("Adding repository to enable: %s", enable_alias.c_str());
+ s.addRepoToEnable(enable_alias);
+ }
}
// note: do not allow to change the file name?
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.18/src/ServiceManager.cc new/yast2-pkg-bindings-2.17.21/src/ServiceManager.cc
--- old/yast2-pkg-bindings-2.17.18/src/ServiceManager.cc 2008-10-03 12:45:44.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.21/src/ServiceManager.cc 2008-10-17 14:09:29.000000000 +0200
@@ -70,52 +70,37 @@
{
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)
- {
- 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 service %s", alias.c_str());
- // use the old alias
- repomgr.modifyService(orig_alias, s_known);
- }
- }
- else
- {
- y2milestone("Service %s has not been modified, not saving", alias.c_str());
- }
+ SavePkgService(it->second, repomgr);
}
}
}
+bool ServiceManager::SaveService(const std::string &alias, zypp::RepoManager &repomgr) const
+{
+ PkgServices::const_iterator serv_it = _known_services.find(alias);
+
+ if (serv_it == _known_services.end())
+ {
+ y2error("Service '%s' does not exist", alias.c_str());
+ return false;
+ }
+
+ if (serv_it->second.isDeleted())
+ {
+ y2error("Service '%s' has been deleted", alias.c_str());
+ return false;
+ }
+
+ SavePkgService(serv_it->second, repomgr);
+
+ return true;
+}
+
bool ServiceManager::RefreshService(const std::string &alias, zypp::RepoManager &repomgr)
{
PkgServices::iterator serv_it = _known_services.find(alias);
- if (serv_it == _known_services.end())
+ if (serv_it == _known_services.end() || serv_it->second.isDeleted())
{
y2error("Service '%s' does not exist", alias.c_str());
return false;
@@ -292,3 +277,42 @@
return _known_services.size();
}
+void ServiceManager::SavePkgService(const PkgService &s_known, zypp::RepoManager &repomgr) const
+{
+ const std::string alias(s_known.alias());
+ const zypp::ServiceInfo s_stored = repomgr.getService(alias);
+
+ DBG << "Known Service: " << s_known << std::endl;
+ DBG << "Stored Service: " << s_stored << 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)
+ {
+ 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 service %s", alias.c_str());
+ // use the old alias
+ repomgr.modifyService(orig_alias, s_known);
+ }
+ }
+ else
+ {
+ y2milestone("Service %s has not been modified, not saving", alias.c_str());
+ }
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.18/src/ServiceManager.h new/yast2-pkg-bindings-2.17.21/src/ServiceManager.h
--- old/yast2-pkg-bindings-2.17.18/src/ServiceManager.h 2008-10-03 10:21:22.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.21/src/ServiceManager.h 2008-10-17 14:03:10.000000000 +0200
@@ -44,6 +44,8 @@
void SaveServices(zypp::RepoManager &repomgr) const;
+ bool SaveService(const std::string &alias, zypp::RepoManager &repomgr) const;
+
bool AddService(const std::string &alias, const std::string &url);
bool RemoveService(const std::string &alias);
@@ -67,10 +69,13 @@
private:
+ // internal helper method
+ void SavePkgService(const PkgService &s_known, zypp::RepoManager &repomgr) const;
+
// current alias -> PkgService for convenient search by alias
typedef std::map PkgServices;
- // services has been loaded from system
+ // services have been loaded from system
bool _services_loaded;
// all known services (even deleted)
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.17.18/VERSION new/yast2-pkg-bindings-2.17.21/VERSION
--- old/yast2-pkg-bindings-2.17.18/VERSION 2008-10-09 15:27:37.000000000 +0200
+++ new/yast2-pkg-bindings-2.17.21/VERSION 2008-10-21 15:49:06.000000000 +0200
@@ -1 +1 @@
-2.17.18
+2.17.21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org