Author: dmacvicar
Date: Tue May 10 17:09:46 2011
New Revision: 63939
URL: http://svn.opensuse.org/viewcvs/yast?rev=63939&view=rev
Log:
port to Code11 API wihtout breaking Code10 Pkg:: API
Modified:
branches/tmp/dmacvicar/zc10/pkg-bindings/src/Makefile.am
branches/tmp/dmacvicar/zc10/pkg-bindings/src/Package.cc
branches/tmp/dmacvicar/zc10/pkg-bindings/src/PkgModuleFunctions.cc
branches/tmp/dmacvicar/zc10/pkg-bindings/src/PkgModuleFunctions.h
Modified: branches/tmp/dmacvicar/zc10/pkg-bindings/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/zc10/pkg-bindings/src/Makefile.am?rev=63939&r1=63938&r2=63939&view=diff
==============================================================================
--- branches/tmp/dmacvicar/zc10/pkg-bindings/src/Makefile.am (original)
+++ branches/tmp/dmacvicar/zc10/pkg-bindings/src/Makefile.am Tue May 10 17:09:46 2011
@@ -22,9 +22,9 @@
Y2CCPkg.cc Y2CCPkg.h \
ycpTools.cc ycpTools.h \
PkgModule.cc PkgModule.h \
+ YRepo.h YRepo.cc
PkgModuleFunctions.h \
PkgModuleFunctions.cc \
- ProvideProcess.cc ProvideProcess.h \
Package.cc \
Patch.cc \
Resolvable.cc \
Modified: branches/tmp/dmacvicar/zc10/pkg-bindings/src/Package.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/zc10/pkg-bindings/src/Package.cc?rev=63939&r1=63938&r2=63939&view=diff
==============================================================================
--- branches/tmp/dmacvicar/zc10/pkg-bindings/src/Package.cc (original)
+++ branches/tmp/dmacvicar/zc10/pkg-bindings/src/Package.cc Tue May 10 17:09:46 2011
@@ -37,6 +37,7 @@
#include
#include
+#include
#include
#include
#include
@@ -98,60 +99,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;
@@ -191,58 +196,55 @@
YCPValue
PkgModuleFunctions::PkgMediaNames ()
{
-# warning No installation order
-
- std::listzypp::SourceManager::SourceId source_ids = zypp::SourceManager::sourceManager()->enabledSources();
-
YCPList res;
- // initialize
- for( std::listzypp::SourceManager::SourceId::const_iterator sit = source_ids.begin();
- sit != source_ids.end(); ++sit)
+ RepoId index = 0;
+ // for all enabled sources
+ for( RepoCont::const_iterator repoit = repos.begin();
+ repoit != repos.end(); ++repoit,++index)
{
- unsigned id = *sit;
+ if ((*repoit)->repoInfo().enabled() && !(*repoit)->isDeleted())
+ {
+ try
+ {
+ std::string repo_name = (*repoit)->repoInfo().name();
+ YCPList src_desc;
+
+ if (repo_name.empty())
+ {
+ y2warning("Name of repository '%zd' is empty, using URL", index);
- zypp::Source_Ref src = zypp::SourceManager::sourceManager()->findSource( id );
+ // use URL as the product name
+ std::string name;
+ if ((*repoit)->repoInfo().baseUrlsBegin() != (*repoit)->repoInfo().baseUrlsEnd())
+ {
+ name = (*repoit)->repoInfo().baseUrlsBegin()->asString();
+ }
- try
- {
- // find a product for the given source
- zypp::ResPool::byKind_iterator it = zypp_ptr()->pool().byKindBegin(zypp::ResTraitszypp::Product::kind);
+ // use alias if url is unknown
+ if (name.empty())
+ {
+ name = (*repoit)->repoInfo().alias();
+ }
- for( ; it != zypp_ptr()->pool().byKindEnd(zypp::ResTraitszypp::Product::kind)
- ; ++it) {
- zypp::Product::constPtr product = boost::dynamic_pointer_cast<const zypp::Product>( it->resolvable() );
+ src_desc->add( YCPString( name ));
+ src_desc->add( YCPInteger( index ) );
- y2debug ("Checking product: %s", product->summary().c_str());
- if( product->source() == src )
+ res->add( src_desc );
+ }
+ else
{
- y2debug ("Found");
-
- YCPList src_desc;
- src_desc->add( YCPString( product->summary() ) );
- src_desc->add( YCPInteger( src.numericId() ) );
+ src_desc->add( YCPString( repo_name ));
+ src_desc->add( YCPInteger( index ) );
res->add( src_desc );
- break;
}
}
-
- if( it == zypp_ptr()->pool().byKindEnd(zypp::ResTraitszypp::Product::kind) )
+ catch (...)
{
- y2error ("Product for source '%d' not found", id);
-
- YCPList src_desc;
- src_desc->add( YCPString( src.url().asString() ) );
- src_desc->add( YCPInteger( src.numericId() ) );
-
- res->add( src_desc );
+ return res;
}
}
- catch (...)
- {
- return res;
- }
}
y2milestone( "Pkg::PkgMediaNames result: %s", res->toString().c_str());
@@ -250,56 +252,58 @@
return res;
}
+static YCPValue
+PkgMediaSizesOrCount (bool sizes, bool download_size)
+{
+ // all enabled sources
+ std::list<RepoId> source_ids;
+ RepoId index = 0;
+ for(RepoCont::const_iterator it = repos.begin(); it != repos.end() ; ++it, ++index)
+ {
+ // ignore disabled or delted sources
+ if (!(*it)->repoInfo().enabled() || (*it)->isDeleted())
+ continue;
-// ------------------------
-/**
- * @builtin PkgMediaSizes
- * @short Return size of packages to be installed
- * @description
- * return cumulated sizes (in bytes !) to be installed from different sources and media
- *
- * Returns the install size, not the archivesize !!
- *
- * @return list
- * @usage Pkg::PkgMediaSizes () -> [ [src1_media_1_size, src1_media_2_size, ...], ..]
- */
-YCPValue
-PkgModuleFunctions::PkgMediaSizes ()
-{
-# warning No installation order
+ source_ids.push_back(index);
+ }
- // all enabled sources
- std::listzypp::SourceManager::SourceId source_ids = zypp::SourceManager::sourceManager()->enabledSources();
// map SourceId -> [ number_of_media, total_size ]
- std::mapzypp::ByteCount > result;
+ std::mapzypp::ByteCount > result;
- // map zypp::Source -> SourceID
- std::map source_map;
+ // map alias -> SourceID
+ std::map source_map;
- // initialize
- for( std::listzypp::SourceManager::SourceId::const_iterator sit = source_ids.begin();
- sit != source_ids.end(); ++sit)
+ // initialize the structures
+ for( std::list<RepoId>::const_iterator sit = source_ids.begin();
+ sit != source_ids.end(); ++sit, ++index)
{
- zypp::SourceManager::SourceId id = *sit;
+ RepoId id = *sit;
- zypp::Source_Ref src = zypp::SourceManager::sourceManager()->findSource( id );
- unsigned media = src.numberOfMedia();
+ YRepo_Ptr repo = logFindRepository(id);
+ if (!repo)
+ continue;
- result[id] = std::vectorzypp::ByteCount(media,0);
- source_map[ src ] = id;
+ // we don't know the number of media in advance
+ // the vector is dynamically resized during package search
+ result[id] = std::vectorzypp::ByteCount();
+ source_map[ repo->repoInfo().alias() ] = id;
}
- for( zypp::ResPool::byKind_iterator it = zypp_ptr()->pool().byKindBeginzypp::Package()
- ; it != zypp_ptr()->pool().byKindEndzypp::Package()
- ; ++it )
- {
- zypp::Package::constPtr pkg = boost::dynamic_pointer_cast<const zypp::Package>(it->resolvable());
- if( it->status().isToBeInstalled())
+ for (zypp::ResPoolProxy::const_iterator it = zypp_ptr()->poolProxy().byKindBegin(zypp::ResKind::package);
+ it != zypp_ptr()->poolProxy().byKindEnd(zypp::ResKind::package);
+ ++it)
+ {
+ if ((*it)->fate() == zypp::ui::Selectable::TO_INSTALL)
{
- unsigned int medium = pkg->sourceMediaNr();
+ zypp::Package::constPtr pkg = boost::dynamic_pointer_cast<const zypp::Package>((*it)->candidateObj().resolvable());
+
+ if (!pkg)
+ continue;
+
+ unsigned int medium = pkg->mediaNr();
if (medium == 0)
{
medium = 1;
@@ -307,19 +311,29 @@
if (medium > 0)
{
- zypp::ByteCount size = pkg->size();
- result[ source_map[pkg->source()] ]
- [medium - 1] += size ; // media are numbered from 1
+ zypp::ByteCount size = sizes ? (download_size ? pkg->downloadSize() : pkg->installSize()) : zypp::ByteCount(1); //count only
+
+ // refence to the found media array
+ std::vectorzypp::ByteCount &ref = result[source_map[pkg->repoInfo().alias()]];
+ int add_count = (medium - 1) - ref.size() + 1;
+
+ // resize media array - the found index is out of array
+ if (add_count > 0)
+ {
+ ref.insert(ref.end(), add_count, zypp::ByteCount(0));
+ }
+
+ ref[medium - 1] += size ; // media are numbered from 1
}
}
}
YCPList res;
- for(std::mapzypp::ByteCount >::const_iterator it =
+ for(std::mapzypp::ByteCount >::const_iterator it =
result.begin(); it != result.end() ; ++it)
{
- std::vectorzypp::ByteCount values = it->second;
+ const std::vectorzypp::ByteCount &values = it->second;
YCPList source;
for( unsigned i = 0 ; i < values.size() ; i++ )
@@ -330,11 +344,30 @@
res->add( source );
}
- y2milestone( "Pkg::PkgMediaSize result: %s", res->toString().c_str());
+ y2milestone( "Pkg::%s result: %s", sizes ? (download_size ? "PkgMediaPackageSizes" : "PkgMediaSizes" ): "PkgMediaCount", res->toString().c_str());
return res;
}
+// ------------------------
+/**
+ * @builtin PkgMediaSizes
+ * @short Return size of packages to be installed
+ * @description
+ * return cumulated sizes (in bytes !) to be installed from different sources and media
+ *
+ * Returns the install size, not the archivesize !!
+ *
+ * @return list
+ * @usage Pkg::PkgMediaSizes () -> [ [src1_media_1_size, src1_media_2_size, ...], ..]
+ */
+YCPValue
+PkgModuleFunctions::PkgMediaSizes ()
+{
+# warning No installation order
+ return PkgMediaSizesOrCount (true);
+}
+
// ------------------------
/**
@@ -349,88 +382,13 @@
YCPValue
PkgModuleFunctions::PkgMediaCount()
{
-# warning No installation order
-
- // all enabled sources
- std::listzypp::SourceManager::SourceId source_ids = zypp::SourceManager::sourceManager()->enabledSources();
-
- // map SourceId -> [ number_of_media, total_size ]
- std::mapzypp::ByteCount > result;
-
- // map zypp::Source -> SourceID
- std::map source_map;
-
-
- // initialize
- for( std::listzypp::SourceManager::SourceId::const_iterator sit = source_ids.begin();
- sit != source_ids.end(); ++sit)
- {
- zypp::SourceManager::SourceId id = *sit;
-
- zypp::Source_Ref src = zypp::SourceManager::sourceManager()->findSource( id );
- unsigned media = src.numberOfMedia();
-
- result[id] = std::vectorzypp::ByteCount(media,0);
-
- source_map[ src ] = id;
- }
-
- for( zypp::ResPool::byKind_iterator it = zypp_ptr()->pool().byKindBeginzypp::Package()
- ; it != zypp_ptr()->pool().byKindEndzypp::Package()
- ; ++it )
- {
- zypp::Package::constPtr pkg = boost::dynamic_pointer_cast<const zypp::Package>(it->resolvable());
-
- if( pkg && it->status().isToBeInstalled())
- {
- unsigned int medium = pkg->sourceMediaNr();
- if (medium == 0)
- {
- medium = 1;
- }
-
- if (medium > 0)
- {
- result[ source_map[pkg->source()] ]
- [medium - 1]++ ; // media are numbered from 1
- }
- }
- }
- YCPList res;
-
- for(std::mapzypp::ByteCount >::const_iterator it =
- result.begin(); it != result.end() ; ++it)
- {
- const std::vectorzypp::ByteCount &values = it->second;
- YCPList source;
-
- for( unsigned i = 0 ; i < values.size() ; i++ )
- {
- source->add( YCPInteger( values[i] ) );
- }
-
- res->add( source );
- }
-
- y2milestone( "Pkg::PkgMediaCount result: %s", res->toString().c_str());
-
- return res;
+# warning No installation order
+ return PkgMediaSizesOrCount (false);
}
// ------------------------
-struct CaIMatch
-{
- zypp::PoolItem_Ref item;
-
- bool operator() (const zypp::CapAndItem & cai )
- {
- item = cai.item;
- return false;
- }
-};
-
/**
* @builtin IsProvided
*
@@ -450,26 +408,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);
}
@@ -492,24 +449,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);
}
// ------------------------
@@ -530,28 +488,29 @@
YCPValue
PkgModuleFunctions::IsAvailable (const YCPString& tag)
{
- y2milestone("IsAvailable called");
- std::string name = tag->value ();
+ 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);
}
@@ -1613,7 +1572,7 @@
* on the delete_unmaintained arg, they are either tagged as to delete or
* remain unchanged.
*
- * @return map summary of the update
+ * @return map summary of the update
*/
YCPValue
@@ -1723,9 +1682,19 @@
if (name.empty())
return YCPBoolean (false);
- // ensure installation of the 'best' architecture
+ bool ret = false;
+ zypp::ui::Selectable::Ptr selectable = zypp::ui::Selectable::get(name);
- return YCPBoolean( DoProvideNameKind( name, zypp::ResTraitszypp::Package::kind, zypp_ptr()->architecture(), "") );
+ if (selectable)
+ {
+ ret = selectable->setToInstall(whoWantsIt);
+ }
+ else
+ {
+ y2error("Package %s is not available", name.c_str());
+ }
+
+ return YCPBoolean(ret);
}
/**
Modified: branches/tmp/dmacvicar/zc10/pkg-bindings/src/PkgModuleFunctions.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/zc10/pkg-bindings/src/PkgModuleFunctions.cc?rev=63939&r1=63938&r2=63939&view=diff
==============================================================================
--- branches/tmp/dmacvicar/zc10/pkg-bindings/src/PkgModuleFunctions.cc (original)
+++ branches/tmp/dmacvicar/zc10/pkg-bindings/src/PkgModuleFunctions.cc Tue May 10 17:09:46 2011
@@ -34,9 +34,9 @@
#include
#include
-#include
#include
-#include
+#include
+//#include
// sleep
#include
@@ -45,7 +45,7 @@
#include <cstdlib>
// textdomain
-#include
+#include
class Y2PkgFunction: public Y2Function
{
@@ -313,23 +313,49 @@
/**
- * @builtin SetLocale
- * @short Set Prefered Locale
+ * @short Set Package Manager Locale
* @description
- * set the given locale as the "preferred" locale
+ * Set the given locale as the output locale -- all messages from the package manager (errors, warnings,...)
+ * will be returned in the selected language. This built-in does not change package selection in any way.
+ * @param string locale Locale
+ * @return void
+ */
+static YCPValue
+SetTextLocale (const YCPString &locale)
+{
+ try
+ {
+ zypp::Locale loc = zypp::Locale(locale->value());
+ zypp::ZConfig::instance().setTextLocale(loc);
+ }
+ catch (const std::exception& excpt)
+ {
+ y2error("Caught an exception: %s", excpt.what());
+ }
+ catch (...)
+ {
+ y2internal("Caught an unknown exception");
+ }
+
+ return YCPVoid();
+}
+
+/**
+ * @short Select locale for installation
+ * @description
+ * Select the main locale for installation, call Pkg::PkgSolve() to select the respective packages.
* @param string locale Locale
* @return void
*/
YCPValue
-PkgModuleFunctions::SetLocale (const YCPString &locale)
+PkgModuleFunctions::SetPackageLocale (const YCPString &locale)
{
try
{
zypp::Locale loc = zypp::Locale(locale->value());
- zypp_ptr()->setTextLocale(loc);
// add packages for the preferred locale, preserve additional locales
- zypp::ZYpp::LocaleSet lset = zypp_ptr()->getRequestedLocales();
+ zypp::LocaleSet lset = zypp::sat::Pool::instance().getRequestedLocales();
// remove the previous locale
if (preferred_locale != zypp::Locale::noCode)
@@ -339,7 +365,7 @@
// add the new locale
lset.insert(loc);
- zypp_ptr()->setRequestedLocales(lset);
+ zypp::sat::Pool::instance().setRequestedLocales(lset);
// remember the main locale
preferred_locale = loc;
@@ -352,6 +378,22 @@
}
/**
+ * @builtin SetLocale
+ * @short Set Prefered Locale
+ * @description
+ * set the given locale as the "preferred" locale
+ * @param string locale Locale
+ * @return void
+ */
+YCPValue
+PkgModuleFunctions::SetLocale (const YCPString &locale)
+{
+ SetTextLocale(locale);
+ SetPackageLocale(locale);
+ return YCPVoid();
+}
+
+/**
* @builtin GetLocale
* @short get the currently preferred locale
* @return string locale
@@ -383,7 +425,7 @@
YCPValue
PkgModuleFunctions::SetAdditionalLocales (YCPList langycplist)
{
- zypp::ZYpp::LocaleSet lset;
+ zypp::LocaleSet lset;
int i = 0;
while (i < langycplist->size())
@@ -407,7 +449,7 @@
try
{
- zypp_ptr()->setRequestedLocales(lset);
+ zypp::sat::Pool::instance().setRequestedLocales(lset);
}
catch(...)
{
@@ -431,9 +473,9 @@
try
{
- zypp::ZYpp::LocaleSet lset = zypp_ptr()->getRequestedLocales();
+ zypp::LocaleSet lset = zypp::sat::Pool::instance().getRequestedLocales();
- for (zypp::ZYpp::LocaleSet::const_iterator it = lset.begin();
+ for (zypp::LocaleSet::const_iterator it = lset.begin();
it != lset.end(); ++it)
{
// ignore the main locale
@@ -507,15 +549,7 @@
YCPValue
PkgModuleFunctions::Init ()
{
- try {
- zypp::SourceManager::sourceManager()->reset();
- }
- catch( const zypp::Exception & expt )
- {
- y2error( "Initialization of libzypp failed" );
- return YCPBoolean(false);
- }
-
+ // With Code11 stack, nothing to initialize
return YCPBoolean(true);
}
Modified: branches/tmp/dmacvicar/zc10/pkg-bindings/src/PkgModuleFunctions.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/zc10/pkg-bindings/src/PkgModuleFunctions.h?rev=63939&r1=63938&r2=63939&view=diff
==============================================================================
--- branches/tmp/dmacvicar/zc10/pkg-bindings/src/PkgModuleFunctions.h (original)
+++ branches/tmp/dmacvicar/zc10/pkg-bindings/src/PkgModuleFunctions.h Tue May 10 17:09:46 2011
@@ -43,8 +43,6 @@
#include
#include
#include
-#include
-
#include "PkgError.h"
@@ -78,21 +76,22 @@
protected:
zypp::Pathname _target_root;
-
+
std::setstd::string _broken_sources;
zypp::ZYpp::Ptr zypp_pointer;
+ // From Code11, but we only use it as a helper
+ YCPValue SetPackageLocale (const YCPString &locale);
// remember the main locale (set by SetLocale) for SetAdditionalLocales,
// add the main locale to the additional ones
zypp::Locale preferred_locale;
- /**
+ /**
* ZYPP
*/
zypp::ZYpp::Ptr zypp_ptr();
-
private: // source related
bool DoProvideNameKind( const std::string & name, zypp::Resolvable::Kind kind, zypp::Arch architecture,
@@ -102,7 +101,7 @@
bool DoRemoveAllKind(zypp::Resolvable::Kind kind);
bool DoAllKind(zypp::Resolvable::Kind kind, bool provide);
YCPValue GetPkgLocation(const YCPString& p, bool full_path);
- YCPValue PkgProp( zypp::PoolItem_Ref item );
+ YCPValue PkgProp( zypp::PoolItem item );
void SetCurrentDU();
@@ -136,7 +135,7 @@
* call zypp::SourceManager::sourceManager()->findSource
* and in case of exception, log error and setLastError AND RETHROW
*/
- zypp::Source_Ref logFindSource (zypp::SourceManager::SourceId id);
+ //zypp::Source_Ref logFindSource (zypp::SourceManager::SourceId id);
public:
// general
@@ -304,25 +303,25 @@
/* TYPEINFO: void(string) */
YCPValue CallbackResolvableReport( const YCPString& func );
/* TYPEINFO: void(string) */
- YCPValue CallbackImportGpgKey( const YCPString& func );
+ YCPValue CallbackImportGpgKey( const YCPString& func );
/* TYPEINFO: void(string) */
YCPValue CallbackAcceptNonTrustedGpgKey( const YCPString& args );
/* TYPEINFO: void(string) */
- YCPValue CallbackAcceptUnknownGpgKey( const YCPString& func );
+ YCPValue CallbackAcceptUnknownGpgKey( const YCPString& func );
/* TYPEINFO: void(string) */
- YCPValue CallbackAcceptUnsignedFile( const YCPString& func );
+ YCPValue CallbackAcceptUnsignedFile( const YCPString& func );
/* TYPEINFO: void(string) */
- YCPValue CallbackAcceptVerificationFailed( const YCPString& func );
+ YCPValue CallbackAcceptVerificationFailed( const YCPString& func );
/* TYPEINFO: void(string) */
YCPValue CallbackAcceptWrongDigest( const YCPString& func);
/* TYPEINFO: void(string) */
YCPValue CallbackAcceptUnknownDigest( const YCPString& func);
/* TYPEINFO: void(string) */
- YCPValue CallbackTrustedKeyAdded( const YCPString& func );
+ YCPValue CallbackTrustedKeyAdded( const YCPString& func );
/* TYPEINFO: void(string) */
- YCPValue CallbackTrustedKeyRemoved( const YCPString& func );
+ YCPValue CallbackTrustedKeyRemoved( const YCPString& func );
/* TYPEINFO: void(string) */
- YCPValue CallbackAcceptFileWithoutChecksum( const YCPString& func );
+ YCPValue CallbackAcceptFileWithoutChecksum( const YCPString& func );
// source related
/* TYPEINFO: boolean(boolean)*/
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org