- Parse and provide package keywords. (Fate 120368)
authorMichael Andres <ma@suse.de>
Wed, 11 Apr 2007 13:34:51 +0000 (13:34 +0000)
committerMichael Andres <ma@suse.de>
Wed, 11 Apr 2007 13:34:51 +0000 (13:34 +0000)
zypp/Package.cc
zypp/Package.h
zypp/detail/PackageImplIf.cc
zypp/detail/PackageImplIf.h
zypp/source/susetags/PackagesParser.cc
zypp/source/susetags/SuseTagsPackageImpl.cc
zypp/source/susetags/SuseTagsPackageImpl.h
zypp/source/yum/YUMPackageImpl.cc
zypp/source/yum/YUMPackageImpl.h
zypp/target/rpm/RpmPackageImpl.cc
zypp/target/rpm/RpmPackageImpl.h

index bd452c3..54560d3 100644 (file)
@@ -70,6 +70,8 @@ namespace zypp
   PackageGroup Package::group() const
   { return pimpl().group(); }
 
+  Package::Keywords Package::keywords() const
+  { return pimpl().keywords(); }
 
   /** Don't ship it as class Url, because it might be
    * in fact anything but a legal Url. */
index b3b5aad..3e1e4f3 100644 (file)
@@ -29,7 +29,6 @@ namespace zypp
   */
   class Package : public ResObject
   {
-
   public:
     typedef detail::PackageImplIf    Impl;
     typedef Package                  Self;
@@ -38,6 +37,9 @@ namespace zypp
     typedef TraitsType::constPtrType constPtr;
 
   public:
+    typedef std::set<PackageKeyword> Keywords;
+
+  public:
     /**
      * Checksum the source says this package should have
      */
@@ -54,6 +56,8 @@ namespace zypp
     std::string packager() const;
     /** */
     PackageGroup group() const;
+    /** */
+    Keywords keywords() const;
     /** Don't ship it as class Url, because it might be
      * in fact anything but a legal Url. */
     std::string url() const;
index d54cb50..888d670 100644 (file)
@@ -44,6 +44,9 @@ namespace zypp
       PackageGroup PackageImplIf::group() const
       { return PackageGroup(); }
 
+      PackageImplIf::Keywords PackageImplIf::keywords() const
+      { return std::set<PackageKeyword>(); }
+
       Changelog PackageImplIf::changelog() const
       { return Changelog(); }
 
index 5c7e440..a813090 100644 (file)
@@ -20,6 +20,7 @@
 #include "zypp/Arch.h"
 #include "zypp/Changelog.h"
 #include "zypp/DiskUsage.h"
+#include "zypp/PackageKeyword.h"
 #include "zypp/source/PackageDelta.h"
 
 ///////////////////////////////////////////////////////////////////
@@ -46,6 +47,7 @@ namespace zypp
     public:
       typedef packagedelta::DeltaRpm    DeltaRpm;
       typedef packagedelta::PatchRpm    PatchRpm;
+      typedef std::set<PackageKeyword>  Keywords;
 
     public:
       /** \name Rpm Package Attributes. */
@@ -63,6 +65,8 @@ namespace zypp
       /** */
       virtual PackageGroup group() const PURE_VIRTUAL;
       /** */
+      virtual Keywords keywords() const PURE_VIRTUAL;
+      /** */
       virtual Changelog changelog() const PURE_VIRTUAL;
       /** */
       virtual Pathname location() const PURE_VIRTUAL;
index 848d740..439faca 100644 (file)
@@ -356,13 +356,12 @@ struct PackagesParser : public parser::tagfile::TagFileParser
     {
       collectDeps( mtag_r.values, _nvrad[Dep::ENHANCES] );
     }
-    else if ( mtag_r.name == "Key" )
+    else if ( mtag_r.name == "Kwd" )
     {
-      _pkgImpl->_keywords = mtag_r.values;
+      _pkgImpl->_keywords.insert( mtag_r.values.begin(), mtag_r.values.end() );
     }
     else if ( mtag_r.name == "Aut" )
     {
-      // MultiTag is a Set but author is a list
       _pkgImpl->_authors = mtag_r.values;
     }
   }
index 65b50c6..5410f88 100644 (file)
@@ -124,6 +124,11 @@ PackageGroup SuseTagsPackageImpl::group() const
   return _group;
 }
 
+SuseTagsPackageImpl::Keywords SuseTagsPackageImpl::keywords() const
+{
+  return _keywords;
+}
+
 Changelog SuseTagsPackageImpl::changelog() const
 {
   return Changelog();
index 6f1e03e..3cd06cb 100644 (file)
@@ -68,7 +68,9 @@ namespace zypp
         /** */
         virtual PackageGroup group() const;
         /** */
-        virtual Changelog changelog() const;
+       virtual Keywords keywords() const;
+       /** */
+       virtual Changelog changelog() const;
         /** */
         virtual Pathname location() const;
         /** Don't ship it as class Url, because it might be
@@ -109,8 +111,8 @@ namespace zypp
         NVRA _nvra;
 
         PackageGroup _group;
+       Keywords _keywords;
         std::list<std::string> _authors;
-        std::list<std::string> _keywords;
         ByteCount _size;
         ByteCount _archivesize;
         Vendor _vendor;
index e8c9e29..959b191 100644 (file)
@@ -53,7 +53,7 @@ YUMPackageImpl::YUMPackageImpl(
     _changelog(), // TODO
     _type(parsed.type),
     _authors(parsed.authors),
-    _keywords( parsed.keywords),
+    _keywords( parsed.keywords.begin(), parsed.keywords.end() ),
     _mediaNumber(str::strtonum<unsigned int>(parsed.media)),
     _checksum(parsed.checksumType,
               parsed.checksum),
@@ -65,14 +65,6 @@ YUMPackageImpl::YUMPackageImpl(
     _package_size(str::strtonum<unsigned int>(parsed.sizePackage)),
     _size(str::strtonum<unsigned int>(parsed.sizeInstalled)),
     _source(source_r)
-#if 0
-    :
-    _size_package(strtol(parsed.sizePackage.c_str(), 0, 10)),
-    _size_archive(strtol(parsed.sizeArchive.c_str(), 0, 10)),
-    _size_installed(strtol(parsed.sizeInstalled.c_str(), 0, 10)),
-    _sourcepkg(parsed.sourcerpm),
-    _dir_sizes(parsed.dirSizes),
-#endif
 {
   for (std::list<FileData>::const_iterator it = filelist.files.begin();
        it != filelist.files.end();
@@ -250,7 +242,7 @@ std::string YUMPackageImpl::type() const
 }
 
 /** */
-std::list<std::string> YUMPackageImpl::keywords() const
+YUMPackageImpl::Keywords YUMPackageImpl::keywords() const
 {
   return _keywords;
 }
index 7615cad..5b7e7e8 100644 (file)
@@ -97,7 +97,7 @@ public:
   /** */
   virtual std::string type() const;
   /** */
-  virtual std::list<std::string> keywords() const;
+  virtual Keywords keywords() const;
   /** */
   virtual bool installOnly() const;
   /** */
@@ -123,7 +123,7 @@ protected:
   Changelog _changelog;
   std::string _type;
   std::list<std::string> _authors;
-  std::list<std::string> _keywords;
+  Keywords _keywords;
   unsigned _mediaNumber;
   CheckSum _checksum;
   std::list<std::string> _filenames;
index 68c52bd..452a2f5 100644 (file)
@@ -50,17 +50,10 @@ namespace zypp
        _group(data->tag_group()),
        _changelog(data->tag_changelog()),
        _type("rpm"), // FIXME in the future
-//     _authors(data->authors),
-//     _keywords(data->keywords),
        _filenames(data->tag_filenames()),
 //     _disk_usage(data->diskusage),
        _size(data->tag_size()),
        _archivesize(data->tag_archivesize())
-#if 0
-       _size_installed( strtol(parsed.sizeInstalled.c_str(), 0, 10)),
-       _sourcepkg( parsed.sourcerpm),
-       _dir_sizes(parsed.dirSizes),
-#endif
       {
         // we know we are reading english.
         _description.setText(data->tag_description(), Locale("en"));
@@ -159,10 +152,6 @@ namespace zypp
       { return _archivesize; }
 
       /** */
-      std::list<std::string> RPMPackageImpl::authors() const
-      { return _authors; }
-
-      /** */
       std::list<std::string> RPMPackageImpl::filenames() const
       { return _filenames; }
 
@@ -171,10 +160,6 @@ namespace zypp
       { return _type; }
 
       /** */
-      std::list<std::string> RPMPackageImpl::keywords() const
-      { return _keywords; }
-
-      /** */
       DiskUsage RPMPackageImpl::diskUsage() const
       { return _disk_usage; }
 
index b4d722f..48a192d 100644 (file)
@@ -85,14 +85,10 @@ namespace zypp
        /** */
        virtual ByteCount archivesize() const;
        /** */
-       virtual std::list<std::string> authors() const;
-       /** */
        virtual std::list<std::string> filenames() const;
         /** */
         virtual std::string type() const;
         /** */
-        virtual std::list<std::string> keywords() const;
-        /** */
         virtual DiskUsage diskUsage() const;
         /** */
         virtual Source_Ref source() const;
@@ -115,8 +111,6 @@ namespace zypp
        Changelog _changelog;
        Pathname _location;                     // for 'local' rpms
        std::string _type;
-       std::list<std::string> _authors;
-       std::list<std::string>_keywords;
        std::list<std::string> _filenames;
        DiskUsage _disk_usage;
        ByteCount _size;