[yast-commit] r41037 - in /trunk/pkg-bindings: VERSION package/yast2-pkg-bindings.changes src/Package.cc

Author: lslezak Date: Mon Sep 24 09:20:05 2007 New Revision: 41037 URL: http://svn.opensuse.org/viewcvs/yast?rev=41037&view=rev Log: - search the correct package instance in license bindings (Pkg::PkgGetLicenseToConfirm(), Pkg::PkgGetLicensesToConfirm() and Pkg::PkgMarkLicenseConfirmed()) - fixes the double license confirmation bug (#326277) - 2.15.50 Modified: trunk/pkg-bindings/VERSION trunk/pkg-bindings/package/yast2-pkg-bindings.changes trunk/pkg-bindings/src/Package.cc Modified: trunk/pkg-bindings/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/VERSION?rev=41037&r1... ============================================================================== --- trunk/pkg-bindings/VERSION (original) +++ trunk/pkg-bindings/VERSION Mon Sep 24 09:20:05 2007 @@ -1 +1 @@ -2.15.49 +2.15.50 Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/package/yast2-pkg-bi... ============================================================================== --- trunk/pkg-bindings/package/yast2-pkg-bindings.changes (original) +++ trunk/pkg-bindings/package/yast2-pkg-bindings.changes Mon Sep 24 09:20:05 2007 @@ -1,4 +1,13 @@ ------------------------------------------------------------------- +Mon Sep 24 09:02:57 CEST 2007 - lslezak@suse.cz + +- search the correct package instance in license bindings + (Pkg::PkgGetLicenseToConfirm(), Pkg::PkgGetLicensesToConfirm() + and Pkg::PkgMarkLicenseConfirmed()) - fixes the double license + confirmation bug (#326277) +- 2.15.50 + +------------------------------------------------------------------- Mon Sep 3 13:01:12 CEST 2007 - lslezak@suse.cz - reimplemented media redirection in media change callback Modified: trunk/pkg-bindings/src/Package.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Package.cc?rev=4... ============================================================================== --- trunk/pkg-bindings/src/Package.cc (original) +++ trunk/pkg-bindings/src/Package.cc Mon Sep 24 09:20:05 2007 @@ -2419,23 +2419,21 @@ { try { - // find the uninstalled (!) package - zypp::ResPool::byName_iterator it = std::find_if ( - zypp_ptr()->pool().byNameBegin(pkgname) - , zypp_ptr()->pool().byNameEnd(pkgname) - , zypp::functor::chain( - zypp::resfilter::ByUninstalled (), - zypp::resfilter::ByKind( zypp::ResTraits<zypp::Package>::kind ) ) - ); - - if (it != zypp_ptr()->pool().byNameEnd(pkgname) && !it->status().isLicenceConfirmed()) + for (zypp::ResPool::byName_iterator it = zypp_ptr()->pool().byNameBegin(pkgname); + it != zypp_ptr()->pool().byNameEnd(pkgname); + ++it) { - // cast to Package object + // is it a package? zypp::Package::constPtr package = zypp::dynamic_pointer_cast<const zypp::Package>(it->resolvable()); - // get the license - zypp::License license = package->licenseToConfirm(); - return YCPString(license); + // a package scheduled for installation, with unconfirmed license, not installed yet + if (package && it->status().isToBeInstalled() && !it->status().isLicenceConfirmed() + && !it->status().isInstalled()) + { + // get the license + zypp::License license = package->licenseToConfirm(); + return YCPString(license); + } } } catch (...) @@ -2462,38 +2460,12 @@ YCPMap ret; for ( int i = 0; i < packages->size(); ++i ) { - std::string pkgname = packages->value(i)->asString()->value(); + YCPString license = PkgGetLicenseToConfirm(packages->value(i)->asString()); - if (!pkgname.empty()) + // found a license to confirm? + if (!license->value().empty()) { - try - { - // find the uninstalled (!) package - zypp::ResPool::byName_iterator it = std::find_if( - zypp_ptr()->pool().byNameBegin(pkgname) - , zypp_ptr()->pool().byNameEnd(pkgname) - , zypp::functor::chain( - zypp::resfilter::ByUninstalled (), - zypp::resfilter::ByKind( zypp::ResTraits<zypp::Package>::kind ) ) - ); - - // found a package? - if (it != zypp_ptr()->pool().byNameEnd(pkgname)) - { - // cast to Package object - zypp::Package::constPtr package = zypp::dynamic_pointer_cast<const zypp::Package>(it->resolvable()); - zypp::License license = package->licenseToConfirm(); - - // has the license already been confirmed? - if (!license.empty() && !it->status().isLicenceConfirmed()) - { - ret->add(packages->value(i), YCPString(license)); - } - } - } - catch (...) - { - } + ret->add(packages->value(i), license); } } @@ -2507,7 +2479,6 @@ @param string name of a package @return boolean true if the license has been successfuly confirmed */ -#warning This is bogus, as we have multiple matching packages YCPBoolean PkgModuleFunctions::PkgMarkLicenseConfirmed (const YCPString & package) { std::string pkgname = package->value(); @@ -2516,20 +2487,21 @@ { try { - // find the package - zypp::ResPool::byName_iterator it = std::find_if( - zypp_ptr()->pool().byNameBegin(pkgname) - , zypp_ptr()->pool().byNameEnd(pkgname) - , zypp::functor::chain( - zypp::resfilter::ByUninstalled (), - zypp::resfilter::ByKind( zypp::ResTraits<zypp::Package>::kind ) ) - ); - - if (it != zypp_ptr()->pool().byNameEnd(pkgname)) + for (zypp::ResPool::byName_iterator it = zypp_ptr()->pool().byNameBegin(pkgname); + it != zypp_ptr()->pool().byNameEnd(pkgname); + ++it) { - // confirm the license - it->status().setLicenceConfirmed(true); - return YCPBoolean( true ); + // is it a package? + zypp::Package::constPtr package = zypp::dynamic_pointer_cast<const zypp::Package>(it->resolvable()); + + // a package scheduled for installation, with unconfirmed license, not installed yet + if (package && it->status().isToBeInstalled() && !it->status().isLicenceConfirmed() + && !it->status().isInstalled()) + { + // confirm the license + it->status().setLicenceConfirmed(true); + return YCPBoolean( true ); + } } } catch (...) -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
lslezak@svn.opensuse.org