Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

ULPackagesParser.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013   File:         ULPackagesParser.h
00014 
00015   Author:       Klaus Kaempf <kkaempf@suse.de>
00016   Maintainer:   Klaus Kaempf <kkaempf@suse.de>
00017 
00018   Purpose: Parse UnitedLinux compatible selection files
00019 
00020 /-*/
00021 #ifndef ULPackagesParser_h
00022 #define ULPackagesParser_h
00023 
00024 #include <string>
00025 #include <list>
00026 #include <map>
00027 #include <utility>
00028 #include <fstream>
00029 
00030 #include <y2util/Pathname.h>
00031 #include <y2util/LangCode.h>
00032 #include <y2util/TaggedParser.h>
00033 #include <y2util/TaggedFile.h>
00034 #include <y2util/TagCacheRetrievalPtr.h>
00035 
00036 #include <y2pm/PMError.h>
00037 #include <y2pm/MediaAccessPtr.h>
00038 
00039 #include <y2pm/PkgArch.h>
00040 
00041 #include <y2pm/PMPackagePtr.h>
00042 #include <y2pm/PMULPackageDataProviderPtr.h>
00043 #include <y2pm/InstSrcPtr.h>
00044 
00045 #include <y2pm/ULPackagesParserPtr.h>
00046 
00047 class ULPackagesParser : public CountedRep {
00048     private:
00049         // the source
00050         const InstSrcPtr _source;
00051 
00052         // tag ids for the TaggedParser
00053         enum Tags {
00054             PACKAGE,    // name version release arch
00055             REQUIRES,   // list of requires tags
00056             PREREQUIRES,// list of pre-requires tags
00057             PROVIDES,   // list of provides tags
00058             CONFLICTS,  // list of conflicts tags
00059             OBSOLETES,  // list of obsoletes tags
00060             RECOMMENDS, // list of recommends tags
00061             SUGGESTS,   // list of suggests tags
00062             LOCATION,   // file location
00063             SIZE,       // packed and unpacked size
00064             BUILDTIME,  // buildtime
00065             SOURCERPM,  // source package
00066             GROUP,      // rpm group
00067             LICENSE,    // license
00068             AUTHORS,    // list of authors
00069             SHAREWITH,  // package to share data with
00070             KEYWORDS,   // list of keywords
00071 
00072             // packages.<locale>
00073 
00074             SUMMARY,    // short summary (label)
00075             DESCRIPTION,// long description
00076             INSNOTIFY,  // install notification
00077             DELNOTIFY,  // delete notification
00078             LICENSETOCONFIRM,   // license to confirm upon install
00079 
00080             // packages.DU
00081             DU,         // disk usage data
00082 
00083             NUM_TAGS
00084         };
00085 
00086 
00087         // our parser
00088         TaggedParser _parser;
00089         // our set of tags, initialized in constructor
00090         TaggedFile::TagSet _tagset;
00091 
00092         // list of currently allowed archs
00093         std::list<PkgArch> _allowed_archs;
00094 
00095         // map of our currently known packages
00096         // key == "package version release architecture" as used in "=Pkg:"
00097         // and "=Shr:" tags
00098         typedef std::map <std::string, std::pair<PMPackagePtr, PMULPackageDataProviderPtr> > pkgmaptype;
00099         pkgmaptype _pkgmap;
00100 
00101         // look if arch is allowed
00102         bool allowedArch (const PkgArch& arch) const;
00103 
00104         // create package from tagset and cache and add to _pkgmap
00105         PMError fromCache (TagCacheRetrievalPtr pkgcache, TagCacheRetrievalPtr localecache, TagCacheRetrievalPtr ducache);
00106 
00107         // augment package data (_pkgmap) with data from packages.<locale> cache
00108         PMError fromLocale ();
00109 
00110         // augment package data (_pkgmap) with data from packages.DU cache
00111         PMError fromDU ();
00112 
00113         // parse 'packages' from path to _pkgmap
00114         // localepath is only for initialization of the dataprovider
00115         // fromPathLocale() does the parsing of the locale file
00116         PMError fromPath (const Pathname& path, const Pathname& localepath, const Pathname& dupath);
00117 
00118         // augment _pkgmap data from 'packages.<locale>' at path
00119         PMError fromPathLocale (const Pathname& path);
00120 
00121         // augment _pkgmap data from 'packages.DU' at path
00122         PMError fromPathDU (const Pathname& path);
00123 
00124     public:
00125         ULPackagesParser (const InstSrcPtr source);
00126         ~ULPackagesParser();
00127 
00133         PMError fromMediaDir (std::list<PMPackagePtr>& packages,
00134                 MediaAccessPtr media_r, const Pathname& descr_dir_r,
00135                 const std::list<PkgArch>& allowed_archs, const LangCode& locale);
00136 
00137 };
00138 
00139 #endif //ULPackagesParser_h

Generated on Fri Nov 9 14:30:32 2007 for yast2-packagemanager by doxygen 1.3.6