#include <zypp/ZYppFactory.h>
#include <zypp/zypp_detail/ZYppReadOnlyHack.h>
-#include <zypp/base/Logger.h>
+#include <zypp/base/LogTools.h>
#include <zypp/base/Algorithm.h>
#include <zypp/base/UserRequestException.h>
+#include <zypp/base/DtorReset.h>
#include <zypp/sat/SolvAttr.h>
#include <zypp/PoolQuery.h>
% (zypper.runningShell() ? "help <command>" : "zypper help <command>")));
}
+int Zypper::defaultLoadSystem( LoadSystemFlags flags_r )
+{
+ DBG << "FLAGS:" << flags_r << endl;
+ if ( ! flags_r.testFlag( NO_POOL ) )
+ {
+ init_target( *this );
+ if ( exitCode() != ZYPPER_EXIT_OK )
+ return exitCode();
+
+ if ( ! flags_r.testFlag( NO_REPOS ) )
+ {
+ init_repos(*this);
+ if ( exitCode() != ZYPPER_EXIT_OK )
+ return exitCode();
+ }
+
+ DtorReset _tmp( _gopts.disable_system_resolvables );
+ if ( flags_r.testFlag( NO_TARGET ) )
+ {
+ _gopts.disable_system_resolvables = true;
+ }
+ load_resolvables( *this );
+ if ( exitCode() != ZYPPER_EXIT_OK )
+ return exitCode();
+
+ if ( ! ( flags_r && NO_POOL ) )
+ {
+ // have REPOS and TARGET
+ // compute status of PPP
+ resolve(*this);
+ }
+ }
+ return exitCode();
+}
+
/*
* parses global options, returns the command
*
#include <zypp/base/Exception.h>
#include <zypp/base/NonCopyable.h>
#include <zypp/base/PtrTypes.h>
+#include <zypp/base/Flags.h>
#include <zypp/TriBool.h>
#include <zypp/RepoInfo.h>
void cleanup();
public:
+ /** Flags for tuning \ref defaultLoadSystem. */
+ enum _LoadSystemFlags
+ {
+ NO_TARGET = (1 << 0), //< don't load target to pool
+ NO_REPOS = (1 << 1), //< don't load repos to pool
+ NO_POOL = NO_TARGET | NO_REPOS //< no pool at all
+ };
+ ZYPP_DECLARE_FLAGS( LoadSystemFlags, _LoadSystemFlags );
+
+ /** Prepare repos and pool according to \a flags_r.
+ * Defaults to load target and repos and in this case also adjusts
+ * the PPP status by doing an initial solver run.
+ */
+ int defaultLoadSystem( LoadSystemFlags flags_r = LoadSystemFlags() );
+
+public:
/** Convenience to return properly casted _commandOptions. */
template<class _Opt>
shared_ptr<_Opt> commandOptionsAs() const
shared_ptr<Options> _commandOptions;
};
+/** \relates Zypper::LoadSystemFlags */
+ZYPP_DECLARE_OPERATORS_FOR_FLAGS( Zypper::LoadSystemFlags );
+
void print_main_help(const Zypper & zypper);
void print_unknown_command_hint(Zypper & zypper);
void print_command_help_hint(Zypper & zypper);