Author: lslezak Date: Wed Aug 1 10:33:01 2007 New Revision: 39851 URL: http://svn.opensuse.org/viewcvs/yast?rev=39851&view=rev Log: - 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 Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes trunk/pkg-bindings/src/PkgModuleFunctions.cc trunk/pkg-bindings/src/PkgModuleFunctions.h trunk/pkg-bindings/src/Source.cc Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/package/yast2-pkg-bindings.changes?rev=39851&r1=39850&r2=39851&view=diff ============================================================================== --- trunk/pkg-bindings/package/yast2-pkg-bindings.changes (original) +++ trunk/pkg-bindings/package/yast2-pkg-bindings.changes Wed Aug 1 10:33:01 2007 @@ -1,4 +1,14 @@ ------------------------------------------------------------------- +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 Modified: trunk/pkg-bindings/src/PkgModuleFunctions.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/PkgModuleFunctions.cc?rev=39851&r1=39850&r2=39851&view=diff ============================================================================== --- trunk/pkg-bindings/src/PkgModuleFunctions.cc (original) +++ trunk/pkg-bindings/src/PkgModuleFunctions.cc Wed Aug 1 10:33:01 2007 @@ -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; } Modified: trunk/pkg-bindings/src/PkgModuleFunctions.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/PkgModuleFunctions.h?rev=39851&r1=39850&r2=39851&view=diff ============================================================================== --- trunk/pkg-bindings/src/PkgModuleFunctions.h (original) +++ trunk/pkg-bindings/src/PkgModuleFunctions.h Wed Aug 1 10:33:01 2007 @@ -441,6 +441,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)*/ Modified: trunk/pkg-bindings/src/Source.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Source.cc?rev=39851&r1=39850&r2=39851&view=diff ============================================================================== --- trunk/pkg-bindings/src/Source.cc (original) +++ trunk/pkg-bindings/src/Source.cc Wed Aug 1 10:33:01 2007 @@ -966,6 +966,29 @@ 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 + 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) +{ bool found = true; YRepo_Ptr repo = logFindRepository(id->value()); if (!repo) @@ -973,11 +996,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 +1018,9 @@ } } + // set the original probing value + _silent_probing = _silent_probing_old; + if (found) { return YCPString(path.asString()); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org