Author: jkupec Date: Fri Aug 10 14:47:33 2007 New Revision: 6580 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6580&view=rev Log: - Added global option --root to operate on a different directory (#238165, F#301963) (backport from trunk) Modified: branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-misc.cc branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-sources.cc branches/SuSE-Linux-10_2-Branch/zypper/src/zmart.h branches/SuSE-Linux-10_2-Branch/zypper/src/zypper.cc Modified: branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-misc.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-misc.cc?rev=6580&r1=6579&r2=6580&view=diff ============================================================================== --- branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-misc.cc (original) +++ branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-misc.cc Fri Aug 10 14:47:33 2007 @@ -24,10 +24,10 @@ if (!done) { #ifdef LIBZYPP_1xx cerr_v << _("Initializing Target") << _(" (old way)") << endl; - God->initTarget("/", true); + God->initTarget(gSettings.root_dir, true); #else cerr_v << _("Initializing Target") << endl; - God->initializeTarget("/"); + God->initializeTarget(gSettings.root_dir); #endif done = true; } Modified: branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-sources.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-sources.cc?rev=6580&r1=6579&r2=6580&view=diff ============================================================================== --- branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-sources.cc (original) +++ branches/SuSE-Linux-10_2-Branch/zypper/src/zmart-sources.cc Fri Aug 10 14:47:33 2007 @@ -46,7 +46,7 @@ try { cerr << _("Restoring system sources...") << endl; - manager->restore("/"); + manager->restore(gSettings.root_dir); } // catch (const SourcesAlreadyRestoredException& excpt) { // } @@ -151,10 +151,10 @@ try { #ifdef LIBZYPP_1xx - sources = SourceManager::sourceManager()->knownSourceInfos ("/"); + sources = SourceManager::sourceManager()->knownSourceInfos (gSettings.root_dir); #else zypp::storage::PersistentStorage store; - store.init( "/" ); + store.init( gSettings.root_dir ); sources = store.storedSources(); #endif } @@ -233,7 +233,7 @@ cerr_vv << "Constructing SourceManager" << endl; SourceManager_Ptr manager = SourceManager::sourceManager(); cerr_vv << "Restoring SourceManager" << endl; - manager->restore ("/", true /*use_cache*/); + manager->restore (gSettings.root_dir, true /*use_cache*/); listSourceManager::SourceId sourceIds; @@ -276,7 +276,7 @@ } cerr_vv << "Storing source data" << endl; - manager->store( "/", true /*metadata_cache*/ ); + manager->store( gSettings.root_dir, true /*metadata_cache*/ ); } template<typename T> @@ -320,7 +320,7 @@ SourceManager_Ptr manager = SourceManager::sourceManager(); cerr_vv << "Restoring SourceManager" << endl; try { - manager->restore ("/", true /*use_cache*/); + manager->restore (gSettings.root_dir, true /*use_cache*/); } catch (const Exception & ex) { // so what if sources cannot be restored @@ -383,7 +383,7 @@ } cerr_vv << "Storing source data" << endl; - manager->store( "/", true /*metadata_cache*/ ); + manager->store( gSettings.root_dir, true /*metadata_cache*/ ); } //! rename a source, identified in any way: alias, url, id @@ -396,7 +396,7 @@ cerr_vv << "Constructing SourceManager" << endl; SourceManager_Ptr manager = SourceManager::sourceManager(); cerr_vv << "Restoring SourceManager" << endl; - manager->restore ("/", true /*use_cache*/); + manager->restore (gSettings.root_dir, true /*use_cache*/); Source_Ref src; @@ -454,7 +454,7 @@ } cerr_vv << "Storing source data" << endl; - manager->store( "/", true /*metadata_cache*/ ); + manager->store( gSettings.root_dir, true /*metadata_cache*/ ); #endif } @@ -468,7 +468,7 @@ try { - store.init( "/" ); + store.init( gSettings.root_dir ); sources = store.storedSources(); } catch ( const Exception &e ) Modified: branches/SuSE-Linux-10_2-Branch/zypper/src/zmart.h URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-10_2-Branch/zypper/src/zmart.h?rev=6580&r1=6579&r2=6580&view=diff ============================================================================== --- branches/SuSE-Linux-10_2-Branch/zypper/src/zmart.h (original) +++ branches/SuSE-Linux-10_2-Branch/zypper/src/zmart.h Fri Aug 10 14:47:33 2007 @@ -52,6 +52,7 @@ disable_system_sources(false), disable_system_resolvables(false), is_rug_compatible(false), + root_dir("/"), non_interactive(false) {} @@ -63,6 +64,7 @@ bool disable_system_sources; bool disable_system_resolvables; bool is_rug_compatible; + std::string root_dir; bool non_interactive; }; @@ -107,4 +109,7 @@ // define new _ macro #define _(MSG) ::gettext(MSG) +// Local Variables: +// c-basic-offset: 2 +// End: #endif Modified: branches/SuSE-Linux-10_2-Branch/zypper/src/zypper.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-10_2-Branch/zypper/src/zypper.cc?rev=6580&r1=6579&r2=6580&view=diff ============================================================================== --- branches/SuSE-Linux-10_2-Branch/zypper/src/zypper.cc (original) +++ branches/SuSE-Linux-10_2-Branch/zypper/src/zypper.cc Fri Aug 10 14:47:33 2007 @@ -57,6 +57,7 @@ {"terse", no_argument, 0, 't'}, {"table-style", required_argument, 0, 's'}, {"rug-compatible", no_argument, 0, 'r'}, + {"root", required_argument, 0, 'R'}, {"non-interactive", no_argument, 0, 0}, {"opt", optional_argument, 0, 'o'}, {0, 0, 0, 0} @@ -129,6 +130,7 @@ "\t--terse, -t\t\tTerse output for machine consumption\n" "\t--table-style, -s\tTable style (integer)\n" "\t--rug-compatible, -r\tTurn on rug compatibility\n" + "\t--root, -R <dir>\tOperate on a different root directory\n" "\t--non-interactive\tDon't ask anything, use default answers automatically. (under development)\n"); ; @@ -155,6 +157,12 @@ else cerr << _("Invalid table style ") << s << endl; } + + if (gopts.count("root")) { + gSettings.root_dir = gopts["root"].front(); + } + + // testing option if (gopts.count("opt")) { cerr << "Opt arg: "; -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org