Zypp Commits
Threads by month
- ----- 2024 -----
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
April 2007
- 6 participants
- 149 discussions
[zypp-commit] r5464 - in /trunk/libzypp: devel/devel.ma/ zypp/ zypp/parser/ zypp/parser/susetags/ zypp/parser/tagfile/
by mlandres@svn.opensuse.org 30 Apr '07
by mlandres@svn.opensuse.org 30 Apr '07
30 Apr '07
Author: mlandres
Date: Mon Apr 30 19:02:49 2007
New Revision: 5464
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5464&view=rev
Log:
backup bsic tag parser
Added:
trunk/libzypp/zypp/ProgressData.cc
trunk/libzypp/zypp/ProgressData.h
trunk/libzypp/zypp/parser/TagParser.cc
trunk/libzypp/zypp/parser/TagParser.h
trunk/libzypp/zypp/parser/susetags/
Modified:
trunk/libzypp/devel/devel.ma/Parse.cc
trunk/libzypp/zypp/CMakeLists.txt
trunk/libzypp/zypp/parser/tagfile/TagFileParser.cc
Modified: trunk/libzypp/devel/devel.ma/Parse.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Parse.cc?…
==============================================================================
--- trunk/libzypp/devel/devel.ma/Parse.cc (original)
+++ trunk/libzypp/devel/devel.ma/Parse.cc Mon Apr 30 19:02:49 2007
@@ -1,5 +1,3 @@
-#include <ctime>
-#include <iostream>
#include "Tools.h"
#include <zypp/base/PtrTypes.h>
@@ -23,16 +21,20 @@
#include "zypp/NameKindProxy.h"
#include "zypp/pool/GetResolvablesToInsDel.h"
+#include "zypp/parser/tagfile/TagFileParser.h"
+#include "zypp/parser/TagParser.h"
using namespace std;
using namespace zypp;
using namespace zypp::ui;
using namespace zypp::functor;
+using zypp::parser::tagfile::TagFileParser;
+using zypp::parser::TagParser;
+
///////////////////////////////////////////////////////////////////
static const Pathname sysRoot( "/Local/ROOT" );
-static const Pathname sysRootAlt( "/Local/ALTERNATE/ROOTPATH" );
///////////////////////////////////////////////////////////////////
@@ -98,18 +100,6 @@
///////////////////////////////////////////////////////////////////
-struct PoolItemSelect
-{
- void operator()( const PoolItem & pi ) const
- {
- if ( pi->source().numericId() == 2 )
- pi.status().setTransact( true, ResStatus::USER );
- }
-};
-
-///////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-
struct AddResolvables
{
bool operator()( const Source_Ref & src ) const
@@ -121,80 +111,14 @@
///////////////////////////////////////////////////////////////////
-struct SetTransactValue
-{
- SetTransactValue( ResStatus::TransactValue newVal_r, ResStatus::TransactByValue causer_r )
- : _newVal( newVal_r )
- , _causer( causer_r )
- {}
-
- ResStatus::TransactValue _newVal;
- ResStatus::TransactByValue _causer;
-
- bool operator()( const PoolItem & pi ) const
- { return pi.status().setTransactValue( _newVal, _causer ); }
-};
-
-struct StatusReset : public SetTransactValue
-{
- StatusReset()
- : SetTransactValue( ResStatus::KEEP_STATE, ResStatus::USER )
- {}
-};
-
-
-inline bool selectForTransact( const NameKindProxy & nkp, Arch arch = Arch() )
-{
- if ( nkp.availableEmpty() ) {
- ERR << "No Item to select: " << nkp << endl;
- return false;
- ZYPP_THROW( Exception("No Item to select") );
- }
-
- if ( arch != Arch() )
- {
- typeof( nkp.availableBegin() ) it = nkp.availableBegin();
- for ( ; it != nkp.availableEnd(); ++it )
- {
- if ( (*it)->arch() == arch )
- return (*it).status().setTransact( true, ResStatus::USER );
- }
- }
-
- return nkp.availableBegin()->status().setTransact( true, ResStatus::USER );
-}
-
-void seltest( const NameKindProxy & nks )
-{
- SEC << nks << endl;
- PoolItem av( *nks.availableBegin() );
- SEC << av << endl;
- Pattern::constPtr pat( asKind<Pattern>(av.resolvable()) );
- SEC << pat << endl;
- WAR << pat->install_packages() << endl;
- MIL << pat->deps() << endl;
- MIL << pat->includes() << endl;
- MIL << pat->extends() << endl;
-}
-void showProd( const PoolItem & prod )
+std::ostream & operator<<( std::ostream & str, const iostr::EachLine & obj )
{
- Product::constPtr p( asKind<Product>(prod) );
- DBG << prod << endl;
- MIL << p << endl;
- MIL << p->distributionName() << endl;
- MIL << p->distributionEdition() << endl;
- MIL << p->installtime() << endl;
-}
+ str << "(" << obj.valid() << ")[" << obj.lineNo() << "|" << obj.lineStart() << "]{" << *obj << "}";
+ return str;
-void doPkg( const PoolItem & pi )
-{
- Package::constPtr p( asKind<Package>(pi) );
- MIL << p << endl;
- DBG << p->keywords() << endl;
}
-///////////////////////////////////////////////////////////////////
/******************************************************************
**
** FUNCTION NAME : main
@@ -205,49 +129,56 @@
//zypp::base::LogControl::instance().logfile( "log.restrict" );
INT << "===[START]==========================================" << endl;
- ConvertDbReceive cr;
- cr.connect();
- MediaChangeReceive mr;
- mr.connect();
+ //Pathname p( "lmd/suse/setup/descr/packages" );
+ Pathname p( "packages" );
- Pathname root( sysRoot );
+ if ( 1 )
+ {
+ Pathname p( "packages" );
+ Measure x( p.basename() );
+ TagFileParser tp( (zypp::parser::ParserProgress::Ptr()) );
+ tp.parse( p );
+ }
+
+ if ( 1 ) {
+ Pathname p( "p" );
+ Measure x( p.basename() );
+ TagParser tp;
+ tp.parse( p );
+ }
if ( 1 ) {
- //zypp::base::LogControl::TmpLineWriter shutUp;
- SourceManager::sourceManager()->restore( root );
+ Pathname p( "p.gz" );
+ Measure x( p.basename() );
+ TagParser tp;
+ tp.parse( p );
+ }
+ if ( 1 ) {
+ Pathname p( "packages" );
+ Measure x( p.basename() );
+ TagParser tp;
+ tp.parse( p );
+ }
+ if ( 1 ) {
+ Pathname p( "packages.gz" );
+ Measure x( p.basename() );
+ TagParser tp;
+ tp.parse( p );
+ }
- if ( SourceManager::sourceManager()->allSources().empty() )
+ if ( 0 )
+ {
+ Measure x( "lmd.idx" );
+ std::ifstream fIndex( "lmd.idx" );
+ for( iostr::EachLine in( fIndex ); in; in.next() )
{
+ Measure x( *in );
+ std::ifstream fIn( (*in).c_str() );
+ for( iostr::EachLine l( fIn ); l; l.next() )
{
- zypp::base::LogControl::TmpLineWriter shutUp;
- Source_Ref src1( createSource( "dir:/dist/install/SLP/openSUSE-10.3-Build00300-DVD/i386/DVD1" ) );
- SourceManager::sourceManager()->addSource( src1 );
- SourceManager::sourceManager()->store( root, true );
+ ;
}
- dumpRange( USR << "Sources Created: ",
- SourceManager::sourceManager()->Source_begin(),
- SourceManager::sourceManager()->Source_end()
- ) << endl;
- } else {
- dumpRange( USR << "Sources Reloaded: ",
- SourceManager::sourceManager()->Source_begin(),
- SourceManager::sourceManager()->Source_end()
- ) << endl;
}
}
-
- std::for_each( SourceManager::sourceManager()->Source_begin(),
- SourceManager::sourceManager()->Source_end(),
- AddResolvables() );
-
- ResPool pool( getZYpp()->pool() );
- dumpRange( USR << "PackageKeywords: " << PackageKeyword::allSize(),
- PackageKeyword::allBegin(),
- PackageKeyword::allEnd() ) << endl;
-
- std::for_each( pool.byKindBegin<Package>(),
- pool.byKindEnd<Package>(),
- doPkg );
-
INT << "===[END]============================================" << endl << endl;
zypp::base::LogControl::instance().logNothing();
return 0;
Modified: trunk/libzypp/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/CMakeLists.txt?rev=…
==============================================================================
--- trunk/libzypp/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/zypp/CMakeLists.txt Mon Apr 30 19:02:49 2007
@@ -48,6 +48,7 @@
ProblemSolution.cc
Package.cc
Pathname.cc
+ ProgressData.cc
Source.cc
SourceFactory.cc
SourceManager.cc
@@ -132,6 +133,7 @@
Patch.h
PathInfo.h
Pathname.h
+ ProgressData.h
Pattern.h
PoolItem.h
ProblemSolution.h
@@ -406,12 +408,14 @@
)
SET( zypp_parser_SRCS
+ parser/TagParser.cc
parser/LibXMLHelper.cc
parser/SAXParser.cc
parser/XMLNodeIterator.cc
)
SET( zypp_parser_HEADERS
+ parser/TagParser.h
parser/LibXMLHelper.h
parser/ParserProgress.h
parser/SAXParser.h
Added: trunk/libzypp/zypp/ProgressData.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ProgressData.cc?rev…
==============================================================================
--- trunk/libzypp/zypp/ProgressData.cc (added)
+++ trunk/libzypp/zypp/ProgressData.cc Mon Apr 30 19:02:49 2007
@@ -0,0 +1,99 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/ProgressData.cc
+ *
+*/
+#include <iostream>
+#include "zypp/base/Logger.h"
+#include "zypp/base/InputStream.h"
+#include "zypp/base/String.h"
+
+#include "zypp/ProgressData.h"
+
+using std::endl;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : ProgressData::report
+ // METHOD TYPE : void
+ //
+ void ProgressData::report()
+ {
+ if ( hasRange() )
+ {
+ value_type newVal = _d->_val * 100;
+ newVal /= ( _d->_max - _d->_min );
+
+ if ( newVal - _d->_last_val > 5 || Date::now() - _d->_last_send > 1 || _d->_state == END )
+ {
+ DBG << str::form( "{%u|%s}(%d%%)",
+ numericId(), name().c_str(), newVal ) << endl;
+ _d->_last_val = newVal;
+ _d->_last_send = Date::now();
+ if ( _d->_state == INIT )
+ {
+ _d->_state = RUN;
+ }
+ }
+ }
+ else
+ {
+ if ( Date::now() - _d->_last_send > 1 || _d->_state == END )
+ {
+ DBG << str::form( "{%u|%s}(%d!)",
+ numericId(), name().c_str(), _d->_val ) << endl;
+ _d->_last_val = _d->_val;
+ _d->_last_send = Date::now();
+ if ( _d->_state == INIT )
+ {
+ _d->_state = RUN;
+ }
+ }
+ }
+ }
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : operator<<
+ ** FUNCTION TYPE : std::ostream &
+ */
+ std::ostream & operator<<( std::ostream & str, const ProgressData & obj )
+ {
+ if ( obj.hasRange() )
+ {
+ return str << str::form( "{%u|%s}[%lld,%lld](%lld)",
+ obj.numericId(), obj.name().c_str(),
+ obj.min(), obj.max(), obj.val() );
+ }
+ return str << str::form( "{%u|%s}[-,-](%lld)",
+ obj.numericId(), obj.name().c_str(),
+ obj.val() );
+ }
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : operator<<
+ ** FUNCTION TYPE : std::ostream &
+ */
+ ProgressData makeProgressData( const InputStream & input_r )
+ {
+ ProgressData ret;
+ ret.name( input_r.name() );
+ if ( input_r.size() > 0 )
+ ret.range( input_r.size() );
+ return ret;
+ }
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
Added: trunk/libzypp/zypp/ProgressData.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ProgressData.h?rev=…
==============================================================================
--- trunk/libzypp/zypp/ProgressData.h (added)
+++ trunk/libzypp/zypp/ProgressData.h Mon Apr 30 19:02:49 2007
@@ -0,0 +1,203 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/ProgressData.h
+ *
+*/
+#ifndef ZYPP_PROGRESSDATA_H
+#define ZYPP_PROGRESSDATA_H
+
+#include <iosfwd>
+#include <string>
+
+#include "zypp/base/PtrTypes.h"
+#include "zypp/base/ProvideNumericId.h"
+
+#include "zypp/Date.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : ProgressData
+ //
+ /** Maintain <tt>[min,max]</tt> and counter <tt>(value)</tt> for progress counting.
+ *
+ * This class should provide everything the producer of progress data
+ * needs. As a convention, a zero sizes range indicates that you are just
+ * able to send <em>'still alive'</em> triggers.
+ *
+ * The counter should be updated in reasonable intervals. Don't mind wheter
+ * the counter value actually increased or not. ProgressData will recognize
+ * your triggers and knows when to actually send notification to a consumer.
+ *
+ * Each ProgressData object provides a unique numeric id and you may assign
+ * it a name.
+ *
+ * \todo complete the progess sending.
+ */
+ class ProgressData : public base::ProvideNumericId<ProgressData,unsigned>
+ {
+ public:
+ typedef long long value_type;
+ enum State { INIT, RUN, END };
+
+ private:
+ class Data
+ {
+ public:
+ Data( value_type min_r, value_type max_r, value_type val_r )
+ : _state( INIT ), _min( min_r ), _max( max_r ), _val( val_r )
+ , _last_val( 0 ), _last_send( 0 )
+ {}
+
+ public:
+ State _state;
+ std::string _name;
+ value_type _min;
+ value_type _max;
+ value_type _val;
+
+ value_type _last_val;
+ Date _last_send;
+
+ private:
+ /** clone for RWCOW_pointer */
+ friend Data * rwcowClone<Data>( const Data * rhs );
+ Data * clone() const { return new Data( *this ); }
+ };
+
+ public:
+ /** Ctor no range <tt>[0,0](0)</tt>. */
+ ProgressData()
+ : _d( new Data( 0, 0, 0 ) )
+ {}
+
+ /** Ctor <tt>[0,max](0)</tt>. */
+ ProgressData( value_type max_r )
+ : _d( new Data( 0, max_r, 0 ) )
+ {}
+
+ /** Ctor <tt>[min,max](min)</tt>. */
+ ProgressData( value_type min_r, value_type max_r )
+ : _d( new Data( min_r, max_r, min_r ) )
+ {}
+
+ /** Ctor <tt>[min,max](val)</tt>. */
+ ProgressData( value_type min_r, value_type max_r, value_type val_r )
+ : _d( new Data( min_r, max_r, val_r ) )
+ {}
+
+ ~ProgressData()
+ {
+ if ( _d->_state == RUN )
+ {
+ _d->_state = END;
+ report();
+ }
+ }
+
+ public:
+ /** @return Current \c min value. */
+ value_type min() const
+ { return _d->_min; }
+
+ /** @return Current \c max value. */
+ value_type max() const
+ { return _d->_max; }
+
+ /** @return Current counter \c value. */
+ value_type val() const
+ { return _d->_val; }
+
+ /** @return Wheter <tt>[min,max]</tt> defines a nonempty range. */
+ bool hasRange() const
+ { return min() != max(); }
+
+ /** @return The counters name. */
+ const std::string & name() const
+ { return _d->_name; }
+
+ public:
+ /** Set new \c min value. */
+ void min( value_type min_r )
+ { _d->_min = min_r; }
+
+ /** Set new \c max value. */
+ void max( value_type max_r )
+ { _d->_max = max_r; }
+
+ /** Set no range <tt>[0,0]</tt>. */
+ void noRange()
+ { range( 0, 0 ); }
+
+ /** Set new <tt>[0,max]</tt>. */
+ void range( value_type max_r )
+ { range( 0, max_r ); }
+
+ /** Set new <tt>[min,max]</tt>. */
+ void range( value_type min_r, value_type max_r )
+ { min( min_r ); max( max_r ); }
+
+ public:
+ /** Set new counter \c value. */
+ void set( value_type val_r )
+ {
+ _d->_val = val_r;
+ report();
+ }
+
+ /** Increment counter \c value (default by 1). */
+ void incr( value_type val_r = 1 )
+ { set( val() + val_r ); }
+
+ /** Decrement counter \c value (default by 1). */
+ void decr( value_type val_r = 1 )
+ { set( val() - val_r ); }
+
+ /** Set counter value to current \c min value. */
+ void toMin()
+ { set( min() ); }
+
+ /** Set counter value to current \c max value (unless no range). */
+ void toMax()
+ { if ( hasRange() ) set( max() ); }
+
+ /** Leave counter value unchanged (still alive). */
+ void tick()
+ { set( val() ); }
+
+ public:
+ /** Set counter name. */
+ void name( const std::string & name_r )
+ { _d->_name = name_r; }
+
+ private:
+ /** Send report if necessary. */
+ void report();
+
+ /** Pointer to data. */
+ RWCOW_pointer<Data> _d;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /** \relates ProgressData Stream output */
+ std::ostream & operator<<( std::ostream & str, const ProgressData & obj );
+
+ ///////////////////////////////////////////////////////////////////
+
+ class InputStream;
+ /** \relates ProgressData Setup from \ref InputStream. */
+ ProgressData makeProgressData( const InputStream & input_r );
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_PROGRESSDATA_H
Added: trunk/libzypp/zypp/parser/TagParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/TagParser.cc…
==============================================================================
--- trunk/libzypp/zypp/parser/TagParser.cc (added)
+++ trunk/libzypp/zypp/parser/TagParser.cc Mon Apr 30 19:02:49 2007
@@ -0,0 +1,335 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/parser/TagParser.cc
+ *
+*/
+#include <iostream>
+#include <sstream>
+
+#include "zypp/base/Logger.h"
+#include "zypp/base/String.h"
+#include "zypp/base/IOStream.h"
+
+#include "zypp/parser/TagParser.h"
+#include "zypp/ProgressData.h"
+
+using std::endl;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace parser
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : TagParser::Tag
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ std::string TagParser::Tag::asString() const
+ {
+ std::string ret( name );
+ if ( ! modifier.empty() )
+ ret += modifier;
+ return ret += ":";
+ }
+
+ std::ostream & operator<<( std::ostream & str, const TagParser::Tag & obj )
+ {
+ str << "@" << obj.lineNo << "{" << obj.name;
+ if ( ! obj.modifier.empty() )
+ str << '.' << obj.modifier;
+ return str << ":}(" << obj.dataStart << "|" << obj.dataLength << ")";
+ }
+
+ std::ostream & operator<<( std::ostream & str, const TagParser::SingleTag & obj )
+ {
+ str << "=" << static_cast<const TagParser::Tag &>( obj );
+ return str << "\"" << obj.value << "\"";
+ }
+
+ std::ostream & operator<<( std::ostream & str, const TagParser::MultiTag & obj )
+ {
+ str << "+" << static_cast<const TagParser::Tag &>( obj );
+ return str << "[" << obj.value.size() << "]";
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : TagParser
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : TagParser::TagParser
+ // METHOD TYPE : Ctor
+ //
+ TagParser::TagParser()
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : TagParser::~TagParser
+ // METHOD TYPE : Dtor
+ //
+ TagParser::~TagParser()
+ {}
+
+ void TagParser::beginParse()
+ {}
+ void TagParser::consume( const SingleTagPtr & tag_r )
+ {}
+ void TagParser::consume( const MultiTagPtr & tag_r )
+ {}
+ void TagParser::endParse()
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : TagParser::errPrefix
+ // METHOD TYPE : std::string
+ //
+ std::string TagParser::errPrefix( unsigned lineNo_r,
+ const std::string & msg_r ) const
+ {
+ return str::form( "%s:%u:%s: %s",
+ _inputname.c_str(),
+ lineNo_r,
+ "-",
+ msg_r.c_str() );
+ }
+
+ std::string TagParser::errPrefix( const SingleTagPtr & tag_r,
+ const std::string & msg_r ) const
+ {
+ return str::form( "%s:%u:=%s %s",
+ _inputname.c_str(),
+ tag_r->lineNo,
+ tag_r->asString().c_str(),
+ msg_r.c_str() );
+ }
+
+ std::string TagParser::errPrefix( const MultiTagPtr & tag_r,
+ const std::string & msg_r ) const
+ {
+ return str::form( "%s:%u:+%s %s",
+ _inputname.c_str(),
+ tag_r->lineNo,
+ tag_r->asString().c_str(),
+ msg_r.c_str() );
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ namespace
+ { /////////////////////////////////////////////////////////////////
+
+ /** Parse a tag <tt>NAME[.EXT]:</tt>from \a begin_r.
+ * If a tag was found, update \a tag_r and advance
+ * \a begin_r to point behind the \c :.
+ */
+ inline bool helperParseStartTag( TagParser::Tag & tag_r, const char *& begin_r )
+ {
+ const char * tsep = 0; // find ':'
+ const char * esep = 0; // remember last '.'
+ for ( const char * ch = begin_r; *ch; ++ch )
+ {
+ switch ( *ch )
+ {
+ case '.':
+ esep = ch; // remember
+ break;
+ case ':':
+ tsep = ch;
+ ch = 0; // done: found ':'
+ break;
+ case ' ':
+ case '\t':
+ case '\n':
+ case '\r':
+ ch = 0; // fail: no whitespace allowed in tag
+ break;
+ }
+ if ( ! ch )
+ break;
+ }
+
+ if ( ! tsep )
+ return false; // no tag found
+
+ // Update name and modifier
+ if ( esep )
+ {
+ std::string( begin_r, esep-begin_r ).swap( tag_r.name );
+ ++esep;
+ std::string( esep, tsep-esep ).swap( tag_r.modifier );
+ }
+ else
+ {
+ std::string( begin_r, tsep-begin_r ).swap( tag_r.name );
+ }
+
+ begin_r = tsep+1; // behind ':'
+ return true;
+ }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace
+ ///////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : TagParser::parse
+ // METHOD TYPE : void
+ //
+ void TagParser::parse( const InputStream & input_r )
+ {
+ MIL << "Start parsing " << input_r << endl;
+ _inputname = input_r.name();
+ beginParse();
+
+ ProgressData ticks( makeProgressData( input_r ) );
+ ticks.toMin();
+
+ iostr::EachLine line( input_r );
+ for( ; line; line.next() )
+ {
+ const char * cp = (*line).c_str();
+ switch ( *cp )
+ {
+ ///////////////////////////////////////////////////////////////////
+ case '=': // get single line data
+ {
+ SingleTagPtr tagP( new SingleTag( line.lineNo(), line.lineStart() ) );
+ SingleTag & tag( *tagP.get() );
+
+ const char * cp = (*line).c_str() + 1;
+ if ( helperParseStartTag( tag, cp ) )
+ {
+ while ( *cp == ' ' || *cp == '\t' )
+ ++cp;
+
+ tag.dataStart = tag.tagStart + cp - (*line).c_str();
+
+ if ( *cp ) // not at string end
+ {
+ const char * ep = (*line).c_str() + (*line).size();
+ do {
+ --ep;
+ } while ( *ep == ' ' || *ep == '\t' );
+ tag.dataLength = ep+1-cp;
+ std::string( cp, tag.dataLength ).swap( tag.value );
+ }
+
+ consume( tagP );
+ }
+ else
+ {
+ ZYPP_THROW( ParseException( errPrefix( line.lineNo(), "Orphan data: " + (*line) ) ) );
+ }
+ }
+ break;
+
+ ///////////////////////////////////////////////////////////////////
+ case '+': // get mulit line data
+ {
+ MultiTagPtr tagP( new MultiTag(line.lineNo(), line.lineStart() ) );
+ MultiTag & tag( *tagP.get() );
+
+ const char * cp = (*line).c_str() + 1;
+ if ( helperParseStartTag( tag, cp ) )
+ {
+ std::string endTag( "-" );
+ endTag += tag.name;
+ if ( ! tag.modifier.empty() )
+ {
+ endTag += ".";
+ endTag += tag.modifier;
+ }
+ endTag += ":";
+
+ line.next();
+ tag.dataStart = line.lineStart();
+
+ for( ; line; line.next() )
+ {
+ if ( str::hasPrefix( *line, endTag ) )
+ {
+ tag.dataLength = line.lineStart() - tag.dataStart;
+ break;
+ }
+ else
+ {
+ tag.value.push_back( *line );
+ }
+ }
+
+ if ( ! line )
+ {
+ ZYPP_THROW( ParseException( errPrefix( tagP, "Reached EOF while looking for end tag") ) );
+ }
+
+ consume( tagP );
+ }
+ else
+ {
+ ZYPP_THROW( ParseException( errPrefix( line.lineNo(), "Orphan data: " + (*line) ) ) );
+ }
+ }
+ break;
+
+ ///////////////////////////////////////////////////////////////////
+ default: // empty or comment
+ {
+ for ( const char * cp = (*line).c_str(); *cp; ++cp )
+ {
+ switch( *cp )
+ {
+ case ' ':
+ case '\t':
+ case '\r':
+ case '\n':
+ break;
+
+ default:
+ if ( *cp != '#' )
+ {
+ ZYPP_THROW( ParseException( errPrefix( line.lineNo(), "Orphan data: " + (*line) ) ) );
+ }
+ cp = 0;
+ break;
+ }
+
+ if ( ! cp )
+ {
+ break;
+ }
+ }
+ }
+ break;
+ }
+
+ ticks.set( input_r.stream().tellg() );
+ }
+
+ ticks.toMax();
+
+ endParse();
+ _inputname.clear();
+ MIL << "Done parsing " << input_r << endl;
+ }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace parser
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
Added: trunk/libzypp/zypp/parser/TagParser.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/TagParser.h?…
==============================================================================
--- trunk/libzypp/zypp/parser/TagParser.h (added)
+++ trunk/libzypp/zypp/parser/TagParser.h Mon Apr 30 19:02:49 2007
@@ -0,0 +1,138 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/parser/TagParser.h
+ *
+*/
+#ifndef ZYPP_PARSER_TAGPARSER_H
+#define ZYPP_PARSER_TAGPARSER_H
+
+#include <iosfwd>
+#include <string>
+#include <list>
+
+#include "zypp/base/PtrTypes.h"
+#include "zypp/base/NonCopyable.h"
+#include "zypp/base/InputStream.h"
+
+#include "zypp/parser/tagfile/ParseException.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace parser
+ { /////////////////////////////////////////////////////////////////
+
+ using tagfile::ParseException;
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : TagParser
+ //
+ /** Basic SUSEtags parser.
+ * Will replace parser/tagfile/ and parser/taggedfile/ stuff.
+ */
+ class TagParser : private base::NonCopyable
+ {
+ public:
+
+ struct Tag
+ {
+ Tag( unsigned lineNo_r = 0, std::streamoff tagStart_r = -1 )
+ : lineNo( lineNo_r ), tagStart( tagStart_r ), dataStart( -1 ), dataLength( 0 )
+ {}
+ /** String <tt>"NAME[.MODIFIER]:"</tt>. */
+ std::string asString() const;
+
+ unsigned lineNo;
+ std::streamoff tagStart;
+ std::streamoff dataStart;
+ std::streamoff dataLength;
+
+ std::string name;
+ std::string modifier;
+ };
+
+ struct SingleTag : Tag
+ {
+ SingleTag( unsigned lineNo_r = 0, std::streamoff tagStart_r = -1 )
+ : Tag( lineNo_r, tagStart_r )
+ {}
+ std::string value;
+ };
+
+ struct MultiTag : Tag
+ {
+ MultiTag( unsigned lineNo_r = 0, std::streamoff tagStart_r = -1 )
+ : Tag( lineNo_r, tagStart_r )
+ {}
+ std::list<std::string> value;
+ };
+
+ typedef shared_ptr<SingleTag> SingleTagPtr;
+ typedef shared_ptr<MultiTag> MultiTagPtr;
+
+ public:
+ /** Default ctor */
+ TagParser();
+ /** Dtor */
+ virtual ~TagParser();
+ /** Parse the stream.
+ * \throw ParseExcetion on errors. Invoke \ref consume
+ * for each tag. \ref consume might throw other exceptions
+ * as well.
+ */
+ void parse( const InputStream & imput_r );
+
+ public:
+ /** Called when start parsing. */
+ virtual void beginParse();
+ /** Called when a single-tag is found. */
+ virtual void consume( const SingleTagPtr & tag_r );
+ /** Called when a multi-tag is found. */
+ virtual void consume( const MultiTagPtr & tag_r );
+ /** Called when the parse is done. */
+ virtual void endParse();
+
+ public:
+ /** Prefix exception message with line and tag information. */
+ std::string errPrefix( unsigned lineNo_r,
+ const std::string & msg_r = std::string() ) const;
+ /** Prefix exception message with line and tag information. */
+ std::string errPrefix( const SingleTagPtr & tag_r,
+ const std::string & msg_r = std::string() ) const;
+ /** Prefix exception message with line and tag information. */
+ std::string errPrefix( const MultiTagPtr & tag_r,
+ const std::string & msg_r = std::string() ) const;
+ /** Name of the current InputStream. */
+ const std::string & inputname() const
+ { return _inputname; }
+
+ private:
+ std::string _inputname;
+ //ProgressData _ticks;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /** \relates TagParser::Tag Stream output. */
+ std::ostream & operator<<( std::ostream & str, const TagParser::Tag & obj );
+
+ /** \relates TagParser::SingleTag Stream output. */
+ std::ostream & operator<<( std::ostream & str, const TagParser::SingleTag & obj );
+
+ /** \relates TagParser::MultiTag Stream output. */
+ std::ostream & operator<<( std::ostream & str, const TagParser::MultiTag & obj );
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace parser
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_PARSER_TAGPARSER_H
Modified: trunk/libzypp/zypp/parser/tagfile/TagFileParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/tagfile/TagF…
==============================================================================
--- trunk/libzypp/zypp/parser/tagfile/TagFileParser.cc (original)
+++ trunk/libzypp/zypp/parser/tagfile/TagFileParser.cc Mon Apr 30 19:02:49 2007
@@ -208,7 +208,7 @@
}
new_progress = (int)((((float)readed)/((float)_file_size))*100);
- if ( new_progress != previous_progress )
+ if ( _progress && new_progress != previous_progress )
_progress->progress( new_progress );
previous_progress = new_progress;
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5463 - in /trunk/libzypp: devel/devel.jkupec/ zypp/ zypp/data/ zypp/parser/yum/ zypp/source/yum/
by jkupec@svn.opensuse.org 30 Apr '07
by jkupec@svn.opensuse.org 30 Apr '07
30 Apr '07
Author: jkupec
Date: Mon Apr 30 18:35:53 2007
New Revision: 5463
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5463&view=rev
Log:
backup
- PrimaryFileReader almost complete
- YUMParser will handle all metadata file readers
- YUMResourceType added
- unified namespaces of some readers to zypp::parser::yum
- OtherFileReader and PatchFileReader started
Added:
trunk/libzypp/zypp/parser/yum/OtherFileReader.cc
trunk/libzypp/zypp/parser/yum/OtherFileReader.h
trunk/libzypp/zypp/parser/yum/PatchFileReader.cc
trunk/libzypp/zypp/parser/yum/PatchFileReader.h
trunk/libzypp/zypp/source/yum/YUMResourceType.cc
trunk/libzypp/zypp/source/yum/YUMResourceType.h
Modified:
trunk/libzypp/devel/devel.jkupec/YUMParser.cc
trunk/libzypp/devel/devel.jkupec/YUMParser.h
trunk/libzypp/devel/devel.jkupec/YUMParser_test.cc
trunk/libzypp/zypp/CMakeLists.txt
trunk/libzypp/zypp/ResObject.h
trunk/libzypp/zypp/data/ResolvableData.h
trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc
trunk/libzypp/zypp/parser/yum/PrimaryFileReader.h
trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc
trunk/libzypp/zypp/parser/yum/RepomdFileReader.h
trunk/libzypp/zypp/source/yum/YUMDownloader.cc
trunk/libzypp/zypp/source/yum/YUMDownloader.h
Modified: trunk/libzypp/devel/devel.jkupec/YUMParser.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.jkupec/YUMPa…
==============================================================================
--- trunk/libzypp/devel/devel.jkupec/YUMParser.cc (original)
+++ trunk/libzypp/devel/devel.jkupec/YUMParser.cc Mon Apr 30 18:35:53 2007
@@ -1,7 +1,21 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
#include "zypp/ZYpp.h"
#include "zypp/ZYppFactory.h"
#include "zypp/base/Logger.h"
+#include "zypp/parser/yum/RepomdFileReader.h"
+#include "zypp/parser/yum/PrimaryFileReader.h"
+#include "zypp/parser/yum/PatchesFileReader.h"
+#include "zypp/parser/yum/PatchFileReader.h"
+
#include "YUMParser.h"
using std::endl;
@@ -24,12 +38,22 @@
}
- bool YUMParser::primary_CB(const zypp::data::Package &package, const zypp::data::Dependencies &deps)
+ bool YUMParser::repomd_CB( const OnMediaLocation &loc, const YUMResourceType &dtype )
+ {
+ DBG << "Adding " << dtype
+ << " (" << loc.filename() << ") to YUMParser jobs " << endl;
+
+ _jobs.push_back(YUMParserJob(loc.filename(), dtype));
+
+ return true;
+ }
+
+ bool YUMParser::primary_CB(const zypp::data::Package & package)
{
NVRA nvra(package.name, package.edition, package.arch);
data::RecordId pkgid =
_consumer.appendResolvable(
- _catalog_id, ResTraits<Package>::kind, nvra, deps);
+ _catalog_id, ResTraits<Package>::kind, nvra, package.deps);
/* MIL << "got package "
<< package.name << package.edition << " "
@@ -39,15 +63,87 @@
MIL << "summary: " << package.summary << endl;*/
}
+
+ bool YUMParser::patches_CB(const OnMediaLocation &loc, const string & patch_id)
+ {
+ DBG << "Adding patch " << loc.filename() << " to YUMParser jobs " << endl;
+
+ _jobs.push_back(YUMParserJob(loc.filename(), YUMResourceType::PATCH));
+
+ return true;
+ }
+
+
+ bool YUMParser::patch_CB(const zypp::data::Patch & patch)
+ {
+ NVRA nvra(patch.name, patch.edition, patch.arch);
+ data::RecordId pkgid =
+ _consumer.appendResolvable(
+ _catalog_id, ResTraits<Patch>::kind, nvra, patch.deps);
+
+ MIL << "got patch "
+ << patch.name << patch.edition << " "
+ << patch.arch
+ << endl;
+ }
+
+
void YUMParser::start(const Pathname &cache_dir, ParserProgress::Ptr progress)
{
- zypp::parser::yum::PrimaryFileReader(
- cache_dir + "/repodata/primary.xml.gz",
- bind(&YUMParser::primary_CB, this, _1, _2),
- progress);
+ zypp::parser::yum::RepomdFileReader(
+ cache_dir + "/repodata/repomd.xml",
+ bind(&YUMParser::repomd_CB, this, _1, _2));
+
+ doJobs(cache_dir, progress);
+ }
+
+
+ void YUMParser::doJobs(const Pathname &cache_dir, ParserProgress::Ptr progress)
+ {
+ for(list<YUMParserJob>::const_iterator it = _jobs.begin(); it != _jobs.end(); ++it)
+ {
+ YUMParserJob job = *it;
+
+ MIL << "going to parse " << job.type() << " file " << job.filename() << endl;
+
+ switch(job.type().toEnum())
+ {
+ // parse primary.xml.gz
+ case YUMResourceType::PRIMARY_e:
+ {
+ zypp::parser::yum::PrimaryFileReader(
+ cache_dir + job.filename(),
+ bind(&YUMParser::primary_CB, this, _1),
+ progress);
+ break;
+ }
+ case YUMResourceType::PATCHES_e:
+ {
+ zypp::source::yum::PatchesFileReader(
+ cache_dir + job.filename(),
+ bind(&YUMParser::patches_CB, this, _1, _2));
+ break;
+ }
+ case YUMResourceType::PATCH_e:
+ {
+ zypp::parser::yum::PatchFileReader(
+ cache_dir + job.filename(),
+ bind(&YUMParser::patch_CB, this, _1));
+ break;
+ }
+ default:
+ {
+ DBG << "oh yeah, time will come, when we will parse "
+ << job.type() << " file "
+ << job.filename() << endl;
+ }
+ }
+ }
}
} // ns yum
} // ns parser
} // ns zypp
+
+// vim: set ts=2 sts=2 sw=2 et ai:
Modified: trunk/libzypp/devel/devel.jkupec/YUMParser.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.jkupec/YUMPa…
==============================================================================
--- trunk/libzypp/devel/devel.jkupec/YUMParser.h (original)
+++ trunk/libzypp/devel/devel.jkupec/YUMParser.h Mon Apr 30 18:35:53 2007
@@ -1,15 +1,26 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
#ifndef YUMPARSER_H_
#define YUMPARSER_H_
#include "zypp/base/Logger.h"
#include "zypp2/cache/CacheStore.h"
#include "zypp/data/ResolvableData.h"
-#include "zypp/parser/yum/PrimaryFileReader.h"
#include "zypp/parser/ParserProgress.h"
+#include "zypp/source/yum/YUMResourceType.h"
+
#undef ZYPP_BASE_LOGGER_LOGGROUP
#define ZYPP_BASE_LOGGER_LOGGROUP "parser"
+using zypp::source::yum::YUMResourceType;
namespace zypp
{
@@ -18,22 +29,45 @@
namespace yum
{
+ /**
+ *
+ */
+ struct YUMParserJob
+ {
+ YUMParserJob(const Pathname & filename, const YUMResourceType & type)
+ : _filename(filename), _type(type) {}
+ const Pathname & filename() const { return _filename; }
+ const YUMResourceType & type() const { return _type; }
+
+ private:
+ Pathname _filename;
+ YUMResourceType _type;
+ };
+
+
+ /**
+ *
+ */
class YUMParser
{
public:
typedef function<bool( int )> Progress;
- YUMParser(const zypp::data::RecordId &catalog_id, zypp::cache::CacheStore &consumer);
+ YUMParser(const zypp::data::RecordId & catalog_id, zypp::cache::CacheStore & consumer);
- void start(const zypp::Pathname &path, ParserProgress::Ptr progress);
+ void start(const zypp::Pathname & path, ParserProgress::Ptr progress);
+ void doJobs(const zypp::Pathname & path, ParserProgress::Ptr progress);
- bool primary_CB(const zypp::data::Package &package, const zypp::data::Dependencies &deps);
- bool test() { return true; }
+ bool repomd_CB(const OnMediaLocation & loc, const YUMResourceType & dtype);
+ bool primary_CB(const zypp::data::Package & package);
+ bool patches_CB(const OnMediaLocation &loc, const std::string & patch_id);
+ bool patch_CB(const zypp::data::Patch & patch);
private:
- zypp::cache::CacheStore &_consumer;
+ zypp::cache::CacheStore & _consumer;
zypp::data::RecordId _catalog_id;
+ std::list<YUMParserJob> _jobs;
};
@@ -42,3 +76,5 @@
} // ns zypp
#endif /*YUMPARSER_H_*/
+
+// vim: set ts=2 sts=2 sw=2 et ai:
Modified: trunk/libzypp/devel/devel.jkupec/YUMParser_test.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.jkupec/YUMPa…
==============================================================================
--- trunk/libzypp/devel/devel.jkupec/YUMParser_test.cc (original)
+++ trunk/libzypp/devel/devel.jkupec/YUMParser_test.cc Mon Apr 30 18:35:53 2007
@@ -64,3 +64,5 @@
return 0;
}
+
+// vim: set ts=2 sts=2 sw=2 et ai:
Modified: trunk/libzypp/zypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/CMakeLists.txt?rev=…
==============================================================================
--- trunk/libzypp/zypp/CMakeLists.txt (original)
+++ trunk/libzypp/zypp/CMakeLists.txt Mon Apr 30 18:35:53 2007
@@ -541,6 +541,7 @@
parser/yum/RepomdFileReader.cc
parser/yum/PatchesFileReader.cc
parser/yum/PrimaryFileReader.cc
+ parser/yum/PatchFileReader.cc
)
SET( zypp_parser_yum_HEADERS
@@ -558,6 +559,7 @@
parser/yum/RepomdFileReader.h
parser/yum/PatchesFileReader.h
parser/yum/PrimaryFileReader.h
+ parser/yum/PatchFileReader.h
parser/yum/schemanames.h
)
@@ -566,14 +568,6 @@
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/parser/yum
)
-SET( zypp_parser_yum2_SRCS
- parser/yum2/YUMPrimaryParser.cc
-)
-
-SET( zypp_parser_yum2_HEADERS
- parser/yum2/YUMPrimaryParser.h
-)
-
INSTALL( FILES
${zypp_parser_yum2_HEADERS}
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/parser/yum2
@@ -768,6 +762,7 @@
source/yum/YUMProductImpl.cc
source/yum/YUMScriptImpl.cc
source/yum/YUMSourceImpl.cc
+ source/yum/YUMResourceType.cc
)
SET( zypp_source_yum_HEADERS
@@ -781,6 +776,7 @@
source/yum/YUMProductImpl.h
source/yum/YUMScriptImpl.h
source/yum/YUMSourceImpl.h
+ source/yum/YUMResourceType.h
)
INSTALL( FILES
Modified: trunk/libzypp/zypp/ResObject.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResObject.h?rev=546…
==============================================================================
--- trunk/libzypp/zypp/ResObject.h (original)
+++ trunk/libzypp/zypp/ResObject.h Mon Apr 30 18:35:53 2007
@@ -63,10 +63,10 @@
/** */
Vendor vendor() const;
- /** */
+ /** Installed size. */
ByteCount size() const;
- /** */
+ /** Size of the rpm package. */
ByteCount archivesize() const;
/** Backlink to the source providing this. */
Modified: trunk/libzypp/zypp/data/ResolvableData.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/data/ResolvableData…
==============================================================================
--- trunk/libzypp/zypp/data/ResolvableData.h (original)
+++ trunk/libzypp/zypp/data/ResolvableData.h Mon Apr 30 18:35:53 2007
@@ -71,9 +71,11 @@
std::string 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;
@@ -83,7 +85,7 @@
Date build_time;
Date install_time;
};
-
+
class AtomBase : public ResObject
{
public:
@@ -134,6 +136,21 @@
{
public:
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;
};
/*
@@ -229,7 +246,7 @@
std::string group;
std::string url;
std::string os;
-
+
std::string prein;
std::string postin;
std::string preun;
Added: trunk/libzypp/zypp/parser/yum/OtherFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/OtherFil…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/OtherFileReader.cc (added)
+++ trunk/libzypp/zypp/parser/yum/OtherFileReader.cc Mon Apr 30 18:35:53 2007
@@ -0,0 +1,75 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#include <fstream>
+
+#include "zypp/parser/yum/OtherFileReader.h"
+
+using namespace std;
+using namespace zypp::xml;
+
+namespace zypp
+{
+ namespace parser
+ {
+ namespace yum
+ {
+
+
+ OtherFileReader::OtherFileReader(const Pathname & other_file, ProcessOther callback)
+ : _callback(callback), _resolvable(NULL)
+ {
+ Reader reader(other_file);
+ MIL << "Reading " << other_file << endl;
+ reader.foreachNode(bind(&OtherFileReader::consumeNode, this, _1));
+ }
+
+
+ bool OtherFileReader::consumeNode(Reader & reader_r)
+ {
+ if (reader_r->nodeType() == XML_READER_TYPE_ELEMENT)
+ {
+ if (reader_r->name() == "package")
+ {
+ if (_resolvable) delete _resolvable;
+ _resolvable = new zypp::data::Resolvable();
+
+ _resolvable->name = reader_r->getAttribute("name").asString();
+ _resolvable->arch = Arch(reader_r->getAttribute("arch").asString());
+ return true;
+ }
+ if (reader_r->name() == "version")
+ {
+ _package->edition = Edition(reader_r->getAttribute("ver").asString(),
+ reader_r->getAttribute("rel").asString(),
+ reader_r->getAttribute("epoch").asString());
+ }
+ }
+ else if (reader_r->nodeType() == XML_READER_TYPE_END_ELEMENT)
+ {
+ if (reader_r->name() == "package")
+ {
+ // _callback(*_resolvable, changelog, checksum - package id);
+ if (_resolvable)
+ {
+ delete _resolvable;
+ _resolvable = NULL;
+ }
+ return true;
+ }
+ }
+ return true;
+ }
+
+
+ } // ns yum
+ } // ns parser
+} // ns zypp
+
+// vim: set ts=2 sts=2 sw=2 et ai:
Added: trunk/libzypp/zypp/parser/yum/OtherFileReader.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/OtherFil…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/OtherFileReader.h (added)
+++ trunk/libzypp/zypp/parser/yum/OtherFileReader.h Mon Apr 30 18:35:53 2007
@@ -0,0 +1,108 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#ifndef OTHERFILEREADER_H_
+#define OTHERFILEREADER_H_
+
+#include "zypp/base/Function.h"
+#include "zypp/base/Logger.h"
+#include "zypp/parser/xml/Reader.h"
+#include "zypp/data/ResolvableData.h"
+#include "zypp/parser/ParserProgress.h"
+
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "parser"
+
+namespace zypp
+{
+ namespace parser
+ {
+ namespace yum
+ {
+
+ /**
+ * Reads through a other.xml file and collects additional package data
+ * like changelogs.
+ *
+ * After a package is read, a \ref zypp::data::Resolvable
+ * and \ref changelog TODO is prepared and \ref _callback
+ * is called with these two objects passed in.
+ *
+ * The \ref _callback is provided on construction.
+ *
+ * \code
+ * PrimaryFileReader reader(repomd_file,
+ * bind(&SomeClass::callbackfunc, &object, _1));
+ * \endcode
+ */
+ class OtherFileReader
+ {
+ public:
+ /**
+ * Callback definition.
+ */
+ typedef function<bool(const zypp::data::Resolvable &)> ProcessPackage;
+
+
+ /**
+ * Constructor
+ * \param other_file the other.xml.gz file you want to read
+ * \param function to process \ref _resolvable data.
+ * \param progress progress reporting function TODO better progress reporting
+ *
+ * \see OtherFileReader::ProcessPackage
+ */
+ PrimaryFileReader(const Pathname & other_file,
+ ProcessPackage callback, ParserProgress::Ptr progress);
+
+ /**
+ * Callback provided to the XML parser.
+ */
+ bool consumeNode(zypp::xml::Reader & reader_r);
+
+ private:
+
+ /**
+ * Number of packages read so far.
+ */
+ unsigned _count;
+
+ /**
+ * Total number of packages to be read. This information is acquired from
+ * the <code>packages</code> attribute of <code>otherdata<code> tag.
+ */
+ unsigned _total_packages;
+
+ /**
+ * Pointer to the \ref zypp::data::Resolvable object for storing the NVRA
+ * data.
+ */
+ zypp::data::Resolvable *_resolvable;
+
+ /**
+ * Callback for processing package metadata passed in through constructor.
+ */
+ ProcessPackage _callback;
+
+ /**
+ * Progress reporting object.
+ */
+ ParserProgress::Ptr _progress;
+
+ long int _old_progress;
+ };
+
+
+ } // ns zypp
+ } // ns parser
+} // ns yum
+
+#endif /*OTHERFILEREADER_H_*/
+
+// vim: set ts=2 sts=2 sw=2 et ai:
Added: trunk/libzypp/zypp/parser/yum/PatchFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PatchFil…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PatchFileReader.cc (added)
+++ trunk/libzypp/zypp/parser/yum/PatchFileReader.cc Mon Apr 30 18:35:53 2007
@@ -0,0 +1,74 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#include <fstream>
+
+#include "zypp/parser/yum/PatchFileReader.h"
+
+using namespace std;
+using namespace zypp::xml;
+
+namespace zypp
+{
+ namespace parser
+ {
+ namespace yum
+ {
+
+
+ PatchFileReader::PatchFileReader(const Pathname & patch_file, ProcessPatch callback)
+ : _callback(callback), _patch(NULL)
+ {
+ Reader reader(patch_file);
+ MIL << "Reading " << patch_file << endl;
+ reader.foreachNode(bind(&PatchFileReader::consumeNode, this, _1));
+ }
+
+
+ bool PatchFileReader::consumeNode(Reader & reader_r)
+ {
+ if (reader_r->nodeType() == XML_READER_TYPE_ELEMENT)
+ {
+ if (reader_r->name() == "patch")
+ {
+ if (_patch) delete _patch;
+ _patch = new zypp::data::Patch();
+
+ _patch->id = reader_r->getAttribute("patchid").asString();
+ _patch->timestamp = Date(reader_r->getAttribute("timestamp").asString());
+ return true;
+ }
+ if (reader_r->name() == "yum:name")
+ {
+ _patch->name = reader_r.nodeText().asString();
+ return true;
+ }
+ }
+ else if (reader_r->nodeType() == XML_READER_TYPE_END_ELEMENT)
+ {
+ if (reader_r->name() == "patch")
+ {
+ _callback(*_patch);
+ if (_patch)
+ {
+ delete _patch;
+ _patch = NULL;
+ }
+ return true;
+ }
+ }
+ return true;
+ }
+
+
+ } // ns yum
+ } // ns parser
+} // ns zypp
+
+// vim: set ts=2 sts=2 sw=2 et ai:
Added: trunk/libzypp/zypp/parser/yum/PatchFileReader.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PatchFil…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PatchFileReader.h (added)
+++ trunk/libzypp/zypp/parser/yum/PatchFileReader.h Mon Apr 30 18:35:53 2007
@@ -0,0 +1,76 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#ifndef PATCHFILEREADER_H_
+#define PATCHFILEREADER_H_
+
+#include "zypp/base/Function.h"
+#include "zypp/base/Logger.h"
+#include "zypp/parser/xml/Reader.h"
+#include "zypp/data/ResolvableData.h"
+
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "parser"
+
+namespace zypp
+{
+ namespace parser
+ {
+ namespace yum
+ {
+
+
+ /**
+ *
+ */
+ class PatchFileReader
+ {
+ public:
+
+ /**
+ * Callback definition.
+ */
+ typedef function<bool(const zypp::data::Patch &)> ProcessPatch;
+
+ /**
+ *
+ */
+ PatchFileReader(const Pathname & patch_file, ProcessPatch callback);
+
+ /**
+ * Callback provided to the XML parser.
+ */
+ bool consumeNode(zypp::xml::Reader & reader_r);
+
+ private:
+ /**
+ * Callback for processing patch metadata passed in through constructor.
+ */
+ ProcessPatch _callback;
+
+ /**
+ * Pointer to the \ref zypp::data::Patch object for storing the patch
+ * metada (except of depencencies).
+ */
+ zypp::data::Patch *_patch;
+
+ /**
+ * A map of lists of strings for storing dependencies.
+ *
+ * \see zypp::data::Dependencies
+ */
+ zypp::data::Dependencies _deps;
+ };
+
+
+ }
+ }
+}
+
+#endif /*PATCHFILEREADER_H_*/
Modified: trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PrimaryF…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/yum/PrimaryFileReader.cc Mon Apr 30 18:35:53 2007
@@ -1,9 +1,18 @@
-//#include "zypp/base/String.h"
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
#include "zypp/base/Logger.h"
#include "zypp/parser/yum/PrimaryFileReader.h"
#include "zypp/Arch.h"
#include "zypp/Edition.h"
#include "zypp/TranslatedText.h"
+#include "zypp/ByteCount.h"
using namespace std;
using namespace zypp::xml;
@@ -16,8 +25,13 @@
{
- PrimaryFileReader::PrimaryFileReader(const Pathname &primary_file, ProcessPackage callback, ParserProgress::Ptr progress)
- : _callback(callback), _package(NULL), _count(0), _total_packages(0),
+ PrimaryFileReader::PrimaryFileReader(
+ const Pathname &primary_file,
+ ProcessPackage callback,
+ ParserProgress::Ptr progress)
+ :
+ _callback(callback), _package(NULL),
+ _count(0), _total_packages(0),
_tag(tag_NONE), _expect_rpm_entry(false), _dtype(zypp::Dep::REQUIRES),
_progress(progress), _old_progress(0)
{
@@ -95,13 +109,40 @@
if (reader_r->name() == "packager")
{
- _package->packager = reader_r.nodeText().asString();
+ _package->packager = reader_r.nodeText().asString();
+// DBG << "packager: " << _package->packager << endl;
+ return true;
+ }
+
+ if (reader_r->name() == "url")
+ {
+// DBG << "url: " << reader_r.nodeText().asString() << endl;
+ _package->url = reader_r.nodeText().asString();
return true;
}
- // TODO url
- // TODO time
- // TODO size
+ if (reader_r->name() == "time")
+ {
+ _package->build_time = reader_r->getAttribute("build").asString();
+ // ignoring reader_r->getAttribute("file").asString(); (rpm file timestamp)
+ return true;
+ }
+
+ if (reader_r->name() == "size")
+ {
+ // ???
+ // reader_r->getAttribute("archive").asString();
+
+ // installed size
+ ByteCount size(str::strtonum<long long>(reader_r->getAttribute("installed").asString()), Unit());
+ _package->size = size;
+
+ // rpm package size
+ ByteCount size_rpm(str::strtonum<long long>(reader_r->getAttribute("package").asString()), Unit());
+ _package->archive_size = size_rpm;
+
+ return true;
+ }
if (reader_r->name() == "location")
{
@@ -112,7 +153,6 @@
if (reader_r->name() == "format")
{
_tag = tag_format;
- _deps.clear();
return true;
}
}
@@ -120,7 +160,7 @@
{
if (reader_r->name() == "package")
{
- _callback(*_package, _deps);
+ _callback(*_package);
if (_package)
{
delete _package;
@@ -169,7 +209,7 @@
<< reader_r->getAttribute("name").asString()
<< " " << edition << endl;
*/
- _deps[_dtype].push_back(
+ _package->deps[_dtype].push_back(
zypp::capability::parse(
ResTraits<Package>::kind,
reader_r->getAttribute("name").asString(),
@@ -179,12 +219,42 @@
);
}
- // TODO license
- // TODO vendor
- // TODO group
- // TODO buildhost
- // TODO sourcerpm
- // TODO header-range
+ if (reader_r->name() == "rpm:license")
+ {
+ _package->license = reader_r.nodeText().asString();
+ return true;
+ }
+
+ if (reader_r->name() == "rpm:vendor")
+ {
+ _package->vendor = reader_r.nodeText().asString();
+ return true;
+ }
+
+ if (reader_r->name() == "rpm:group")
+ {
+ _package->group = reader_r.nodeText().asString();
+ return true;
+ }
+
+ if (reader_r->name() == "rpm:buildhost")
+ {
+ _package->buildhost = reader_r.nodeText().asString();
+ return true;
+ }
+
+ if (reader_r->name() == "rpm:sourcerpm")
+ {
+ //package->source = reader_r.nodeText().asString();
+ return true;
+ }
+
+ if (reader_r->name() == "rpm:header-range")
+ {
+ //reader_r->getAttribute("start").asString(),
+ //reader_r->getAttribute("end").asString(),
+ return true;
+ }
if (reader_r->name() == "rpm:provides")
{
@@ -240,7 +310,14 @@
_expect_rpm_entry = true;
return true;
}
- // TODO file
+
+ if (reader_r->name() == "file")
+ {
+ // TODO figure out how to read files
+ // file = reader_r.nodeText().asString();
+ // type = reader_r->getAttribute("type").asString();
+ return true;
+ }
}
else if (reader_r->nodeType() == XML_READER_TYPE_END_ELEMENT)
{
Modified: trunk/libzypp/zypp/parser/yum/PrimaryFileReader.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/PrimaryF…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/PrimaryFileReader.h (original)
+++ trunk/libzypp/zypp/parser/yum/PrimaryFileReader.h Mon Apr 30 18:35:53 2007
@@ -1,3 +1,12 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
#ifndef ZYPP_PARSER_YUM_PRIMARYFILEPARSER_H
#define ZYPP_PARSER_YUM_PRIMARYFILEPARSER_H
@@ -21,9 +30,8 @@
* Reads through a primary.xml file and collects package data including
* dependencies.
*
- * After a package is read, a \ref zypp::data::Package
- * and \ref zypp::data::Dependencies object is prepared and \ref _callback
- * is called with these two objects passed in.
+ * After a package is read, a \ref zypp::data::Package object is prepared
+ * and \ref _callback is called with this object passed in.
*
* The \ref _callback is provided on construction.
*
@@ -38,7 +46,7 @@
/**
* Callback definition.
*/
- typedef function<bool(const zypp::data::Package&, const zypp::data::Dependencies &deps)> ProcessPackage;
+ typedef function<bool(const zypp::data::Package &)> ProcessPackage;
/**
* Enumeration of some primary.xml tags.
@@ -49,20 +57,7 @@
tag_package,
tag_format
};
-/*
- enum RPMTag
- {
- rpmtag_NONE,
- rpmtag_provides,
- rpmtag_conflicts,
- rpmtag_obsoletes,
- rpmtag_requires,
- rpmtag_recommends,
- rpmtag_enhances,
- rpmtag_supplements,
- rpmtag_suggests
- };
-*/
+
/**
* Constructor
* \param primary_file the primary.xml.gz file you want to read
@@ -87,8 +82,6 @@
/** Used to remember primary.xml tag beeing currently processed. */
Tag _tag;
-// RPMTag _rpmtag;
-
/**
* Used to remember whether we are expecting an rpm:entry tag
* e.g. for rpm:requires
@@ -113,18 +106,11 @@
/**
* Pointer to the \ref zypp::data::Package object for storing the package
- * metada (except of depencencies are stored).
+ * metada
*/
zypp::data::Package *_package;
/**
- * A map of lists of strings for storing package dependencies.
- *
- * \see zypp::data::Dependencies
- */
- zypp::data::Dependencies _deps;
-
- /**
* Callback for processing package metadata passed in through constructor.
*/
ProcessPackage _callback;
Modified: trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/RepomdFi…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc (original)
+++ trunk/libzypp/zypp/parser/yum/RepomdFileReader.cc Mon Apr 30 18:35:53 2007
@@ -15,11 +15,12 @@
using namespace std;
using namespace zypp::xml;
+using zypp::source::yum::YUMResourceType;
-namespace zypp { namespace source { namespace yum {
+namespace zypp { namespace parser { namespace yum {
RepomdFileReader::RepomdFileReader( const Pathname &repomd_file, ProcessResource callback )
- : _tag(tag_NONE), _callback(callback)
+ : _tag(tag_NONE), _callback(callback), _type(YUMResourceType::NONE_e)
{
Reader reader( repomd_file );
MIL << "Reading " << repomd_file << endl;
@@ -40,7 +41,7 @@
if ( reader_r->name() == "data" )
{
_tag = tag_Data;
- _type = reader_r->getAttribute("type").asString();
+ _type = YUMResourceType(reader_r->getAttribute("type").asString());
return true;
}
if ( reader_r->name() == "location" )
Modified: trunk/libzypp/zypp/parser/yum/RepomdFileReader.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/parser/yum/RepomdFi…
==============================================================================
--- trunk/libzypp/zypp/parser/yum/RepomdFileReader.h (original)
+++ trunk/libzypp/zypp/parser/yum/RepomdFileReader.h Mon Apr 30 18:35:53 2007
@@ -15,13 +15,14 @@
#include "zypp/OnMediaLocation.h"
#include "zypp/base/Function.h"
#include "zypp/parser/xml/Reader.h"
+#include "zypp/source/yum/YUMResourceType.h"
using namespace std;
using namespace zypp::xml;
namespace zypp
{
- namespace source
+ namespace parser
{
namespace yum
{
@@ -46,8 +47,11 @@
* first parameter is a \ref OnMediaLocation object with the resource
* second parameter is the resource type
*/
- typedef function<bool( const OnMediaLocation &, const string & )> ProcessResource;
-
+ typedef function< bool(
+ const OnMediaLocation &,
+ const source::yum::YUMResourceType & )>
+ ProcessResource;
+
enum Tag
{
tag_NONE,
@@ -74,7 +78,7 @@
private:
OnMediaLocation _location;
Tag _tag;
- std::string _type;
+ source::yum::YUMResourceType _type;
ProcessResource _callback;
CheckSum _checksum;
std::string _checksum_type;
Modified: trunk/libzypp/zypp/source/yum/YUMDownloader.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/source/yum/YUMDownl…
==============================================================================
--- trunk/libzypp/zypp/source/yum/YUMDownloader.cc (original)
+++ trunk/libzypp/zypp/source/yum/YUMDownloader.cc Mon Apr 30 18:35:53 2007
@@ -20,6 +20,7 @@
using namespace std;
using namespace zypp::xml;
+using namespace zypp::parser::yum;
namespace zypp
{
@@ -41,7 +42,7 @@
}
-bool YUMDownloader::repomd_Callback( const OnMediaLocation &loc, const string &dtype )
+bool YUMDownloader::repomd_Callback( const OnMediaLocation &loc, const YUMResourceType &dtype )
{
MIL << dtype << " : " << loc << endl;
_fetcher.enqueue(loc);
@@ -49,7 +50,7 @@
// We got a patches file we need to read, to add patches listed
// there, so we transfer what we have in the queue, and
// queue the patches in the patches callback
- if ( dtype == "patches" )
+ if ( dtype == YUMResourceType::PATCHES )
{
_fetcher.start( _dest_dir, _media);
// now the patches.xml file must exists
Modified: trunk/libzypp/zypp/source/yum/YUMDownloader.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/source/yum/YUMDownl…
==============================================================================
--- trunk/libzypp/zypp/source/yum/YUMDownloader.h (original)
+++ trunk/libzypp/zypp/source/yum/YUMDownloader.h Mon Apr 30 18:35:53 2007
@@ -16,6 +16,7 @@
#include "zypp/OnMediaLocation.h"
#include "zypp/MediaSetAccess.h"
#include "zypp/parser/xml/Reader.h"
+#include "zypp/source/yum/YUMResourceType.h"
namespace zypp
{
@@ -46,7 +47,7 @@
void download( const Pathname &dest_dir );
protected:
- bool repomd_Callback( const OnMediaLocation &loc, const std::string &dtype );
+ bool repomd_Callback( const OnMediaLocation &loc, const YUMResourceType &dtype );
bool patches_Callback( const OnMediaLocation &loc, const std::string &id );
private:
Url _url;
Added: trunk/libzypp/zypp/source/yum/YUMResourceType.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/source/yum/YUMResou…
==============================================================================
--- trunk/libzypp/zypp/source/yum/YUMResourceType.cc (added)
+++ trunk/libzypp/zypp/source/yum/YUMResourceType.cc Mon Apr 30 18:35:53 2007
@@ -0,0 +1,90 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#include <map>
+
+#include "zypp/base/Exception.h"
+
+#include "YUMResourceType.h"
+//#include <iostream>
+
+namespace zypp
+{
+ namespace source
+ {
+ namespace yum
+ {
+
+
+ static std::map<std::string,YUMResourceType::Type> _table;
+
+ const YUMResourceType YUMResourceType::REPOMD(YUMResourceType::REPOMD_e);
+ const YUMResourceType YUMResourceType::PRIMARY(YUMResourceType::PRIMARY_e);
+ const YUMResourceType YUMResourceType::OTHER(YUMResourceType::OTHER_e);
+ const YUMResourceType YUMResourceType::FILELISTS(YUMResourceType::FILELISTS_e);
+ const YUMResourceType YUMResourceType::GROUP(YUMResourceType::GROUP_e);
+ const YUMResourceType YUMResourceType::PATCHES(YUMResourceType::PATCHES_e);
+ const YUMResourceType YUMResourceType::PATCH(YUMResourceType::PATCH_e);
+ const YUMResourceType YUMResourceType::PRODUCT(YUMResourceType::PRODUCT_e);
+
+
+ YUMResourceType::YUMResourceType(const std::string & strval_r)
+ : _type(parse(strval_r))
+ {}
+
+ YUMResourceType::Type YUMResourceType::parse(const std::string & strval_r)
+ {
+ if (_table.empty())
+ {
+ // initialize it
+ _table["repomd"] = YUMResourceType::REPOMD_e;
+ _table["primary"] = YUMResourceType::PRIMARY_e;
+ _table["other"] = YUMResourceType::OTHER_e;
+ _table["filelists"] = YUMResourceType::FILELISTS_e;
+ _table["group"] = YUMResourceType::GROUP_e;
+ _table["patches"] = YUMResourceType::PATCHES_e;
+ _table["patch"] = YUMResourceType::PATCH_e;
+ _table["product"] = YUMResourceType::PRODUCT_e;
+ _table["NONE"] = _table["none"] = YUMResourceType::NONE_e;
+ }
+
+ std::map<std::string,YUMResourceType::Type>::const_iterator it
+ = _table.find(strval_r);
+ if (it == _table.end())
+ {
+ ZYPP_THROW(Exception(
+ "YUMResourceType parse: illegal string value '" + strval_r + "'"));
+ }
+ return it->second;
+ }
+
+
+ const std::string & YUMResourceType::asString() const
+ {
+ static std::map<Type, std::string> _table;
+ if ( _table.empty() )
+ {
+ // initialize it
+ _table[REPOMD_e] = "repomd";
+ _table[PRIMARY_e] = "primary";
+ _table[OTHER_e] = "other";
+ _table[FILELISTS_e] = "filelists";
+ _table[GROUP_e] = "group";
+ _table[PATCHES_e] = "patches";
+ _table[PATCH_e] = "patch";
+ _table[PRODUCT_e] = "product";
+ _table[NONE_e] = "NONE";
+ }
+ return _table[_type];
+ }
+
+
+ }
+ }
+}
Added: trunk/libzypp/zypp/source/yum/YUMResourceType.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/source/yum/YUMResou…
==============================================================================
--- trunk/libzypp/zypp/source/yum/YUMResourceType.h (added)
+++ trunk/libzypp/zypp/source/yum/YUMResourceType.h Mon Apr 30 18:35:53 2007
@@ -0,0 +1,76 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#ifndef YUMRESOURCETYPE_H_
+#define YUMRESOURCETYPE_H_
+
+#include<string>
+
+
+namespace zypp
+{
+ namespace source
+ {
+ namespace yum
+ {
+
+
+ /**
+ *
+ */
+ struct YUMResourceType
+ {
+ static const YUMResourceType REPOMD;
+ static const YUMResourceType PRIMARY;
+ static const YUMResourceType OTHER;
+ static const YUMResourceType FILELISTS;
+ static const YUMResourceType GROUP;
+ static const YUMResourceType PATCHES; // suse extension
+ static const YUMResourceType PATCH; // suse extension
+ static const YUMResourceType PRODUCT; // suse extension
+
+ enum Type
+ {
+ NONE_e,
+ REPOMD_e,
+ PRIMARY_e,
+ OTHER_e,
+ FILELISTS_e,
+ GROUP_e,
+ PATCHES_e,
+ PATCH_e,
+ PRODUCT_e
+ };
+
+ YUMResourceType(Type type) : _type(type) {}
+
+ explicit YUMResourceType(const std::string & strval_r);
+
+ const Type toEnum() const { return _type; }
+
+ YUMResourceType::Type parse(const std::string & strval_r);
+
+ const std::string & asString() const;
+
+ Type _type;
+ };
+
+
+ inline std::ostream & operator<<( std::ostream & str, const YUMResourceType & obj )
+ { return str << obj.asString(); }
+
+ inline bool operator==(const YUMResourceType & obj1, const YUMResourceType & obj2)
+ { return obj1._type == obj2._type; }
+
+ }
+ }
+}
+#endif /*YUMRESOURCETYPE_H_*/
+
+// vim: set ts=2 sts=2 sw=2 et ai:
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
30 Apr '07
Author: jkupec
Date: Mon Apr 30 18:12:27 2007
New Revision: 5462
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5462&view=rev
Log:
unused code
Removed:
trunk/libzypp/zypp/parser/yum2/
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5461 - in /trunk: ./ libzypp/devel/devel.dmacvicar/ libzypp/zypp2/ libzypp/zypp2/repository/
by dmacvicar@svn.opensuse.org 29 Apr '07
by dmacvicar@svn.opensuse.org 29 Apr '07
29 Apr '07
Author: dmacvicar
Date: Mon Apr 30 01:01:54 2007
New Revision: 5461
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5461&view=rev
Log:
r5186@piscolita: duncan | 2007-04-30 00:59:32 +0200
fix uncimplete commit
Added:
trunk/libzypp/zypp2/repository/RepositoryImpl.cc
trunk/libzypp/zypp2/repository/RepositoryImpl.h
Modified:
trunk/ (props changed)
trunk/libzypp/devel/devel.dmacvicar/CachedSource_tp.cc
trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc
trunk/libzypp/devel/devel.dmacvicar/testbed.cc
trunk/libzypp/zypp2/CMakeLists.txt
trunk/libzypp/zypp2/RepositoryInfo.cc
trunk/libzypp/zypp2/RepositoryInfo.h
Modified: trunk/libzypp/devel/devel.dmacvicar/CachedSource_tp.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/Ca…
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/CachedSource_tp.cc (original)
+++ trunk/libzypp/devel/devel.dmacvicar/CachedSource_tp.cc Mon Apr 30 01:01:54 2007
@@ -10,14 +10,14 @@
#include "zypp/Product.h"
#include "zypp/detail/PackageImplIf.h"
#include "zypp/Package.h"
-#include "zypp/SourceFactory.h"
-#include "zypp2/source/cached/CachedSourceImpl.h"
+#include "zypp2/RepositoryFactory.h"
+#include "zypp2/repository/cached/CachedRepositoryImpl.h"
#include "zypp/data/ResolvableData.h"
using namespace std;
using namespace zypp;
-using namespace zypp::source;
-using namespace zypp::source::cached;
+using namespace zypp::repository;
+using namespace zypp::repository::cached;
int main(int argc, char **argv)
@@ -28,12 +28,12 @@
Pathname dbpath = Pathname(getenv("PWD"));
- SourceImpl_Ptr sourceImpl(new CachedSourceImpl(dbpath));
- SourceFactory factory;
- Source_Ref source = factory.createFrom(sourceImpl);
- ResStore dbres = source.resolvables();
+ //RepositoryImpl_Ptr repositoryImpl(new CachedRepositoryImpl(dbpath));
+ //RepositoryFactory factory;
+ //Repository_Ref repository = factory.createFrom(repositoryImpl);
+ //ResStore dbres = repository.resolvables();
- MIL << dbres.size() << " resolvables" << endl;
+ //MIL << dbres.size() << " resolvables" << endl;
}
catch ( const Exception &e )
Modified: trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/Re…
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc (original)
+++ trunk/libzypp/devel/devel.dmacvicar/RepositoryManager_tp.cc Mon Apr 30 01:01:54 2007
@@ -11,12 +11,15 @@
#include "zypp/Product.h"
#include "zypp/detail/PackageImplIf.h"
#include "zypp/Package.h"
-#include "zypp/SourceFactory.h"
+#include "zypp2/RepositoryFactory.h"
+#include "zypp2/RepositoryInfo.h"
-#include "zypp2/source/cached/CachedSourceImpl.h"
+#include "zypp2/repository/cached/CachedRepositoryImpl.h"
#include "zypp/data/ResolvableData.h"
-#include "RepositoryManager.h"
+#include "zypp2/RepositoryManager.h"
+#include "zypp2/RepositoryInfo.h"
+
using namespace std;
using namespace zypp;
@@ -32,7 +35,12 @@
Pathname dbpath = Pathname(getenv("PWD"));
RepositoryManager manager;
- list<SourceInfo> sources = manager.knownRepositories();
+ RepositoryInfoList repos = manager.knownRepositories();
+
+ for ( RepositoryInfoList::const_iterator it = repos.begin(); it != repos.end(); ++it )
+ {
+ cout << *it << endl;
+ }
}
catch ( const Exception &e )
{
Modified: trunk/libzypp/devel/devel.dmacvicar/testbed.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/te…
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/testbed.cc (original)
+++ trunk/libzypp/devel/devel.dmacvicar/testbed.cc Mon Apr 30 01:01:54 2007
@@ -10,14 +10,14 @@
#include "zypp/Product.h"
#include "zypp/detail/PackageImplIf.h"
#include "zypp/Package.h"
-#include "zypp/SourceFactory.h"
-#include "zypp2/source/cached/CachedSourceImpl.h"
+#include "zypp2/RepositoryFactory.h"
+#include "zypp2/repository/cached/CachedRepositoryImpl.h"
#include "zypp/data/ResolvableData.h"
using namespace std;
using namespace zypp;
-using namespace zypp::source;
-using namespace zypp::source::cached;
+using namespace zypp::repository;
+using namespace zypp::repository::cached;
int main(int argc, char **argv)
@@ -28,12 +28,12 @@
Pathname dbpath = Pathname(getenv("PWD"));
- SourceImpl_Ptr sourceImpl(new CachedSourceImpl(dbpath));
- SourceFactory factory;
- Source_Ref source = factory.createFrom(sourceImpl);
- ResStore dbres = source.resolvables();
+ //RepositoryImpl_Ptr repositoryImpl(new CachedRepositoryImpl(dbpath));
+ //RepositoryFactory factory;
+ //Repository_Ref repository = factory.createFrom(repositoryImpl);
+ //ResStore dbres = repository.resolvables();
- MIL << dbres.size() << " resolvables" << endl;
+ //MIL << dbres.size() << " resolvables" << endl;
}
catch ( const Exception &e )
Modified: trunk/libzypp/zypp2/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/CMakeLists.txt?rev…
==============================================================================
--- trunk/libzypp/zypp2/CMakeLists.txt (original)
+++ trunk/libzypp/zypp2/CMakeLists.txt Mon Apr 30 01:01:54 2007
@@ -10,19 +10,19 @@
SET( zypp2_SRCS
-# Repository.cc
-# RepositoryInfo.cc
-# RepositoryManager.cc
-# RepositoryFactory.cc
+ Repository.cc
+ RepositoryInfo.cc
+ RepositoryManager.cc
+ RepositoryFactory.cc
Lazy.cc
dummy.cc
)
SET( zypp2_HEADERS
-# Repository.h
-# RepositoryInfo.h
-# RepositoryManager.h
-# RepositoryFactory.h
+ Repository.h
+ RepositoryInfo.h
+ RepositoryManager.h
+ RepositoryFactory.h
CommiterIface.h
Lazy.h
)
@@ -78,25 +78,25 @@
# DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp2/cache/sqlite3x
#)
-#SET( zypp2_repository_SRCS
-# repository/dummy.cc
-# repository/RepositoryImpl.cc
-#)
+SET( zypp2_repository_SRCS
+ repository/dummy.cc
+ repository/RepositoryImpl.cc
+)
-#SET( zypp2_repository_HEADERS
-# repository/dummy.h
-# repository/RepositoryImpl.h
-#)
+SET( zypp2_repository_HEADERS
+ repository/dummy.h
+ repository/RepositoryImpl.h
+)
-#SET( zypp2_repository_cached_SRCS
-# repository/cached/CachedRepositoryImpl.cc
-# repository/cached/CachedRepositoryPackageImpl.cc
-#)
+SET( zypp2_repository_cached_SRCS
+ repository/cached/CachedRepositoryImpl.cc
+ repository/cached/CachedRepositoryPackageImpl.cc
+)
-#SET( zypp2_repository_cached_HEADERS
-# repository/cached/CachedRepositoryImpl.h
-# repository/cached/CachedRepositoryPackageImpl.h
-#)
+SET( zypp2_repository_cached_HEADERS
+ repository/cached/CachedRepositoryImpl.h
+ repository/cached/CachedRepositoryPackageImpl.h
+)
#INSTALL( FILES
# ${zypp2_repository_sqlite-repository_HEADERS}
Modified: trunk/libzypp/zypp2/RepositoryInfo.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepositoryInfo.cc?…
==============================================================================
--- trunk/libzypp/zypp2/RepositoryInfo.cc (original)
+++ trunk/libzypp/zypp2/RepositoryInfo.cc Mon Apr 30 01:01:54 2007
@@ -31,13 +31,11 @@
RepositoryInfo::RepositoryInfo( const Url & url,
const Pathname & path,
const std::string & alias,
- const Pathname & cache_dir,
tribool autorefresh)
: _enabled (true),
_autorefresh(autorefresh),
_base_repository( indeterminate ),
_url(url),
- _cache_dir(cache_dir),
_path(path),
_alias(alias)
{
@@ -86,12 +84,6 @@
return *this;
}
- RepositoryInfo & RepositoryInfo::setCacheDir( const Pathname &p )
- {
- _cache_dir = p;
- return *this;
- }
-
RepositoryInfo & RepositoryInfo::setDescription( const std::string &description )
{
_description = description;
@@ -119,9 +111,6 @@
boost::tribool RepositoryInfo::baseRepository() const
{ return _base_repository; }
- Pathname RepositoryInfo::cacheDir() const
- { return _cache_dir; }
-
Pathname RepositoryInfo::path() const
{ return _path; }
@@ -153,7 +142,6 @@
str << "- enabled : " << enabled() << std::endl;
str << "- autorefresh : " << autorefresh() << std::endl;
str << "- path : " << path() << std::endl;
- str << "- cache_dir : " << cacheDir() << std::endl;
return str;
}
Modified: trunk/libzypp/zypp2/RepositoryInfo.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepositoryInfo.h?r…
==============================================================================
--- trunk/libzypp/zypp2/RepositoryInfo.h (original)
+++ trunk/libzypp/zypp2/RepositoryInfo.h Mon Apr 30 01:01:54 2007
@@ -28,7 +28,7 @@
RepositoryInfo();
- RepositoryInfo( const Url & url, const Pathname & path, const std::string & alias = "", const Pathname & cache_dir = "", boost::tribool autorefresh = boost::indeterminate );
+ RepositoryInfo( const Url & url, const Pathname & path, const std::string & alias = "", boost::tribool autorefresh = boost::indeterminate );
RepositoryInfo & setEnabled( boost::tribool enabled );
RepositoryInfo & setAutorefresh( boost::tribool autorefresh );
@@ -44,7 +44,6 @@
boost::tribool enabled() const;
boost::tribool autorefresh() const;
boost::tribool baseRepository() const;
- Pathname cacheDir() const;
Pathname path() const;
std::string alias() const;
std::string type() const;
Added: trunk/libzypp/zypp2/repository/RepositoryImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/Reposit…
==============================================================================
--- trunk/libzypp/zypp2/repository/RepositoryImpl.cc (added)
+++ trunk/libzypp/zypp2/repository/RepositoryImpl.cc Mon Apr 30 01:01:54 2007
@@ -0,0 +1,23 @@
+
+#include "repository/RepositoryImpl.h"
+
+namespace zypp { namespace repository {
+
+IMPL_PTR_TYPE(RepositoryImpl)
+
+RepositoryImpl::RepositoryImpl()
+{
+
+}
+
+RepositoryImpl::~RepositoryImpl()
+{
+
+}
+
+RepositoryImpl::RepositoryImpl( const null & )
+ : base::ProvideNumericId<RepositoryImpl,Repository::NumericId>( NULL )
+{}
+
+} } // ns
+
Added: trunk/libzypp/zypp2/repository/RepositoryImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/Reposit…
==============================================================================
--- trunk/libzypp/zypp2/repository/RepositoryImpl.h (added)
+++ trunk/libzypp/zypp2/repository/RepositoryImpl.h Mon Apr 30 01:01:54 2007
@@ -0,0 +1,54 @@
+
+
+
+
+#ifndef ZYPP_REPOSITORY_IMPL_h
+#define ZYPP_REPOSITORY_IMPL_h
+
+#include <iostream>
+#include <iosfwd>
+#include <string>
+
+#include "zypp/base/ReferenceCounted.h"
+#include "zypp/base/NonCopyable.h"
+#include "zypp/base/PtrTypes.h"
+#include "zypp/base/ProvideNumericId.h"
+#include "zypp2/Repository.h"
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace repository
+ { /////////////////////////////////////////////////////////////////
+
+ DEFINE_PTR_TYPE(RepositoryImpl);
+
+ class RepositoryImpl : public base::ReferenceCounted,
+ public base::ProvideNumericId<RepositoryImpl,Repository::NumericId>,
+ private base::NonCopyable
+ {
+ friend std::ostream & operator<<( std::ostream & str, const RepositoryImpl & obj );
+ public:
+ RepositoryImpl();
+
+ ~RepositoryImpl();
+
+ struct null {};
+ public:
+ /** Offer default Impl. */
+ static RepositoryImpl_Ptr nullimpl()
+ {
+ static RepositoryImpl_Ptr _nullimpl( new RepositoryImpl( null() ) );
+ return _nullimpl;
+ }
+
+ RepositoryImpl( const null & );
+
+ Repository selfRepository()
+ { return Repository( this ); }
+ };
+
+ }
+}
+
+#endif
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
27 Apr '07
Author: mlandres
Date: Sat Apr 28 00:02:38 2007
New Revision: 5460
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5460&view=rev
Log:
disable Repository draft: incomplete checkin does not compile
Modified:
trunk/libzypp/zypp2/CMakeLists.txt
Modified: trunk/libzypp/zypp2/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/CMakeLists.txt?rev…
==============================================================================
--- trunk/libzypp/zypp2/CMakeLists.txt (original)
+++ trunk/libzypp/zypp2/CMakeLists.txt Sat Apr 28 00:02:38 2007
@@ -10,19 +10,19 @@
SET( zypp2_SRCS
- Repository.cc
- RepositoryInfo.cc
- RepositoryManager.cc
- RepositoryFactory.cc
+# Repository.cc
+# RepositoryInfo.cc
+# RepositoryManager.cc
+# RepositoryFactory.cc
Lazy.cc
dummy.cc
)
SET( zypp2_HEADERS
- Repository.h
- RepositoryInfo.h
- RepositoryManager.h
- RepositoryFactory.h
+# Repository.h
+# RepositoryInfo.h
+# RepositoryManager.h
+# RepositoryFactory.h
CommiterIface.h
Lazy.h
)
@@ -78,25 +78,25 @@
# DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp2/cache/sqlite3x
#)
-SET( zypp2_repository_SRCS
- repository/dummy.cc
- repository/RepositoryImpl.cc
-)
+#SET( zypp2_repository_SRCS
+# repository/dummy.cc
+# repository/RepositoryImpl.cc
+#)
-SET( zypp2_repository_HEADERS
- repository/dummy.h
- repository/RepositoryImpl.h
-)
+#SET( zypp2_repository_HEADERS
+# repository/dummy.h
+# repository/RepositoryImpl.h
+#)
-SET( zypp2_repository_cached_SRCS
- repository/cached/CachedRepositoryImpl.cc
- repository/cached/CachedRepositoryPackageImpl.cc
-)
+#SET( zypp2_repository_cached_SRCS
+# repository/cached/CachedRepositoryImpl.cc
+# repository/cached/CachedRepositoryPackageImpl.cc
+#)
-SET( zypp2_repository_cached_HEADERS
- repository/cached/CachedRepositoryImpl.h
- repository/cached/CachedRepositoryPackageImpl.h
-)
+#SET( zypp2_repository_cached_HEADERS
+# repository/cached/CachedRepositoryImpl.h
+# repository/cached/CachedRepositoryPackageImpl.h
+#)
#INSTALL( FILES
# ${zypp2_repository_sqlite-repository_HEADERS}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5459 - in /trunk: ./ libzypp/devel/devel.dmacvicar/ libzypp/zypp/ libzypp/zypp2/ libzypp/zypp2/repository/ libzypp/zypp2/repository/cached/ libzypp/zypp2/source/
by dmacvicar@svn.opensuse.org 27 Apr '07
by dmacvicar@svn.opensuse.org 27 Apr '07
27 Apr '07
Author: dmacvicar
Date: Fri Apr 27 18:06:37 2007
New Revision: 5459
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5459&view=rev
Log:
r5166@piscola: dmacvicar | 2007-04-27 13:32:22 +0200
source -> repo
r5167@piscola: dmacvicar | 2007-04-27 13:34:02 +0200
source -> repo
r5168@piscola: dmacvicar | 2007-04-27 17:59:33 +0200
end of line
r5171@piscola: dmacvicar | 2007-04-27 18:04:39 +0200
put new classes in piece and make everything compile again.
Added:
trunk/libzypp/zypp2/Repository.cc
trunk/libzypp/zypp2/Repository.h
trunk/libzypp/zypp2/RepositoryFactory.cc
trunk/libzypp/zypp2/RepositoryFactory.h
trunk/libzypp/zypp2/RepositoryInfo.cc
trunk/libzypp/zypp2/RepositoryInfo.h
trunk/libzypp/zypp2/RepositoryManager.cc
- copied, changed from r5456, trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.cc
trunk/libzypp/zypp2/RepositoryManager.h
- copied, changed from r5456, trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.h
trunk/libzypp/zypp2/repository/
- copied from r5451, trunk/libzypp/zypp2/source/
trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.cc
trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.h
trunk/libzypp/zypp2/repository/cached/CachedRepositoryPackageImpl.cc
trunk/libzypp/zypp2/repository/cached/CachedRepositoryPackageImpl.h
Removed:
trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.cc
trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.h
trunk/libzypp/zypp2/source/
Modified:
trunk/ (props changed)
trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt
trunk/libzypp/zypp/Edition.cc
trunk/libzypp/zypp2/CMakeLists.txt
Modified: trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.dmacvicar/CM…
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt (original)
+++ trunk/libzypp/devel/devel.dmacvicar/CMakeLists.txt Fri Apr 27 18:06:37 2007
@@ -32,9 +32,9 @@
TARGET_LINK_LIBRARIES(cachedsource zypp )
TARGET_LINK_LIBRARIES(cachedsource zypp2 )
-ADD_EXECUTABLE(repomanager RepositoryManager_tp.cc RepositoryManager.cc)
+ADD_EXECUTABLE(repomanager RepositoryManager_tp.cc)
TARGET_LINK_LIBRARIES(repomanager zypp )
-#TARGET_LINK_LIBRARIES(repomanager zypp2 )
+TARGET_LINK_LIBRARIES(repomanager zypp2 )
FIND_PACKAGE(Zsync)
IF(ZSYNC_FOUND)
Modified: trunk/libzypp/zypp/Edition.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Edition.cc?rev=5459…
==============================================================================
--- trunk/libzypp/zypp/Edition.cc (original)
+++ trunk/libzypp/zypp/Edition.cc Fri Apr 27 18:06:37 2007
@@ -321,3 +321,5 @@
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
+
+
Modified: trunk/libzypp/zypp2/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/CMakeLists.txt?rev…
==============================================================================
--- trunk/libzypp/zypp2/CMakeLists.txt (original)
+++ trunk/libzypp/zypp2/CMakeLists.txt Fri Apr 27 18:06:37 2007
@@ -10,11 +10,19 @@
SET( zypp2_SRCS
+ Repository.cc
+ RepositoryInfo.cc
+ RepositoryManager.cc
+ RepositoryFactory.cc
Lazy.cc
dummy.cc
)
SET( zypp2_HEADERS
+ Repository.h
+ RepositoryInfo.h
+ RepositoryManager.h
+ RepositoryFactory.h
CommiterIface.h
Lazy.h
)
@@ -70,36 +78,42 @@
# DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp2/cache/sqlite3x
#)
-SET( zypp2_source_SRCS
- source/dummy.cc
+SET( zypp2_repository_SRCS
+ repository/dummy.cc
+ repository/RepositoryImpl.cc
)
-SET( zypp2_source_cached_SRCS
- source/cached/CachedSourceImpl.cc
- source/cached/CachedSourcePackageImpl.cc
+SET( zypp2_repository_HEADERS
+ repository/dummy.h
+ repository/RepositoryImpl.h
)
-SET( zypp2_source_cached_HEADERS
- source/cached/CachedSourceImpl.h
- source/cached/CachedSourcePackageImpl.h
+SET( zypp2_repository_cached_SRCS
+ repository/cached/CachedRepositoryImpl.cc
+ repository/cached/CachedRepositoryPackageImpl.cc
+)
+
+SET( zypp2_repository_cached_HEADERS
+ repository/cached/CachedRepositoryImpl.h
+ repository/cached/CachedRepositoryPackageImpl.h
)
#INSTALL( FILES
-# ${zypp2_source_sqlite-source_HEADERS}
-# DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp2/source/sqlite-source
+# ${zypp2_repository_sqlite-repository_HEADERS}
+# DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp2/repository/sqlite-repository
#)
SET( zypp2_lib_SRCS
-${zypp2_source_SRCS}
+${zypp2_repository_SRCS}
${zypp2_SRCS}
${zypp2_cache_SRCS}
-${zypp2_source_cached_SRCS}
+${zypp2_repository_cached_SRCS}
${zypp2_cache_sqlite3x_SRCS}
)
SET( zypp2_lib_HEADERS
-${zypp2_source_HEADERS}
+${zypp2_repository_HEADERS}
${zypp2_HEADERS}
${zypp2_cache_HEADERS}
${zypp2_cache_sqlite3x_HEADERS}
Added: trunk/libzypp/zypp2/Repository.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/Repository.cc?rev=…
==============================================================================
--- trunk/libzypp/zypp2/Repository.cc (added)
+++ trunk/libzypp/zypp2/Repository.cc Fri Apr 27 18:06:37 2007
@@ -0,0 +1,45 @@
+#include <cassert>
+#include <iostream>
+
+#include "zypp2/Repository.h"
+#include "zypp2/repository/RepositoryImpl.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ const Repository Repository::noRepository;
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : Repository::Repository
+ // METHOD TYPE : Ctor
+ //
+ Repository::Repository()
+ : _pimpl( Impl::nullimpl() )
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : Repository::Repository
+ // METHOD TYPE : Ctor
+ //
+ Repository::Repository( const Impl_Ptr & impl_r )
+ : _pimpl( impl_r )
+ {
+ assert( impl_r );
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // Forward to RepositoryImpl:
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ Repository::NumericId Repository::numericId() const
+ { return _pimpl->numericId(); }
+
+}
+
Added: trunk/libzypp/zypp2/Repository.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/Repository.h?rev=5…
==============================================================================
--- trunk/libzypp/zypp2/Repository.h (added)
+++ trunk/libzypp/zypp2/Repository.h Fri Apr 27 18:06:37 2007
@@ -0,0 +1,77 @@
+
+#ifndef ZYPP_REPOSITORY_H
+#define ZYPP_REPOSITORY_H
+
+#include <iosfwd>
+#include <string>
+
+#include "zypp/base/PtrTypes.h"
+#include "zypp/base/SafeBool.h"
+
+namespace zypp
+{
+ namespace repository
+ {
+ DEFINE_PTR_TYPE(RepositoryImpl);
+ class RepositoryImpl;
+ }
+
+ class Repository : protected base::SafeBool<Repository> /* private, but gcc refuses */
+ {
+ public:
+ friend std::ostream & operator<<( std::ostream & str, const Repository & obj );
+ friend bool operator==( const Repository & lhs, const Repository & rhs );
+ friend bool operator<( const Repository & lhs, const Repository & rhs );
+
+ public:
+ typedef repository::RepositoryImpl Impl;
+ typedef repository::RepositoryImpl_Ptr Impl_Ptr;
+
+ public:
+
+ /** Default ctor: noRepository.
+ * Real Repositorys are to be created via RepositoryFactory.
+ */
+ Repository();
+
+ /** A dummy Repository (Id \c 0) providing nothing, doing nothing.
+ * \todo provide a _constRef
+ */
+ static const Repository noRepository;
+
+ /** Validate Repository in a boolean context.
+ * \c FALSE iff == noRepository.
+ */
+ using base::SafeBool<Repository>::operator bool_type;
+
+ public:
+ typedef unsigned long NumericId;
+
+ /** Runtime unique numeric Repository Id. */
+ NumericId numericId() const;
+ private:
+ friend base::SafeBool<Repository>::operator bool_type() const;
+ /** \ref SafeBool test. */
+ bool boolTest() const
+ { return _pimpl != noRepository._pimpl; }
+
+ private:
+ /** Factory */
+ friend class RepositoryFactory;
+ friend class repository::RepositoryImpl;
+
+ private:
+ /** Factory ctor */
+ explicit
+ Repository( const Impl_Ptr & impl_r );
+
+ private:
+ /** Pointer to implementation */
+ Impl_Ptr _pimpl;
+ };
+
+}
+
+#endif
+
+
Added: trunk/libzypp/zypp2/RepositoryFactory.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepositoryFactory.…
==============================================================================
--- trunk/libzypp/zypp2/RepositoryFactory.cc (added)
+++ trunk/libzypp/zypp2/RepositoryFactory.cc Fri Apr 27 18:06:37 2007
@@ -0,0 +1,23 @@
+
+#include "zypp2/RepositoryFactory.h"
+
+namespace zypp {
+
+RepositoryFactory::RepositoryFactory()
+{
+}
+
+RepositoryFactory::~RepositoryFactory()
+{
+
+}
+
+
+Repository RepositoryFactory::createFrom( const RepositoryInfo & context )
+{
+
+}
+
+} // ns zypp
+
+
Added: trunk/libzypp/zypp2/RepositoryFactory.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepositoryFactory.…
==============================================================================
--- trunk/libzypp/zypp2/RepositoryFactory.h (added)
+++ trunk/libzypp/zypp2/RepositoryFactory.h Fri Apr 27 18:06:37 2007
@@ -0,0 +1,30 @@
+
+#ifndef ZYPP_REPOSITORY_FACTORY_H
+#define ZYPP_REPOSITORY_FACTORY_H
+
+#include "zypp2/Repository.h"
+#include "zypp2/RepositoryInfo.h"
+
+namespace zypp
+{
+ class RepositoryFactory
+ {
+ friend std::ostream & operator<<( std::ostream & str, const RepositoryFactory & obj );
+
+ public:
+ /** Default ctor */
+ RepositoryFactory();
+ /** Dtor */
+ ~RepositoryFactory();
+
+ public:
+ /** Construct source.
+ * \throw EXCEPTION on fail
+ */
+ Repository createFrom( const RepositoryInfo & context );
+ };
+}
+
+#endif
+
+
Added: trunk/libzypp/zypp2/RepositoryInfo.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepositoryInfo.cc?…
==============================================================================
--- trunk/libzypp/zypp2/RepositoryInfo.cc (added)
+++ trunk/libzypp/zypp2/RepositoryInfo.cc Fri Apr 27 18:06:37 2007
@@ -0,0 +1,163 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/repository/RepositoryInfo.cc
+ *
+*/
+
+#include <string>
+#include <iostream>
+#include "zypp2/RepositoryInfo.h"
+
+using namespace boost;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ RepositoryInfo::RepositoryInfo()
+ : _enabled (indeterminate)
+ , _autorefresh(indeterminate)
+ , _base_repository( indeterminate )
+ {
+
+ }
+
+ RepositoryInfo::RepositoryInfo( const Url & url,
+ const Pathname & path,
+ const std::string & alias,
+ const Pathname & cache_dir,
+ tribool autorefresh)
+ : _enabled (true),
+ _autorefresh(autorefresh),
+ _base_repository( indeterminate ),
+ _url(url),
+ _cache_dir(cache_dir),
+ _path(path),
+ _alias(alias)
+ {
+
+ }
+
+ RepositoryInfo & RepositoryInfo::setEnabled( boost::tribool enabled )
+ {
+ _enabled = enabled;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setAutorefresh( boost::tribool autorefresh )
+ {
+ _autorefresh = autorefresh;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setBaseRepository( bool val_r )
+ {
+ _base_repository = val_r;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setUrl( const Url &url )
+ {
+ _url = url;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setPath( const Pathname &p )
+ {
+ _path = p;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setAlias( const std::string &alias )
+ {
+ _alias = alias;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setType( const std::string &t )
+ {
+ _type = t;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setCacheDir( const Pathname &p )
+ {
+ _cache_dir = p;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setDescription( const std::string &description )
+ {
+ _description = description;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setChecksum( const CheckSum &checksum )
+ {
+ _checksum = checksum;
+ return *this;
+ }
+
+ RepositoryInfo & RepositoryInfo::setTimestamp( const Date ×tamp )
+ {
+ _timestamp = timestamp;
+ return *this;
+ }
+
+ tribool RepositoryInfo::enabled() const
+ { return _enabled; }
+
+ tribool RepositoryInfo::autorefresh() const
+ { return _autorefresh; }
+
+ boost::tribool RepositoryInfo::baseRepository() const
+ { return _base_repository; }
+
+ Pathname RepositoryInfo::cacheDir() const
+ { return _cache_dir; }
+
+ Pathname RepositoryInfo::path() const
+ { return _path; }
+
+ std::string RepositoryInfo::alias() const
+ { return _alias; }
+
+ std::string RepositoryInfo::description() const
+ { return _description; }
+
+ CheckSum RepositoryInfo::checksum() const
+ { return _checksum; }
+
+ Date RepositoryInfo::timestamp() const
+ { return _timestamp; }
+
+ std::string RepositoryInfo::type() const
+ { return _type; }
+
+ Url RepositoryInfo::url() const
+ { return _url; }
+
+ std::ostream & RepositoryInfo::dumpOn( std::ostream & str ) const
+ {
+ str << "--------------------------------------" << std::endl;
+ str << "- alias : " << alias() << std::endl;
+ str << "- url : " << url() << std::endl;
+ str << "- type : " << type() << std::endl;
+ str << "- baserepository : " << baseRepository() << std::endl;
+ str << "- enabled : " << enabled() << std::endl;
+ str << "- autorefresh : " << autorefresh() << std::endl;
+ str << "- path : " << path() << std::endl;
+ str << "- cache_dir : " << cacheDir() << std::endl;
+ return str;
+ }
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+
Added: trunk/libzypp/zypp2/RepositoryInfo.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepositoryInfo.h?r…
==============================================================================
--- trunk/libzypp/zypp2/RepositoryInfo.h (added)
+++ trunk/libzypp/zypp2/RepositoryInfo.h Fri Apr 27 18:06:37 2007
@@ -0,0 +1,85 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#ifndef ZYPP_RepositoryInfo_H
+#define ZYPP_RepositoryInfo_H
+
+#include <list>
+
+#include <boost/logic/tribool.hpp>
+#include "zypp/Pathname.h"
+#include "zypp/Url.h"
+#include "zypp/CheckSum.h"
+#include "zypp/Date.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ class RepositoryInfo
+ {
+ public:
+
+ RepositoryInfo();
+
+ RepositoryInfo( const Url & url, const Pathname & path, const std::string & alias = "", const Pathname & cache_dir = "", boost::tribool autorefresh = boost::indeterminate );
+
+ RepositoryInfo & setEnabled( boost::tribool enabled );
+ RepositoryInfo & setAutorefresh( boost::tribool autorefresh );
+ RepositoryInfo & setBaseRepository( bool val_r );
+ RepositoryInfo & setUrl( const Url &url );
+ RepositoryInfo & setPath( const Pathname &p );
+ RepositoryInfo & setAlias( const std::string &alias );
+ RepositoryInfo & setType( const std::string &t );
+ RepositoryInfo & setCacheDir( const Pathname &p );
+ RepositoryInfo & setDescription( const std::string &description );
+ RepositoryInfo & setChecksum( const CheckSum &checksum );
+ RepositoryInfo & setTimestamp( const Date ×tamp );
+ boost::tribool enabled() const;
+ boost::tribool autorefresh() const;
+ boost::tribool baseRepository() const;
+ Pathname cacheDir() const;
+ Pathname path() const;
+ std::string alias() const;
+ std::string type() const;
+ std::string description() const;
+ CheckSum checksum() const;
+ Date timestamp() const;
+ Url url() const;
+
+
+ /** Overload to realize stream output. */
+ std::ostream & dumpOn( std::ostream & str ) const;
+
+ private:
+
+ boost::tribool _enabled;
+ boost::tribool _autorefresh;
+ boost::tribool _base_repository;
+ std::string _type;
+ Url _url;
+ Pathname _cache_dir;
+ Pathname _path;
+ std::string _alias;
+ std::string _description;
+ CheckSum _checksum;
+ Date _timestamp;
+ };
+
+ /** \relates RepositoryInfo Stream output */
+ inline std::ostream & operator<<( std::ostream & str, const RepositoryInfo & obj )
+ { return obj.dumpOn( str ); }
+
+ typedef std::list<RepositoryInfo> RepositoryInfoList;
+
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_RepositoryInfo_H
+
+
Copied: trunk/libzypp/zypp2/RepositoryManager.cc (from r5456, trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.cc)
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepositoryManager.…
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.cc (original)
+++ trunk/libzypp/zypp2/RepositoryManager.cc Fri Apr 27 18:06:37 2007
@@ -1,23 +1,19 @@
-
-
-
-
-
#include <iostream>
#include <list>
#include <algorithm>
-#include "RepositoryManager.h"
#include "zypp/base/Exception.h"
#include "zypp/base/Logger.h"
#include "zypp/PathInfo.h"
#include "zypp/parser/inifile/iniparser.h"
+#include "zypp2/RepositoryManager.h"
+
+
using namespace std;
using namespace zypp;
using namespace zypp::filesystem;
-using namespace zypp::source;
namespace zypp {
@@ -26,7 +22,7 @@
}
-static std::list<source::SourceInfo> repositories_in_file( const Pathname &file )
+static std::list<RepositoryInfo> repositories_in_file( const Pathname &file )
{
dictionary *d = iniparser_new(file.c_str());
@@ -41,12 +37,12 @@
MIL << iniparser_getsecname(d, i) << endl;
}
- return std::list<source::SourceInfo>();
+ return std::list<RepositoryInfo>();
}
-static std::list<source::SourceInfo> repositories_in_path( const Pathname &dir )
+static std::list<RepositoryInfo> repositories_in_path( const Pathname &dir )
{
- std::list<source::SourceInfo> repos;
+ std::list<RepositoryInfo> repos;
list<Pathname> entries;
if ( filesystem::readdir( entries, Pathname(dir), false ) != 0 )
ZYPP_THROW(Exception("failed to read directory"));
@@ -54,17 +50,18 @@
for ( list<Pathname>::const_iterator it = entries.begin(); it != entries.end(); ++it )
{
Pathname file = *it;
- std::list<source::SourceInfo> repos_here = repositories_in_file(file);
+ std::list<RepositoryInfo> repos_here = repositories_in_file(file);
std::copy( repos_here.begin(), repos_here.end(), std::back_inserter(repos));
}
return repos;
}
-std::list<source::SourceInfo> RepositoryManager::knownRepositories()
+std::list<RepositoryInfo> RepositoryManager::knownRepositories()
{
- return std::list<source::SourceInfo>();
+ return std::list<RepositoryInfo>();
}
-} // ns zypp
\ No newline at end of file
+} // ns zypp
+
Copied: trunk/libzypp/zypp2/RepositoryManager.h (from r5456, trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.h)
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/RepositoryManager.…
==============================================================================
--- trunk/libzypp/devel/devel.dmacvicar/RepositoryManager.h (original)
+++ trunk/libzypp/zypp2/RepositoryManager.h Fri Apr 27 18:06:37 2007
@@ -5,9 +5,10 @@
#include <list>
#include "zypp/base/ReferenceCounted.h"
#include "zypp/base/NonCopyable.h"
-#include "zypp/source/SourceInfo.h"
#include "zypp/Pathname.h"
+#include "zypp2/RepositoryInfo.h"
+
namespace zypp
{
@@ -16,9 +17,11 @@
friend std::ostream & operator<<( std::ostream & str, const RepositoryManager & obj );
public:
RepositoryManager();
- std::list<source::SourceInfo> knownRepositories();
+ std::list<RepositoryInfo> knownRepositories();
};
}
-#endif
\ No newline at end of file
+
+#endif
+
Added: trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/cached/…
==============================================================================
--- trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.cc (added)
+++ trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.cc Fri Apr 27 18:06:37 2007
@@ -0,0 +1,184 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#include <iostream>
+#include "zypp/base/Logger.h"
+#include "zypp/base/Measure.h"
+#include <sqlite3.h>
+#include "zypp2/cache/sqlite3x/sqlite3x.hpp"
+#include "zypp2/cache/QueryFactory.h"
+#include "zypp2/cache/CapabilityQuery.h"
+#include "zypp2/cache/sqlite_detail/CacheSqlite.h"
+#include "zypp2/cache/DatabaseTypes.h"
+#include "zypp2/cache/CacheCommon.h"
+#include "zypp2/cache/sqlite_detail/QueryFactoryImpl.h"
+#include "zypp/detail/ResImplTraits.h"
+#include "zypp/CapFactory.h"
+
+#include "zypp2/repository/cached/CachedRepositoryImpl.h"
+#include "zypp2/repository/cached/CachedRepositoryPackageImpl.h"
+
+
+using namespace zypp::detail;
+using namespace zypp::cache;
+using std::endl;
+using namespace std;
+using namespace sqlite3x;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+namespace repository
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+namespace cached
+{ /////////////////////////////////////////////////////////////////
+
+CachedRepositoryImpl::CachedRepositoryImpl( const Pathname &dbdir)
+ : _dbdir(dbdir)
+{
+
+}
+
+CachedRepositoryImpl::~CachedRepositoryImpl()
+{
+
+}
+
+
+void CachedRepositoryImpl::factoryInit()
+{
+ MIL << "Plaindir repository initialized." << std::endl;
+}
+
+void read_capabilities( sqlite3_connection &con, map<data::RecordId, NVRAD> &nvras );
+
+void CachedRepositoryImpl::createResolvables()
+{
+ debug::Measure m("create resolvables");
+ CapFactory capfactory;
+ try {
+ sqlite3_connection con((_dbdir + "zypp.db").asString().c_str());
+ con.executenonquery("PRAGMA cache_size=8000;");
+ con.executenonquery("BEGIN;");
+ sqlite3_command cmd( con, "select id,name,version,release,epoch,arch,kind from resolvables;");
+ map<data::RecordId, NVRAD> nvras;
+
+ sqlite3_reader reader = cmd.executereader();
+ while(reader.read())
+ {
+ long long id = reader.getint64(0);
+ Dependencies deps;
+
+ Arch arch = db_arch2zypp_arch( static_cast<db::Arch>(reader.getint(5)));
+
+ // Collect basic Resolvable data
+ nvras[id] = NVRAD( reader.getstring(1),
+ Edition( reader.getstring(2), reader.getstring(3), reader.getint(4) ),
+ arch,
+ deps
+ );
+ }
+
+ MIL << "Done reading resolvables nvra" << endl;
+
+ read_capabilities( con, nvras);
+
+ for ( map<data::RecordId, NVRAD>::const_iterator it = nvras.begin(); it != nvras.end(); ++it )
+ {
+ ResImplTraits<CachedRepositoryPackageImpl>::Ptr impl = new CachedRepositoryPackageImpl(selfRepository());
+ Package::Ptr package = detail::makeResolvableFromImpl( it->second, impl );
+ _store.insert (package);
+ }
+ con.executenonquery("COMMIT;");
+ }
+ catch(exception &ex) {
+ cerr << "Exception Occured: " << ex.what() << endl;
+ }
+ //extract_packages_from_directory( _store, thePath, selfRepositoryRef(), true );
+
+}
+
+void read_capabilities( sqlite3_connection &con, map<data::RecordId, NVRAD> &nvras )
+{
+ CapFactory capfactory;
+ // precompile statements
+
+// map<data::RecordId, capability::CapabilityImpl::Ptr> named_caps;
+// sqlite3_command select_named_cmd( con, "select v.id, c.refers_kind, n.name, v.version, v.release, v.epoch, v.relation named_capabilities v, capabilities c, names n where v.name_id=n.id and c.id=ncc.capability_id and ncc.named_capability_id=v.id;");
+// {
+// debug::Measure mnc("read named capabilities");
+// sqlite3_reader reader = select_named_cmd.executereader();
+// while ( reader.read() )
+// {
+//
+// }
+// }
+ sqlite3_command select_named_cmd( con, "select v.refers_kind, n.name, v.version, v.release, v.epoch, v.relation, v.dependency_type, v.resolvable_id from named_capabilities v, names n where v.name_id=n.id;");
+ sqlite3_command select_file_cmd( con, "select fc.refers_kind, dn.name, fn.name, fc.dependency_type, fc.resolvable_id from file_capabilities fc, files f, dir_names dn, file_names fn where f.id=fc.file_id and f.dir_name_id=dn.id and f.file_name_id=fn.id;");
+
+ {
+ debug::Measure mnc("read named capabilities");
+ sqlite3_reader reader = select_named_cmd.executereader();
+ while ( reader.read() )
+ {
+ Resolvable::Kind refer = db_kind2zypp_kind( static_cast<db::Kind>(reader.getint(0)) );
+ zypp::Rel rel = db_rel2zypp_rel( static_cast<db::Rel>(reader.getint(5)) );
+ data::RecordId rid = reader.getint64(7);
+
+ if ( rel == zypp::Rel::NONE )
+ {
+ capability::NamedCap *ncap = new capability::NamedCap( refer, reader.getstring(1) );
+ zypp::Dep deptype = db_deptype2zypp_deptype( static_cast<db::DependencyType>(reader.getint(5)) );
+
+ nvras[rid][deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(ncap) ) );
+ }
+ else
+ {
+ capability::VersionedCap *vcap = new capability::VersionedCap( refer, reader.getstring(1), /* rel */ rel, Edition( reader.getstring(2), reader.getstring(3), reader.getint(4) ) );
+ zypp::Dep deptype = db_deptype2zypp_deptype( static_cast<db::DependencyType>(reader.getint(5)) );
+ nvras[rid][deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(vcap) ) );
+ }
+ }
+ }
+
+ {
+ debug::Measure mnf("read file capabilities");
+ sqlite3_reader reader = select_file_cmd.executereader();
+ while ( reader.read() )
+ {
+ Resolvable::Kind refer = db_kind2zypp_kind( static_cast<db::Kind>(reader.getint(0)) );
+ capability::FileCap *fcap = new capability::FileCap( refer, reader.getstring(1) + "/" + reader.getstring(2) );
+ zypp::Dep deptype = db_deptype2zypp_deptype( static_cast<db::DependencyType>(reader.getint(3)) );
+ data::RecordId rid = reader.getint64(4);
+ nvras[rid][deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(fcap) ) );
+ }
+ }
+
+ MIL << nvras.size() << " capabilities" << endl;
+}
+
+
+
+
+
+
+
+
+/////////////////////////////////////////////////////////////////
+} // namespace plaindir
+///////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////
+} // namespace repository
+///////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+
Added: trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/cached/…
==============================================================================
--- trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.h (added)
+++ trunk/libzypp/zypp2/repository/cached/CachedRepositoryImpl.h Fri Apr 27 18:06:37 2007
@@ -0,0 +1,80 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#ifndef ZYPP_CachedRepositoryImpl_H
+#define ZYPP_CachedRepositoryImpl_H
+
+#include <iosfwd>
+#include "zypp/Pathname.h"
+#include "zypp2/repository/RepositoryImpl.h"
+#include "zypp/ResStore.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace repository
+ { /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace cached
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : CachedRepositoryImpl
+ //
+ /** */
+ class CachedRepositoryImpl : public repository::RepositoryImpl
+ {
+ public:
+ typedef intrusive_ptr<CachedRepositoryImpl> Ptr;
+ typedef intrusive_ptr<const CachedRepositoryImpl> constPtr;
+
+ public:
+ /** Default ctor */
+ CachedRepositoryImpl( const zypp::Pathname &dbdir );
+ /** Dtor */
+ ~CachedRepositoryImpl();
+
+ public:
+ /** String identifying the type of the source. */
+ static std::string typeString()
+ { return "CachedSource"; }
+
+ /** String identifying the type of the source. */
+ virtual std::string type() const
+ { return typeString(); }
+
+ private:
+ /** Ctor substitute.
+ * Actually get the metadata.
+ * \throw EXCEPTION on fail
+ */
+ virtual void factoryInit();
+ virtual void createResolvables();
+
+ zypp::Pathname _dbdir;
+ ResStore _store;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace cached
+ ///////////////////////////////////////////////////////////////////
+
+ using cached::CachedRepositoryImpl;
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace source
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_SOURCE_PLAINDIR_PLAINDIRIMPL_H
+
Added: trunk/libzypp/zypp2/repository/cached/CachedRepositoryPackageImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/cached/…
==============================================================================
--- trunk/libzypp/zypp2/repository/cached/CachedRepositoryPackageImpl.cc (added)
+++ trunk/libzypp/zypp2/repository/cached/CachedRepositoryPackageImpl.cc Fri Apr 27 18:06:37 2007
@@ -0,0 +1,101 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zmd/backend/dbrepository/CachedRepositoryPackageImpl.h
+ *
+*/
+
+#include "zypp/TranslatedText.h"
+#include "zypp/base/String.h"
+#include "zypp/base/Logger.h"
+#include "zypp2/cache/CachedResolvableDataProvider.h"
+#include "zypp2/repository/RepositoryImpl.h"
+#include "CachedRepositoryPackageImpl.h"
+
+
+using namespace std;
+using namespace zypp::detail;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////
+//
+// CLASS NAME : CachedRepositoryPackageImpl
+//
+///////////////////////////////////////////////////////////////////
+
+/** Default ctor
+*/
+CachedRepositoryPackageImpl::CachedRepositoryPackageImpl (Repository repository_r)
+ : _repository (repository_r)
+ , _install_only(false)
+ , _size_installed(0)
+ , _size_archive(0)
+ , _data_loaded(false)
+{}
+
+Repository
+CachedRepositoryPackageImpl::repository() const
+{
+ return _repository;
+}
+
+/** Package summary */
+TranslatedText CachedRepositoryPackageImpl::summary() const
+{
+ return _summary;
+}
+
+/** Package description */
+TranslatedText CachedRepositoryPackageImpl::description() const
+{
+ return _description;
+}
+
+PackageGroup CachedRepositoryPackageImpl::group() const
+{
+ return _group;
+}
+
+Pathname CachedRepositoryPackageImpl::location() const
+{
+ return _location;
+}
+
+ByteCount CachedRepositoryPackageImpl::size() const
+{
+ return _size_installed;
+}
+
+/** */
+ByteCount CachedRepositoryPackageImpl::archivesize() const
+{
+ return _size_archive;
+}
+
+bool CachedRepositoryPackageImpl::installOnly() const
+{
+ return _install_only;
+}
+
+unsigned CachedRepositoryPackageImpl::repositoryMediaNr() const
+{
+ return _media_nr;
+}
+
+Vendor CachedRepositoryPackageImpl::vendor() const
+{
+ return "suse";
+}
+
+/////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+
Added: trunk/libzypp/zypp2/repository/cached/CachedRepositoryPackageImpl.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/repository/cached/…
==============================================================================
--- trunk/libzypp/zypp2/repository/cached/CachedRepositoryPackageImpl.h (added)
+++ trunk/libzypp/zypp2/repository/cached/CachedRepositoryPackageImpl.h Fri Apr 27 18:06:37 2007
@@ -0,0 +1,62 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zmd/backend/dbrepository/CachedRepositoryPackageImpl.h
+ *
+*/
+#ifndef CachedRepositoryPackageImpl_H
+#define CachedRepositoryPackageImpl_H
+
+#include "zypp/detail/PackageImpl.h"
+#include "zypp2/Repository.h"
+//#include <sqlite3.h>
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : CachedRepositoryPackageImpl
+ //
+ class CachedRepositoryPackageImpl : public detail::PackageImplIf
+ {
+ public:
+
+ CachedRepositoryPackageImpl( Repository repository_r );
+
+ virtual TranslatedText summary() const;
+ virtual TranslatedText description() const;
+ virtual ByteCount size() const;
+ virtual PackageGroup group() const;
+ virtual ByteCount archivesize() const;
+ virtual Pathname location() const;
+ virtual bool installOnly() const;
+ virtual Repository repository() const;
+ virtual unsigned repositoryMediaNr() const;
+ virtual Vendor vendor() const;
+
+ protected:
+ Repository _repository;
+ TranslatedText _summary;
+ TranslatedText _description;
+ PackageGroup _group;
+ Pathname _location;
+ bool _install_only;
+ unsigned _media_nr;
+
+ ByteCount _size_installed;
+ ByteCount _size_archive;
+
+ bool _data_loaded;
+ };
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZMD_BACKEND_DBSOURCE_DBPACKAGEIMPL_H
+
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5458 - /branches/work/updater-kde-refactoring/updater-kde/updater/
by tgoettlicher@svn.opensuse.org 27 Apr '07
by tgoettlicher@svn.opensuse.org 27 Apr '07
27 Apr '07
Author: tgoettlicher
Date: Fri Apr 27 16:40:05 2007
New Revision: 5458
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5458&view=rev
Log:
Added first draft of a config dialog for plugin selection.
(It is dirty code which needs clean-up.)
Added:
branches/work/updater-kde-refactoring/updater-kde/updater/configWidget.cpp
branches/work/updater-kde-refactoring/updater-kde/updater/configWidget.h
branches/work/updater-kde-refactoring/updater-kde/updater/configWidgetUI.h
branches/work/updater-kde-refactoring/updater-kde/updater/configWidgetUI.ui
Modified:
branches/work/updater-kde-refactoring/updater-kde/updater/CMakeLists.txt
branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.cpp
branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.h
branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.cpp
branches/work/updater-kde-refactoring/updater-kde/updater/opensuseupdater_settings.kcfg
branches/work/updater-kde-refactoring/updater-kde/updater/updatersettingswidget_base.ui
Modified: branches/work/updater-kde-refactoring/updater-kde/updater/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/…
==============================================================================
--- branches/work/updater-kde-refactoring/updater-kde/updater/CMakeLists.txt (original)
+++ branches/work/updater-kde-refactoring/updater-kde/updater/CMakeLists.txt Fri Apr 27 16:40:05 2007
@@ -8,9 +8,9 @@
kde3_add_kcfg_files(settings_SRCS opensuseupdater_settings.kcfgc)
SET(opensuseupdater_LIB_SRCS
-Updater.cpp Updater.h osupdaterpopup.cpp TrayIcon.cpp UpdateListItem.cpp HeaderWidget.cpp ${settings_SRCS}
+Updater.cpp Updater.h osupdaterpopup.cpp TrayIcon.cpp UpdateListItem.cpp HeaderWidget.cpp configWidget.cpp configWidget.h configWidgetUI.h configWidgetUI.ui ${settings_SRCS}
)
-kde3_add_ui_files( opensuseupdater_LIB_SRCS updatersettingswidget_base.ui )
+kde3_add_ui_files( opensuseupdater_LIB_SRCS updatersettingswidget_base.ui configWidgetUI.ui )
KDE3_AUTOMOC(${opensuseupdater_LIB_SRCS})
ADD_LIBRARY(opensuseupdater SHARED ${opensuseupdater_LIB_SRCS})
SET_TARGET_PROPERTIES(opensuseupdater PROPERTIES VERSION 4.2.0 SOVERSION 4 )
@@ -20,7 +20,7 @@
########### next target ###############
-SET(opensuseupdater_SRCS main.cpp UpdaterApplication.cpp MainWindow.cpp )
+SET(opensuseupdater_SRCS main.cpp UpdaterApplication.cpp MainWindow.cpp configWidget.h configWidgetUI.h configWidgetUI.ui )
KDE3_AUTOMOC(${opensuseupdater_SRCS})
KDE3_ADD_EXECUTABLE(opensuseupdater-kde ${opensuseupdater_SRCS})
TARGET_LINK_LIBRARIES(opensuseupdater-kde opensuseupdater ${QT_AND_KDECORE_LIBS} kdeui kio )
Modified: branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/…
==============================================================================
--- branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.cpp (original)
+++ branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.cpp Fri Apr 27 16:40:05 2007
@@ -48,6 +48,9 @@
#include "UpdateListItem.h"
#include "TrayIcon.h"
+#include "configWidget.h"
+
+
MainWindow::MainWindow( const UpdaterCapabilities &caps, QWidget *parent)
@@ -312,6 +315,29 @@
void MainWindow::configButtonClicked()
{
+
+ static configWidget* confWidget = 0;
+
+ if (KConfigDialog::showDialog("settings")) {
+// updateConfigDialog(confWidget);
+ return;
+ }
+
+// configDialog = new KConfigDialog(this, "settings", Prefs::self());
+ configDialog = new KConfigDialog(this, "settings", UpdaterSettings::self() );
+
+ configDialog->setHelp(QString::null);
+
+ confWidget = new configWidget(0, "Kscd");
+
+ // kscd config page
+ configDialog->addPage(confWidget, i18n("CD Player"), "kscd", i18n("Settings & Behavior"));
+
+
+ /// ENDE
+ return;
+
+
//An instance of your dialog could be already created and could be cached,
//in which case you want to display the cached dialog instead of creating
//another one
Modified: branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/…
==============================================================================
--- branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.h (original)
+++ branches/work/updater-kde-refactoring/updater-kde/updater/MainWindow.h Fri Apr 27 16:40:05 2007
@@ -23,6 +23,8 @@
#include <qobject.h>
#include <kmainwindow.h>
#include "UpdaterCapabilities.h"
+#include <kconfigdialog.h>
+
class TrayIcon;
class KTextEdit;
@@ -247,6 +249,9 @@
QWidget *centralWidget;
+ KConfigDialog *configDialog;
+
+
};
#endif
Modified: branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/…
==============================================================================
--- branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.cpp (original)
+++ branches/work/updater-kde-refactoring/updater-kde/updater/UpdaterApplication.cpp Fri Apr 27 16:40:05 2007
@@ -36,7 +36,7 @@
{
loadPlugins();
- int backend = UpdaterSettings::self()->backend();
+ QString backend = UpdaterSettings::self()->backend();
// if ( backend == UpdaterSettings::EnumBackend::zmd )
// {
Added: branches/work/updater-kde-refactoring/updater-kde/updater/configWidget.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/…
==============================================================================
--- branches/work/updater-kde-refactoring/updater-kde/updater/configWidget.cpp (added)
+++ branches/work/updater-kde-refactoring/updater-kde/updater/configWidget.cpp Fri Apr 27 16:40:05 2007
@@ -0,0 +1,120 @@
+/*
+ * configWidget - the config dialog page for KSCD settings
+ *
+ * $Id:
+ *
+ * Copyright (c) 2002 Aaron J. Seigo <aseigo(a)kde.org>
+ * Copyright (c) 2004 Alexander Kern <alex.kern(a)gmx.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include <kdebug.h>
+#include <klineedit.h>
+#include <dcopref.h>
+#include <kurlrequester.h>
+#include <qcheckbox.h>
+#include <kcombobox.h>
+#include <qlayout.h>
+/*
+#include <config.h>
+extern "C" {
+ // We don't have libWorkMan installed already, so get everything
+ // from within our own directory
+#include "libwm/include/wm_config.h"
+}
+*/
+
+#include "configWidget.h"
+//#include "kscd.h"
+//#include "prefs.h"
+
+class SpecialComboBox : public KComboBox
+{
+public:
+ SpecialComboBox(QWidget* parent, const char* name)
+ : KComboBox(parent, name)
+ {}
+
+ // QComboBox::setCurrentText replaces the current text if
+ // the list doesn't contain text, while
+ // KComboBox::setCurrentItem doesn't
+ void setCurrentText(const QString& text)
+ {
+ setCurrentItem(text);
+ }
+} ;
+
+/*
+ * Constructs a configWidget which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'.
+ *
+ * The dialog will by default be modeless, unless you set 'modal' to
+ * TRUE to construct a modal dialog.
+ */
+configWidget::configWidget(QWidget* parent, const char* name)
+ : configWidgetUI(parent, name)
+
+{
+ if (!name)
+ {
+ setName("configWidget");
+ }
+/*
+ kcfg_cdDevice->comboBox()->setEditable(true);
+ kcfg_cdDevice->comboBox()->insertItem(DEFAULT_CD_DEVICE);
+ getMediaDevices();
+*/
+
+ (new QVBoxLayout(audioSystemFrame))->setAutoAdd(true);
+ kcfg_AudioSystem = new SpecialComboBox(audioSystemFrame, "kcfg_AudioSystem");
+/* textLabel4->setBuddy(kcfg_AudioSystem);
+#if defined(BUILD_CDDA)
+ kcfg_DigitalPlayback_toggled(Prefs::digitalPlayback());
+
+ // fill ComboBox audioBackend
+// kcfg_AudioSystem->insertStringList(mPlayer->audioSystems());
+#else
+ kcfg_DigitalPlayback_toggled(false);
+
+ kcfg_DigitalPlayback->setChecked(false);
+ kcfg_DigitalPlayback->hide();
+#endif
+ kcfg_SelectEncoding_toggled(Prefs::selectEncoding());
+
+*/
+
+ kcfg_AudioSystem->insertStringList(QStringList("plugin"));
+}
+
+configWidget::~configWidget()
+{
+}
+
+void configWidget::kcfg_DigitalPlayback_toggled(bool toggle)
+{
+}
+
+void configWidget::getMediaDevices()
+{
+}
+
+
+void configWidget::kcfg_SelectEncoding_toggled(bool toggle)
+{
+}
+
+#include "configWidget.moc"
Added: branches/work/updater-kde-refactoring/updater-kde/updater/configWidget.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/…
==============================================================================
--- branches/work/updater-kde-refactoring/updater-kde/updater/configWidget.h (added)
+++ branches/work/updater-kde-refactoring/updater-kde/updater/configWidget.h Fri Apr 27 16:40:05 2007
@@ -0,0 +1,50 @@
+/*
+ * configWidget - the config dialog page for KSCD settings
+ *
+ * Copyright (c) 2002 Aaron J. Seigo <aseigo(a)kde.org>
+ * Copyright (c) 2004 Alexander Kern <alex.kern(a)gmx.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef CONFIGWIDGET_H
+#define CONFIGWIDGET_H
+
+#include "configWidgetUI.h"
+
+class KSCD;
+class SpecialComboBox;
+
+class configWidget : public configWidgetUI
+{
+ Q_OBJECT
+
+ public:
+ configWidget(QWidget* parent = 0, const char* name = 0);
+ ~configWidget();
+
+ protected:
+ KSCD* mPlayer;
+ SpecialComboBox* kcfg_AudioSystem;
+
+ public slots:
+ virtual void kcfg_DigitalPlayback_toggled(bool);
+ virtual void kcfg_SelectEncoding_toggled(bool);
+ private:
+ void getMediaDevices();
+};
+
+#endif // CONFIGWIDGET_H
Added: branches/work/updater-kde-refactoring/updater-kde/updater/configWidgetUI.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/…
==============================================================================
--- branches/work/updater-kde-refactoring/updater-kde/updater/configWidgetUI.h (added)
+++ branches/work/updater-kde-refactoring/updater-kde/updater/configWidgetUI.h Fri Apr 27 16:40:05 2007
@@ -0,0 +1,85 @@
+/****************************************************************************
+** Form interface generated from reading ui file './configWidgetUI.ui'
+**
+** Created: Fr Apr 27 15:30:17 2007
+** by: The User Interface Compiler ($Id: qt/main.cpp 3.3.7 edited Aug 31 2005 $)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+
+#ifndef CONFIGWIDGETUI_H
+#define CONFIGWIDGETUI_H
+
+#include <qvariant.h>
+#include <qwidget.h>
+
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QSpacerItem;
+class QGroupBox;
+class QLabel;
+class KColorButton;
+class QCheckBox;
+class KFontRequester;
+class QButtonGroup;
+class KIntNumInput;
+class KURLComboRequester;
+class KURLRequester;
+class QFrame;
+class QComboBox;
+
+class configWidgetUI : public QWidget
+{
+ Q_OBJECT
+
+public:
+ configWidgetUI( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~configWidgetUI();
+
+ QGroupBox* groupBox1;
+ QLabel* textLabel2;
+ KColorButton* kcfg_BackColor;
+ QCheckBox* kcfg_Docking;
+ QCheckBox* kcfg_TrackAnnouncement;
+ QLabel* textLabel1;
+ KColorButton* kcfg_ledColor;
+ KFontRequester* kcfg_ledFont;
+ QLabel* textLabel1_2;
+ QButtonGroup* buttonGroup1;
+ KIntNumInput* kcfg_SkipDelta;
+ QLabel* textLabel3;
+ QCheckBox* kcfg_Autoplay;
+ QCheckBox* kcfg_EjectOnFinish;
+ QCheckBox* kcfg_StopExit;
+ QGroupBox* groupBox3;
+ KURLComboRequester* kcfg_cdDevice;
+ QLabel* textLabel5;
+ QCheckBox* kcfg_DigitalPlayback;
+ QLabel* textLabel4;
+ KURLRequester* kcfg_AudioDevice;
+ QFrame* audioSystemFrame;
+ QGroupBox* groupBox9;
+ QCheckBox* kcfg_SelectEncoding;
+ QComboBox* kcfg_SelectedEncoding;
+
+public slots:
+ virtual void kcfg_DigitalPlayback_toggled( bool );
+ virtual void kcfg_SelectEncoding_toggled(bool);
+
+protected:
+ QVBoxLayout* configWidgetUILayout;
+ QSpacerItem* spacer3;
+ QGridLayout* groupBox1Layout;
+ QSpacerItem* spacer1;
+ QGridLayout* buttonGroup1Layout;
+ QSpacerItem* spacer2;
+ QGridLayout* groupBox3Layout;
+ QHBoxLayout* groupBox9Layout;
+
+protected slots:
+ virtual void languageChange();
+
+};
+
+#endif // CONFIGWIDGETUI_H
Added: branches/work/updater-kde-refactoring/updater-kde/updater/configWidgetUI.ui
URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/…
==============================================================================
--- branches/work/updater-kde-refactoring/updater-kde/updater/configWidgetUI.ui (added)
+++ branches/work/updater-kde-refactoring/updater-kde/updater/configWidgetUI.ui Fri Apr 27 16:40:05 2007
@@ -0,0 +1,462 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>configWidgetUI</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>configWidgetUI</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>539</width>
+ <height>605</height>
+ </rect>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox1</cstring>
+ </property>
+ <property name="title">
+ <string>Interface</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>&Background color:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kcfg_BackColor</cstring>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="2" column="1">
+ <property name="name">
+ <cstring>kcfg_BackColor</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The background color that will be used for the LCD display.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>kcfg_Docking</cstring>
+ </property>
+ <property name="text">
+ <string>Show icon in &system tray</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>When this option is selected an icon will appear in the system tray. Note that KsCD will <i>not</i> quit when the window is closed if a system tray icon is displayed. You may quit KsCD by clicking the Quit button or right-clicking on the system tray icon and selecting the appropriate entry.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>kcfg_TrackAnnouncement</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Show &track announcement</string>
+ </property>
+ </widget>
+ <spacer row="1" column="2" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>292</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>&LCD color:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kcfg_ledColor</cstring>
+ </property>
+ </widget>
+ <widget class="KColorButton" row="1" column="1">
+ <property name="name">
+ <cstring>kcfg_ledColor</cstring>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The foreground color that will be used in the LCD display.</string>
+ </property>
+ </widget>
+ <widget class="KFontRequester" row="0" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>kcfg_ledFont</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <bold>1</bold>
+ </font>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>LCD &font:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kcfg_ledFont</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QButtonGroup">
+ <property name="name">
+ <cstring>buttonGroup1</cstring>
+ </property>
+ <property name="title">
+ <string>Play Options</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KIntNumInput" row="0" column="1">
+ <property name="name">
+ <cstring>kcfg_SkipDelta</cstring>
+ </property>
+ <property name="minValue">
+ <number>1</number>
+ </property>
+ <property name="maxValue">
+ <number>1000</number>
+ </property>
+ <property name="suffix">
+ <string> seconds</string>
+ </property>
+ <property name="specialValueText">
+ <string>1 second</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>This option controls the number of seconds KsCD will skip when the skip forwards or backwards buttons are pressed.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Skip &interval:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kcfg_SkipDelta</cstring>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>kcfg_Autoplay</cstring>
+ </property>
+ <property name="text">
+ <string>Auto&play when CD inserted</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>When this option is selected the CD will start playing automatically upon being inserted into the CD-ROM.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>kcfg_EjectOnFinish</cstring>
+ </property>
+ <property name="text">
+ <string>&Eject CD when finished playing</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>When this option is selected the CD will automatically eject when it is finished.</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>kcfg_StopExit</cstring>
+ </property>
+ <property name="text">
+ <string>Stop playing CD on e&xit</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>When this option is selected the CD will automatically stop playing when quitting KsCD.</string>
+ </property>
+ </widget>
+ <spacer row="0" column="2" rowspan="4" colspan="1">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>171</width>
+ <height>81</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox3</cstring>
+ </property>
+ <property name="title">
+ <string>CD-ROM &Device</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KURLComboRequester" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>kcfg_cdDevice</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>The CD-ROM device to use when playing CDs. This will typically look something like "/dev/cdrom". To have KsCD autodetect your CD-ROM, leave this field empty.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel5</cstring>
+ </property>
+ <property name="text">
+ <string>Select audio de&vice:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>kcfg_AudioDevice</cstring>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>kcfg_DigitalPlayback</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>&Use direct digital playback</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>When this option is selected KsCD will attempt to play the CD using direct digital playback. This option is useful if the CD-ROM is not connected directly to the sound output on the computer. Note that digital playback consumes more system resources than the normal method of playback.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>textLabel4</cstring>
+ </property>
+ <property name="text">
+ <string>Select &audio backend:</string>
+ </property>
+ <property name="indent">
+ <number>0</number>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="3" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>kcfg_AudioDevice</cstring>
+ </property>
+ </widget>
+ <widget class="QFrame" row="2" column="2">
+ <property name="name">
+ <cstring>audioSystemFrame</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>Plain</enum>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>groupBox9</cstring>
+ </property>
+ <property name="title">
+ <string> Music Information Services </string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>kcfg_SelectEncoding</cstring>
+ </property>
+ <property name="text">
+ <string>Allow en&coding selection:</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>When this option is selected, you have the ability to select encoding for the results of a CDDB request. The standard describes CDDB results as being strictly Latin1. This is not true, as non-English speaking users often use other 8-bit encodings.</string>
+ </property>
+ </widget>
+ <widget class="QComboBox">
+ <item>
+ <property name="text">
+ <string>AUTO</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>UTF-8</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>CP1250</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>CP1251</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>CP1252</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>CP1253</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>CP1254</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>CP1255</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>CP1256</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>CP1257</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>kcfg_SelectedEncoding</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="duplicatesEnabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>45</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>kcfg_DigitalPlayback</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>configWidgetUI</receiver>
+ <slot>kcfg_DigitalPlayback_toggled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>kcfg_Docking</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>kcfg_TrackAnnouncement</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+ <connection>
+ <sender>kcfg_SelectEncoding</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>configWidgetUI</receiver>
+ <slot>kcfg_SelectEncoding_toggled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>kcfg_ledColor</tabstop>
+ <tabstop>kcfg_BackColor</tabstop>
+ <tabstop>kcfg_Docking</tabstop>
+ <tabstop>kcfg_TrackAnnouncement</tabstop>
+ <tabstop>kcfg_SkipDelta</tabstop>
+ <tabstop>kcfg_Autoplay</tabstop>
+ <tabstop>kcfg_EjectOnFinish</tabstop>
+ <tabstop>kcfg_StopExit</tabstop>
+ <tabstop>kcfg_cdDevice</tabstop>
+ <tabstop>kcfg_DigitalPlayback</tabstop>
+ <tabstop>kcfg_AudioDevice</tabstop>
+</tabstops>
+<slots>
+ <slot>kcfg_DigitalPlayback_toggled( bool )</slot>
+ <slot>kcfg_SelectEncoding_toggled(bool)</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kcolorbutton.h</includehint>
+ <includehint>kfontrequester.h</includehint>
+ <includehint>knuminput.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>kcombobox.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
Modified: branches/work/updater-kde-refactoring/updater-kde/updater/opensuseupdater_settings.kcfg
URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/…
==============================================================================
--- branches/work/updater-kde-refactoring/updater-kde/updater/opensuseupdater_settings.kcfg (original)
+++ branches/work/updater-kde-refactoring/updater-kde/updater/opensuseupdater_settings.kcfg Fri Apr 27 16:40:05 2007
@@ -11,13 +11,8 @@
<label>Automatically start the applet on login</label>
<default>true</default>
</entry>
- <entry name="Backend" type="Enum">
- <label>Update engine backend</label>
- <choices>
- <choice name="zypp"/>
- <choice name="zmd"/>
- </choices>
- <default>zypp</default>
- </entry>
+ <entry name="Backend" type="String">
+ <label>The backend for connecting to package database.</label>
+ </entry>
</group>
-</kcfg>
\ No newline at end of file
+</kcfg>
Modified: branches/work/updater-kde-refactoring/updater-kde/updater/updatersettingswidget_base.ui
URL: http://svn.opensuse.org/viewcvs/zypp/branches/work/updater-kde-refactoring/…
==============================================================================
--- branches/work/updater-kde-refactoring/updater-kde/updater/updatersettingswidget_base.ui (original)
+++ branches/work/updater-kde-refactoring/updater-kde/updater/updatersettingswidget_base.ui Fri Apr 27 16:40:05 2007
@@ -44,53 +44,106 @@
<string>Alt+T</string>
</property>
</widget>
- <widget class="QButtonGroup">
+
+ <widget class="QGroupBox" row="0" column="0">
<property name="name">
- <cstring>kcfg_Backend</cstring>
+ <cstring>GroupBox3</cstring>
</property>
<property name="title">
- <string>Get Updates Via</string>
+ <string>Backend Selection</string>
</property>
- <vbox>
+ <property name="toolTip" stdset="0">
+ <string></string>
+ </property>
+ <grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QRadioButton">
+ <widget class="QPushButton" row="0" column="3">
<property name="name">
- <cstring>radioButton2</cstring>
+ <cstring>_configure</cstring>
</property>
<property name="text">
- <string>Default</string>
+ <string>Configure Backend...</string>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Configure backend options</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Configure bakend. Choose your update backend.</string>
</property>
</widget>
- <widget class="QRadioButton">
+ <widget class="QComboBox" row="0" column="2">
<property name="name">
- <cstring>radioButton1</cstring>
+ <cstring>_mixer</cstring>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Select backend</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Backend selector. Choose the plugin for your update system.</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
</property>
<property name="text">
- <string>Novell ZENWorks</string>
+ <string>Select backend:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit" row="1" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>_author</cstring>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Shows backend author</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string></string>
</property>
</widget>
- </vbox>
+ <widget class="QLineEdit" row="2" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>_description</cstring>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" stdset="0">
+ <string>Shows backend description</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel18</cstring>
+ </property>
+ <property name="text">
+ <string>Author:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel17</cstring>
+ </property>
+ <property name="text">
+ <string>Description:</string>
+ </property>
+ </widget>
+
+ </grid>
</widget>
- <spacer>
- <property name="name">
- <cstring>spacer1</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
+
</vbox>
</widget>
+
+
+
<layoutdefaults spacing="6" margin="11"/>
</UI>
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5457 - in /trunk/libzypp/zypp/base: InputStream.cc InputStream.h
by mlandres@svn.opensuse.org 27 Apr '07
by mlandres@svn.opensuse.org 27 Apr '07
27 Apr '07
Author: mlandres
Date: Fri Apr 27 15:00:56 2007
New Revision: 5457
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5457&view=rev
Log:
Made InputStream set no size for compressed files.
Modified:
trunk/libzypp/zypp/base/InputStream.cc
trunk/libzypp/zypp/base/InputStream.h
Modified: trunk/libzypp/zypp/base/InputStream.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/InputStream.cc…
==============================================================================
--- trunk/libzypp/zypp/base/InputStream.cc (original)
+++ trunk/libzypp/zypp/base/InputStream.cc Fri Apr 27 15:00:56 2007
@@ -30,7 +30,7 @@
inline std::streamoff _heplerInitSize( const Pathname & file_r )
{
PathInfo p( file_r );
- if ( p.isFile() )
+ if ( p.isFile() && filesystem::zipType( file_r ) == filesystem::ZT_NONE )
return p.size();
return -1;
}
Modified: trunk/libzypp/zypp/base/InputStream.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/base/InputStream.h?…
==============================================================================
--- trunk/libzypp/zypp/base/InputStream.h (original)
+++ trunk/libzypp/zypp/base/InputStream.h Fri Apr 27 15:00:56 2007
@@ -111,14 +111,14 @@
const Pathname & path() const
{ return _path; }
- /** Size of the input stream (might be estimated).
- * If constructed from a file, the file size. Otherwise \c -1.
- * See \ref setSize;
+ /** Size of the input stream (informal).
+ * If constructed from an uncompressed file, the file size.
+ * Otherwise \c -1. See \ref setSize;
*/
std::streamoff size() const
{ return _size; }
- /** Set the (estimated) size of the input stream.
+ /** Set the size of the input stream.
* You may set it to whatever vaule is appropriate. E.g.
* <tt>*=10</tt> to compensate gzip comression. or the
* number of items, lines, ... The value is not used here,
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5456 - /trunk/libzypp/zypp/data/ResolvableData.h
by jkupec@svn.opensuse.org 27 Apr '07
by jkupec@svn.opensuse.org 27 Apr '07
27 Apr '07
Author: jkupec
Date: Fri Apr 27 10:46:24 2007
New Revision: 5456
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5456&view=rev
Log:
Use std:string instead of zypp::Url for package upstream homepage.
zypp::Url accepts only valid URLs, whereas the upstream URLs may come in
many different forms.
Modified:
trunk/libzypp/zypp/data/ResolvableData.h
Modified: trunk/libzypp/zypp/data/ResolvableData.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/data/ResolvableData…
==============================================================================
--- trunk/libzypp/zypp/data/ResolvableData.h (original)
+++ trunk/libzypp/zypp/data/ResolvableData.h Fri Apr 27 10:46:24 2007
@@ -175,7 +175,7 @@
std::string releasenotesurl;
};
- /*
+ /*
* Data Object for Package
* resolvable
*/
@@ -193,9 +193,13 @@
std::string license;
std::string packager;
std::string group;
- Url url;
+ /**
+ * Upstream home page URL.
+ * \see zypp::Package::url();
+ */
+ std::string url;
std::string os;
-
+
std::string prein;
std::string postin;
std::string preun;
@@ -223,7 +227,7 @@
std::string license;
std::string packager;
std::string group;
- Url url;
+ std::string url;
std::string os;
std::string prein;
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0
[zypp-commit] r5455 - in /trunk: ./ libzypp/zypp/capability/ libzypp/zypp2/cache/ libzypp/zypp2/cache/schema/
by dmacvicar@svn.opensuse.org 26 Apr '07
by dmacvicar@svn.opensuse.org 26 Apr '07
26 Apr '07
Author: dmacvicar
Date: Thu Apr 26 18:32:41 2007
New Revision: 5455
URL: http://svn.opensuse.org/viewcvs/zypp?rev=5455&view=rev
Log:
r5158@piscola: dmacvicar | 2007-04-26 13:50:43 +0200
support for modalias caps
r5159@piscola: dmacvicar | 2007-04-26 13:51:25 +0200
fix duplicate index
r5160@piscola: dmacvicar | 2007-04-26 16:11:51 +0200
- support for HAL dependencies
r5161@piscola: dmacvicar | 2007-04-26 17:19:02 +0200
- support storing hal dependencies, and unknown dependencies
Modified:
trunk/ (props changed)
trunk/libzypp/zypp/capability/FileCap.h
trunk/libzypp/zypp/capability/FilesystemCap.cc
trunk/libzypp/zypp/capability/FilesystemCap.h
trunk/libzypp/zypp/capability/HalCap.cc
trunk/libzypp/zypp/capability/HalCap.h
trunk/libzypp/zypp/capability/ModaliasCap.cc
trunk/libzypp/zypp/capability/ModaliasCap.h
trunk/libzypp/zypp/capability/NamedCap.h
trunk/libzypp/zypp/capability/NullCap.cc
trunk/libzypp/zypp/capability/NullCap.h
trunk/libzypp/zypp/capability/SplitCap.cc
trunk/libzypp/zypp/capability/SplitCap.h
trunk/libzypp/zypp/capability/VersionedCap.h
trunk/libzypp/zypp2/cache/CacheStore.cpp
trunk/libzypp/zypp2/cache/CacheStore.h
trunk/libzypp/zypp2/cache/schema/schema.sql
Modified: trunk/libzypp/zypp/capability/FileCap.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/capability/FileCap.…
==============================================================================
--- trunk/libzypp/zypp/capability/FileCap.h (original)
+++ trunk/libzypp/zypp/capability/FileCap.h Thu Apr 26 18:32:41 2007
@@ -35,9 +35,9 @@
{
public:
typedef FileCap Self;
- typedef FileCap_Ptr Ptr;
- typedef FileCap_constPtr constPtr;
-
+ typedef FileCap_Ptr Ptr;
+ typedef FileCap_constPtr constPtr;
+
/** Ctor */
FileCap( const Resolvable::Kind & refers_r, const std::string & fname_r )
: CapabilityImpl( refers_r )
Modified: trunk/libzypp/zypp/capability/FilesystemCap.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/capability/Filesyst…
==============================================================================
--- trunk/libzypp/zypp/capability/FilesystemCap.cc (original)
+++ trunk/libzypp/zypp/capability/FilesystemCap.cc Thu Apr 26 18:32:41 2007
@@ -26,6 +26,8 @@
namespace capability
{ /////////////////////////////////////////////////////////////////
+ IMPL_PTR_TYPE(FilesystemCap)
+
/** Ctor */
FilesystemCap::FilesystemCap( const Resolvable::Kind & refers_r,
const std::string & name_r )
@@ -36,7 +38,7 @@
const CapabilityImpl::Kind & FilesystemCap::kind() const
{ return CapTraits<Self>::kind; }
- CapMatch FilesystemCap::matches( const constPtr & rhs ) const
+ CapMatch FilesystemCap::matches( const CapabilityImpl::constPtr & rhs ) const
{
if ( sameKindAndRefers( rhs ) )
{
Modified: trunk/libzypp/zypp/capability/FilesystemCap.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/capability/Filesyst…
==============================================================================
--- trunk/libzypp/zypp/capability/FilesystemCap.h (original)
+++ trunk/libzypp/zypp/capability/FilesystemCap.h Thu Apr 26 18:32:41 2007
@@ -21,6 +21,8 @@
namespace capability
{ /////////////////////////////////////////////////////////////////
+ DEFINE_PTR_TYPE(FilesystemCap)
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : FilesystemCap
@@ -42,7 +44,9 @@
{
public:
typedef FilesystemCap Self;
-
+ typedef FilesystemCap_Ptr Ptr;
+ typedef FilesystemCap_constPtr constPtr;
+
public:
/** Ctor */
FilesystemCap( const Resolvable::Kind & refers_r, const std::string & name_r );
@@ -52,7 +56,7 @@
virtual const Kind & kind() const;
/** Query USED_FS_LIST. */
- virtual CapMatch matches( const constPtr & rhs ) const;
+ virtual CapMatch matches( const CapabilityImpl::constPtr & rhs ) const;
/** <tt>filesystem(name)</tt> */
virtual std::string encode() const;
Modified: trunk/libzypp/zypp/capability/HalCap.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/capability/HalCap.c…
==============================================================================
--- trunk/libzypp/zypp/capability/HalCap.cc (original)
+++ trunk/libzypp/zypp/capability/HalCap.cc Thu Apr 26 18:32:41 2007
@@ -21,10 +21,12 @@
namespace capability
{ /////////////////////////////////////////////////////////////////
+ IMPL_PTR_TYPE(HalCap)
+
const CapabilityImpl::Kind & HalCap::kind() const
{ return CapTraits<Self>::kind; }
- CapMatch HalCap::matches( const constPtr & rhs ) const
+ CapMatch HalCap::matches( const CapabilityImpl::constPtr & rhs ) const
{
if ( sameKindAndRefers( rhs ) )
{
Modified: trunk/libzypp/zypp/capability/HalCap.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/capability/HalCap.h…
==============================================================================
--- trunk/libzypp/zypp/capability/HalCap.h (original)
+++ trunk/libzypp/zypp/capability/HalCap.h Thu Apr 26 18:32:41 2007
@@ -21,6 +21,8 @@
namespace capability
{ /////////////////////////////////////////////////////////////////
+ DEFINE_PTR_TYPE(HalCap)
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : HalCap
@@ -42,6 +44,8 @@
{
public:
typedef HalCap Self;
+ typedef HalCap_Ptr Ptr;
+ typedef HalCap_constPtr constPtr;
public:
/** Ctor */
@@ -66,13 +70,23 @@
virtual const Kind & kind() const;
/** Query target::Hal. */
- virtual CapMatch matches( const constPtr & rhs ) const;
+ virtual CapMatch matches( const CapabilityImpl::constPtr & rhs ) const;
/** <tt>hal(name) [op value]</tt> */
virtual std::string encode() const;
/** <tt>hal(name)</tt> */
virtual std::string index() const;
+
+ public:
+ const std::string & name() const
+ { return _name; }
+
+ Rel op() const
+ { return _op; }
+
+ const std::string & value() const
+ { return _value; }
private:
/** Empty HalCap <tt>hal()</tt> */
Modified: trunk/libzypp/zypp/capability/ModaliasCap.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/capability/Modalias…
==============================================================================
--- trunk/libzypp/zypp/capability/ModaliasCap.cc (original)
+++ trunk/libzypp/zypp/capability/ModaliasCap.cc Thu Apr 26 18:32:41 2007
@@ -24,6 +24,8 @@
namespace capability
{ /////////////////////////////////////////////////////////////////
+ IMPL_PTR_TYPE(ModaliasCap)
+
/** If name_r contains 2 ':', the 1st part is a package name. */
inline void modsplit( std::string & name_r, std::string & pkgname_r )
{
@@ -57,7 +59,7 @@
const CapabilityImpl::Kind & ModaliasCap::kind() const
{ return CapTraits<Self>::kind; }
- CapMatch ModaliasCap::matches( const constPtr & rhs ) const
+ CapMatch ModaliasCap::matches( const CapabilityImpl::constPtr & rhs ) const
{
if ( sameKindAndRefers( rhs ) )
{
Modified: trunk/libzypp/zypp/capability/ModaliasCap.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/capability/Modalias…
==============================================================================
--- trunk/libzypp/zypp/capability/ModaliasCap.h (original)
+++ trunk/libzypp/zypp/capability/ModaliasCap.h Thu Apr 26 18:32:41 2007
@@ -12,6 +12,7 @@
#ifndef ZYPP_CAPABILITY_MODALIASCAP_H
#define ZYPP_CAPABILITY_MODALIASCAP_H
+#include "zypp/base/Deprecated.h"
#include "zypp/capability/CapabilityImpl.h"
///////////////////////////////////////////////////////////////////
@@ -21,6 +22,8 @@
namespace capability
{ /////////////////////////////////////////////////////////////////
+ DEFINE_PTR_TYPE(ModaliasCap)
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : ModaliasCap
@@ -42,7 +45,9 @@
{
public:
typedef ModaliasCap Self;
-
+ typedef ModaliasCap_Ptr Ptr;
+ typedef ModaliasCap_constPtr constPtr;
+
public:
/** Ctor */
ModaliasCap( const Resolvable::Kind & refers_r, const std::string & name_r );
@@ -58,7 +63,7 @@
virtual const Kind & kind() const;
/** Query target::Modalias. */
- virtual CapMatch matches( const constPtr & rhs ) const;
+ virtual CapMatch matches( const CapabilityImpl::constPtr & rhs ) const;
/** <tt>modalias(name) [op value]</tt> */
virtual std::string encode() const;
@@ -70,9 +75,18 @@
const std::string & pkgname() const
{ return _pkgname; }
- const std::string & querystring() const
+ ZYPP_DEPRECATED const std::string & querystring() const
{ return _name; }
+ const std::string & name() const
+ { return _name; }
+
+ Rel op() const
+ { return _op; }
+
+ const std::string & value() const
+ { return _value; }
+
private:
/** Empty ModaliasCap <tt>modalias()</tt> */
bool isEvalCmd() const;
Modified: trunk/libzypp/zypp/capability/NamedCap.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/capability/NamedCap…
==============================================================================
--- trunk/libzypp/zypp/capability/NamedCap.h (original)
+++ trunk/libzypp/zypp/capability/NamedCap.h Thu Apr 26 18:32:41 2007
@@ -34,9 +34,9 @@
{
public:
typedef NamedCap Self;
- typedef NamedCap_Ptr Ptr;
- typedef NamedCap_constPtr constPtr;
-
+ typedef NamedCap_Ptr Ptr;
+ typedef NamedCap_constPtr constPtr;
+
/** Ctor */
NamedCap( const Resolvable::Kind & refers_r, const std::string & name_r )
: CapabilityImpl( refers_r )
Modified: trunk/libzypp/zypp/capability/NullCap.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/capability/NullCap.…
==============================================================================
--- trunk/libzypp/zypp/capability/NullCap.cc (original)
+++ trunk/libzypp/zypp/capability/NullCap.cc Thu Apr 26 18:32:41 2007
@@ -41,7 +41,7 @@
bool NullCap::relevant() const
{ return false; }
- CapMatch NullCap::matches( const constPtr & rhs ) const
+ CapMatch NullCap::matches( const CapabilityImpl::constPtr & rhs ) const
{ return CapMatch::irrelevant; }
std::string NullCap::encode() const
Modified: trunk/libzypp/zypp/capability/NullCap.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/capability/NullCap.…
==============================================================================
--- trunk/libzypp/zypp/capability/NullCap.h (original)
+++ trunk/libzypp/zypp/capability/NullCap.h Thu Apr 26 18:32:41 2007
@@ -52,7 +52,7 @@
virtual bool relevant() const;
/** Iirrelevant. */
- virtual CapMatch matches( const constPtr & rhs ) const;
+ virtual CapMatch matches( const CapabilityImpl::constPtr & rhs ) const;
/** Empty string. */
virtual std::string encode() const;
Modified: trunk/libzypp/zypp/capability/SplitCap.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/capability/SplitCap…
==============================================================================
--- trunk/libzypp/zypp/capability/SplitCap.cc (original)
+++ trunk/libzypp/zypp/capability/SplitCap.cc Thu Apr 26 18:32:41 2007
@@ -20,10 +20,12 @@
namespace capability
{ /////////////////////////////////////////////////////////////////
+ IMPL_PTR_TYPE(SplitCap)
+
const CapabilityImpl::Kind & SplitCap::kind() const
{ return CapTraits<Self>::kind; }
- CapMatch SplitCap::matches( const constPtr & rhs ) const
+ CapMatch SplitCap::matches( const CapabilityImpl::constPtr & rhs ) const
{
return CapMatch::irrelevant;
}
Modified: trunk/libzypp/zypp/capability/SplitCap.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/capability/SplitCap…
==============================================================================
--- trunk/libzypp/zypp/capability/SplitCap.h (original)
+++ trunk/libzypp/zypp/capability/SplitCap.h Thu Apr 26 18:32:41 2007
@@ -21,6 +21,8 @@
namespace capability
{ /////////////////////////////////////////////////////////////////
+ DEFINE_PTR_TYPE(SplitCap)
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : SplitCap
@@ -42,7 +44,9 @@
{
public:
typedef SplitCap Self;
-
+ typedef SplitCap_Ptr Ptr;
+ typedef SplitCap_constPtr constPtr;
+
/** Ctor */
SplitCap( const Resolvable::Kind & refers_r,
const std::string & name_r,
@@ -59,7 +63,7 @@
{ return false; }
/** */
- virtual CapMatch matches( const constPtr & rhs ) const;
+ virtual CapMatch matches( const CapabilityImpl::constPtr & rhs ) const;
/** <tt>name:/path</tt> */
virtual std::string encode() const;
Modified: trunk/libzypp/zypp/capability/VersionedCap.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/capability/Versione…
==============================================================================
--- trunk/libzypp/zypp/capability/VersionedCap.h (original)
+++ trunk/libzypp/zypp/capability/VersionedCap.h Thu Apr 26 18:32:41 2007
@@ -35,9 +35,7 @@
{
public:
typedef VersionedCap Self;
- typedef VersionedCap_Ptr Ptr;
- typedef VersionedCap_constPtr constPtr;
-
+
/** Ctor */
VersionedCap( const Resolvable::Kind & refers_r,
const std::string & name_r,
Modified: trunk/libzypp/zypp2/cache/CacheStore.cpp
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/CacheStore.c…
==============================================================================
--- trunk/libzypp/zypp2/cache/CacheStore.cpp (original)
+++ trunk/libzypp/zypp2/cache/CacheStore.cpp Thu Apr 26 18:32:41 2007
@@ -62,6 +62,9 @@
sqlite3_command_ptr append_file_dependency_cmd;
sqlite3_command_ptr append_named_dependency_cmd;
+ sqlite3_command_ptr append_modalias_dependency_cmd;
+ sqlite3_command_ptr append_hal_dependency_cmd;
+ sqlite3_command_ptr append_other_dependency_cmd;
sqlite3_command_ptr append_resolvable_cmd;
@@ -114,6 +117,12 @@
_pimpl->append_file_dependency_cmd.reset( new sqlite3_command( _pimpl->con, "insert into file_capabilities ( resolvable_id, dependency_type, refers_kind, file_id ) values ( :resolvable_id, :dependency_type, :refers_kind, :file_id );" ));
_pimpl->append_named_dependency_cmd.reset( new sqlite3_command( _pimpl->con, "insert into named_capabilities ( resolvable_id, dependency_type, refers_kind, name_id, version, release, epoch, relation ) values ( :resolvable_id, :dependency_type, :refers_kind, :name_id, :version, :release, :epoch, :relation );" ));
+ _pimpl->append_modalias_dependency_cmd.reset( new sqlite3_command( _pimpl->con, "insert into modalias_capabilities ( resolvable_id, dependency_type, refers_kind, name, value, relation ) values ( :resolvable_id, :dependency_type, :refers_kind, :name, :value, :relation );" ));
+
+ _pimpl->append_hal_dependency_cmd.reset( new sqlite3_command( _pimpl->con, "insert into hal_capabilities ( resolvable_id, dependency_type, refers_kind, name, value, relation ) values ( :resolvable_id, :dependency_type, :refers_kind, :name, :value, :relation );" ));
+
+ _pimpl->append_other_dependency_cmd.reset( new sqlite3_command( _pimpl->con, "insert into other_capabilities ( resolvable_id, dependency_type, refers_kind, value ) values ( :resolvable_id, :dependency_type, :refers_kind, :value );" ));
+
_pimpl->append_resolvable_cmd.reset( new sqlite3_command( _pimpl->con, "insert into resolvables ( name, version, release, epoch, arch, kind, catalog_id ) values ( :name, :version, :release, :epoch, :arch, :kind, :catalog_id );" ));
// disable autocommit
@@ -181,27 +190,32 @@
void CacheStore::appendDependency( const data::RecordId &resolvable_id, zypp::Dep deptype, capability::CapabilityImpl::Ptr cap )
{
- //DBG << cap << endl;
- if ( cap->refers() != ResTraits<Package>::kind )
+ if ( cap == 0 )
{
DBG << "invalid capability" << endl;
return;
}
- if ( cap == 0 )
+ if ( capability::isKind<NamedCap>(cap) )
{
- DBG << "invalid capability" << endl;
- return;
+ appendNamedDependency( resolvable_id, deptype, capability::asKind<NamedCap>(cap) );
}
-
- if ( capability::isKind<FileCap>(cap) )
+ else if ( capability::isKind<FileCap>(cap) )
{
appendFileDependency( resolvable_id, deptype, capability::asKind<FileCap>(cap) );
return;
}
- else if ( capability::isKind<NamedCap>(cap) )
+ else if ( capability::isKind<ModaliasCap>(cap) )
{
- appendNamedDependency( resolvable_id, deptype, capability::asKind<NamedCap>(cap) );
+ appendModaliasDependency( resolvable_id, deptype, capability::asKind<ModaliasCap>(cap) );
+ }
+ else if ( capability::isKind<HalCap>(cap) )
+ {
+ appendHalDependency( resolvable_id, deptype, capability::asKind<HalCap>(cap) );
+ }
+ else
+ {
+ appendUnknownDependency( resolvable_id, deptype, cap );
}
}
@@ -255,10 +269,51 @@
//delete cmd;
}
-void CacheStore::appendFileDependency( const data::RecordId &resolvable_id, zypp::Dep deptype, capability::FileCap::Ptr cap )
+void CacheStore::appendModaliasDependency( const data::RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::ModaliasCap::Ptr cap )
+{
+ if ( !cap )
+ ZYPP_THROW(Exception("Null modalias capability"));
+
+ _pimpl->append_modalias_dependency_cmd->bind( ":resolvable_id", resolvable_id );
+ _pimpl->append_modalias_dependency_cmd->bind( ":dependency_type", zypp_deptype2db_deptype(deptype) );
+ _pimpl->append_modalias_dependency_cmd->bind( ":refers_kind", zypp_kind2db_kind(cap->refers()) );
+
+ //_pimpl->append_modalias_dependency_cmd->bind( ":capability_id", capability_id);
+ _pimpl->append_modalias_dependency_cmd->bind( ":name", cap->name());
+ _pimpl->append_modalias_dependency_cmd->bind( ":value", cap->value());
+ _pimpl->append_modalias_dependency_cmd->bind( ":relation", zypp_rel2db_rel( cap->op() ) );
+
+ _pimpl->append_modalias_dependency_cmd->executenonquery();
+ //delete cmd;
+}
+
+void CacheStore::appendHalDependency( const data::RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::HalCap::Ptr cap )
+{
+ if ( !cap )
+ ZYPP_THROW(Exception("Null HAL capability"));
+
+ _pimpl->append_hal_dependency_cmd->bind( ":resolvable_id", resolvable_id );
+ _pimpl->append_hal_dependency_cmd->bind( ":dependency_type", zypp_deptype2db_deptype(deptype) );
+ _pimpl->append_hal_dependency_cmd->bind( ":refers_kind", zypp_kind2db_kind(cap->refers()) );
+
+ //_pimpl->append_hal_dependency_cmd->bind( ":capability_id", capability_id);
+ _pimpl->append_hal_dependency_cmd->bind( ":name", cap->name());
+ _pimpl->append_hal_dependency_cmd->bind( ":value", cap->value());
+ _pimpl->append_hal_dependency_cmd->bind( ":relation", zypp_rel2db_rel( cap->op() ) );
+
+ _pimpl->append_hal_dependency_cmd->executenonquery();
+ //delete cmd;
+}
+
+void CacheStore::appendFileDependency( const data::RecordId &resolvable_id, zypp::Dep deptype,
+ capability::FileCap::Ptr cap )
{
if ( !cap )
- ZYPP_THROW(Exception("bad file cap"));
+ ZYPP_THROW(Exception("Null file capability"));
//data::RecordId capability_id = appendDependencyEntry( resolvable_id, deptype, cap->refers() );
data::RecordId file_id = lookupOrAppendFile(cap->filename());
@@ -274,6 +329,23 @@
//delete cmd;
}
+void CacheStore::appendUnknownDependency( const data::RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::CapabilityImpl::Ptr cap )
+{
+ if ( !cap )
+ ZYPP_THROW(Exception("Null unknown capability"));
+
+ _pimpl->append_other_dependency_cmd->bind( ":resolvable_id", resolvable_id );
+ _pimpl->append_other_dependency_cmd->bind( ":dependency_type", zypp_deptype2db_deptype(deptype) );
+ _pimpl->append_other_dependency_cmd->bind( ":refers_kind", zypp_kind2db_kind(cap->refers()) );
+ _pimpl->append_other_dependency_cmd->bind( ":value", cap->encode());
+
+ _pimpl->append_hal_dependency_cmd->executenonquery();
+ //delete cmd;
+}
+
+
// data::RecordId CacheStore::appendDependencyEntry( const data::RecordId &resolvable_id, zypp::Dep deptype, const Resolvable::Kind &refers )
// {
// //DBG << "rid: " << resolvable_id << " deptype: " << deptype << " " << "refers: " << refers << endl;
Modified: trunk/libzypp/zypp2/cache/CacheStore.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/CacheStore.h…
==============================================================================
--- trunk/libzypp/zypp2/cache/CacheStore.h (original)
+++ trunk/libzypp/zypp2/cache/CacheStore.h Thu Apr 26 18:32:41 2007
@@ -173,6 +173,63 @@
capability::FileCap::Ptr);
/**
+ * Adds a Modalias dependency to the store.
+ *
+ * A \ref ModaliasCap::Ptr \a cap to be specified. Among
+ * which type of dependency \ref zypp::Dep it is as
+ * the \a deptype argument.
+ *
+ * \a resolvable_id is the resolvable Id in the CacheStore
+ * that will own the capability
+ *
+ * You can create the modalias capability using either
+ * \ref capability::parse or \ref capability::buildModalias
+ *
+ * FIXME should it \throw if the resolvable does not exist?
+ */
+ void appendModaliasDependency( const data::RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::ModaliasCap::Ptr cap);
+
+ /**
+ * Adds a Hal dependency to the store.
+ *
+ * A \ref HalCap::Ptr \a cap to be specified. Among
+ * which type of dependency \ref zypp::Dep it is as
+ * the \a deptype argument.
+ *
+ * \a resolvable_id is the resolvable Id in the CacheStore
+ * that will own the capability
+ *
+ * You can create the modalias capability using either
+ * \ref capability::parse or \ref capability::buildHal
+ *
+ * FIXME should it \throw if the resolvable does not exist?
+ */
+ void appendHalDependency( const data::RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::HalCap::Ptr cap );
+
+ /**
+ * Adds a unknown dependency to the store.
+ *
+ * A \ref Capability::Ptr \a cap to be specified. Among
+ * which type of dependency \ref zypp::Dep it is as
+ * the \a deptype argument.
+ *
+ * \a resolvable_id is the resolvable Id in the CacheStore
+ * that will own the capability
+ *
+ * You can create the capability using either
+ * \ref capability::parse
+ *
+ * FIXME should it \throw if the resolvable does not exist?
+ */
+ void appendUnknownDependency( const data::RecordId &resolvable_id,
+ zypp::Dep deptype,
+ capability::CapabilityImpl::Ptr cap );
+
+ /**
* Returns the record id of a catalog (Source) \a path
*
* \note If the catalog entry does not exist, it will
Modified: trunk/libzypp/zypp2/cache/schema/schema.sql
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp2/cache/schema/schem…
==============================================================================
--- trunk/libzypp/zypp2/cache/schema/schema.sql (original)
+++ trunk/libzypp/zypp2/cache/schema/schema.sql Thu Apr 26 18:32:41 2007
@@ -4,42 +4,6 @@
-- cat schema.sql | grep "^CREATE" | awk '{print "DROP " $2 " IF EXISTS " $3 ";"}' | sort -r
------------------------------------------------
-DROP VIEW IF EXISTS scripts;
-DROP VIEW IF EXISTS products;
-DROP VIEW IF EXISTS patterns;
-DROP VIEW IF EXISTS patches;
-DROP VIEW IF EXISTS packages;
-DROP VIEW IF EXISTS messages;
-DROP TRIGGER IF EXISTS remove_resolvables;
-DROP TRIGGER IF EXISTS remove_patch_packages_baseversions;
-DROP TABLE IF EXISTS named_capabilities;
-DROP TABLE IF EXISTS translated_texts;
-DROP TABLE IF EXISTS script_details;
-DROP TABLE IF EXISTS resolvable_texts;
-DROP TABLE IF EXISTS resolvables_catalogs;
-DROP TABLE IF EXISTS resolvables;
-DROP TABLE IF EXISTS product_details;
-DROP TABLE IF EXISTS pattern_details;
-DROP TABLE IF EXISTS patch_packages_baseversions;
-DROP TABLE IF EXISTS patch_packages;
-DROP TABLE IF EXISTS patch_details;
-DROP TABLE IF EXISTS package_details;
-DROP TABLE IF EXISTS names;
-DROP TABLE IF EXISTS message_details;
-DROP TABLE IF EXISTS locks;
-DROP TABLE IF EXISTS files;
-DROP TABLE IF EXISTS file_names;
-DROP TABLE IF EXISTS file_capabilities;
-DROP TABLE IF EXISTS split_capabilities;
-DROP TABLE IF EXISTS dir_names;
-DROP TABLE IF EXISTS delta_packages;
-DROP TABLE IF EXISTS db_info;
-DROP TABLE IF EXISTS catalogs;
-DROP TABLE IF EXISTS capabilities;
-DROP INDEX IF EXISTS package_details_resolvable_id;
-DROP INDEX IF EXISTS capability_resolvable;
-DROP INDEX IF EXISTS named_capabilities_capability_id;
-
------------------------------------------------
-- version metadata, probably not needed, there
-- is pragma user_version
@@ -322,6 +286,26 @@
);
CREATE INDEX named_capabilities_name ON named_capabilities(name_id);
+CREATE TABLE modalias_capabilities (
+ id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
+ , resolvable_id INTEGER REFERENCES resolvables(id)
+ , dependency_type INTEGER
+ , refers_kind INTEGER
+ , name TEXT
+ , value TEXT
+ , relation INTEGER
+);
+
+CREATE TABLE hal_capabilities (
+ id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
+ , resolvable_id INTEGER REFERENCES resolvables(id)
+ , dependency_type INTEGER
+ , refers_kind INTEGER
+ , name TEXT
+ , value TEXT
+ , relation INTEGER
+);
+
CREATE TABLE file_capabilities (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
, resolvable_id INTEGER REFERENCES resolvables(id)
@@ -330,6 +314,14 @@
, file_id INTEGER REFERENCES files(id)
);
+CREATE TABLE other_capabilities (
+ id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
+ , resolvable_id INTEGER REFERENCES resolvables(id)
+ , dependency_type INTEGER
+ , refers_kind INTEGER
+ , value TEXT
+);
+
CREATE TABLE split_capabilities (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
, resolvable_id INTEGER REFERENCES resolvables(id)
--
To unsubscribe, e-mail: zypp-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: zypp-commit+help(a)opensuse.org
1
0