Author: mlandres
Date: Tue May 15 17:23:30 2007
New Revision: 5552
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5552&view=rev
Log:
updated data:: resolvable classes.
Modified:
trunk/libzypp/zypp/base/String.h
trunk/libzypp/zypp/data/ResolvableData.cc
trunk/libzypp/zypp/data/ResolvableData.h
trunk/libzypp/zypp/data/ResolvableDataConsumer.h
trunk/libzypp/zypp/parser/susetags/PackagesFileReader.cc
trunk/libzypp/zypp/parser/susetags/PackagesLangFileReader.cc
trunk/libzypp/zypp/parser/susetags/PatternFileReader.cc
trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc
Modified: trunk/libzypp/zypp/base/String.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/String.h?rev=5552&r1=5551&r2=5552&view=diff
==============================================================================
--- trunk/libzypp/zypp/base/String.h (original)
+++ trunk/libzypp/zypp/base/String.h Tue May 15 17:23:30 2007
@@ -94,7 +94,7 @@
* helper to debug regular expressions matches
*/
std::ostream & dumpRegexpResult( const boost::smatch &what, std::ostream & str );
-
+
///////////////////////////////////////////////////////////////////
/** \name String representation of number.
*
@@ -180,7 +180,7 @@
* \endcode
*/
template<typename _It>
- inline _It strtonum( const std::string & str );
+ _It strtonum( const std::string & str );
template<>
inline short strtonum( const std::string & str ) { return ::strtol ( str.c_str(), NULL, 0 ); }
@@ -329,7 +329,7 @@
inline std::string stripPrefix( const std::string & str_r, const std::string & prefix_r )
{ return( hasPrefix( str_r, prefix_r ) ? str_r.substr( prefix_r.size() ) : str_r ); }
//@}
-
+
/////////////////////////////////////////////////////////////////
} // namespace str
///////////////////////////////////////////////////////////////////
Modified: trunk/libzypp/zypp/data/ResolvableData.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/data/ResolvableData.cc?rev=5552&r1=5551&r2=5552&view=diff
==============================================================================
--- trunk/libzypp/zypp/data/ResolvableData.cc (original)
+++ trunk/libzypp/zypp/data/ResolvableData.cc Tue May 15 17:23:30 2007
@@ -18,10 +18,8 @@
IMPL_PTR_TYPE(Resolvable);
IMPL_PTR_TYPE(ResObject);
-IMPL_PTR_TYPE(AtomBase);
IMPL_PTR_TYPE(Script);
IMPL_PTR_TYPE(Message);
-IMPL_PTR_TYPE(Selection);
IMPL_PTR_TYPE(Patch);
IMPL_PTR_TYPE(Pattern);
IMPL_PTR_TYPE(Product);
Modified: trunk/libzypp/zypp/data/ResolvableData.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/data/ResolvableData.h?rev=5552&r1=5551&r2=5552&view=diff
==============================================================================
--- trunk/libzypp/zypp/data/ResolvableData.h (original)
+++ trunk/libzypp/zypp/data/ResolvableData.h Tue May 15 17:23:30 2007
@@ -6,10 +6,11 @@
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-
-
-#ifndef ResolvableData_h
-#define ResolvableData_h
+/** \file zypp/data/ResolvableData.h
+ *
+*/
+#ifndef ZYPP_DATA_RESOLVABLEDATA_H
+#define ZYPP_DATA_RESOLVABLEDATA_H
#include <iosfwd>
#include <list>
@@ -18,6 +19,7 @@
#include "zypp/base/ReferenceCounted.h"
#include "zypp/base/NonCopyable.h"
+#include "zypp/data/RecordId.h"
#include "zypp/capability/CapabilityImpl.h"
#include "zypp/Pathname.h"
#include "zypp/NVR.h"
@@ -25,6 +27,7 @@
#include "zypp/ByteCount.h"
#include "zypp/Arch.h"
#include "zypp/CheckSum.h"
+#include "zypp/Changelog.h"
#include "zypp/Url.h"
#include "zypp/Date.h"
#include "zypp/TranslatedText.h"
@@ -33,24 +36,51 @@
{
namespace data
{
-
+ /** ::data dependencies are CapabilityImpl. */
typedef std::setcapability::CapabilityImpl::Ptr DependencyList;
- typedef std::map Dependencies;
+ typedef std::map Dependencies;
+
+ typedef DefaultIntegral MediaNr;
+
+ /** Data to retrieve a file from some media. */
+ struct Location
+ {
+ Location()
+ : fileSize( -1 ), gzSize( -1 )
+ {}
+
+ /** Media number (0==no media access required). */
+ MediaNr mediaNr;
+ /** Path on the media. */
+ Pathname filePath;
+ /** The uncompressed files size. */
+ ByteCount fileSize;
+ /** The uncompressed files checksum. */
+ CheckSum fileChecksum;
+ /** The compressed (gz) files size. */
+ ByteCount gzSize;
+ /** The compressed (gz) files checksum. */
+ CheckSum gzChecksum;
+ };
///////////////////////////////////////////////////////////////////
DEFINE_PTR_TYPE(Resolvable);
+ /** Mandatory resolvable data. */
class Resolvable : public base::ReferenceCounted, private base::NonCopyable
{
public:
Resolvable()
{};
+ /** Name */
std::string name;
+ /** Edition */
Edition edition;
+ /** Architecture */
Arch arch;
-
+ /** Dependencies */
Dependencies deps;
};
@@ -58,35 +88,43 @@
DEFINE_PTR_TYPE(ResObject);
+ /** Common resolvable data. */
class ResObject : public Resolvable
{
public:
ResObject()
- : source_media_nr(1), install_only(false)
{}
+ /** Share some data with another resolvable.*/
+ RecordId shareDataWith;
+
+ // Common attributes:
+ /** Vendor */
+ std::string vendor;
+ /** Installed size (UI hint). */
+ ByteCount installedSize;
+ /** Bildtime. */
+ Date buildTime;
+
+ // Flags:
+ /** 'rpm -i' mode. */
+ DefaultIntegral installOnly;
+
+ // Translated texts:
+ /** One line summary. */
TranslatedText summary;
+ /** Multiline description. */
TranslatedText description;
-
+ /** License to confirm. */
+ TranslatedText licenseToConfirm;
+ /** UI notification text if selected to install. */
TranslatedText insnotify;
+ /** UI notification text if selected to delete. */
TranslatedText delnotify;
- TranslatedText license_to_confirm;
- std::string vendor;
-
- /** Installed size. \see zypp::ResObject::size() */
- ByteCount size;
- /** RPM package size. \see zypp::ResObject::archive_size() */
- ByteCount archive_size;
-
- std::string source;
-
- int source_media_nr;
-
- bool install_only;
-
- Date build_time;
- Date install_time;
+ // Repository related:
+ /** Repository providing this resolvable. */
+ RecordId repository;
protected:
/** Overload to realize std::ostream & operator\<\<. */
@@ -95,115 +133,115 @@
///////////////////////////////////////////////////////////////////
- DEFINE_PTR_TYPE(AtomBase);
+ DEFINE_PTR_TYPE(Atom);
- class AtomBase : public ResObject
+ /* Data Object for Atom resolvable. */
+ class Atom : public ResObject
{
public:
- enum AtomType { TypePackage, TypeScript, TypeMessage };
- virtual AtomType atomType() = 0;
+ Atom()
+ {};
};
///////////////////////////////////////////////////////////////////
DEFINE_PTR_TYPE(Script);
- class Script : public AtomBase
+ /* Data Object for Script resolvable. */
+ class Script : public ResObject
{
public:
- Script() {};
- virtual AtomType atomType() { return TypeScript; };
- std::string do_script;
- std::string undo_script;
- std::string do_location;
- std::string undo_location;
- std::string do_media;
- std::string undo_media;
- std::string do_checksum_type;
- std::string do_checksum;
- std::string undo_checksum_type;
- std::string undo_checksum;
- };
-
- ///////////////////////////////////////////////////////////////////
-
- DEFINE_PTR_TYPE(Message);
+ Script()
+ {};
- class Message : public AtomBase
- {
- public:
- Message() {};
- virtual AtomType atomType() { return TypeMessage; };
- TranslatedText text;
+ /** Inlined doScript. */
+ std::string doScript;
+ /** Location of doScript on the repositories media. */
+ Location doScriptLocation;
+
+ /** Inlined undoScript. */
+ std::string undoScript;
+ /** Location of undoScript on the repositories media. */
+ Location undoScriptLocation;
};
///////////////////////////////////////////////////////////////////
- DEFINE_PTR_TYPE(Selection);
+ DEFINE_PTR_TYPE(Message);
- class Selection : public ResObject
+ /* Data Object for Message resolvable. */
+ class Message : public ResObject
{
public:
+ Message()
+ {};
- Selection() {};
- std::string groupId;
- TranslatedText name;
- std::string default_;
- std::string user_visible;
- TranslatedText description;
- //std::list<MetaPkg> grouplist;
- //std::list<PackageReq> packageList;
+ /** Inlined Text. */
+ TranslatedText text;
+ /** Location od textfile on the repositories media. */
+ //Location repositoryLoaction;
};
///////////////////////////////////////////////////////////////////
DEFINE_PTR_TYPE(Patch);
+ /* Data Object for Patch resolvable. */
class Patch : public ResObject
{
public:
- Patch() {};
+ Patch()
+ {};
- /** Patch ID */
- std::string id;
- /** Patch time stamp */
- Date timestamp;
- /** Patch category (recommended, security,...) */
- std::string category;
- /** Does the system need to reboot to finish the update process? */
- bool reboot_needed;
- /** Does the patch affect the package manager itself? */
- bool affects_pkg_manager;
- /** The list of all atoms building the patch */
- //AtomList atoms;
- /** Is the patch installation interactive? (does it need user input?) */
- bool interactive;
+ /** Patch ID */
+ std::string id;
+ /** Patch time stamp */
+ Date timestamp;
+ /** Patch category (recommended, security,...) */
+ std::string category;
+
+ // Flags:
+ /** Does the system need to reboot to finish the update process? */
+ DefaultIntegral rebootNeeded;
+ /** Does the patch affect the package manager itself? */
+ DefaultIntegral affectsPkgManager;
+
+ /** The list of all atoms building the patch.
+ * \todo See whether we need this.
+ */
+ std::set<RecordId> atomList;
};
///////////////////////////////////////////////////////////////////
DEFINE_PTR_TYPE(Pattern);
- /*
- * Data Object for Pattern
- * resolvable
- */
+ /* Data Object for Pattern resolvable. */
class Pattern : public ResObject
{
public:
-
Pattern()
- : is_default(false), user_visible(true)
- {};
+ {}
- bool is_default;
- bool user_visible;
+ // Flags
+ /** */
+ DefaultIntegral isDefault;
+ /** Visible or hidden at the UI. */
+ DefaultIntegral userVisible;
+
+ /** Category */
TranslatedText category;
+
+ /** Icon path. */
std::string icon;
+ /** UI order string */
std::string order;
+ /** ? */
std::string script;
+ /** Included patterns. */
DependencyList includes;
+ /** Extended patterns. */
DependencyList extends;
};
@@ -211,23 +249,36 @@
DEFINE_PTR_TYPE(Product);
- /*
- * Data Object for Product
- * resolvable
- */
+ /* Data Object for Product resolvable. */
class Product : public ResObject
{
public:
- Product() {};
+ Product()
+ {};
- std::string type;
- std::string vendor;
- std::string name;
- std::string distribution_name;
- Edition distribution_edition;
- TranslatedText short_name;
- // those are suse specific tags
- std::string releasenotesurl;
+ /** Abbreviation like \c SLES10 */
+ TranslatedText shortName;
+ /** More verbose Name like <tt>Suse Linux Enterprise Server 10</tt>*/
+ TranslatedText longName;
+
+ /** The product flags.
+ * \todo What is it?
+ */
+ std::liststd::string flags;
+
+ /** Releasenotes url. */
+ Url releasenotesUrl;
+ /** Update repositories for the product. */
+ std::list<Url> updateUrls;
+ /** Additional software for the product. */
+ std::list<Url> extraUrls;
+ /** Optional software for the product. */
+ std::list<Url> optionalUrls;
+
+ /** Vendor specific distribution id. */
+ std::string distributionName;
+ /** Vendor specific distribution version. */
+ Edition distributionEdition;
};
///////////////////////////////////////////////////////////////////
@@ -245,33 +296,41 @@
public:
enum PackageType { BIN, SRC };
virtual PackageType packageType() const = 0;
+
public:
- std::string type;
- CheckSum checksum;
- // changlelog?
+ /** Location on the repositories media. */
+ Location repositoryLocation;
+
+ /** Rpm group.*/
+ std::string group;
+ /** PackageDb keywors (tags). */
+ std::liststd::string keywords;
+
+ /** Changelog. */
+ Changelog changelog;
+ /** Author list. */
+ std::liststd::string authors;
+
+
+ /** Buildhost. */
std::string buildhost;
+ /** Distribution. */
std::string distribution;
+ /** Licensetype. Not the text you have to confirm. */
std::string license;
+ /** Packager. */
std::string packager;
- std::string group;
- /**
- * Upstream home page URL.
- * \see zypp::Package::url();
- */
+ /** Upstream home page URL.*/
std::string url;
- std::string os;
+ /** Pre install script. */
std::string prein;
+ /** Post install script. */
std::string postin;
+ /** Pre uninstall script. */
std::string preun;
+ /** Post uninstall script. */
std::string postun;
-
- ByteCount source_size;
-
- std::liststd::string authors;
- std::liststd::string keywords;
-
- Pathname location;
};
DEFINE_PTR_TYPE(Package);
@@ -283,7 +342,7 @@
virtual PackageType packageType() const { return BIN; }
/** NVR of the corresponding SrcPackage. */
- shared_ptr<NVR> srcPackageIdent;
+ NVR srcPackageIdent;
};
DEFINE_PTR_TYPE(SrcPackage);
@@ -296,38 +355,6 @@
};
///////////////////////////////////////////////////////////////////
- template<class _Res> class SpecificData;
-
- template<> class SpecificData<Package>
- {
- public:
- std::string type;
- CheckSum checksum;
- // changlelog?
- std::string buildhost;
- std::string distribution;
- std::string license;
- std::string packager;
- std::string group;
- std::string url;
- std::string os;
-
- std::string prein;
- std::string postin;
- std::string preun;
- std::string postun;
-
- ByteCount source_size;
-
- std::liststd::string authors;
- std::liststd::string keywords;
-
- Pathname location;
- };
-
} // namespace data
} // namespace zypp
-
-
-#endif
-
+#endif // ZYPP_DATA_RESOLVABLEDATA_H
Modified: trunk/libzypp/zypp/data/ResolvableDataConsumer.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/data/ResolvableDataConsumer.h?rev=5552&r1=5551&r2=5552&view=diff
==============================================================================
--- trunk/libzypp/zypp/data/ResolvableDataConsumer.h (original)
+++ trunk/libzypp/zypp/data/ResolvableDataConsumer.h Tue May 15 17:23:30 2007
@@ -29,6 +29,12 @@
virtual ~ResolvableDataConsumer();
virtual void consumePackage( const data::Package &package) = 0;
+ virtual void consumePackage( const data::Pattern &package) = 0;
+ virtual void consumePackage( const data::Patch &package) = 0;
+ virtual void consumePackage( const data::Script &package) = 0;
+ virtual void consumePackage( const data::Message &package) = 0;
+ virtual void consumePackage( const data::Product &package) = 0;
+ virtual void consumePackage( const data::SrcPackage &package) = 0;
};
} // namespace parser
Modified: trunk/libzypp/zypp/parser/susetags/PackagesFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/susetags/PackagesFileReader.cc?rev=5552&r1=5551&r2=5552&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/susetags/PackagesFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/susetags/PackagesFileReader.cc Tue May 15 17:23:30 2007
@@ -106,7 +106,7 @@
{
ZYPP_THROW( error( tag_r, "Expected [type checksum]") );
}
- _data->checksum = CheckSum( words[0], words[1] );
+ _data->repositoryLocation.fileChecksum = CheckSum( words[0], words[1] );
}
/** Consume =Grp:. */
@@ -141,13 +141,13 @@
ZYPP_THROW( error( tag_r, "Expected sourcepackages [name version release arch]") );
}
- _pkgData->srcPackageIdent.reset( new NVR( words[0], Edition( words[1],words[2] ) ) );
+ _pkgData->srcPackageIdent = NVR( words[0], Edition( words[1],words[2] ) );
}
/** Consume =Tim:. */
void consumeTim( const SingleTagPtr & tag_r )
{
- _data->build_time = str::strtonumDate::ValueType( tag_r->value );
+ _data->buildTime = str::strtonumDate::ValueType( tag_r->value );
}
/** Consume =Loc:. */
@@ -157,15 +157,15 @@
switch ( str::split( tag_r->value, std::back_inserter(words) ) )
{
case 2: // [medianr filename]
- str::strtonum( words[0], _data->source_media_nr );
- _data->location = _data->arch.asString();
- _data->location /= words[1];
+ str::strtonum( words[0], _data->repositoryLocation.mediaNr.get() );
+ _data->repositoryLocation.filePath = _data->arch.asString();
+ _data->repositoryLocation.filePath /= words[1];
break;
case 3: // [medianr filename dir]
- str::strtonum( words[0], _data->source_media_nr );
- _data->location = words[2];
- _data->location /= words[1];
+ str::strtonum( words[0], _data->repositoryLocation.mediaNr.get() );
+ _data->repositoryLocation.filePath = words[2];
+ _data->repositoryLocation.filePath /= words[1];
break;
default:
@@ -182,8 +182,8 @@
{
ZYPP_THROW( error( tag_r, "Expected [archivesize size]") );
}
- _data->archive_size = str::strtonumByteCount::SizeType( words[0] );
- _data->size = str::strtonumByteCount::SizeType( words[1] );
+ _data->repositoryLocation.fileSize = str::strtonumByteCount::SizeType( words[0] );
+ _data->installedSize = str::strtonumByteCount::SizeType( words[1] );
}
/** Consume =Shr:. */
Modified: trunk/libzypp/zypp/parser/susetags/PackagesLangFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/susetags/PackagesLangFileReader.cc?rev=5552&r1=5551&r2=5552&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/susetags/PackagesLangFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/susetags/PackagesLangFileReader.cc Tue May 15 17:23:30 2007
@@ -115,7 +115,7 @@
/** Consume +Eul:. */
void consumeEul( const MultiTagPtr & tag_r )
{
- _data->license_to_confirm.setText( tag_r->value, _locale );
+ _data->licenseToConfirm.setText( tag_r->value, _locale );
}
/** Consume +Ins:. */
Modified: trunk/libzypp/zypp/parser/susetags/PatternFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/susetags/PatternFileReader.cc?rev=5552&r1=5551&r2=5552&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/susetags/PatternFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/susetags/PatternFileReader.cc Tue May 15 17:23:30 2007
@@ -81,7 +81,7 @@
/** Consume =Vis:. */
void consumeVis( const SingleTagPtr & tag_r )
{
- _data->user_visible = ( tag_r->value == "true" );
+ _data->userVisible = ( tag_r->value == "true" );
}
/** Consume =Cat:. */
Modified: trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc?rev=5552&r1=5551&r2=5552&view=diff
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc Tue May 15 17:23:30 2007
@@ -93,7 +93,7 @@
if (reader_r->name() == "checksum")
{
- _package->checksum = CheckSum(reader_r->getAttribute("type").asString(),
+ _package->repositoryLocation.fileChecksum = CheckSum(reader_r->getAttribute("type").asString(),
reader_r.nodeText().asString());
// ignoring pkgid attribute
return true;
@@ -131,7 +131,7 @@
if (reader_r->name() == "time")
{
- _package->build_time = reader_r->getAttribute("build").asString();
+ _package->buildTime = reader_r->getAttribute("build").asString();
// ignoring reader_r->getAttribute("file").asString(); (rpm file timestamp)
return true;
}
@@ -142,17 +142,17 @@
// reader_r->getAttribute("archive").asString();
// installed size
- _package->size = str::strtonumByteCount::SizeType( reader_r->getAttribute("installed").asString() );
+ _package->installedSize = str::strtonumByteCount::SizeType( reader_r->getAttribute("installed").asString() );
// rpm package size
- _package->archive_size = str::strtonumByteCount::SizeType( reader_r->getAttribute("package").asString() );
+ _package->repositoryLocation.fileSize = str::strtonumByteCount::SizeType( reader_r->getAttribute("package").asString() );
return true;
}
if (reader_r->name() == "location")
{
- _package->location = reader_r->getAttribute("href").asString();
+ _package->repositoryLocation.filePath = reader_r->getAttribute("href").asString();
return true;
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org