Product::constPtr Target::baseProduct() const
{ return _pimpl->baseProduct(); }
+ LocaleSet Target::requestedLocales() const
+ { return _pimpl->requestedLocales(); }
+ LocaleSet Target::requestedLocales( const Pathname & root_r )
+ { return target::TargetImpl::requestedLocales( root_r ); }
+
std::string Target::targetDistribution() const
{ return _pimpl->targetDistribution(); }
std::string Target::targetDistribution( const Pathname & root_r )
*/
Product::constPtr baseProduct() const;
+ /**
+ * \brief Languages to be supported by the system.
+ * E.g. language specific packages to be installed.
+ */
+ LocaleSet requestedLocales() const;
+ /** \overload Use a specific root_r, if empty the default targets root, or '/'
+ */
+ static LocaleSet requestedLocales( const Pathname & root_r );
+
public:
/** \name Base product and registration.
*
}
///////////////////////////////////////////////////////////////////
-
- Product::constPtr TargetImpl::baseProduct() const
- {
- ResPool pool(ResPool::instance());
- for_( it, pool.byKindBegin<Product>(), pool.byKindEnd<Product>() )
- {
- Product::constPtr p = (*it)->asKind<Product>();
- if ( p->isTargetDistribution() )
- return p;
- }
- return 0L;
- }
-
- ///////////////////////////////////////////////////////////////////
-
namespace
{
parser::ProductFileData baseproductdata( const Pathname & root_r )
}
return std::string();
}
+ } // namescpace
+ ///////////////////////////////////////////////////////////////////
+
+ Product::constPtr TargetImpl::baseProduct() const
+ {
+ ResPool pool(ResPool::instance());
+ for_( it, pool.byKindBegin<Product>(), pool.byKindEnd<Product>() )
+ {
+ Product::constPtr p = (*it)->asKind<Product>();
+ if ( p->isTargetDistribution() )
+ return p;
+ }
+ return nullptr;
+ }
+
+ LocaleSet TargetImpl::requestedLocales( const Pathname & root_r )
+ {
+ const Pathname needroot( staticGuessRoot(root_r) );
+ const Target_constPtr target( getZYpp()->getTarget() );
+ if ( target && target->root() == needroot )
+ return target->requestedLocales();
+ return RequestedLocalesFile( home(needroot) / "RequestedLocales" ).locales();
}
std::string TargetImpl::targetDistribution() const
/** The directory to store things. */
Pathname home() const
- { return _root / "/var/lib/zypp"; }
+ { return home( _root ); }
+
+ static Pathname home( const Pathname & root_r )
+ { return root_r / "/var/lib/zypp"; }
/** Commit changes in the pool */
ZYppCommitResult commit( ResPool pool_r, const ZYppCommitPolicy & policy_r );
/** \copydoc Target::baseProduct() */
Product::constPtr baseProduct() const;
+ /** \copydoc Target::requestedLocales() */
+ LocaleSet requestedLocales() const
+ { return _requestedLocalesFile.locales(); }
+ /** \overload */
+ static LocaleSet requestedLocales( const Pathname & root_r );
/** \copydoc Target::targetDistribution() */
std::string targetDistribution() const;