##
# vendordir = /etc/zypp/vendors.d
+##
+## Whether required packages are installed ONLY
+## So recommended packages, language packages and packages which depend
+## on hardware (modalias) will not be regarded.
+##
+## Valid values: boolean
+## Default value: false
+##
+# solver.onlyRequires = false
\ No newline at end of file
#include <iostream>
#include "zypp/Resolver.h"
+#include "zypp/ZConfig.h"
#include "zypp/UpgradeStatistics.h"
#include "zypp/solver/detail/Resolver.h"
#include "zypp/solver/detail/Testcase.h"
namespace zypp
{ /////////////////////////////////////////////////////////////////
+ using namespace solver;
+
IMPL_PTR_TYPE(Resolver);
#if 0
Resolver_Ptr Resolver::_resolver = NULL;
{ _pimpl->setForceResolve( force ); }
bool Resolver::forceResolve()
{ return _pimpl->forceResolve(); }
+ void Resolver::setOnlyRequires( const bool onlyRequires )
+ { onlyRequires ? _pimpl->setOnlyRequires( TRUE ) : _pimpl->setOnlyRequires( FALSE ); }
+ void Resolver::resetOnlyRequires()
+ { _pimpl->setOnlyRequires( DEFAULT ); }
+ bool Resolver::onlyRequires()
+ {
+ switch (_pimpl->onlyRequires()) {
+ case DEFAULT:
+ return ZConfig::instance().solver_onlyRequires();
+ case TRUE:
+ return true;
+ case FALSE:
+ return false;
+ };
+ }
void Resolver::addRequire (const Capability & capability)
{ _pimpl->addExtraRequire( capability ); }
bool forceResolve();
/**
+ * Setting whether required packages are installed ONLY
+ * So recommended packages, language packages and packages which depend
+ * on hardware (modalias) will not be regarded.
+ **/
+ void setOnlyRequires (const bool onlyRequires);
+ void resetOnlyRequires(); // set back to default (described in zypp.conf)
+ bool onlyRequires();
+
+ /**
* Adding additional requirement
*
*/
{
public:
Impl( const Pathname & override_r = Pathname() )
- : cfg_arch ( defaultSystemArchitecture() )
- , cfg_textLocale ( defaultTextLocale() )
- , repo_add_probe ( false )
- , repo_refresh_delay ( 10 )
- , download_use_patchrpm ( true )
- , download_use_deltarpm ( true )
+ : cfg_arch ( defaultSystemArchitecture() )
+ , cfg_textLocale ( defaultTextLocale() )
+ , repo_add_probe ( false )
+ , repo_refresh_delay ( 10 )
+ , download_use_patchrpm ( true )
+ , download_use_deltarpm ( true )
+ , solver_onlyRequires ( false )
{
MIL << "libzypp: " << VERSION << " built " << __DATE__ << " " << __TIME__ << endl;
{
cfg_packages_path = Pathname(value);
}
+ else if ( entry == "solver.onlyRequires" )
+ {
+ solver_onlyRequires = str::strToBool( value, solver_onlyRequires );
+ }
}
}
}
bool download_use_patchrpm;
bool download_use_deltarpm;
+ bool solver_onlyRequires;
};
///////////////////////////////////////////////////////////////////
? Pathname("/etc/zypp/vendors.d") : _pimpl->cfg_vendor_path );
}
+ bool ZConfig::solver_onlyRequires() const
+ { return _pimpl->solver_onlyRequires; }
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
*/
Pathname vendorPath() const;
+ /**
+ * Solver regards required packages,patterns,... only
+ */
+ bool solver_onlyRequires() const;
+
public:
class Impl;
/** Dtor */
#include "zypp/base/Algorithm.h"
#include "zypp/ResPool.h"
#include "zypp/ResFilters.h"
+#include "zypp/ZConfig.h"
#include "zypp/sat/SATResolver.h"
#include "zypp/sat/Pool.h"
#include "zypp/sat/WhatProvides.h"
, _allowvirtualconflicts(false)
, _noupdateprovide(false)
, _dosplitprovides(false)
+ , _onlyRequires(ZConfig::instance().solver_onlyRequires())
{
}
_solv->allowarchchange = _allowarchchange;
_solv->dosplitprovides = _dosplitprovides;
_solv->noupdateprovide = _noupdateprovide;
+ _solv->dontinstallrecommended = _onlyRequires;
sat::Pool::instance().prepare();
PoolItemList _items_to_remove;
PoolItemList _items_to_lock;
- bool _fixsystem; /* repair errors in rpm dependency graph */
- bool _allowdowngrade; /* allow to downgrade installed solvable */
- bool _allowarchchange; /* allow to change architecture of installed solvables */
- bool _allowvendorchange; /* allow to change vendor of installed solvables */
- bool _allowuninstall; /* allow removal of installed solvables */
- bool _updatesystem; /* distupgrade */
- bool _allowvirtualconflicts; /* false: conflicts on package name, true: conflicts on package provides */
- bool _noupdateprovide; /* true: update packages needs not to provide old package */
- bool _dosplitprovides; /* true: consider legacy split provides */
+ bool _fixsystem; // repair errors in rpm dependency graph
+ bool _allowdowngrade; // allow to downgrade installed solvable
+ bool _allowarchchange; // allow to change architecture of installed solvables
+ bool _allowvendorchange; // allow to change vendor of installed solvables
+ bool _allowuninstall; // allow removal of installed solvables
+ bool _updatesystem; // distupgrade
+ bool _allowvirtualconflicts; // false: conflicts on package name, true: conflicts on package provides
+ bool _noupdateprovide; // true: update packages needs not to provide old package
+ bool _dosplitprovides; // true: consider legacy split provides
+ bool _onlyRequires; // true: consider required packages only
// ---------------------------------- methods
std::string SATprobleminfoString (Id problem, std::string &detail);
bool noupdateprovide () const {return _noupdateprovide;}
void setNoupdateprovide ( const bool noupdateprovide) { _noupdateprovide = noupdateprovide;}
-
+
bool dosplitprovides () const {return _dosplitprovides;}
void setDosplitprovides ( const bool dosplitprovides) { _dosplitprovides = dosplitprovides;}
+
+ bool onlyRequires () const {return _onlyRequires;}
+ void setOnlyRequires ( const bool onlyRequires) { _onlyRequires = onlyRequires;}
bool doesObsoleteItem (PoolItem candidate, PoolItem installed);
};
#include "zypp/solver/detail/Testcase.h"
#include "zypp/Capabilities.h"
+#include "zypp/ZConfig.h"
#include "zypp/base/Logger.h"
#include "zypp/base/String.h"
#include "zypp/base/Gettext.h"
, _forceResolve(false)
, _upgradeMode(false)
, _verifying(false)
+ , _onlyRequires(DEFAULT)
{
sat::Pool satPool( sat::Pool::instance() );
if (_forceResolve)
_satResolver->setAllowuninstall(true);
+
+ switch (_onlyRequires) {
+ case DEFAULT:
+ _satResolver->setOnlyRequires(ZConfig::instance().solver_onlyRequires());
+ case TRUE:
+ _satResolver->setOnlyRequires(true);
+ case FALSE:
+ _satResolver->setOnlyRequires(false);
+ }
if (_verifying)
_satResolver->setFixsystem(true);
namespace solver
{ /////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
+
+ enum TriState
+ {
+ FALSE,
+ TRUE,
+ DEFAULT
+ };
+
namespace detail
{ ///////////////////////////////////////////////////////////////////
PoolItemList _ignoreVendorItem;
- bool _forceResolve; // remove items which are conflicts with others or
- // have unfulfilled requirements.
- // This behaviour is favourited by ZMD
- bool _upgradeMode; // Resolver has been called with doUpgrade
- bool _verifying; // The system will be checked
+ bool _forceResolve; // remove items which are conflicts with others or
+ // have unfulfilled requirements.
+ // This behaviour is favourited by ZMD
+ bool _upgradeMode; // Resolver has been called with doUpgrade
+ bool _verifying; // The system will be checked
+ TriState _onlyRequires; // do install required resolvables only
+ // no recommended resolvables, language
+ // packages, hardware packages (modalias)
// helpers
bool doesObsoleteCapability (PoolItem candidate, const Capability & cap);
void setForceResolve (const bool force) { _forceResolve = force; }
bool forceResolve() { return _forceResolve; }
+ void setOnlyRequires (const TriState state)
+ { _onlyRequires = state; }
+ TriState onlyRequires () { return _onlyRequires; }
+
bool verifySystem ();
bool resolvePool();