Hello community,
here is the log from the commit of package yast2-pkg-bindings
checked in at Wed Mar 5 22:00:56 CET 2008.
--------
--- yast2-pkg-bindings/yast2-pkg-bindings.changes 2008-02-27 09:08:26.000000000 +0100
+++ yast2-pkg-bindings/yast2-pkg-bindings.changes 2008-03-05 17:36:03.065428000 +0100
@@ -1,0 +2,10 @@
+Wed Mar 5 12:22:37 CET 2008 - lslezak@suse.cz
+
+- added Pkg::CallbackStartRefresh() and Pkg::CallbackDoneRefresh()
+ callbacks, added Pkg::SkipRefresh() call to abort and skip
+ running source refresh (FATE #30962, bnc #231745)
+- use zypp::sat::WhatProvides instead of obsoleted byCapability
+ iterators
+- 2.16.16
+
+-------------------------------------------------------------------
Old:
----
yast2-pkg-bindings-2.16.15.tar.bz2
New:
----
yast2-pkg-bindings-2.16.16.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-pkg-bindings-devel-doc.spec ++++++
--- /var/tmp/diff_new_pack.f23462/_old 2008-03-05 22:00:06.000000000 +0100
+++ /var/tmp/diff_new_pack.f23462/_new 2008-03-05 22:00:06.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-pkg-bindings-devel-doc (Version 2.16.15)
+# spec file for package yast2-pkg-bindings-devel-doc (Version 2.16.16)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -12,12 +12,12 @@
Name: yast2-pkg-bindings-devel-doc
-Version: 2.16.15
+Version: 2.16.16
Release: 1
License: GPL v2 or later
Group: Documentation/HTML
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-pkg-bindings-2.16.15.tar.bz2
+Source0: yast2-pkg-bindings-2.16.16.tar.bz2
Prefix: /usr
# same as in the main package (because we use the same configure.in.in)
BuildRequires: blocxx-devel boost boost-devel dbus-1-devel docbook-xsl-stylesheets doxygen gcc-c++ hal-devel libgcrypt-devel libxcrypt-devel libxslt libzypp libzypp-devel perl-XML-Writer rpm-devel sgml-skel yast2-core-devel yast2-devtools
@@ -38,7 +38,7 @@
Ladislav Slez�k
%prep
-%setup -n yast2-pkg-bindings-2.16.15
+%setup -n yast2-pkg-bindings-2.16.16
# build only documentation, ignore all other directories
echo "doc" > SUBDIRS
++++++ yast2-pkg-bindings.spec ++++++
--- /var/tmp/diff_new_pack.f23462/_old 2008-03-05 22:00:06.000000000 +0100
+++ /var/tmp/diff_new_pack.f23462/_new 2008-03-05 22:00:06.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-pkg-bindings (Version 2.16.15)
+# spec file for package yast2-pkg-bindings (Version 2.16.16)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -12,12 +12,12 @@
Name: yast2-pkg-bindings
-Version: 2.16.15
+Version: 2.16.16
Release: 1
License: GPL v2 or later
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-pkg-bindings-2.16.15.tar.bz2
+Source0: yast2-pkg-bindings-2.16.16.tar.bz2
Prefix: /usr
BuildRequires: blocxx-devel boost boost-devel dbus-1-devel docbook-xsl-stylesheets doxygen gcc-c++ hal-devel libgcrypt-devel libxcrypt-devel libxslt perl-XML-Writer rpm-devel sgml-skel yast2-core-devel yast2-devtools
BuildRequires: libzypp-devel >= 4.1.8
@@ -41,7 +41,7 @@
Stanislav Visnovsky
%prep
-%setup -n yast2-pkg-bindings-2.16.15
+%setup -n yast2-pkg-bindings-2.16.16
# build only the library, ignore documentation (it is in devel-doc package)
echo "src" > SUBDIRS
@@ -74,6 +74,13 @@
%doc %{prefix}/share/doc/packages/yast2-pkg-bindings
%changelog
+* Wed Mar 05 2008 lslezak@suse.cz
+- added Pkg::CallbackStartRefresh() and Pkg::CallbackDoneRefresh()
+ callbacks, added Pkg::SkipRefresh() call to abort and skip
+ running source refresh (FATE #30962, bnc #231745)
+- use zypp::sat::WhatProvides instead of obsoleted byCapability
+ iterators
+- 2.16.16
* Wed Feb 27 2008 lslezak@suse.cz
- update - 'keep_intalled_patches' and 'delete_unmaintained' options
were removed from the libzypp API
++++++ yast2-pkg-bindings-2.16.15.tar.bz2 -> yast2-pkg-bindings-2.16.16.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.16.15/configure new/yast2-pkg-bindings-2.16.16/configure
--- old/yast2-pkg-bindings-2.16.15/configure 2008-02-22 15:51:39.000000000 +0100
+++ new/yast2-pkg-bindings-2.16.16/configure 2008-03-05 17:31:28.000000000 +0100
@@ -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.16.14.
+# Generated by GNU Autoconf 2.61 for yast2-pkg-bindings 2.16.16.
#
# 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.16.14'
-PACKAGE_STRING='yast2-pkg-bindings 2.16.14'
+PACKAGE_VERSION='2.16.16'
+PACKAGE_STRING='yast2-pkg-bindings 2.16.16'
PACKAGE_BUGREPORT='http://bugs.opensuse.org/'
ac_unique_file="RPMNAME"
@@ -1447,7 +1447,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.16.14 to adapt to many kinds of systems.
+\`configure' configures yast2-pkg-bindings 2.16.16 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1518,7 +1518,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of yast2-pkg-bindings 2.16.14:";;
+ short | recursive ) echo "Configuration of yast2-pkg-bindings 2.16.16:";;
esac
cat <<\_ACEOF
@@ -1627,7 +1627,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-yast2-pkg-bindings configure 2.16.14
+yast2-pkg-bindings configure 2.16.16
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1641,7 +1641,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.16.14, which was
+It was created by yast2-pkg-bindings $as_me 2.16.16, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -2462,7 +2462,7 @@
# Define the identity of the package.
PACKAGE='yast2-pkg-bindings'
- VERSION='2.16.14'
+ VERSION='2.16.16'
cat >>confdefs.h <<_ACEOF
@@ -2690,7 +2690,7 @@
-VERSION="2.16.14"
+VERSION="2.16.16"
RPMNAME="yast2-pkg-bindings"
MAINTAINER="Ladislav Slezák "
@@ -21199,7 +21199,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.16.14, which was
+This file was extended by yast2-pkg-bindings $as_me 2.16.16, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -21252,7 +21252,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-yast2-pkg-bindings config.status 2.16.14
+yast2-pkg-bindings config.status 2.16.16
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.16.15/configure.in new/yast2-pkg-bindings-2.16.16/configure.in
--- old/yast2-pkg-bindings-2.16.15/configure.in 2008-02-22 15:51:27.000000000 +0100
+++ new/yast2-pkg-bindings-2.16.16/configure.in 2008-03-05 17:31:18.000000000 +0100
@@ -1,9 +1,9 @@
dnl configure.in for yast2-pkg-bindings
dnl
-dnl -- This file is generated by y2autoconf 2.16.5 - DO NOT EDIT! --
+dnl -- This file is generated by y2autoconf 2.16.6 - DO NOT EDIT! --
dnl (edit configure.in.in instead)
-AC_INIT(yast2-pkg-bindings, 2.16.14, http://bugs.opensuse.org/, yast2-pkg-bindings)
+AC_INIT(yast2-pkg-bindings, 2.16.16, 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.16.14"
+VERSION="2.16.16"
RPMNAME="yast2-pkg-bindings"
MAINTAINER="Ladislav Slezák "
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.16.15/src/Callbacks_Register.cc new/yast2-pkg-bindings-2.16.16/src/Callbacks_Register.cc
--- old/yast2-pkg-bindings-2.16.15/src/Callbacks_Register.cc 2008-01-17 13:03:20.000000000 +0100
+++ new/yast2-pkg-bindings-2.16.16/src/Callbacks_Register.cc 2008-03-05 15:56:02.000000000 +0100
@@ -19,7 +19,7 @@
*/
/*
- File: $Id: Callbacks_Register.cc 43700 2008-01-17 12:03:20Z lslezak $
+ File: $Id: Callbacks_Register.cc 45220 2008-03-05 14:56:02Z lslezak $
Author: Ladislav Slezák
Summary: Functions for registering YCP callbacks from Yast
Namespace: Pkg
@@ -715,4 +715,29 @@
return SET_YCP_CB( CB_ProcessProgress, func);
}
+
+/**
+ * @builtin CallbackStartRefresh
+ * @short Register a callback function
+ * @param string func Name of the callback handler function. Required callback prototype is <code>void()</code>.
+ * The callback function is evaluated when repository refresh is started
+ * @return void
+ */
+YCPValue PkgFunctions::CallbackStartRefresh( const YCPString& func )
+{
+ return SET_YCP_CB( CB_StartSourceRefresh, func);
+}
+
+/**
+ * @builtin CallbackDoneRefresh
+ * @short Register a callback function
+ * @param string func Name of the callback handler function. Required callback prototype is <code>void()</code>.
+ * The callback function is evaluated when repository refresh is finished
+ * @return void
+ */
+YCPValue PkgFunctions::CallbackDoneRefresh( const YCPString& func )
+{
+ return SET_YCP_CB( CB_DoneSourceRefresh, func);
+}
+
#undef SET_YCP_CB
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.16.15/src/Package.cc new/yast2-pkg-bindings-2.16.16/src/Package.cc
--- old/yast2-pkg-bindings-2.16.15/src/Package.cc 2008-02-27 09:01:36.000000000 +0100
+++ new/yast2-pkg-bindings-2.16.16/src/Package.cc 2008-03-05 17:21:28.000000000 +0100
@@ -47,6 +47,8 @@
#include
#include
+#include
+
#include <fstream>
#include <sstream>
@@ -96,60 +98,64 @@
YCPList ret;
std::string name = tag->value();
- // 'it' is 'const struct std::pair >'
- for (zypp::ResPool::byCapabilityIndex_iterator it = zypp_ptr()->pool().byCapabilityIndexBegin(name, zypp::Dep::PROVIDES);
- it != zypp_ptr()->pool().byCapabilityIndexEnd(name, zypp::Dep::PROVIDES);
- ++it)
- {
- // is it a package?
- if (zypp::isKindzypp::Package(it->item.resolvable()))
- {
-
- // cast to Package object
- zypp::Package::constPtr package = zypp::dynamic_pointer_cast<const zypp::Package>(it->item.resolvable());
- std::string pkgname = package->name();
-
- // get instance status
- bool installed = it->item.status().staysInstalled();
- std::string instance;
+ zypp::Capability cap(name, zypp::ResKind::package);
+ zypp::sat::WhatProvides possibleProviders(cap);
-# warning Status `NONE and `INST is not supported
- // TODO FIXME the other values??
- if (installed)
- {
- instance = "BOTH";
- }
- else
- {
- instance = "CAND";
- }
+ for_(iter, possibleProviders.begin(), possibleProviders.end())
+ {
+ zypp::PoolItem provider = zypp::ResPool::instance().find(*iter);
- // get status on the system
- bool uninstalled = it->item.status().staysUninstalled() || it->item.status().isToBeUninstalled();
- std::string onSystem;
+ // cast to Package object
+ zypp::Package::constPtr package = zypp::dynamic_pointer_cast<const zypp::Package>(provider.resolvable());
- if (uninstalled)
- {
- onSystem = "NONE";
- }
- else if (installed)
- {
- onSystem = "INST";
- }
- else
- {
- onSystem = "CAND";
- }
+ if (!package)
+ {
+ y2internal("Casting to Package failed!");
+ continue;
+ }
- // create list item
- YCPList item;
- item->add(YCPString(pkgname));
- item->add(YCPSymbol(instance));
- item->add(YCPSymbol(onSystem));
+ std::string pkgname = package->name();
- // add the item to the result
- ret->add(item);
+ // get instance status
+ bool installed = provider.status().staysInstalled();
+ std::string instance;
+
+# warning Status `NONE and `INST is not supported
+ // TODO FIXME the other values??
+ if (installed)
+ {
+ instance = "BOTH";
+ }
+ else
+ {
+ instance = "CAND";
+ }
+
+ // get status on the system
+ bool uninstalled = provider.status().staysUninstalled() || provider.status().isToBeUninstalled();
+ std::string onSystem;
+
+ if (uninstalled)
+ {
+ onSystem = "NONE";
+ }
+ else if (installed)
+ {
+ onSystem = "INST";
}
+ else
+ {
+ onSystem = "CAND";
+ }
+
+ // create list item
+ YCPList item;
+ item->add(YCPString(pkgname));
+ item->add(YCPSymbol(instance));
+ item->add(YCPSymbol(onSystem));
+
+ // add the item to the result
+ ret->add(item);
}
return ret;
@@ -421,26 +427,25 @@
if (name.empty())
return YCPBoolean (false);
- y2milestone("IsProvided called");
+ // look for packages
+ zypp::Capability cap(name, zypp::ResKind::package);
+ zypp::sat::WhatProvides possibleProviders(cap);
- zypp::Dep dep( zypp::Dep::PROVIDES );
- CaIMatch match;
-
- // look for installed packages
-
- try
- {
- invokeOnEach( zypp_ptr()->pool().byCapabilityIndexBegin( name, dep ),
- zypp_ptr()->pool().byCapabilityIndexEnd( name, dep ),
- zypp::functor::chain( zypp::resfilter::ByCaIInstalled (),
- zypp::resfilter::ByCaIKind( zypp::ResTraitszypp::Package::kind ) ),
- zypp::functor::functorRef( match ) );
- }
- catch (...)
+ for_(iter, possibleProviders.begin(), possibleProviders.end())
{
+ zypp::PoolItem provider = zypp::ResPool::instance().find(*iter);
+
+ // is it installed?
+ if (provider.status().isInstalled())
+ {
+ y2milestone("Tag %s is provided by %s", name.c_str(), provider->name().c_str());
+ return YCPBoolean(true);
+ }
}
- return YCPBoolean( match.item );
+ y2milestone("Tag %s is not provided", name.c_str());
+
+ return YCPBoolean(false);
}
@@ -463,24 +468,25 @@
if (name.empty())
return YCPBoolean (false);
- zypp::Dep dep( zypp::Dep::PROVIDES );
- CaIMatch match;
+ // look for packages
+ zypp::Capability cap(name, zypp::ResKind::package);
+ zypp::sat::WhatProvides possibleProviders(cap);
- try
- {
- // look for to-be-installed packages
- invokeOnEach( zypp_ptr()->pool().byCapabilityIndexBegin( name, dep ),
- zypp_ptr()->pool().byCapabilityIndexEnd( name, dep ),
- zypp::functor::chain( zypp::resfilter::ByCaIUninstalled(),
- zypp::functor::chain( zypp::resfilter::ByCaITransact(),
- zypp::resfilter::ByCaIKind( zypp::ResTraitszypp::Package::kind ) ) ),
- zypp::functor::functorRef( match ) );
- }
- catch (...)
+ for_(iter, possibleProviders.begin(), possibleProviders.end())
{
+ zypp::PoolItem provider = zypp::ResPool::instance().find(*iter);
+
+ // is it installed?
+ if (provider.status().isToBeInstalled())
+ {
+ y2milestone("Tag %s provided by %s is selected to install", name.c_str(), provider->name().c_str());
+ return YCPBoolean(true);
+ }
}
- return YCPBoolean( match.item );
+ y2milestone("Tag %s is not selected to install", name.c_str());
+
+ return YCPBoolean(false);
}
// ------------------------
@@ -501,28 +507,29 @@
YCPValue
PkgFunctions::IsAvailable (const YCPString& tag)
{
- y2milestone("IsAvailable called");
std::string name = tag->value ();
if (name.empty())
return YCPBoolean (false);
- zypp::Dep dep( zypp::Dep::PROVIDES );
- CaIMatch match;
+ // look for packages
+ zypp::Capability cap(name, zypp::ResKind::package);
+ zypp::sat::WhatProvides possibleProviders(cap);
- try
- {
- // look for uninstalled packages
- invokeOnEach( zypp_ptr()->pool().byCapabilityIndexBegin( name, dep ),
- zypp_ptr()->pool().byCapabilityIndexEnd( name, dep ),
- zypp::functor::chain( zypp::resfilter::ByCaIUninstalled(),
- zypp::resfilter::ByCaIKind( zypp::ResTraitszypp::Package::kind ) ),
- zypp::functor::functorRef( match ) );
- }
- catch (...)
+ for_(iter, possibleProviders.begin(), possibleProviders.end())
{
+ zypp::PoolItem provider = zypp::ResPool::instance().find(*iter);
+
+ // is it installed?
+ if (!provider.status().isInstalled())
+ {
+ y2milestone("Tag %s provided by %s is available to install", name.c_str(), provider->name().c_str());
+ return YCPBoolean(true);
+ }
}
- return YCPBoolean( match.item );
+ y2milestone("Tag %s is not available to install", name.c_str());
+
+ return YCPBoolean(false);
}
YCPValue
@@ -692,30 +699,27 @@
bool
PkgFunctions::DoRemoveNameKind( const std::string & name, zypp::Resolvable::Kind kind)
{
- zypp::Dep dep( zypp::Dep::PROVIDES );
- CaIMatch match;
+ zypp::Capability cap(name, kind);
+ zypp::sat::WhatProvides possibleProviders(cap);
- try
- {
- // look for installed packages
- invokeOnEach( zypp_ptr()->pool().byCapabilityIndexBegin( name, dep ),
- zypp_ptr()->pool().byCapabilityIndexEnd( name, dep ),
- zypp::functor::chain( zypp::resfilter::ByCaIInstalled(),
- zypp::resfilter::ByCaIKind( kind ) ),
- zypp::functor::functorRef( match ) );
- }
- catch (...)
+ bool ret = false;
+
+ for_(iter, possibleProviders.begin(), possibleProviders.end())
{
- return false;
- }
+ zypp::PoolItem provider = zypp::ResPool::instance().find(*iter);
- if (!match.item)
- return false;
+ // get instance status
+ bool installed = provider.status().isInstalled();
- bool result = match.item.status().setToBeUninstalled( whoWantsIt );
- y2milestone ("DoRemoveNameKind %s -> %s\n", name.c_str(), (result ? "Ok" : "Bad"));
+ if (installed)
+ {
+ bool result = provider.status().setToBeUninstalled(whoWantsIt);
+ y2milestone("DoRemoveNameKind %s -> %s\n", name.c_str(), (result ? "Ok" : "Bad"));
+ ret = true;
+ }
+ }
- return true;
+ return ret;
}
// ------------------------
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.16.15/src/PkgFunctions.h new/yast2-pkg-bindings-2.16.16/src/PkgFunctions.h
--- old/yast2-pkg-bindings-2.16.15/src/PkgFunctions.h 2008-02-15 15:07:09.000000000 +0100
+++ new/yast2-pkg-bindings-2.16.16/src/PkgFunctions.h 2008-03-05 09:09:04.000000000 +0100
@@ -95,6 +95,9 @@
// table for converting libzypp source type to Yast type (for backward compatibility)
std::map type_conversion_table;
+
+ // flag for skipping autorefresh
+ volatile bool autorefresh_skipped;
// conversion methods for type string between Yast and libzypp (for backward compatibility)
std::string zypp2yastType(const std::string &type);
@@ -134,6 +137,8 @@
const zypp::ProgressData::ReceiverFnc & progressrcv = zypp::ProgressData::ReceiverFnc());
zypp::repo::RepoType ProbeWithCallbacks(const zypp::Url &url);
void ScanProductsWithCallBacks(const zypp::Url &url);
+ void CallRefreshStarted();
+ void CallRefreshDone();
YCPValue SourceLoadImpl(PkgProgress &progress);
YCPValue SourceStartManagerImpl(const YCPBoolean& enable, PkgProgress &progress);
@@ -305,6 +310,11 @@
/* TYPEINFO: void(string) */
YCPValue CallbackProgressReportEnd(const YCPString& func);
+ /* TYPEINFO: void(string) */
+ YCPValue CallbackStartRefresh( const YCPString& func );
+ /* TYPEINFO: void(string) */
+ YCPValue CallbackDoneRefresh( const YCPString& func );
+
// Script (patch installation) callbacks
/* TYPEINFO: void(string) */
YCPValue CallbackScriptStart( const YCPString& args );
@@ -478,6 +488,8 @@
YCPValue RepositoryScan(const YCPString& url);
/* TYPEINFO: integer(map)*/
YCPValue RepositoryAdd(const YCPMap ¶ms);
+ /* TYPEINFO: void()*/
+ YCPValue SkipRefresh();
// target related
/* TYPEINFO: boolean(string,boolean)*/
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.16.15/src/Source_Load.cc new/yast2-pkg-bindings-2.16.16/src/Source_Load.cc
--- old/yast2-pkg-bindings-2.16.15/src/Source_Load.cc 2008-01-24 12:39:28.000000000 +0100
+++ new/yast2-pkg-bindings-2.16.16/src/Source_Load.cc 2008-03-05 15:56:02.000000000 +0100
@@ -19,7 +19,7 @@
*/
/*
- File: $Id: Source_Load.cc 43861 2008-01-24 11:39:28Z lslezak $
+ File: $Id: Source_Load.cc 45220 2008-03-05 14:56:02Z lslezak $
Author: Ladislav Slezák
Summary: Functions for initializing the package manager
Namespace: Pkg
@@ -125,6 +125,37 @@
return ret;
}
+void PkgFunctions::CallRefreshStarted()
+{
+ // get the YCP callback handler for destroy event
+ Y2Function* ycp_handler = _callbackHandler._ycpCallbacks.createCallback(CallbackHandler::YCPCallbacks::CB_StartSourceRefresh);
+
+ // is the callback registered?
+ if (ycp_handler != NULL)
+ {
+ // evaluate the callback function
+ ycp_handler->evaluateCall();
+ }
+}
+
+void PkgFunctions::CallRefreshDone()
+{
+ // get the YCP callback handler for destroy event
+ Y2Function* ycp_handler = _callbackHandler._ycpCallbacks.createCallback(CallbackHandler::YCPCallbacks::CB_DoneSourceRefresh);
+
+ // is the callback registered?
+ if (ycp_handler != NULL)
+ {
+ // evaluate the callback function
+ ycp_handler->evaluateCall();
+ }
+}
+
+YCPValue PkgFunctions::SkipRefresh()
+{
+ autorefresh_skipped = true;
+ return YCPVoid();
+}
/****************************************************************************************
* @builtin SourceLoad
@@ -140,16 +171,22 @@
bool success = true;
int repos_to_load = 0;
+ int repos_to_refresh = 0;
for (RepoCont::iterator it = repos.begin();
it != repos.end(); ++it)
{
if ((*it)->repoInfo().enabled() && !(*it)->isDeleted())
{
repos_to_load++;
+
+ if ((*it)->repoInfo().autorefresh())
+ {
+ repos_to_refresh++;
+ }
}
}
- y2debug("repos_to_load: %d", repos_to_load);
+ y2debug("repos_to_load: %d, repos_to_refresh: %d", repos_to_load, repos_to_refresh);
// set max. value (3 steps per repository - refresh, rebuild, load)
zypp::ProgressData prog_total(repos_to_load * 3 * 100);
@@ -158,46 +195,71 @@
zypp::RepoManager repomanager = CreateRepoManager();
- // refresh metadata
- for (RepoCont::iterator it = repos.begin();
- it != repos.end(); ++it)
+ autorefresh_skipped = false;
+ CallRefreshStarted();
+
+ if (repos_to_refresh > 0)
{
- // load resolvables only from enabled repos which are not deleted
- if ((*it)->repoInfo().enabled() && !(*it)->isDeleted())
+ // refresh metadata
+ for (RepoCont::iterator it = repos.begin();
+ it != repos.end(); ++it)
{
- // sub tasks
- zypp::CombinedProgressData refresh_subprogress(prog_total, 100);
- zypp::ProgressData prog(100);
- prog.sendTo(refresh_subprogress);
- y2debug("Progress status: %lld", prog_total.val());
-
- if (AnyResolvableFrom((*it)->repoInfo().alias()))
- {
- y2milestone("Resolvables from '%s' are already present, not loading", (*it)->repoInfo().alias().c_str());
- }
- else
+ // load resolvables only from enabled repos which are not deleted
+ if ((*it)->repoInfo().enabled() && !(*it)->isDeleted())
{
- // autorefresh the source
- if ((*it)->repoInfo().autorefresh())
+ // sub tasks
+ zypp::CombinedProgressData refresh_subprogress(prog_total, 100);
+ zypp::ProgressData prog(100);
+ prog.sendTo(refresh_subprogress);
+ y2debug("Progress status: %lld", prog_total.val());
+
+ if (AnyResolvableFrom((*it)->repoInfo().alias()))
{
- try
- {
- y2milestone("Autorefreshing source: %s", (*it)->repoInfo().alias().c_str());
- // refresh the repository
- RefreshWithCallbacks((*it)->repoInfo(), prog.receiver());
- }
- // NOTE: subtask progresses are reported as done in the descructor
- // no need to handle them in the exception code
- catch (const zypp::Exception& excpt)
+ y2milestone("Resolvables from '%s' are already present, not loading", (*it)->repoInfo().alias().c_str());
+ }
+ else
+ {
+ zypp::RepoStatus raw_metadata_status = repomanager.metadataStatus((*it)->repoInfo());
+
+ // autorefresh the source
+ if ((*it)->repoInfo().autorefresh() || raw_metadata_status.empty())
{
- y2error ("Error in SourceLoad: %s", excpt.asString().c_str());
- _last_error.setLastError(ExceptionAsString(excpt));
- success = false;
+ try
+ {
+ y2milestone("Autorefreshing source: %s", (*it)->repoInfo().alias().c_str());
+ // refresh the repository
+ RefreshWithCallbacks((*it)->repoInfo(), prog.receiver());
+ }
+ // NOTE: subtask progresses are reported as done in the destructor
+ // no need to handle them in the exception code
+ catch (const zypp::Exception& excpt)
+ {
+ if (autorefresh_skipped)
+ {
+ y2internal("autorefresh_skipped, ignoring the exception");
+ }
+ else
+ {
+ y2error ("Error in SourceLoad: %s", excpt.asString().c_str());
+ _last_error.setLastError(ExceptionAsString(excpt));
+ success = false;
+ }
+ }
+
+ if (autorefresh_skipped)
+ {
+ y2internal("Skipping autorefresh for the rest of repositories");
+ break;
+ }
+ else
+ {
+ y2internal("Continuing with autorefresh");
+ }
}
}
+ prog.toMax();
+ y2debug("Progress status: %lld", prog_total.val());
}
- prog.toMax();
- y2debug("Progress status: %lld", prog_total.val());
}
}
@@ -218,13 +280,25 @@
y2debug("Progress status: %lld", prog_total.val());
if (AnyResolvableFrom((*it)->repoInfo().alias()))
{
- y2milestone("Resolvables from '%s' are already present, not loading", (*it)->repoInfo().alias().c_str());
+ y2milestone("Resolvables from '%s' are already present, not rebuilding the cache", (*it)->repoInfo().alias().c_str());
}
else
{
// autorefresh the source
if ((*it)->repoInfo().autorefresh())
{
+ if (autorefresh_skipped)
+ {
+ zypp::RepoStatus raw_metadata_status = repomanager.metadataStatus((*it)->repoInfo());
+
+ // autorefresh the source
+ if (raw_metadata_status.empty() )
+ {
+ y2internal("Missinga metadata, not rebuilding the cache");
+ continue;
+ }
+ }
+
try
{
// rebuild cache (the default policy is "if needed")
@@ -237,9 +311,26 @@
// no need to handle them in the exception code
catch (const zypp::Exception& excpt)
{
- y2error ("Error in SourceLoad: %s", excpt.asString().c_str());
- _last_error.setLastError(ExceptionAsString(excpt));
- success = false;
+ if (autorefresh_skipped)
+ {
+ y2internal("autorefresh_skipped, ignoring the exception");
+ }
+ else
+ {
+ y2error ("Error in SourceLoad: %s", excpt.asString().c_str());
+ _last_error.setLastError(ExceptionAsString(excpt));
+ success = false;
+ }
+ }
+
+ if (autorefresh_skipped)
+ {
+ y2internal("Skipping autorefresh for the rest of repositories");
+ break;
+ }
+ else
+ {
+ y2internal("Continuing with autorefresh");
}
}
}
@@ -248,6 +339,8 @@
}
}
+ CallRefreshDone();
+
progress.NextStage();
for (RepoCont::iterator it = repos.begin();
@@ -277,6 +370,7 @@
// report 100%
prog_total.toMax();
+ autorefresh_skipped = false;
return YCPBoolean(success);
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.16.15/src/Source_Resolvables.cc new/yast2-pkg-bindings-2.16.16/src/Source_Resolvables.cc
--- old/yast2-pkg-bindings-2.16.15/src/Source_Resolvables.cc 2008-02-15 15:07:09.000000000 +0100
+++ new/yast2-pkg-bindings-2.16.16/src/Source_Resolvables.cc 2008-03-05 15:56:02.000000000 +0100
@@ -19,7 +19,7 @@
*/
/*
- File: $Id: Source_Resolvables.cc 44491 2008-02-15 10:46:16Z coolo $
+ File: $Id: Source_Resolvables.cc 45220 2008-03-05 14:56:02Z lslezak $
Author: Ladislav Slezák
Summary: Functions for adding/removing resolvables in the pool
Namespace: Pkg
@@ -85,13 +85,18 @@
zypp::RepoManager repomanager = CreateRepoManager();
// build cache if needed
- if (!repomanager.isCached(repoinfo))
+ if (!repomanager.isCached(repoinfo) && !autorefresh_skipped)
{
zypp::RepoStatus raw_metadata_status = repomanager.metadataStatus(repoinfo);
if (raw_metadata_status.empty())
{
y2milestone("Missing metadata for source '%s', downloading...", repoinfo.alias().c_str());
+
+ CallRefreshStarted();
+
RefreshWithCallbacks(repoinfo);
+
+ CallRefreshDone();
}
y2milestone("Caching source '%s'...", repoinfo.alias().c_str());
@@ -103,10 +108,17 @@
}
catch(const zypp::repo::RepoNotCachedException &excpt )
{
- std::string alias = repoinfo.alias();
- y2error ("Resolvables from '%s' havn't been loaded: %s", alias.c_str(), excpt.asString().c_str());
- _last_error.setLastError("'" + alias + "': " + ExceptionAsString(excpt));
- success = false;
+ if (!autorefresh_skipped)
+ {
+ std::string alias = repoinfo.alias();
+ y2error ("Resolvables from '%s' havn't been loaded: %s", alias.c_str(), excpt.asString().c_str());
+ _last_error.setLastError("'" + alias + "': " + ExceptionAsString(excpt));
+ success = false;
+ }
+ else
+ {
+ y2internal("Autorefresh disabled, the cache is missing -> cannot load resolvables");
+ }
// FIXME ??
/*
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.16.15/VERSION new/yast2-pkg-bindings-2.16.16/VERSION
--- old/yast2-pkg-bindings-2.16.15/VERSION 2008-02-27 09:04:08.000000000 +0100
+++ new/yast2-pkg-bindings-2.16.16/VERSION 2008-03-05 17:28:24.000000000 +0100
@@ -1 +1 @@
-2.16.15
+2.16.16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org