From: Klaus Kaempf Date: Fri, 24 Feb 2006 12:36:47 +0000 (+0000) Subject: add "--arch" option to test on foreign architectures X-Git-Tag: BASE-SuSE-SLE-10-SP2-Branch~1923 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=24518c6d2bde492f54170cf87997896f8b286e2e;p=platform%2Fupstream%2Flibzypp.git add "--arch" option to test on foreign architectures --- diff --git a/testsuite/source/tests/suseparser.cc b/testsuite/source/tests/suseparser.cc index c644016..4049a1a 100644 --- a/testsuite/source/tests/suseparser.cc +++ b/testsuite/source/tests/suseparser.cc @@ -1,6 +1,8 @@ // test for SUSE Source // +#include + #include #include #include @@ -14,6 +16,8 @@ #include "zypp/base/LogControl.h" #include "zypp/SourceFactory.h" #include "zypp/Source.h" +#include "zypp/ZYpp.h" +#include "zypp/ZYppFactory.h" #include "zypp/source/SourceImpl.h" #include "zypp/media/MediaManager.h" @@ -31,15 +35,24 @@ using namespace zypp; int main( int argc, char * argv[] ) { if (argc < 2) { - cerr << "Usage: suseparse [all|reallyall]" << endl; + cerr << "Usage: suseparse [--arch x] [all|reallyall]" << endl; exit (1); } zypp::base::LogControl::instance().logfile( "-" ); INT << "===[START]==========================================" << endl; + ZYpp::Ptr God = zypp::getZYpp(); + + int argpos = 1; + + if (strcmp( argv[argpos], "--arch") == 0) { + ++argpos; + God->setArchitecture( Arch( argv[argpos] ) ); + ++argpos; + } Pathname p; - Url url(argv[1]); + Url url( argv[argpos++] ); string alias("suseparse"); Locale lang( "en" ); @@ -68,12 +81,12 @@ int main( int argc, char * argv[] ) INT << "\t" << patcount << " patterns" << endl; INT << "\t" << prdcount << " products" << endl; - if (argc > 2) { + if (argpos < argc) { int count = 0; for (ResStore::iterator it = store.begin(); it != store.end(); ++it) { ResObject::Ptr robj = *it; MIL << ++count << *robj << endl; - if (strcmp(argv[2], "reallyall") == 0) { + if (strcmp(argv[argpos], "reallyall") == 0) { const Dependencies & deps = robj->deps(); MIL << deps << endl; }