zypper port starts. zypp2 to zypp
[platform/upstream/libzypp.git] / devel / devel.dmacvicar / target_iterate_by_kind.cc
1 #include <iostream>
2 #include <fstream>
3 #include <sstream>
4 #include <streambuf>
5
6 #include "boost/filesystem/operations.hpp" // includes boost/filesystem/path.hpp
7 #include "boost/filesystem/fstream.hpp"    // ditto
8
9 #include <boost/iostreams/device/file_descriptor.hpp>
10
11 #include <zypp/base/Logger.h>
12 #include <zypp/Locale.h>
13 #include <zypp/ZYpp.h>
14 #include <zypp/ZYppFactory.h>
15 #include <zypp/TranslatedText.h>
16 ///////////////////////////////////////////////////////////////////
17
18 #include <zypp/base/Logger.h>
19
20
21 #include <map>
22 #include <set>
23
24 #include "zypp/CapFactory.h"
25 #include "zypp/KeyRing.h"
26 #include "zypp/Product.h"
27 #include "zypp/Selection.h"
28 #include "zypp/PublicKey.h"
29
30 #include "zypp/ZYppFactory.h"
31
32 #include "zypp/MediaSetAccess.h"
33 #include "zypp/source/yum/YUMSourceCacher.h"
34
35 using namespace zypp::detail;
36
37 using namespace std;
38 using namespace zypp;
39 using namespace zypp::source;
40 //using namespace DbXml;
41
42 #define TestKind Selection
43
44 int main()
45 {
46   //MediaSetAccess ma( Url("cd:///"), Pathname("/"));
47   //MIL << "done 1" << std::endl;
48   //ChecksumFileChecker checker(CheckSum("sha1", "fa0abb22f703a3a41f7a39f0844b24daf572fd4c"));
49   //Pathname local = ma.provideFile("content", 1, checker);
50   //MIL << local << std::endl;
51   try
52   {
53     //zypp::source::yum::YUMSourceCacher cacher(Pathname("/"));
54     //cacher.cache( Url("dir:/space/tmp/factory-yum"), Pathname("/"));
55     ZYpp::Ptr z = getZYpp();
56     z->initializeTarget("/");
57     
58     for (ResStore::resfilter_const_iterator it = z->target()->byKindBegin(ResTraits<TestKind>::kind); it != z->target()->byKindEnd(ResTraits<TestKind>::kind); ++it)
59     {
60       zypp::TestKind::constPtr res = asKind<const zypp::TestKind>( *it );
61       MIL << res->name() << " " << res->edition() << std::endl;
62     }
63     
64   }
65   catch ( const Exception &e )
66   {
67     MIL << "Sorry, bye" << endl;
68   }
69 }
70
71