Hello community,
here is the log from the commit of package yast2-pkg-bindings
checked in at Fri Aug 3 16:09:16 CEST 2007.
--------
--- yast2-pkg-bindings/yast2-pkg-bindings.changes 2007-07-31 10:43:52.000000000 +0200
+++ /mounts/work_src_done/STABLE/yast2-pkg-bindings/yast2-pkg-bindings.changes 2007-08-03 12:31:44.924046000 +0200
@@ -1,0 +2,40 @@
+Fri Aug 3 11:00:23 CEST 2007 - lslezak@suse.cz
+
+- added product directory support
+- Pkg::ResolvableProperties() returns license and status if
+ available
+- fixed id of undefined repository (-1 returned as unsigned)
+- 2.15.40
+
+-------------------------------------------------------------------
+Thu Aug 2 09:56:21 CEST 2007 - lslezak@suse.cz
+
+- added Pkg::CallbackInitDownload() and Pkg::CallbackDestDownload()
+ for registering the initial and the final even when downloading
+ a file (to leave the progress popup open and avoid flashing)
+- call the new callbacks when scanning, probing, refreshing
+ and downloading a file or directory
+- Pkg::SourceSaveAll() - remove also raw metadata cache for the
+ removed repositories
+- ignore errors in the download callback when probing or scanning
+ a repository (the downloaded files are optional)
+- Pkg::SourceProvideDir() - return the correct value
+- 2.15.39
+
+-------------------------------------------------------------------
+Wed Aug 1 10:14:28 CEST 2007 - lslezak@suse.cz
+
+- Pkg::SourceProvideDir() is non-recursive now (backward comaptible
+ behavior)
+- added Pkg::SourceProvideDirectory() -- optional and/or recursive
+ directory download from a repository (required for FATE #302018)
+- internal support for Pkg functions with 5 arguments
+- 2.15.38
+
+-------------------------------------------------------------------
+Tue Jul 31 15:49:30 CEST 2007 - lslezak@suse.cz
+
+- Pkg::SourceChangeUrl() adapted to the latest libzypp
+- implemented Pkg::SourceMoveDownloadArea()
+
+-------------------------------------------------------------------
Old:
----
yast2-pkg-bindings-2.15.37.tar.bz2
New:
----
yast2-pkg-bindings-2.15.40.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-pkg-bindings-devel-doc.spec ++++++
--- /var/tmp/diff_new_pack.V26329/_old 2007-08-03 16:08:47.000000000 +0200
+++ /var/tmp/diff_new_pack.V26329/_new 2007-08-03 16:08:47.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-pkg-bindings-devel-doc (Version 2.15.37)
+# spec file for package yast2-pkg-bindings-devel-doc (Version 2.15.40)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -11,12 +11,12 @@
# norootforbuild
Name: yast2-pkg-bindings-devel-doc
-Version: 2.15.37
+Version: 2.15.40
Release: 1
License: GPL v2 or later
Group: Documentation/HTML
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-pkg-bindings-2.15.37.tar.bz2
+Source0: yast2-pkg-bindings-2.15.40.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
@@ -37,7 +37,7 @@
Ladislav Slez�k
%prep
-%setup -n yast2-pkg-bindings-2.15.37
+%setup -n yast2-pkg-bindings-2.15.40
# build only documentation, ignore all other directories
echo "doc" > SUBDIRS
++++++ yast2-pkg-bindings.spec ++++++
--- /var/tmp/diff_new_pack.V26329/_old 2007-08-03 16:08:47.000000000 +0200
+++ /var/tmp/diff_new_pack.V26329/_new 2007-08-03 16:08:47.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-pkg-bindings (Version 2.15.37)
+# spec file for package yast2-pkg-bindings (Version 2.15.40)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -11,19 +11,19 @@
# norootforbuild
Name: yast2-pkg-bindings
-Version: 2.15.37
+Version: 2.15.40
Release: 1
License: GPL v2 or later
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-pkg-bindings-2.15.37.tar.bz2
+Source0: yast2-pkg-bindings-2.15.40.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 >= 3.11.8
BuildRequires: libzypp >= 3.11.8
# new API (RepoManager instead of SourceManager)
Requires: libzypp >= 3.11.8
-Summary: YaST2 Package Manager Access
+Summary: YaST2 - Package Manager Access
%description
This package contains a name space for accessing the package manager
@@ -40,7 +40,7 @@
Stanislav Visnovsky
%prep
-%setup -n yast2-pkg-bindings-2.15.37
+%setup -n yast2-pkg-bindings-2.15.40
# build only the library, ignore documentation (it is in devel-doc package)
echo "src" > SUBDIRS
@@ -73,6 +73,34 @@
%doc %{prefix}/share/doc/packages/yast2-pkg-bindings
%changelog
+* Fri Aug 03 2007 - lslezak@suse.cz
+- added product directory support
+- Pkg::ResolvableProperties() returns license and status if
+ available
+- fixed id of undefined repository (-1 returned as unsigned)
+- 2.15.40
+* Thu Aug 02 2007 - lslezak@suse.cz
+- added Pkg::CallbackInitDownload() and Pkg::CallbackDestDownload()
+ for registering the initial and the final even when downloading
+ a file (to leave the progress popup open and avoid flashing)
+- call the new callbacks when scanning, probing, refreshing
+ and downloading a file or directory
+- Pkg::SourceSaveAll() - remove also raw metadata cache for the
+ removed repositories
+- ignore errors in the download callback when probing or scanning
+ a repository (the downloaded files are optional)
+- Pkg::SourceProvideDir() - return the correct value
+- 2.15.39
+* Wed Aug 01 2007 - lslezak@suse.cz
+- Pkg::SourceProvideDir() is non-recursive now (backward comaptible
+ behavior)
+- added Pkg::SourceProvideDirectory() -- optional and/or recursive
+ directory download from a repository (required for FATE #302018)
+- internal support for Pkg functions with 5 arguments
+- 2.15.38
+* Tue Jul 31 2007 - lslezak@suse.cz
+- Pkg::SourceChangeUrl() adapted to the latest libzypp
+- implemented Pkg::SourceMoveDownloadArea()
* Tue Jul 31 2007 - lslezak@suse.cz
- Pkg::SourceGetCurrent() - return correct IDs (fixed nasty off
by one bug) (#295901)
++++++ yast2-pkg-bindings-2.15.37.tar.bz2 -> yast2-pkg-bindings-2.15.40.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.37/configure new/yast2-pkg-bindings-2.15.40/configure
--- old/yast2-pkg-bindings-2.15.37/configure 2007-07-31 10:42:52.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.40/configure 2007-08-03 11:37:20.000000000 +0200
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.60 for yast2-pkg-bindings 2.15.37.
+# Generated by GNU Autoconf 2.60 for yast2-pkg-bindings 2.15.40.
#
# Report bugs to http://bugs.opensuse.org/.
#
@@ -713,8 +713,8 @@
# Identity of this package.
PACKAGE_NAME='yast2-pkg-bindings'
PACKAGE_TARNAME='yast2-pkg-bindings'
-PACKAGE_VERSION='2.15.37'
-PACKAGE_STRING='yast2-pkg-bindings 2.15.37'
+PACKAGE_VERSION='2.15.40'
+PACKAGE_STRING='yast2-pkg-bindings 2.15.40'
PACKAGE_BUGREPORT='http://bugs.opensuse.org/'
ac_unique_file="RPMNAME"
@@ -1429,7 +1429,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.15.37 to adapt to many kinds of systems.
+\`configure' configures yast2-pkg-bindings 2.15.40 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1500,7 +1500,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of yast2-pkg-bindings 2.15.37:";;
+ short | recursive ) echo "Configuration of yast2-pkg-bindings 2.15.40:";;
esac
cat <<\_ACEOF
@@ -1608,7 +1608,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-yast2-pkg-bindings configure 2.15.37
+yast2-pkg-bindings configure 2.15.40
generated by GNU Autoconf 2.60
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1622,7 +1622,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.15.37, which was
+It was created by yast2-pkg-bindings $as_me 2.15.40, which was
generated by GNU Autoconf 2.60. Invocation command line was
$ $0 $@
@@ -2423,7 +2423,7 @@
# Define the identity of the package.
PACKAGE='yast2-pkg-bindings'
- VERSION='2.15.37'
+ VERSION='2.15.40'
cat >>confdefs.h <<_ACEOF
@@ -2650,7 +2650,7 @@
-VERSION="2.15.37"
+VERSION="2.15.40"
RPMNAME="yast2-pkg-bindings"
MAINTAINER="Ladislav Slezák "
@@ -21612,7 +21612,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.15.37, which was
+This file was extended by yast2-pkg-bindings $as_me 2.15.40, which was
generated by GNU Autoconf 2.60. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -21665,7 +21665,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-yast2-pkg-bindings config.status 2.15.37
+yast2-pkg-bindings config.status 2.15.40
configured by $0, generated by GNU Autoconf 2.60,
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.15.37/configure.in new/yast2-pkg-bindings-2.15.40/configure.in
--- old/yast2-pkg-bindings-2.15.37/configure.in 2007-07-31 10:42:40.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.40/configure.in 2007-08-03 11:37:06.000000000 +0200
@@ -3,7 +3,7 @@
dnl -- This file is generated by y2autoconf 2.14.0 - DO NOT EDIT! --
dnl (edit configure.in.in instead)
-AC_INIT(yast2-pkg-bindings, 2.15.37, http://bugs.opensuse.org/, yast2-pkg-bindings)
+AC_INIT(yast2-pkg-bindings, 2.15.40, http://bugs.opensuse.org/, yast2-pkg-bindings)
dnl Check for presence of file 'RPMNAME'
AC_CONFIG_SRCDIR([RPMNAME])
@@ -17,7 +17,7 @@
AM_INIT_AUTOMAKE(tar-ustar) dnl searches for some needed programs
dnl Important YaST2 variables
-VERSION="2.15.37"
+VERSION="2.15.40"
RPMNAME="yast2-pkg-bindings"
MAINTAINER="Ladislav Slezák "
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.37/src/Callbacks.cc new/yast2-pkg-bindings-2.15.40/src/Callbacks.cc
--- old/yast2-pkg-bindings-2.15.37/src/Callbacks.cc 2007-07-27 11:15:23.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.40/src/Callbacks.cc 2007-08-03 09:51:58.000000000 +0200
@@ -513,7 +513,7 @@
size = pkg->downloadSize();
// convert the repo ID
- int source_id = _pkg_ref.logFindAlias(pkg->repository().info().alias());
+ long long source_id = _pkg_ref.logFindAlias(pkg->repository().info().alias());
int media_nr = pkg->mediaNr();
if( source_id != last_source_id || media_nr != last_source_media )
@@ -822,8 +822,17 @@
{
CB callback( ycpcb( YCPCallbacks::CB_DoneDownload ) );
+ zypp::media::DownloadProgressReport::Error err = error;
+
+ // ignore errors for optional files
+ if ( _silent_probing == MEDIA_CHANGE_DISABLE ||
+ _silent_probing == MEDIA_CHANGE_OPTIONALFILE)
+ {
+ err = zypp::media::DownloadProgressReport::NO_ERROR;
+ }
+
if ( callback._set ) {
- callback.addInt( error );
+ callback.addInt( err );
callback.addStr( reason );
callback.evaluate();
}
@@ -2528,4 +2537,11 @@
return SET_YCP_CB( CB_ProgressDone, func );
}
+YCPValue PkgModuleFunctions::CallbackInitDownload( const YCPString& args ) {
+ return SET_YCP_CB( CB_InitDownload, args );
+}
+
+YCPValue PkgModuleFunctions::CallbackDestDownload( const YCPString& args ) {
+ return SET_YCP_CB( CB_DestDownload, args );
+}
#undef SET_YCP_CB
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.37/src/Callbacks.YCP.h new/yast2-pkg-bindings-2.15.40/src/Callbacks.YCP.h
--- old/yast2-pkg-bindings-2.15.37/src/Callbacks.YCP.h 2007-07-16 13:05:36.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.40/src/Callbacks.YCP.h 2007-08-01 14:31:44.000000000 +0200
@@ -82,7 +82,7 @@
CB_StartDeltaApply, CB_ProgressDeltaApply, CB_ProblemDeltaApply,
CB_StartPatchDownload, CB_ProgressPatchDownload, CB_ProblemPatchDownload,
CB_FinishDeltaDownload, CB_FinishDeltaApply, CB_FinishPatchDownload,
- CB_StartDownload, CB_ProgressDownload, CB_DoneDownload,
+ CB_StartDownload, CB_ProgressDownload, CB_DoneDownload, CB_InitDownload, CB_DestDownload,
CB_SourceProbeStart, CB_SourceProbeFailed, CB_SourceProbeSucceeded, CB_SourceProbeEnd, CB_SourceProbeProgress, CB_SourceProbeError,
CB_SourceReportStart, CB_SourceReportProgress, CB_SourceReportError, CB_SourceReportEnd, CB_SourceReportInit, CB_SourceReportDestroy,
@@ -136,6 +136,8 @@
ENUM_OUT( StartDownload );
ENUM_OUT( ProgressDownload );
ENUM_OUT( DoneDownload );
+ ENUM_OUT( InitDownload );
+ ENUM_OUT( DestDownload );
ENUM_OUT( ScriptStart );
ENUM_OUT( ScriptProgress );
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.37/src/Package.cc new/yast2-pkg-bindings-2.15.40/src/Package.cc
--- old/yast2-pkg-bindings-2.15.37/src/Package.cc 2007-07-25 16:23:31.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.40/src/Package.cc 2007-08-03 09:54:18.000000000 +0200
@@ -1003,8 +1003,8 @@
data->add( YCPString("arch"), YCPString( pkg->arch().asString() ) );
data->add( YCPString("medianr"), YCPInteger( pkg->mediaNr() ) );
- std::vector::size_type sid = logFindAlias(pkg->repository().info().alias());
- y2debug("srcId: %d", sid );
+ long long sid = logFindAlias(pkg->repository().info().alias());
+ y2debug("srcId: %lld", sid );
data->add( YCPString("srcid"), YCPInteger( sid ) );
std::string status("available");
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.37/src/PkgModuleFunctions.cc new/yast2-pkg-bindings-2.15.40/src/PkgModuleFunctions.cc
--- old/yast2-pkg-bindings-2.15.37/src/PkgModuleFunctions.cc 2007-07-26 09:34:12.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.40/src/PkgModuleFunctions.cc 2007-07-31 16:20:03.000000000 +0200
@@ -56,6 +56,7 @@
YCPValue m_param2;
YCPValue m_param3;
YCPValue m_param4;
+ YCPValue m_param5;
string m_name;
public:
@@ -77,6 +78,7 @@
, m_param2 ( YCPNull () )
, m_param3 ( YCPNull () )
, m_param4 ( YCPNull () )
+ , m_param5 ( YCPNull () )
, m_name (name)
{
};
@@ -89,6 +91,7 @@
case 1: m_param2 = arg; break;
case 2: m_param3 = arg; break;
case 3: m_param4 = arg; break;
+ case 4: m_param5 = arg; break;
default: return false;
}
@@ -120,7 +123,12 @@
m_param4 = arg;
return true;
}
- y2internal ("appendParameter > 3 not implemented");
+ else if (m_param5.isNull ())
+ {
+ m_param5 = arg;
+ return true;
+ }
+ y2internal ("appendParameter > 5 not implemented");
return false;
}
@@ -158,6 +166,7 @@
m_param2 = YCPNull ();
m_param3 = YCPNull ();
m_param4 = YCPNull ();
+ m_param5 = YCPNull ();
return true;
}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.37/src/PkgModuleFunctions.h new/yast2-pkg-bindings-2.15.40/src/PkgModuleFunctions.h
--- old/yast2-pkg-bindings-2.15.37/src/PkgModuleFunctions.h 2007-07-23 09:09:07.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.40/src/PkgModuleFunctions.h 2007-08-03 09:49:43.000000000 +0200
@@ -162,6 +162,12 @@
void CallSourceReportInit();
void CallSourceReportDestroy();
+ void CallInitDownload(const std::string &task);
+ void CallDestDownload();
+ void RefreshWithCallbacks(const zypp::RepoInfo &repo);
+ zypp::repo::RepoType ProbeWithCallbacks(const zypp::Url &url);
+ void ScanProductsWithCallBacks(const zypp::Url &url);
+
// After all, APPL_HIGH might be more appropriate, because we suggest
// the user what he should do and if it does not work, it's his job to
// fix it (using USER). --ma
@@ -270,6 +276,10 @@
YCPValue CallbackProgressDownload (const YCPString& func);
/* TYPEINFO: void(string) */
YCPValue CallbackDoneDownload (const YCPString& func);
+ /* TYPEINFO: void(string) */
+ YCPValue CallbackInitDownload( const YCPString& args );
+ /* TYPEINFO: void(string) */
+ YCPValue CallbackDestDownload( const YCPString& args );
/* TYPEINFO: void(string) */
YCPValue CallbackSourceCreateStart( const YCPString& func);
@@ -441,6 +451,8 @@
YCPValue SourceProvideOptionalFile (const YCPInteger&, const YCPInteger&, const YCPString&);
/* TYPEINFO: string(integer,integer,string)*/
YCPValue SourceProvideDir (const YCPInteger&, const YCPInteger&, const YCPString&);
+ /* TYPEINFO: string(integer,integer,string,boolean,boolean)*/
+ YCPValue SourceProvideDirectory(const YCPInteger& id, const YCPInteger& mid, const YCPString& d, const YCPBoolean &optional, const YCPBoolean &recursive);
/* TYPEINFO: boolean(string)*/
YCPValue SourceCacheCopyTo (const YCPString&);
/* TYPEINFO: boolean(boolean)*/
@@ -705,7 +717,7 @@
virtual ~PkgModuleFunctions ();
// must be public, used in callbacks
- std::vector::size_type logFindAlias(const std::string &alias) const;
+ long long logFindAlias(const std::string &alias) const;
virtual const string name () const
{
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.37/src/Resolvable.cc new/yast2-pkg-bindings-2.15.40/src/Resolvable.cc
--- old/yast2-pkg-bindings-2.15.37/src/Resolvable.cc 2007-07-16 13:05:36.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.40/src/Resolvable.cc 2007-08-03 10:49:29.000000000 +0200
@@ -405,6 +405,14 @@
zypp::Repository repo = (*it)->repository();
info->add(YCPString("source"), YCPInteger(logFindAlias(repo.info().alias())));
+ // add license info if it is defined
+ std::string license = (*it)->licenseToConfirm();
+ if (!license.empty())
+ {
+ info->add(YCPString("license_confirmed"), YCPBoolean(it->status().isLicenceConfirmed()));
+ info->add(YCPString("license"), YCPString(license));
+ }
+
// product specific info
if( req_kind == "product" ) {
zypp::Product::constPtr product = boost::dynamic_pointer_cast<const zypp::Product>(it->resolvable());
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.37/src/Source.cc new/yast2-pkg-bindings-2.15.40/src/Source.cc
--- old/yast2-pkg-bindings-2.15.37/src/Source.cc 2007-07-31 10:23:48.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.40/src/Source.cc 2007-08-03 09:50:33.000000000 +0200
@@ -54,15 +54,46 @@
Textdomain "pkg-bindings"
*/
-zypp::MediaProductSet scanProducts(const zypp::Url &url)
+// scanned available products
+// hack: zypp/MediaProducts.h cannot be included in PkgModuleFunctions.h
+zypp::MediaProductSet available_products;
+
+// this method should be used instead of zypp::productsInMedia()
+// it initializes the download callbacks
+void PkgModuleFunctions::ScanProductsWithCallBacks(const zypp::Url &url)
{
- // scan available products
- zypp::MediaProductSet products;
+ CallInitDownload(std::string(_("Scanning products in ") + url.asString()));
+
+ extern ZyppRecipients::MediaChangeSensitivity _silent_probing;
+ // remember the current value
+ ZyppRecipients::MediaChangeSensitivity _silent_probing_old = _silent_probing;
+
+ // disable media change callback for optional file
+ _silent_probing = ZyppRecipients::MEDIA_CHANGE_DISABLE;
y2milestone("Scanning products in %s ...", url.asString().c_str());
- zypp::productsInMedia(url, products);
- return products;
+ try
+ {
+ available_products.clear();
+ zypp::productsInMedia(url, available_products);
+ }
+ catch(...)
+ {
+ // call the final event even in case of exception
+ CallDestDownload();
+
+ // restore the probing flag
+ _silent_probing = _silent_probing_old;
+
+ // rethrow the execption
+ throw;
+ }
+
+ CallDestDownload();
+
+ // restore the probing flag
+ _silent_probing = _silent_probing_old;
}
void PkgModuleFunctions::CallSourceReportStart(const std::string &text)
@@ -127,6 +158,94 @@
}
}
+void PkgModuleFunctions::CallInitDownload(const std::string &task)
+{
+ // get the YCP callback handler for destroy event
+ Y2Function* ycp_handler = _callbackHandler._ycpCallbacks.createCallback(CallbackHandler::YCPCallbacks::CB_InitDownload);
+
+ // is the callback registered?
+ if (ycp_handler != NULL)
+ {
+ ycp_handler->appendParameter(YCPString(task));
+ // evaluate the callback function
+ ycp_handler->evaluateCall();
+ }
+}
+
+void PkgModuleFunctions::CallDestDownload()
+{
+ // get the YCP callback handler for destroy event
+ Y2Function* ycp_handler = _callbackHandler._ycpCallbacks.createCallback(CallbackHandler::YCPCallbacks::CB_DestDownload);
+
+ // is the callback registered?
+ if (ycp_handler != NULL)
+ {
+ // evaluate the callback function
+ ycp_handler->evaluateCall();
+ }
+}
+
+// this method should be used instead of RepoManager::refreshMetadata()
+void PkgModuleFunctions::RefreshWithCallbacks(const zypp::RepoInfo &repo)
+{
+ CallInitDownload(std::string(_("Refreshing repository ") + repo.alias()));
+
+ try
+ {
+ zypp::RepoManager repomanager = CreateRepoManager();
+ repomanager.refreshMetadata(repo);
+ }
+ catch(...)
+ {
+ // call the final event even in case of exception
+ CallDestDownload();
+ // rethrow the execption
+ throw;
+ }
+
+ CallDestDownload();
+}
+
+// this method should be used instead of RepoManager::probe()
+zypp::repo::RepoType PkgModuleFunctions::ProbeWithCallbacks(const zypp::Url &url)
+{
+ CallInitDownload(std::string(_("Probing repository ") + url.asString()));
+
+ zypp::repo::RepoType repotype;
+
+ extern ZyppRecipients::MediaChangeSensitivity _silent_probing;
+ // remember the current value
+ ZyppRecipients::MediaChangeSensitivity _silent_probing_old = _silent_probing;
+
+ // disable media change callback for optional file
+ _silent_probing = ZyppRecipients::MEDIA_CHANGE_DISABLE;
+
+ try
+ {
+ // probe type of the repository
+ zypp::RepoManager repomanager = CreateRepoManager();
+ repotype = repomanager.probe(url);
+ }
+ catch(...)
+ {
+ // call the final event even in case of exception
+ CallDestDownload();
+
+ // restore the probing flag
+ _silent_probing = _silent_probing_old;
+
+ // rethrow the execption
+ throw;
+ }
+
+ CallDestDownload();
+
+ // restore the probing flag
+ _silent_probing = _silent_probing_old;
+
+ return repotype;
+}
+
/**
* Logging helper:
* call zypp::SourceManager::sourceManager()->findSource
@@ -167,7 +286,7 @@
return YRepo_Ptr();
}
-std::vector::size_type PkgModuleFunctions::logFindAlias(const std::string &alias) const
+long long PkgModuleFunctions::logFindAlias(const std::string &alias) const
{
std::vector::size_type index = 0;
@@ -177,7 +296,7 @@
return index;
}
- return -1;
+ return -1LL;
}
bool PkgModuleFunctions::aliasExists(const std::string &alias) const
@@ -289,15 +408,25 @@
// autorefresh the source
if ((*it)->repoInfo().autorefresh())
{
- y2milestone("Autorefreshing source: %s", (*it)->repoInfo().alias().c_str());
- repomanager.refreshMetadata((*it)->repoInfo());
+ try
+ {
+ y2milestone("Autorefreshing source: %s", (*it)->repoInfo().alias().c_str());
+ RefreshWithCallbacks((*it)->repoInfo());
- // rebuild cache (the default policy is "if needed")
- y2milestone("Rebuilding cache for '%s'...", (*it)->repoInfo().alias().c_str());
- repomanager.buildCache((*it)->repoInfo());
+ // rebuild cache (the default policy is "if needed")
+ y2milestone("Rebuilding cache for '%s'...", (*it)->repoInfo().alias().c_str());
+ repomanager.buildCache((*it)->repoInfo());
+ }
+ catch (const zypp::Exception& excpt)
+ {
+ // FIXME: assuming the sources are already initialized
+ y2error ("Error in SourceLoad: %s", excpt.asString().c_str());
+ _last_error.setLastError(excpt.asUserString());
+ success = false;
+ }
}
- success = LoadResolvablesFrom((*it)->repoInfo());
+ success = success && LoadResolvablesFrom((*it)->repoInfo());
}
}
@@ -493,21 +622,31 @@
if ((*it)->isDeleted())
{
std::string repo_alias = (*it)->repoInfo().alias();
- // remove the cache
- if (repomanager.isCached((*it)->repoInfo()))
- {
- y2milestone("Removing cache for '%s'...", repo_alias.c_str());
- repomanager.cleanCache((*it)->repoInfo());
- }
try
{
+ // remove the metadata
+ zypp::RepoStatus raw_metadata_status = repomanager.metadataStatus((*it)->repoInfo());
+ if (!raw_metadata_status.empty())
+ {
+ y2milestone("Removing metadata for source '%s'...", repo_alias.c_str());
+ repomanager.cleanMetadata((*it)->repoInfo());
+ }
+
+ // remove the cache
+ if (repomanager.isCached((*it)->repoInfo()))
+ {
+ y2milestone("Removing cache for '%s'...", repo_alias.c_str());
+ repomanager.cleanCache((*it)->repoInfo());
+ }
+
repomanager.getRepositoryInfo(repo_alias);
y2milestone("Removing repository '%s'", repo_alias.c_str());
repomanager.removeRepository((*it)->repoInfo());
}
catch (const zypp::repo::RepoNotFoundException &ex)
{
+ // repository not found -- not critical, continue
y2warning("No such repository: %s", repo_alias.c_str());
}
catch (const zypp::Exception & excpt)
@@ -651,9 +790,7 @@
data->add( YCPString("enabled"), YCPBoolean(repo->repoInfo().enabled()));
data->add( YCPString("autorefresh"), YCPBoolean(repo->repoInfo().autorefresh()));
data->add( YCPString("type"), YCPString(srctype));
-#warning FIXME: "product_dir" is always "/"
-// data->add( YCPString("product_dir"), YCPString(repo->path().asString()));
- data->add( YCPString("product_dir"), YCPString("/"));
+ data->add( YCPString("product_dir"), YCPString(repo->repoInfo().path().asString()));
// check if there is an URL
if (repo->repoInfo().baseUrlsBegin() != repo->repoInfo().baseUrlsEnd())
@@ -859,8 +996,7 @@
const YCPString& f,
const YCPBoolean & optional)
{
- CallSourceReportInit();
- CallSourceReportStart(_("Downloading file..."));
+ CallInitDownload(std::string(_("Downloading ") + f->value()));
bool found = true;
YRepo_Ptr repo = logFindRepository(id->value());
@@ -898,8 +1034,7 @@
// set the original probing value
_silent_probing = _silent_probing_old;
- CallSourceReportEnd(_("Downloading file..."));
- CallSourceReportDestroy();
+ CallDestDownload();
if (found)
{
@@ -966,6 +1101,31 @@
YCPValue
PkgModuleFunctions::SourceProvideDir (const YCPInteger& id, const YCPInteger& mid, const YCPString& d)
{
+ y2warning("Pkg::SourceProvideDir() is obsoleted use Pkg::SourceProvideDirectory() instead");
+ // non optional, non recursive
+ return SourceProvideDirectory(id, mid, d, false, false);
+}
+
+
+/****************************************************************************************
+ * @builtin SourceProvideDirectory
+ * @short make a directory available at the local filesystem
+ * @description
+ * Download a directory from repository (make it available at the local filesystem) and
+ * all the files within it.
+ *
+ * @param integer id repository to use (id)
+ * @param integer mid Number of the media where the directory is located on ('1' for the 1st media).
+ * @param string d Directory name relative to the media root.
+ * @param boolean optional set to true if the directory may not exist (do not report errors)
+ * @param boolean recursive set to true to provide all subdirectories recursively
+ * @return string local path as string or nil when an error occured
+ */
+YCPValue
+PkgModuleFunctions::SourceProvideDirectory(const YCPInteger& id, const YCPInteger& mid, const YCPString& d, const YCPBoolean &optional, const YCPBoolean &recursive)
+{
+ CallInitDownload(std::string(_("Downloading ") + d->value()));
+
bool found = true;
YRepo_Ptr repo = logFindRepository(id->value());
if (!repo)
@@ -973,11 +1133,19 @@
zypp::filesystem::Pathname path; // FIXME user ManagedMedia
+ extern ZyppRecipients::MediaChangeSensitivity _silent_probing;
+ // remember the current value
+ ZyppRecipients::MediaChangeSensitivity _silent_probing_old = _silent_probing;
+
+ // disable media change callback for optional file
+ if (optional->value())
+ _silent_probing = ZyppRecipients::MEDIA_CHANGE_OPTIONALFILE;
+
if (found)
{
try
{
- path = repo->mediaAccess()->provideDir(d->value(), true, mid->value());
+ path = repo->mediaAccess()->provideDir(d->value(), recursive->value(), mid->value());
}
catch (const zypp::Exception& excpt)
{
@@ -987,6 +1155,11 @@
}
}
+ // set the original probing value
+ _silent_probing = _silent_probing_old;
+
+ CallDestDownload();
+
if (found)
{
return YCPString(path.asString());
@@ -1019,10 +1192,7 @@
if (repo->repoInfo().baseUrlsSize() > 1)
{
// store current urls
- std::setzypp::Url baseUrls;
- for (std::setzypp::Url::const_iterator i = repo->repoInfo().baseUrlsBegin();
- i != repo->repoInfo().baseUrlsEnd(); ++i)
- baseUrls.insert(*i);
+ std::setzypp::Url baseUrls (repo->repoInfo().baseUrlsBegin(), repo->repoInfo().baseUrlsEnd());
// reset url list and store the new one there
repo->repoInfo().setBaseUrl(zypp::Url(u->value()));
@@ -1159,7 +1329,7 @@
unsigned int id = 0;
while(aliasExists(ret))
{
- y2milestone("Alias %s already found: %d", ret.c_str(), logFindAlias(ret));
+ y2milestone("Alias %s already found: %lld", ret.c_str(), logFindAlias(ret));
// the alias already exists - add a counter
std::ostringstream ostr;
@@ -1193,18 +1363,7 @@
std::string alias = removeAlias(url_r, url);
y2milestone("Alias from URL: '%s'", alias.c_str());
-#warning FIXME: use base_source (base_source vs. addon)
-#warning FIXME: use path_r (product directory)
-/*
- FIXME: add the product dir to the URL?
- std::string prod_dir = path_r.asString();
- if (!prod_dir.empty() && prod_dir != "/")
- {
- y2milestone("Using product directory: %s", prod_dir.c_str());
- std::string path = url.getPathName();
- path = path + "/"
- }
-*/
+#warning FIXME: use base_source (base_source vs. addon) (will be probably not needed)
// repository type
zypp::repo::RepoType repotype;
@@ -1230,7 +1389,7 @@
y2milestone("Probing source type: '%s'", url.asString().c_str());
// autoprobe type of the repository
- repotype = repomanager.probe(url);
+ repotype = ProbeWithCallbacks(url);
}
y2milestone("Using source type: %s", repotype.asString().c_str());
@@ -1260,12 +1419,13 @@
repo.setName(name);
repo.setType(repotype);
repo.addBaseUrl(url);
+ repo.setPath(path_r);
repo.setEnabled(true);
repo.setAutorefresh(true);
y2milestone("Adding source '%s' (%s)", repo.alias().c_str(), url.asString().c_str());
// note: exceptions should be caught by the calling code
- repomanager.refreshMetadata(repo);
+ RefreshWithCallbacks(repo);
// build cache if needed
if (!repomanager.isCached(repo))
@@ -1430,7 +1590,7 @@
if (!params->value( YCPString("prod_dir") ).isNull() && params->value(YCPString("prod_dir"))->isString())
{
- #warning FIXME TODO: add product directory support
+ repo.setPath(params->value(YCPString("prod_dir"))->asString()->value());
}
repos.push_back(new YRepo(repo));
@@ -1505,7 +1665,8 @@
try
{
y2milestone("Scanning products in %s ...", url.asString().c_str());
- zypp::productsInMedia(url, products);
+ ScanProductsWithCallBacks(url);
+ products = available_products;
}
catch ( const zypp::Exception& excpt)
{
@@ -1623,7 +1784,7 @@
{
y2error ("Invalid URL: %s", expt.asString().c_str());
_last_error.setLastError(expt.asUserString());
- return YCPInteger (-1);
+ return YCPInteger (-1LL);
}
@@ -1637,7 +1798,8 @@
zypp::MediaProductSet products;
try {
- products = scanProducts(url);
+ ScanProductsWithCallBacks(url);
+ products = available_products;
}
catch ( const zypp::Exception& excpt)
{
@@ -1672,7 +1834,7 @@
y2error("SourceCreate for '%s' product '%s' has failed"
, url.asString().c_str(), pn.asString().c_str());
_last_error.setLastError(excpt.asUserString());
- return YCPInteger(-1);
+ return YCPInteger(-1LL);
}
}
} else {
@@ -1812,7 +1974,7 @@
{
zypp::RepoManager repomanager = CreateRepoManager();
y2milestone("Refreshing metadata '%s'", repo->repoInfo().alias().c_str());
- repomanager.refreshMetadata(repo->repoInfo());
+ RefreshWithCallbacks(repo->repoInfo());
y2milestone("Caching source '%s'...", repo->repoInfo().alias().c_str());
repomanager.buildCache(repo->repoInfo());
@@ -2083,23 +2245,21 @@
YCPValue
PkgModuleFunctions::SourceMoveDownloadArea (const YCPString & path)
{
-#warning SourceMoveDownloadArea is NOT implemented
-// TODO FIXME
- /*
try
{
- y2milestone( "Moving download area of all sources to %s", path->value().c_str()) ;
- zypp::SourceManager::sourceManager()->reattachSources (path->value());
+ y2milestone("Moving download area of all sources to %s", path->value().c_str());
+ zypp::media::MediaManager manager;
+ manager.setAttachPrefix(path->value());
}
catch (zypp::Exception & excpt)
{
_last_error.setLastError(excpt.asUserString());
- y2error("Pkg::SourceMoveDownloadArea has failed: %s", excpt.msg().c_str() );
+ y2error("Pkg::SourceMoveDownloadArea has failed: %s", excpt.msg().c_str());
return YCPBoolean(false);
}
y2milestone( "Download areas moved");
-*/
+
return YCPBoolean(true);
}
@@ -2164,7 +2324,7 @@
if (raw_metadata_status.empty())
{
y2milestone("Missing metadata for source '%s', downloading...", repoinfo.alias().c_str());
- repomanager.refreshMetadata(repoinfo);
+ RefreshWithCallbacks(repoinfo);
}
y2milestone("Caching source '%s'...", repoinfo.alias().c_str());
@@ -2220,7 +2380,7 @@
zypp::Url probe_url(url->value());
// autoprobe type of the repository
- zypp::repo::RepoType repotype = repomanager.probe(probe_url);
+ zypp::repo::RepoType repotype = ProbeWithCallbacks(probe_url);
ret = zypp2yastType(repotype.asString());
y2milestone("Detected type: '%s'...", ret.c_str());
@@ -2249,7 +2409,8 @@
try
{
zypp::Url baseurl(url->value());
- products = scanProducts(baseurl);
+ ScanProductsWithCallBacks(baseurl);
+ products = available_products;
}
catch ( const zypp::Exception& excpt)
{
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.37/VERSION new/yast2-pkg-bindings-2.15.40/VERSION
--- old/yast2-pkg-bindings-2.15.37/VERSION 2007-07-31 10:37:32.000000000 +0200
+++ new/yast2-pkg-bindings-2.15.40/VERSION 2007-08-03 11:10:01.000000000 +0200
@@ -1 +1 @@
-2.15.37
+2.15.40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org