Author: dmacvicar Date: Thu Oct 25 16:04:54 2007 New Revision: 7635 URL: http://svn.opensuse.org/viewcvs/zypp?rev=7635&view=rev Log: - Add zmd-solver-testcase binary which allows for easy generation of solver testcases from zmd.db during development and afterwards during maintainance. - bump version for SP2 Added: branches/SuSE-SLE-10-SP2-Branch/backend/src/zmd-solver-testcase.cc Modified: branches/SuSE-SLE-10-SP2-Branch/backend/VERSION branches/SuSE-SLE-10-SP2-Branch/backend/package/libzypp-zmd-backend.changes branches/SuSE-SLE-10-SP2-Branch/backend/src/Makefile.am Modified: branches/SuSE-SLE-10-SP2-Branch/backend/VERSION URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-SLE-10-SP2-Branch/backend... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/backend/VERSION (original) +++ branches/SuSE-SLE-10-SP2-Branch/backend/VERSION Thu Oct 25 16:04:54 2007 @@ -1 +1 @@ -m4_define([BACKEND_VERSION], [7.1.1.0_0.9]) +m4_define([BACKEND_VERSION], [7.1.1.0_2.9]) Modified: branches/SuSE-SLE-10-SP2-Branch/backend/package/libzypp-zmd-backend.changes URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-SLE-10-SP2-Branch/backend... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/backend/package/libzypp-zmd-backend.changes (original) +++ branches/SuSE-SLE-10-SP2-Branch/backend/package/libzypp-zmd-backend.changes Thu Oct 25 16:04:54 2007 @@ -1,4 +1,13 @@ ------------------------------------------------------------------- +Thu Oct 25 16:03:03 CEST 2007 - duncan@suse.de + +- Add zmd-solver-testcase binary which allows for easy generation of + solver testcases from zmd.db during development and afterwards + during maintainance. +- SP2 branch version will be 7.1.1.0_2.x +- version 7.1.1.0_2.0 + +------------------------------------------------------------------- Fri Jul 20 13:14:19 CEST 2007 - ma@suse.de - Use capability name, not index, when storing capabilities. (#288422) Modified: branches/SuSE-SLE-10-SP2-Branch/backend/src/Makefile.am URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-SLE-10-SP2-Branch/backend... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/backend/src/Makefile.am (original) +++ branches/SuSE-SLE-10-SP2-Branch/backend/src/Makefile.am Thu Oct 25 16:04:54 2007 @@ -20,6 +20,7 @@ service-delete \ parse-metadata \ update-status \ + zmd-solver-testcase \ transact EXTRA_DIST = query-system.sh @@ -31,4 +32,4 @@ transact_SOURCES = transact.cc transactions.cc transactions.h RpmCallbacks.h MediaChangeCallback.h MessageResolvableReportCallback.h KeyRingCallbacks.h locks.cc locks.h parse_metadata_SOURCES = parse-metadata.cc KeyRingCallbacks.h update_status_SOURCES = update-status.cc locks.cc locks.h - +zmd_solver_testcase_SOURCES = zmd-solver-testcase.cc transactions.cc transactions.h locks.cc locks.h Added: branches/SuSE-SLE-10-SP2-Branch/backend/src/zmd-solver-testcase.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-SLE-10-SP2-Branch/backend... ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/backend/src/zmd-solver-testcase.cc (added) +++ branches/SuSE-SLE-10-SP2-Branch/backend/src/zmd-solver-testcase.cc Thu Oct 25 16:04:54 2007 @@ -0,0 +1,107 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ + +#include <iostream> +#include <string> + +#include "dbsource/zmd-backend.h" + +#include <zypp/ZYpp.h> +#include <zypp/ZYppFactory.h> +#include <zypp/VendorAttr.h> +#include <zypp/base/Logger.h> +#include <zypp/base/Exception.h> + +using namespace std; +using namespace zypp; + +#include <sqlite3.h> +#undef ZYPP_BASE_LOGGER_LOGGROUP +#define ZYPP_BASE_LOGGER_LOGGROUP "resolve-dependencies" + +#include "dbsource/DbAccess.h" +#include "dbsource/DbSources.h" +#include "KeyRingCallbacks.h" + +#include "transactions.h" +#include "locks.h" +#include <zypp/solver/detail/ResolverInfo.h> + +using solver::detail::ResolverInfo_Ptr; + +//----------------------------------------------------------------------------- + +int +main (int argc, char **argv) +{ + if (argc < 3) + { + cerr << "usage: " << argv[0] << " zmd-db test-case-output-path" << endl; + return 1; + } + + const char *logfile = getenv("ZYPP_LOGFILE"); + if (logfile != NULL) + zypp::base::LogControl::instance().logfile( logfile ); + else + zypp::base::LogControl::instance().logfile( ZMD_BACKEND_LOG ); + + MIL << "-------------------------------------" << endl; + MIL << "START zmd-solver-testcase " << argv[1] << endl; + + // access the sqlite db + + DbAccess db (argv[1]); + if (!db.openDb(false)) + return 1; + + // we honor zmd locks, so disable autoprotecton of + // foreign vendors + zypp::VendorAttr::disableAutoProtect(); + + ZYpp::Ptr God = backend::getZYpp( true ); + KeyRingCallbacks keyring_callbacks; + DigestCallbacks digest_callbacks; + + Target_Ptr target = backend::initTarget( God ); + + // load the catalogs and resolvables from sqlite db + + DbSources dbs(db.db()); + + const SourcesList & sources = dbs.sources(); + + for (SourcesList::const_iterator it = sources.begin(); it != sources.end(); ++it) + { + zypp::ResStore store = it->resolvables(); + MIL << "Catalog " << it->id() << " contributing " << store.size() << " resolvables" << endl; + God->addResolvables( store, (it->id() == "@system") ); + } + + // update-status is supposed to do this + // but resolvables dont have a status yet + God->resolver()->establishPool(); + + // now the pool is complete, add transactions + + // read locks first + read_locks (God->pool(), db.db()); + + int removals = 0; // unused here + IdItemMap transacted_items; // unused here + + bool have_best_package = false; + + int count = read_transactions( God->pool(), db.db(), dbs, removals, transacted_items, have_best_package ); + if (count < 0) + return 1; + + MIL << "Processing " << count << " transactions" << endl; + bool success = true; + God->resolver()->createSolverTestcase ( argv[2] ); + + db.closeDb(); + + MIL << "END zmd-testcase, result " << (success ? 0 : 1) << endl; + + return (success ? 0 : 1); +} -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org