#include <zypp/base/Algorithm.h>
#include <zypp/solver/detail/Helper.h>
+#include <zypp/RepoManager.h>
+#include <zypp/RepoInfo.h>
+#include <zypp/repo/RepoException.h>
+
using namespace zypp::detail;
using namespace std;
void cond_load_resolvables ()
{
- // something changed
+ // load repository resolvables
load_sources();
-
+
+ // load target resolvables
if ( ! gSettings.disable_system_resolvables ) {
load_target();
}
}
}
+
+/** read repository resolvables */
+void load_repo_resolvables()
+{
+ RepoManager manager;
+
+ for (std::list<RepoInfo>::iterator it = gData.repos.begin();
+ it != gData.repos.end(); ++it)
+ {
+ RepoInfo repo(*it);
+
+ if (! it->enabled())
+ continue; // #217297
+
+ Repository repository;
+
+ try {
+ repository = manager.createFromCache(repo);
+ }
+ catch ( const repo::RepoNotCachedException &e )
+ {
+ ZYPP_CAUGHT(e);
+ cout_v << "Repository " << repo.alias() << " not cached. Caching..." << endl;
+ manager.buildCache(repo);
+ repository = manager.createFromCache(repo);
+ }
+
+ ResStore store = repository.resolvables();
+ //! \todo use format
+ cout_vv << "(" << store.size() << " resolvables found)" << endl;
+
+ God->addResolvables(store);
+ }
+
+}
+
void establish ()
{
cerr_v << _("Establishing status of aggregates") << endl;
void cond_load_resolvables ();
void load_target();
void load_sources();
+void load_repo_resolvables();
void establish ();
bool resolve();
void dump_pool ();
#include <zypp/target/store/PersistentStorage.h>
#include <zypp/base/IOStream.h>
+#include <zypp/RepoManager.h>
+#include <zypp/RepoInfo.h>
+
using namespace zypp::detail;
}
done = true;
}
+/*
+void cond_init_system_sources ()
+{
+ static bool done = false;
+ //! \todo this has to be done so that it works in zypper shell
+ if (done)
+ return;
+ if ( ! gSettings.disable_system_sources ) {
+ init_system_sources();
+ }
+
+ done = true;
+}
+*/
+// OLD
void init_system_sources()
{
SourceManager_Ptr manager;
}
}
+/** reads known repositories and stores them into gData, does refresh */
+void init_repos()
+{
+ RepoManager manager;
+ gData.repos = manager.knownRepositories();
+
+ for (std::list<RepoInfo>::iterator it = gData.repos.begin();
+ it != gData.repos.end(); ++it)
+ {
+ RepoInfo repo(*it);
+
+// bool do_refresh = repo.autorefresh(); //! \todo honor command line options/commands
+ bool do_refresh = false;
+
+ if (do_refresh)
+ {
+ //! \todo progress reporting
+ cout << "Refreshing " << repo.alias() << endl;
+ manager.refreshMetadata(repo);
+ }
+ }
+}
+
+
void include_source_by_url( const Url &url )
{
try
#include "zypp/Url.h"
//! calls init_system_sources if not disabled by user (or non-root)
-void cond_init_system_sources();
-void init_system_sources();
+void cond_init_system_sources(); // OLD
+void init_system_sources(); // OLD
+void init_repos();
void include_source_by_url( const zypp::Url &url );
bool parse_repo_file (const std::string& file, std::string& url, std::string& alias);
void add_source_by_url( const zypp::Url &url, const std::string &alias,
#include <zypp/Digest.h>
#include <zypp/CapFactory.h>
+#include <zypp/RepoInfo.h>
+
#define ZYPP_CHECKPATCHES_LOG "/var/log/zypper.log"
#undef ZYPP_BASE_LOGGER_LOGGROUP
#define ZYPP_BASE_LOGGER_LOGGROUP "zypper"
{}
std::list<Error> errors;
+ // deprecated
std::list<zypp::Source_Ref> sources;
+ std::list<zypp::RepoInfo> repos;
int patches_count;
int security_patches_count;
std::vector<std::string> packages_to_install;
// --------------------------( remove/install )-----------------------------
else if (command == "install" || command == "in" ||
- command == "remove" || command == "rm") {
+ command == "remove" || command == "rm") {
if (command == "install" || command == "in") {
if (ghelp || arguments.size() < 1) {
- cerr << "install [options] name...\n"
- << specific_help
- ;
+ cerr << "install [options] name...\n" << specific_help;
return !ghelp;
}
gData.packages_to_uninstall = arguments;
}
+ // read resolvable type
string skind = copts.count("type")? copts["type"].front() : "package";
kind = string_to_kind (skind);
if (kind == ResObject::Kind ()) {
return ZYPPER_EXIT_ERR_INVALID_ARGS;
}
- cond_init_system_sources ();
+ init_repos();
+ //! \todo support temporary additional sources
+ /*
for ( std::list<Url>::const_iterator it = gSettings.additional_sources.begin(); it != gSettings.additional_sources.end(); ++it )
- {
- include_source_by_url( *it );
- }
-
- if ( gData.sources.empty() )
- {
- cerr << _("Warning: No sources. Operating only with the installed resolvables. Nothing can be installed.") << endl;
- }
+ {
+ include_source_by_url( *it );
+ }
+ */
+
+ if ( gData.repos.empty() )
+ {
+ cerr << _("Warning: No sources. Operating only with the installed resolvables. Nothing can be installed.") << endl;
+ }
cond_init_target ();
- cond_load_resolvables ();
+ cout_v << "loading repo resolvables... ";
+ load_repo_resolvables();
+ cout_v << "DONE" << endl;
for ( vector<string>::const_iterator it = arguments.begin(); it != arguments.end(); ++it ) {
if (command == "install" || command == "in") {
- mark_for_install(kind, *it);
+ mark_for_install(kind, *it);
}
else {
- mark_for_uninstall(kind, *it);
+ mark_for_uninstall(kind, *it);
}
}