2 // Read a directory with rpms as a source
3 // No need for metadata, it is read from the rpms
5 #include <zypp/base/Logger.h>
7 #include <zypp/ZYppFactory.h>
9 #include "zypp/Product.h"
10 #include "zypp/Package.h"
12 #include "zypp/SourceFactory.h"
16 using namespace zypp::source;
19 main (int argc, char **argv)
22 cerr << "1|usage: " << argv[0] << " <dir:/somepath>" << endl;
28 ZYpp::Ptr z = getZYpp();
30 // plaindir sources are not signed so we don't need to initialize the
31 // target to import the system public keys.
32 //z->initializeTarget("/");
34 Source_Ref source = SourceFactory().createFrom( Url(argv[1]), "/", "testsource", Pathname() );
35 ResStore store = source.resolvables();
36 //zypp::testsuite::utils::dump(store, true, true);
38 for (ResStore::const_iterator it = store.begin(); it != store.end(); ++it)
40 zypp::Package::Ptr res = asKind<zypp::Package>( *it );
41 MIL << res->name() << " " << res->edition() << " " << res->location() << std::endl;
45 catch ( const Exception &e )
47 MIL << "Exception ocurred, bye" << endl;