#
SET(LIBZYPP_MAJOR "3")
-SET(LIBZYPP_MINOR "4")
-SET(LIBZYPP_COMPATMINOR "3")
-SET(LIBZYPP_PATCH "0")
+SET(LIBZYPP_MINOR "11")
+SET(LIBZYPP_COMPATMINOR "10")
+SET(LIBZYPP_PATCH "8")
/usr/local/include
)
-FIND_LIBRARY(SQLITE_LIBRARY NAMES sqlitezmd3 sqlite3
+FIND_LIBRARY(SQLITE_LIBRARY NAMES sqlite3
PATHS
/usr/lib
/usr/local/lib
ADD_EXECUTABLE(mediaaccess mediaaccess.cc)
TARGET_LINK_LIBRARIES(mediaaccess zypp )
-ADD_EXECUTABLE(scansource ScanSource.cc)
-TARGET_LINK_LIBRARIES(scansource zypp )
+#ADD_EXECUTABLE(scansource ScanSource.cc)
+#TARGET_LINK_LIBRARIES(scansource zypp )
-ADD_EXECUTABLE(susetags-downloader SUSETagsDownloader_tp.cc)
-TARGET_LINK_LIBRARIES(susetags-downloader zypp )
+#ADD_EXECUTABLE(susetags-downloader SUSETagsDownloader_tp.cc)
+#TARGET_LINK_LIBRARIES(susetags-downloader zypp )
ADD_EXECUTABLE(cachestore CacheStore_tp.cc)
TARGET_LINK_LIBRARIES(cachestore zypp )
-ADD_EXECUTABLE(testbed testbed.cc)
-TARGET_LINK_LIBRARIES(testbed zypp )
+#ADD_EXECUTABLE(testbed testbed.cc)
+#TARGET_LINK_LIBRARIES(testbed zypp )
-ADD_EXECUTABLE(yum-downloader YUMDownloader_tp.cc)
-TARGET_LINK_LIBRARIES(yum-downloader zypp )
+#ADD_EXECUTABLE(yum-downloader YUMDownloader_tp.cc)
+#TARGET_LINK_LIBRARIES(yum-downloader zypp )
# ADD_EXECUTABLE(yum-reader YUMReader_tp.cc)
# TARGET_LINK_LIBRARIES(yum-reader zypp )
#include "zypp/Product.h"
#include "zypp/detail/PackageImplIf.h"
#include "zypp/Package.h"
-#include "zypp/RepositoryFactory.h"
#include "zypp/repo/cached/RepoImpl.h"
#include "zypp/data/ResolvableData.h"
#include <fstream>
#include <zypp/base/Logger.h>
+#include <zypp/base/Measure.h>
#include <zypp/ZYpp.h>
#include <zypp/ZYppFactory.h>
#include "zypp/Product.h"
#include "zypp/detail/PackageImplIf.h"
#include "zypp/Package.h"
-#include "zypp/RepositoryFactory.h"
#include "zypp/RepoInfo.h"
#include "zypp/repo/cached/RepoImpl.h"
using namespace std;
using namespace zypp;
-using namespace zypp::source;
+using namespace zypp::repo;
int main(int argc, char **argv)
for ( RepoInfoList::const_iterator it = repos.begin(); it != repos.end(); ++it )
{
cout << *it << endl;
+ Repository repo = manager.createFromCache(*it);
+ z->addResolvables(repo.resolvables());
}
+
+ ResPool pool(z->pool());
+ cout << pool.size() << " resolvables" << endl;
+ debug::Measure m("group call");
+ for ( ResPool::const_iterator it = pool.begin();
+ it != pool.end();
+ ++it )
+ {
+ ResObject::constPtr res = (*it).resolvable();
+ if ( isKind<Package>(res) )
+ {
+ Package::constPtr p = asKind<Package>(res);
+ //cout << p->group() << std::endl;
+ }
+ }
+ m.elapsed();
}
catch ( const Exception &e )
{
#include "zypp/Product.h"
#include "zypp/detail/PackageImplIf.h"
#include "zypp/Package.h"
-#include "zypp/RepositoryFactory.h"
#include "zypp/repo/cached/RepoImpl.h"
#include "zypp/data/ResolvableData.h"
ENDFOREACH( loop_var )
-FOREACH( loop_var AOUT Parse)
+FOREACH( loop_var AOUT Parse Test)
ADD_EXECUTABLE( ${loop_var}
${loop_var}.cc
)
#include <zypp/base/PtrTypes.h>
#include <zypp/base/Exception.h>
+#include <zypp/base/LogTools.h>
#include <zypp/base/ProvideNumericId.h>
#include "zypp/ZYppFactory.h"
#include "zypp/ResPoolProxy.h"
-#include <zypp/SourceManager.h>
-#include <zypp/SourceFactory.h>
+#include <zypp/CapMatchHelper.h>
#include "zypp/ZYppCallbacks.h"
#include "zypp/NVRAD.h"
#include "zypp/NameKindProxy.h"
#include "zypp/pool/GetResolvablesToInsDel.h"
-#include "zypp/parser/tagfile/TagFileParser.h"
#include "zypp/parser/TagParser.h"
#include "zypp/parser/susetags/PackagesFileReader.h"
#include "zypp/parser/susetags/PackagesLangFileReader.h"
#include "zypp/parser/susetags/PatternFileReader.h"
#include "zypp/parser/susetags/ContentFileReader.h"
#include "zypp/parser/susetags/RepoIndex.h"
-
#include "zypp/parser/susetags/RepoParser.h"
#include "zypp/cache/CacheStore.h"
+#include "zypp/RepoManager.h"
+#include "zypp/RepoInfo.h"
using namespace std;
using namespace zypp;
using namespace zypp::functor;
-using zypp::parser::tagfile::TagFileParser;
using zypp::parser::TagParser;
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
+struct Xprint
+{
+ bool operator()( const PoolItem & obj_r )
+ {
+ MIL << obj_r << " " << obj_r->summary() << endl;
+ MIL << obj_r << " " << obj_r->description() << endl;
+ return true;
+ }
+
+ template<class _C>
+ bool operator()( const _C & obj_r )
+ {
+ USR << obj_r << endl;
+ return true;
+ }
+};
+
+///////////////////////////////////////////////////////////////////
+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
+ {
+ bool ret = pi.status().setTransactValue( _newVal, _causer );
+ if ( ! ret )
+ ERR << _newVal << _causer << " " << pi << endl;
+ return ret;
+ }
+};
+
+struct StatusReset : public SetTransactValue
+{
+ StatusReset()
+ : SetTransactValue( ResStatus::KEEP_STATE, ResStatus::USER )
+ {}
+};
+
+struct StatusInstall : public SetTransactValue
+{
+ StatusInstall()
+ : SetTransactValue( ResStatus::TRANSACT, ResStatus::USER )
+ {}
+};
+
+inline bool g( 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 );
+}
+
+///////////////////////////////////////////////////////////////////
+
+bool solve( bool establish = false )
+{
+ if ( establish )
+ {
+ bool eres = false;
+ {
+ zypp::base::LogControl::TmpLineWriter shutUp;
+ eres = getZYpp()->resolver()->establishPool();
+ }
+ if ( ! eres )
+ {
+ ERR << "establish " << eres << endl;
+ return false;
+ }
+ MIL << "establish " << eres << endl;
+ }
+
+ bool rres = false;
+ {
+ zypp::base::LogControl::TmpLineWriter shutUp;
+ rres = getZYpp()->resolver()->resolvePool();
+ }
+ if ( ! rres )
+ {
+ ERR << "resolve " << rres << endl;
+ return false;
+ }
+ MIL << "resolve " << rres << endl;
+ return true;
+}
+
+///////////////////////////////////////////////////////////////////
+
struct ConvertDbReceive : public callback::ReceiveReport<target::ScriptResolvableReport>
{
virtual void start( const Resolvable::constPtr & script_r,
struct MediaChangeReceive : public callback::ReceiveReport<media::MediaChangeReport>
{
- virtual Action requestMedia( Source_Ref source
+ virtual Action requestMedia( Repository source
, unsigned mediumNr
, Error error
, const std::string & description )
struct AddResolvables
{
- bool operator()( const Source_Ref & src ) const
+ bool operator()( const Repository & src ) const
{
getZYpp()->addResolvables( src.resolvables() );
return true;
}
///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-
-using namespace zypp::parser::susetags;
-#include "zypp/cache/CacheStore.h"
-
-void consumeIndex( const parser::susetags::RepoIndex_Ptr & index_r )
-{
- SEC << "[Index]" << index_r << endl;
-}
-void consumeProd( const data::Product_Ptr & prod_r )
-{
- SEC << "[Prod]" << prod_r << endl;
-}
+#define for_(IT,BEG,END) for ( typeof(BEG) IT = BEG; IT != END; ++IT )
-void consumePkg( const data::Package_Ptr & pkg_r )
-{
- //MIL << "[Pkg]" << pkg_r << endl;
-}
-
-void consumeSrcPkg( const data::SrcPackage_Ptr & pkg_r )
-{
- //DBG << "[Src]" << pkg_r << endl;
-}
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
-void consumePat( const data::Pattern_Ptr & pat_r )
-{
- MIL << "[Pat]" << pat_r << endl;
-}
-void pPackages( const Pathname & p )
-{
- Measure x( p.basename() );
- PackagesFileReader tp;
- tp.setPkgConsumer( consumePkg );
- tp.setSrcPkgConsumer( consumeSrcPkg );
- tp.parse( p );
-}
-void pPackagesLang( const Pathname & p, const Locale & locale_r )
-{
- Measure x( p.basename() );
- PackagesLangFileReader tp;
- tp.setLocale( locale_r );
- tp.setPkgConsumer( consumePkg );
- tp.setSrcPkgConsumer( consumeSrcPkg );
- tp.parse( p );
-}
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
-void pPattern( const Pathname & p )
-{
- Measure x( p.basename() );
- PatternFileReader tp;
- tp.setConsumer( consumePat );
- tp.parse( p );
-}
+using namespace zypp;
- /******************************************************************
+/******************************************************************
**
** FUNCTION NAME : main
** FUNCTION TYPE : int
//zypp::base::LogControl::instance().logfile( "log.restrict" );
INT << "===[START]==========================================" << endl;
- Pathname dbdir( "store" );
- Pathname reporoot( "lmd" );
+ RepoManager repoManager;
+ RepoInfoList repos = repoManager.knownRepositories();
+ SEC << repos << endl;
- cache::CacheStore store( dbdir );
- data::RecordId repositoryId = store.lookupOrAppendRepository( "foosource" );
+ if ( repos.empty() )
{
- Measure x( "XXXXXXXXXXXXX" );
-
- parser::susetags::RepoParser repo( repositoryId, store );
- repo.parse( reporoot );
-
- store.commit();
+ RepoInfo nrepo;
+ nrepo
+ .setAlias( "factorytest" )
+ .setName( "Test Repo for factory." )
+ .setEnabled( true )
+ .setAutorefresh( false )
+ .addBaseUrl( Url("ftp://dist.suse.de/install/stable-x86/") );
+
+ repoManager.addRepository( nrepo );
+ repos = repoManager.knownRepositories();
+ SEC << "refreshMetadat" << endl;
+ repoManager.refreshMetadata( nrepo );
+ SEC << "buildCache" << endl;
+ repoManager.buildCache( nrepo );
+ SEC << "------" << endl;
}
+ ResPool pool( getZYpp()->pool() );
+ vdumpPoolStats( USR << "Initial pool:" << endl,
+ pool.begin(),
+ pool.end() ) << endl;
-#if 0
- ContentFileReader tp;
- tp.setProductConsumer( consumeProd );
- tp.setRepoIndexConsumer( consumeIndex );
- //tp.setSrcPkgConsumer( consumeSrcPkg );
- tp.parse( p );
-
-
- //try
+ for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it )
{
- //Pathname dbdir( "/Local/ma/zypp-TRUNK/BUILD/libzypp/devel/devel.ma/store" );
-
-
- Pathname dbdir( "store" );
- Pathname metadir( "lmd" );
-
- cache::CacheStore store( dbdir );
- data::RecordId repositoryId = store.lookupOrAppendRepository( Url("http://www.google.com"), "/" );
-
- RepoParser( metadir, repositoryId, store );
-
- }
-
- try
- {
- ZYpp::Ptr z = getZYpp();
-
- Pathname dbfile( "data.db" );
- cache::CacheStore store(getenv("PWD"));
+ RepoInfo & nrepo( *it );
- data::RecordId repository_id = store.lookupOrAppendRepository( Url("http://www.google.com"), "/");
-
- PackagesParser parser( repository_id, store);
- Measure m;
- parser.start(argv[1], &progress_function);
- m.elapsed();
- }
- catch ( const Exception &e )
+ if ( 0 )
{
- cout << "ups! " << e.msg() << std::endl;
+ if ( repoManager.isCached( nrepo ) )
+ {
+ SEC << "cleanCache" << endl;
+ repoManager.cleanCache( nrepo );
+ }
+ SEC << "buildCache" << endl;
+ repoManager.buildCache( nrepo );
}
-#endif
+ SEC << nrepo << endl;
+ Repository nrep( repoManager.createFromCache( nrepo ) );
+ const zypp::ResStore & store( nrep.resolvables() );
+ dumpPoolStats( SEC << "Store: " << endl,
+ store.begin(), store.end() ) << endl;
+ getZYpp()->addResolvables( store );
+ }
- INT << "===[END]============================================" << endl << endl;
- zypp::base::LogControl::instance().logNothing();
- return 0;
+ USR << "pool: " << pool << endl;
- Pathname proot( "lmd/suse/setup/descr" );
+ SEC << pool.knownRepositoriesSize() << endl;
+ std::for_each( pool.knownRepositoriesBegin(), pool.knownRepositoriesEnd(), Print() );
- pPackages( proot/"packages" );
- //pPackages( proot/"packages.gz" );
- pPackagesLang( proot/"packages.de", Locale("de") );
- //pPackagesLang( proot/"packages.de.gz", Locale("de") );
- pPattern( proot/"base-10.3-30.x86_64.pat" );
+ std::for_each( pool.byNameBegin("glibc"), pool.byNameEnd("glibc"), Xprint() );
- 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() )
- {
- ;
- }
- }
- }
+ ///////////////////////////////////////////////////////////////////
INT << "===[END]============================================" << endl << endl;
zypp::base::LogControl::instance().logNothing();
return 0;
#include "Tools.h"
-#include <libxml/xmlreader.h>
-#include <libxml/xmlerror.h>
+#include "ExplicitMap.h"
#include <boost/call_traits.hpp>
#include <iostream>
#include <zypp/base/LogControl.h>
#include <zypp/base/LogTools.h>
-
-#include "Measure.h"
-
-#include "zypp/parser/xml/Reader.h"
-
-using namespace std;
-using namespace zypp;
-
#include "zypp/base/Exception.h"
#include "zypp/base/InputStream.h"
#include "zypp/base/DefaultIntegral.h"
#include <zypp/base/Function.h>
#include <zypp/base/Iterator.h>
+
#include <zypp/Pathname.h>
-#include <zypp/ExplicitMap.h>
-#include <zypp/Depository.h>
#include <zypp/Edition.h>
#include <zypp/CheckSum.h>
#include <zypp/Date.h>
-///////////////////////////////////////////////////////////////////
-
-template<class _Cl>
- void ti( const _Cl & c )
- {
- SEC << __PRETTY_FUNCTION__ << endl;
- }
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{
- namespace parser
- {
- namespace yum
- {
- ///////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- }
- }
-}
-///////////////////////////////////////////////////////////////////
-
-bool nopNode( xml::Reader & reader_r )
-{
- return true;
-}
-
-bool accNode( xml::Reader & reader_r )
-{
- int i;
- xml::XmlString s;
-#define X(m) reader_r->m()
- i=X(readState);
- i=X(lineNumber);
- i=X(columnNumber);
- i=X(depth);
- i=X(nodeType);
- s=X(name);
- s=X(prefix);
- s=X(localName);
- i=X(hasAttributes);
- i=X(attributeCount);
- i=X(hasValue);
- s=X(value);
-#undef X
- return true;
-}
-
-bool dumpNode( xml::Reader & reader_r )
-{
- switch ( reader_r->nodeType() )
- {
- case XML_READER_TYPE_ATTRIBUTE:
- DBG << *reader_r << endl;
- break;
- case XML_READER_TYPE_ELEMENT:
- MIL << *reader_r << endl;
- break;
- default:
- WAR << *reader_r << endl;
- break;
- }
- return true;
-}
-
-bool dumpNode2( xml::Reader & reader_r )
-{
- dumpNode( reader_r );
- return reader_r.foreachNodeAttribute( dumpNode );
-}
-
-bool dumpEd( xml::Reader & reader_r )
-{
- static int num = 5;
- if ( reader_r->nodeType() == XML_READER_TYPE_ELEMENT
- && reader_r->name() == "version" )
- {
- MIL << *reader_r << endl;
- DBG << reader_r->getAttribute( "rel" ) << endl;
- ERR << *reader_r << endl;
- DBG << reader_r->getAttribute( "ver" ) << endl;
- ERR << *reader_r << endl;
- DBG << reader_r->getAttribute( "epoch" ) << endl;
- ERR << *reader_r << endl;
- WAR << Edition( reader_r->getAttribute( "ver" ).asString(),
- reader_r->getAttribute( "rel" ).asString(),
- reader_r->getAttribute( "epoch" ).asString() ) << endl;
- --num;
- }
- return num;
-}
+#include "zypp/parser/TagParser.h"
+#include "zypp/parser/susetags/PackagesFileReader.h"
+#include "zypp/parser/susetags/PackagesLangFileReader.h"
+#include "zypp/parser/susetags/PatternFileReader.h"
+#include "zypp/parser/susetags/ContentFileReader.h"
+#include "zypp/parser/susetags/RepoIndex.h"
+#include "zypp/parser/susetags/RepoParser.h"
+#include "zypp/cache/CacheStore.h"
+using namespace std;
+using namespace zypp;
+using namespace zypp::parser;
+using namespace zypp::parser::susetags;
///////////////////////////////////////////////////////////////////
-namespace parser
+struct DummyConsumer : public zypp::data::ResolvableDataConsumer
+ , private base::NonCopyable
{
- namespace consume
+ std::string idString( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
{
- struct Repomd
- {
- struct Data
- {
- Depository<std::string> _type;
- Depository<CheckSum> _checksum;
- Depository<Date> _timestamp;
- Depository<CheckSum> _openChecksum;
- };
-
- Depository<Data> _data;
- };
+ std::string ret( kind_r.asString() );
+ ret += ":";
+ ret += res_r->name;
+ ret += "-";
+ ret += res_r->edition.asString();
+ ret += ".";
+ ret += res_r->arch.asString();
+ return ret;
}
+ data::RecordId _lastId;
+ std::map<std::string,data::RecordId> _idMap;
+ std::map<data::RecordId,std::string> _reverseMap;
-
-}
-
-namespace data
-{
- struct Repomd
- {
- struct Data
- {
- std::string _type;
- CheckSum _checksum;
- Date _timestamp;
- CheckSum _openChecksum;
- };
-
- std::map<std::string, Data> _data;
- };
-}
-
-///////////////////////////////////////////////////////////////////
-
-
-
-struct Element;
-std::ostream & operator<<( std::ostream & str, const Element & obj );
-
-struct Element : private base::NonCopyable
-{
- Element( xml::Reader & reader_r )
- : _reader( reader_r )
- , _name( _reader->name().asString() )
- , _depth( _reader->depth() )
- {
- MIL << *this << endl;
- //return;
- while( nextElement() )
- {
- Element el( _reader );
- }
- }
-
- ~Element()
+ bool hasEntry( const std::string & id_r )
{
- while( nextElement() )
- { ; }
- DBG << *this << endl;
+ return _idMap.find( id_r ) != _idMap.end();
}
- bool atBegin() const
+ data::RecordId newId( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
{
- return ( _reader->depth() == _depth
- && _reader->nodeType() == XML_READER_TYPE_ELEMENT
- && _reader->name().c_str() == _name );
+ std::string id( idString( res_r, kind_r ) );
+ if ( hasEntry( id ) )
+ ZYPP_THROW(Exception(id));
+ _idMap[id] = ++_lastId;
+ _reverseMap[_lastId] = id;
+ MIL << "NEW_ID " << _lastId << " - " << id << endl;
+ logNew( res_r, kind_r );
+ return _lastId;
}
- bool atEnd() const
+ data::RecordId getId( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
{
- return ( _reader->depth() == _depth
- && ( _reader->nodeType() == XML_READER_TYPE_END_ELEMENT
- || ( _reader->nodeType() == XML_READER_TYPE_ELEMENT
- && _reader->isEmptyElement() ) )
- && _reader->name().c_str() == _name );
+ std::string id( idString( res_r, kind_r ) );
+ if ( ! hasEntry( id ) )
+ ZYPP_THROW(Exception(id));
+ data::RecordId ret = _idMap[id];
+ DBG << ret << " " << id << endl;
+ return ret;
}
- bool nextElement()
+ std::string lookup( data::RecordId id_r )
{
- while ( ! atEnd() )
- {
- if ( ! _reader.nextNode() )
- return false;
- if ( _reader->nodeType() == XML_READER_TYPE_ELEMENT )
- return true;
- WAR << *_reader << endl;
- }
- return false;
- }
-
-
- xml::Reader & _reader;
- std::string _name;
- int _depth;
-};
-
-std::ostream & operator<<( std::ostream & str, const Element & obj )
-{
- str << ( obj.atBegin() ? 'B' : '_' )
- << ( obj.atEnd() ? 'E' : '_' )
- << obj._depth << ":" << std::string( obj._depth, ' ') << obj._name
- << " {" << *obj._reader << '}';
- return str;
-}
-
-bool dumpEl( xml::Reader & reader_r )
-{
- Element el( reader_r );
- return true;
-}
-
-void parse2( const InputStream & file_r )
-{
- Measure x( file_r.name() );
- try
+ if ( id_r == data::noRecordId )
{
- MIL << file_r << endl;
- xml::Reader r( file_r );
- MIL << *r << endl;
- Element el( r );
- MIL << *r << endl;
+ return "";
}
- catch ( const Exception & )
- {
- }
-}
-///////////////////////////////////////////////////////////////////
-class BasicParser
-{
- public:
- typedef function<void( xml::Reader & )> Consumer;
- typedef ExplicitMap<std::string,Consumer> ConsumerMap;
-
- BasicParser( const InputStream & file_r )
- : _reader( file_r )
- , _cmap( nop )
- {}
-
- public:
- xml::Reader & reader()
- { return _reader; }
-
- const xml::Reader & reader() const
- { return _reader; }
-
- ConsumerMap & cmap()
- { return _cmap; }
- const ConsumerMap & cmap() const
- { return _cmap; }
-
- public:
-
- bool parse( xml::Reader & reader_r )
+ if ( _reverseMap.find( id_r ) != _reverseMap.end() )
{
- switch ( reader_r->nodeType() )
- {
- case XML_READER_TYPE_ELEMENT:
- case XML_READER_TYPE_TEXT:
- case XML_READER_TYPE_CDATA:
- case XML_READER_TYPE_END_ELEMENT:
- consume( reader_r );
- default:
- ;
- }
- return true;
+ return _reverseMap[id_r];
}
- public:
- void consume( xml::Reader & reader_r, const std::string & key_r )
- { _cmap[key_r]( reader_r ); }
-
- void consume( xml::Reader & reader_r )
- { consume( reader_r, reader_r->name().asString() ); }
-
- void consume()
- { consume( _reader ); }
-
- public:
- static void nop( xml::Reader & reader_r )
- { ; }
-
- static void log( xml::Reader & reader_r )
- { DBG << "NOP " << *reader_r << endl; }
-
-
- protected:
- xml::Reader _reader;
- ConsumerMap _cmap;
-};
-
-///////////////////////////////////////////////////////////////////
-
-struct RepomdParser : private BasicParser
-{
- RepomdParser( const InputStream & file_r )
- : BasicParser( file_r )
- {
- reader().foreachNode( ref(*this) );
- }
-
- bool operator()( xml::Reader & reader_r )
- {
- return parse( reader_r );
- }
-
- // READER goes here!
-};
-
-///////////////////////////////////////////////////////////////////
-struct Consume
-{
- struct Entry
- {
- Pathname _location;
- CheckSum _checksum;
- //unused: Date _timestamp;
- //unused: CheckSum _openChecksum;
- };
-
- typedef void (Consume::*Consumer)( xml::Reader & reader_r );
-
- Consume( const InputStream & file_r )
- : _reader( file_r )
- , _consume( &Consume::nop )
- , _centry( NULL )
- {
- _consume.set( "data", &Consume::data );
- _reader.foreachNode( ref(*this) );
- }
-
- bool operator()( xml::Reader & reader_r )
- {
- switch ( reader_r->nodeType() )
- {
- case XML_READER_TYPE_ELEMENT:
- (this->*_consume[reader_r->name().asString()])( reader_r );
- //data( reader_r );
- break;
- default:
- WAR << *_reader << endl;
- break;
- }
- return true;
+ WAR << "Lookup id " << id_r << "failed" << endl;
+ return std::string();
}
- void nop( xml::Reader & reader_r )
- { ; }
-
- void log( xml::Reader & reader_r )
- { DBG << "NOP " << *_reader << endl; }
-
- void data( xml::Reader & reader_r )
+ void logNew( const data::ResObject_Ptr & res_r, ResolvableTraits::KindType kind_r )
{
- MIL << *_reader << endl;
- _result[reader_r->name().asString()] = Entry();
- }
-
-
-
- xml::Reader _reader;
- ExplicitMap<std::string,Consumer> _consume;
- std::map<std::string,Entry> _result;
- Entry * _centry;
-};
-
-std::ostream & operator<<( std::ostream & str, const Consume & obj )
-{
- return str;
-}
-
-std::ostream & operator<<( std::ostream & str, const Consume::Entry & obj )
-{
- return str << "Entry";
-}
-
-void parse( const InputStream & file_r )
-{
- Measure x( file_r.name() );
- try
+ std::string shr( lookup( res_r->shareDataWith ) );
+ if ( ! shr.empty() )
{
- MIL << file_r << endl;
- RepomdParser a( file_r );
- //WAR << a._result << endl;
+ DBG << " SHR: " << shr << endl;
}
- catch ( const Exception & )
+ //DBG << " SUM: " << res_r->summary << endl;
+ if ( 0&&kind_r == ResTraits<Package>::kind )
{
+ data::Package_Ptr p = dynamic_pointer_cast<data::Package>(res_r);
+ DBG << " PKG: " << p << endl;
+ DBG << " LOC: " << p->repositoryLocation << endl;
}
-}
-
-struct Test
-{
- struct Mix
- {
- Mix()
- : a( 0 )
- {}
-
- void seta( int v )
- { a = v; }
-
- void setb( const string & v )
- { b = v; }
-
- int a;
- string b;
- };
-
- Test()
- : a( 0 )
- {}
-
- int a;
- string b;
- Mix c;
-};
-
-std::ostream & operator<<( std::ostream & str, const Test & obj )
-{
- return str << "Test(" << obj.a << '|' << obj.b
- << '|' << obj.c.a << '|' << obj.c.b << ')';
-}
-
-struct Transform
-{
- Transform()
- : outfile( "susedu.xml", std::ios_base::out )
- {}
-
- static const bool indented = !false;
- static const bool shorttags = !true;
- std::fstream outfile;
-
- bool operator()( xml::Reader & reader_r )
- {
- switch ( reader_r->nodeType() )
- {
- case XML_READER_TYPE_ELEMENT:
- process( reader_r, true );
- break;
- case XML_READER_TYPE_END_ELEMENT:
- process( reader_r, false );
- break;
- default:
- //WAR << *reader_r << endl;
- break;
- }
- return true;
+ static unsigned n = 20;
+ if ( 0&&! --n )
+ throw;
}
- struct File
- {
- std::string name;
- std::string type;
-
- bool operator<( const File & rhs ) const
- { return( name < rhs.name ); }
- };
+ public:
- struct Package
- {
- std::string pkgid;
- std::string name;
- std::string epoch;
- std::string ver;
- std::string rel;
- std::string arch;
- std::set<File> files;
- };
-
- shared_ptr<Package> pkg;
-
- void process( xml::Reader & reader_r, bool open_r )
+ virtual data::RecordId consumePackage( const data::RecordId & repository_id, const data::Package_Ptr & res_r )
{
- if ( reader_r->name() == "file" )
- {
- if ( open_r )
- addFile( reader_r );
- }
- else if ( reader_r->name() == "version" )
- {
- if ( open_r )
- addVersion( reader_r );
- }
- else if ( reader_r->name() == "package" )
- {
- if ( open_r )
- startPackage( reader_r );
- else
- endPackage();
- }
- else if ( reader_r->name() == "filelists" )
- {
- DBG << *reader_r << endl;
- if ( open_r )
- {
- DBG << outfile << endl;
- outfile << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
- outfile << "<susedu>" << endl;
- }
- else
- {
- outfile << "</susedu>" << endl;
- outfile.close();
- }
- }
- else
- {
- throw;
- }
+ return newId( res_r, ResTraits<Package>::kind );
}
- void startPackage( xml::Reader & reader_r )
+ virtual data::RecordId consumeSourcePackage( const data::RecordId & repository_id, const data::SrcPackage_Ptr & res_r )
{
- endPackage();
- pkg.reset( new Package );
- pkg->pkgid = reader_r->getAttribute( "pkgid" ).asString();
- pkg->name = reader_r->getAttribute( "name" ).asString();
- pkg->arch = reader_r->getAttribute( "arch" ).asString();
+ return newId( res_r, ResTraits<SrcPackage>::kind );
}
- void addVersion( xml::Reader & reader_r )
+ virtual data::RecordId consumeProduct ( const data::RecordId & repository_id, const data::Product_Ptr & res_r )
{
- pkg->epoch = reader_r->getAttribute( "epoch" ).asString();
- pkg->ver = reader_r->getAttribute( "ver" ).asString();
- pkg->rel = reader_r->getAttribute( "rel" ).asString();
+ return newId( res_r, ResTraits<Product>::kind );
}
- void addFile( xml::Reader & reader_r )
+ virtual data::RecordId consumePatch ( const data::RecordId & repository_id, const data::Patch_Ptr & res_r )
{
- File f;
- f.type = reader_r->getAttribute( "type" ).asString();
- for( reader_r.nextNode();
- reader_r->nodeType() != XML_READER_TYPE_END_ELEMENT;
- reader_r.nextNode() )
- {
- if ( reader_r->nodeType() == XML_READER_TYPE_TEXT )
- {
- f.name = reader_r->value().asString();
- }
- }
- pkg->files.insert( f );
+ return newId( res_r, ResTraits<Patch>::kind );
}
- void endPackage()
+ virtual data::RecordId consumePackageAtom ( const data::RecordId & repository_id, const data::PackageAtom_Ptr & res_r )
{
- if ( pkg )
- {
- writePackage( outfile );
- pkg.reset();
- }
+ return newId( res_r, ResTraits<Atom>::kind );
}
- static std::ostream & putAttr( std::ostream & stream_r,
- const std::string & tag_r,
- const std::string & value_r )
+ virtual data::RecordId consumeMessage ( const data::RecordId & repository_id, const data::Message_Ptr & res_r )
{
- if ( value_r.empty() || tag_r.empty() )
- return stream_r;
- return stream_r
- << str::form( " %s=\"%s\"", tag_r.c_str(), value_r.c_str() );
+ return newId( res_r, ResTraits<Message>::kind );
}
- void writePackage( std::ostream & stream_r )
+ virtual data::RecordId consumeScript ( const data::RecordId & repository_id, const data::Script_Ptr & res_r )
{
- stream_r << " <package";
- putAttr( stream_r, "pkgid", pkg->pkgid );
- putAttr( stream_r, "name", pkg->name );
- putAttr( stream_r, "arch", pkg->arch );
- stream_r << ">\n";
-
- stream_r << " <version";
- putAttr( stream_r, "epoch", pkg->epoch );
- putAttr( stream_r, "ver", pkg->ver );
- putAttr( stream_r, "rel", pkg->rel );
- stream_r << "/>\n";
-
- writePackageFiles2( stream_r );
-
- stream_r << " </package>\n";
+ return newId( res_r, ResTraits<Script>::kind );
}
- void writePackageFiles( std::ostream & stream_r )
+ virtual data::RecordId consumePattern ( const data::RecordId & repository_id, const data::Pattern_Ptr & res_r )
{
- for ( std::set<File>::const_iterator it = pkg->files.begin();
- it != pkg->files.end(); ++it )
- {
- stream_r << " <file";
- putAttr( stream_r, "type", it->type );
- stream_r << ">" << it->name << "</file>\n";
- }
+ return newId( res_r, ResTraits<Pattern>::kind );
}
- struct Fnode
- {
- Fnode( const std::string & name_r )
- : name( name_r )
- , entry( NULL )
- {}
-
- std::string name;
- mutable const File * entry;
- mutable std::set<Fnode> children;
+ virtual data::RecordId consumeChangelog ( const data::RecordId & repository_id, const data::Resolvable_Ptr &, const Changelog & )
+ { return data::RecordId(); }
- const Fnode * add( const std::string & sub_r ) const
- {
- std::set<Fnode>::iterator i = children.find( sub_r );
- if ( i != children.end() )
- return &(*i);
- return &(*(children.insert( Fnode( sub_r ) ).first));
- }
+ virtual data::RecordId consumeFilelist ( const data::RecordId & repository_id, const data::Resolvable_Ptr &, const data::Filenames & )
+ { return data::RecordId(); }
- void dump( std::ostream & stream_r, const std::string & pname, unsigned level ) const
+ void updatePackageLang( const data::RecordId & resolvable_id,
+ const data::Packagebase_Ptr & data_r )
+ {
+ SEC << lookup( resolvable_id ) << endl;
+ INT << " " << data_r->summary.text() << endl;
+ INT << " " << data_r->summary.text( Locale("en") ) << endl;
+ if ( data_r->licenseToConfirm.locales().size() )
{
- std::string tname;
- if ( pname.empty() )
- {
- tname = name;
- }
- else if ( pname == "/" )
- {
- tname = pname+name;
- }
- else
- {
- tname = pname+"/"+name;
- }
-
- if ( children.size() == 1 )
- {
- children.begin()->dump( stream_r, tname, (indented?level:0) );
- return;
- }
-
- std::string tag;
- stream_r << std::string( level, ' ' );
-
- if ( entry )
- {
- tag = (shorttags ? "f" : "file");
- stream_r << "<" << tag;
- putAttr( stream_r, (shorttags ? "t" : "type"), entry->type );
- putAttr( stream_r, (shorttags ? "n" : "name"), tname );
- }
- else
- {
- tag = (shorttags ? "b" : "base");
- stream_r << "<" << tag;
- putAttr( stream_r, (shorttags ? "n" : "name"), tname );
- }
-
- if ( children.empty() )
- {
- stream_r << "/>" << (indented?"\n":"");
- }
- else
- {
- stream_r << ">" << (indented?"\n":"");
- for ( std::set<Fnode>::const_iterator it = children.begin();
- it != children.end(); ++it )
- {
- it->dump( stream_r, "", (indented?level+1:0) );
- }
- stream_r << std::string( level, ' ' ) << "</" << tag << ">" << (indented?"\n":"");
- }
+ INT << " " << data_r->licenseToConfirm.text() << endl;
+ INT << " " << data_r->licenseToConfirm.text( Locale("en") ) << endl;
+ INT << " " << data_r->licenseToConfirm.locales() << endl;
}
-
- bool operator<( const Fnode & rhs ) const
- { return( name < rhs.name ); }
- };
-
- void writePackageFiles2( std::ostream & stream_r )
- {
- Fnode root( "" );
- for ( std::set<File>::const_iterator it = pkg->files.begin();
- it != pkg->files.end(); ++it )
- {
- std::list<std::string> words;
- str::split( it->name, std::back_inserter(words), "/" );
-
- const Fnode * c = &root;
- for ( std::list<std::string>::const_iterator w = words.begin();
- w != words.end(); ++w )
- {
- c = c->add( *w );
- }
- c->entry = &(*it);
- }
- root.dump( stream_r, "/", (indented?3:0) );
- }
-
+ }
};
/******************************************************************
int main( int argc, char * argv[] )
{
INT << "===[START]==========================================" << endl;
- {
- Measure x;
- Pathname repodata( "/Local/PATCHES/repodata" );
- //repodata = "/Local/FACTORY/repodata";
- xml::Reader reader( repodata/"filelists.xml" );
- Transform t;
- reader.foreachNode( ref(t) );
- }
- INT << "===[END]============================================" << endl << endl;
- return 0;
- int s;
- Pathname repodata( "/Local/PATCHES/repodata" );
- //repodata = "/Local/FACTORY/repodata";
- InputStream x ( "/Local/PATCHES/repodata" );
- parse2( repodata/"repomd.xml" );
- //parse2( repodata/"primary.xml" );
+ DummyConsumer dummy;
+ RepoParser parser( data::RecordId(), dummy );
- INT << "===[END]============================================" << endl << endl;
- return 0;
- {
- Measure x;
- for ( int i = 1; i; --i )
- {
- parse( repodata/"repomd.xml" );
- parse( repodata/"primary.xml" );
- parse( repodata/"filelists.xml" );
- parse( repodata/"other.xml" );
- }
- }
- ERR << "done..." << endl;
- cin >> s;
- return 0;
- {
- Measure x;
- for ( int i = 20; i; --i )
- {
- parse( (repodata/"repomd.xml").asString() );
- parse( repodata/"primary.xml" );
- parse( repodata/"filelists.xml" );
- parse( repodata/"other.xml" );
- }
- }
- ERR << "done..." << endl;
- cin >> s;
+ parser.parse( "REPO" );
INT << "===[END]============================================" << endl << endl;
return 0;
#include <zypp/ResObject.h>
#include <zypp/pool/PoolStats.h>
-#include <zypp/SourceFactory.h>
-#include <zypp/source/susetags/SuseTagsImpl.h>
+#include <zypp/Repository.h>
using namespace zypp;
using zypp::debug::Measure;
}
///////////////////////////////////////////////////////////////////
-inline Source_Ref createSource( const Url & url_r, const std::string & alias_r = std::string() )
+inline Repository createSource( const Url & url_r, const std::string & alias_r = std::string() )
{
- Source_Ref ret;
+ Repository ret;
+#if 0
Measure x( "createSource: " + url_r.asString() );
try
{
}
catch ( const Exception & )
{
- return Source_Ref::noSource;
+ return Repository::noSource;
}
x.start( "parseSource: " + url_r.asString() );
{
MIL << "Content " << ret << "{" << endl;
rstats( ret.resolvables() );
MIL << "}" << endl;
-
+#endif
return ret;
}
-inline Source_Ref createSource( const std::string & url_r, const std::string & alias_r = std::string() )
+inline Repository createSource( const std::string & url_r, const std::string & alias_r = std::string() )
{
try
{
}
catch ( const Exception & )
{
- return Source_Ref::noSource;
+ return Repository::noRepository;
}
}
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = @HAVE_DOT@
-CLASS_GRAPH = NO
+CLASS_GRAPH = YES
COLLABORATION_GRAPH = NO
GROUP_GRAPHS = NO
-UML_LOOK = NO
+UML_LOOK = YES
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = NO
INCLUDED_BY_GRAPH = NO
CALL_GRAPH = NO
-GRAPHICAL_HIERARCHY = NO
+GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = NO
DOT_IMAGE_FORMAT = png
DOT_PATH =
%files -f zypp.lang
%defattr(-,root,root)
-%{prefix}/lib/zypp
+#%{prefix}/lib/zypp
%{prefix}/share/zypp
%{_libdir}/libzypp*so.*
%{prefix}/share/applications/package-manager.desktop
-------------------------------------------------------------------
+Mon Jul 16 11:43:33 CEST 2007 - dmacvicar@suse.de
+
+- fix reading of non existant repo
+- r6015
+- first submission to stable
+- version 3.11.8
+
+-------------------------------------------------------------------
+Wed Jul 11 19:14:47 CEST 2007 - jkupec@suse.cz
+
+- make resolvable query complete exceptionless with the database
+- test that packages have some attributes
+- disable progress adaptor for now
+- revision 5977
+- version 3.11.7
+
+-------------------------------------------------------------------
+Wed Jul 11 14:37:02 CEST 2007 - ma@suse.de
+
+- fixed unresolved symbols
+- revision 5972
+- version 3.11.6
+
+-------------------------------------------------------------------
+Wed Jul 11 13:31:39 CEST 2007 - ma@suse.de
+
+- fixed TranslatedText creating unwanted entries.
+- fixed capability processing
+- revision 5964
+- version 3.11.5
+
+-------------------------------------------------------------------
+Tue Jul 10 20:01:18 CEST 2007 - jkupec@suse.cz
+
+- MediaSetAccess::release() added
+- Use attachDesiredMedia in MediaProducts
+- Progress reporting improved
+- revision 5959
+- version 3.11.4
+
+-------------------------------------------------------------------
+Tue Jul 10 14:23:13 CEST 2007 - ma@suse.de
+
+- fixed parsing translated texts.
+- added source packages.
+- revision 5947
+- version 3.11.3
+
+-------------------------------------------------------------------
+Tue Jul 10 13:11:31 CEST 2007 - jkupec@suse.cz
+
+- repo callbacks fixed
+- Fixed YUM parser progress reporting
+- Added CombinedProgressData
+- make RepoImpl::resolvables() load lazy
+- MediaProducts added for scanning products file
+- Implement cache schema versioning and automatic invalidation of
+ cache when schema changes
+- revision 5942
+- version 3.11.2
+
+-------------------------------------------------------------------
+Fri Jul 6 13:51:50 CEST 2007 - ma@suse.de
+
+- Propagate pools repository_iterator to the UI
+- revision 5911
+- version 3.11.1
+
+-------------------------------------------------------------------
+Thu Jul 5 17:02:08 CEST 2007 - ma@suse.de
+
+- Package::location is now returns an OnMediaLocation
+- archivesize() renamed to downloadSize()
+- Allow to iterate all Repositories that contribute
+ Resolvables to the Pool.
+- MediaSetAccess::provideDir added
+- remove useless url check
+- add old-api-style wrapper
+- Add MediaProducts class
+- revision 5892
+- version 3.11.0
+
+-------------------------------------------------------------------
Thu Jul 5 09:31:02 CEST 2007 - schubi@suse.de
- function isInstalledBy/installs
- Version 3.4.0
-------------------------------------------------------------------
+Tue Jul 3 13:07:31 CEST 2007 - jkupec@suse.cz
+
+- removed unused %{prefix}/lib/zypp from %files in spec file
+- revision 5870
+
+-------------------------------------------------------------------
+Tue Jul 3 10:37:37 CEST 2007 - jkupec@suse.cz
+
+- Old API (SourceManager, metadata parsers) dropped in favor of the
+ new refactored ones (RepoManager, RepoParser(s), cache subtree,
+ repo subtree).
+- Some new API improvements.
+- revision 5868
+- version 3.10.0 (bumped minor to 10 to indicate refactoring branch)
+
+-------------------------------------------------------------------
Fri Jun 22 15:28:03 CEST 2007 - schubi@suse.de
- New API calls which provides more information about one
- Evaluate ResolverInfoNeededBy for more information in the error
messages
- Enlarge detail description in the error messages
-- Revision 5807
+- Revision 5807
-------------------------------------------------------------------
Tue Jun 19 13:59:09 CEST 2007 - ma@suse.de
TARGET_LINK_LIBRARIES(CacheQuery zypp )
ADD_TEST(CacheInitializer ${CMAKE_CURRENT_BINARY_DIR}/CacheInitializer ${CMAKE_CURRENT_SOURCE_DIR}/data )
-ADD_TEST(CacheStore ${CMAKE_CURRENT_BINARY_DIR}/CacheStore ${CMAKE_CURRENT_SOURCE_DIR}/data )
+ADD_TEST(CacheStore ${CMAKE_CURRENT_BINARY_DIR}/CacheStore ${CMAKE_SOURCE_DIR}/tests )
# run this test against a YUM repo
ADD_TEST(CacheQuery ${CMAKE_CURRENT_BINARY_DIR}/CacheQuery ${CMAKE_SOURCE_DIR}/tests/repo/yum/data/10.2-updates-subset )
void cacheinit_test()
{
- //unit_test_log::instance().set_log_threshold_level(log_messages);
filesystem::TmpDir tmpdir;
- cache::CacheInitializer initializer(tmpdir.path(), "test.db");
+ {
+ //unit_test_log::instance().set_log_threshold_level(log_messages);
+ cache::CacheInitializer initializer(tmpdir.path(), "test.db");
+
+ sqlite3_connection con( (tmpdir.path() + "test.db").asString().c_str());
+ //con.executenonquery(SOURCES_TABLE_SCHEMA);
+ int count = con.executeint("select count(*) from sqlite_master where type='table';");
+ BOOST_CHECK( initializer.justInitialized() );
+ BOOST_CHECK( !initializer.justReinitialized() );
+ // 14 tables need to be created
+ BOOST_CHECK( count > 0);
+ int version = con.executeint("select version from db_info;");
+ BOOST_CHECK_EQUAL( version, ZYPP_CACHE_SCHEMA_VERSION );
+ }
+
+ // now screw up the versioning and check if schema is rebuilt
+ {
+ sqlite3_connection con( (tmpdir.path() + "test.db").asString().c_str());
+ con.executenonquery("update db_info set version=9999 where 1;");
+ cache::CacheInitializer initializer(tmpdir.path(), "test.db");
+ BOOST_CHECK( !initializer.justInitialized() );
+ BOOST_CHECK( initializer.justReinitialized() );
+
+ }
- sqlite3_connection con( (tmpdir.path() + "test.db").asString().c_str());
- //con.executenonquery(SOURCES_TABLE_SCHEMA);
- int count = con.executeint("select count(*) from sqlite_master where type='table';");
- BOOST_CHECK( initializer.justInitialized() );
- // 14 tables need to be created
- BOOST_CHECK( count > 0);
}
test_suite*
#include "zypp/cache/CacheStore.h"
#include "zypp/RepoInfo.h"
#include "zypp/repo/cached/RepoImpl.h"
+#include "zypp/parser/yum/RepoParser.h"
+#include "zypp/parser/susetags/RepoParser.h"
#include "zypp/Url.h"
#include "zypp/NVRA.h"
#include "zypp/PathInfo.h"
#include "zypp/TmpPath.h"
+#include "zypp/TranslatedText.h"
+#include "zypp/Package.h"
+#include "zypp/Pattern.h"
+#include "zypp/Product.h"
+#include "zypp/Patch.h"
-#include "SimplePackagesParser.h"
+#include "zypp/detail/ImplConnect.h"
using namespace std;
using namespace zypp;
+using namespace zypp::parser;
using namespace zypp::repo;
using namespace zypp::repo::cached;
using namespace boost::unit_test;
+using namespace sqlite3x;
-void cache_write_test(const string &dir)
+/**
+ * \short Asserts a package against a fixed package
+ *
+ * kdelibs3 357-24 i586
+ */
+void check_kdelibs3_package( Package::Ptr p )
{
- data::RecordId repository_id;
- filesystem::TmpDir tmpdir;
+ // check authors and timestamp?
+// =Tim: 1183399094
+// +Aut:
+// The KDE Team <kde@kde.org>
+// -Aut:
+//
+ BOOST_CHECK_EQUAL( p->name(), "kdelibs3");
+ BOOST_CHECK_EQUAL( p->edition(), Edition("3.5.7", "24") );
+ BOOST_CHECK_EQUAL( p->arch(), Arch("i586") );
+ BOOST_CHECK_EQUAL( p->summary(), "KDE Base Libraries" );
+ BOOST_CHECK_EQUAL( p->description().substr(0, 16), "<!-- DT:Rich -->");
+ //BOOST_CHECK_EQUAL( p->packager(), "http://bugs.opensuse.org");
+ //BOOST_CHECK_EQUAL( p->url(), "http://glabels.sourceforge.net/");
+ BOOST_CHECK_EQUAL( p->group(), "System/GUI/KDE");
+ //BOOST_CHECK_EQUAL( p->buildhost(), "dale.suse.de");
+ //BOOST_CHECK_EQUAL( p->vendor(), "SUSE LINUX Products GmbH, Nuernberg, Germany");
+ BOOST_CHECK_EQUAL( p->license(), "BSD License and BSD-like, GNU General Public License (GPL)");
+ BOOST_CHECK_EQUAL( p->location().checksum(), CheckSum("sha1", "05f0647241433d01636785fd282cc824a6527269"));
+ BOOST_CHECK_EQUAL( p->location().filename(), Pathname("./suse/i586/kdelibs3-3.5.7-24.i586.rpm"));
+ BOOST_CHECK_EQUAL( p->size(), 38850584);
+ BOOST_CHECK_EQUAL( p->location().downloadSize(), 16356019);
+}
+
+/**
+ * \short Asserts a pattern against a fixed pattern
+ *
+ * kde-10.3-71.i586.pat
+ */
+void check_kde_pattern( Pattern::Ptr p )
+{
+ BOOST_CHECK_EQUAL( p->name(), "kde");
+ BOOST_CHECK_EQUAL( p->edition(), Edition("10.3", "71") );
+ BOOST_CHECK_EQUAL( p->arch(), Arch("i586") );
+
+// detail::ResImplTraits<ResObject::Impl>::constPtr pipp( detail::ImplConnect::resimpl( p ) );
+// TranslatedText got = pipp->summary();
+//
+ //DBG<< pipp->summary() << endl;
+// for ( set<Locale>::const_iterator it = got.locales().begin();
+// it != got.locales().end();
+// ++it )
+// {
+// cout << *it << " | " << got.text(*it) << endl;
+// }
+
+ BOOST_CHECK_EQUAL( p->summary(), "KDE Desktop Environment" );
+ BOOST_CHECK_EQUAL( p->description().substr(0, 16), "KDE is a powerfu");
+ BOOST_CHECK_EQUAL( p->category(), "Graphical Environments");
+ BOOST_CHECK_EQUAL( p->userVisible(), true);
+ //1520
+}
+
+/**
+ * \short Asserts a product against a fixed product
+ *
+ * openSUSE-factory
+ */
+void check_factory_product( Product::Ptr p )
+{
+ BOOST_CHECK_EQUAL( p->name(), "openSUSE-factory");
+ BOOST_CHECK_EQUAL( p->edition(), Edition("10.3") );
+ BOOST_CHECK_EQUAL( p->arch(), Arch("i686") );
+
+ BOOST_CHECK_EQUAL( p->distributionName(), "SuSE-Linux-STABLE-X86" );
+ BOOST_CHECK_EQUAL( p->distributionEdition(), Edition("10.2.42-factory") );
+ BOOST_CHECK_EQUAL( p->summary(), "openSUSE FACTORY 10.3" );
+ BOOST_CHECK_EQUAL( p->description().substr(0, 16), "NO DESC?");
+// BOOST_CHECK_EQUAL( p->category(), "Graphical Environments");
+// BOOST_CHECK_EQUAL( p->userVisible(), true);
+ //1520
+}
+
+
+/**
+ * \short Asserts a package against a fixed package
+ *
+ * glabels 2.0.4-30.2-0 i586
+ */
+void check_glabels_package( Package::Ptr p )
+{
+ BOOST_CHECK_EQUAL( p->name(), "glabels");
+ BOOST_CHECK_EQUAL( p->edition(), Edition("2.0.4", "30.2", "0") );
+ BOOST_CHECK_EQUAL( p->arch(), Arch("i586") );
+ BOOST_CHECK_EQUAL( p->summary(), "A Label Editing and Printing Tool" );
+ BOOST_CHECK_EQUAL( p->description().substr(0, 20), "Labels is a powerful");
+ BOOST_CHECK_EQUAL( p->packager(), "http://bugs.opensuse.org");
+ BOOST_CHECK_EQUAL( p->url(), "http://glabels.sourceforge.net/");
+ BOOST_CHECK_EQUAL( p->group(), "Productivity/Office/Other");
+ BOOST_CHECK_EQUAL( p->buildhost(), "dale.suse.de");
+ BOOST_CHECK_EQUAL( p->vendor(), "SUSE LINUX Products GmbH, Nuernberg, Germany");
+ BOOST_CHECK_EQUAL( p->license(), "GNU General Public License (GPL)");
+ BOOST_CHECK_EQUAL( p->location().checksum(), CheckSum("sha1", "34adf06a0c4873b9d53b4634beb8bee458b45767"));
+ BOOST_CHECK_EQUAL( p->location().filename(), Pathname("rpm/i586/glabels-2.0.4-30.2.i586.rpm"));
+ BOOST_CHECK_EQUAL( p->size(), 2257356);
+ BOOST_CHECK_EQUAL( p->location().downloadSize(), 983124);
+}
+
+/**
+ * \short assert that tables are clean after removing a repo
+ *
+ * \note the only tables allowed to keep data are normalized
+ * tables like names, files. Those should be cleaned using
+ * a more smart vacuum
+ */
+void check_tables_clean( filesystem::TmpDir tmpdir )
+{
+ cache::CacheStore store(tmpdir.path());
+ data::RecordId repository_id = store.lookupOrAppendRepository("novell.com");
+ store.cleanRepository(repository_id);
+ store.commit();
+
+ sqlite3_connection con((tmpdir.path() + "zypp.db").c_str());
+ int count;
+
+ sqlite3_command tables_cmd( con, "select name from sqlite_master where type='table';");
+ sqlite3_reader reader = tables_cmd.executereader();
+ list<string> tables;
+ while ( reader.read() )
{
- Pathname nvra_list = Pathname(dir) + "package-set.txt.gz";
- list<MiniResolvable> res_list;
+ string tablename = reader.getstring(0);
+ if (
+ (tablename == "sqlite_sequence" ) ||
+ (tablename == "db_info" ) ||
+ (tablename == "types" ) ||
+ (tablename == "names" ) ||
+ (tablename == "file_names" ) ||
+ (tablename == "dir_names" ) ||
+ (tablename == "files" )
+ )
+ continue;
+
+ tables.push_back(tablename);
+ }
+ reader.close();
+
+ for ( list<string>::const_iterator it = tables.begin();
+ it != tables.end();
+ ++it )
+ {
+ MIL << "Checking table " << *it << endl;
+ string query = (string("select count(*) from ") + (*it) +";");
+ sqlite3_command cmd(con, query.c_str());
+ count = cmd.executeint();
+ string msg = (string("there should be no ") + (*it) +" after cleaning");
+ BOOST_CHECK_MESSAGE( count == 0, msg.c_str());
+ }
+}
+
+/**
+ * \short Write a YUM repo to the cache
+ */
+void write_yum_repo( const string &alias,
+ const Pathname &repodir,
+ filesystem::TmpDir tmpdir )
+{
+ data::RecordId repository_id;
+ cache::CacheStore store(tmpdir.path());
+ repository_id = store.lookupOrAppendRepository(alias);
- parse_mini_file( nvra_list, res_list );
+ zypp::debug::Measure repo_write_timer("store resolvables");
+
+ yum::RepoParser parser( repository_id, store);
+ parser.parse(repodir);
+ store.commit();
+}
+
+/**
+ * \short Write a SUSETAGS repo to the cache
+ */
+void write_susetags_repo( const string &alias,
+ const Pathname &repodir,
+ filesystem::TmpDir tmpdir )
+{
+ data::RecordId repository_id;
+ cache::CacheStore store(tmpdir.path());
+ repository_id = store.lookupOrAppendRepository(alias);
+ zypp::debug::Measure repo_write_timer("store resolvables");
+
+ susetags::RepoParser parser( repository_id, store);
+ parser.parse(repodir);
+ store.commit();
+}
+
+/**
+ * \short get resolvables from the cache
+ */
+ResStore get_resolvables( const string &alias,
+ filesystem::TmpDir tmpdir )
+{
+ MIL << "now read resolvables" << endl;
+
+ data::RecordId repository_id;
+ {
cache::CacheStore store(tmpdir.path());
-
- repository_id = store.lookupOrAppendRepository("novell.com");
-
- zypp::debug::Measure cap_parse_timer("store resolvables");
- for ( list<MiniResolvable>::iterator it = res_list.begin(); it != res_list.end(); it++)
+ repository_id = store.lookupOrAppendRepository(alias);
+ }
+ zypp::debug::Measure repo_read_timer("read resolvables");
+ cached::RepoImpl *repositoryImpl = new cached::RepoImpl( cached::RepoOptions( RepoInfo(),
+ tmpdir.path(),
+ repository_id ));
+ return repositoryImpl->resolvables();
+}
+
+/**
+ * \short Test that a yum repo is cached and restored
+ */
+void cache_write_yum_test(const string &dir)
+{
+ data::RecordId repository_id;
+ Pathname repodir = Pathname(dir) + "/repo/yum/data/10.2-updates-subset";
+ filesystem::TmpDir tmpdir;
+ string alias = "novell.com";
+ write_yum_repo( alias, repodir, tmpdir );
+
+ ResStore dbres = get_resolvables( alias, tmpdir);;;
+ //read_resolvables( alias, tmpdir, std::inserter(dbres, dbres.end()));
+ MIL << dbres.size() << " resolvables" << endl;
+ BOOST_CHECK_EQUAL( dbres.size(), 48);
+
+ bool found_glabels_i586 = false;
+ for ( ResStore::const_iterator it = dbres.begin();
+ it != dbres.end();
+ ++it )
+ {
+ if ( isKind<Package>(*it) )
{
- data::RecordId id = store.appendResolvable( repository_id,
- ResTraits<Package>::kind,
- (*it).nvra,
- (*it).deps );
+ Package::Ptr p = asKind<Package>(*it);
+ if ( (p->name() == "glabels") && p->arch() == Arch("i586") )
+ {
+ found_glabels_i586 = true;
+ check_glabels_package(p);
+ }
}
- store.commit();
}
+ BOOST_CHECK_MESSAGE( found_glabels_i586, "Package glabels i586 should be in cache");
+
+ check_tables_clean(tmpdir);
+}
+
+/**
+ * \short Test that a susetags repo is cached and restored
+ */
+void cache_write_susetags_test(const string &dir)
+{
+ data::RecordId repository_id;
+ Pathname repodir = Pathname(dir) + "/repo/susetags/data/stable-x86-subset";
+ filesystem::TmpDir tmpdir;
+ string alias = "novell.com";
+ write_susetags_repo( alias, repodir, tmpdir );
+
+ ResStore dbres = get_resolvables( alias, tmpdir);;
+ //read_resolvables( alias, tmpdir, std::inserter(dbres, dbres.end()));
+ MIL << dbres.size() << " resolvables" << endl;
+
+ // packages and a patterns
+ BOOST_CHECK_EQUAL( dbres.size(), 7);
+ bool found_kdelibs3_i586 = false;
+ bool found_kde_pat = false;
+ bool found_factory_product = false;
+ for ( ResStore::const_iterator it = dbres.begin();
+ it != dbres.end();
+ ++it )
{
- MIL << "now read resolvables" << endl;
-
- cached::RepoImpl *repositoryImpl = new cached::RepoImpl( RepoInfo(), tmpdir.path(), repository_id);
- //RepositoryFactory factory;
- //Repository_Ref repository = factory.createFrom(repositoryImpl);
- repositoryImpl->createResolvables();
- ResStore dbres = repositoryImpl->resolvables();
-
- MIL << dbres.size() << " resolvables" << endl;
+ MIL << *it << endl;
+ if ( isKind<Package>(*it) )
+ {
+ Package::Ptr p = asKind<Package>(*it);
+ if ( (p->name() == "kdelibs3") && p->arch() == Arch("i586") )
+ {
+ BOOST_CHECK_MESSAGE( !found_kdelibs3_i586, "kdelibs3 i586 only once" );
+ found_kdelibs3_i586 = true;
+ check_kdelibs3_package(p);
+ }
+ }
+ if ( isKind<Pattern>(*it) )
+ {
+ Pattern::Ptr p = asKind<Pattern>(*it);
+ if ( (p->name() == "kde") && p->arch() == Arch("i586") )
+ {
+ BOOST_CHECK_MESSAGE( !found_kde_pat, "kde pattern only once" );
+ found_kde_pat = true;
+ check_kde_pattern(p);
+ }
+ }
+ if ( isKind<Product>(*it) )
+ {
+ Product::Ptr p = asKind<Product>(*it);
+ if ( (p->name() == "openSUSE-factory") )
+ {
+ BOOST_CHECK_MESSAGE( !found_factory_product, "factory product only once" );
+ found_factory_product = true;
+ check_factory_product(p);
+ }
+ }
}
+ BOOST_CHECK_MESSAGE( found_kdelibs3_i586, "Package kdelibs3 i586 should be in cache");
+ BOOST_CHECK_MESSAGE( found_kde_pat, "Pattern kde i586 should be in cache");
+ BOOST_CHECK_MESSAGE( found_factory_product, "Product factory i586 should be in cache");
+ check_tables_clean(tmpdir);
}
test_suite*
if (argc < 2)
{
datadir = TESTS_SRC_DIR;
- datadir = (Pathname(datadir) + "/cache/data").asString();
cout << "CacheStore_test:"
" path to directory with test data required as parameter. Using " << datadir << endl;
//return (test_suite *)0;
test_suite* test= BOOST_TEST_SUITE("CacheStore");
std::string const params[] = { datadir };
- test->add(BOOST_PARAM_TEST_CASE(&cache_write_test,
+ test->add(BOOST_PARAM_TEST_CASE(&cache_write_yum_test,
+ (std::string const*)params, params+1));
+ test->add(BOOST_PARAM_TEST_CASE(&cache_write_susetags_test,
(std::string const*)params, params+1));
+ //test->add(BOOST_PARAM_TEST_CASE(&cache_write_test2,
+ // (std::string const*)params, params+1));
return test;
}
-ADD_SUBDIRECTORY( yum )
\ No newline at end of file
+ADD_SUBDIRECTORY( yum )
+ADD_SUBDIRECTORY( susetags )
\ No newline at end of file
--- /dev/null
+ADD_EXECUTABLE( Downloader Downloader_test.cc )
+TARGET_LINK_LIBRARIES( Downloader zypp boost_unit_test_framework )
+
+ADD_TEST(Downloader ${CMAKE_CURRENT_BINARY_DIR}/Downloader ${CMAKE_CURRENT_SOURCE_DIR}/data )
\ No newline at end of file
--- /dev/null
+#include <stdio.h>
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include <list>
+#include <boost/test/unit_test.hpp>
+#include <boost/test/parameterized_test.hpp>
+#include <boost/test/unit_test_log.hpp>
+
+#include "zypp/Url.h"
+#include "zypp/PathInfo.h"
+#include "zypp/TmpPath.h"
+#include "zypp/repo/susetags/Downloader.h"
+
+
+using std::cout;
+using std::endl;
+using std::string;
+using namespace zypp;
+using namespace boost::unit_test;
+
+using namespace zypp::repo;
+
+void susetags_download_test(const string &dir)
+{
+ Pathname p = dir + "/stable-x86-subset";
+ Url url("dir:" + p.asString());
+ susetags::Downloader downloader(url, "/");
+ filesystem::TmpDir tmp;
+
+ Pathname localdir(tmp.path());
+
+ downloader.download(localdir);
+
+ const char* files[] =
+ {
+ "/suse",
+ "/suse/setup",
+ "/suse/setup/descr",
+ "/suse/setup/descr/kde-10.3-71.i586.pat",
+ "/suse/setup/descr/packages",
+ "/suse/setup/descr/packages.DU",
+ "/suse/setup/descr/packages.en",
+ "/suse/setup/descr/packages.es",
+ "/suse/setup/descr/patterns",
+ "/content",
+ "/gpg-pubkey-7e2e3b05-44748aba.asc",
+ "/media.1",
+// "/media.1/products.asc",
+// "/media.1/products.key",
+ "/media.1/media",
+// "/media.1/products",
+// "/media.1/info.txt",
+// "/media.1/license.zip",
+ "/gpg-pubkey-a1912208-446a0899.asc",
+ "/gpg-pubkey-307e3d54-44201d5d.asc",
+ "/gpg-pubkey-9c800aca-40d8063e.asc",
+ "/content.asc",
+ "/content.key",
+ "/gpg-pubkey-3d25d3d9-36e12d04.asc",
+ "/gpg-pubkey-0dfb3188-41ed929b.asc",
+ NULL
+ };
+
+ int i=0;
+ while ( files[i] != NULL )
+ {
+ BOOST_CHECK_MESSAGE( PathInfo(localdir + files[i] ).isExist(), string(files[i]).c_str() );
+ i++;
+ }
+
+}
+
+test_suite*
+init_unit_test_suite( int argc, char *argv[] )
+{
+ string datadir;
+ if (argc < 2)
+ {
+ datadir = TESTS_SRC_DIR;
+ datadir = (Pathname(datadir) + "/repo/susetags/data").asString();
+ cout << "SUSETags Downloader_test:"
+ " path to directory with test data required as parameter. Using " << datadir << endl;
+ //return (test_suite *)0;
+
+ }
+ else
+ {
+ datadir = argv[1];
+ }
+
+ test_suite* test= BOOST_TEST_SUITE("SUSETags Downloader");
+
+ std::string const params[] = { datadir };
+ test->add(BOOST_PARAM_TEST_CASE(&susetags_download_test,
+ (std::string const*)params, params+1));
+ return test;
+}
+
+// vim: set ts=2 sts=2 sw=2 ai et:
--- /dev/null
+PRODUCT openSUSE-factory
+VERSION 10.3
+DISTPRODUCT SuSE-Linux-STABLE-X86
+DISTVERSION 10.2.42-factory
+VENDOR SUSE LINUX Products GmbH, Nuernberg, Germany
+RELNOTESURL http://www.suse.com/relnotes/i386/openSUSE/FACTORY/release-notes.rpm
+ARCH.x86_64 x86_64 i686 i586 i486 i386 noarch
+ARCH.i686 i686 i586 i486 i386 noarch
+ARCH.i586 i586 i486 i386 noarch
+ARCH.i486 i486 i386 noarch
+ARCH.i386 i386 noarch
+DEFAULTBASE i586
+REQUIRES openSUSE-release = 10.3 pattern:basesystem
+PROVIDES product:openSUSE = 10.2.42
+OBSOLETES product:SUSE_LINUX product:openSUSE <= 10.2
+LINGUAS cs da de en en_GB es fi fr hu it ja km nl nb pl pt_BR zh_CN zh_TW
+SHORTLABEL FACTORY
+LABEL openSUSE FACTORY 10.3
+LABEL.de openSUSE FACTORY 10.3
+DESCRDIR suse/setup/descr
+DATADIR suse
+FLAGS update
+LANGUAGE en_US
+META SHA1 c37f4ba4225650844363711710c3824a58c901dd kde-10.3-71.i586.pat
+META SHA1 80f9bb1f9e95ebcebfd9b22f338f779e204cd50b packages
+META SHA1 9c341d93124860f03b001681513ca07b4d0ca873 packages.DU
+META SHA1 a48fa507afccbce76b549a07394e41d9813e6b01 packages.en
+META SHA1 765900f5513ce6bf496d5006bdff45f805e61997 packages.es
+META SHA1 fbb6a2d6976c37c9a6beb52ca35f7594ae3eff1e patterns
+KEY SHA1 c0354069c10819674da8706822e1d4bd0c1797e9 gpg-pubkey-0dfb3188-41ed929b.asc
+KEY SHA1 2e38e503c436c5d002bdc31755c82188044d9d21 gpg-pubkey-307e3d54-44201d5d.asc
+KEY SHA1 7025932e6866932f489421990075f3ed312023ea gpg-pubkey-3d25d3d9-36e12d04.asc
+KEY SHA1 fd6146cac8c1473c5b52548936de773d5bbd5610 gpg-pubkey-7e2e3b05-44748aba.asc
+KEY SHA1 cd7adceba1fe5d7ba27b5749718743192d82f802 gpg-pubkey-9c800aca-40d8063e.asc
+KEY SHA1 7535d79e31ef7b4232e5593bb49d9142978b2e95 gpg-pubkey-a1912208-446a0899.asc
+
--- /dev/null
+-----BEGIN PGP MESSAGE-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+owGFVb1vW1UUD41opScxFEaW+wfU9v3+iIrQS+w4FsYufnZoBhTdzyQk/qjfM0k6
+IgbEVLGA1AEkVhAd6MjC1pEJBmBgQ2Jkh/vsmNotqJJ1n3zP+f3OOb/f0XsPXtnc
+uHbz4Z8/PP71kdh/6ZvrD8wNOx4VflTsfnbvyZ1etz7Y6YPxxI+yQdaoBG2L8fQy
+2W/0sla3AxCskqTeyvrLzGwWs9ono9lFJeun2+1G5a7k84wVCK5SvELVqXd7oKQH
+7VZncBfcmY7dzBY5aA7N3i3QmfnpyPjp0S3Q9NOhHl0mvUa70+03skGvDY6LYrJV
+q52fn1fzWe6rdjysTf3ZaFz4vHZCJK8tu6/tpjv9bu+gDHud+8o8pzqdDJO0t7NX
+vZD8kFNw9TjhkoMTVh60PCITGI311B4vshfxFyWxF8Tp/4fIM7f1xm46aPe30yhU
+SRlVeGfQ6jWyp/ZcDQbemBsDJrooonZbJt7ll3nhh0n0ab9Vj5jJQuStJXaBKZ1J
+uttZt93orySVCYcLc57D3V4AkxhuDtIM2Bw4DZwHfhR/h81t4HMQTkCYguMZOCnA
++xqcDsHoDIwMmJyBSXG43QP3jw93OuXZfzfJ9rq9fjvdbrTBlWPJ4t+/Na+uF+s3
+j1Vjwf8Ox2F3evVWD5TbUct9MZvUnM/tNKmn/XQZSHbbaTMDs4nThY+U5SzNRjnA
+IEvebvRTkO2lCFgiAjWaYsw4g5JSwolASCBoicRUM2kVRM4BcOp8paxfEWi+BdVo
+xgqRhEEZg4LyinljvQlOGYwDITIIoTyG1DoGDYgm2lN95PMVsLKEIqcIwnFzYIDE
+QIi4RAwRq6Ew1EGrpSBPwdX6YAWvqQyaQaGDtbG24IZRFYFEUV8SS0Q8NxCt4P1o
+BS84UxAGVtaLiYEqHnuF3LgQKAsSMs+RUmIVv9p/MIZr7LgSPApqlebGG4atJiwI
+pqj2xIeAPFhucJ681Ti4cgASRiFXFkGJFBfUxUkhlxh75KiJkyOhhFcAHE2OKpOZ
+OfWXFeiCIUjKCkXeKaxMVef2KSf2RHoGiY12WuYgxMZZggRjVuIIg5Q65TBa4yRQ
+eOIYrVCKo+XMrXMKiJki2McXBI/PQKWiOIoCoWCBeBfNg5h4vc7pMHPEqQrhHmEH
+6TpncBxRbrWVFlFBLIuisUhMuPNCxGaMcYwjuMYpfBzPQBb7FFRqo9c5rRPaxf3T
+KHjmhNFYGCaoEkgKSpDCTuLoKF7jVFZCqK2uUOgk5MQ/MzsjkUp5gnyI24ijDCyK
+YQxVTiGKlZAGx8Vf49RIIYxh9IhyDaVSc87k4zc3X94ov0XLj9TNawefb3zx3gff
+vpoWf8ifPvr+3qd/71188suXH248vP548z76+rvXf//50Y+v/Xb7xl9nXz35Bw==
+=iYSm
+-----END PGP MESSAGE-----
--- /dev/null
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+mQGiBEYjZk4RBACjIOtNaPzvKlC32b8R5TDRB0/FQ0tsMtt5dLwuq2ZYlEbT1YLF
+110vZEl5IQAq5ldvD7MdR/6fqdXTdxBeYzZjeIEYbHzg3rN/N/+MkcG4W8IK1H6e
+DAbL05HlQ1ueTp0mjgoGLYKt1igQe8h5uA6gEE7dv0tG0NJx2w5Gs2GpmwCgiRiu
+s2ev221Pa65IpR1gsYuXLOEEAKJ1Bvjm+BfHJirqoH7iPq5HlABwn+s9sUmf6bjC
+kfar/ySAsL0VUhHNCIoHUEZd2imA2ZA0kTBxB+BIX/HMRZzxPZEwYI8Q0UYsTVb/
+gnQt+mWaZs1/2teWR0wnUp+eO5MpOAO9QjFJTdIz0GegsfSOPCo55CUtktr3tJUK
+fZ3gA/9mZe+b1Evi1/Us+klnERRKR2jjWXxwuPN6UivJbfXIZjuVUNclAhEqstzp
+fnWJ3LhPxj0zJvhp/MnqSTaI6DQbr0f+JvwP+5k/4gbnqm+xxOocyhiVT45zOPAy
+UYuG4t0m+9G7Vx6LC9tMukbdfHaRym42yC2s04GW2isKfta1ZbQsWllwcCBUZXN0
+IEtleSBQYWlyIDx6eXBwLWRldmVsQG9wZW5zdXNlLm9yZz6IYAQTEQIAIAUCRiNm
+TgIbIwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEJvswrXdsDdWSVAAnjkR2lao
+hb2Q4WnxamdHYWSf8ULKAJ4jjfZsFq0vmgPsO/YHaKTJN5sAL7kBDQRGI2ZREAQA
+toB5TGT9K7NCv5D5dQw7jVHngnxp3NGTtAhwirYphBWaF2be3UJVTLbUFW14eMnr
+VW9PKj/HNVLhQu0C6CaXtXy5LahIls+mFlSKwbiP74cFlNYcj69tzCnaFKgElQPH
+cMOc31EgjySYcUIys421MxI++sugW+yHr5ByIsL6vfcAAwUEAILSwmLtD+Pwkues
+73DPPyWIM3MA0exO7QmZeFwnbpiZYuZQ3GiPGrbeZVqHWB72dhW8+5ugR9CVQSsL
+HC5wHMIQFU8RsiL06gZdIaJNgAr7ajhtUybP0WPVpXkzm5+VB8Che9m0Z0t2tK8Y
+0KVapBcr3YDgx89F9VA0yny6q3WiiEkEGBECAAkFAkYjZlECGwwACgkQm+zCtd2w
+N1apuACfUR+Daoo3N1fxxDa3A3t4OkAfpQgAn1UEvpQp+/4DnzSbEvwzLeoek3dz
+=5nY9
+-----END PGP PUBLIC KEY BLOCK-----
--- /dev/null
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v2.0.4-svn0 (GNU/Linux)
+
+mQGiBEHtkpsRBACRHiXh3olS++6/Mp9N7ByGMmjaaE+Y8cJQLUPG1myrbW5aogIP
+0WenayhGbbgOHNWgd5dQ8KQpYYFoQuUHjFYzj5MvgrdOENOvD7ZNJ6+EmbkNh5cV
+zUYfNG9jdiGweZkyA1sh8DYS0JiUmQ4CzaBD/DotB/dCmDcyuNQFiw4qKwCglQah
+ATyueBRsOiXl0NIs1uB6dkkD/1A2YmQ6te1q38a1J+a8os6bDlMZhVnkZdhJdw6x
+eBwUb9XS0n7hyt/AKCcBnrDEUQJuhBMNgzctJvbuMv27yRMANAXZDQkp0ip/yHLJ
+PhUdSNTTRHOL9bV3t+JuZ9xmuclprwyrrJYUkEESXNc0tkuczHBP2c/RqA3OxYHt
+hrHLA/9Pqe2gEleeo8l26u/uFXs2dtwjh8EZmdhHoqGcOlpYR4DyAg2D+jYfh3RI
+oPzIwRlHVUR1ii5h8iPi98BVuEvukwfbbQ1K22Jwzxt6w3ihCXBKWKbeC3ElIMfA
+hVMchLFUbTAw+yodO/u3NHxKQ34+ginid9dVyxV5T0gpDEEHObQrT3BlbiBFbnRl
+cnByaXNlIFNlcnZlciA8c3VwcG9ydEBub3ZlbGwuY29tPoheBBMRAgAeBQJB7ZKb
+AhsDBgsJCAcDAgMVAgMDFgIBAh4BAheAAAoJEHPSXWMN+zGID4oAoJPTGZbZApW+
+tuU422mHYGwoqgjrAJ9fhzRhRbV3YsOxKUomNeuIfmWGXA==
+=Qv5+
+-----END PGP PUBLIC KEY BLOCK-----
--- /dev/null
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v2.0.4-svn0 (GNU/Linux)
+
+mIsERCAdXQEEAL7MrBTz+3SBWpCm2ae2yaDqV3ezQcs2JlvqidJVhsZqQe9/jkxi
+KTEQW5+TXF/+BlQSiebunRI7oo3+9U8GyRCgs1sf+yRQWMLzZqRaarzRhw9w+Ihl
+edtqYl6/U2JZCb8Adp6d7RzlRliJdJ/VtsfXj2ef7Dwu7elOVSsmaBdtAAYptChT
+dVNFIFBhY2thZ2UgU2lnbmluZyBLZXkgPGJ1aWxkQHN1c2UuZGU+iLgEEwECACIF
+AkQgHV0CGwMFCQQ9AoAECwcDAgMVAgMDFgIBAh4BAheAAAoJEOOlw2Awfj1UjUIE
+AIf3SLlrfj2RsCDjyYThXen+A/WTYDPbY+NYmmVvFQilHNQY9ZrJ5cNohRQu6hA+
+Sccrf11Uy24tTHWSTzuG9VzFeeIAcIU02XHar0w3QbvTk6IqeG+OZlfOGJj1sdx4
+JKwpwk9mSdrq2ELhrkPZiVWS7RmRkPr2klwYgKGWbmOJ
+=ZmDA
+-----END PGP PUBLIC KEY BLOCK-----
--- /dev/null
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v2.0.4-svn0 (GNU/Linux)
+
+mQENAzbhLQQAAAEIAKAkXHe0lWRBXLpn38hMHy03F0I4Sszmoc8aaKJrhfhyMlOA
+BqvklPLE2f9UrI4Xc860gH79ZREwAgPt0pi6+SleNFLNcNFAuuHMLQOOsaMFatbz
+JR9i4m/lf6q929YROu5zB48rBAlcfTm+IBbijaEdnqpwGib45wE/Cfy6FAttBHQh
+1Kp+r/jPbf1mYAvljUfHKuvbg8t2EIQz/5yGp+n5trn9pElfQO2cRBq8LFpf1l+U
+P7EKjFmlOq+Gs/fF98/dP3DfniSd78LQPq5vp8RL8nr/o2i7jkAQ33m4f1wOBWd+
+cZovrKXYlXiR+Bf7m2hpZo+/sAzhd7LmAD0l09kABRG0JVN1U0UgU2VjdXJpdHkg
+VGVhbSA8c2VjdXJpdHlAc3VzZS5kZT6JARUDBRA24S1H5Fiyh7HKPEUBAVcOB/9b
+yHYji1/+4Xc2GhvXK0FSJN0MGgeXgW47yxDL7gmR4mNgjlIOUHZj0PEpVjWepOJ7
+tQS3L9oP6cpj1Fj/XxuLbkp5VCQ61hpt54coQAvYrnT9rtWEGN+xmwejT1WmYmDJ
+xG+EGBXKr+XP69oIUl1E2JO3rXeklulgjqRKos4cdXKgyjWZ7CP9V9daRXDtje63
+Om8gwSdU/nCvhdRIWp/Vwbf7Ia8iZr9OJ5YuQl0DBG4qmGDDrvImgPAFkYFzwlqo
+choXFQ9y0YVCV41DnR+GYhwl2qBd81T8aXhihEGPIgaw3g8gd8B5o6mPVgl+nJqI
+BkEYGBusiag2pS6qwznZiQEVAwUQNuEtBHey5gA9JdPZAQFtOAf+KVh939b0J94u
+v/kpg4xs1LthlhquhbHcKNoVTNspugiC3qMPyvSX4XcBr2PC0cVkS4Z9PY9iCfT+
+x9WM96g39dAF+le2CCx7XISk9XXJ4ApEy5g4AuK7NYgAJd39PPbERgWnxjxir9g0
+Ix30dS30bW39D+3NPU5Ho9TD/B7UDFvYT5AWHl3MGwo3a1RhTs6sfgL7yQ3U+mvq
+MkTExZb5mfN1FeaYKMopoI4VpzNVeGxQWIz67VjJHVyUlF20ekOz4kWVgsxkc8G2
+saqZd6yv2EwqYTi8BDAduweP33KrQc4KDDommQNDOXxaKOeCoESIdM4p7Esdjq1o
+L0oixF12CohGBBARAgAGBQI7HmHDAAoJEJ5A4xAACqukTlQAoI4QzP9yjPohY7OU
+F7J3eKBTzp25AJ42BmtSd3pvm5ldmognWF3Trhp+GYkAlQMFEDe3O8IWkDf+zvyS
+FQEBAfkD/3GG5UgJj18UhYmh1gfjIlDcPAeqMwSytEHDENmHC+vlZQ/p0mT9tPiW
+tp34io54mwr+bLPN8l6B5GJNkbGvH6M+mO7R8Lj4nHL6pyAv3PQr83WyLHcaX7It
+Klj371/4yzKV6qpz43SGRK4MacLo2rNZ/dNej7lwPCtzCcFYwqkiiEYEEBECAAYF
+AjoaQqQACgkQx1KqMrDf94ArewCfWnTUDG5gNYkmHG4bYL8fQcizyA4An2eVo/n+
+3J2KRWSOhpAMsnMxtPbB
+=Ay23
+-----END PGP PUBLIC KEY BLOCK-----
--- /dev/null
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v2.0.4-svn0 (GNU/Linux)
+
+mQGiBER0iroRBADfqUeJmPCXqPJFnf3CVKy40dL1F+gfvP+JHN7/uu4c9+oCYjI1
+uAE8iGTm/Twb/Zzbs4dt0iWjhNFXbRi42rMww4d/8QcPYZ21WSehh+fv8nCjt2sw
+LeC87ar2SR8OTpJBK0fQlcd4e6H5GMntfI6SYEUOPd8m/eQ+4+1AxpUUpwCgswaF
+13fePZGI//pDn5tGjbvmaP8D/R3qum/I+oDS8lbFeeDS10GkEkwTYec13gdfsq6I
+yzIj7VBsC+rGfbipv+VGR61Q4d19pOHKLDekr9OG+3G4ZcYM4NQvQZR+QIlp3xWu
+nBmYD1LRkHLVj+Z4DGQhjjOffkPSuacKPymMaZ/aRiLgTIAo97W2YPhutscXrLSG
+2Y+BA/4jsyaDb7kbW4wc8RtPIcuFEheVqgBeRakP9Uj47kBMBEpPtI/mIdY5liKk
+ztKnuQG6ROYLNV/PW0ZbE1uT64C710weh4cB3PnZLV5P10deDLBjHk8MJQGCTSDD
+JYvhutUzQfshAU6j2kErGvKdZxWGezab34vFyMP2oLGqswPAJrRQTm92ZWxsIFBy
+b3ZvIEJ1aWxkIChDb250YWN0IHNlY3VyaXR5QG5vdmVsbC5jb20pIDxub3ZlbGwt
+cHJvdm8tYnVpbGRAbm92ZWxsLmNvbT6IZgQTEQIAJgUCRHSKugIbAwUJA8JnAAYL
+CQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEBTCi8l+LjsFWEoAn13x+5ObqkW08gYF
+YNDlcGPjQuGPAJ9kAQbVUvvh1u9mBgu91cQ9W/TkHYhGBBMRAgAGBQJEexD/AAoJ
+EKhO2uicgArKFLwAn0B+g2mJ5n8LrBziTQ5SjnSPyDBXAJwJoYTta5Sfw/3vVGpU
+fJAKVDoB9w==
+=tJSz
+-----END PGP PUBLIC KEY BLOCK-----
--- /dev/null
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v2.0.4-svn0 (GNU/Linux)
+
+mQGiBDnu9IERBACT8Y35+2vv4MGVKiLEMOl9GdST6MCkYS3yEKeueNWc+z/0Kvff
+4JctBsgs47tjmiI9sl0eHjm3gTR8rItXMN6sJEUHWzDP+Y0PFPboMvKx0FXl/A0d
+M+HFrruCgBlWt6FA+okRySQiliuI5phwqkXefl9AhkwR8xocQSVCFxcwvwCglVcO
+QliHu8jwRQHxlRE0tkwQQI0D+wfQwKdvhDplxHJ5nf7U8c/yE/vdvpN6lF0tmFrK
+XBUX+K7u4ifrZlQvj/81M4INjtXreqDiJtr99Rs6xa0ScZqITuZC4CWxJa9GynBE
+D3+D2t1V/f8l0smsuYoFOF7Ib49IkTdbtwAThlZp8bEhELBeGaPdNCcmfZ66rKUd
+G5sRA/9ovnc1krSQF2+sqB9/o7w5/q2qiyzwOSTnkjtBUVKn4zLUOf6aeBAoV6NM
+CC3Kj9aZHfA+ND0ehPaVGJgjaVNFhPi4x0e7BULdvgOoAqajLfvkURHAeSsxXIoE
+myW/xC1sBbDkDUIBSx5oej73XCZgnj/inphRqGpsb+1nKFvF+rQoU3VTRSBQYWNr
+YWdlIFNpZ25pbmcgS2V5IDxidWlsZEBzdXNlLmRlPohiBBMRAgAiBQJA2AY+AhsD
+BQkObd+9BAsHAwIDFQIDAxYCAQIeAQIXgAAKCRCoTtronIAKypCfAJ9RuZ6ZSV7Q
+W4pTgTIxQ+ABPp0sIwCffG9bCNnrETPlgOn+dGEkAWegKL+IRgQQEQIABgUCOnBe
+UgAKCRCeQOMQAAqrpNzOAKCL512FZvv4VZx94TpbA9lxyoAejACeOO1HIbActAev
+k5MUBhNeLZa/qM2JARUDBRA6cGBvd7LmAD0l09kBATWnB/9An5vfiUUE1VQnt+T/
+EYklES3tXXaJJp9pHMa4fzFa8jPVtv5UBHGee3XoUNDVwM2OgSEISZxbzdXGnqIl
+cT08TzBUD9i579uifklLsnr35SJDZ6ram51/CWOnnaVhUzneOA9gTPSr+/fT3WeV
+nwJiQCQ30kNLWVXWATMnsnT486eAOlT6UNBPYQLpUprF5Yryk23pQUPAgJENDEqe
+U6iIO9Ot1ZPtB0lniw+/xCi13D360o1tZDYOp0hHHJN3D3EN8C1yPqZd5CvvznYv
+B6bWBIpWcRgdn2DUVMmpU661jwqGlRz1F84JG/xe4jGuzgpJt9IXSzyohEJB6XG5
++D0BuQINBDnu9JIQCACEkdBN6Mxf5WvqDWkcMRy6wnrd9DYJ8UUTmIT2iQf07tRU
+KJJ9v0JXfx2Z4d08IQSMNRaq4VgSe+PdYgIy0fbj23Via5/gO7fJEpD2hd2f+pMn
+OWvH2rOOIbeYfuhzAc6BQjAKtmgR0ERUTafTM9Wb6F13CNZZNZfDqnFDP6L12w3z
+3F7FFXkz07Rs3AIto1ZfYZd4sCSpMr/0S5nLrHbIvGLp271hhQBeRmmoGEKO2JRe
+lGgUJ2CUzOdtwDIKT0LbCpvaP8PVnYF5IFoYJIWRHqlEt5ucTXstZy7vYjL6vTP4
+l5xs+LIOkNmPhqmfsgLzVo0UaLt80hOwc4NvDCOLAAMGB/9g+9V3ORzw4LvO1pwR
+YJqfDKUq/EJ0rNMMD4N8RLpZRhKHKJUm9nNHLbksnlZwrbSTM5LpC/U6sheLP+l0
+bLVoq0lmsCcUSyh+mY6PxWirLIWCn/IAZAGnXb6Zd6TtIJlGG6pqUN8QxGJYQnon
+l0uTJKHJENbI9sWHQdcTtBMc34gorHFCo1Bcvpnc1LFLrWn7mfoGx6INQjf3HGQp
+MXAWuSBQhzkazY6vaWFpa8bBJ+gKbBuySWzNm3rFtT5HRKMWpO+M9bHp4d+puY0L
+1YwN1OMatcMMpcWnZpiWiR83oi32+xtWUY2U7Ae38mMag8zFbpeqPQUsDv9V7CAJ
+1dbriEwEGBECAAwFAkDYBnoFCQ5t3+gACgkQqE7a6JyACspnpgCfRbYwxT3iq+9l
+/PgNTUNTZOlof2oAn25y0eGi0371jap9kOV6uq71sUuO
+=pJli
+-----END PGP PUBLIC KEY BLOCK-----
--- /dev/null
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v2.0.4-svn0 (GNU/Linux)
+
+mQILBERqCJkBEACdqhZWdAbUHLIumXMEgv+GFjr1ZzVHgynnFOzztU/8sxZNa9cm
+YV4HZpVfjMr7fos3ArzyiPPt/336cf7w9p79/ZS4rHSNPDMlPCtXYvFxUbvU0/GY
+q4jwcBsrJ0xaJ9CP5bWyAgVKOb7Y6k0ktaLjRR+tDfMsHA4H0ClMoRr6ATw8NL0e
+VCfAHuzqCKvX1If8ng+wTivtAhKvz/WwQiELNELmPfc5tZHOw8NgP/r0Pze18Hn2
+dlAHu0WpC7uoR00vscsMIJiJJPcsxbL1F1eADKnk+wEy8Go+EJeJ5i0WoFbqD52q
+Lv/C/oY6NVtVY0MBwtn+oQNSnQ4JBsB/Akdt53LAi0ZtNQxMyUW+76R8FCOmVCV8
+WGiF5CPRP0yvG80AMBjBjKjHb/v8ov5MnIyFimzAHS1gQcUNxTEYA/5eFwoYcGcK
+weGq9FUjPTzLQAgvp7XmOzHpSAfJ7qysxFTepNsSZZhgizJyInrdQldr+GYcUNqB
+krD9MWmFop975OxhCTEnNv/HcE79r8WD26HzDFYxTiTJbr0pU/ivBzo+rjq+YG2V
+stJk+udVYmZTnC4LmXus8JiNuqBXbxNscwCBpcJ8YcfCV6uh+7E0XfXZsgVUFLp1
+NF+ylYRGTycOlWoZODrnJevZW7N9O3bWRx/G2P4bJD07LsDLe4i5hymf5QAGKbRQ
+Tm92ZWxsIFByb3ZvIEJ1aWxkIChDb250YWN0IHNlY3VyaXR5QG5vdmVsbC5jb20p
+IDxub3ZlbGwtcHJvdm8tYnVpbGRAbm92ZWxsLmNvbT6JAjMEEwECAB0FAkRqCJkG
+CwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRBHijLooZEiCKSFD/93vZHCAMLEfksU
+KnvXl08bv1rfuamuyJnE3ANRE5RDyypriHMCnkVxazvQ2WI4W4UEjluL9+SzZwtV
+ZvKVoAr31614nSyWwv2YnJTHfjMG+xRlkolZMnuIiB9PcCBo9+GPU0ABuzo4pEJW
+NIRoSS1NFbAZBhtUnY0cN+trM5QObLl7xXTavLyGk//blkk57fov7GXsQJlZUig0
+l2yt5XNyGpLUnTMDumHh8b389quF+0+ZfdwOy7A768xjipAZiTvIujBrEv51wrxh
+0HBT0VGA0MhD9t0B+Ce4BM9P/iVMO00naaOp6PqMfPPKxQQqer8qy1i6UWBx95SY
+mKZBIvOm2d9PezDxkckCu61r6krx1iKnT1wdprCAkIYwALK118SpbxuyGW0bhRHc
+wsc/akzWH72fS0Xu49mvL4k4A2U9asdeQid3dMgbtm5mSWof0yiU/G4YNn0yeXoY
+oG1VbCAqQbFX1Rvd6GITJVqI+ekW/uMA9BP78dF8wBeG0+QmpQnSf+eOsxB/RT8o
+Kb4hHY+29MUlg+i9ceVt7hoKr03J/uIG5TXFXRYLaI0iAFVlKfWxpqDfS2XA4+dD
+VYt+5RDgBcnxDaTB4FE9GqcYScNfe7+NFtL0p0wOPftbmgZzGjucTmrD8mDUNdqA
+xGK7vlk4GATSfOQlq7G6LXW6RYnInohGBBMRAgAGBQJEazMlAAoJEKhO2uicgArK
+2vMAn0TbVDESEVKVuFZStrfIzOvJQrR9AJsH733Ju1kE99GFrdfCeGqpckmNhg==
+=E+qN
+-----END PGP PUBLIC KEY BLOCK-----
--- /dev/null
+info.txt
+license.zip
+media
+products
+products.asc
+products.key
--- /dev/null
+
+ openSUSE FACTORY 10.3-factory
+
+ Attention! You are accessing our BETA Distribution. If you install
+ any package, note that we can NOT GIVE ANY SUPPORT for your system -
+ no matter if you update from a previous system or do a complete
+ new installation.
+
+ Use this BETA distribution at your own risk! We recommend it for
+ testing, porting and evaluation purposes but not for any critical
+ production systems.
+
+ If you are curious and would like to help us to find the bugs, you're
+ very welcome. Please enter bug reports following the instructions
+ given at http://bugs.opensuse.org .
+ If you want to talk about this distribution with others, you can
+ discuss on the mailing list opensuse-factory@opensuse.org.
+
+ Sources for development releases are not distributed via mirrors to
+ reduce the bandwidth and storage on these mirrors.
+
+ You can always find the latest source at
+ http://download.opensuse.org/distribution/SL-OSS-factory/
+
+ In case you need the exact source of this development release you can
+ find it on:
+ http://www.novell.com/products/opensuse/source_code.html
+
+ Alternatively, see
+ http://www.novell.com/products/opensuse/source_code.html or send e-mail
+ to sourcedvd@suse.de to request the source
+ for a specific release of openSUSE on DVD. Please note that we will
+ charge $15 or 15 Euros to cover our costs of distribution.
+
+ Use this distribution at your own risk - and remember to have a
+ lot of fun! :)
+
+ Your openSUSE Team.
--- /dev/null
+SUSE Linux Products GmbH
+20070705102239
+1
--- /dev/null
+/ SuSE-Linux-STABLE-X86 10.3
--- /dev/null
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.0.7 (GNU/Linux)
+
+iD8DBQBGjNGIqE7a6JyACsoRAoWnAJkB1wTxOQngy5xvjTiUvwWp65wW5wCg
+hCbA+jw64zZYCa7IM71hBBynFL4=
+=nSHl
+-----END PGP SIGNATURE-----
--- /dev/null
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: GnuPG v2.0.4-svn0 (GNU/Linux)
+
+mQGiBDnu9IERBACT8Y35+2vv4MGVKiLEMOl9GdST6MCkYS3yEKeueNWc+z/0Kvff
+4JctBsgs47tjmiI9sl0eHjm3gTR8rItXMN6sJEUHWzDP+Y0PFPboMvKx0FXl/A0d
+M+HFrruCgBlWt6FA+okRySQiliuI5phwqkXefl9AhkwR8xocQSVCFxcwvwCglVcO
+QliHu8jwRQHxlRE0tkwQQI0D+wfQwKdvhDplxHJ5nf7U8c/yE/vdvpN6lF0tmFrK
+XBUX+K7u4ifrZlQvj/81M4INjtXreqDiJtr99Rs6xa0ScZqITuZC4CWxJa9GynBE
+D3+D2t1V/f8l0smsuYoFOF7Ib49IkTdbtwAThlZp8bEhELBeGaPdNCcmfZ66rKUd
+G5sRA/9ovnc1krSQF2+sqB9/o7w5/q2qiyzwOSTnkjtBUVKn4zLUOf6aeBAoV6NM
+CC3Kj9aZHfA+ND0ehPaVGJgjaVNFhPi4x0e7BULdvgOoAqajLfvkURHAeSsxXIoE
+myW/xC1sBbDkDUIBSx5oej73XCZgnj/inphRqGpsb+1nKFvF+rQoU3VTRSBQYWNr
+YWdlIFNpZ25pbmcgS2V5IDxidWlsZEBzdXNlLmRlPohiBBMRAgAiBQJA2AY+AhsD
+BQkObd+9BAsHAwIDFQIDAxYCAQIeAQIXgAAKCRCoTtronIAKypCfAJ9RuZ6ZSV7Q
+W4pTgTIxQ+ABPp0sIwCffG9bCNnrETPlgOn+dGEkAWegKL+IRgQQEQIABgUCOnBe
+UgAKCRCeQOMQAAqrpNzOAKCL512FZvv4VZx94TpbA9lxyoAejACeOO1HIbActAev
+k5MUBhNeLZa/qM2JARUDBRA6cGBvd7LmAD0l09kBATWnB/9An5vfiUUE1VQnt+T/
+EYklES3tXXaJJp9pHMa4fzFa8jPVtv5UBHGee3XoUNDVwM2OgSEISZxbzdXGnqIl
+cT08TzBUD9i579uifklLsnr35SJDZ6ram51/CWOnnaVhUzneOA9gTPSr+/fT3WeV
+nwJiQCQ30kNLWVXWATMnsnT486eAOlT6UNBPYQLpUprF5Yryk23pQUPAgJENDEqe
+U6iIO9Ot1ZPtB0lniw+/xCi13D360o1tZDYOp0hHHJN3D3EN8C1yPqZd5CvvznYv
+B6bWBIpWcRgdn2DUVMmpU661jwqGlRz1F84JG/xe4jGuzgpJt9IXSzyohEJB6XG5
++D0BuQINBDnu9JIQCACEkdBN6Mxf5WvqDWkcMRy6wnrd9DYJ8UUTmIT2iQf07tRU
+KJJ9v0JXfx2Z4d08IQSMNRaq4VgSe+PdYgIy0fbj23Via5/gO7fJEpD2hd2f+pMn
+OWvH2rOOIbeYfuhzAc6BQjAKtmgR0ERUTafTM9Wb6F13CNZZNZfDqnFDP6L12w3z
+3F7FFXkz07Rs3AIto1ZfYZd4sCSpMr/0S5nLrHbIvGLp271hhQBeRmmoGEKO2JRe
+lGgUJ2CUzOdtwDIKT0LbCpvaP8PVnYF5IFoYJIWRHqlEt5ucTXstZy7vYjL6vTP4
+l5xs+LIOkNmPhqmfsgLzVo0UaLt80hOwc4NvDCOLAAMGB/9g+9V3ORzw4LvO1pwR
+YJqfDKUq/EJ0rNMMD4N8RLpZRhKHKJUm9nNHLbksnlZwrbSTM5LpC/U6sheLP+l0
+bLVoq0lmsCcUSyh+mY6PxWirLIWCn/IAZAGnXb6Zd6TtIJlGG6pqUN8QxGJYQnon
+l0uTJKHJENbI9sWHQdcTtBMc34gorHFCo1Bcvpnc1LFLrWn7mfoGx6INQjf3HGQp
+MXAWuSBQhzkazY6vaWFpa8bBJ+gKbBuySWzNm3rFtT5HRKMWpO+M9bHp4d+puY0L
+1YwN1OMatcMMpcWnZpiWiR83oi32+xtWUY2U7Ae38mMag8zFbpeqPQUsDv9V7CAJ
+1dbriEwEGBECAAwFAkDYBnoFCQ5t3+gACgkQqE7a6JyACspnpgCfRbYwxT3iq+9l
+/PgNTUNTZOlof2oAn25y0eGi0371jap9kOV6uq71sUuO
+=pJli
+-----END PGP PUBLIC KEY BLOCK-----
--- /dev/null
+# openSUSE Patterns 10.3-71.i586 -- (c) 2007 SUSE LINUX Products GmbH
+# generated on Wed Jul 4 17:31:46 UTC 2007
+
+=Ver: 5.0
+
+=Pat: kde 10.3 71 i586
+
+=Cat.cs: Grafická rozhraní
+=Cat.da: Grafiske miljøer
+=Cat.de: Grafische Umgebungen
+=Cat: Graphical Environments
+=Cat.en_GB: Graphical Environments
+=Cat.es: Entornos gráficos
+=Cat.et: Graafilised keskkonnad
+=Cat.fi: Graafinen ympäristö
+=Cat.fr: Environnements graphiques
+=Cat.hr: Grafičko okruženje
+=Cat.hu: Grafikus környezet
+=Cat.id: Lingkungan Grafis
+=Cat.it: Ambienti grafici
+=Cat.ja: グラフィック環境
+=Cat.km: បរិស្ថានក្រាហ្វិក
+=Cat.lt: Grafinės aplinkos
+=Cat.nb: Grafisk miljø
+=Cat.nl: Grafische omgevingen
+=Cat.pl: Środowiska graficzne
+=Cat.pt_BR: Ambientes Gráficos
+=Cat.ru: Графическое окружение
+=Cat.sk: Grafické prostredia
+=Cat.sv: Grafiska miljöer
+=Cat.uk: Графічні середовища
+=Cat.zh_CN: 图形环境
+=Cat.zh_TW: 圖形環境
+
+=Ico: kde
+
+=Sum: KDE Desktop Environment
+=Sum.bg: KDE Работна среда
+=Sum.cs: Prostředí KDE
+=Sum.da: KDE skrivebordsmiljø
+=Sum.de: KDE Desktop-Umgebung
+=Sum.el: Ξ Ξ΅Ο\81ιβάλλον Ξ\95Ο\80ΞΉΟ\86άνΡιαΟ\82 Ξ\95Ο\81Ξ³Ξ±Ο\83Ξ—Ξ±Ο\82 KDE
+=Sum.en_GB: KDE Desktop Environment
+=Sum.es: Escritorio KDE
+=Sum.et: KDE töölaua keskkond
+=Sum.fi: KDE-työpöytäympäristö
+=Sum.fr: Environnement de bureau KDE
+=Sum.hu: KDE asztali környezet
+=Sum.it: Ambiente Desktop KDE
+=Sum.ja: KDE デスクトップ環境
+=Sum.km: បរិស្ថានផ្ទៃតុ KDE
+=Sum.ko: KDE 데스크탑 환경
+=Sum.lt: KDE darbalaukio aplinka
+=Sum.nb: Skrivebordsmiljøet KDE
+=Sum.nl: KDE Desktop Environment
+=Sum.pl: Środowisko graficzne KDE
+=Sum.pt_BR: KDE Ambiente de Desktop
+=Sum.ru: Рабочая среда KDE
+=Sum.sk: Prostredie KDE
+=Sum.sl: Namizno okolje KDE
+=Sum.sv: Skrivbordsmiljön KDE
+=Sum.uk: Стільничне середовище KDE
+=Sum.zh_CN: KDE 桌面环境
+=Sum.zh_TW: KDE 桌面環境
+
++Des.bg:
+KDE е мощна свободна графична среда за работни станции с Линукс, комбинираща в себе си лекота на употреба, съвременна функционалност и изключителен графичен дизайн с техническото превъзходство операционната система Линукс.
+-Des.bg:
++Des.ca:
+KDE és un potent entorn gràfic d'escriptori de programari lliure per a les estacions de treball de Linux. Combina la facilitat d'ús, la funcionalitat contemporània i un disseny gràfic excepcional amb la tecnologia del sistema operatiu Linux.
+-Des.ca:
++Des.cs:
+KDE je svobodné grafické prostředí pro pracovní stanice. Snoubí v sobě uživatelskou přívětivost, moderní funkcionalitu a atraktivní vzhled s linuxovou technologií.
+-Des.cs:
++Des.da:
+KDE er et stærkt grafisk skrivebordsmiljø til Linux-arbejdsstationer og er fri software. Det er både let at bruge, har mange funktioner og et flot grafisk design med teknologien fra Linux-operativsystemet.
+-Des.da:
++Des.de:
+KDE ist eine leistungsstarke kostenlose grafische Desktop-Umgebung für Linux-Arbeitsstationen. Das Programm kombiniert Benutzerfreundlichkeit, moderne Funktionsweise und hervorragendes grafisches Design mit der Technologie des Linux-Betriebssystems.
+-Des.de:
++Des:
+KDE is a powerful free software graphical desktop environment for Linux workstations. It combines ease of use, contemporary functionality, and outstanding graphical design with the technology of the Linux operating system.
+-Des:
++Des.en_GB:
+KDE is a powerful free software graphical desktop environment for Linux workstations. It combines ease of use, contemporary functionality, and outstanding graphical design with the technology of the Linux operating system.
+-Des.en_GB:
++Des.es:
+KDE es un potente programa escritorio gráfico gratuito para estaciones de trabajo Linux. Combina la facilidad de uso, funciones contemporáneas y un diseño gráfico insuperable con la tecnología del sistema operativo Linux.
+-Des.es:
++Des.fi:
+KDE on vaikuttava vapaa työpöytäympäristö Linux-työasemille. Siinä yhdistyy helppokäyttöisyys, käytettävyys ja upea graafinen suunnittelu Linux-käyttöjärjestelmäteknologian kanssa.
+-Des.fi:
++Des.fr:
+KDE est un environnement de bureau graphique gratuit et puissant pour les stations de travail Linux. Il allie simplicité d'utilisation, fonctionnalités modernes et conception graphique exceptionnelle grâce à la technologie du système d'exploitation Linux.
+-Des.fr:
++Des.hr:
+KDE je moćno besplatano grafičko okruženje radne površine za Linux radne stanice. Kombinira lakoću korištenja, svakodnevnu funkcionalnost i izvrstan grafički dizajn zajedno s tehnologijom Linux operativnog sustava.
+-Des.hr:
++Des.hu:
+A KDE egy nagyteljesítményű, ingyenes, grafikus, asztali környezet Linux munkaállomásokhoz. Az egyszerű használatot, a modern funkcionalitást, valamint a kiemelkedő grafikai kivitelt egyesíti a Linux operációs rendszer technológiai előnyeivel.
+-Des.hu:
++Des.id:
+KDE merupakan lingkungan desktop grafis free software yang powerful untuk workstation Linux. Ia menggabungkan kemudahan, fungsionalitas kontemporer, dan desain grafis yang hebat dengan teknologi sistem operasi Linux.
+-Des.id:
++Des.it:
+KDE rappresenta un efficiente ambiente desktop grafico software gratuito per le workstation Linux. Associa facilità d'uso, funzioni aggiornate e ambiente grafico accattivante alla tecnologia del sistema operativo Linux.
+-Des.it:
++Des.ja:
+KDEは、Linuxワークステーション用の無料で強力なソフトウェアグラフィカルデスクトップ環境です。 使いやすさ、現代の機能性、そして優れたグラフィカルデザインをLinuxオペレーティングシステムの技術と統合します。
+-Des.ja:
++Des.km:
+KDE គឺជាបរិស្ថានផ្ទៃតុក្រាហ្វិកឥតគិតថ្លៃសម្រាប់ស្ថានីយការងាររបស់លីនុច ។ វារួមបញ្ចូលនូវភាពងាយស្រួលក្នុងការប្រើប្រាស់ និងមុខងារដែលវិវត្តតាមសម័យកាលជានិច្ច ជាមួយនឹងបច្ចេកវិជ្ជារចនាក្រាហ្វិកគំរូតាមប្រព័ន្ធប្រតិបត្តិការលីនុច ។
+-Des.km:
++Des.lt:
+KDE yra galinga nemokama grafinė darbalaukio aplinka Linux darbo stotims. Ji sujungia lengvą naudojimą, šiuolaikinį funkcionalumą ir puikų grafinį dizainą su Linux operacinės sistemos technologijomis.
+-Des.lt:
++Des.nb:
+KDE er et effektivt og elegant grafisk skrivebordsmiljø for Linux-arbeidsstasjoner. KDE kombinerer brukervennlighet, avanserte funksjoner og lekker grafisk design med teknologien i Linux-operativsystemet.
+-Des.nb:
++Des.nl:
+KDE is een krachtige, vrije grafische desktop environment voor Linux-computers. Het combineert eenvoudig gebruik, uitgebreide functionaliteit en een uitstekend grafisch design met de technologie van het Linux-besturingssysteem.
+-Des.nl:
++Des.pl:
+KDE jest potężnym środowiskiem graficznym dla linuksowych stacji roboczych. Łączy łatwość obsługi, szerokie możliwości i atrakcyjny wygląd z technologiamisystemu operacyjnego Linux.
+-Des.pl:
++Des.pt:
+O KDE é um ambiente de trabalho gráfico livre e potente, para estações de trabalho Linux. Este combina a facilidade de utilização, funcionalidade contemporânea, e design gráfico de grande destaque, com a tecnologia do sistema operativo Linux.
+-Des.pt:
++Des.pt_BR:
+O KDE é um poderoso ambiente gráfico de área de trabalho de software gratuito para estações de trabalho Linux. Ele combina a facilidade de uso, a funcionalidade contemporânea e o excelente design gráfico à tecnologia do sistema operacional Linux.
+-Des.pt_BR:
++Des.ru:
+KDE это мощная бесплатная графическая система для Linux рабочих станций. Она комбинирует легкость в использовании, современную функциональность, превосходный дизайн с технологиями оперативной системы Linux.
+-Des.ru:
++Des.sk:
+KDE je výkonné grafické prostredie a slobodný softvér, pre linuxové pracovné stanice. Kombinuje jednoduchosž použitia, modernú funkcionalitu a výnimočný grafický dizajn spolu s technológiou operačného systému Linux.
+-Des.sk:
++Des.sv:
+KDE är en kraftfull fri programvara för grafisk skrivbordsmiljö för Linux-arbetsstationer. Den kombinerar användarvänlighet, moderna funktioner och fantastisk grafisk formgivning med tekniken hos operativsystemet Linux.
+-Des.sv:
++Des.uk:
+KDE - це потужне графічне середовище для робочих станцій Linux. Воно поєднує простоту використання, модерну функціональність та видатний графічний дизайн з операційною системою Linux.
+-Des.uk:
++Des.zh_CN:
+KDE 是一个软件图形桌面环境,它用于 Linux 工作站,不但功能强大,而且还可以免费使用。 它将先进的功能、独特的图形设计与 Linux 操作系统的技术相结合,使用方便。
+-Des.zh_CN:
++Des.zh_TW:
+KDE 是針對 Linux 工作站所設計、功能強大的免費軟體圖形桌面環境。它將容易使用、現代化功能及傑出的圖形設計等結合到 Linux 作業系統之中。
+-Des.zh_TW:
+
++Rec:
+kde_internet
+multimedia
+office
+kde_utilities
+imaging
+games
+non_oss
+non_oss_java
+xgl
+-Rec:
+
++Req:
+kde_basis
+-Req:
+
+=Vis: true
+
+=Ord: 1520
+
++Prc:
+opensuse-quickstart_en
+-Prc:
++Psg:
+kdeedu3
+kiosktool
+-Psg:
+
--- /dev/null
+##----------------------------------------
+=Pkg: kdelibs3 3.5.7 24 i586
+=Cks: SHA1 05f0647241433d01636785fd282cc824a6527269
++Req:
+rpmlib(VersionedDependencies) <= 3.0.3-1
+qt3 >= 3.3.8
+openssl
+hicolor-icon-theme
+sudo
+/bin/sh
+/bin/sh
+rpmlib(PayloadFilesHavePrefix) <= 4.0-1
+rpmlib(CompressedFileNames) <= 3.0.4-1
+/bin/sh
+/usr/bin/perl
+libDCOP.so.4
+libHalf.so.4
+libICE.so.6
+libIlmImf.so.4
+libSM.so.6
+libX11.so.6
+libXau.so.6
+libXcursor.so.1
+libXext.so.6
+libXfixes.so.3
+libXft.so.2
+libXi.so.6
+libXinerama.so.1
+libXrandr.so.2
+libXrender.so.1
+libacl.so.1
+libacl.so.1(ACL_1.0)
+libart_lgpl_2.so.2
+libasound.so.2
+libasound.so.2(ALSA_0.9)
+libaspell.so.15
+libattr.so.1
+libattr.so.1(ATTR_1.0)
+libbz2.so.1
+libc.so.6
+libc.so.6(GLIBC_2.0)
+libc.so.6(GLIBC_2.1)
+libc.so.6(GLIBC_2.1.2)
+libc.so.6(GLIBC_2.1.3)
+libc.so.6(GLIBC_2.2)
+libc.so.6(GLIBC_2.3)
+libc.so.6(GLIBC_2.3.4)
+libc.so.6(GLIBC_2.4)
+libcups.so.2
+libdl.so.2
+libdl.so.2(GLIBC_2.0)
+libdl.so.2(GLIBC_2.1)
+libdns_sd.so.1
+libexpat.so.1
+libfam.so.0
+libfontconfig.so.1
+libfreetype.so.6
+libgcc_s.so.1
+libgcc_s.so.1(GCC_3.0)
+libgcc_s.so.1(GLIBC_2.0)
+libgssapi_krb5.so.2
+libgssapi_krb5.so.2(gssapi_krb5_2_MIT)
+libidn.so.11
+libjasper.so.1
+libjpeg.so.62
+libkabc.so.1
+libkabc_dir.so.1
+libkabc_file.so.1
+libkabc_ldapkio.so.1
+libkatepartinterfaces.so.0
+libkdecore.so.4
+libkdefakes.so.4
+libkdefx.so.4
+libkdeinit_cupsdconf.so
+libkdeinit_dcopserver.so
+libkdeinit_kaddprinterwizard.so
+libkdeinit_kbuildsycoca.so
+libkdeinit_kcmshell.so
+libkdeinit_kconf_update.so
+libkdeinit_kcookiejar.so
+libkdeinit_kded.so
+libkdeinit_kio_http_cache_cleaner.so
+libkdeinit_kio_uiserver.so
+libkdeinit_klauncher.so
+libkdeinit_knotify.so
+libkdemm.so.0
+libkdeprint.so.4
+libkdeprint_management.so.4
+libkdesu.so.4
+libkdeui.so.4
+libkhtml.so.4
+libkio.so.4
+libkjs.so.1
+libkmediaplayer.so.0
+libknewstuff.so.1
+libkntlm.so.0
+libkparts.so.2
+libkresources.so.1
+libkscript.so.0
+libkspell2.so.1
+libktexteditor.so.0
+libkutils.so.1
+libkwalletbackend.so.1
+libkwalletclient.so.1
+libm.so.6
+libm.so.6(GLIBC_2.0)
+libnetworkstatus.so.0
+libpcre.so.0
+libpng12.so.0
+libpthread.so.0
+libpthread.so.0(GLIBC_2.0)
+libpthread.so.0(GLIBC_2.2)
+libqt-mt.so.3
+libresolv.so.2
+libresolv.so.2(GLIBC_2.0)
+libresolv.so.2(GLIBC_2.2)
+libstdc++.so.6
+libstdc++.so.6(CXXABI_1.3)
+libstdc++.so.6(CXXABI_1.3.1)
+libstdc++.so.6(GLIBCXX_3.4)
+libstdc++.so.6(GLIBCXX_3.4.9)
+libtiff.so.3
+libutil.so.1
+libvcard.so.0
+libxcb-xlib.so.0
+libxcb.so.1
+libxml2.so.2
+libxslt.so.1
+libz.so.1
+rpmlib(PayloadIsBzip2) <= 3.0.5-1
+-Req:
++Prq:
+rpmlib(VersionedDependencies) <= 3.0.3-1
+/bin/sh
+/bin/sh
+rpmlib(PayloadFilesHavePrefix) <= 4.0-1
+rpmlib(CompressedFileNames) <= 3.0.4-1
+rpmlib(PayloadIsBzip2) <= 3.0.5-1
+-Prq:
++Prv:
+kups
+keramik
+kdelibs3-cups
+kdelibs3-33addons
+kdepim3-networkstatus
+kdelibs3_base = 3.3
+cupsdconf.so
+dcopserver.so
+highcolor.so
+highcontrast.so
+kabc_dir.so
+kabc_file.so
+kabc_ldapkio.so
+kabcformat_binary.so
+kaddprinterwizard.so
+kbuildsycoca.so
+kbzip2filter.so
+kcm_kresources.so
+kcmshell.so
+kconf_update.so
+kcookiejar.so
+kded.so
+kded_kcookiejar.so
+kded_kdeprintd.so
+kded_kdetrayproxy.so
+kded_kpasswdserver.so
+kded_kssld.so
+kded_kwalletd.so
+kded_networkstatus.so
+kded_proxyscout.so
+kdeprint_cups.so
+kdeprint_ext.so
+kdeprint_lpdunix.so
+kdeprint_lpr.so
+kdeprint_rlpr.so
+kdeprint_tool_escputil.so
+kdewidgets.so
+keramik.so
+kfileaudiopreview.so
+kgzipfilter.so
+khtmlimagepart.so
+kimg_dds.so
+kimg_eps.so
+kimg_exr.so
+kimg_hdr.so
+kimg_ico.so
+kimg_jp2.so
+kimg_pcx.so
+kimg_psd.so
+kimg_rgb.so
+kimg_tga.so
+kimg_tiff.so
+kimg_xcf.so
+kimg_xview.so
+kio_file.so
+kio_ftp.so
+kio_ghelp.so
+kio_help.so
+kio_http.so
+kio_http_cache_cleaner.so
+kio_metainfo.so
+kio_uiserver.so
+kjavaappletviewer.so
+klauncher.so
+knotify.so
+kspell_aspell.so
+kspell_ispell.so
+kstyle_highcontrast_config.so
+kstyle_plastik_config.so
+ktexteditor_docwordcompletion.so
+ktexteditor_insertfile.so
+ktexteditor_isearch.so
+ktexteditor_kdatatool.so
+kthemestyle.so
+libDCOP.so.4
+libconnectionmanager.so.0
+libkabc.so.1
+libkabc_dir.so.1
+libkabc_file.so.1
+libkabc_ldapkio.so.1
+libkatepart.so
+libkatepartinterfaces.so.0
+libkcertpart.so
+libkdecore.so.4
+libkdefakes.so.4
+libkdefx.so.4
+libkdeinit_cupsdconf.so
+libkdeinit_dcopserver.so
+libkdeinit_kaddprinterwizard.so
+libkdeinit_kbuildsycoca.so
+libkdeinit_kcmshell.so
+libkdeinit_kconf_update.so
+libkdeinit_kcookiejar.so
+libkdeinit_kded.so
+libkdeinit_kio_http_cache_cleaner.so
+libkdeinit_kio_uiserver.so
+libkdeinit_klauncher.so
+libkdeinit_knotify.so
+libkdemm.so.0
+libkdeprint.so.4
+libkdeprint_management.so.4
+libkdeprint_management_module.so
+libkdesasl.so.1
+libkdesu.so.4
+libkdeui.so.4
+libkdnssd.so.1
+libkhtml.so.4
+libkhtmlpart.so
+libkimproxy.so.0
+libkio.so.4
+libkjava.so.1
+libkjs.so.1
+libkmdi.so.1
+libkmdi2.so.1
+libkmediaplayer.so.0
+libkmid.so.0
+libkmultipart.so
+libknewstuff.so.1
+libkntlm.so.0
+libkparts.so.2
+libkresources.so.1
+libkscreensaver.so.4
+libkscript.so.0
+libkspell.so.4
+libkspell2.so.1
+libktexteditor.so.0
+libkunittest.so.1
+libkutils.so.1
+libkwalletbackend.so.1
+libkwalletclient.so.1
+libnetworkstatus.so.0
+libshellscript.so
+libvcard.so.0
+light.so
+plastik.so
+kdelibs3 = 3.5.7-24
+-Prv:
++Obs:
+kde3-i18n
+kups
+keramik
+kdelibs3-cups
+kdelibs3-33addons
+kdepim3-networkstatus
+-Obs:
++Rec:
+ispell
+ispell_dictionary
+enscript
+-Rec:
+=Grp: System/GUI/KDE
+=Lic: BSD License and BSD-like, GNU General Public License (GPL)
+=Src: kdelibs3 3.5.7 24 src
+=Tim: 1183399094
+=Loc: 1 kdelibs3-3.5.7-24.i586.rpm
+=Siz: 16356019 38850584
++Aut:
+The KDE Team <kde@kde.org>
+-Aut:
+##----------------------------------------
+=Pkg: kdelibs3-arts 3.5.7 24 i586
+=Cks: SHA1 84d8c8e875395b8caaed90ae40bdfad3fe903eb7
++Req:
+arts >= 1.5.7
+/bin/sh
+/bin/sh
+rpmlib(PayloadFilesHavePrefix) <= 4.0-1
+rpmlib(CompressedFileNames) <= 3.0.4-1
+libX11.so.6
+libartsflow.so.1
+libartsflow_idl.so.1
+libc.so.6
+libc.so.6(GLIBC_2.0)
+libc.so.6(GLIBC_2.1.3)
+libc.so.6(GLIBC_2.4)
+libkdecore.so.4
+libkdeui.so.4
+libkio.so.4
+libkmedia2_idl.so.1
+libmcop.so.1
+libpthread.so.0
+libpthread.so.0(GLIBC_2.0)
+libqt-mt.so.3
+libqtmcop.so.1
+libsoundserver_idl.so.1
+libstdc++.so.6
+libstdc++.so.6(CXXABI_1.3)
+libstdc++.so.6(GLIBCXX_3.4)
+libstdc++.so.6(GLIBCXX_3.4.9)
+rpmlib(PayloadIsBzip2) <= 3.0.5-1
+-Req:
++Prq:
+/bin/sh
+/bin/sh
+rpmlib(PayloadFilesHavePrefix) <= 4.0-1
+rpmlib(CompressedFileNames) <= 3.0.4-1
+rpmlib(PayloadIsBzip2) <= 3.0.5-1
+-Prq:
++Prv:
+kdelibs3:/opt/kde3/bin/artsmessage
+libartskde.so.1
+kdelibs3-arts = 3.5.7-24
+-Prv:
++Rec:
+kdemultimedia3-arts
+-Rec:
+=Grp: System/GUI/KDE
+=Lic: BSD License and BSD-like, GNU General Public License (GPL)
+=Src: kdelibs3 3.5.7 24 src
+=Tim: 1183399094
+=Loc: 1 kdelibs3-arts-3.5.7-24.i586.rpm
+=Siz: 183999 393828
++Aut:
+The KDE Team <kde@kde.org>
+-Aut:
+##----------------------------------------
+=Pkg: kdelibs3-debuginfo 3.5.7 24 i586
+=Cks: SHA1 0f4c7798729fae70830fd03962dff8cdcadb7bdc
++Req:
+kdelibs3 = 3.5.7-24
+rpmlib(PayloadFilesHavePrefix) <= 4.0-1
+rpmlib(CompressedFileNames) <= 3.0.4-1
+rpmlib(PayloadIsBzip2) <= 3.0.5-1
+-Req:
++Prq:
+rpmlib(PayloadFilesHavePrefix) <= 4.0-1
+rpmlib(CompressedFileNames) <= 3.0.4-1
+rpmlib(PayloadIsBzip2) <= 3.0.5-1
+-Prq:
++Prv:
+kdelibs3-debuginfo = 3.5.7-24
+-Prv:
+=Grp: Development/Debug
+=Lic: BSD License and BSD-like, GNU General Public License (GPL)
+=Src: kdelibs3 3.5.7 24 src
+=Tim: 1183399094
+=Loc: 1 kdelibs3-debuginfo-3.5.7-24.i586.rpm
+=Siz: 44452218 139124954
++Aut:
+The KDE Team <kde@kde.org>
+-Aut:
+##----------------------------------------
+=Pkg: kdelibs3-devel 3.5.7 24 i586
+=Cks: SHA1 46cfb73e29561af9e5445f6c525821856d067e61
++Req:
+qt3-devel
+libvorbis-devel
+kdelibs3 = 3.5.7
+autoconf
+automake
+libxslt-devel
+libxml2-devel
+libart_lgpl-devel
+libjpeg-devel
+kdelibs3-doc
+libtiff-devel
+openssl-devel
+unsermake
+update-desktop-files
+libdrm-devel
+dbus-1-qt3-devel
+libattr-devel
+libacl-devel
+avahi-compat-mDNSResponder-devel
+libbz2-devel
+kdelibs3-arts
+fam-devel
+pcre-devel
+libidn-devel
+arts-devel
+rpmlib(PayloadFilesHavePrefix) <= 4.0-1
+rpmlib(CompressedFileNames) <= 3.0.4-1
+/bin/bash
+/bin/sh
+/usr/bin/env
+/usr/bin/perl
+libc.so.6
+libc.so.6(GLIBC_2.0)
+libc.so.6(GLIBC_2.1.3)
+libc.so.6(GLIBC_2.4)
+libkdecore.so.4
+libkio.so.4
+libkunittest.so.1
+libqt-mt.so.3
+libstdc++.so.6
+libstdc++.so.6(CXXABI_1.3)
+libstdc++.so.6(GLIBCXX_3.4)
+libstdc++.so.6(GLIBCXX_3.4.9)
+rpmlib(PayloadIsBzip2) <= 3.0.5-1
+-Req:
++Prq:
+rpmlib(PayloadFilesHavePrefix) <= 4.0-1
+rpmlib(CompressedFileNames) <= 3.0.4-1
+rpmlib(PayloadIsBzip2) <= 3.0.5-1
+-Prq:
++Prv:
+perl(Ast)
+perl(Iter)
+perl(kalyptusCxxToDcopIDL)
+perl(kdocAstUtil)
+perl(kdocParseDoc)
+perl(kdocUtil)
+kdelibs3-devel = 3.5.7-24
+-Prv:
+=Grp: System/GUI/KDE
+=Lic: BSD License and BSD-like, GNU General Public License (GPL)
+=Src: kdelibs3 3.5.7 24 src
+=Tim: 1183399094
+=Loc: 1 kdelibs3-devel-3.5.7-24.i586.rpm
+=Siz: 1403143 6898685
++Aut:
+The KDE Team <kde@kde.org>
+-Aut:
+##----------------------------------------
+=Pkg: kdelibs3-doc 3.5.7 24 i586
+=Cks: SHA1 28714c6b0ab4dbed12039d511995d3085721ed4e
++Req:
+sgml-skel
+libxml2
+/usr/bin/sgml-register-catalog
+/usr/bin/xmlcatalog
+/usr/bin/edit-xml-catalog
+sed
+grep
+awk
+/bin/sh
+/bin/sh
+rpmlib(PayloadFilesHavePrefix) <= 4.0-1
+rpmlib(CompressedFileNames) <= 3.0.4-1
+libbz2.so.1
+libc.so.6
+libc.so.6(GLIBC_2.0)
+libc.so.6(GLIBC_2.1)
+libc.so.6(GLIBC_2.4)
+libkdecore.so.4
+libkio.so.4
+libqt-mt.so.3
+libstdc++.so.6
+libstdc++.so.6(CXXABI_1.3)
+libstdc++.so.6(GLIBCXX_3.4)
+libxml2.so.2
+libxslt.so.1
+rpmlib(PayloadIsBzip2) <= 3.0.5-1
+-Req:
++Prq:
+/usr/bin/sgml-register-catalog
+/usr/bin/xmlcatalog
+/usr/bin/edit-xml-catalog
+sed
+grep
+awk
+/bin/sh
+/bin/sh
+rpmlib(PayloadFilesHavePrefix) <= 4.0-1
+rpmlib(CompressedFileNames) <= 3.0.4-1
+rpmlib(PayloadIsBzip2) <= 3.0.5-1
+-Prq:
++Prv:
+kdelibs3:/opt/kde3/share/apps/ksgmltools2
+kdelibs3_doc
+kdelibs3-doc = 3.5.7-24
+-Prv:
+=Grp: System/GUI/KDE
+=Lic: BSD License and BSD-like, GNU General Public License (GPL)
+=Src: kdelibs3 3.5.7 24 src
+=Tim: 1183399094
+=Loc: 1 kdelibs3-doc-3.5.7-24.i586.rpm
+=Siz: 918394 5908265
++Aut:
+The KDE Team <kde@kde.org>
+-Aut:
+##----------------------------------------
\ No newline at end of file
--- /dev/null
+##----------------------------------------
+=Pkg: kdelibs3 3.5.7 24 i586
++Dir:
+/ 0 39444 0 3068
+etc/ 1 12 1 1
+etc/xdg/ 0 12 0 1
+etc/xdg/menus/ 12 0 1 0
+opt/ 0 39366 0 3054
+opt/kde3/ 0 39366 0 3054
+opt/kde3/bin/ 1104 0 51 0
+opt/kde3/lib/ 19666 5798 53 152
+opt/kde3/lib/kde3/ 4968 830 138 14
+opt/kde3/lib/kde3/plugins/ 0 830 0 14
+opt/kde3/lib/kde3/plugins/designer/ 108 0 2 0
+opt/kde3/lib/kde3/plugins/styles/ 722 0 12 0
+opt/kde3/share/ 0 12798 0 2798
+opt/kde3/share/applications/ 0 13 0 1
+opt/kde3/share/applications/kde/ 13 0 1 0
+opt/kde3/share/apps/ 0 3902 0 410
+opt/kde3/share/apps/LICENSES/ 57 0 5 0
+opt/kde3/share/apps/kabc/ 229 4 1 1
+opt/kde3/share/apps/kabc/formats/ 4 0 1 0
+opt/kde3/share/apps/katepart/ 11 2194 2 134
+opt/kde3/share/apps/katepart/scripts/ 16 10 5 2
+opt/kde3/share/apps/katepart/scripts/indent/ 10 0 2 0
+opt/kde3/share/apps/katepart/syntax/ 2168 0 127 0
+opt/kde3/share/apps/kcertpart/ 1 0 1 0
+opt/kde3/share/apps/kcm_componentchooser/ 38 0 2 0
+opt/kde3/share/apps/kconf_update/ 8 0 8 0
+opt/kde3/share/apps/kdeprint/ 194 299 13 99
+opt/kde3/share/apps/kdeprint/filters/ 156 0 20 0
+opt/kde3/share/apps/kdeprint/icons/ 0 91 0 55
+opt/kde3/share/apps/kdeprint/icons/crystalsvg/ 0 91 0 55
+opt/kde3/share/apps/kdeprint/icons/crystalsvg/16x16/ 0 20 0 20
+opt/kde3/share/apps/kdeprint/icons/crystalsvg/16x16/actions/ 3 0 3 0
+opt/kde3/share/apps/kdeprint/icons/crystalsvg/16x16/apps/ 17 0 17 0
+opt/kde3/share/apps/kdeprint/icons/crystalsvg/22x22/ 0 32 0 19
+opt/kde3/share/apps/kdeprint/icons/crystalsvg/22x22/actions/ 31 0 18 0
+opt/kde3/share/apps/kdeprint/icons/crystalsvg/22x22/apps/ 1 0 1 0
+opt/kde3/share/apps/kdeprint/icons/crystalsvg/32x32/ 0 26 0 12
+opt/kde3/share/apps/kdeprint/icons/crystalsvg/32x32/actions/ 3 0 1 0
+opt/kde3/share/apps/kdeprint/icons/crystalsvg/32x32/apps/ 23 0 11 0
+opt/kde3/share/apps/kdeprint/icons/crystalsvg/48x48/ 0 6 0 2
+opt/kde3/share/apps/kdeprint/icons/crystalsvg/48x48/apps/ 6 0 2 0
+opt/kde3/share/apps/kdeprint/icons/crystalsvg/64x64/ 0 7 0 2
+opt/kde3/share/apps/kdeprint/icons/crystalsvg/64x64/apps/ 7 0 2 0
+opt/kde3/share/apps/kdeprint/pics/ 25 0 18 0
+opt/kde3/share/apps/kdeprint/plugins/ 25 0 5 0
+opt/kde3/share/apps/kdeprint/tools/ 2 0 1 0
+opt/kde3/share/apps/kdeui/ 0 93 0 26
+opt/kde3/share/apps/kdeui/about/ 45 0 23 0
+opt/kde3/share/apps/kdeui/pics/ 48 0 3 0
+opt/kde3/share/apps/kdewidgets/ 0 60 0 42
+opt/kde3/share/apps/kdewidgets/pics/ 60 0 42 0
+opt/kde3/share/apps/khtml/ 6 50 4 12
+opt/kde3/share/apps/khtml/css/ 9 0 2 0
+opt/kde3/share/apps/khtml/icons/ 0 41 0 10
+opt/kde3/share/apps/khtml/icons/crystalsvg/ 0 41 0 10
+opt/kde3/share/apps/khtml/icons/crystalsvg/128x128/ 0 14 0 1
+opt/kde3/share/apps/khtml/icons/crystalsvg/128x128/actions/ 14 0 1 0
+opt/kde3/share/apps/khtml/icons/crystalsvg/16x16/ 0 4 0 3
+opt/kde3/share/apps/khtml/icons/crystalsvg/16x16/actions/ 4 0 3 0
+opt/kde3/share/apps/khtml/icons/crystalsvg/22x22/ 0 4 0 2
+opt/kde3/share/apps/khtml/icons/crystalsvg/22x22/actions/ 4 0 2 0
+opt/kde3/share/apps/khtml/icons/crystalsvg/32x32/ 0 6 0 2
+opt/kde3/share/apps/khtml/icons/crystalsvg/32x32/actions/ 6 0 2 0
+opt/kde3/share/apps/khtml/icons/crystalsvg/48x48/ 0 5 0 1
+opt/kde3/share/apps/khtml/icons/crystalsvg/48x48/actions/ 5 0 1 0
+opt/kde3/share/apps/khtml/icons/crystalsvg/64x64/ 0 8 0 1
+opt/kde3/share/apps/khtml/icons/crystalsvg/64x64/actions/ 8 0 1 0
+opt/kde3/share/apps/kio_uiserver/ 0 1 0 1
+opt/kde3/share/apps/kio_uiserver/icons/ 0 1 0 1
+opt/kde3/share/apps/kio_uiserver/icons/crystalsvg/ 0 1 0 1
+opt/kde3/share/apps/kio_uiserver/icons/crystalsvg/16x16/ 0 1 0 1
+opt/kde3/share/apps/kio_uiserver/icons/crystalsvg/16x16/apps/ 1 0 1 0
+opt/kde3/share/apps/kjava/ 156 2 3 1
+opt/kde3/share/apps/kjava/icons/ 0 2 0 1
+opt/kde3/share/apps/kjava/icons/crystalsvg/ 0 2 0 1
+opt/kde3/share/apps/kjava/icons/crystalsvg/16x16/ 0 2 0 1
+opt/kde3/share/apps/kjava/icons/crystalsvg/16x16/actions/ 2 0 1 0
+opt/kde3/share/apps/knewstuff/ 1 0 1 0
+opt/kde3/share/apps/knotify/ 119 0 1 0
+opt/kde3/share/apps/kssl/ 159 0 1 0
+opt/kde3/share/apps/kstyle/ 0 183 0 47
+opt/kde3/share/apps/kstyle/pixmaps/ 0 90 0 32
+opt/kde3/share/apps/kstyle/pixmaps/riscos/ 90 0 32 0
+opt/kde3/share/apps/kstyle/themes/ 93 0 15 0
+opt/kde3/share/apps/ktexteditor_docwordcompletion/ 1 0 1 0
+opt/kde3/share/apps/ktexteditor_insertfile/ 1 0 1 0
+opt/kde3/share/apps/ktexteditor_isearch/ 1 0 1 0
+opt/kde3/share/apps/ktexteditor_kdatatool/ 1 0 1 0
+opt/kde3/share/apps/proxyscout/ 33 0 1 0
+opt/kde3/share/autostart/ 7 0 1 0
+opt/kde3/share/config/ 202 18 10 6
+opt/kde3/share/config/colors/ 10 0 4 0
+opt/kde3/share/config/ui/ 8 0 2 0
+opt/kde3/share/emoticons/ 0 79 0 42
+opt/kde3/share/emoticons/Default/ 79 0 42 0
+opt/kde3/share/icons/ 0 6549 0 1906
+opt/kde3/share/icons/crystalsvg/ 8 6480 1 1898
+opt/kde3/share/icons/crystalsvg/128x128/ 0 1622 0 151
+opt/kde3/share/icons/crystalsvg/128x128/actions/ 27 0 3 0
+opt/kde3/share/icons/crystalsvg/128x128/apps/ 33 0 2 0
+opt/kde3/share/icons/crystalsvg/128x128/devices/ 269 0 22 0
+opt/kde3/share/icons/crystalsvg/128x128/filesystems/ 529 0 40 0
+opt/kde3/share/icons/crystalsvg/128x128/mimetypes/ 764 0 84 0
+opt/kde3/share/icons/crystalsvg/16x16/ 0 429 0 408
+opt/kde3/share/icons/crystalsvg/16x16/actions/ 248 0 228 0
+opt/kde3/share/icons/crystalsvg/16x16/apps/ 3 0 2 0
+opt/kde3/share/icons/crystalsvg/16x16/devices/ 47 0 47 0
+opt/kde3/share/icons/crystalsvg/16x16/filesystems/ 45 0 45 0
+opt/kde3/share/icons/crystalsvg/16x16/mimetypes/ 86 0 86 0
+opt/kde3/share/icons/crystalsvg/22x22/ 0 552 0 346
+opt/kde3/share/icons/crystalsvg/22x22/actions/ 316 0 211 0
+opt/kde3/share/icons/crystalsvg/22x22/apps/ 4 0 2 0
+opt/kde3/share/icons/crystalsvg/22x22/devices/ 41 0 23 0
+opt/kde3/share/icons/crystalsvg/22x22/filesystems/ 43 0 23 0
+opt/kde3/share/icons/crystalsvg/22x22/mimetypes/ 148 0 87 0
+opt/kde3/share/icons/crystalsvg/32x32/ 0 782 0 359
+opt/kde3/share/icons/crystalsvg/32x32/actions/ 347 0 181 0
+opt/kde3/share/icons/crystalsvg/32x32/apps/ 5 0 2 0
+opt/kde3/share/icons/crystalsvg/32x32/devices/ 119 0 47 0
+opt/kde3/share/icons/crystalsvg/32x32/filesystems/ 107 0 41 0
+opt/kde3/share/icons/crystalsvg/32x32/mimetypes/ 204 0 88 0
+opt/kde3/share/icons/crystalsvg/48x48/ 0 842 0 223
+opt/kde3/share/icons/crystalsvg/48x48/actions/ 148 0 39 0
+opt/kde3/share/icons/crystalsvg/48x48/apps/ 10 0 2 0
+opt/kde3/share/icons/crystalsvg/48x48/devices/ 185 0 47 0
+opt/kde3/share/icons/crystalsvg/48x48/filesystems/ 188 0 44 0
+opt/kde3/share/icons/crystalsvg/48x48/mimetypes/ 311 0 91 0
+opt/kde3/share/icons/crystalsvg/64x64/ 0 917 0 184
+opt/kde3/share/icons/crystalsvg/64x64/actions/ 21 0 5 0
+opt/kde3/share/icons/crystalsvg/64x64/apps/ 13 0 2 0
+opt/kde3/share/icons/crystalsvg/64x64/devices/ 258 0 47 0
+opt/kde3/share/icons/crystalsvg/64x64/filesystems/ 240 0 40 0
+opt/kde3/share/icons/crystalsvg/64x64/mimetypes/ 385 0 90 0
+opt/kde3/share/icons/crystalsvg/scalable/ 0 1336 0 227
+opt/kde3/share/icons/crystalsvg/scalable/actions/ 304 0 56 0
+opt/kde3/share/icons/crystalsvg/scalable/apps/ 7 0 1 0
+opt/kde3/share/icons/crystalsvg/scalable/devices/ 290 0 47 0
+opt/kde3/share/icons/crystalsvg/scalable/filesystems/ 212 0 44 0
+opt/kde3/share/icons/crystalsvg/scalable/mimetypes/ 523 0 79 0
+opt/kde3/share/icons/hicolor/ 0 61 0 7
+opt/kde3/share/icons/hicolor/128x128/ 0 24 0 1
+opt/kde3/share/icons/hicolor/128x128/apps/ 24 0 1 0
+opt/kde3/share/icons/hicolor/16x16/ 0 1 0 1
+opt/kde3/share/icons/hicolor/16x16/apps/ 1 0 1 0
+opt/kde3/share/icons/hicolor/22x22/ 0 2 0 1
+opt/kde3/share/icons/hicolor/22x22/apps/ 2 0 1 0
+opt/kde3/share/icons/hicolor/32x32/ 0 3 0 1
+opt/kde3/share/icons/hicolor/32x32/apps/ 3 0 1 0
+opt/kde3/share/icons/hicolor/48x48/ 0 5 0 1
+opt/kde3/share/icons/hicolor/48x48/apps/ 5 0 1 0
+opt/kde3/share/icons/hicolor/64x64/ 0 8 0 1
+opt/kde3/share/icons/hicolor/64x64/apps/ 8 0 1 0
+opt/kde3/share/icons/hicolor/scalable/ 0 18 0 1
+opt/kde3/share/icons/hicolor/scalable/apps/ 18 0 1 0
+opt/kde3/share/locale/ 259 0 1 0
+opt/kde3/share/mimelnk/ 42 1290 1 317
+opt/kde3/share/mimelnk/all/ 9 0 2 0
+opt/kde3/share/mimelnk/application/ 761 0 179 0
+opt/kde3/share/mimelnk/audio/ 101 0 27 0
+opt/kde3/share/mimelnk/image/ 144 0 38 0
+opt/kde3/share/mimelnk/inode/ 21 0 6 0
+opt/kde3/share/mimelnk/message/ 9 0 2 0
+opt/kde3/share/mimelnk/model/ 3 0 1 0
+opt/kde3/share/mimelnk/multipart/ 9 0 2 0
+opt/kde3/share/mimelnk/text/ 175 0 41 0
+opt/kde3/share/mimelnk/uri/ 12 0 6 0
+opt/kde3/share/mimelnk/video/ 46 0 13 0
+opt/kde3/share/services/ 226 80 62 12
+opt/kde3/share/services/kded/ 70 0 8 0
+opt/kde3/share/services/kresources/ 3 7 1 3
+opt/kde3/share/services/kresources/kabc/ 7 0 3 0
+opt/kde3/share/servicetypes/ 131 0 29 0
+usr/ 0 65 0 12
+usr/share/ 0 65 0 12
+usr/share/doc/ 0 57 0 6
+usr/share/doc/packages/ 0 57 0 6
+usr/share/doc/packages/kdelibs3/ 57 0 6 0
+usr/share/man/ 0 8 0 6
+usr/share/man/man1/ 4 0 3 0
+usr/share/man/man7/ 3 0 2 0
+usr/share/man/man8/ 1 0 1 0
+-Dir:
+##----------------------------------------
+=Pkg: kdelibs3-arts 3.5.7 24 i586
++Dir:
+/ 0 386 0 2
+opt/ 0 386 0 2
+opt/kde3/ 0 386 0 2
+opt/kde3/bin/ 11 0 1 0
+opt/kde3/lib/ 375 0 1 0
+-Dir:
+##----------------------------------------
+=Pkg: kdelibs3-debuginfo 3.5.7 24 i586
++Dir:
+/ 0 137630 0 3429
+usr/ 0 137630 0 3429
+usr/lib/ 0 106253 0 186
+usr/lib/debug/ 0 106253 0 186
+usr/lib/debug/opt/ 0 106253 0 186
+usr/lib/debug/opt/kde3/ 0 106253 0 186
+usr/lib/debug/opt/kde3/bin/ 8618 0 56 0
+usr/lib/debug/opt/kde3/lib/ 70633 27002 54 76
+usr/lib/debug/opt/kde3/lib/kde3/ 23702 3300 69 7
+usr/lib/debug/opt/kde3/lib/kde3/plugins/ 0 3300 0 7
+usr/lib/debug/opt/kde3/lib/kde3/plugins/designer/ 317 0 1 0
+usr/lib/debug/opt/kde3/lib/kde3/plugins/styles/ 2983 0 6 0
+usr/src/ 0 31377 0 3243
+usr/src/debug/ 0 31377 0 3243
+usr/src/debug/kdelibs-3.5.7/ 0 31377 0 3243
+usr/src/debug/kdelibs-3.5.7/arts/ 0 273 0 52
+usr/src/debug/kdelibs-3.5.7/arts/kde/ 235 0 45 0
+usr/src/debug/kdelibs-3.5.7/arts/knotify/ 35 0 6 0
+usr/src/debug/kdelibs-3.5.7/arts/message/ 3 0 1 0
+usr/src/debug/kdelibs-3.5.7/dcop/ 285 451 20 44
+usr/src/debug/kdelibs-3.5.7/dcop/KDE-ICE/ 359 0 31 0
+usr/src/debug/kdelibs-3.5.7/dcop/client/ 52 0 7 0
+usr/src/debug/kdelibs-3.5.7/dcop/dcopidl/ 3 0 1 0
+usr/src/debug/kdelibs-3.5.7/dcop/dcopidl2cpp/ 37 0 5 0
+usr/src/debug/kdelibs-3.5.7/dnssd/ 101 0 23 0
+usr/src/debug/kdelibs-3.5.7/interfaces/ 0 437 0 134
+usr/src/debug/kdelibs-3.5.7/interfaces/kimproxy/ 0 63 0 7
+usr/src/debug/kdelibs-3.5.7/interfaces/kimproxy/library/ 63 0 7 0
+usr/src/debug/kdelibs-3.5.7/interfaces/kio/ 2 0 1 0
+usr/src/debug/kdelibs-3.5.7/interfaces/kmediaplayer/ 33 10 8 3
+usr/src/debug/kdelibs-3.5.7/interfaces/kmediaplayer/kfileaudiopreview/ 10 0 3 0
+usr/src/debug/kdelibs-3.5.7/interfaces/kregexpeditor/ 5 0 1 0
+usr/src/debug/kdelibs-3.5.7/interfaces/kscript/ 28 9 6 3
+usr/src/debug/kdelibs-3.5.7/interfaces/kscript/sample/ 9 0 3 0
+usr/src/debug/kdelibs-3.5.7/interfaces/ktexteditor/ 287 0 105 0
+usr/src/debug/kdelibs-3.5.7/kab/ 217 0 9 0
+usr/src/debug/kdelibs-3.5.7/kabc/ 658 383 93 134
+usr/src/debug/kdelibs-3.5.7/kabc/formats/ 8 0 2 0
+usr/src/debug/kdelibs-3.5.7/kabc/plugins/ 0 124 0 21
+usr/src/debug/kdelibs-3.5.7/kabc/plugins/dir/ 25 0 7 0
+usr/src/debug/kdelibs-3.5.7/kabc/plugins/file/ 30 0 7 0
+usr/src/debug/kdelibs-3.5.7/kabc/plugins/ldapkio/ 69 0 7 0
+usr/src/debug/kdelibs-3.5.7/kabc/vcard/ 119 109 36 69
+usr/src/debug/kdelibs-3.5.7/kabc/vcard/include/ 76 33 36 33
+usr/src/debug/kdelibs-3.5.7/kabc/vcard/include/generated/ 33 0 33 0
+usr/src/debug/kdelibs-3.5.7/kabc/vcardparser/ 23 0 6 0
+usr/src/debug/kdelibs-3.5.7/kate/ 0 1740 0 108
+usr/src/debug/kdelibs-3.5.7/kate/interfaces/ 59 0 7 0
+usr/src/debug/kdelibs-3.5.7/kate/part/ 1592 0 89 0
+usr/src/debug/kdelibs-3.5.7/kate/plugins/ 0 89 0 12
+usr/src/debug/kdelibs-3.5.7/kate/plugins/insertfile/ 15 0 3 0
+usr/src/debug/kdelibs-3.5.7/kate/plugins/isearch/ 26 0 3 0
+usr/src/debug/kdelibs-3.5.7/kate/plugins/kdatatool/ 17 0 3 0
+usr/src/debug/kdelibs-3.5.7/kate/plugins/wordcompletion/ 31 0 3 0
+usr/src/debug/kdelibs-3.5.7/kcert/ 34 0 3 0
+usr/src/debug/kdelibs-3.5.7/kcmshell/ 22 0 6 0
+usr/src/debug/kdelibs-3.5.7/kconf_update/ 27 0 3 0
+usr/src/debug/kdelibs-3.5.7/kdecore/ 3210 768 259 50
+usr/src/debug/kdelibs-3.5.7/kdecore/kconfig_compiler/ 51 0 1 0
+usr/src/debug/kdelibs-3.5.7/kdecore/malloc/ 181 0 1 0
+usr/src/debug/kdelibs-3.5.7/kdecore/network/ 446 0 44 0
+usr/src/debug/kdelibs-3.5.7/kdecore/svgicons/ 90 0 4 0
+usr/src/debug/kdelibs-3.5.7/kded/ 218 0 32 0
+usr/src/debug/kdelibs-3.5.7/kdefx/ 337 0 14 0
+usr/src/debug/kdelibs-3.5.7/kdemm/ 78 0 21 0
+usr/src/debug/kdelibs-3.5.7/kdeprint/ 729 1418 126 353
+usr/src/debug/kdelibs-3.5.7/kdeprint/cups/ 337 224 73 58
+usr/src/debug/kdelibs-3.5.7/kdeprint/cups/cupsdconf2/ 224 0 58 0
+usr/src/debug/kdelibs-3.5.7/kdeprint/ext/ 14 0 7 0
+usr/src/debug/kdelibs-3.5.7/kdeprint/lpdunix/ 24 0 7 0
+usr/src/debug/kdelibs-3.5.7/kdeprint/lpr/ 141 0 35 0
+usr/src/debug/kdelibs-3.5.7/kdeprint/management/ 621 0 154 0
+usr/src/debug/kdelibs-3.5.7/kdeprint/rlpr/ 41 0 16 0
+usr/src/debug/kdelibs-3.5.7/kdeprint/tools/ 0 16 0 3
+usr/src/debug/kdelibs-3.5.7/kdeprint/tools/escputil/ 16 0 3 0
+usr/src/debug/kdelibs-3.5.7/kdesu/ 90 0 15 0
+usr/src/debug/kdelibs-3.5.7/kdeui/ 3964 22 362 7
+usr/src/debug/kdelibs-3.5.7/kdeui/kdetrayproxy/ 22 0 7 0
+usr/src/debug/kdelibs-3.5.7/kdewidgets/ 55 0 4 0
+usr/src/debug/kdelibs-3.5.7/kdoctools/ 56 0 8 0
+usr/src/debug/kdelibs-3.5.7/khtml/ 866 4750 44 283
+usr/src/debug/kdelibs-3.5.7/khtml/css/ 530 0 18 0
+usr/src/debug/kdelibs-3.5.7/khtml/dom/ 700 0 53 0
+usr/src/debug/kdelibs-3.5.7/khtml/ecma/ 827 0 48 0
+usr/src/debug/kdelibs-3.5.7/khtml/html/ 492 0 32 0
+usr/src/debug/kdelibs-3.5.7/khtml/java/ 174 0 21 0
+usr/src/debug/kdelibs-3.5.7/khtml/kmultipart/ 31 0 3 0
+usr/src/debug/kdelibs-3.5.7/khtml/misc/ 211 0 23 0
+usr/src/debug/kdelibs-3.5.7/khtml/rendering/ 1307 0 59 0
+usr/src/debug/kdelibs-3.5.7/khtml/xml/ 478 0 26 0
+usr/src/debug/kdelibs-3.5.7/kimgio/ 198 0 17 0
+usr/src/debug/kdelibs-3.5.7/kinit/ 182 0 18 0
+usr/src/debug/kdelibs-3.5.7/kio/ 0 4866 0 488
+usr/src/debug/kdelibs-3.5.7/kio/bookmarks/ 300 0 40 0
+usr/src/debug/kdelibs-3.5.7/kio/httpfilter/ 25 0 3 0
+usr/src/debug/kdelibs-3.5.7/kio/kfile/ 1289 0 124 0
+usr/src/debug/kdelibs-3.5.7/kio/kio/ 2424 0 201 0
+usr/src/debug/kdelibs-3.5.7/kio/kioexec/ 14 0 3 0
+usr/src/debug/kdelibs-3.5.7/kio/kpasswdserver/ 35 0 4 0
+usr/src/debug/kdelibs-3.5.7/kio/kssl/ 354 0 54 0
+usr/src/debug/kdelibs-3.5.7/kio/misc/ 95 326 10 48
+usr/src/debug/kdelibs-3.5.7/kio/misc/kdesasl/ 14 0 2 0
+usr/src/debug/kdelibs-3.5.7/kio/misc/kfile/ 18 0 2 0
+usr/src/debug/kdelibs-3.5.7/kio/misc/kntlm/ 46 0 5 0
+usr/src/debug/kdelibs-3.5.7/kio/misc/kpac/ 63 0 14 0
+usr/src/debug/kdelibs-3.5.7/kio/misc/ksendbugmail/ 27 0 6 0
+usr/src/debug/kdelibs-3.5.7/kio/misc/kssld/ 50 0 4 0
+usr/src/debug/kdelibs-3.5.7/kio/misc/kwalletd/ 108 0 15 0
+usr/src/debug/kdelibs-3.5.7/kio/tests/ 4 0 1 0
+usr/src/debug/kdelibs-3.5.7/kioslave/ 0 500 0 29
+usr/src/debug/kdelibs-3.5.7/kioslave/bzip2/ 8 0 2 0
+usr/src/debug/kdelibs-3.5.7/kioslave/file/ 61 0 3 0
+usr/src/debug/kdelibs-3.5.7/kioslave/ftp/ 94 0 2 0
+usr/src/debug/kdelibs-3.5.7/kioslave/gzip/ 13 0 2 0
+usr/src/debug/kdelibs-3.5.7/kioslave/http/ 204 115 6 12
+usr/src/debug/kdelibs-3.5.7/kioslave/http/kcookiejar/ 115 0 12 0
+usr/src/debug/kdelibs-3.5.7/kioslave/metainfo/ 5 0 2 0
+usr/src/debug/kdelibs-3.5.7/kjs/ 748 0 69 0
+usr/src/debug/kdelibs-3.5.7/kmdi/ 460 138 38 39
+usr/src/debug/kdelibs-3.5.7/kmdi/kmdi/ 116 0 17 0
+usr/src/debug/kdelibs-3.5.7/kmdi/res/ 22 0 22 0
+usr/src/debug/kdelibs-3.5.7/knewstuff/ 182 0 31 0
+usr/src/debug/kdelibs-3.5.7/kparts/ 317 0 37 0
+usr/src/debug/kdelibs-3.5.7/kresources/ 123 0 26 0
+usr/src/debug/kdelibs-3.5.7/kspell2/ 92 275 23 36
+usr/src/debug/kdelibs-3.5.7/kspell2/plugins/ 0 204 0 19
+usr/src/debug/kdelibs-3.5.7/kspell2/plugins/aspell/ 14 0 5 0
+usr/src/debug/kdelibs-3.5.7/kspell2/plugins/ispell/ 190 0 14 0
+usr/src/debug/kdelibs-3.5.7/kspell2/ui/ 71 0 17 0
+usr/src/debug/kdelibs-3.5.7/kstyles/ 0 1078 0 46
+usr/src/debug/kdelibs-3.5.7/kstyles/highcolor/ 69 0 4 0
+usr/src/debug/kdelibs-3.5.7/kstyles/highcontrast/ 60 9 3 3
+usr/src/debug/kdelibs-3.5.7/kstyles/highcontrast/config/ 9 0 3 0
+usr/src/debug/kdelibs-3.5.7/kstyles/keramik/ 436 0 13 0
+usr/src/debug/kdelibs-3.5.7/kstyles/kthemestyle/ 203 0 8 0
+usr/src/debug/kdelibs-3.5.7/kstyles/light/ 112 0 7 0
+usr/src/debug/kdelibs-3.5.7/kstyles/plastik/ 167 18 4 3
+usr/src/debug/kdelibs-3.5.7/kstyles/plastik/config/ 18 0 3 0
+usr/src/debug/kdelibs-3.5.7/kstyles/utils/ 0 4 0 1
+usr/src/debug/kdelibs-3.5.7/kstyles/utils/installtheme/ 4 0 1 0
+usr/src/debug/kdelibs-3.5.7/kunittest/ 61 0 7 0
+usr/src/debug/kdelibs-3.5.7/kutils/ 374 66 42 12
+usr/src/debug/kdelibs-3.5.7/kutils/ksettings/ 66 0 12 0
+usr/src/debug/kdelibs-3.5.7/kwallet/ 0 110 0 18
+usr/src/debug/kdelibs-3.5.7/kwallet/backend/ 68 0 13 0
+usr/src/debug/kdelibs-3.5.7/kwallet/client/ 42 0 5 0
+usr/src/debug/kdelibs-3.5.7/libkmid/ 250 0 32 0
+usr/src/debug/kdelibs-3.5.7/libkscreensaver/ 25 0 5 0
+usr/src/debug/kdelibs-3.5.7/libltdl/ 79 0 2 0
+usr/src/debug/kdelibs-3.5.7/networkstatus/ 63 0 20 0
+usr/src/debug/kdelibs-3.5.7/pics/ 1 0 1 0
+-Dir:
+##----------------------------------------
+=Pkg: kdelibs3-devel 3.5.7 24 i586
++Dir:
+/ 0 7141 0 791
+etc/ 0 5 0 1
+etc/opt/ 0 5 0 1
+etc/opt/kde3/ 5 0 1 0
+opt/ 0 7136 0 790
+opt/kde3/ 0 7136 0 790
+opt/kde3/bin/ 130 0 7 0
+opt/kde3/include/ 4111 1867 415 289
+opt/kde3/include/arts/ 59 0 10 0
+opt/kde3/include/dnssd/ 30 0 7 0
+opt/kde3/include/dom/ 420 0 29 0
+opt/kde3/include/kabc/ 202 0 43 0
+opt/kde3/include/kate/ 22 0 2 0
+opt/kde3/include/kdemm/ 26 0 7 0
+opt/kde3/include/kdeprint/ 63 8 14 3
+opt/kde3/include/kdeprint/lpr/ 8 0 3 0
+opt/kde3/include/kdesu/ 25 0 8 0
+opt/kde3/include/khexedit/ 26 0 5 0
+opt/kde3/include/kio/ 332 0 37 0
+opt/kde3/include/kjs/ 120 0 17 0
+opt/kde3/include/kmdi/ 16 0 4 0
+opt/kde3/include/kmediaplayer/ 11 0 3 0
+opt/kde3/include/knewstuff/ 47 0 10 0
+opt/kde3/include/kparts/ 125 0 14 0
+opt/kde3/include/kresources/ 43 0 9 0
+opt/kde3/include/ksettings/ 20 0 4 0
+opt/kde3/include/kspell2/ 32 0 10 0
+opt/kde3/include/ktexteditor/ 97 0 33 0
+opt/kde3/include/kunittest/ 43 0 3 0
+opt/kde3/include/libkmid/ 100 0 17 0
+opt/kde3/lib/ 84 0 43 0
+opt/kde3/share/ 0 944 0 36
+opt/kde3/share/apps/ 0 944 0 36
+opt/kde3/share/apps/dcopidlng/ 82 0 7 0
+opt/kde3/share/apps/kdelibs/ 0 862 0 29
+opt/kde3/share/apps/kdelibs/admin/ 862 0 29 0
+-Dir:
+##----------------------------------------
+=Pkg: kdelibs3-doc 3.5.7 24 i586
++Dir:
+/ 0 6378 0 1199
+etc/ 0 1 0 1
+etc/xml/ 1 0 1 0
+opt/ 0 6377 0 1198
+opt/kde3/ 0 6377 0 1198
+opt/kde3/bin/ 43 0 1 0
+opt/kde3/share/ 0 6334 0 1197
+opt/kde3/share/apps/ 0 6003 0 1145
+opt/kde3/share/apps/ksgmltools2/ 0 6003 0 1145
+opt/kde3/share/apps/ksgmltools2/customization/ 66 940 16 487
+opt/kde3/share/apps/ksgmltools2/customization/af/ 7 9 4 9
+opt/kde3/share/apps/ksgmltools2/customization/af/entities/ 9 0 9 0
+opt/kde3/share/apps/ksgmltools2/customization/bg/ 5 0 2 0
+opt/kde3/share/apps/ksgmltools2/customization/ca/ 11 14 4 13
+opt/kde3/share/apps/ksgmltools2/customization/ca/entities/ 14 0 13 0
+opt/kde3/share/apps/ksgmltools2/customization/cs/ 7 1 3 1
+opt/kde3/share/apps/ksgmltools2/customization/cs/entities/ 1 0 1 0
+opt/kde3/share/apps/ksgmltools2/customization/da/ 11 14 4 13
+opt/kde3/share/apps/ksgmltools2/customization/da/entities/ 14 0 13 0
+opt/kde3/share/apps/ksgmltools2/customization/de/ 11 19 4 14
+opt/kde3/share/apps/ksgmltools2/customization/de/entities/ 19 0 14 0
+opt/kde3/share/apps/ksgmltools2/customization/dtd/ 19 0 4 0
+opt/kde3/share/apps/ksgmltools2/customization/el/ 5 1 2 1
+opt/kde3/share/apps/ksgmltools2/customization/el/entities/ 1 0 1 0
+opt/kde3/share/apps/ksgmltools2/customization/en-GB/ 7 2 3 1
+opt/kde3/share/apps/ksgmltools2/customization/en-GB/entities/ 2 0 1 0
+opt/kde3/share/apps/ksgmltools2/customization/en/ 9 2 4 2
+opt/kde3/share/apps/ksgmltools2/customization/en/entities/ 2 0 2 0
+opt/kde3/share/apps/ksgmltools2/customization/entities/ 76 0 3 0
+opt/kde3/share/apps/ksgmltools2/customization/es/ 10 14 4 13
+opt/kde3/share/apps/ksgmltools2/customization/es/entities/ 14 0 13 0
+opt/kde3/share/apps/ksgmltools2/customization/et/ 9 14 4 13
+opt/kde3/share/apps/ksgmltools2/customization/et/entities/ 14 0 13 0
+opt/kde3/share/apps/ksgmltools2/customization/fi/ 7 4 4 4
+opt/kde3/share/apps/ksgmltools2/customization/fi/entities/ 4 0 4 0
+opt/kde3/share/apps/ksgmltools2/customization/fo/ 7 14 4 9
+opt/kde3/share/apps/ksgmltools2/customization/fo/entities/ 14 0 9 0
+opt/kde3/share/apps/ksgmltools2/customization/fr/ 51 15 4 13
+opt/kde3/share/apps/ksgmltools2/customization/fr/entities/ 15 0 13 0
+opt/kde3/share/apps/ksgmltools2/customization/he/ 8 17 4 12
+opt/kde3/share/apps/ksgmltools2/customization/he/entities/ 17 0 12 0
+opt/kde3/share/apps/ksgmltools2/customization/hu/ 7 6 3 5
+opt/kde3/share/apps/ksgmltools2/customization/hu/entities/ 6 0 5 0
+opt/kde3/share/apps/ksgmltools2/customization/id/ 6 4 3 3
+opt/kde3/share/apps/ksgmltools2/customization/id/entities/ 4 0 3 0
+opt/kde3/share/apps/ksgmltools2/customization/it/ 10 18 4 13
+opt/kde3/share/apps/ksgmltools2/customization/it/entities/ 18 0 13 0
+opt/kde3/share/apps/ksgmltools2/customization/ja/ 6 0 3 0
+opt/kde3/share/apps/ksgmltools2/customization/ko/ 6 7 3 7
+opt/kde3/share/apps/ksgmltools2/customization/ko/entities/ 7 0 7 0
+opt/kde3/share/apps/ksgmltools2/customization/lt/ 5 0 2 0
+opt/kde3/share/apps/ksgmltools2/customization/nl/ 23 16 4 13
+opt/kde3/share/apps/ksgmltools2/customization/nl/entities/ 16 0 13 0
+opt/kde3/share/apps/ksgmltools2/customization/nn/ 11 14 4 11
+opt/kde3/share/apps/ksgmltools2/customization/nn/entities/ 14 0 11 0
+opt/kde3/share/apps/ksgmltools2/customization/no/ 7 14 4 13
+opt/kde3/share/apps/ksgmltools2/customization/no/entities/ 14 0 13 0
+opt/kde3/share/apps/ksgmltools2/customization/obsolete/ 36 0 5 0
+opt/kde3/share/apps/ksgmltools2/customization/pl/ 20 13 4 12
+opt/kde3/share/apps/ksgmltools2/customization/pl/entities/ 13 0 12 0
+opt/kde3/share/apps/ksgmltools2/customization/pt-BR/ 9 14 4 13
+opt/kde3/share/apps/ksgmltools2/customization/pt-BR/entities/ 14 0 13 0
+opt/kde3/share/apps/ksgmltools2/customization/pt/ 12 13 5 12
+opt/kde3/share/apps/ksgmltools2/customization/pt/entities/ 13 0 12 0
+opt/kde3/share/apps/ksgmltools2/customization/ro/ 11 14 4 13
+opt/kde3/share/apps/ksgmltools2/customization/ro/entities/ 14 0 13 0
+opt/kde3/share/apps/ksgmltools2/customization/ru/ 9 15 4 11
+opt/kde3/share/apps/ksgmltools2/customization/ru/entities/ 15 0 11 0
+opt/kde3/share/apps/ksgmltools2/customization/sk/ 7 12 3 11
+opt/kde3/share/apps/ksgmltools2/customization/sk/entities/ 12 0 11 0
+opt/kde3/share/apps/ksgmltools2/customization/sl/ 8 12 4 11
+opt/kde3/share/apps/ksgmltools2/customization/sl/entities/ 12 0 11 0
+opt/kde3/share/apps/ksgmltools2/customization/sr/ 40 18 4 12
+opt/kde3/share/apps/ksgmltools2/customization/sr/entities/ 18 0 12 0
+opt/kde3/share/apps/ksgmltools2/customization/sv/ 7 13 4 12
+opt/kde3/share/apps/ksgmltools2/customization/sv/entities/ 13 0 12 0
+opt/kde3/share/apps/ksgmltools2/customization/tr/ 5 13 2 9
+opt/kde3/share/apps/ksgmltools2/customization/tr/entities/ 13 0 9 0
+opt/kde3/share/apps/ksgmltools2/customization/uk/ 9 0 4 0
+opt/kde3/share/apps/ksgmltools2/customization/wa/ 5 0 2 0
+opt/kde3/share/apps/ksgmltools2/customization/xh/ 5 0 2 0
+opt/kde3/share/apps/ksgmltools2/customization/xsl/ 28 0 28 0
+opt/kde3/share/apps/ksgmltools2/customization/xx/ 5 0 2 0
+opt/kde3/share/apps/ksgmltools2/customization/zh-CN/ 7 8 3 5
+opt/kde3/share/apps/ksgmltools2/customization/zh-CN/entities/ 8 0 5 0
+opt/kde3/share/apps/ksgmltools2/customization/zh-TW/ 7 5 3 5
+opt/kde3/share/apps/ksgmltools2/customization/zh-TW/entities/ 5 0 5 0
+opt/kde3/share/apps/ksgmltools2/docbook/ 1 4996 1 641
+opt/kde3/share/apps/ksgmltools2/docbook/xml-dtd-4.1.2/ 311 67 13 19
+opt/kde3/share/apps/ksgmltools2/docbook/xml-dtd-4.1.2/ent/ 67 0 19 0
+opt/kde3/share/apps/ksgmltools2/docbook/xml-dtd-4.2/ 321 0 11 0
+opt/kde3/share/apps/ksgmltools2/docbook/xsl/ 31 4266 6 592
+opt/kde3/share/apps/ksgmltools2/docbook/xsl/common/ 2232 0 60 0
+opt/kde3/share/apps/ksgmltools2/docbook/xsl/html/ 1291 0 58 0
+opt/kde3/share/apps/ksgmltools2/docbook/xsl/images/ 58 31 29 31
+opt/kde3/share/apps/ksgmltools2/docbook/xsl/images/callouts/ 31 0 31 0
+opt/kde3/share/apps/ksgmltools2/docbook/xsl/lib/ 70 0 4 0
+opt/kde3/share/apps/ksgmltools2/docbook/xsl/manpages/ 43 0 7 0
+opt/kde3/share/apps/ksgmltools2/docbook/xsl/params/ 541 0 403 0
+opt/kde3/share/doc/ 0 331 0 52
+opt/kde3/share/doc/HTML/ 0 331 0 52
+opt/kde3/share/doc/HTML/en/ 0 331 0 52
+opt/kde3/share/doc/HTML/en/common/ 320 0 50 0
+opt/kde3/share/doc/HTML/en/kspell/ 11 0 2 0
+-Dir:
+##----------------------------------------
\ No newline at end of file
--- /dev/null
+##----------------------------------------
+=Pkg: kdelibs3 3.5.7 24 i586
+=Sum: KDE Base Libraries
++Des:
+<!-- DT:Rich -->
+<p>This package contains kdelibs, one of the basic packages of the K
+Desktop Environment. It contains the necessary libraries for the KDE desktop.
+</p><p>
+This package is absolutely necessary for using KDE.
+</p>
+-Des:
+##----------------------------------------
+=Pkg: kdelibs3-arts 3.5.7 24 i586
+=Sum: KDE aRts support
++Des:
+<!-- DT:Rich -->
+<p>This package contains bindings and gui elements for using aRts sound daemon.
+</p>
+-Des:
+##----------------------------------------
+=Pkg: kdelibs3-debuginfo 3.5.7 24 i586
+=Sum: KDE Base Libraries
++Des:
+<!-- DT:Rich -->
+<p>This package contains kdelibs, one of the basic packages of the K
+Desktop Environment. It contains the necessary libraries for the KDE desktop.
+</p><p>
+This package is absolutely necessary for using KDE.
+</p>
+-Des:
+##----------------------------------------
+=Pkg: kdelibs3-devel 3.5.7 24 i586
+=Sum: KDE Base Package: Build Environment
++Des:
+<!-- DT:Rich -->
+<p>This package contains all necessary include files and libraries needed to develop applications that require these.
+</p>
+-Des:
+##----------------------------------------
+=Pkg: kdelibs3-doc 3.5.7 24 i586
+=Sum: Documentation for KDE Base Libraries
++Des:
+<!-- DT:Rich -->
+<p>This package contains the core environment and templates for the KDE help system.
+</p>
+-Des:
+##----------------------------------------
--- /dev/null
+##----------------------------------------
+=Pkg: kdelibs3 3.5.7 24 i586
+=Sum: KDE Base Libraries
++Des:
+<!-- DT:Rich -->
+<p>This package contains kdelibs, one of the basic packages of the K
+Desktop Environment. It contains the necessary libraries for the KDE desktop.
+</p><p>
+This package is absolutely necessary for using KDE.
+</p>
+-Des:
+##----------------------------------------
+=Pkg: kdelibs3-arts 3.5.7 24 i586
+=Sum: KDE aRts support
++Des:
+<!-- DT:Rich -->
+<p>This package contains bindings and gui elements for using aRts sound daemon.
+</p>
+-Des:
+##----------------------------------------
+=Pkg: kdelibs3-debuginfo 3.5.7 24 i586
+=Sum: KDE Base Libraries
++Des:
+<!-- DT:Rich -->
+<p>This package contains kdelibs, one of the basic packages of the K
+Desktop Environment. It contains the necessary libraries for the KDE desktop.
+</p><p>
+This package is absolutely necessary for using KDE.
+</p>
+-Des:
+##----------------------------------------
+=Pkg: kdelibs3-devel 3.5.7 24 i586
+=Sum: Paquete básico de KDE: entorno de desarrollo
++Des:
+<!-- DT:Rich -->
+<p>Este paquete contiene todas las librerías y archivos include necesarios para desarrollar aplicaciones que los requieran.
+</p>
+-Des:
+##----------------------------------------
+=Pkg: kdelibs3-doc 3.5.7 24 i586
+=Sum: Documentación para las bibliotecas básicas de KDE
++Des:
+<!-- DT:Rich -->
+<p>Este paquete contiene el entorno central y las plantillas para el sistema de ayuda de KDE.
+</p>
+-Des:
+##----------------------------------------
--- /dev/null
+kde-10.3-71.i586.pat
+
TARGET_LINK_LIBRARIES(PtrTypes zypp )
ADD_EXECUTABLE(TranslatedText TranslatedText.cc)
-TARGET_LINK_LIBRARIES(TranslatedText zypp )
+TARGET_LINK_LIBRARIES(TranslatedText zypp boost_unit_test_framework)
ADD_EXECUTABLE(CheckSum CheckSum.cc)
TARGET_LINK_LIBRARIES(CheckSum zypp boost_unit_test_framework )
ADD_EXECUTABLE( RepoInfo RepoInfo_test.cc )
TARGET_LINK_LIBRARIES( RepoInfo zypp boost_unit_test_framework )
+ADD_EXECUTABLE( ProgressData ProgressData_test.cc )
+TARGET_LINK_LIBRARIES( ProgressData zypp boost_unit_test_framework )
+
ADD_TEST(ArchTest ${CMAKE_CURRENT_BINARY_DIR}/Arch)
ADD_TEST(UrlTest ${CMAKE_CURRENT_BINARY_DIR}/Url)
ADD_TEST(Edition ${CMAKE_CURRENT_BINARY_DIR}/Edition)
ADD_TEST(RepoManagerTest ${CMAKE_CURRENT_BINARY_DIR}/RepoManager ${CMAKE_CURRENT_SOURCE_DIR}/data/RepoManager)
ADD_TEST(RepoInfoTest ${CMAKE_CURRENT_BINARY_DIR}/RepoInfo ${CMAKE_CURRENT_SOURCE_DIR}/data/RepoInfo)
ADD_TEST(FetcherTest ${CMAKE_CURRENT_BINARY_DIR}/Fetcher)
+ADD_TEST(ProgressData_test ${CMAKE_CURRENT_BINARY_DIR}/ProgressData)
using std::endl;
using std::string;
using namespace zypp;
-using namespace zypp::media;
using namespace boost::unit_test;
-class SimpleVerifier : public zypp::media::MediaVerifierBase
+class SimpleVerifier : public media::MediaVerifierBase
{
public:
// provide file from invalid media
BOOST_CHECK_THROW(setaccess.provideFile("/test.txt", 2),
- zypp::media::MediaNotDesiredException);
+ media::MediaNotDesiredException);
// provide file from media3
Pathname file3 = setaccess.provideFile("/test.txt", 3);
// provide file from media
Pathname file = setaccess.provideFile("/test.txt", 1);
BOOST_CHECK(check_file_exists(file) == true);
+
+ // provide non-existent file
+ // (default answer from callback should be ABORT)
+ BOOST_CHECK_THROW(setaccess.provideFile("/imnothere", 2),
+ media::MediaFileNotFoundException);
+}
+
+/*
+ * Provide directory from src/cd1.
+ */
+void msa_provide_dir(const string &urlstr)
+{
+ Url url(urlstr);
+ MediaSetAccess setaccess(url);
+
+ Pathname dir = setaccess.provideDir("/dir", false, 1);
+
+ Pathname file1 = dir + "/file1";
+ BOOST_CHECK(check_file_exists(file1) == true);
+
+ Pathname file2 = dir + "/file2";
+ BOOST_CHECK(check_file_exists(file2) == true);
+
+ // provide non-existent dir
+ // (default answer from callback should be ABORT)
+ BOOST_CHECK_THROW(setaccess.provideDir("/imnothere", 2),
+ media::MediaFileNotFoundException);
+
+ // This can't be properly tested with 'dir' schema, probably only curl
+ // schemas (http, ftp) where download is actually needed.
+ // Other schemas just get mounted onto a local dir and the whole subtree
+ // is automatically available that way.
+ // BOOST_CHECK(check_file_exists(dir + "/subdir/file") == false);
+ // BOOST_CHECK(check_file_exists(dir + "/subdir") == false);
+}
+
+
+/*
+ * Provide directory from src/cd1 (recursively).
+ */
+void msa_provide_dirtree(const string &urlstr)
+{
+ Url url(urlstr);
+ MediaSetAccess setaccess(url);
+
+ Pathname dir = setaccess.provideDir("/dir", true, 1);
+
+ Pathname file1 = dir + "/file1";
+ BOOST_CHECK(check_file_exists(file1) == true);
+
+ Pathname file2 = dir + "/file2";
+ BOOST_CHECK(check_file_exists(file2) == true);
+
+ Pathname file3 = dir + "/subdir/file";
+ BOOST_CHECK(check_file_exists(file3) == true);
}
*
* test data dir structure:
*
- * src1/
- * src1/cd1/
- * src1/cd1/test.txt
- * src1/cd1/.media1
- * src1/cd2/
- * src1/cd2/test.txt
- * src1/cd2/.mediabad
- * src1/cd3/
- * src1/cd3/test.txt
- * src1/cd3/.media3
- * src2
- * src2/test.txt
- * src2/.media
+ * .
+ * |-- src1
+ * | |-- cd1
+ * | | |-- dir
+ * | | | |-- file1
+ * | | | |-- file2
+ * | | | `-- subdir
+ * | | | `-- file
+ * | | `-- test.txt
+ * | |-- cd2
+ * | | `-- test.txt
+ * | `-- cd3
+ * | `-- test.txt
+ * `-- src2
+ * `-- test.txt
*
*/
if (argc < 2)
{
cout << "mediasetaccesstest:"
- " path to directory with test data required as parameter" << endl;
+ " absolute path to local directory with test data required as parameter"
+ << endl;
return (test_suite *)0;
}
test->add(BOOST_PARAM_TEST_CASE(&msa_provide_files_single,
(std::string const*)params_single, params_single+1));
+ // provide directory
+ test->add(BOOST_PARAM_TEST_CASE(&msa_provide_dir,
+ (std::string const*)params, params+1));
+
+ // provide directory tree
+ test->add(BOOST_PARAM_TEST_CASE(&msa_provide_dirtree,
+ (std::string const*)params, params+1));
+
return test;
}
--- /dev/null
+
+#include <iostream>
+#include <fstream>
+#include <list>
+#include <string>
+
+#include "zypp/base/Logger.h"
+#include "zypp/base/Exception.h"
+
+#include <boost/test/unit_test.hpp>
+#include <boost/test/parameterized_test.hpp>
+#include <boost/test/unit_test_log.hpp>
+
+#include "zypp/ProgressData.h"
+
+using boost::unit_test::test_suite;
+using boost::unit_test::test_case;
+using namespace boost::unit_test::log;
+
+using namespace std;
+using namespace zypp;
+
+void progressdata_test()
+{
+ {
+ ProgressData progress(100);
+ CombinedProgressData sub1rcv(progress, 80);
+
+ ProgressData sub1progress(100);
+ sub1progress.sendTo(sub1rcv);
+
+ // task 1 goes to 50%
+ sub1progress.set(50);
+ // which is 50% of 80% in task 1
+ BOOST_CHECK_EQUAL( progress.val(), 40 );
+ }
+
+ {
+ ProgressData progress(40000);
+ CombinedProgressData sub2rcv(progress, 10000);
+
+ ProgressData sub2progress(500);
+ sub2progress.sendTo(sub2rcv);
+ sub2progress.set(250);
+
+ // which is 50% of 80% in task 1
+ BOOST_CHECK_EQUAL( progress.val(), 5000 );
+ }
+
+ {
+ ProgressData progress(20000,60000);
+ CombinedProgressData sub2rcv(progress, 10000);
+
+ ProgressData sub2progress(500);
+ sub2progress.sendTo(sub2rcv);
+ sub2progress.set(250);
+
+ // which is 50% of 80% in task 1
+ BOOST_CHECK_EQUAL( progress.val(), 25000 );
+ }
+
+}
+
+test_suite*
+init_unit_test_suite( int argc, char* argv[] )
+{
+ test_suite* test= BOOST_TEST_SUITE( "ProgressData_test" );
+ test->add( BOOST_TEST_CASE( &progressdata_test ), 0 /* expected zero error */ );
+ return test;
+}
+
#include "zypp/PublicKey.h"
#include "zypp/TmpPath.h"
#include "zypp/ResStore.h"
+#include "zypp/PathInfo.h"
#include "zypp/RepoManager.h"
#include "zypp/ZYppFactory.h"
#include "zypp/ZYpp.h"
+// Boost.Test
+#include <boost/test/floating_point_comparison.hpp>
+#include <boost/test/unit_test.hpp>
+
+using boost::unit_test::test_suite;
+using boost::unit_test::test_case;
+using boost::test_tools::close_at_tolerance;
+
using namespace std;
using namespace zypp;
-int main( int argc, char * argv[] )
+void test_tt()
{
ZYpp::Ptr god;
- try {
- god = getZYpp();
- }
- catch( const Exception &e )
- {
- return 99;
- }
+ god = getZYpp();
TranslatedText testTT;
MIL << "Locale: en" << std::endl;
god->setTextLocale(Locale("en"));
testTT.setText("default");
- if ( testTT.text() != "default" )
- return 2;
+ MIL << "value: '" << testTT.text() << "'" << std::endl;
+ BOOST_CHECK_EQUAL( testTT.text(), "default" );
testTT.setText("default english", Locale("en"));
- if ( testTT.text() != "default english" )
- return 3;
+ BOOST_CHECK_EQUAL( testTT.text(), "default english" );
MIL << "Locale: es_ES" << std::endl;
god->setTextLocale(Locale("es_ES"));
- if ( testTT.text() != "default english" )
- {
- ERR << testTT.text() << std::endl;
- return 4;
- }
+ BOOST_CHECK_EQUAL( testTT.text(), "default english" );
testTT.setText("hola esto es neutro", Locale("es"));
testTT.setText("this is neutral", Locale("en"));
- if ( testTT.text() != "hola esto es neutro" )
- return 5;
+ BOOST_CHECK_EQUAL( testTT.text(), "hola esto es neutro" );
testTT.setText("hola Spain", Locale("es_ES"));
- if ( testTT.text() != "hola Spain" )
- return 6;
+ BOOST_CHECK_EQUAL( testTT.text(), "hola Spain" );
MIL << "Locale: null" << std::endl;
god->setTextLocale(Locale());
- if ( testTT.text() != "default" )
- {
- ERR << testTT.text() << std::endl;
- return 7;
- }
-
- return 0;
+ BOOST_CHECK_EQUAL( testTT.text(), "default" );
}
+
+test_suite*
+init_unit_test_suite( int, char* [] )
+{
+ test_suite* test= BOOST_TEST_SUITE( "TranslatedText" );
+ test->add( BOOST_TEST_CASE( &test_tt ), 0 /* expected zero error */ );
+ return test;
+}
\ No newline at end of file
--- /dev/null
+this is a file from dir
--- /dev/null
+Occifer! I'm not as think as you stoned I am!
--- /dev/null
+this is a file from subdir
-ADD_SUBDIRECTORY( registration )
+#ADD_SUBDIRECTORY( registration )
ADD_SUBDIRECTORY( package-manager )
ADD_SUBDIRECTORY( cachetools )
\ No newline at end of file
#include <zypp/ZYpp.h>
#include <zypp/zypp_detail/ZYppReadOnlyHack.h>
#include <zypp/ZYppFactory.h>
-#include <zypp/SourceManager.h>
+#include <zypp/RepoManager.h>
#include <zypp/base/Logger.h>
#include <zypp/base/Exception.h>
#include <zypp/base/Algorithm.h>
MIL << "query_pool kind '" << kind << "', repository '" << repository << "'" << endl;
- SourceManager_Ptr manager = SourceManager::sourceManager();
+ RepoManager manager;
if (!system)
{
ADD_DEFINITIONS(-DLOCALEDIR=\\\"/usr/share/libzypp\\\" -DTEXTDOMAIN=\\\"zypp\\\" )
-IF(ZYPP_REFACTORING)
- ADD_DEFINITIONS(-DZYPP_REFACTORING)
-ENDIF(ZYPP_REFACTORING)
-
ADD_EXECUTABLE(mkarray ${CMAKE_SOURCE_DIR}/zypp/cache/schema/mkarray.c )
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
#FILE(WRITE filename "message to write"... )
Package.cc
Pathname.cc
ProgressData.cc
- Source.cc
- SourceFactory.cc
- SourceManager.cc
- SourceCache.cc
- SourceFeed.cc
SrcPackage.cc
SysContent.cc
Target.cc
RepoInfo.cc
RepoStatus.cc
RepoManager.cc
- RepositoryFactory.cc
+ MediaProducts.cc
)
SET( zypp_HEADERS
Selection.h
Signature.h
SilentCallbacks.h
- Source.h
- SourceCache.h
- SourceFactory.h
- SourceFeed.h
- SourceManager.h
SrcPackage.h
SysContent.h
SystemResObject.h
RepoInfo.h
RepoStatus.h
RepoManager.h
- RepositoryFactory.h
+ MediaProducts.h
)
INSTALL( FILES ${zypp_HEADERS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/zypp" )
)
SET( zypp_base_HEADERS
+ base/Easy.h
base/Random.h
base/Algorithm.h
base/Counter.h
parser/IniParser.cc
parser/IniDict.cc
parser/LibXMLHelper.cc
- parser/SAXParser.cc
parser/XMLNodeIterator.cc
parser/RepoFileReader.cc
)
parser/IniDict.h
parser/LibXMLHelper.h
parser/ParserProgress.h
- parser/SAXParser.h
parser/XMLNodeIterator.h
parser/xml_parser_assert.h
parser/RepoFileReader.h
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/parser/susetags
)
-SET( zypp_parser_tagfile_SRCS
- parser/tagfile/TagFileParser.cc
+SET( zypp_parser_plaindir_SRCS
+ parser/plaindir/RepoParser.cc
)
-SET( zypp_parser_tagfile_HEADERS
- parser/tagfile/TagFileParser.h
+SET( zypp_parser_plaindir_HEADERS
+ parser/plaindir/RepoParser.h
)
INSTALL( FILES
- ${zypp_parser_tagfile_HEADERS}
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/parser/tagfile
+ ${zypp_parser_plaindir_HEADERS}
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/parser/plaindir
)
SET( zypp_parser_xml_SRCS
)
SET( zypp_parser_yum_SRCS
- parser/yum/YUMFileListParser.cc
- parser/yum/YUMGroupParser.cc
- parser/yum/YUMOtherParser.cc
- parser/yum/YUMParserData.cc
- parser/yum/YUMPatchParser.cc
- parser/yum/YUMPatchesParser.cc
- parser/yum/YUMPatternParser.cc
- parser/yum/YUMPrimaryParser.cc
- parser/yum/YUMProductParser.cc
- parser/yum/YUMRepomdParser.cc
parser/yum/RepoParser.cc
parser/yum/FileReaderBaseImpl.cc
parser/yum/RepomdFileReader.cc
)
SET( zypp_parser_yum_HEADERS
- parser/yum/YUMFileListParser.h
- parser/yum/YUMGroupParser.h
- parser/yum/YUMOtherParser.h
- parser/yum/YUMParser.h
- parser/yum/YUMParserData.h
- parser/yum/YUMPatchParser.h
- parser/yum/YUMPatchesParser.h
- parser/yum/YUMPatternParser.h
- parser/yum/YUMPrimaryParser.h
- parser/yum/YUMProductParser.h
- parser/yum/YUMRepomdParser.h
parser/yum/RepoParser.h
parser/yum/RepoParserOpts.h
parser/yum/FileReaderBase.h
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/parser/yum
)
-INSTALL( FILES
- ${zypp_parser_yum2_HEADERS}
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/parser/yum2
-)
-
SET( zypp_pool_SRCS
pool/GetResolvablesToInsDel.cc
pool/PoolImpl.cc
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/solver/detail
)
-SET( zypp_source_SRCS
- source/Applydeltarpm.cc
- source/MediaSet.cc
- source/PackageDelta.cc
- source/PackageProvider.cc
- source/SourceImpl.cc
- source/SourceInfo.cc
- source/SourceProvideFile.cc
- source/SUSEMediaVerifier.cc
-)
-
-SET( zypp_source_HEADERS
- source/Applydeltarpm.h
- source/Builtin.h
- source/MediaSet.h
- source/PackageDelta.h
- source/PackageProvider.h
- source/SourceImpl.h
- source/SourceInfo.h
- source/SourceProvideFile.h
- source/SUSEMediaVerifier.h
-)
-
-INSTALL( FILES
- ${zypp_source_HEADERS}
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/source
-)
-
-SET( zypp_source_plaindir_SRCS
- source/plaindir/PlaindirImpl.cc
-)
-
-SET( zypp_source_plaindir_HEADERS
- source/plaindir/PlaindirImpl.h
-)
-
-INSTALL( FILES
- ${zypp_source_plaindir_HEADERS}
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/source/plaindir
-)
-
-SET( zypp_source_susetags_SRCS
- source/susetags/MediaMetadataParser.cc
- source/susetags/MediaPatchesMetadataParser.cc
- source/susetags/PackagesLangParser.cc
- source/susetags/PackagesParser.cc
- source/susetags/PatternTagFileParser.cc
- source/susetags/ProductMetadataParser.cc
- source/susetags/SelectionTagFileParser.cc
- source/susetags/SuseTagsImpl.cc
- source/susetags/SuseTagsPackageImpl.cc
- source/susetags/SuseTagsPatternImpl.cc
- source/susetags/SuseTagsProductImpl.cc
- source/susetags/SuseTagsSelectionImpl.cc
- source/susetags/SuseTagsSrcPackageImpl.cc
-)
-
-SET( zypp_source_susetags_HEADERS
- source/susetags/MediaMetadataParser.h
- source/susetags/MediaPatchesMetadataParser.h
- source/susetags/PackagesLangParser.h
- source/susetags/PackagesParser.h
- source/susetags/PatternTagFileParser.h
- source/susetags/ProductMetadataParser.h
- source/susetags/SelectionTagFileParser.h
- source/susetags/SuseTagsImpl.h
- source/susetags/SuseTagsPackageImpl.h
- source/susetags/SuseTagsPatternImpl.h
- source/susetags/SuseTagsProductImpl.h
- source/susetags/SuseTagsSelectionImpl.h
- source/susetags/SuseTagsSrcPackageImpl.h
-)
-
-INSTALL( FILES
- ${zypp_source_susetags_HEADERS}
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/source/susetags
-)
-
-SET( zypp_source_yum_SRCS
- source/yum/YUMAtomImpl.cc
- source/yum/YUMGroupImpl.cc
- source/yum/YUMMessageImpl.cc
- source/yum/YUMPackageImpl.cc
- source/yum/YUMPatchImpl.cc
- source/yum/YUMPatternImpl.cc
- source/yum/YUMProductImpl.cc
- source/yum/YUMScriptImpl.cc
- source/yum/YUMSourceImpl.cc
-)
-
-SET( zypp_source_yum_HEADERS
- source/yum/YUMAtomImpl.h
- source/yum/YUMGroupImpl.h
- source/yum/YUMMessageImpl.h
- source/yum/YUMPackageImpl.h
- source/yum/YUMPatchImpl.h
- source/yum/YUMPatternImpl.h
- source/yum/YUMProductImpl.h
- source/yum/YUMScriptImpl.h
- source/yum/YUMSourceImpl.h
-)
-
-INSTALL( FILES
- ${zypp_source_yum_HEADERS}
- DESTINATION ${CMAKE_INSTALL_PREFIX}/include/zypp/source/yum
-)
-
SET( zypp_target_SRCS
target/CommitLog.cc
target/CommitPackageCache.cc
${CMAKE_BINARY_DIR}/zypp/sqlite-schema.h
cache/CacheInitializer.cc
cache/CacheException.cc
+ cache/Attribute.cc
cache/CacheTypes.cc
cache/ResolvableQuery.cc
cache/CacheStore.cc
)
SET( zypp_cache_HEADERS
+ cache/Attribute.h
+ cache/CacheAttributes.h
cache/CacheTypes.h
cache/CacheInitializer.h
cache/CacheException.h
repo/PackageProvider.cc
repo/RepoProvideFile.cc
repo/DeltaCandidates.cc
+ repo/Applydeltarpm.cc
+ repo/PackageDelta.cc
+ repo/SUSEMediaVerifier.cc
)
SET( zypp_repo_HEADERS
repo/PackageProvider.h
repo/RepoProvideFile.h
repo/DeltaCandidates.h
+ repo/Applydeltarpm.h
+ repo/PackageDelta.h
+ repo/SUSEMediaVerifier.h
)
INSTALL( FILES
SET( zypp_repo_cached_SRCS
repo/cached/RepoImpl.cc
repo/cached/PackageImpl.cc
+ repo/cached/SrcPackageImpl.cc
repo/cached/PatchImpl.cc
repo/cached/PatternImpl.cc
repo/cached/ProductImpl.cc
SET( zypp_repo_cached_HEADERS
repo/cached/RepoImpl.h
repo/cached/PackageImpl.h
+ repo/cached/SrcPackageImpl.h
repo/cached/PatchImpl.h
repo/cached/PatternImpl.h
repo/cached/ProductImpl.h
SET( zypp_repo_data_SRCS
+ repo/memory/ScriptImpl.cc
+ repo/memory/MessageImpl.cc
repo/memory/PackageImpl.cc
repo/memory/PatternImpl.cc
repo/memory/ProductImpl.cc
${zypp_cache_SRCS}
${zypp_cache_sqlite3x_SRCS}
${zypp_pool_SRCS}
-${zypp_parser_tagfile_SRCS}
${zypp_parser_susetags_SRCS}
-${zypp_parser_yum2_SRCS}
${zypp_parser_xmlstore_SRCS}
${zypp_parser_xml_SRCS}
${zypp_parser_yum_SRCS}
+${zypp_parser_plaindir_SRCS}
${zypp_parser_SRCS}
-${zypp_source_plaindir_SRCS}
-${zypp_source_yum_SRCS}
-${zypp_source_susetags_SRCS}
-${zypp_source_SRCS}
${zypp_data_SRCS}
${zypp_media_proxyinfo_SRCS}
${zypp_media_SRCS}
)
SET( zypp_lib_HEADERS
-${zypp_source_plaindir_HEADERS}
${zypp_target_store_xml_HEADERS}
+${zypp_target_rpm_HEADERS}
${zypp_parser_tagfile_HEADERS}
${zypp_parser_susetags_HEADERS}
-${zypp_target_rpm_HEADERS}
-${zypp_parser_yum2_HEADERS}
+${zypp_parser_yum_HEADERS}
+${zypp_parser_plaindir_HEADERS}
+${zypp_parser_xml_HEADERS}
+${zypp_parser_HEADERS}
${zypp_capability_HEADERS}
${zypp_cache_HEADERS}
${zypp_cache_sqlite3x_HEADERS}
${zypp_data_HEADERS}
${zypp_media_HEADERS}
${zypp_target_hal_HEADERS}
-${zypp_parser_xml_HEADERS}
${zypp_media_proxyinfo_HEADERS}
-${zypp_source_yum_HEADERS}
${zypp_base_HEADERS}
${zypp_solver_detail_HEADERS}
${zypp_target_store_HEADERS}
${zypp_url_HEADERS}
-${zypp_source_HEADERS}
-${zypp_parser_HEADERS}
${zypp_HEADERS}
${zypp_zypp_detail_HEADERS}
${zypp_thread_HEADERS}
${zypp_source_susetags_HEADERS}
${zypp_target_modalias_HEADERS}
${zypp_target_HEADERS}
-${zypp_parser_yum_HEADERS}
${zypp_detail_HEADERS}
${zypp_pool_HEADERS}
)
SET_LOGGROUP( "zypp" ${zypp_lib_SRCS} )
# override some defaults
-SET_LOGGROUP( "plaindir" ${zypp_source_plaindir_SRCS} )
SET_LOGGROUP( "xmlstore" ${zypp_target_store_xml_SRCS} )
-SET_LOGGROUP( "tagfile" ${zypp_parser_tagfile_SRCS} )
#SET_LOGGROUP( "group" ${zypp_target_rpm_SRCS} )
#SET_LOGGROUP( "group" ${zypp_parser_yum2_SRCS} )
#SET_LOGGROUP( "group" ${zypp_capability_SRCS} )
#include "zypp/base/Functional.h"
#include "zypp/Capability.h"
+#include "zypp/ResObject.h"
///////////////////////////////////////////////////////////////////
namespace zypp
_resources.clear();
_caches.clear();
}
-
+
void Fetcher::Impl::addCachePath( const Pathname &cache_dir )
{
- _caches.push_back(cache_dir);
+ PathInfo info(cache_dir);
+ if ( info.isDir() )
+ {
+ _caches.push_back(cache_dir);
+ }
+ else
+ {
+ // don't add bad cache directory, just log the error
+ ERR << "Not adding cache: '" << cache_dir << "'. Not a direcotry." << endl;
+ }
}
-
+
void Fetcher::Impl::start( const Pathname &dest_dir,
MediaSetAccess &media,
const ProgressData::ReceiverFnc & progress_receiver )
bool got_from_cache = false;
for ( list<Pathname>::const_iterator it_cache = _caches.begin(); it_cache != _caches.end(); ++it_cache )
{
- // Pathinfos could be cached to avoid too many stats?
- PathInfo info(*it_cache);
- if ( info.isDir() )
+ // does the current file exists in the current cache?
+ Pathname cached_file = *it_cache + (*it_res).location.filename();
+ if ( PathInfo( cached_file ).isExist() )
{
- // does the current file exists in the current cache?
- Pathname cached_file = *it_cache + (*it_res).location.filename();
- if ( PathInfo( cached_file ).isExist() )
+ // check the checksum
+ if ( is_checksum( cached_file, (*it_res).location.checksum() ) )
{
- // check the checksum
- if ( is_checksum( cached_file, (*it_res).location.checksum() ) )
- {
- // cached
- MIL << "file " << (*it_res).location.filename() << " found in previous cache. Using cached copy." << endl;
- // checksum is already checked.
- // we could later implement double failover and try to download if file copy fails.
-
- // replicate the complete path in the target directory
- Pathname dest_full_path = dest_dir + (*it_res).location.filename();
- if ( assert_dir( dest_full_path.dirname() ) != 0 )
- ZYPP_THROW( Exception("Can't create " + dest_full_path.dirname().asString()));
-
- if ( filesystem::copy(cached_file, dest_full_path ) != 0 )
- { //copy_file2dir
- //ZYPP_THROW(SourceIOException("Can't copy " + cached_file.asString() + " to " + destination.asString()));
- ERR << "Can't copy " << cached_file + " to " + dest_dir << endl;
- // try next cache
- continue;
- }
-
- got_from_cache = true;
- break;
+ // cached
+ MIL << "file " << (*it_res).location.filename() << " found in previous cache. Using cached copy." << endl;
+ // checksum is already checked.
+ // we could later implement double failover and try to download if file copy fails.
+
+ // replicate the complete path in the target directory
+ Pathname dest_full_path = dest_dir + (*it_res).location.filename();
+ if ( assert_dir( dest_full_path.dirname() ) != 0 )
+ ZYPP_THROW( Exception("Can't create " + dest_full_path.dirname().asString()));
+
+ if ( filesystem::copy(cached_file, dest_full_path ) != 0 )
+ { //copy_file2dir
+ //ZYPP_THROW(SourceIOException("Can't copy " + cached_file.asString() + " to " + destination.asString()));
+ ERR << "Can't copy " << cached_file + " to " + dest_dir << endl;
+ // try next cache
+ continue;
}
+
+ got_from_cache = true;
+ break;
}
- else
- {
- // File exists in cache but with a different checksum
- // so just try next cache
- continue;
- }
- }
- else
- {
- // skip bad cache directory and try with next one
- ERR << "Skipping cache : " << *it_cache << endl;
- continue;
}
}
-
+
if ( ! got_from_cache )
{
// try to get the file from the net
// continue with next file
continue;
}
-
+
// no matter where did we got the file, try to validate it:
- Pathname localfile = dest_dir + (*it_res).location.filename();
- // call the checker function
- try {
- (*it_res).checkers(localfile);
- }
- catch ( const FileCheckException &e )
- {
- ZYPP_RETHROW(e);
- }
- catch ( const Exception &e )
- {
- ZYPP_RETHROW(e);
- }
- catch (...)
- {
- ZYPP_THROW(Exception("Unknown error while validating " + (*it_res).location.filename().asString()));
- }
-
- if ( ! progress.incr() )
+ Pathname localfile = dest_dir + (*it_res).location.filename();
+ // call the checker function
+ try {
+ (*it_res).checkers(localfile);
+ }
+ catch ( const FileCheckException &e )
+ {
+ ZYPP_RETHROW(e);
+ }
+ catch ( const Exception &e )
+ {
+ ZYPP_RETHROW(e);
+ }
+ catch (...)
+ {
+ ZYPP_THROW(Exception("Unknown error while validating " + (*it_res).location.filename().asString()));
+ }
+
+ if ( ! progress.incr() )
ZYPP_THROW(AbortRequestException());
} // for each job
}
#include <list>
#include "zypp/base/Exception.h"
#include "zypp/base/Function.h"
-#include "zypp/Pathname.h"
+#include "zypp/PathInfo.h"
#include "zypp/CheckSum.h"
///////////////////////////////////////////////////////////////////
#include "zypp/base/Logger.h"
#include "zypp/base/IOStream.h"
#include "zypp/base/String.h"
-#include "zypp/Pathname.h"
+#include "zypp/PathInfo.h"
#include "zypp/KeyRing.h"
#include "zypp/ExternalProgram.h"
#include "zypp/TmpPath.h"
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMParser.h
- *
-*/
-
-
-#ifndef YUMParser_h
-#define YUMParser_h
-
-#include "zypp/parser/yum/YUMParserData.h"
-#include "zypp/parser/yum/YUMRepomdParser.h"
-#include "zypp/parser/yum/YUMPrimaryParser.h"
-#include "zypp/parser/yum/YUMGroupParser.h"
-#include "zypp/parser/yum/YUMPatternParser.h"
-#include "zypp/parser/yum/YUMFileListParser.h"
-#include "zypp/parser/yum/YUMOtherParser.h"
-#include "zypp/parser/yum/YUMPatchParser.h"
-#include "zypp/parser/yum/YUMPatchesParser.h"
-#include "zypp/parser/yum/YUMProductParser.h"
-
-#endif
+
+
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "zypp"
+
+#include "zypp/MediaProducts.h"
+
+using namespace std;
+
+namespace zypp
+{
+
+// template<class _OutputIterator>
+// void productsInMedia( const Url & url_r, _OutputIterator result )
+
+
+} // ns zypp
+
+// vim: set ts=2 sts=2 sw=2 et ai:
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/MediaProducts.h
+ * Functions to find out products in media
+ */
+#ifndef ZYPP_MEDIAPRODUCTS_H_
+#define ZYPP_MEDIAPRODUCTS_H_
+
+#include <iterator>
+#include <iostream>
+#include <fstream>
+#include "zypp/ZConfig.h"
+#include "zypp/base/Logger.h"
+#include "zypp/media/MediaManager.h"
+#include "zypp/base/UserRequestException.h"
+
+#include "zypp/ProgressData.h"
+
+namespace zypp
+{
+ /**
+ * \short Represents an available product in media
+ */
+ struct MediaProductEntry
+ {
+ Pathname _dir;
+ std::string _name;
+
+ /**
+ * \short Ctor
+ */
+ MediaProductEntry( const Pathname & dir_r = "/", const std::string & name_r = std::string() )
+ : _dir(dir_r), _name(name_r)
+ {
+ }
+
+ bool operator<( const MediaProductEntry &rhs ) const
+ {
+ return ( _name < rhs._name );
+ }
+ };
+
+ /**
+ * A set of available products in media
+ */
+ typedef std::set<MediaProductEntry> MediaProductSet;
+
+ /**
+ * FIXME: add a comment here...
+ */
+ template <class _OutputIterator>
+ static void scanProductsFile( const Pathname & file_r, _OutputIterator result )
+ {
+ std::ifstream pfile( file_r.asString().c_str() );
+ while ( pfile.good() ) {
+
+ std::string value = str::getline( pfile, str::TRIM );
+ if ( pfile.bad() ) {
+ ERR << "Error parsing " << file_r << std::endl;
+ ZYPP_THROW(Exception("Error parsing " + file_r.asString()));
+ }
+ if ( pfile.fail() ) {
+ break; // no data on last line
+ }
+ std::string tag = str::stripFirstWord( value, true );
+
+ if ( tag.size() ) {
+ *result = MediaProductEntry( tag, value );
+ }
+ }
+ }
+
+ /**
+ * \short Available products in a url location
+ *
+ * \param url_r url to inspect
+ * \param result output iterator where \ref MediaProductEntry
+ * items will be inserted.
+ * \throws MediaException If accessng the media fails
+ */
+ template <class _OutputIterator>
+ void productsInMedia( const Url & url_r, _OutputIterator result )
+ {
+ media::MediaManager media_mgr;
+ // open the media
+ media::MediaId id = media_mgr.open(url_r);
+ media_mgr.attachDesiredMedia(id);
+ Pathname products_file = Pathname("media.1/products");
+
+ try {
+ media_mgr.provideFile (id, products_file);
+ products_file = media_mgr.localPath (id, products_file);
+ scanProductsFile (products_file, result);
+ }
+ catch ( const Exception & excpt ) {
+ ZYPP_CAUGHT(excpt);
+ MIL << "No products description found on the Url" << std::endl;
+ }
+ media_mgr.release(id);
+ }
+
+ /**
+ * \short Available products in a url location
+ *
+ * \param url_r url to inspect
+ * \param set ef MediaProductEntry set where
+ * items will be inserted.
+ * \throws MediaException If accessng the media fails
+ */
+ void productsInMedia( const Url & url_r, MediaProductSet &set )
+ {
+ productsInMedia(url_r, std::inserter(set, set.end()));
+ }
+
+} // ns zypp
+
+#endif
+
+// vim: set ts=2 sts=2 sw=2 et ai:
#include <fstream>
#include "zypp/base/LogTools.h"
+#include "zypp/base/UserRequestException.h"
#include "zypp/ZYppCallbacks.h"
#include "zypp/MediaSetAccess.h"
#include "zypp/PathInfo.h"
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
+
+IMPL_PTR_TYPE(MediaSetAccess);
+
///////////////////////////////////////////////////////////////////
MediaSetAccess::MediaSetAccess(const Url &url,
MediaSetAccess::~MediaSetAccess()
{
+#warning TODO call release() here once MediaSetAccess is passed as param in PackageProvider. MediaSetAccess will become like a ManagedFile object.
+ //! \todo call release() here once MediaSetAccess is passed as param in PackageProvider. MediaSetAccess will become like a ManagedFile object.
}
media::MediaAccessId media = getMediaAccessId( media_nr);
bool exists = false;
-
+
do
{
try
{
DBG << "Cheking if file " << file
- << " from media number " << media_nr << " exists." << endl;
+ << " from media number " << media_nr << " exists." << endl;
// try to attach the media
if ( ! media_mgr.isAttached(media) )
media_mgr.attachDesiredMedia(media);
exists = media_mgr.doesFileExist(media, file);
break;
}
- catch ( Exception & excp )
+ catch ( media::MediaException & excp )
{
ZYPP_CAUGHT(excp);
media::MediaChangeReport::Action user;
// set up the reason
media::MediaChangeReport::Error reason = media::MediaChangeReport::INVALID;
-
+
if( typeid(excp) == typeid( media::MediaFileNotFoundException ) ||
typeid(excp) == typeid( media::MediaNotAFileException ) )
{
else if ( user == media::MediaChangeReport::IGNORE )
{
DBG << "Skipping" << endl;
- ZYPP_THROW ( source::SkipRequestedException("User-requested skipping of a file") );
+ ZYPP_THROW ( SkipRequestException("User-requested skipping of a file") );
}
else if ( user == media::MediaChangeReport::EJECT )
{
try
{
DBG << "Going to try to provide file " << file
- << " from media number " << media_nr << endl;
+ << " from media number " << media_nr << endl;
// try to attach the media
if ( ! media_mgr.isAttached(media) )
media_mgr.attachDesiredMedia(media);
media_mgr.provideFile (media, file, false, false);
break;
}
- catch ( Exception & excp )
+ catch ( media::MediaException & excp )
{
ZYPP_CAUGHT(excp);
media::MediaChangeReport::Action user;
ZYPP_CAUGHT(excpt_r);
MIL << "Failed to release media " << media << endl;
}
-
+
/*MIL << "Releasing all _medias of all sources" << endl;
try
{
// set up the reason
media::MediaChangeReport::Error reason = media::MediaChangeReport::INVALID;
-
+
if( typeid(excp) == typeid( media::MediaFileNotFoundException ) ||
typeid(excp) == typeid( media::MediaNotAFileException ) )
{
user = checkonly ? media::MediaChangeReport::ABORT :
report->requestMedia (
- Source_Ref::noSource,
+ Repository::noRepository,
media_nr,
reason,
excp.asUserString()
else if ( user == media::MediaChangeReport::IGNORE )
{
DBG << "Skipping" << endl;
- ZYPP_THROW ( source::SkipRequestedException("User-requested skipping of a file") );
+ ZYPP_THROW ( SkipRequestException("User-requested skipping of a file") );
}
else if ( user == media::MediaChangeReport::EJECT )
{
return media_mgr.localPath( media, file );
}
+
+ Pathname MediaSetAccess::provideDir(const Pathname & dir,
+ bool recursive,
+ unsigned media_nr)
+ {
+ callback::SendReport<media::MediaChangeReport> report;
+ media::MediaManager media_mgr;
+
+ // get the mediaId, but don't try to attach it here
+ media::MediaAccessId _media = getMediaAccessId(media_nr);
+ do
+ {
+ try
+ {
+ DBG << "Going to try provide direcotry " << dir
+ << (recursive ? " (recursively)" : "")
+ << " from media nr. " << media_nr << endl;
+
+ // try to attach the media
+ if (!media_mgr.isAttached(_media))
+ media_mgr.attachDesiredMedia(_media);
+
+ _media = getMediaAccessId(media_nr); // in case of redirect
+
+ if (recursive)
+ media_mgr.provideDirTree(_media, dir);
+ else
+ media_mgr.provideDir(_media, dir);
+
+ break; // quit the retry loop
+ }
+ catch (media::MediaException & excp)
+ {
+ ZYPP_CAUGHT(excp);
+ media::MediaChangeReport::Action user;
+
+ do
+ {
+ DBG << "Media couldn't provide dir " << dir << ", releasing." << endl;
+ try
+ {
+ media_mgr.release (_media, false);
+ }
+ catch (const Exception & excpt_r)
+ {
+ ZYPP_CAUGHT(excpt_r);
+ ERR << "Failed to release media " << _media << endl;
+ }
+
+ //MIL << "Releasing all medias of all sources" << endl;
+ try
+ {
+ //! \todo do we need replacement for this at all?
+ //zypp::SourceManager::sourceManager()->releaseAllSources();
+ }
+ catch (const zypp::Exception& excpt_r)
+ {
+ ZYPP_CAUGHT(excpt_r);
+ ERR << "Failed to release all sources" << endl;
+ }
+
+ // set up the reason
+ media::MediaChangeReport::Error reason = media::MediaChangeReport::INVALID;
+
+ if (typeid(excp) == typeid(media::MediaFileNotFoundException)
+ || typeid(excp) == typeid(media::MediaNotAFileException))
+ {
+ reason = media::MediaChangeReport::NOT_FOUND;
+ }
+ else if (typeid(excp) == typeid( media::MediaNotDesiredException)
+ || typeid(excp) == typeid(media::MediaNotAttachedException))
+ {
+ reason = media::MediaChangeReport::WRONG;
+ }
+
+ user = report->requestMedia(Repository::noRepository,
+ media_nr,
+ reason,
+ excp.asUserString());
+
+ DBG << "ProvideFile exception caught, callback answer: " << user << endl;
+
+ if (user == media::MediaChangeReport::ABORT)
+ {
+ DBG << "Aborting" << endl;
+ ZYPP_RETHROW ( excp );
+ }
+ else if (user == media::MediaChangeReport::EJECT)
+ {
+ DBG << "Eject: try to release" << endl;
+ try
+ {
+ //! \todo do we need replacement for this at all?
+ // zypp::SourceManager::sourceManager()->releaseAllSources();
+ }
+ catch (const zypp::Exception& excpt_r)
+ {
+ ZYPP_CAUGHT(excpt_r);
+ ERR << "Failed to release all sources" << endl;
+ }
+ media_mgr.release (_media, true); // one more release needed for eject
+ // FIXME: this will not work, probably
+ }
+ else if (user == media::MediaChangeReport::RETRY ||
+ user == media::MediaChangeReport::CHANGE_URL)
+ {
+ // retry
+ DBG << "Going to try again" << endl;
+
+ // not attaching, media set will do that for us
+ // this could generate uncaught exception (#158620)
+
+ break;
+ }
+ else
+ {
+ DBG << "Don't know, let's ABORT" << endl;
+
+ ZYPP_RETHROW (excp);
+ }
+ }
+ while (user == media::MediaChangeReport::EJECT);
+ }
+ // retry or change URL
+ }
+ while (true);
+
+ return media_mgr.localPath(_media, dir);
+ }
+
media::MediaAccessId MediaSetAccess::getMediaAccessId (media::MediaNr medianr)
{
media::MediaManager media_mgr;
ZYPP_CAUGHT(e);
WAR << "Verifier not found" << endl;
}
-
+
return id;
}
return url_r;
}
+ void MediaSetAccess::release()
+ {
+ DBG << "Releasing all media IDs held by this MediaSetAccess" << endl;
+ media::MediaManager manager;
+ for (MediaMap::const_iterator m = _medias.begin(); m != _medias.end(); ++m)
+ manager.release(m->second);
+ }
+
std::ostream & MediaSetAccess::dumpOn( std::ostream & str ) const
{
str << "MediaSetAccess (URL='" << _url << "', attach_point_hint='" << _prefAttachPoint << "')";
* Sets a \ref MediaVerifier verifier for given media number.
*/
void setVerifier( unsigned media_nr, media::MediaVerifierRef verifier );
-
+
/**
* Provides a file from a media location.
+ *
+ * \param on_media_file location of the file on media
+ * \return local pathname of the requested file
+ *
+ * \throws MediaException if a problem occurs,
+ * see \ref media::MediaManager::provideFile()
*/
Pathname provideFile( const OnMediaLocation & on_media_file );
/**
- * Provides \a file from media \a media_nr.
+ * Provides \a file from media \a media_nr.
+ *
+ * \param file path to the file relative to media URL
+ * \param media_nr the media number in the media set
+ * \return local pathname of the requested file
+ *
+ * \throws MediaException if a problem occurs,
+ * see \ref media::MediaManager::provideFile()
*/
Pathname provideFile(const Pathname & file, unsigned media_nr = 1 );
+
+ /**
+ * Provides direcotry \a dir from media number \a media_nr.
+ *
+ * \param dir path to the directory relative to media URL
+ * \param recursive whether to provide the whole directory subtree
+ * \param media_nr the media number in the media set
+ * \return local pathname of the requested directory
+ *
+ * \throws MediaException if a problem occurs,
+ * see \ref media::MediaManager::provideDir()
+ * and \ref media::MediaManager::provideDirTree()
+ */
+ Pathname provideDir(const Pathname & dir, bool recursive, unsigned media_nr = 1);
/**
* check if a file exists on the specified media
bool doesFileExist(const Pathname & file, unsigned media_nr = 1 );
/**
+ * Release all attached media of this set.
+ *
+ * \throws MediaNotOpenException for invalid access IDs.
+ */
+ void release();
+
+ /**
* Replaces media number in specified url with given \a medianr.
*
* Media number in the URL is searched for with regex
std::ostream & operator<<( std::ostream & str, const OnMediaLocation & obj )
{
return str << "[" << obj.medianr() << "]" << obj.filename()
- << "{" << obj.downloadsize() << "|" << obj.checksum() << "}";
+ << "{" << obj.downloadSize() << "|" << obj.checksum() << "}";
}
/////////////////////////////////////////////////////////////////
//
// CLASS NAME : OnMediaLocation
//
- /**
+ /**
* Describes a path ona certain media amongs as the information
* required to download it, like its media number, checksum and
* size.
{}
public:
- unsigned medianr() const { return _medianr; }
- const Pathname & filename() const { return _filename; }
- const CheckSum & checksum() const { return _checksum; }
- const ByteCount & downloadsize() const { return _downloadsize; }
+ unsigned medianr() const { return _medianr; }
+ const Pathname & filename() const { return _filename; }
+ const CheckSum & checksum() const { return _checksum; }
+ const ByteCount & downloadSize() const { return _downloadsize; }
+ const ByteCount & openSize() const { return _opendownloadsize; }
+ const CheckSum & openChecksum() const { return _openchecksum; }
public:
- OnMediaLocation & medianr( unsigned val_r ) { _medianr = val_r; return *this; }
- OnMediaLocation & filename( const Pathname & val_r ) { _filename = val_r; return *this; }
- OnMediaLocation & checksum( const CheckSum & val_r ) { _checksum = val_r; return *this; }
- OnMediaLocation & downloadsize( const ByteCount & val_r ) { _downloadsize = val_r; return *this; }
-
+ OnMediaLocation & setMedianr( unsigned val_r ) { _medianr = val_r; return *this; }
+ OnMediaLocation & setFilename( const Pathname & val_r ) { _filename = val_r; return *this; }
+ OnMediaLocation & setChecksum( const CheckSum & val_r ) { _checksum = val_r; return *this; }
+ OnMediaLocation & setDownloadSize( const ByteCount & val_r ) { _downloadsize = val_r; return *this; }
+ OnMediaLocation & setOpenChecksum( const CheckSum & val_r ) { _openchecksum = val_r; return *this; }
+ OnMediaLocation & setOpenSize( const ByteCount & val_r ) { _opendownloadsize = val_r; return *this; }
private:
unsigned _medianr;
Pathname _filename;
CheckSum _checksum;
ByteCount _downloadsize;
+ ByteCount _opendownloadsize;
+ CheckSum _openchecksum;
};
///////////////////////////////////////////////////////////////////
*
*/
#include "zypp/Package.h"
-#include "zypp/source/SourceImpl.h"
#include "zypp/base/Exception.h"
using namespace std;
std::string Package::buildhost() const
{ return pimpl().buildhost(); }
- CheckSum Package::checksum() const
- { return pimpl().checksum(); }
-
/** */
std::string Package::distribution() const
{ return pimpl().distribution(); }
std::list<std::string> Package::filenames() const
{ return pimpl().filenames(); }
- Pathname Package::location() const
+ OnMediaLocation Package::location() const
{ return pimpl().location(); }
-
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
typedef std::set<PackageKeyword> Keywords;
public:
- /**
- * Checksum the source says this package should have
- */
- CheckSum checksum() const;
+
/** Get the package change log */
Changelog changelog() const;
/** */
/** Disk usage per directory */
DiskUsage diskusage() const;
-
- /** location in source */
- Pathname location() const;
-
+
+ /**
+ * Checksum the source says this package should have
+ * \deprecated Use location().checksum()
+ */
+ ZYPP_DEPRECATED CheckSum checksum() const
+ { return location().checksum(); }
+
+ /**
+ * \short Location of the resolvable in the repository
+ */
+ OnMediaLocation location() const;
+
protected:
Package( const NVRAD & nvrad_r );
/** Dtor */
#include <iostream>
#include "zypp/Pathname.h"
+#include "zypp/Url.h"
using std::string;
///////////////////////////////////////////////////////////////////
//
+ // METHOD NAME : Pathname::asUrl
+ // METHOD TYPE : Url
+ //
+ Url Pathname::asUrl() const
+ {
+ Url ret( "dir:///" );
+ ret.setPathName( asString() );
+ return ret;
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ //
// METHOD NAME : Pathname::extension
// METHOD TYPE : string
//
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
+
+ class Url;
+
///////////////////////////////////////////////////////////////////
namespace filesystem
{ /////////////////////////////////////////////////////////////////
const std::string & asString() const
{ return name_t; }
+ /** Url representation using \c dir schema. */
+ Url asUrl() const;
+
/** String representation. */
const char * c_str() const
{ return name_t.c_str(); }
//
bool ProgressData::report()
{
- // DISABLED to get DBG output from 'if ( doReport )'
- //if ( ! _d->_receiver )
- // return true;
-
bool goOn = true; // continue per default
bool doReport = false;
if ( _d->_receiver )
{
- goOn = _d->_receiver( _d->_last_val );
+ goOn = _d->_receiver( *this );
}
else
{
- DBG << str::form( "{#%u|%s}(%lld%s)",
- numericId(), name().c_str(),
- _d->_last_val, ( hasRange() ? "%" : "!" ) ) << endl;
+ if ( _d->_state != END )
+ {
+ DBG << str::form( "{#%u|%s}(%lld%s)",
+ numericId(), name().c_str(),
+ _d->_last_val, ( hasRange() ? "%" : "!" ) ) << endl;
+ }
+ else
+ {
+ DBG << str::form( "{#%u|%s}END", numericId(), name().c_str() ) << endl;
+ }
}
}
return ret;
}
+ CombinedProgressData::CombinedProgressData( ProgressData &pd,
+ ProgressData::value_type weight )
+ : _weight(weight),
+ _last_value(0),
+ _pd(pd)
+ {
+
+ }
+
+ bool CombinedProgressData::operator()( const ProgressData &progress )
+ {
+ if ( progress.reportAlive() || ( _weight == 0 ) )
+ return _pd.tick();
+
+ // factor [0,1] of increase in subtask ( ie: before 0,2 now 0.5 )
+ float increment = ((float)(progress.val() - _last_value))/(progress.max() - progress.min());
+ // how much the subtask affects the parent task ie: 0,1
+ float parent_factor = (float)(_weight)/(_pd.max() - _pd.min());
+ // real increment of the parent task
+ float real_increment = parent_factor*increment;
+ _last_value = progress.val();
+ return _pd.incr( (int)( (_pd.max()-_pd.min()) * real_increment) );
+ }
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
{
public:
typedef long long value_type;
- /** Most simple version of progress reporting - a single value.
+ /** Most simple version of progress reporting
* The percentage in most cases. Sometimes just keepalive.
+ * \p sender ProgressData object who sends the progress info
+ * \p
*/
- typedef function<bool(value_type)> ReceiverFnc;
+ typedef function<bool( const ProgressData & )> ReceiverFnc;
private:
enum State { INIT, RUN, END };
//@}
public:
+ /** \name Progress receiving.
+ */
+ //@{
/** @return Current \c min value. */
value_type min() const
{ return _d->_min; }
bool hasRange() const
{ return min() != max(); }
+ /** @return Wheter \ref reportValue will return a percent value.
+ * Same as \ref hasRange.
+ * \see \ref reportAlive
+ */
+ bool reportPercent() const
+ { return hasRange(); }
+
+ /** @return Wheter \ref reportValue always returns -1, because we
+ * trigger 'still alive' messages. I.e. \ref hasrange is \c false.
+ * \see \ref reportPercent
+ */
+ bool reportAlive() const
+ { return ! hasRange(); }
+
+ /** @return Either a a percent value or -1.
+ * \see \ref reportPercent and \ref reportAlive.
+ */
+ value_type reportValue() const
+ { return hasRange() ? val() * 100 / ( max() - min() ) : -1; }
+
/** @return The counters name. */
const std::string & name() const
{ return _d->_name; }
const ReceiverFnc & receiver() const
{ return _d->_receiver; }
+ /** @return Retrun \c true if this the final report sent by the
+ * ProgressData dtor.
+ */
+ bool finalReport() const
+ { return( _d->_state == END ); }
+
+ //@}
+
private:
/** Send report if necessary. */
bool report();
/** \relates ProgressData Setup from \ref InputStream. */
ProgressData makeProgressData( const InputStream & input_r );
+ ///////////////////////////////////////////////////////////////////
+
+ /**
+ * \short Progress callback from another progress
+ *
+ * This class allows you to pass a progress callback to a
+ * subtask based on a current progress data, plus a weight
+ * value. Every progress reported by the subtask via
+ * this callback will be forwarded to the main progress
+ * data, with the corresponding weight.
+ *
+ * Example:
+ *
+ * \code
+ *
+ * // receiver for main task
+ * void task_receiver( ProgressData &progress );
+ *
+ * // subtask prototypes
+ * void do_subtask_one( ProgressData::ReceiverFnc &fnc );
+ * void do_subtask_two( ProgressData::ReceiverFnc &fnc );
+ *
+ * // main task
+ * ProgressData progress;
+ * //progress for subtask 1
+ * // which is 80%
+ * CombinedProgressData sub1(pd, 80);
+ * // the second is only 20%
+ * CombinedProgressData sub2(pd, 20);
+ * do_subtask_one( sub1 );
+ * do_subtask_two( sub2 );
+ *
+ * \endcode
+ */
+ class CombinedProgressData
+ {
+ public:
+ /**
+ * \short Ctor
+ *
+ * Creates a \ref ProgressData::ReceiverFnc
+ * from a \ref ProgressData object
+ *
+ * \param pd \ref ProgressData object
+ * \param weight Weight of the subtask
+ * relative to the main task range.
+ *
+ * If weight is 0, or \param pd only reports
+ * keepalives. then only ticks are sent.
+ *
+ */
+ CombinedProgressData( ProgressData &pd,
+ ProgressData::value_type weight = 0 );
+
+ /**
+ * Implements the \ref ProgressData::ReceiverFnc
+ * callback interface
+ */
+ bool operator()( const ProgressData &progress );
+
+ private:
+ ProgressData::value_type _weight;
+ ProgressData::value_type _last_value;
+ ProgressData &_pd;
+ };
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
/** RepoInfo implementation. */
struct RepoInfo::Impl
{
-
+
Impl()
: enabled (indeterminate),
autorefresh(indeterminate),
type(repo::RepoType::NONE_e)
{}
-
+
~Impl()
{
//MIL << std::endl;
public:
boost::tribool enabled;
boost::tribool autorefresh;
+ boost::tribool gpgcheck;
+ Url gpgkey_url;
repo::RepoType type;
Url mirrorlist_url;
std::set<Url> baseUrls;
+ Pathname path;
std::string alias;
std::string name;
Pathname filepath;
//MIL << std::endl;
}
-
-
RepoInfo & RepoInfo::setEnabled( boost::tribool enabled )
{
_pimpl->enabled = enabled;
_pimpl->autorefresh = autorefresh;
return *this;
}
+
+ RepoInfo & RepoInfo::setGpgCheck( boost::tribool check )
+ {
+ _pimpl->gpgcheck = check;
+ return *this;
+ }
RepoInfo & RepoInfo::setMirrorListUrl( const Url &url )
{
_pimpl->mirrorlist_url = url;
return *this;
}
+
+ RepoInfo & RepoInfo::setGpgKeyUrl( const Url &url )
+ {
+ _pimpl->gpgkey_url = url;
+ return *this;
+ }
RepoInfo & RepoInfo::addBaseUrl( const Url &url )
{
return *this;
}
+ RepoInfo & RepoInfo::setBaseUrl( const Url &url )
+ {
+ _pimpl->baseUrls.clear();
+ addBaseUrl(url);
+ return *this;
+ }
+
+ RepoInfo & RepoInfo::setPath( const Pathname &path )
+ {
+ _pimpl->path = path;
+ return *this;
+ }
+
RepoInfo & RepoInfo::setAlias( const std::string &alias )
{
_pimpl->alias = alias;
_pimpl->filepath = filepath;
return *this;
}
-
+
tribool RepoInfo::enabled() const
{ return _pimpl->enabled; }
tribool RepoInfo::autorefresh() const
{ return _pimpl->autorefresh; }
+
+ tribool RepoInfo::gpgCheck() const
+ { return _pimpl->gpgcheck; }
std::string RepoInfo::alias() const
{ return _pimpl->alias; }
Pathname RepoInfo::filepath() const
{ return _pimpl->filepath; }
-
+
repo::RepoType RepoInfo::type() const
{ return _pimpl->type; }
Url RepoInfo::mirrorListUrl() const
{ return _pimpl->mirrorlist_url; }
+
+ Url RepoInfo::gpgKeyUrl() const
+ { return _pimpl->gpgkey_url; }
std::set<Url> RepoInfo::baseUrls() const
{ return _pimpl->baseUrls; }
-
+
+ Pathname RepoInfo::path() const
+ { return _pimpl->path; }
+
RepoInfo::urls_const_iterator RepoInfo::baseUrlsBegin() const
{ return _pimpl->baseUrls.begin(); }
-
+
RepoInfo::urls_const_iterator RepoInfo::baseUrlsEnd() const
{ return _pimpl->baseUrls.end(); }
-
+
+ RepoInfo::urls_size_type RepoInfo::baseUrlsSize() const
+ { return _pimpl->baseUrls.size(); }
+
+ bool RepoInfo::baseUrlsEmpty() const
+ { return _pimpl->baseUrls.empty(); }
+
std::ostream & RepoInfo::dumpOn( std::ostream & str ) const
{
str << "--------------------------------------" << std::endl;
{
str << "- url : " << *it << std::endl;
}
-
+ str << "- path : " << path() << std::endl;
str << "- type : " << type() << std::endl;
str << "- enabled : " << enabled() << std::endl;
+
str << "- autorefresh : " << autorefresh() << std::endl;
- //str << "- path : " << path() << std::endl;
+ str << "- gpgcheck : " << gpgCheck() << std::endl;
+ str << "- gpgkey : " << gpgKeyUrl() << std::endl;
+
return str;
}
{
str << *it << endl;
}
- str << "mirrorlist=" << mirrorListUrl() << endl;
+
+ if ( ! path().empty() )
+ str << "path="<< path() << endl;
+
+ if ( ! (mirrorListUrl().asString().empty()) )
+ str << "mirrorlist=" << mirrorListUrl() << endl;
+
str << "type=" << type().asString() << endl;
- str << "enabled=" << (enabled() ? "1" : "0") << endl;
+
+ if ( enabled() != indeterminate )
+ str << "enabled=" << (enabled() ? "1" : "0") << endl;
+ if ( autorefresh() != indeterminate )
+ str << "autorefresh=" << (autorefresh() ? "1" : "0") << endl;
+ if ( autorefresh() != indeterminate )
+ str << "gpgcheck=" << (gpgCheck() ? "1" : "0") << endl;
+ if ( ! (gpgKeyUrl().asString().empty()) )
+ str << "gpgkey=" <<gpgKeyUrl() << endl;
+
return str;
}
{
return obj.dumpOn(str);
}
-
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
class RepoInfo
{
friend std::ostream & operator<<( std::ostream & str, const RepoInfo & obj );
-
+
public:
RepoInfo();
~RepoInfo();
//RepoInfo( const Url & url, const Pathname & path, const std::string & alias = "", boost::tribool autorefresh = boost::indeterminate );
-
+
+ typedef unsigned long NumericId;
+
/**
* unique identifier for this source. If not specified
* It should be generated from the base url.
* ( [somerepo] )
*/
std::string alias() const;
-
+
/**
* A Url under which the metadata are located, or a set of mirrors.
*
* This can't be empty in order the repository to be valid
* unless the download of the mirror list succeeds and it
* contains a valid url.
+ *
+ * \deprecated IMO superfluous as we provide begin/end iterator.
*/
std::set<Url> baseUrls() const;
/**
+ * \short Repository path
+ *
+ * Pathname relative to the base Url where the product/repository
+ * is located
+ *
+ * For medias containing more than one product, or repositories not
+ * located at the root of the media it is important to
+ * know the path of the media root relative to the product directory
+ * so a media verifier can be set for that media.
+ *
+ * It is not mandatory, and the default is /
+ *
+ * \note As a repository can have multiple Urls, the path is unique and
+ * the same for all Urls, so it is assumed all the Urls have the
+ * same media layout.
+ *
+ */
+ Pathname path() const;
+
+ /**
* Url of a file which contains a list of Urls
* If empty, the base url will be used.
*/
Url mirrorListUrl() const;
-
+
typedef std::set<Url>::const_iterator urls_const_iterator;
-
+ typedef std::set<Url>::size_type urls_size_type;
+
/**
* iterator that points at begin of repository urls
*/
urls_const_iterator baseUrlsBegin() const;
-
+
/**
* iterator that points at end of repository urls
*/
urls_const_iterator baseUrlsEnd() const;
-
+
/**
+ * number of repository urls
+ */
+ urls_size_type baseUrlsSize() const;
+
+ /**
+ * whether repository urls are available
+ */
+ bool baseUrlsEmpty() const;
+
+ /**
* If enabled is false, then this repository must be ignored as if does
* not exists, except when checking for duplicate alias.
*/
boost::tribool enabled() const;
-
+
/**
* If true, the repostory must be refreshed before creating resolvables
* from it
*/
boost::tribool autorefresh() const;
-
+
/**
* Type of repository,
- *
+ *
*/
repo::RepoType type() const;
-
+
/**
* \short Repository short label
*
* infos created in memory.
*/
Pathname filepath() const;
+
+ /**
+ * \short Whether to check or not this repository with gpg
+ *
+ * \note This is a just a hint to the application and can
+ * be ignored.
+ *
+ */
+ boost::tribool gpgCheck() const;
+
+ /**
+ * \short Key to use for gpg checking of this repository
+ *
+ * \param url Url to the key in ASCII armored format
+ *
+ * \note This is a just a hint to the application and can
+ * be ignored.
+ *
+ */
+ Url gpgKeyUrl() const;
/**
* Add a base url. \see baseUrls
* \param url The base url for the repository.
*
- * To edit or remove urls, create a new RepoInfo instead.
+ * To recreate the base URLs list, use \ref setBaseUrl(const Url &) followed
+ * by addBaseUrl().
*/
RepoInfo & addBaseUrl( const Url &url );
+
+ /**
+ * Clears current base URL list and adds \a url.
+ */
+ RepoInfo & setBaseUrl( const Url &url );
+
+ /**
+ * set the product path. \see path()
+ * \param path the path to the product
+ */
+ RepoInfo & setPath( const Pathname &path );
/**
* Set mirror list url. \see mirrorListUrl
* \param url The base url for the list
*/
RepoInfo & setMirrorListUrl( const Url &url );
-
+
/**
* enable or disable the repository \see enabled
* \param enabled
*/
RepoInfo & setEnabled( boost::tribool enabled );
-
+
/**
* enable or disable autorefresh \see autorefresh
* \param enabled
*/
RepoInfo & setAutorefresh( boost::tribool autorefresh );
-
+
/**
* set the repository alias \see alias
* \param alias
*/
RepoInfo & setAlias( const std::string &alias );
-
+
/**
* set the repository type \see type
* \param t
*/
RepoInfo & setType( const repo::RepoType &t );
-
+
/**
* set the repository name \see name
* \param name
* \param path File path
*/
RepoInfo & setFilepath( const Pathname &filename );
+
+ /**
+ * \short Whether to check or not this repository with gpg
+ *
+ * \param check true (check) or false (dont'check)
+ *
+ * \note This is a just a hint to the application and can
+ * be ignored.
+ *
+ */
+ RepoInfo & setGpgCheck( boost::tribool check );
- std::ostream & dumpOn( std::ostream & str ) const;
+ /**
+ * \short Key to use for gpg checking of this repository
+ *
+ * \param url Url to the key in ASCII armored format
+ *
+ * \note This is a just a hint to the application and can
+ * be ignored.
+ *
+ */
+ RepoInfo & setGpgKeyUrl( const Url &gpgkey );
+ /**
+ * Write a human-readable representation of this RepoInfo object
+ * into the \a str stream. Useful for logging.
+ */
+ std::ostream & dumpOn( std::ostream & str ) const;
+
+ /**
+ * Write this RepoInfo object into \a str in a <tr>.repo</tt> file format.
+ */
std::ostream & dumpRepoOn( std::ostream & str ) const;
class Impl;
std::ostream & operator<<( std::ostream & str, const RepoInfo & obj );
typedef std::list<RepoInfo> RepoInfoList;
-
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
#include <algorithm>
#include "zypp/base/InputStream.h"
#include "zypp/base/Logger.h"
+#include "zypp/base/Gettext.h"
#include "zypp/base/Function.h"
#include "zypp/PathInfo.h"
#include "zypp/TmpPath.h"
#include "zypp/cache/CacheStore.h"
#include "zypp/repo/cached/RepoImpl.h"
+#include "zypp/media/MediaManager.h"
#include "zypp/MediaSetAccess.h"
#include "zypp/parser/RepoFileReader.h"
#include "zypp/repo/yum/Downloader.h"
#include "zypp/parser/yum/RepoParser.h"
-
+#include "zypp/parser/plaindir/RepoParser.h"
#include "zypp/repo/susetags/Downloader.h"
#include "zypp/parser/susetags/RepoParser.h"
+#include "zypp/ZYppCallbacks.h"
+
using namespace std;
using namespace zypp;
using namespace zypp::repo;
// CLASS NAME : RepoManagerOptions
//
///////////////////////////////////////////////////////////////////
-
+
RepoManagerOptions::RepoManagerOptions()
{
ZConfig globalConfig;
{
MIL << endl;
}
-
+
~RepoCollector()
{
MIL << endl;
}
-
+
bool collect( const RepoInfo &repo )
{
//MIL << "here in collector: " << repo.alias() << endl;
//MIL << "added: " << repo.alias() << endl;
return true;
}
-
+
RepoInfoList repos;
};
-
+
////////////////////////////////////////////////////////////////////////////
-
+
/**
* Reads RepoInfo's from a repo file.
*
std::list<RepoInfo> readRepoFile(const Url & repo_file)
{
// no interface to download a specific file, using workaround:
- //! \todo add MediaManager::provideFile(Url file_url) to easily access any file URLs? (no need for media access id or media_nr)
+ //! \todo add MediaManager::provideFile(Url file_url) to easily access any file URLs? (no need for media access id or media_nr)
Url url(repo_file);
Pathname path(url.getPathName());
url.setPathName ("/");
MediaSetAccess access(url);
Pathname local = access.provideFile(path);
-
+
DBG << "reading repo file " << repo_file << ", local path: " << local << endl;
-
+
return repositories_in_file(local);
}
////////////////////////////////////////////////////////////////////////////
-
+
/**
* \short List of RepoInfo's from a directory
*
list<Pathname> entries;
if ( filesystem::readdir( entries, Pathname(dir), false ) != 0 )
ZYPP_THROW(Exception("failed to read directory"));
-
+
for ( list<Pathname>::const_iterator it = entries.begin(); it != entries.end(); ++it )
{
- list<RepoInfo> tmp = repositories_in_file( *it );
+ list<RepoInfo> tmp = repositories_in_file( *it );
repos.insert( repos.end(), tmp.begin(), tmp.end() );
//std::copy( collector.repos.begin(), collector.repos.end(), std::back_inserter(repos));
}
////////////////////////////////////////////////////////////////////////////
-
+
static void assert_alias( const RepoInfo &info )
{
if (info.alias().empty())
ZYPP_THROW(RepoNoAliasException());
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
static void assert_urls( const RepoInfo &info )
{
if (info.baseUrls().empty())
ZYPP_THROW(RepoNoUrlException());
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
/**
* \short Calculates the raw cache path for a repository
*/
// CLASS NAME : RepoManager::Impl
//
///////////////////////////////////////////////////////////////////
-
+
/**
* \short RepoManager implementation.
*/
Impl( const RepoManagerOptions &opt )
: options(opt)
{
-
+
}
-
+
Impl()
{
-
+
}
-
+
RepoManagerOptions options;
-
+
public:
/** Offer default Impl. */
static shared_ptr<Impl> nullimpl()
{}
////////////////////////////////////////////////////////////////////////////
-
+
RepoManager::~RepoManager()
{}
-
+
////////////////////////////////////////////////////////////////////////////
std::list<RepoInfo> RepoManager::knownRepositories() const
{
MIL << endl;
- return repositories_in_dir(_pimpl->options.knownReposPath);
+
+ if ( PathInfo(_pimpl->options.knownReposPath).isExist() )
+ return repositories_in_dir(_pimpl->options.knownReposPath);
+ else
+ return std::list<RepoInfo>();
+
MIL << endl;
}
////////////////////////////////////////////////////////////////////////////
-
+
RepoStatus RepoManager::rawMetadataStatus( const RepoInfo &info )
{
Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info );
RepoType repokind = info.type();
RepoStatus status;
+
switch ( repokind.toEnum() )
{
case RepoType::NONE_e:
// unknown, probe the local metadata
- repokind = probe(Url(rawpath.asString()));
+ repokind = probe(rawpath.asUrl());
break;
default:
break;
}
-
+
switch ( repokind.toEnum() )
{
case RepoType::RPMMD_e :
status = RepoStatus( rawpath + "/repodata/repomd.xml");
}
break;
+
case RepoType::YAST2_e :
{
status = RepoStatus( rawpath + "/content");
}
break;
- default:
- ZYPP_THROW(RepoUnknownTypeException());
+
+ case RepoType::RPMPLAINDIR_e :
+ {
+ if ( PathInfo(Pathname(rawpath + "/cookie")).isExist() )
+ status = RepoStatus( rawpath + "/cookie");
+ }
+ break;
+
+ case RepoType::NONE_e :
+ // Return default RepoStatus in case of RepoType::NONE
+ // indicating it should be created?
+ // ZYPP_THROW(RepoUnknownTypeException());
+ break;
}
return status;
}
-
-
+
+
void RepoManager::refreshMetadata( const RepoInfo &info,
RawMetadataRefreshPolicy policy,
const ProgressData::ReceiverFnc & progress )
{
assert_alias(info);
assert_urls(info);
-
+
RepoStatus oldstatus;
RepoStatus newstatus;
// try urls one by one
{
Url url(*it);
filesystem::TmpDir tmpdir;
-
+
repo::RepoType repokind = info.type();
-
+
// if the type is unknown, try probing.
switch ( repokind.toEnum() )
{
default:
break;
}
-
+
Pathname rawpath = rawcache_path_for_repoinfo( _pimpl->options, info );
oldstatus = rawMetadataStatus(info);
-
+
switch ( repokind.toEnum() )
{
case RepoType::RPMMD_e :
{
yum::Downloader downloader( url, "/" );
-
+
RepoStatus newstatus = downloader.status();
bool refresh = false;
if ( oldstatus.checksum() == newstatus.checksum() )
{
refresh = true;
}
-
+
if ( refresh )
downloader.download(tmpdir.path());
else
case RepoType::YAST2_e :
{
susetags::Downloader downloader( url, "/" );
-
+
RepoStatus newstatus = downloader.status();
bool refresh = false;
if ( oldstatus.checksum() == newstatus.checksum() )
{
refresh = true;
}
-
+
if ( refresh )
downloader.download(tmpdir.path());
else
// no error
}
break;
+
+ case RepoType::RPMPLAINDIR_e :
+ {
+ RepoStatus newstatus = parser::plaindir::dirStatus(url.getPathName());
+ bool refresh = false;
+ if ( oldstatus.checksum() == newstatus.checksum() )
+ {
+ MIL << "repo has not changed" << endl;
+ if ( policy == RefreshForced )
+ {
+ MIL << "refresh set to forced" << endl;
+ refresh = true;
+ }
+ }
+ else
+ {
+ refresh = true;
+ }
+
+ if ( refresh )
+ {
+ std::ofstream file(( tmpdir.path() + "/cookie").c_str());
+ if (!file) {
+ ZYPP_THROW (Exception( "Can't open " + tmpdir.path().asString() + "/cookie" ) );
+ }
+ file << url << endl;
+ file << newstatus.checksum() << endl;
+
+ file.close();
+ }
+ else
+ return;
+ // no error
+ }
+ break;
default:
ZYPP_THROW(RepoUnknownTypeException());
}
-
+
// ok we have the metadata, now exchange
// the contents
TmpDir oldmetadata;
ERR << "No more urls..." << endl;
ZYPP_THROW(RepoException("Cant refresh metadata"));
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
void RepoManager::cleanMetadata( const RepoInfo &info,
const ProgressData::ReceiverFnc & progress )
{
filesystem::recursive_rmdir(rawcache_path_for_repoinfo(_pimpl->options, info));
}
-
- ////////////////////////////////////////////////////////////////////////////
-
+
void RepoManager::buildCache( const RepoInfo &info,
CacheBuildPolicy policy,
const ProgressData::ReceiverFnc & progressrcv )
{
- ProgressData progress;
- progress.sendTo(progressrcv);
+ ProgressData progress(100);
+ callback::SendReport<ProgressReport> report;
+ progress.sendTo( ProgressReportAdaptor( progressrcv, report ) );
+ progress.name(str::form(_("Building repository '%s' cache"), info.alias().c_str()));
progress.toMin();
+
assert_alias(info);
Pathname rawpath = rawcache_path_for_repoinfo(_pimpl->options, info);
-
+
cache::CacheStore store(_pimpl->options.repoCachePath);
-
+
RepoStatus raw_metadata_status = rawMetadataStatus(info);
if ( store.isCached( info.alias() ) )
{
return;
}
else {
- MIL << "Build cache is forced" << endl;
+ MIL << info.alias() << " cache rebuild is forced" << endl;
}
}
store.cleanRepository(id);
}
-
+
+ MIL << info.alias() << " building cache..." << endl;
data::RecordId id = store.lookupOrAppendRepository(info.alias());
// do we have type?
repo::RepoType repokind = info.type();
-
- // if the type is unknown, try probing.
- switch ( repokind.toEnum() )
+
+ // if the type is unknown, try probing.
+ switch ( repokind.toEnum() )
+ {
+ case RepoType::NONE_e:
+ // unknown, probe the local metadata
+ repokind = probe(rawpath.asUrl());
+ break;
+ default:
+ break;
+ }
+
+ CombinedProgressData subprogrcv( progress, 100);
+
+ switch ( repokind.toEnum() )
+ {
+ case RepoType::RPMMD_e :
{
- case RepoType::NONE_e:
- // unknown, probe the local metadata
- repokind = probe(Url(rawpath.asString()));
- break;
- default:
- break;
+ parser::yum::RepoParser parser(id, store, parser::yum::RepoParserOpts(), subprogrcv);
+ parser.parse(rawpath);
+ // no error
}
-
- switch ( repokind.toEnum() )
+ break;
+ case RepoType::YAST2_e :
{
- case RepoType::RPMMD_e :
- {
- parser::yum::RepoParser parser(id, store);
- parser.parse(rawpath);
- // no error
- }
- break;
- case RepoType::YAST2_e :
- {
- parser::susetags::RepoParser parser(id, store);
- parser.parse(rawpath);
- // no error
- }
- break;
- default:
- ZYPP_THROW(RepoUnknownTypeException());
+ parser::susetags::RepoParser parser(id, store, subprogrcv);
+ parser.parse(rawpath);
+ // no error
}
-
- // update timestamp and checksum
- store.updateRepositoryStatus(id, raw_metadata_status);
-
- MIL << "Commit cache.." << endl;
- store.commit();
- progress.toMax();
+ break;
+ case RepoType::RPMPLAINDIR_e :
+ {
+ InputStream is(rawpath + "cookie");
+ string buffer;
+ getline( is.stream(), buffer);
+ Url url(buffer);
+ parser::plaindir::RepoParser parser(id, store, subprogrcv);
+ parser.parse(url.getPathName());
+ }
+ break;
+ default:
+ ZYPP_THROW(RepoUnknownTypeException());
+ }
+
+ // update timestamp and checksum
+ store.updateRepositoryStatus(id, raw_metadata_status);
+
+ MIL << "Commit cache.." << endl;
+ store.commit();
+ progress.toMax();
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
repo::RepoType RepoManager::probe( const Url &url )
{
+ if ( url.getScheme() == "dir" && ! PathInfo( url.getPathName() ).isDir() )
+ {
+ // Handle non existing local directory in advance, as
+ // MediaSetAccess does not support it.
+ return repo::RepoType::NONE;
+ }
+
MediaSetAccess access(url);
if ( access.doesFileExist("/repodata/repomd.xml") )
return repo::RepoType::RPMMD;
if ( access.doesFileExist("/content") )
return repo::RepoType::YAST2;
-
- return repo::RepoType("UNKNOWN");
+
+ // if it is a local url of type dir
+ if ( (! media::MediaManager::downloads(url)) && ( url.getScheme() == "dir" ) )
+ {
+ Pathname path = Pathname(url.getPathName());
+ if ( PathInfo(path).isDir() )
+ {
+ // allow empty dirs for now
+ return repo::RepoType::RPMPLAINDIR;
+ }
+ }
+
+ return repo::RepoType::NONE;
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
void RepoManager::cleanCache( const RepoInfo &info,
const ProgressData::ReceiverFnc & progressrcv )
{
- ProgressData progress;
- progress.sendTo(progressrcv);
-
+ ProgressData progress(100);
+ callback::SendReport<ProgressReport> report;
+ progress.sendTo( ProgressReportAdaptor( progressrcv, report ) );
+ progress.name(str::form(_("Cleaning repository '%s' cache"), info.alias().c_str()));
+ progress.toMin();
+
cache::CacheStore store(_pimpl->options.repoCachePath);
data::RecordId id = store.lookupRepository(info.alias());
store.cleanRepository(id);
store.commit();
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
bool RepoManager::isCached( const RepoInfo &info ) const
{
cache::CacheStore store(_pimpl->options.repoCachePath);
return store.isCached(info.alias());
}
-
+
Repository RepoManager::createFromCache( const RepoInfo &info,
- const ProgressData::ReceiverFnc & progress )
+ const ProgressData::ReceiverFnc & progressrcv )
{
- cache::CacheStore store(_pimpl->options.repoCachePath);
+ callback::SendReport<ProgressReport> report;
+ ProgressData progress;
+ progress.sendTo(ProgressReportAdaptor( progressrcv, report ));
+ progress.sendTo( progressrcv );
+ progress.name(str::form(_("Reading repository '%s' cache"), info.alias().c_str()));
+ progress.toMin();
+ cache::CacheStore store(_pimpl->options.repoCachePath);
+
if ( ! store.isCached( info.alias() ) )
ZYPP_THROW(RepoNotCachedException());
-
+
MIL << "Repository " << info.alias() << " is cached" << endl;
-
+
data::RecordId id = store.lookupRepository(info.alias());
+
+ repo::cached::RepoOptions opts( info, _pimpl->options.repoCachePath, id );
+ opts.readingResolvablesProgress = progressrcv;
repo::cached::RepoImpl::Ptr repoimpl =
- new repo::cached::RepoImpl( info, _pimpl->options.repoCachePath, id );
+ new repo::cached::RepoImpl( opts );
+
+ repoimpl->resolvables();
// read the resolvables from cache
- repoimpl->createResolvables();
return Repository(repoimpl);
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
/**
* Generate a non existing filename in a directory, using a base
* name. For example if a directory contains 3 files
* |-- foo
* `-- moo
*
- * If you try to generate a unique filename for this directory,
+ * If you try to generate a unique filename for this directory,
* based on "ruu" you will get "ruu", but if you use the base
* "foo" you will get "foo_1"
*
}
return dir + Pathname(final_filename);
}
-
+
////////////////////////////////////////////////////////////////////////////
void RepoManager::addRepository( const RepoInfo &info,
const ProgressData::ReceiverFnc & progressrcv )
{
assert_alias(info);
+
+ ProgressData progress(100);
+ callback::SendReport<ProgressReport> report;
+ progress.sendTo( ProgressReportAdaptor( progressrcv, report ) );
+ progress.name(str::form(_("Adding repository '%s'"), info.alias().c_str()));
+ progress.toMin();
std::list<RepoInfo> repos = knownRepositories();
for ( std::list<RepoInfo>::const_iterator it = repos.begin();
if ( info.alias() == (*it).alias() )
ZYPP_THROW(RepoAlreadyExistsException(info.alias()));
}
+
+ progress.set(50);
+
+ // assert the directory exists
+ filesystem::assert_dir(_pimpl->options.knownReposPath);
Pathname repofile = generate_non_existing_name(_pimpl->options.knownReposPath,
Pathname(info.alias()).extend(".repo").asString());
// now we have a filename that does not exists
MIL << "Saving repo in " << repofile << endl;
-
+
std::ofstream file(repofile.c_str());
if (!file) {
ZYPP_THROW (Exception( "Can't open " + repofile.asString() ) );
}
-
+
info.dumpRepoOn(file);
+ progress.toMax();
MIL << "done" << endl;
}
-
+
void RepoManager::addRepositories( const Url &url,
const ProgressData::ReceiverFnc & progressrcv )
{
}
}
}
-
+
string filename = Pathname(url.getPathName()).basename();
-
+
if ( filename == Pathname() )
ZYPP_THROW(RepoException("Invalid repo file name at " + url.asString() ));
+
+ // assert the directory exists
+ filesystem::assert_dir(_pimpl->options.knownReposPath);
Pathname repofile = generate_non_existing_name(_pimpl->options.knownReposPath, filename);
// now we have a filename that does not exists
MIL << "Saving " << repos.size() << " repo" << ( repos.size() ? "s" : "" ) << " in " << repofile << endl;
-
+
std::ofstream file(repofile.c_str());
if (!file) {
ZYPP_THROW (Exception( "Can't open " + repofile.asString() ) );
}
-
+
for ( std::list<RepoInfo>::const_iterator it = repos.begin();
it != repos.end();
++it )
}
MIL << "done" << endl;
}
-
+
////////////////////////////////////////////////////////////////////////////
-
+
void RepoManager::removeRepository( const RepoInfo & info,
const ProgressData::ReceiverFnc & progressrcv)
{
+ MIL << "Going to delete repo " << info.alias() << endl;
+
std::list<RepoInfo> repos = knownRepositories();
for ( std::list<RepoInfo>::const_iterator it = repos.begin();
it != repos.end();
// then skip
if ( (!info.alias().empty()) && ( info.alias() != (*it).alias() ) )
continue;
-
+
// TODO match by url
-
+
// we have a matcing repository, now we need to know
// where it does come from.
RepoInfo todelete = *it;
{
ZYPP_THROW(RepoException("Can't delete " + todelete.filepath().asString()));
}
+ MIL << todelete.alias() << " sucessfully deleted." << endl;
return;
}
else
// write them back except the deleted one.
//TmpFile tmp;
//std::ofstream file(tmp.path().c_str());
+
+ // assert the directory exists
+ filesystem::assert_dir(todelete.filepath().dirname());
+
std::ofstream file(todelete.filepath().c_str());
if (!file) {
//ZYPP_THROW (Exception( "Can't open " + tmp.path().asString() ) );
if ( (*fit).alias() != todelete.alias() )
(*fit).dumpRepoOn(file);
}
-
+
cache::CacheStore store(_pimpl->options.repoCachePath);
-
+
if ( store.isCached( todelete.alias() ) ) {
MIL << "repository was cached. cleaning cache" << endl;
store.cleanRepository(todelete.alias());
}
-
+
+ MIL << todelete.alias() << " sucessfully deleted." << endl;
return;
}
} // else filepath is empty
-
+
}
// should not be reached on a sucess workflow
ZYPP_THROW(RepoNotFoundException(info));
}
-
+
+ ////////////////////////////////////////////////////////////////////////////
+
+ void RepoManager::modifyRepository( const std::string &alias,
+ const RepoInfo & newinfo,
+ const ProgressData::ReceiverFnc & progressrcv )
+ {
+ RepoInfo toedit = getRepositoryInfo(alias);
+
+ if (toedit.filepath().empty())
+ {
+ ZYPP_THROW(RepoException("Can't figure where the repo is stored"));
+ }
+ else
+ {
+ // figure how many repos are there in the file:
+ std::list<RepoInfo> filerepos = repositories_in_file(toedit.filepath());
+
+ // there are more repos in the same file
+ // write them back except the deleted one.
+ //TmpFile tmp;
+ //std::ofstream file(tmp.path().c_str());
+
+ // assert the directory exists
+ filesystem::assert_dir(toedit.filepath().dirname());
+
+ std::ofstream file(toedit.filepath().c_str());
+ if (!file) {
+ //ZYPP_THROW (Exception( "Can't open " + tmp.path().asString() ) );
+ ZYPP_THROW (Exception( "Can't open " + toedit.filepath().asString() ) );
+ }
+ for ( std::list<RepoInfo>::const_iterator fit = filerepos.begin();
+ fit != filerepos.end();
+ ++fit )
+ {
+ // if the alias is different, dump the original
+ // if it is the same, dump the provided one
+ if ( (*fit).alias() != toedit.alias() )
+ (*fit).dumpRepoOn(file);
+ else
+ newinfo.dumpRepoOn(file);
+ }
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+
+ RepoInfo RepoManager::getRepositoryInfo( const std::string &alias,
+ const ProgressData::ReceiverFnc & progressrcv )
+ {
+ std::list<RepoInfo> repos = knownRepositories();
+ for ( std::list<RepoInfo>::const_iterator it = repos.begin();
+ it != repos.end();
+ ++it )
+ {
+ if ( (*it).alias() == alias )
+ return *it;
+ }
+ RepoInfo info;
+ info.setAlias(info.alias());
+ ZYPP_THROW(RepoNotFoundException(info));
+ }
+
////////////////////////////////////////////////////////////////////////////
-
+
std::ostream & operator<<( std::ostream & str, const RepoManager & obj )
{
return str << *obj._pimpl;
/**
* \short Create a repository object from the cache data
*
+ * Creating from cache requires that the repository is
+ * refreshed (metadata downloaded) and cached
+ *
+ * \throws repo::RepoNoAliasException if can't figure an alias to look in cache
* \throw RepoNotCachedException When the source is not cached.
*/
Repository createFromCache( const RepoInfo &info,
const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() );
/**
+ * \short Create a repository object from raw metadata
+ *
+ * Creating from cache requires that the repository is
+ * refreshed (metadata downloaded)
+ *
+ * \throw Exception If there are errors parsing the
+ * raw metadata
+ */
+ Repository createFromMetadata( const RepoInfo &info,
+ const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() );
+
+ /**
* \short Probe repo metadata type.
*
* \todo FIXME Should this be private?
void removeRepository( const RepoInfo & info,
const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() );
+ /**
+ * \short Modify repository attributes
+ *
+ * \throws RepoNotFoundException If no repo match
+ * \throws ParseException If the file parsing fails
+ * \throws Exception On other errors.
+ */
+ void modifyRepository( const std::string &alias,
+ const RepoInfo & newinfo,
+ const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() );
+
+ /**
+ * \short Find a matching repository info
+ *
+ * \note if multple repositories incorrectly share the
+ * same alias, the first one found will be returned.
+ *
+ * \throws RepoNotFoundException If no repo match
+ * \throws ParseException If the file parsing fails
+ * \throws Exception On other errors.
+ */
+ RepoInfo getRepositoryInfo( const std::string &alias,
+ const ProgressData::ReceiverFnc & progressrcv = ProgressData::ReceiverFnc() );
+
protected:
RepoStatus rawMetadataStatus( const RepoInfo &info );
RepoStatus cacheStatus( const RepoInfo &info );
Repository::NumericId Repository::numericId() const
{ return _pimpl->numericId(); }
- const ResStore & Repository::resolvables()
+ const ResStore & Repository::resolvables() const
{
return _pimpl->resolvables();
}
-
- const RepoInfo Repository::info() const
+
+ const RepoInfo & Repository::info() const
{
return _pimpl->info();
}
-
+
const std::list<packagedelta::PatchRpm> &
Repository::patchRpms() const
{
return _pimpl->patchRpms();
}
-
+
const std::list<packagedelta::DeltaRpm> &
Repository::deltaRpms() const
{
return _pimpl->deltaRpms();
}
-
-
+
+ std::ostream & operator<<( std::ostream & str, const Repository & obj )
+ {
+ return str << "[" << obj.info().alias() << "]";
+ }
+
+ bool operator==( const Repository & lhs, const Repository & rhs )
+ {
+ return (lhs.info().alias() == rhs.info().alias());
+ }
+
+ bool operator<( const Repository & lhs, const Repository & rhs )
+ {
+ return (lhs.info().alias() < rhs.info().alias());
+ }
}
#include "zypp/base/PtrTypes.h"
#include "zypp/base/SafeBool.h"
-#include "zypp/ResStore.h"
+//#include "zypp/ResStore.h"
#include "zypp/RepoInfo.h"
+#include "zypp/repo/PackageDelta.h"
namespace zypp
{
+ class ResStore;
+
namespace repo
{
DEFINE_PTR_TYPE(RepositoryImpl);
class Repository : private base::SafeBool<Repository>
{
- 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 repo::RepositoryImpl Impl;
typedef repo::RepositoryImpl_Ptr Impl_Ptr;
public:
- /**
+ /**
* \short Default ctor: noRepository.
* \see RepoManager::createFromCache.
*/
Repository();
- /**
+ /**
* A dummy Repository (Id \c 0) providing nothing, doing nothing.
*/
static const Repository noRepository;
/**
* \short Get the resolvables for repo
*/
- const ResStore & resolvables();
+ const zypp::ResStore & resolvables() const;
/**
* \short Repository info used to create this repository
*/
- const RepoInfo info() const;
+ const RepoInfo & info() const;
/**
* \short Patch RPMs the repository provides
*/
const std::list<packagedelta::PatchRpm> & patchRpms() const;
-
+
/**
* \short Delta RPMs the repository provides
*/
const std::list<packagedelta::DeltaRpm> & deltaRpms() const;
-
+
private:
friend base::SafeBool<Repository>::operator bool_type() const;
/** \ref SafeBool test. */
RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl;
};
+ /** \relates Repository */
+ std::ostream & operator<<( std::ostream & str, const Repository & obj );
+ /** \relates Repository */
+ bool operator==( const Repository & lhs, const Repository & rhs );
+ /** \relates Repository */
+ inline bool operator!=( const Repository & lhs, const Repository & rhs )
+ { return !( lhs == rhs ); }
+ /** \relates Repository */
+ bool operator<( const Repository & lhs, const Repository & rhs );
+
}
#endif
+++ /dev/null
-
-#include "zypp/RepositoryFactory.h"
-
-namespace zypp {
-
-RepositoryFactory::RepositoryFactory()
-{
-}
-
-RepositoryFactory::~RepositoryFactory()
-{
-
-}
-
-
-Repository RepositoryFactory::createFrom( const RepoInfo & context )
-{
- return Repository::noRepository;
-}
-
-} // ns zypp
-
-
+++ /dev/null
-
-#ifndef ZYPP_REPOSITORY_FACTORY_H
-#define ZYPP_REPOSITORY_FACTORY_H
-
-#include "zypp/Repository.h"
-#include "zypp/RepoInfo.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 RepoInfo & context );
- };
-}
-
-#endif
-
-
#include "zypp/Resolvable.h"
#include "zypp/CapFilters.h"
-#include "zypp/Source.h"
-
#include "zypp/PoolItem.h"
#include "zypp/CapAndItem.h"
+//#include "zypp/Repository.h"
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
+ class Repository;
///////////////////////////////////////////////////////////////////
namespace resfilter
{ /////////////////////////////////////////////////////////////////
};
- /** Select ResObject by source. */
- struct BySource : public ResObjectFilterFunctor
+ /** Select ResObject by repository. */
+ struct ByRepository : public ResObjectFilterFunctor
{
- BySource( Source_Ref source_r )
- : _source( source_r )
+ ByRepository( Repository repository_r )
+ : _repository( repository_r )
{}
bool operator()( ResObject::constPtr p ) const
{
- return p->source() == _source;
+ return p->repository() == _repository;
}
- Source_Ref _source;
+ Repository _repository;
};
*
*/
#include "zypp/ResObject.h"
-#include "zypp/source/SourceImpl.h"
#include "zypp/Repository.h"
#include "zypp/detail/ResObjectImplIf.h"
//
std::ostream & ResObject::dumpOn( std::ostream & str ) const
{
- str << "[S" << source().numericId() << ":" << sourceMediaNr() << "]";
+ str << "[S" << repository().numericId() << ":" << mediaNr() << "]";
return Resolvable::dumpOn( str );
}
ByteCount ResObject::size() const
{ return pimpl().size(); }
- ByteCount ResObject::archivesize() const
- { return pimpl().archivesize(); }
-
- Source_Ref ResObject::source() const
- { return pimpl().source(); }
-
- unsigned ResObject::sourceMediaNr() const
- { return pimpl().sourceMediaNr(); }
-
Repository ResObject::repository() const
{ return pimpl().repository(); }
+ ByteCount ResObject::downloadSize() const
+ { return pimpl().downloadSize(); }
+
unsigned ResObject::mediaNr() const
{ return pimpl().mediaNr(); }
Date ResObject::installtime() const
{ return pimpl().installtime(); }
-
- ZmdId ResObject::zmdid () const
- { return pimpl().zmdid(); }
-
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
#include "zypp/Resolvable.h"
#include "zypp/TranslatedText.h"
#include "zypp/NeedAType.h"
+#include "zypp/Date.h"
+#include "zypp/OnMediaLocation.h"
///////////////////////////////////////////////////////////////////
namespace zypp
class ImplConnect;
class ResObjectImplIf;
}
- class Source_Ref;
+
class Repository;
class ByteCount;
ByteCount size() const;
/** Size of the rpm package. */
- ByteCount archivesize() const;
+ ByteCount downloadSize() const;
/**
- * Source providing this resolvable
+ * \short Download size
+ * \deprecated Use downloadSize()
*/
- /*ZYPP_DEPRECATED */ Source_Ref source() const;
+ ZYPP_DEPRECATED ByteCount archivesize() const
+ { return downloadSize(); }
/**
* Source providing this resolvable
*/
Repository repository() const;
-
+
/**
* Media number where the resolvable is located
* 0 if no media access is required.
*/
unsigned mediaNr() const;
-
- /**
- * Media number where the resolvable is located
- * 0 if no media access is required.
- */
- /* ZYPP_DEPRECATED */ unsigned sourceMediaNr() const;
-
- /**
- * \deprecated Use sourceMediaNr
- */
- /* ZYPP_DEPRECATED */ unsigned mediaId() const
- { return sourceMediaNr(); }
/**
* \TODO FIXME what is this?
*/
Date installtime() const;
- /**
- * \deprecated No replacement.
- */
- ZYPP_DEPRECATED ZmdId zmdid () const;
-
protected:
/** Ctor */
ResObject( const Kind & kind_r,
ResPool::byCapabilityIndex_iterator ResPool::byCapabilityIndexEnd( const std::string & index_r, Dep depType_r ) const
{ return _pimpl->_caphash.end( index_r, depType_r ); }
+ ResPool::size_type ResPool::knownRepositoriesSize() const
+ { return _pimpl->knownRepositories().size(); }
+
+ ResPool::repository_iterator ResPool::knownRepositoriesBegin() const
+ { return _pimpl->knownRepositories().begin(); }
+
+ ResPool::repository_iterator ResPool::knownRepositoriesEnd() const
+ { return _pimpl->knownRepositories().end(); }
+
void ResPool::setAdditionalRequire( const AdditionalCapSet & capset ) const
{ _pimpl->setAdditionalRequire( capset ); }
ResPool::AdditionalCapSet & ResPool::additionalRequire() const
{ return _pimpl->additionalRequire(); }
-
+
void ResPool::setAdditionalConflict( const AdditionalCapSet & capset ) const
{ _pimpl->setAdditionalConflict( capset ); }
ResPool::AdditionalCapSet & ResPool::additionaConflict() const
{ return _pimpl->additionaConflict(); }
-
+
void ResPool::setAdditionalProvide( const AdditionalCapSet & capset ) const
{ _pimpl->setAdditionalProvide( capset ); }
ResPool::AdditionalCapSet & ResPool::additionaProvide() const
{ return _pimpl->additionaProvide(); }
-
+
/******************************************************************
**
typedef pool::PoolTraits::byName_iterator byName_iterator;
typedef pool::PoolTraits::byCapabilityIndex_iterator byCapabilityIndex_iterator;
typedef pool::PoolTraits::AdditionalCapSet AdditionalCapSet;
+ typedef pool::PoolTraits::repository_iterator repository_iterator;
public:
/** Default ctor: empty pool */
public:
/** \name Iterate through all ResObjects of a certain kind. */
//@{
- typedef resfilter::ByKind ByKind;
+ typedef zypp::resfilter::ByKind ByKind;
typedef filter_iterator<ByKind,const_iterator> byKind_iterator;
byKind_iterator byKindBegin( const ResObject::Kind & kind_r ) const
//@}
public:
+ /** \name Iterate through all Repositories that contribute ResObjects.
+ */
+ //@{
+ size_type knownRepositoriesSize() const;
+
+ repository_iterator knownRepositoriesBegin() const;
+
+ repository_iterator knownRepositoriesEnd() const;
+ //@}
+
+ public:
/** \name Handling addition capabilities in the pool in order for solving it in
* a solver run. This is used for tasks like needing a package with the name "foo".
* The solver has to evaluate a proper package by his own.
*/
/**
- * Handling additional requirement. E.G. need package "foo" and package
+ * Handling additional requirement. E.G. need package "foo" and package
* "foo1" which has a greater version than 1.0:
*
* \code
* CapSet capset;
- * capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo"));
+ * capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo"));
* capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo1 > 1.0"));
*
* // The user is setting this capablility
/**
* Handling additional conflicts. E.G. do not install anything which provides "foo":
*
- * \code
- * CapSet capset;
+ * \code75
+ * CapSet capset;
* capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo"));
*
* // The user is setting this capablility
* ResPool::AdditionalCapSet aCapSet;
* aCapSet[ResStatus::USER] = capset;
*
- * setAdditionalConflict( aCapSet );
+ * setAdditionalConflict( aCapSet );
* \endcode
- */
+ */
void setAdditionalConflict( const AdditionalCapSet & capset ) const;
AdditionalCapSet & additionaConflict() const;
-
+
/**
* Handling additional provides. This is used for ignoring a requirement.
* e.G. Do ignore the requirement "foo":
*
* \code
- * CapSet capset;
+ * CapSet capset;
* capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo"));
*
* // The user is setting this capablility
* ResPool::AdditionalCapSet aCapSet;
* aCapSet[ResStatus::USER] = capset;
*
- * setAdditionalProvide( aCapSet );
+ * setAdditionalProvide( aCapSet );
* \endcode
- */
+ */
void setAdditionalProvide( const AdditionalCapSet & capset ) const;
- AdditionalCapSet & additionaProvide() const;
+ AdditionalCapSet & additionaProvide() const;
private:
/** */
const_iterator byKindEnd( const ResObject::Kind & kind_r ) const
{ return _selPool[kind_r].end(); }
+ public:
+ size_type knownRepositoriesSize() const
+ { return _pool.knownRepositoriesSize(); }
+
+ repository_iterator knownRepositoriesBegin() const
+ { return _pool.knownRepositoriesBegin(); }
+
+ repository_iterator knownRepositoriesEnd() const
+ { return _pool.knownRepositoriesEnd(); }
public:
ResPoolProxy::const_iterator ResPoolProxy::byKindEnd( const ResObject::Kind & kind_r ) const
{ return _pimpl->byKindEnd( kind_r ); }
+ ResPoolProxy::size_type ResPoolProxy::knownRepositoriesSize() const
+ { return _pimpl->knownRepositoriesSize(); }
+
+ ResPoolProxy::repository_iterator ResPoolProxy::knownRepositoriesBegin() const
+ { return _pimpl->knownRepositoriesBegin(); }
+
+ ResPoolProxy::repository_iterator ResPoolProxy::knownRepositoriesEnd() const
+ { return _pimpl->knownRepositoriesEnd(); }
+
void ResPoolProxy::saveState() const
{ _pimpl->saveState(); }
typedef SelectableIndex::const_iterator const_iterator;
typedef SelectableIndex::size_type size_type;
+ typedef ResPool::repository_iterator repository_iterator;
+
public:
/** Default ctor: no pool */
ResPoolProxy();
{ return byKindEnd( ResTraits<_Res>::kind ); }
//@}
+ public:
+ /** \name Iterate through all Repositories that contribute ResObjects.
+ */
+ //@{
+ size_type knownRepositoriesSize() const;
+
+ repository_iterator knownRepositoriesBegin() const;
+
+ repository_iterator knownRepositoriesEnd() const;
+ //@}
+
public:
/** Test whether there is at least one ui::Selectable with
* an installed object.
/** Type of Resolvable provided by ResStore. */
typedef ResObject ResT;
-
+
private:
typedef std::set<ResT::Ptr> StorageT;
-
+
public:
-
+ typedef StorageT::value_type value_type;
+ typedef StorageT::const_reference const_reference;
typedef StorageT::size_type size_type;
typedef StorageT::iterator iterator;
typedef StorageT::const_iterator const_iterator;
/** */
iterator insert( const ResT::Ptr & ptr_r )
{ return store().insert( ptr_r ).first; }
+
+ /** */
+ iterator insert( iterator position, const value_type &v )
+ { return store().insert( position, v ); }
+
/** */
template <class _InputIterator>
void insert( _InputIterator first_r, _InputIterator last_r )
#include "zypp/detail/ResolvableImpl.h"
#include "zypp/ResObject.h"
-#include "zypp/Source.h"
using namespace std;
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/Source.cc
- *
-*/
-#include <cassert>
-
-#include <iostream>
-
-#include "zypp/Source.h"
-#include "zypp/source/SourceImpl.h"
-#include "zypp/SourceFactory.h"
-
-using namespace std;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-
- const Source_Ref Source_Ref::noSource;
-
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : Source_Ref::Source_Ref
- // METHOD TYPE : Ctor
- //
- Source_Ref::Source_Ref()
- : _pimpl( Impl::nullimpl() )
- {}
-
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : Source_Ref::Source_Ref
- // METHOD TYPE : Ctor
- //
- Source_Ref::Source_Ref( const Impl_Ptr & impl_r )
- : _pimpl( impl_r )
- {
- assert( impl_r );
- }
-
- ///////////////////////////////////////////////////////////////////
- //
- // Forward to SourceImpl:
- //
- ///////////////////////////////////////////////////////////////////
-
- Source_Ref::NumericId Source_Ref::numericId() const
- { return _pimpl->numericId(); }
-
- bool Source_Ref::resStoreInitialized() const
- { return _pimpl->resStoreInitialized(); }
-
- const ResStore & Source_Ref::resolvables() const
- { return _pimpl->resolvables(); }
-
- const ResStore Source_Ref::resolvables(zypp::Resolvable::Kind kind) const
- { return _pimpl->resolvables(kind); }
-
- const Pathname Source_Ref::provideFile(const Pathname & file_r,
- const unsigned media_nr)
- { return _pimpl->provideFile(file_r, media_nr); }
-
- const Pathname Source_Ref::provideDirTree(const Pathname & dir_r,
- const unsigned media_nr)
- { return _pimpl->provideDirTree(dir_r, media_nr); }
-
- const Pathname Source_Ref::providePackage( Package::constPtr package )
- { return _pimpl->providePackage( package ); }
-
- const void Source_Ref::releaseFile(const Pathname & file_r,
- const unsigned media_nr)
- { _pimpl->releaseFile(file_r, media_nr); }
-
- const void Source_Ref::releaseDir(const Pathname & dir_r,
- const unsigned media_nr,
- bool recursive)
- { _pimpl->releaseDir(dir_r, media_nr, recursive); }
-
- bool Source_Ref::enabled() const
- { return _pimpl->enabled(); }
-
- void Source_Ref::enable()
- { _pimpl->enable(); }
-
- void Source_Ref::disable()
- { _pimpl->disable(); }
-
- Date Source_Ref::timestamp() const
- { return _pimpl->timestamp(); }
-
- std::string Source_Ref::checksum() const
- { return _pimpl->checksum(); }
-
- bool Source_Ref::autorefresh() const
- { return _pimpl->autorefresh(); }
-
- void Source_Ref::setAutorefresh( bool enable_r )
- { _pimpl->setAutorefresh( enable_r ); }
-
- void Source_Ref::refresh()
- { _pimpl->refresh() ; }
-
- void Source_Ref::storeMetadata(const Pathname & cache_dir_r)
- { _pimpl->storeMetadata(cache_dir_r); }
-
- string Source_Ref::alias (void) const
- { return _pimpl->alias(); }
-
- void Source_Ref::setAlias (const std::string & alias_r)
- { _pimpl->setAlias( alias_r ); }
-
- string Source_Ref::type (void) const
- { return _pimpl->type(); }
-
- string Source_Ref::id (void) const
- { return _pimpl->id(); }
-
- void Source_Ref::setId (const std::string id_r)
- { return _pimpl->setId (id_r); }
-
- unsigned Source_Ref::priority (void) const
- { return _pimpl->priority(); }
-
- void Source_Ref::setPriority (unsigned p)
- { return _pimpl->setPriority(p); }
-
- unsigned Source_Ref::priorityUnsubscribed (void) const
- { return _pimpl->priorityUnsubscribed(); }
-
- void Source_Ref::setPriorityUnsubscribed (unsigned p)
- { return _pimpl->setPriorityUnsubscribed( p ); }
-
- bool Source_Ref::subscribed(void) const
- { return _pimpl->subscribed(); }
-
- void Source_Ref::setSubscribed (bool s)
- { return _pimpl->setSubscribed( s ); }
-
- Url Source_Ref::url (void) const
- { return _pimpl->url (); }
-
- void Source_Ref::setUrl( const Url & url )
- { _pimpl->setUrl( url ); }
-
- bool Source_Ref::remote (void) const
- { return _pimpl->remote (); }
-
- const Pathname & Source_Ref::path (void) const
- { return _pimpl->path (); }
-
- bool Source_Ref::baseSource() const
- { return _pimpl->baseSource(); }
-
- const Pathname & Source_Ref::cacheDir (void) const
- { return _pimpl->cacheDir (); }
-
- void Source_Ref::changeMedia(const media::MediaId & media_r, const Pathname & path_r)
- { _pimpl->changeMedia(media_r, path_r); }
-
- void Source_Ref::redirect(unsigned media_nr, const Url & new_url)
- { _pimpl->redirect(media_nr, new_url); }
-
- void Source_Ref::release()
- { _pimpl->release(); }
-
- void Source_Ref::reattach(const Pathname &attach_point)
- { _pimpl->reattach(attach_point); }
-
- media::MediaVerifierRef Source_Ref::verifier(unsigned media_nr)
- { return _pimpl->verifier(media_nr); }
-
- unsigned Source_Ref::numberOfMedia(void) const
- { return _pimpl->numberOfMedia(); }
-
- std::string Source_Ref::vendor (void) const
- { return _pimpl->vendor(); }
-
- const std::list<Pathname> Source_Ref::publicKeys()
- { return _pimpl->publicKeys(); }
-
- std::string Source_Ref::unique_id (void) const
- { return _pimpl->unique_id(); }
-
- bool Source_Ref::hasResolvablesOfKind( const zypp::Resolvable::Kind &kind ) const
- { return _pimpl->resolvableKinds().count(kind) != 0; }
-
- std::set<zypp::Resolvable::Kind> Source_Ref::resolvableKinds() const
- { return _pimpl->resolvableKinds(); }
-
- /******************************************************************
- **
- ** FUNCTION NAME : operator<<
- ** FUNCTION TYPE : std::ostream &
- */
- std::ostream & operator<<( std::ostream & str, const Source_Ref & obj )
- {
- return str << *obj._pimpl;
- }
-
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/Source.h
- *
-*/
-#ifndef ZYPP_SOURCE_H
-#define ZYPP_SOURCE_H
-
-#include <iosfwd>
-#include <string>
-
-#include "zypp/base/PtrTypes.h"
-#include "zypp/base/SafeBool.h"
-
-#include "zypp/Package.h"
-#include "zypp/Pathname.h"
-#include "zypp/Url.h"
-#include "zypp/Resolvable.h"
-
-#include "zypp/media/MediaManager.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- namespace source
- {
- class SourceImpl;
- DEFINE_PTR_TYPE(SourceImpl);
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : SkipRequestedException
- //
- /**
- * A specialized exception to inform the caller that user
- * specifically asked the file/directory providing to be skipped.
- */
- class SkipRequestedException : public Exception {
- public:
- SkipRequestedException ( const std::string & msg_r ) : Exception( msg_r ) {}
- };
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : SourceUserRejectedException
- //
- /**
- * A specialized exception to inform the caller that user
- * specifically rejected the source
- */
- class SourceUserRejectedException : public Exception
- {
- public:
- SourceUserRejectedException ( const std::string & msg_r ) : Exception( msg_r ) {}
- };
-
- /**
- * A specialized exception to inform the caller that the metadata is invalid
- */
- class SourceMetadataException : public Exception
- {
- public:
- SourceMetadataException ( const std::string & msg_r ) : Exception( msg_r ) {}
- };
-
- /**
- * A specialized exception to inform the caller that there is an IO error
- */
- class SourceIOException : public Exception
- {
- public:
- SourceIOException ( const std::string & msg_r ) : Exception( msg_r ) {}
- };
-
- /**
- * A specialized exception to inform the caller that the source URL does not exist
- */
- class SourceNotFoundException : public Exception
- {
- public:
- SourceNotFoundException ( const std::string & msg_r ) : Exception( msg_r ) {}
- };
-
- /**
- * A specialized exception to inform the caller that the source is not known
- */
- class SourceUnknownTypeException : public Exception
- {
- public:
- SourceUnknownTypeException ( const std::string & msg_r ) : Exception( msg_r ) {}
- };
- }
- class ResStore;
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : Source
- //
- /**
- * \note Source is a reference to the implementation. No COW
- * is performed.
- */
- class Source_Ref : private base::SafeBool<Source_Ref>
- {
- friend std::ostream & operator<<( std::ostream & str, const Source_Ref & obj );
- friend bool operator==( const Source_Ref & lhs, const Source_Ref & rhs );
- friend bool operator<( const Source_Ref & lhs, const Source_Ref & rhs );
-
- public:
- typedef source::SourceImpl Impl;
- typedef source::SourceImpl_Ptr Impl_Ptr;
-
- public:
-
- /** Default ctor: noSource.
- * Real Sources are to be created via SourceFactory.
- */
- Source_Ref();
-
- /** A dummy Source (Id \c 0) providing nothing, doing nothing.
- * \todo provide a _constRef
- */
- static const Source_Ref noSource;
-
- /** Validate Source_Ref in a boolean context.
- * \c FALSE iff == noSource.
- */
- using base::SafeBool<Source_Ref>::operator bool_type;
-
- public:
- typedef unsigned long NumericId;
-
- /** Runtime unique numeric Source Id. */
- NumericId numericId() const;
-
- public:
-
- /**
- * an aproxmate checksum that should change
- * when the source changes
- * can be used to determine if
- * the source needs to be read again or not.
- * (read as parse its metadata, not about downloading)
- */
- std::string checksum() const;
-
- /**
- * aproximate age of the source, can be used to determine if
- * the source needs to be read again or not.
- * (read as parse its metadata, not about downloading)
- */
- Date timestamp() const;
-
- /**
- * wether this source provides or supports resolvables
- * of certain kind.
- */
- bool hasResolvablesOfKind( const zypp::Resolvable::Kind &kind ) const;
-
- /**
- * set of resolvable types the source can offer at this moment
- */
- std::set<zypp::Resolvable::Kind> resolvableKinds() const;
-
- /** Whether the ResStore is initialized.
- * If we know that noone has seen the resolvables yet, we can skip
- * them too, eg. when deleting a source. (#174840)
- */
- bool resStoreInitialized() const;
-
- /** All resolvables provided by this source. */
- const ResStore & resolvables() const;
-
- /** All resolvables of a given kind provided by this source. */
- const ResStore resolvables(zypp::Resolvable::Kind kind) const;
-
- const Pathname providePackage( Package::constPtr package );
-
- /** Provide a file to local filesystem */
- const Pathname provideFile(const Pathname & file_r, const unsigned media_nr = 1);
- const Pathname provideDirTree(const Pathname & dir_r, const unsigned media_nr = 1);
-
- const void releaseFile(const Pathname & file_r, const unsigned media_nr = 1);
- const void releaseDir(const Pathname & dir_r, const unsigned media_nr = 1, bool recursive = false);
-
- bool enabled() const;
-
- void enable();
-
- void disable();
-
- bool autorefresh() const;
- void setAutorefresh( bool enable_r );
- void refresh();
-
- void storeMetadata(const Pathname & cache_dir_r);
-
- /**
- * User chosen identificaton, must be unique
- */
- std::string alias (void) const;
- /**
- * User chosen identificaton, must be unique
- */
- void setAlias (const std::string & alias_r);
-
- /**
- * Source type, like YaST or YUM
- */
- std::string type (void) const;
-
- unsigned numberOfMedia(void) const;
-
- //! from media.1/media
- std::string vendor (void) const;
- //! from media.1/media
- std::string unique_id (void) const;
-
- //! @name generic information get/set
- //@{
- //! runtime-unique, not persistent, a "handle" for Pkg::, string?!
- std::string id (void) const;
- void setId (const std::string id_r);
- unsigned priority (void) const;
- void setPriority (unsigned p);
- unsigned priorityUnsubscribed (void) const;
- void setPriorityUnsubscribed (unsigned p);
- bool subscribed (void) const;
- void setSubscribed (bool s);
- const Pathname & cacheDir (void) const;
- const std::list<Pathname> publicKeys();
- //@}
-
- //! @name for YaST
- //@{
- Url url (void) const;
- /**
- * required for the parse-metadata helper of libzypp-zmd-backend
- * which gets local files to parse but the source is really remote.
- */
- void setUrl( const Url & url );
- bool remote() const;
- const Pathname & path (void) const;
- bool baseSource() const;
- //@}
-
- public:
- /**
- * Change the media of the source (in case original media is not available)
- * The media must be ready-to-use (in the same form as when passing to SourceImpl constructor)
- */
- void changeMedia(const media::MediaId & media_r, const Pathname & path_r);
-
- /**
- * Redirect the given media to the given URL instead of the standard one.
- */
- void redirect(unsigned media_nr, const Url & new_url);
-
- /**
- * Release all medias attached by the source
- */
- void release();
-
- /**
- * Reattach the source if it is not mounted, but downloaded,
- * to different directory
- *
- * \throws Exception
- */
- void reattach(const Pathname &attach_point);
-
- /**
- * Provide a media verifier suitable for the given media number
- */
- media::MediaVerifierRef verifier(unsigned media_nr);
-
- private:
- friend base::SafeBool<Source_Ref>::operator bool_type() const;
- /** \ref SafeBool test. */
- bool boolTest() const
- { return _pimpl != noSource._pimpl; }
-
- private:
- /** Factory */
- friend class SourceFactory;
- friend class source::SourceImpl;
-
- private:
- /** Factory ctor */
- explicit
- Source_Ref( const Impl_Ptr & impl_r );
-
- private:
- /** Pointer to implementation */
- Impl_Ptr _pimpl;
- };
- ///////////////////////////////////////////////////////////////////
-
- /** \relates Source Stream output. */
- std::ostream & operator<<( std::ostream & str, const Source_Ref & obj );
-
- /** \relates Source_Ref Equal if same implementation class. */
- inline bool operator==( const Source_Ref & lhs, const Source_Ref & rhs )
- { return lhs._pimpl == rhs._pimpl; }
-
- /** \relates Source_Ref */
- inline bool operator!=( const Source_Ref & lhs, const Source_Ref & rhs )
- { return ! (lhs == rhs); }
-
- /** \relates Source_Ref Order in std::conainer based on _pimpl. */
- inline bool operator<( const Source_Ref & lhs, const Source_Ref & rhs )
- { return lhs._pimpl < rhs._pimpl; }
-
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/SourceCache.cc
- *
-*/
-#include <iostream>
-#include <fstream>
-#include "zypp/base/Logger.h"
-#include "zypp/base/Exception.h"
-#include "zypp/base/String.h"
-
-#include "zypp/SourceCache.h"
-#include "zypp/source/Builtin.h"
-#include "zypp/media/MediaAccess.h"
-#include "zypp/SourceFactory.h"
-#include "zypp/SourceManager.h"
-#include "zypp/Pathname.h"
-
-using std::endl;
-using namespace zypp::source;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : SourceCache
- //
- ///////////////////////////////////////////////////////////////////
- Pathname SourceCache::_cache_dir = "/var/adm/ZYPP/SourceCache";
- unsigned SourceCache::_next_cache_id = 0;
-
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : SourceCache::SourceCache
- // METHOD TYPE : Ctor
- //
- SourceCache::SourceCache()
- {}
-
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : SourceCache::~SourceCache
- // METHOD TYPE : Dtor
- //
- SourceCache::~SourceCache()
- {}
-
- void SourceCache::setCacheDir( const Pathname & dir_r )
- {
- _cache_dir = dir_r;
- }
-
- void SourceCache::storeSource(Source_Ref src)
- {
- if (0 != assert_dir(_cache_dir, 0700))
- ZYPP_THROW(Exception("Cannot create cache directory"));
- Pathname cache_dir = _cache_dir + str::hexstring(_next_cache_id++);
- if (0 != assert_dir(cache_dir, 0700))
- ZYPP_THROW(Exception("Cannot create cache directory"));
- src.storeMetadata(cache_dir);
- Url url = src.url();
- Pathname path = src.path();
- std::string alias = src.alias();
- std::ofstream data((cache_dir + "source_info").asString().c_str());
- data << url.asCompleteString() << endl;
- data << path.asString() << endl;
- data << alias << endl;
- }
-
- void SourceCache::restoreSources()
- {
- std::list<std::string> contents;
- if (0 != readdir( contents, _cache_dir, false))
- ZYPP_THROW(Exception("Cannot read contents of the cache directory"));
- for (std::list<std::string>::const_iterator it = contents.begin();
- it != contents.end(); it++)
- {
- Pathname cache_dir = _cache_dir + *it;
- std::ifstream data((cache_dir + "source_info").asString().c_str());
- std::string url;
- std::string path;
- std::string alias;
- getline(data, url);
- getline(data, path);
- getline(data, alias);
-
- Source_Ref newsrc( SourceFactory().createFrom(url, path, alias, cache_dir) );
- SourceManager::sourceManager()->addSource(newsrc);
- }
- }
-
- void SourceCache::removeSource(unsigned id)
- {
- Pathname cache_dir = _cache_dir + str::hexstring(_next_cache_id++);
- if (0 != recursive_rmdir(cache_dir))
- ZYPP_THROW(Exception("Cannot delete directory with cached metadata"));
- }
-
- void SourceCache::removeSource(const Url & url_r, const Pathname & path_r)
- {
- std::list<std::string> contents;
- if (0 != readdir( contents, _cache_dir, false))
- ZYPP_THROW(Exception("Cannot read contents of the cache directory"));
- for (std::list<std::string>::const_iterator it = contents.begin();
- it != contents.end(); it++)
- {
- Pathname cache_dir = _cache_dir + *it;
- std::ifstream data((cache_dir + "source_info").asString().c_str());
- std::string url;
- std::string path;
- getline(data, url);
- getline(data, path);
- if (url == url_r.asCompleteString() && path == path_r)
- {
- if (0 != recursive_rmdir(cache_dir))
- ZYPP_THROW(Exception("Cannot delete directory with cached metadata"));
- return;
- }
- }
- ZYPP_THROW(Exception("Specified source not stored in the cache"));
- }
-
- /******************************************************************
- **
- ** FUNCTION NAME : operator<<
- ** FUNCTION TYPE : std::ostream &
- */
- std::ostream & operator<<( std::ostream & str, const SourceCache & obj )
- {
- return str << "SourceCache";
- }
-
-
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/SourceCache.h
- *
-*/
-#ifndef ZYPP_SOURCECACHE_H
-#define ZYPP_SOURCECACHE_H
-
-#include <iosfwd>
-#include <string>
-#include <set>
-
-#include "zypp/base/PtrTypes.h"
-
-#include "zypp/Source.h"
-#include "zypp/Url.h"
-#include "zypp/Pathname.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : SourceCache
- //
- // singleton
- //
- class SourceCache
- {
- friend std::ostream & operator<<( std::ostream & str, const SourceCache & obj );
-
- public:
- /** Default ctor */
- SourceCache();
- /** Dtor */
- ~SourceCache();
-
- void setCacheDir(const Pathname& dir_r);
-
- public:
- void storeSource(Source_Ref src);
-
- void restoreSources();
-
- void removeSource(unsigned id);
-
- void removeSource(const Url & url_r, const Pathname & path_r = "/");
-
- private:
- /** directory to store cached data */
- static Pathname _cache_dir;
- /** counter of caches */
- static unsigned _next_cache_id;
-
-
- ///////////////////////////////////////////////////////////////////
- };
-
- /** \relates SourceCache Stream output */
- extern std::ostream & operator<<( std::ostream & str, const SourceCache & obj );
-
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCECACHE_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/SourceFactory.cc
- *
-*/
-#include <iostream>
-#include <fstream>
-#include "zypp/base/Logger.h"
-#include "zypp/base/Exception.h"
-#include "zypp/base/String.h"
-
-#include "zypp/SourceFactory.h"
-#include "zypp/source/Builtin.h"
-#include "zypp/media/MediaAccess.h"
-#include "zypp/ZYppCallbacks.h"
-
-using std::endl;
-using namespace zypp::source;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-
- static media::MediaManager & media_mgr()
- {
- static media::MediaManager _v;
- return _v;
- }
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : SourceFactory::Impl
- //
- /** SourceFactory implementation. */
- struct SourceFactory::Impl
- {
- /** Try to create a \a _SourceImpl kind of Source.
- * \throw EXCEPTION if creation fails
- */
- template<class _SourceImpl>
- static Source_Ref::Impl_Ptr createSourceImpl( const media::MediaId & media_r,
- const SourceInfo &context )
- {
- Source_Ref::Impl_Ptr impl( new _SourceImpl );
- // note, base_source is a tribool, if indeterminate we fallback to false
- //MIL << "Going to call factory ctor:" << endl;
- //MIL << context << endl;
- impl->factoryCtor( media_r, context.path(), context.alias(), context.cacheDir(), context.baseSource(), context.autorefresh() );
- return impl;
- }
- };
- ///////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : SourceFactory
- //
- ///////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : SourceFactory::SourceFactory
- // METHOD TYPE : Ctor
- //
- SourceFactory::SourceFactory()
- {}
-
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : SourceFactory::~SourceFactory
- // METHOD TYPE : Dtor
- //
- SourceFactory::~SourceFactory()
- {}
-
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : SourceFactory::createFrom
- // METHOD TYPE : Source
- //
- Source_Ref SourceFactory::createFrom( const Source_Ref::Impl_Ptr & impl_r )
- {
- return impl_r ? Source_Ref( impl_r ) : Source_Ref::noSource;
- }
-
- void SourceFactory::listProducts( const Url & url_r, ProductSet & products_r )
- {
- if (! url_r.isValid())
- ZYPP_THROW( Exception("Empty URL passed to SourceFactory") );
-
- // open the media
- media::MediaId id = media_mgr().open(url_r);
- media_mgr().attach(id);
- Pathname products_file = Pathname("media.1/products");
-
- try {
- media_mgr().provideFile (id, products_file);
- products_file = media_mgr().localPath (id, products_file);
- scanProductsFile (products_file, products_r);
- }
- catch ( const Exception & excpt ) {
- ZYPP_CAUGHT(excpt);
- MIL << "No products description found on the Url" << endl;
- }
-
- media_mgr().release(id);
- }
-
- Source_Ref SourceFactory::createFrom( const source::SourceInfo &context )
- {
- if ( context.type().empty() )
- {
- return createFrom( context.url(),
- context.path(),
- context.alias(),
- context.cacheDir(),
- context.baseSource() );
- }
- else
- {
- return createFrom( context.type(),
- context.url(),
- context.path(),
- context.alias(),
- context.cacheDir(),
- context.baseSource(),
- context.autorefresh() );
- }
- }
-
- template<typename _SourceImpl>
- static bool probeSource(const Url &url_r, const Pathname &path_r, media::MediaId id, const std::string &type, callback::SendReport<ProbeSourceReport> &report )
- {
- boost::function<bool()> probe = typename _SourceImpl::Prober( id, path_r );
-
- if ( probe() )
- {
- report->successProbe(url_r, type);
- return true;
- }
- else
- {
- report->failedProbe(url_r, type);
- return false;
- }
- return false;
- }
-
- template<class _SourceImpl>
- Source_Ref SourceFactory::createSourceImplWorkflow( media::MediaId id, const SourceInfo &context )
- {
- //MIL << "Trying (pre) to create source of type " << _SourceImpl::typeString() << endl;
- callback::SendReport<SourceCreateReport> report;
- bool retry = true;
- while (retry)
- {
- report->start( context.url() );
- try
- {
- MIL << "Trying to create source of type " << _SourceImpl::typeString() << endl;
- Source_Ref::Impl_Ptr impl( Impl::createSourceImpl<_SourceImpl>( id, context ) );
- MIL << "Created source " << impl->type() << endl;
- report->finish( context.url(), SourceCreateReport::NO_ERROR, std::string() );
- return Source_Ref(impl);
- }
- catch (const SourceUserRejectedException & excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- report->problem( context.url(), SourceCreateReport::REJECTED, "Source rejected by the user" );
- report->finish( context.url(), SourceCreateReport::NO_ERROR, "" );
- ZYPP_THROW(Exception( "Source Rejected: " + excpt_r.asUserString() ));
- }
- catch ( const SourceMetadataException & excpt_r )
- {
- ZYPP_CAUGHT(excpt_r);
- report->problem( context.url(), SourceCreateReport::REJECTED, "Source metadata is invalid: " + excpt_r.asUserString() );
- report->finish( context.url(), SourceCreateReport::REJECTED, "" );
- ZYPP_THROW(Exception( "Invalid Source: " + excpt_r.asUserString() ));
- }
- catch (const Exception & excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- if ( report->problem( context.url(), SourceCreateReport::UNKNOWN, "Unknown Error: " + excpt_r.asUserString() ) != SourceCreateReport::RETRY )
- {
- report->finish( context.url(), SourceCreateReport::UNKNOWN, std::string("Unknown Error: ") + excpt_r.asUserString() );
- ZYPP_THROW(Exception( "Unknown Error: " + excpt_r.asUserString() ));
- }
- }
- }
- // never reached
- return Source_Ref();
- }
-
- Source_Ref SourceFactory::createFrom( const Url & url_r, const Pathname & path_r, const std::string & alias_r, const Pathname & cache_dir_r, bool base_source )
- {
- if (! url_r.isValid())
- ZYPP_THROW( Exception("Empty URL passed to SourceFactory") );
-
-#warning if cache_dir is provided, no need to open the original url
- // open the media
- media::MediaId id = media_mgr().open(url_r);
-
- // add dummy verifier
- media_mgr().addVerifier(id, media::MediaVerifierRef(new media::NoVerifier()));
- // attach only if initializing from media and not from cache (#153073)
- if (cache_dir_r == "")
- {
- media_mgr().attach(id);
- }
- else
- {
- MIL << "Initializing from cache" << endl;
- }
-
- bool auto_refresh = media::MediaAccess::canBeVolatile( url_r );
-
- SourceInfo context( url_r, path_r, alias_r, cache_dir_r, auto_refresh );
- context.setBaseSource( base_source );
-
- callback::SendReport<ProbeSourceReport> report;
- bool probeYUM = false;
- bool probeYaST = false;
-
- report->start(url_r);
- try
- {
- if ( (probeYUM = probeSource<yum::YUMSourceImpl>( url_r, path_r, id, "YUM", report )) )
- {
- // nothing
- }
- else if ( (probeYaST = probeSource<susetags::SuseTagsImpl>( url_r, path_r, id, "YaST", report )) )
- {
- // nohing
- }
- report->finish(url_r, ProbeSourceReport::NO_ERROR, "");
-
- if ( probeYUM )
- {
- Source_Ref source(createSourceImplWorkflow<source::yum::YUMSourceImpl>( id, context ));
- return source;
- }
- else if ( probeYaST )
- {
- Source_Ref source(createSourceImplWorkflow<susetags::SuseTagsImpl>( id, context ));
- return source;
- }
- else
- {
- ZYPP_THROW( SourceUnknownTypeException("Unknown source type for " + url_r.asString() ) );
- }
- }
- catch ( const Exception &e )
- {
- report->finish(url_r, ProbeSourceReport::IO, e.asUserString());
- ZYPP_RETHROW(e);
- }
- //////////////////////////////////////////////////////////////////
- // TRY PLAINDIR
- //////////////////////////////////////////////////////////////////
- //FIXME disabled
-
- return Source_Ref(); // not reached!!
- }
-
- Source_Ref SourceFactory::createFrom( const std::string & type, const Url & url_r, const Pathname & path_r, const std::string & alias_r, const Pathname & cache_dir_r, bool base_source, tribool auto_refresh )
- {
- if (! url_r.isValid())
- ZYPP_THROW( Exception("Empty URL passed to SourceFactory") );
-
- //callback::SendReport<CreateSourceReport> report;
-
- //report->startProbe (url_r);
-
-#warning if cache_dir is provided, no need to open the original url
- // open the media
- media::MediaId id = media_mgr().open(url_r);
-
- // add dummy verifier
- media_mgr().addVerifier(id, media::MediaVerifierRef(new media::NoVerifier()));
- // attach only if initializing from media and not from cache (#153073)
- if (cache_dir_r == "")
- {
- media_mgr().attach(id);
- }
- else
- {
- MIL << "Initializing from cache" << endl;
- }
-
- bool calculated_autorefresh = auto_refresh;
- // Sane default for unknown autorefresh
- if ( auto_refresh == indeterminate )
- calculated_autorefresh = media::MediaAccess::canBeVolatile( url_r );
-
- //SourceInfo( url, path, alias, cache_dir, autorefresh );
- SourceInfo context( url_r, path_r, alias_r, cache_dir_r, calculated_autorefresh );
- context.setBaseSource( base_source );
- context.setType( type );
-
- try
- {
- Source_Ref::Impl_Ptr impl;
-
- if( type == yum::YUMSourceImpl::typeString() )
- {
- MIL << "Trying the YUM source" << endl;
- impl = Source_Ref::Impl_Ptr( Impl::createSourceImpl<yum::YUMSourceImpl>(id, context ) );
- MIL << "YUM source created" << endl;
- }
- else if ( type == susetags::SuseTagsImpl::typeString() )
- {
- MIL << "Trying the SUSE tags source" << endl;
- impl = Source_Ref::Impl_Ptr( Impl::createSourceImpl<susetags::SuseTagsImpl>(id, context ) );
- MIL << "YaST source created" << endl;
- }
- else if ( type == PlaindirImpl::typeString() )
- {
- MIL << "Trying the Plaindir source" << endl;
- impl = Source_Ref::Impl_Ptr( Impl::createSourceImpl<PlaindirImpl>(id, context ) );
- MIL << "Plaindir source created" << endl;
- }
- else
- {
- ZYPP_THROW( Exception ("Cannot create source of unknown type '" + type + "'"));
- }
-
- // never reached
- return Source_Ref(impl);
- }
- catch (const Exception & excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- MIL << "Creating a source of type " << type << " failed " << endl;
- ZYPP_RETHROW(excpt_r);
- }
-
- return Source_Ref(); // not reached!!
- }
-
-
- /******************************************************************
- **
- ** FUNCTION NAME : operator<<
- ** FUNCTION TYPE : std::ostream &
- */
- std::ostream & operator<<( std::ostream & str, const SourceFactory & obj )
- {
- return str << "SourceFactory";
- }
-
- void SourceFactory::scanProductsFile( const Pathname & file_r, ProductSet & pset_r ) const
- {
- std::ifstream pfile( file_r.asString().c_str() );
- while ( pfile.good() ) {
-
- std::string value = str::getline( pfile, str::TRIM );
- if ( pfile.bad() ) {
- ERR << "Error parsing " << file_r << endl;
- ZYPP_THROW(Exception("Error parsing " + file_r.asString()));
- }
- if ( pfile.fail() ) {
- break; // no data on last line
- }
- std::string tag = str::stripFirstWord( value, true );
-
- if ( tag.size() ) {
- pset_r.insert( ProductEntry( tag, value ) );
- }
- }
- }
-
-
-
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/SourceFactory.h
- *
-*/
-#ifndef ZYPP_SOURCEFACTORY_H
-#define ZYPP_SOURCEFACTORY_H
-
-#include <iosfwd>
-#include <string>
-#include <set>
-#include <boost/logic/tribool.hpp>
-
-#include "zypp/base/PtrTypes.h"
-
-#include "zypp/Source.h"
-#include "zypp/source/SourceInfo.h"
-#include "zypp/Url.h"
-#include "zypp/Pathname.h"
-
-using namespace boost;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-
- template<class T>
- bool probeSource( media::MediaAccessId media_id );
-
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : SourceFactory
- //
- /** Factory to create a \ref Source_Ref.
- * Actually a Singleton
- *
- */
- class SourceFactory
- {
- friend std::ostream & operator<<( std::ostream & str, const SourceFactory & obj );
-
- public:
- /** Default ctor */
- SourceFactory();
- /** Dtor */
- ~SourceFactory();
-
- public:
- /** Construct source.
- * \throw EXCEPTION on fail
- */
- Source_Ref createFrom( const source::SourceInfo & context );
-
- /** Construct source from an implementation.
- * Returns Source_Ref::noSource on NULL \a impl_r.
- */
- Source_Ref createFrom( const Source_Ref::Impl_Ptr & impl_r );
-
- /** Construct source.
- * \throw EXCEPTION on fail
- */
- Source_Ref createFrom( const Url & url_r, const Pathname & path_r = "/", const std::string & alias_r = "", const Pathname & cache_dir_r = "", bool base_source = false );
-
- /** Construct source of a given type.
- * \throw EXCEPTION on fail
- */
- Source_Ref createFrom( const std::string & type, const Url & url_r, const Pathname & path_r, const std::string & alias_r, const Pathname & cache_dir_r, bool base_source, tribool auto_refresh );
-
- protected:
- template<class _SourceImpl>
- Source_Ref createSourceImplWorkflow( media::MediaId id, const source::SourceInfo &context );
- private:
- /** Implementation */
- class Impl;
- /** Pointer to implementation */
- RW_pointer<Impl> _pimpl;
-
- public:
- struct ProductEntry {
- Pathname _dir;
- std::string _name;
- ProductEntry( const Pathname & dir_r = "/", const std::string & name_r = std::string() ){
- _dir = dir_r;
- _name = name_r;
- }
- bool operator<( const ProductEntry & rhs ) const {
- return( _dir.asString() < rhs._dir.asString() );
- }
- };
-
- typedef std::set<ProductEntry> ProductSet;
-
- /** Check which products are available on the media
- * \throw Exception or MediaException on fail
- */
- void listProducts( const Url & url_r, ProductSet & products_r );
- private:
-// bool probeSource( const std::string name, boost::function<bool()> prober, callback::SendReport<CreateSourceReport> &report );
- void scanProductsFile( const Pathname & file_r, ProductSet & pset_r ) const;
- };
- ///////////////////////////////////////////////////////////////////
-
- /** \relates SourceFactory Stream output */
- extern std::ostream & operator<<( std::ostream & str, const SourceFactory & obj );
-
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCEFACTORY_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/SourceFeed.cc
- *
-*/
-#include <iostream>
-//#include "zypp/base/Logger.h"
-
-#include "zypp/ResPoolManager.h"
-#include "zypp/SourceFeed.h"
-#include "zypp/ResStore.h"
-
-using std::endl;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : SourceFeed_Ref::Impl
- //
- /** SourceFeed implementation. */
- struct SourceFeed_Ref::Impl
- {
-
-
- Impl( ResPoolManager pool_r )
- : _pool( pool_r )
- {}
-
-#if 0
- void addSource( Source_Ref src_r );
- void removeSource( Source_Ref src_r );
-#endif
-
- const_iterator sourceBegin() const
- { return _sources.begin(); }
-
- const_iterator sourceEnd() const
- { return _sources.end(); }
-
- void insert( ContainerT & sources_r )
- {
- for ( const_iterator it = sources_r.begin(); it != sources_r.end(); ++it )
- {
- _sources.insert( *it );
- _pool.insert( it->resolvables().begin(), it->resolvables().end() );
- }
- }
-
- void erase( ContainerT & sources_r )
- {
- for ( const_iterator it = sources_r.begin(); it != sources_r.end(); ++it )
- {
- //_pool.erase( it->resolvables().begin(), it->resolvables().end() );
- _sources.erase( *it );
- }
- }
-
- /** Pool to feed. */
- ResPoolManager _pool;
-
- ContainerT _sources;
- };
- ///////////////////////////////////////////////////////////////////
-
- /** \relates SourceFeed::Impl Stream output */
- inline std::ostream & operator<<( std::ostream & str, const SourceFeed_Ref::Impl & obj )
- {
- return str << "SourceFeed::Impl";
- }
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : SourceFeed_Ref
- //
- ///////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : SourceFeed_Ref::SourceFeed_Ref
- // METHOD TYPE : Ctor
- //
- SourceFeed_Ref::SourceFeed_Ref( ResPoolManager pool_r )
- : _pimpl( new Impl( pool_r ) )
- {}
-
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : SourceFeed_Ref::~SourceFeed_Ref
- // METHOD TYPE : Dtor
- //
- SourceFeed_Ref::~SourceFeed_Ref()
- {}
-
- ///////////////////////////////////////////////////////////////////
-#if 0
- void SourceFeed_Ref::addSource( Source_Ref src_r )
- { _pimpl->addSource( src_r ); }
-
- void SourceFeed_Ref::removeSource( Source_Ref src_r )
- { _pimpl->removeSource( src_r ); }
-
-#endif
-
- void SourceFeed_Ref::insert( ContainerT & sources_r )
- { _pimpl->insert( sources_r ); }
-
- void SourceFeed_Ref::erase( ContainerT & sources_r )
- { _pimpl->erase( sources_r ); }
-
- SourceFeed_Ref::const_iterator SourceFeed_Ref::sourceBegin() const
- { return _pimpl->sourceBegin(); }
-
- SourceFeed_Ref::const_iterator SourceFeed_Ref::sourceEnd() const
- { return _pimpl->sourceEnd(); }
-
- ///////////////////////////////////////////////////////////////////
-
- /******************************************************************
- **
- ** FUNCTION NAME : operator<<
- ** FUNCTION TYPE : std::ostream &
- */
- std::ostream & operator<<( std::ostream & str, const SourceFeed_Ref & obj )
- {
- return str << *obj._pimpl;
- }
-
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/SourceFeed.h
- *
-*/
-#ifndef ZYPP_SOURCEFEED_H
-#define ZYPP_SOURCEFEED_H
-
-#include <iosfwd>
-#include <set>
-
-#include "zypp/base/PtrTypes.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-
- class ResPoolManager;
- class Source_Ref;
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : SourceFeed_Ref
- //
- /** Feed Sources into a ResPool.
- * \todo Clean up implementation.
- */
- class SourceFeed_Ref
- {
- friend std::ostream & operator<<( std::ostream & str, const SourceFeed_Ref & obj );
- typedef std::set<Source_Ref> ContainerT;
-
- public:
- /** Implementation */
- class Impl;
-
- typedef ContainerT::size_type size_type;
- typedef ContainerT::iterator iterator;
- typedef ContainerT::const_iterator const_iterator;
-
- public:
- /** Default ctor */
- SourceFeed_Ref( ResPoolManager pool_r );
- /** Dtor */
- ~SourceFeed_Ref();
-
- public:
-
- /** Add one Source. */
- void addSource( Source_Ref src_r )
- {
- ContainerT sources;
- sources.insert( src_r );
- insert( sources );
- }
-
- /** Add Sources from some container. */
- template <class _InputIterator>
- void addSource( _InputIterator first_r, _InputIterator last_r )
- {
- ContainerT sources( first_r, last_r );
- insert( sources );
- }
-
- // Add defaults from sourcemanager
-
- // Set sources
-
- public:
-
- /** Remove a Source. */
- void removeSource( Source_Ref src_r )
- {
- ContainerT sources;
- sources.insert( src_r );
- erase( sources );
- }
-
- /** Remove all Sources mentioned in container. */
- template <class _InputIterator>
- void removeSource( _InputIterator first_r, _InputIterator last_r )
- {
- ContainerT sources( first_r, last_r );
- erase( sources );
- }
-
- /** Remove all Sources. */
- void removeAllSources()
- {
- removeSource( sourceBegin(), sourceEnd() );
- }
-
- public:
-
- /** Iterate and query */
- const_iterator sourceBegin() const;
- const_iterator sourceEnd() const;
-
- private:
-
- void insert( ContainerT & sources_r );
-
- void erase( ContainerT & sources_r );
-
- private:
- /** Pointer to implementation: _Ref */
- shared_ptr<Impl> _pimpl;
- };
- ///////////////////////////////////////////////////////////////////
-
- /** \relates SourceFeed Stream output */
- std::ostream & operator<<( std::ostream & str, const SourceFeed_Ref & obj );
-
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCEFEED_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/SourceManager.cc
- *
-*/
-#include <iostream>
-#include <map>
-
-#include "zypp/base/Logger.h"
-#include "zypp/base/Algorithm.h"
-#include "zypp/base/Gettext.h"
-
-#include "zypp/ZYpp.h"
-#include "zypp/ZYppFactory.h"
-#include "zypp/SourceManager.h"
-#include "zypp/SourceFactory.h"
-#include "zypp/Source.h"
-#include "zypp/source/SourceImpl.h"
-#include "zypp/target/store/PersistentStorage.h"
-#include "zypp/TmpPath.h"
-#include "zypp/Pathname.h"
-#include "zypp/PathInfo.h"
-
-///////////////////////////////////////////////////////////////////
-#undef ZYPP_BASE_LOGGER_LOGGROUP
-#define ZYPP_BASE_LOGGER_LOGGROUP "zypp::SourceManager"
-///////////////////////////////////////////////////////////////////
-
-#define ZYPP_METADATA_PREFIX ( getZYpp()->homePath().asString()+"/cache/" )
-
-using std::endl;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-
- IMPL_PTR_TYPE(SourceManager)
-
- SourceManager_Ptr SourceManager::sourceManager()
- {
- static SourceManager_Ptr _source_manager( new SourceManager );
- return _source_manager;
- }
-
- namespace
- {
- typedef std::map<SourceManager::SourceId, Source_Ref> SourceMap;
-
- static SourceMap _sources;
- static SourceMap _deleted_sources;
- static std::set<std::string> _renamed_sources;
-
- struct PrintSourceMapEntry
- {
- void operator()( const SourceMap::value_type & el ) const
- {
- _str << endl << " - " << el.second;
- }
- PrintSourceMapEntry( std::ostream & str )
- : _str( str )
- {}
- std::ostream & _str;
- };
-
- inline std::ostream & dumpSourceTableOn( std::ostream & str, bool trailingENDL = true )
- {
- str << "SourceManager: =========================" << endl
- << " known Sources " << _sources.size();
- std::for_each( _sources.begin(), _sources.end(), PrintSourceMapEntry(str) );
-
- str << endl
- << " deleted Sources " << _deleted_sources.size();
- std::for_each( _deleted_sources.begin(), _deleted_sources.end(), PrintSourceMapEntry(str) );
- str << endl
- << "========================================";
- if ( trailingENDL )
- str << endl;
- return str;
- }
-
- inline bool sourceTableRemove( SourceMap::iterator it )
- {
- if ( it == _sources.end() )
- return false;
-
- MIL << "SourceManager remove " << it->second << endl;
- _deleted_sources[it->second.numericId()] = it->second;
- _sources.erase(it);
-
- // release all media of this source, not needed anymore (#159754)
- it->second.release();
-
- dumpSourceTableOn( DBG );
- return true;
- }
-
- inline SourceManager::SourceId sourceTableAdd( Source_Ref source_r )
- {
- if ( source_r.numericId() )
- {
- MIL << "SourceManager add " << source_r << endl;
- _sources[source_r.numericId()] = source_r;
-
- dumpSourceTableOn( DBG );
- }
- else
- {
- // Not worth an Exception. Request to add noSource, adds no Source,
- // and returns the noSource Id.
- WAR << "SourceManager does not add Source::noSource" << endl;
- }
- return source_r.numericId();
- }
-
- }
-
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : SourceManager::SourceManager
- // METHOD TYPE : Ctor
- //
- SourceManager::SourceManager()
- {
- MIL << "Created SourceManager Singleton." << endl;
- }
-
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : SourceManager::~SourceManager
- // METHOD TYPE : Dtor
- //
- SourceManager::~SourceManager()
- {
- MIL << "Deleted SourceManager Singleton." << endl;
- }
-
- SourceManager::const_iterator SourceManager::begin() const
- {
- return _sources.begin();
- }
-
- SourceManager::const_iterator SourceManager::end() const
- {
- return _sources.end();
- }
-
- SourceManager::SourceId_const_iterator SourceManager::SourceId_begin() const
- {
- return make_map_key_begin( _sources );
- }
-
- SourceManager::SourceId_const_iterator SourceManager::SourceId_end() const
- {
- return make_map_key_end( _sources );
- }
-
- SourceManager::Source_const_iterator SourceManager::Source_begin() const
- {
- return make_map_value_begin( _sources );
- }
-
- SourceManager::Source_const_iterator SourceManager::Source_end() const
- {
- return make_map_value_end( _sources );
- }
-
- void SourceManager::reset()
- {
- MIL << "SourceManager reset (forget all sources)" << endl;
- _sources.clear();
- _deleted_sources.clear();
- }
-
- SourceManager::SourceId SourceManager::addSource( Source_Ref source_r )
- {
- return sourceTableAdd( source_r );
- }
-
- void SourceManager::renameSource( SourceId id, const std::string & new_alias_r )
- {
- Source_Ref src = findSource(id);
-
- if ( src )
- {
- // delete the old entry in the storage
- // the new entry will appear when doing
- // store
- _renamed_sources.insert(src.alias());
- // set the new alias
- src.setAlias( new_alias_r );
- }
-
- }
-
- void SourceManager::removeSource(SourceManager::SourceId id)
- {
- if ( ! sourceTableRemove( _sources.find(id) ) )
- {
- WAR << "SourceManager remove: no source with SourceId " << id << endl;
- }
- }
-
- void SourceManager::removeSource( const std::string & alias_r )
- {
- SourceMap::iterator it = _sources.begin();
- for ( ; it != _sources.end() && it->second.alias() != alias_r; ++it )
- ; // empty body
-
- if ( ! sourceTableRemove( it ) )
- {
- WAR << "SourceManager remove: no source with alias " << alias_r << endl;
- }
- }
-
- void SourceManager::removeSourceByUrl( const Url & url_r )
- {
- SourceMap::iterator it = _sources.begin();
- for ( ; it != _sources.end() && it->second.url().asString() != url_r.asString(); ++it )
- ; // empty body
-
- if ( ! sourceTableRemove( it ) )
- {
- WAR << "SourceManager remove: no source with Url " << url_r << endl;
- }
- }
-
- void SourceManager::releaseAllSources()
- {
- MIL << "SourceManager releasing all sources ..." << endl;
- for (SourceMap::iterator it = _sources.begin();
- it != _sources.end(); it++)
- {
- it->second.release();
- }
- MIL << "SourceManager releasing all sources done." << endl;
- }
-
- void SourceManager::reattachSources(const Pathname &attach_point)
- {
- MIL << "SourceManager reattach all sources to '" << attach_point << " ..." << endl;
- for (SourceMap::iterator it = _sources.begin();
- it != _sources.end(); it++)
- {
- it->second.reattach(attach_point);
- }
- MIL << "SourceManager reattach all sources to '" << attach_point << " done." << endl;
- }
-
-
- void SourceManager::disableAllSources()
- {
- MIL << "SourceManager disable all sources ..." << endl;
- for ( SourceMap::iterator it = _sources.begin(); it != _sources.end(); it++)
- {
- it->second.disable();
- }
- MIL << "SourceManager disable all sources done." << endl;
- }
-
- std::list<SourceManager::SourceId> SourceManager::enabledSources() const
- {
- std::list<SourceManager::SourceId> res;
-
- for ( SourceMap::const_iterator it = _sources.begin(); it != _sources.end(); it++)
- {
- if ( it->second.enabled() )
- res.push_back(it->first);
- }
-
- return res;
- }
-
- std::list<SourceManager::SourceId> SourceManager::allSources() const
- {
- std::list<SourceManager::SourceId> res;
-
- for ( SourceMap::const_iterator it = _sources.begin(); it != _sources.end(); it++)
- {
- res.push_back(it->first);
- }
-
- return res;
- }
-
- void SourceManager::store(Pathname root_r, bool metadata_cache )
- {
- MIL << "SourceManager store '" << root_r << ( metadata_cache ? "' (metadata_cache)" : "'" )
- << " ..." << endl;
-
- storage::PersistentStorage store;
- store.init( root_r );
-
-
- // make sure to create the source metadata cache
- if ( metadata_cache )
- {
- // make sure our root exists
-
- filesystem::assert_dir( root_r / getZYpp()->homePath() );
- Pathname topdir( root_r / ZYPP_METADATA_PREFIX );
- filesystem::assert_dir( topdir );
- MIL << "Created..." << topdir << std::endl;
- }
-
- // delete renamed sources entries
- for ( std::set<std::string>::const_iterator it = _renamed_sources.begin(); it != _renamed_sources.end(); it++)
- {
- MIL << "removing source entry " << *it << " (renamed) from persistent store" << endl;
- store.deleteSource( *it );
- }
-
- _renamed_sources.clear();
-
- // delete before modifying and creating
- // so that we can recreate a deleted one (#174295)
- for ( SourceMap::iterator it = _deleted_sources.begin(); it != _deleted_sources.end(); it++)
- {
- MIL << "Deleting source " << it->second << " from persistent store" << endl;
- store.deleteSource( it->second.alias() );
- filesystem::recursive_rmdir( it->second.cacheDir() );
- }
-
- _deleted_sources.clear();
-
- for ( SourceMap::iterator it = _sources.begin(); it != _sources.end(); it++)
- {
- source::SourceInfo descr;
-
- descr.setUrl(it->second.url());
- descr.setEnabled( it->second.enabled() );
- descr.setAlias( it->second.alias() );
- descr.setAutorefresh( it->second.autorefresh() );
- descr.setType( it->second.type() );
- descr.setPath( it->second.path() );
-
- // WATCH OUT!
- // Source::cacheDir contains the root prefix.
- // Strip it from SourceInfo::CacheDir!
- if ( root_r.empty() || root_r == "/" )
- {
- descr.setCacheDir( it->second.cacheDir() );
- }
- else
- {
- descr.setCacheDir( str::stripPrefix( it->second.cacheDir().asString(), root_r.asString() ) );
- }
-
- if ( metadata_cache && descr.cacheDir().empty() )
- {
- if ( descr.cacheDir().empty() )
- {
- filesystem::TmpDir newCache( root_r / ZYPP_METADATA_PREFIX, "Source." );
- descr.setCacheDir( ZYPP_METADATA_PREFIX + newCache.path().basename() );
- }
-
- filesystem::assert_dir ( root_r.asString() + descr.cacheDir() );
-
- MIL << "Storing metadata to (" << root_r.asString() << ")/" << descr.cacheDir() << endl;
-
- try
- {
- it->second.storeMetadata( root_r.asString() + descr.cacheDir() );
- }
- catch (const Exception &excp)
- {
- WAR << "Creating local metadata cache failed, not using cache" << endl;
- descr.setCacheDir("");
- }
- }
-
- store.storeSource( descr );
- }
-
- MIL << "SourceManager store done." << endl;
- }
-
- /** \todo Broken design: either use return value or Exception to
- * indicate errors, not both.
- */
- bool SourceManager::restore( Pathname root_r, bool use_caches, const std::string &alias_filter, const std::string &url_filter )
- {
- MIL << "SourceManager restore ('" << root_r << ( use_caches ? "' (use_caches)" : "'" ) << ", alias_filter '" << alias_filter << ", url_filter '" << url_filter << "')" << endl;
-
- if (! _sources.empty() )
- {
-
- // if we've already restored sources and this is an unfiltered call, reject it.
-
- if (alias_filter.empty()
- && url_filter.empty())
- {
- ZYPP_THROW(SourcesAlreadyRestoredException());
- //Exception ( N_("At least one source already registered, cannot restore sources from persistent store.") ) );
- }
-
- // check filters against already restore sources and check for duplicates.
- //
- for (SourceMap::const_iterator it = _sources.begin(); it != _sources.end(); ++it)
- {
- if (!alias_filter.empty() && (alias_filter == it->second.alias()) )
- {
- MIL << "Source with alias '" << alias_filter << "' already restored.";
- return true;
- }
-
- if (!url_filter.empty() && (url_filter == it->second.url().asString()) )
- {
- MIL << "Source with url '" << url_filter << "' already restored.";
- return true;
- }
- }
- }
-
- FailedSourcesRestoreException report;
-
- storage::PersistentStorage store;
- store.init( root_r );
-
- std::list<source::SourceInfo> new_sources = store.storedSources();
-
- MIL << "Found sources: " << new_sources.size() << endl;
-
- for ( std::list<source::SourceInfo>::iterator it = new_sources.begin(); it != new_sources.end(); ++it)
- {
- if ( !alias_filter.empty() // check alias filter, if set
- && (alias_filter != it->alias()) )
- {
- continue;
- }
-
- if ( !url_filter.empty() // check url filter, if set
- && (url_filter != it->url().asString()) )
- {
- continue;
- }
-
- // Note: Url(it->url).asString() to hide password in logs
- MIL << "Restoring source: url:[" << it->url().asString()
- << "] product_dir:[" << it->path()
- << "] alias:[" << it->alias()
- << "] cache_dir:[" << it->cacheDir()
- << "] auto_refresh:[ " << it->autorefresh() << "]" << endl;
-
- SourceId id = 0;
-
- try
- {
- Source_Ref src = SourceFactory().createFrom( it->type(), it->url(), it->path(), it->alias(),
- root_r / it->cacheDir(),
- false, it->autorefresh() );
- id = addSource(src);
- }
- catch (const Exception &expt )
- {
- // Note: Url(it->url).asString() to hide password in logs
- ERR << "Unable to restore source from " << it->url().asString() << endl;
-
- id = 0;
- Url url2;
- try
- {
- url2 = it->url();
- std::string scheme( url2.getScheme());
-
- if ( (scheme == "cd" || scheme == "dvd") && !url2.getQueryParam("devices").empty())
- {
- url2.setQueryParam("devices", "");
- DBG << "CD/DVD devices changed - try again without a devices list" << std::endl;
-
- id = addSource( SourceFactory().createFrom( url2, it->path(), it->alias(),
- root_r / it->cacheDir(),
- false ) );
-
- // This worked ... update it->url ?
- //it->url = url2.asCompleteString();
- }
- }
- catch (const Exception &e2)
- {
- // Note: Url(it->url).asString() to hide password in logs
- ERR << "Unable to restore source from " << url2.asString()
- << endl;
- id = 0;
- ZYPP_CAUGHT(e2);
- }
-
- if ( id == 0)
- {
- report.append( it->url().asString() + it->path().asString(), it->alias(), expt );
- continue;
- }
- }
-
- DBG << "Added source as id " << id << endl;
- // should not throw, we've just created the source
- Source_Ref src = findSource( id );
-
- if ( it->enabled() )
- {
- DBG << "enable source" << endl;
- src.enable();
- }
- else
- {
- DBG << "disable source" << endl;
- src.disable();
- }
- }
-
- if ( !report.empty() )
- {
- ZYPP_THROW(report);
- }
-
- MIL << "SourceManager restore done." << endl;
- dumpSourceTableOn( DBG );
- return true;
- }
-
- void SourceManager::disableSourcesAt( const Pathname & root_r )
- {
- storage::PersistentStorage store;
- store.init( root_r );
-
- std::list<source::SourceInfo> new_sources = store.storedSources();
-
- MIL << "Disabling all sources in store at " << root_r << endl;
-
- for ( std::list<source::SourceInfo>::iterator it = new_sources.begin();
- it != new_sources.end(); ++it)
- {
- MIL << "Disabling source " << it->alias() << endl;
- it->setEnabled(false);
- store.storeSource( *it );
- }
- }
-
- source::SourceInfoList SourceManager::knownSourceInfos(const Pathname &root_r)
- {
- storage::PersistentStorage store;
- SourceInfoList result;
- store.init( root_r );
-
- source::SourceInfoList sources = store.storedSources();
- MIL << "Found sources: " << sources.size() << endl;
- return sources;
- }
-
- /******************************************************************
- **
- ** FUNCTION NAME : operator<<
- ** FUNCTION TYPE : std::ostream &
- */
- std::ostream & operator<<( std::ostream & str, const SourceManager & obj )
- {
- return dumpSourceTableOn( str, /*tailingENDL*/false );
- }
-
- Source_Ref SourceManager::findSource(SourceId id)
- {
- SourceMap::iterator it = _sources.find(id);
- if (it == _sources.end())
- {
- ZYPP_THROW(Exception("Unknown source ID"));
- }
- return it->second;
- }
-
- Source_Ref SourceManager::findSource(const std::string & alias_r)
- {
- SourceMap::iterator it;
- for (it = _sources.begin(); it != _sources.end(); ++it)
- {
- if (it->second.alias() == alias_r)
- {
- return it->second;
- }
- }
- ZYPP_THROW(Exception("Unknown source name '"+alias_r+"'"));
- /*NOTREACHED*/
- return it->second; // just to keep gcc happy
- }
-
- Source_Ref SourceManager::findSourceByUrl(const Url & url_r)
- {
- SourceMap::iterator it;
- for (it = _sources.begin(); it != _sources.end(); ++it)
- {
- if (it->second.url().asCompleteString() == url_r.asCompleteString())
- {
- return it->second;
- }
- }
- ZYPP_THROW(Exception("Unknown source URL '"+url_r.asString()+"'"));
- /*NOTREACHED*/
- return it->second; // just to keep gcc happy
- }
-
- /////////////////////////////////////////////////////////////////
- // FailedSourcesRestoreException
- ///////////////////////////////////////////////////////////////////
-
- std::ostream & FailedSourcesRestoreException::dumpOn( std::ostream & str ) const
- {
- return str << _summary;
- }
-
- std::ostream & FailedSourcesRestoreException::dumpOnTranslated( std::ostream & str ) const
- {
- return str << Exception::asUserString() << endl << _translatedSummary;
- }
-
- bool FailedSourcesRestoreException::empty () const
- {
- return _summary.empty();
- }
-
- std::set<std::string> FailedSourcesRestoreException::aliases () const
- {
- return _aliases;
- }
-
- void FailedSourcesRestoreException::append( std::string source, std::string alias, const Exception& expt)
- {
- _summary = _summary + "\n" + source + ": " + expt.asString();
- _translatedSummary = _translatedSummary + "\n" + source + ": " + expt.asUserString();
- _aliases.insert( alias );
- }
-
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/SourceManager.h
- *
-*/
-#ifndef ZYPP_SOURCEMANAGER_H
-#define ZYPP_SOURCEMANAGER_H
-
-#include <iosfwd>
-#include <list>
-#include <map>
-
-#include "zypp/base/ReferenceCounted.h"
-#include "zypp/base/NonCopyable.h"
-//#include "zypp/base/Iterator.h"
-
-#include "zypp/base/Gettext.h" // move with FailedSourcesRestoreException & SourcesAlreadyRestoredException
-
-#include "zypp/source/SourceInfo.h"
-
-#include "zypp/Source.h"
-#include "zypp/Url.h"
-#include "zypp/Pathname.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-
- DEFINE_PTR_TYPE(SourceManager)
-
- /** \todo move to separate header file.*/
- class FailedSourcesRestoreException : public Exception
- {
- public:
- FailedSourcesRestoreException()
- : Exception(N_("Unable to restore all sources."))
- , _summary()
- , _translatedSummary()
- , _aliases()
- {}
- virtual ~FailedSourcesRestoreException() throw() {};
-
- void append( std::string source, std::string alias, const Exception& problem );
- bool empty() const;
-
- std::set<std::string> aliases() const;
-
- protected:
- virtual std::ostream & dumpOn( std::ostream & str ) const;
- virtual std::ostream & dumpOnTranslated( std::ostream & str ) const;
- private:
- std::string _summary;
- std::string _translatedSummary;
- std::set<std::string> _aliases;
- };
-
- /** \todo move to separate header file.*/
- class SourcesAlreadyRestoredException : public Exception
- {
- public:
- SourcesAlreadyRestoredException()
- : Exception(N_("At least one source already registered, stored sources cannot be restored."))
- {}
- virtual ~SourcesAlreadyRestoredException() throw() {};
- };
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : SourceManager
- //
- /** Provide the known Sources.
- * \todo make it a resl singleton
- * \todo throwing findSource is not acceptable, return either
- * a Source or noSource.
- * \todo Make restore either void or nonthrowing, but two ways of
- * error reporting is bad.
- */
- class SourceManager : public base::ReferenceCounted, private base::NonCopyable
- {
- friend std::ostream & operator<<( std::ostream & str, const SourceManager & obj );
-
- public:
- /** Singleton access */
- static SourceManager_Ptr sourceManager();
-
- public:
- /** Dtor */
- ~SourceManager();
-
- public:
- /** Runtime unique numeric Source Id. */
- typedef Source_Ref::NumericId SourceId;
-
- private:
- /** exposition only */
- typedef std::map<SourceId, Source_Ref> SourceMap;
-
- /** \name Iterate over all (SourceId,Source_Ref) pairs. */
- //@{
- typedef SourceMap::const_iterator const_iterator;
-
- const_iterator begin() const;
-
- const_iterator end() const;
- //@}
-
- public:
- /** \name Iterate over all known SourceIds. */
- //@{
- typedef MapKVIteratorTraits<SourceMap>::Key_const_iterator SourceId_const_iterator;
-
- SourceId_const_iterator SourceId_begin() const;
-
- SourceId_const_iterator SourceId_end() const;
- //@}
-
- public:
- /** \name Iterate over all known Sources. */
- //@{
- typedef MapKVIteratorTraits<SourceMap>::Value_const_iterator Source_const_iterator;
-
- Source_const_iterator Source_begin() const;
-
- Source_const_iterator Source_end() const;
- //@}
-
- public:
-
- /**
- * Reset the manager - discard the sources database,
- * do not store the changes to the persistent store.
- *
- * \throws Exception
- */
- void reset() ;
-
- /**
- * List the known aliases and urls ( no need to restore first )
- *
- * \throws Exception
- */
- source::SourceInfoList knownSourceInfos(const Pathname &root_r);
-
- /**
- * Store the current state to the given path
- *
- * \param root_r root path for storing the source definitions
- * \param metadata_cache if true, this will also store/update
- * metadata caches for the sources.
- *
- * \throws Exception
- */
- void store(Pathname root_r, bool metadata_cache );
-
- /**
- * Restore the sources state to the given path. If the sources
- * database is not empty, it throws an exception
- *
- * \param use_caches if true, source creation will try to use source cache
- * and it's behavior on autorefresh. If false, it will not use
- * the cache at all.
- * \param alias_filter if non-empty, restore only a source matching
- * this alias.
- * \param url_filter if non-empty, restore only a source matching
- * this url.
- *
- * The alias_filter take precedence over the url_filter.
- *
- * \return true on success
- *
- * \throws Exception
- */
- bool restore(Pathname root_r, bool use_caches = true, const std::string &alias_filter = "", const std::string &url_filter = "" );
-
- /**
- * Find a source with a specified ID
- *
- * \throws Exception
- */
- Source_Ref findSource(SourceId id);
-
- /**
- * Find a source with a specified alias
- *
- * \throws Exception
- */
- Source_Ref findSource(const std::string & alias_r);
-
- /**
- * Find a source with a specified URL.
- * URLs are unique in zenworks but NOT in zypp.
- * A bug in SL 10.1 causes alias mismatches so we have to resort to URLs.
- * #177543
- *
- * \throws Exception
- */
- Source_Ref findSourceByUrl(const Url & url_r);
-
- /**
- * Return the list of the currently enabled sources
- *
- */
- std::list<SourceId> enabledSources() const;
-
- /**
- * Return ids of all sources
- */
- std::list<SourceId> allSources() const;
-
- /** Add a new source.
- * An attempt to add Source_Ref::noSource does nothing but
- * returning Source_Ref::noSource.numericId(). Thus it
- * results in adding no Source.
- */
- SourceId addSource(Source_Ref source_r);
-
- /** Rename an existing source by Alias. */
- void renameSource( SourceId id, const std::string & new_alias_r );
-
- /** Remove an existing source by ID. */
- void removeSource(SourceId id);
-
- /** Remove an existing source by Alias. */
- void removeSource(const std::string & alias_r);
-
- /** Remove an existing source by Url. */
- void removeSourceByUrl(const Url & url_r);
-
- /**
- * Release all medias held by all sources
- *
- * \throws Exception
- */
- void releaseAllSources();
-
- /**
- * Reattach all sources which are not mounted, but downloaded,
- * to different directory
- *
- * \throws Exception
- */
- void reattachSources(const Pathname & attach_point);
-
- /**
- * Disable all registered sources
- */
- void disableAllSources();
-
- /**
- * Helper function to disable all sources in the persistent
- * store on the given location. Does not manipulate with
- * the current status of the source manager.
- *
- * \throws Exception ...
- */
- static void disableSourcesAt( const Pathname & root );
-
- private:
- /** Singleton ctor */
- SourceManager();
- };
- ///////////////////////////////////////////////////////////////////
-
- /** \relates SourceManager Stream output */
- std::ostream & operator<<( std::ostream & str, const SourceManager & obj );
-
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCEMANAGER_H
*
*/
#include "zypp/SrcPackage.h"
-#include "zypp/source/SourceImpl.h"
#include "zypp/base/Exception.h"
using namespace std;
//
///////////////////////////////////////////////////////////////////
- ByteCount SrcPackage::archivesize() const
- { return pimpl().archivesize(); }
-
DiskUsage SrcPackage::diskusage() const
{ return pimpl().diskusage(); }
- Pathname SrcPackage::location() const
+ OnMediaLocation SrcPackage::location() const
{ return pimpl().location(); }
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
typedef TraitsType::constPtrType constPtr;
public:
- /** */
- ByteCount archivesize() const;
/** Disk usage per directory */
DiskUsage diskusage() const;
- /** location in source */
- Pathname location() const;
-
+
+ /** location of resolvable in repo */
+ OnMediaLocation location() const;
+
protected:
SrcPackage( const NVRAD & nvrad_r );
/** Dtor */
std::ostream & Target::dumpOn( std::ostream & str ) const
{ return _pimpl->dumpOn( str ); }
- void Target::getResolvablesToInsDel ( const ResPool pool_r,
- PoolItemList & dellist_r,
- PoolItemList & instlist_r,
- PoolItemList & srclist_r ) const
- { _pimpl->getResolvablesToInsDel( pool_r, dellist_r, instlist_r, srclist_r ); }
-
bool Target::setInstallationLogfile(const Pathname & path_r)
{ return _pimpl->setInstallationLogfile(path_r); }
ResObject::constPtr whoOwnsFile (const std::string & path_str) const;
- /** JUST FOR TESTSUITE */
- /** Sort according to prereqs and media numbers
- * \todo provide it as standalone algorithm
- */
- void getResolvablesToInsDel ( const ResPool pool_r,
- PoolItemList & dellist_r,
- PoolItemList & instlist_r,
- PoolItemList & srclist_r ) const;
-
#ifndef STORAGE_DISABLED
/** enables the storage target */
bool isStorageEnabled() const;
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/** \file zypp/TranslatedText.cc
+/** \file zypp/TranslatedText.cc
*
*/
#include <iostream>
-//#include "zypp/base/Logger.h"
-
-#include "zypp/ZYppFactory.h"
-#include "zypp/ZYpp.h"
#include "zypp/base/String.h"
+
#include "zypp/TranslatedText.h"
+#include "zypp/ZConfig.h"
using std::endl;
///////////////////////////////////////////////////////////////////
//
- // CLASS NAME : TranslatedText::Impl
+ // CLASS NAME : TranslatedText::Impl
//
/** TranslatedText implementation. */
struct TranslatedText::Impl
{
+ typedef std::map<Locale, std::string> TranslationMap;
+
Impl()
{}
{
return translations.empty();
}
-
- std::string text( const Locale &lang = Locale() ) const
+
+ std::string text( const Locale &lang ) const
{
- Locale empty_locale;
- // if there are no translation for the requested locale
- // or the passed locale is a empty one, we activate the
- // fallback mechanism, otherwise (else case), we just provide
- // the (existant) requested locale)
- if ( translations[lang].empty() || (lang == empty_locale))
+ // Traverse fallback list and return the 1st nonempty match.
+ // Take care NOT to create new map entries in queries.
+ Locale toReturn( lang );
+ if ( lang == Locale::noCode )
{
- // first, detect the locale
- ZYpp::Ptr z = getZYpp();
- Locale detected_lang( z->getTextLocale() );
- if ( translations[detected_lang].empty() )
- {
- Locale fallback_locale = detected_lang.fallback();
- while ( fallback_locale != empty_locale )
- {
- if ( ! translations[fallback_locale].empty() )
- return translations[fallback_locale];
-
- fallback_locale = fallback_locale.fallback();
- }
- // we gave up, there are no translations with fallbacks
- // last try, emtpy locale
-
- if ( ! translations[empty_locale].empty() )
- return translations[empty_locale];
- else
- return std::string();
- }
- else
- {
- return translations[detected_lang];
- }
+ toReturn = ZConfig().defaultTextLocale();
}
- else
+
+ do
{
- return translations[lang];
- }
+ TranslationMap::const_iterator it = translations.find( toReturn );
+ if ( it != translations.end()
+ && ! it->second.empty() )
+ {
+ return it->second;
+ }
+
+ if ( toReturn != Locale::noCode )
+ {
+ // retry using next fallback:
+ toReturn = toReturn.fallback();
+ }
+ else
+ {
+ // there are no further fallbacks
+ return std::string();
+ }
+ } while( true );
+ // not reached.
+ return std::string();
}
std::set<Locale> locales() const
{
std::set<Locale> lcls;
- for(std::map<Locale, std::string>::const_iterator it = translations.begin(); it != translations.end(); ++it)
+ for( TranslationMap::const_iterator it = translations.begin(); it != translations.end(); ++it )
{
lcls.insert((*it).first);
}
}
private:
- mutable std::map<Locale, std::string> translations;
+ mutable TranslationMap translations;
public:
/** Offer default Impl. */
///////////////////////////////////////////////////////////////////
//
- // CLASS NAME : TranslatedText
+ // CLASS NAME : TranslatedText
//
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
//
- // METHOD NAME : TranslatedText::TranslatedText
- // METHOD TYPE : Ctor
+ // METHOD NAME : TranslatedText::TranslatedText
+ // METHOD TYPE : Ctor
//
TranslatedText::TranslatedText()
: _pimpl( Impl::nullimpl() )
///////////////////////////////////////////////////////////////////
//
- // METHOD NAME : TranslatedText::TranslatedText
- // METHOD TYPE : Ctor
+ // METHOD NAME : TranslatedText::TranslatedText
+ // METHOD TYPE : Ctor
//
TranslatedText::TranslatedText( const std::string &text,
const Locale &lang )
///////////////////////////////////////////////////////////////////
//
- // METHOD NAME : TranslatedText::TranslatedText
- // METHOD TYPE : Ctor
+ // METHOD NAME : TranslatedText::TranslatedText
+ // METHOD TYPE : Ctor
//
TranslatedText::TranslatedText( const std::list<std::string> &text,
const Locale &lang )
///////////////////////////////////////////////////////////////////
//
- // METHOD NAME : TranslatedText::~TranslatedText
- // METHOD TYPE : Dtor
+ // METHOD NAME : TranslatedText::~TranslatedText
+ // METHOD TYPE : Dtor
//
TranslatedText::~TranslatedText()
{}
#include "zypp/base/IOStream.h"
#include "zypp/base/String.h"
+#include "zypp/PathInfo.h"
#include "zypp/VendorAttr.h"
#include "zypp/ZYppFactory.h"
//
///////////////////////////////////////////////////////////////////
- //SourceFeed_Ref ZYpp::sourceFeed() const
- //{ return _pimpl->sourceFeed(); }
-
void ZYpp::addResolvables (const ResStore& store, bool installed)
{
_pimpl->addResolvables (store, installed);
class ZYppFactory;
class ResPool;
class ResPoolProxy;
- class SourceFeed_Ref;
class ResStore;
class Locale;
class KeyRing;
*/
ResPoolProxy poolProxy() const;
- /** */
- //SourceFeed_Ref sourceFeed() const;
-
void addResolvables (const ResStore& store, bool installed = false);
void removeResolvables (const ResStore& store);
#include "zypp/Callback.h"
#include "zypp/Resolvable.h"
-#include "zypp/Source.h"
+#include "zypp/Repository.h"
#include "zypp/Pathname.h"
#include "zypp/Message.h"
#include "zypp/Url.h"
+#include "zypp/ProgressData.h"
#include "zypp/media/MediaUserAuth.h"
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
- namespace source
+
+ struct ProgressReport : public callback::ReportBase
+ {
+ virtual void start( const ProgressData &/*task*/ )
+ {}
+
+ virtual bool progress( const ProgressData &/*task*/ )
+ { return true; }
+
+// virtual Action problem(
+// Repository /*source*/
+// , Error /*error*/
+// , const std::string &/*description*/ )
+// { return ABORT; }
+
+ virtual void finish( const ProgressData &/*task*/ )
+ {}
+
+ };
+
+ struct ProgressReportAdaptor
+ {
+
+ ProgressReportAdaptor( const ProgressData::ReceiverFnc &fnc,
+ callback::SendReport<ProgressReport> &report )
+ : _fnc(fnc)
+ , _report(report)
+ , _first(true)
+ {
+ }
+
+ bool operator()( const ProgressData &progress )
+ {
+ if ( _first )
+ {
+ _report->start(progress);
+ _first = false;
+ }
+
+ _report->progress(progress);
+ bool value = true;
+ if ( _fnc )
+ value = _fnc(progress);
+
+ if ( progress.val() == progress.max() )
+ {
+ _report->finish(progress);
+ }
+ return value;
+ }
+
+ ProgressData::ReceiverFnc _fnc;
+ callback::SendReport<ProgressReport> &_report;
+ bool _first;
+ };
+
+ ////////////////////////////////////////////////////////////////////////////
+
+ namespace repo
{
// progress for downloading a resolvable
struct DownloadResolvableReport : public callback::ReportBase
};
// progress for probing a source
- struct ProbeSourceReport : public callback::ReportBase
+ struct ProbeRepoReport : public callback::ReportBase
{
enum Action {
ABORT, // abort and return error
virtual Action problem( const Url &/*url*/, Error /*error*/, const std::string &/*description*/ ) { return ABORT; }
};
- struct SourceCreateReport : public callback::ReportBase
+ struct RepoCreateReport : public callback::ReportBase
{
enum Action {
ABORT, // abort and return error
{}
};
- struct SourceReport : public callback::ReportBase
+ struct RepoReport : public callback::ReportBase
{
enum Action {
ABORT, // abort and return error
INVALID // th source is invalid
};
- virtual void start( Source_Ref /*source*/, const std::string &/*task*/ ) {}
- virtual bool progress( int /*value*/ )
+ virtual void start( const ProgressData &/*task*/, const RepoInfo /*repo*/ ) {}
+ virtual bool progress( const ProgressData &/*task*/ )
{ return true; }
virtual Action problem(
- Source_Ref /*source*/
+ Repository /*source*/
, Error /*error*/
, const std::string &/*description*/ )
{ return ABORT; }
virtual void finish(
- Source_Ref /*source*/
+ Repository /*source*/
, const std::string &/*task*/
, Error /*error*/
, const std::string &/*reason*/ )
};
virtual Action requestMedia(
- Source_Ref /*source*/
+ Repository /*source*/
, unsigned /*mediumNr*/
, Error /*error*/
, const std::string &/*description*/
{ return _syncPoolAfterCommit; }
public:
- /** Restrict commit to a certain media number
- * \deprecated
+ /** Restrict commit to media 1.
+ * Fake outstanding YCP fix: Honour restriction to media 1
+ * at installation, but install all remaining packages if
+ * post-boot (called with <tt>mediaNr_r > 1</tt>).
*/
ZYppCommitPolicy & restrictToMedia( unsigned mediaNr_r )
- { _restrictToMedia = mediaNr_r; return *this; }
+ { _restrictToMedia = ( mediaNr_r == 1 ) ? 1 : 0; return *this; }
/** Process all media (default) */
ZYppCommitPolicy & allMedia()
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/** \file zypp/source/Builtin.h
+/** \file zypp/base/Easy.h
*
- * Include all builtin Source implementations.
*/
-#ifndef ZYPP_SOURCE_BUILTIN_H
-#define ZYPP_SOURCE_BUILTIN_H
+#ifndef ZYPP_BASE_EASY_H
+#define ZYPP_BASE_EASY_H
-#include <iosfwd>
-
-#include "zypp/source/SourceImpl.h"
-#include "zypp/source/plaindir/PlaindirImpl.h"
-#include "zypp/source/susetags/SuseTagsImpl.h"
-#include "zypp/source/yum/YUMSourceImpl.h"
+/** Convenient for-loops using iterator.
+ * \code
+ * std::set<std::string> _store;
+ * for_( it, _store.begin(), _store.end() )
+ * {
+ * cout << *it << endl;
+ * }
+ * \endcode
+*/
+#define for_(IT,BEG,END) for ( typeof(BEG) IT = BEG; IT != END; ++IT )
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
-
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_BUILTIN_H
+#endif // ZYPP_BASE_EASY_H
* \ref Attribute defines the klass and name value \ref CacheStore
* uses to write an attribute to the database. The same pair is
* required to query the attributes value.
+ *
+ * \c evalShared tells whether the resolvables \c :shared_id should
+ * be evaluated in queries, in case no attribute value is defined.
+ * Some attributes like e.g. \c Summary can be shared between packages
+ * that differ in architecture only. *
*/
struct Attribute
{
- Attribute( const std::string & klass_r, const std::string & name_r )
- : klass(klass_r), name(name_r)
+ enum ShareType { UNIQUE, SHARED };
+
+ Attribute( const std::string & klass_r, const std::string & name_r,
+ ShareType shareType_r = UNIQUE )
+ : klass (klass_r)
+ , name (name_r)
+ , evalShared( shareType_r == SHARED )
{}
std::string klass;
std::string name;
+ bool evalShared;
};
///////////////////////////////////////////////////////////////////
#include "zypp/cache/Attribute.h"
+/** Define OnMediaLocation attributes using a common prefix for all attributes. */
+#define defineOnMediaLocationAttr(OMLATTRPREFIX,KLASS,ATTRNAMEPREFIX ) \
+ inline const Attribute & OMLATTRPREFIX##MediaNr() { static Attribute a(KLASS,#ATTRNAMEPREFIX"MediaNr"); return a; } \
+ inline const Attribute & OMLATTRPREFIX##Filename() { static Attribute a(KLASS,#ATTRNAMEPREFIX"Filename"); return a; } \
+ inline const Attribute & OMLATTRPREFIX##DownloadSize() { static Attribute a(KLASS,#ATTRNAMEPREFIX"DownloadSize"); return a; } \
+ inline const Attribute & OMLATTRPREFIX##Checksum() { static Attribute a(KLASS,#ATTRNAMEPREFIX"Checksum"); return a; } \
+ inline const Attribute & OMLATTRPREFIX##ChecksumType() { static Attribute a(KLASS,#ATTRNAMEPREFIX"ChecksumType"); return a; } \
+ inline const Attribute & OMLATTRPREFIX##OpenSize() { static Attribute a(KLASS,#ATTRNAMEPREFIX"OpenSize"); return a; } \
+ inline const Attribute & OMLATTRPREFIX##OpenChecksum() { static Attribute a(KLASS,#ATTRNAMEPREFIX"OpenChecksum"); return a; } \
+ inline const Attribute & OMLATTRPREFIX##OpenChecksumType() { static Attribute a(KLASS,#ATTRNAMEPREFIX"OpenChecksumType"); return a; }
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
*/
//@{
///////////////////////////////////////////////////////////////////
- inline const Attribute & attrMessageText() { static Attribute a("Message","text"); return a; }
+ inline const Attribute & attrMessageText() { static Attribute a("Message","text"); return a; }
+ ///////////////////////////////////////////////////////////////////
+ inline const Attribute & attrPackageAuthors() { static Attribute a("Package","authors", Attribute::SHARED); return a; }
+ inline const Attribute & attrPackageBuildhost() { static Attribute a("Package","buildhost"); return a; }
+ inline const Attribute & attrPackageChecksumType() { static Attribute a("Package","checksumType"); return a; }
+ inline const Attribute & attrPackageDistribution() { static Attribute a("Package","distribution"); return a; }
+ inline const Attribute & attrPackageGroup() { static Attribute a("Package","group"); return a; }
+ inline const Attribute & attrPackagePackager() { static Attribute a("Package","packager"); return a; }
+ inline const Attribute & attrPackageKeywords() { static Attribute a("Package","keywords"); return a; }
+ inline const Attribute & attrPackageLicense() { static Attribute a("Package","license"); return a; }
+ inline const Attribute & attrPackageOperatingSystem() { static Attribute a("Package","operatingSystem"); return a; }
+ inline const Attribute & attrPackagePostin() { static Attribute a("Package","postin"); return a; }
+ inline const Attribute & attrPackagePostun() { static Attribute a("Package","postun"); return a; }
+ inline const Attribute & attrPackagePrein() { static Attribute a("Package","prein"); return a; }
+ inline const Attribute & attrPackagePreun() { static Attribute a("Package","preun"); return a; }
+ inline const Attribute & attrPackageUrl() { static Attribute a("Package","url"); return a; }
+ inline const Attribute & attrPackageSourcePkgName() { static Attribute a("Package","sourcePkgName"); return a; }
+ inline const Attribute & attrPackageSourcePkgEdition() { static Attribute a("Package","sourcePkgEdition"); return a; }
+ // define attrPackageLocationMediaNr, attrPackageLocationFilename, etc.
+ defineOnMediaLocationAttr( attrPackageLocation, "Package", "location" )
///////////////////////////////////////////////////////////////////
- inline const Attribute & attrPackageAuthors() { static Attribute a("Package","authors"); return a; }
- inline const Attribute & attrPackageBuildhost() { static Attribute a("Package","buildhost"); return a; }
- inline const Attribute & attrPackageChecksum() { static Attribute a("Package","checksum"); return a; }
- inline const Attribute & attrPackageChecksumType() { static Attribute a("Package","checksumType"); return a; }
- inline const Attribute & attrPackageDistribution() { static Attribute a("Package","distribution"); return a; }
- inline const Attribute & attrPackageGroup() { static Attribute a("Package","group"); return a; }
- inline const Attribute & attrPackageKeywords() { static Attribute a("Package","keywords"); return a; }
- inline const Attribute & attrPackageLicense() { static Attribute a("Package","license"); return a; }
- inline const Attribute & attrPackageLocation() { static Attribute a("Package","location"); return a; }
- inline const Attribute & attrPackageOperatingSystem() { static Attribute a("Package","operatingSystem"); return a; }
- inline const Attribute & attrPackagePostin() { static Attribute a("Package","postin"); return a; }
- inline const Attribute & attrPackagePostun() { static Attribute a("Package","postun"); return a; }
- inline const Attribute & attrPackagePrein() { static Attribute a("Package","prein"); return a; }
- inline const Attribute & attrPackagePreun() { static Attribute a("Package","preun"); return a; }
- inline const Attribute & attrPackageUrl() { static Attribute a("Package","url"); return a; }
+ inline const Attribute & attrPatchAffectsPkgManager() { static Attribute a("Patch","affectsPkgManager"); return a; }
+ inline const Attribute & attrPatchCategory() { static Attribute a("Patch","category"); return a; }
+ inline const Attribute & attrPatchRebootNeeded() { static Attribute a("Patch","rebootNeeded"); return a; }
+ inline const Attribute & attrPatchTimestamp() { static Attribute a("Patch","timestamp"); return a; }
///////////////////////////////////////////////////////////////////
- inline const Attribute & attrPatchAffectsPkgManager() { static Attribute a("Patch","affectsPkgManager"); return a; }
- inline const Attribute & attrPatchCategory() { static Attribute a("Patch","category"); return a; }
- inline const Attribute & attrPatchRebootNeeded() { static Attribute a("Patch","rebootNeeded"); return a; }
- inline const Attribute & attrPatchTimestamp() { static Attribute a("Patch","timestamp"); return a; }
+ inline const Attribute & attrPatternCategory() { static Attribute a("Pattern","category"); return a; }
+ inline const Attribute & attrPatternIcon() { static Attribute a("Pattern","icon"); return a; }
+ inline const Attribute & attrPatternIsDefault() { static Attribute a("Pattern","isDefault"); return a; }
+ inline const Attribute & attrPatternOrder() { static Attribute a("Pattern","order"); return a; }
+ inline const Attribute & attrPatternUserVisible() { static Attribute a("Pattern","userVisible"); return a; }
///////////////////////////////////////////////////////////////////
- inline const Attribute & attrPatternCategory() { static Attribute a("Pattern","category"); return a; }
- inline const Attribute & attrPatternIcon() { static Attribute a("Pattern","icon"); return a; }
- inline const Attribute & attrPatternIsDefault() { static Attribute a("Pattern","isDefault"); return a; }
- inline const Attribute & attrPatternOrder() { static Attribute a("Pattern","order"); return a; }
- inline const Attribute & attrPatternUserVisible() { static Attribute a("Pattern","userVisible"); return a; }
+ inline const Attribute & attrProductDistributionEdition() { static Attribute a("Product","distributionEdition"); return a; }
+ inline const Attribute & attrProductDistributionName() { static Attribute a("Product","distributionName"); return a; }
+ inline const Attribute & attrProductExtraUrls() { static Attribute a("Product","extraUrls"); return a; }
+ inline const Attribute & attrProductFlags() { static Attribute a("Product","flags"); return a; }
+ inline const Attribute & attrProductLongName() { static Attribute a("Product","longName"); return a; }
+ inline const Attribute & attrProductOptionalUrls() { static Attribute a("Product","optionalUrls"); return a; }
+ inline const Attribute & attrProductReleasenotesUrl() { static Attribute a("Product","releasenotesUrl"); return a; }
+ inline const Attribute & attrProductShortName() { static Attribute a("Product","shortName"); return a; }
+ inline const Attribute & attrProductUpdateUrls() { static Attribute a("Product","updateUrls"); return a; }
///////////////////////////////////////////////////////////////////
- inline const Attribute & attrProductDistributionEdition() { static Attribute a("Product","distributionEdition"); return a; }
- inline const Attribute & attrProductDistributionName() { static Attribute a("Product","distributionName"); return a; }
- inline const Attribute & attrProductExtraUrls() { static Attribute a("Product","extraUrls"); return a; }
- inline const Attribute & attrProductFlags() { static Attribute a("Product","flags"); return a; }
- inline const Attribute & attrProductLongName() { static Attribute a("Product","longName"); return a; }
- inline const Attribute & attrProductOptionalUrls() { static Attribute a("Product","optionalUrls"); return a; }
- inline const Attribute & attrProductReleasenotesUrl() { static Attribute a("Product","releasenotesUrl"); return a; }
- inline const Attribute & attrProductShortName() { static Attribute a("Product","shortName"); return a; }
- inline const Attribute & attrProductUpdateUrls() { static Attribute a("Product","updateUrls"); return a; }
+ inline const Attribute & attrResObjectBuildTime() { static Attribute a("ResObject","buildTime"); return a; }
+ inline const Attribute & attrResObjectDelnotify() { static Attribute a("ResObject","delnotify", Attribute::SHARED); return a; }
+ inline const Attribute & attrResObjectDescription() { static Attribute a("ResObject","description", Attribute::SHARED); return a; }
+ inline const Attribute & attrResObjectInsnotify() { static Attribute a("ResObject","insnotify", Attribute::SHARED); return a; }
+ inline const Attribute & attrResObjectInstallOnly() { static Attribute a("ResObject","installOnly"); return a; }
+ inline const Attribute & attrResObjectInstalledSize() { static Attribute a("ResObject","installedSize"); return a; }
+ inline const Attribute & attrResObjectLicenseToConfirm() { static Attribute a("ResObject","licenseToConfirm", Attribute::SHARED); return a; }
+ inline const Attribute & attrResObjectSummary() { static Attribute a("ResObject","summary", Attribute::SHARED); return a; }
+ inline const Attribute & attrResObjectVendor() { static Attribute a("ResObject","vendor"); return a; }
///////////////////////////////////////////////////////////////////
- inline const Attribute & attrResObjectArchiveSize() { static Attribute a("ResObject","archiveSize"); return a; }
- inline const Attribute & attrResObjectBuildTime() { static Attribute a("ResObject","buildTime"); return a; }
- inline const Attribute & attrResObjectDelnotify() { static Attribute a("ResObject","delnotify"); return a; }
- inline const Attribute & attrResObjectDescription() { static Attribute a("ResObject","description"); return a; }
- inline const Attribute & attrResObjectInsnotify() { static Attribute a("ResObject","insnotify"); return a; }
- inline const Attribute & attrResObjectInstallOnly() { static Attribute a("ResObject","installOnly"); return a; }
- inline const Attribute & attrResObjectInstalledSize() { static Attribute a("ResObject","installedSize"); return a; }
- inline const Attribute & attrResObjectLicenseToConfirm() { static Attribute a("ResObject","licenseToConfirm"); return a; }
- inline const Attribute & attrResObjectSummary() { static Attribute a("ResObject","summary"); return a; }
- inline const Attribute & attrResObjectVendor() { static Attribute a("ResObject","vendor"); return a; }
+ inline const Attribute & attrScriptDoScript() { static Attribute a("Script","doScript"); return a; }
+ // define attrScriptDoScriptLocationMediaNr, attrLocationFilename, etc.
+ defineOnMediaLocationAttr( attrScriptDoScriptLocation, "Script", "doScriptLocation" )
+ inline const Attribute & attrScriptUndoScript() { static Attribute a("Script","undoScript"); return a; }
+ // define attrScriptUndoScriptLocationMediaNr, attrLocationFilename, etc.
+ defineOnMediaLocationAttr( attrScriptUndoScriptLocation, "Script", "undoScriptLocation" )
///////////////////////////////////////////////////////////////////
- inline const Attribute & attrScriptDoScript() { static Attribute a("Script","doScript"); return a; }
- inline const Attribute & attrScriptDoScriptChecksum() { static Attribute a("Script","doScriptChecksum"); return a; }
- inline const Attribute & attrScriptDoScriptChecksumType() { static Attribute a("Script","doScriptChecksumType"); return a; }
- inline const Attribute & attrScriptDoScriptLocation() { static Attribute a("Script","doScriptLocation"); return a; }
- inline const Attribute & attrScriptUndoScript() { static Attribute a("Script","undoScript"); return a; }
- inline const Attribute & attrScriptUndoScriptChecksum() { static Attribute a("Script","undoScriptChecksum"); return a; }
- inline const Attribute & attrScriptUndoScriptChecksumType(){ static Attribute a("Script","undoScriptChecksumType"); return a; }
- inline const Attribute & attrScriptUndoScriptLocation() { static Attribute a("Script","undoScriptLocation"); return a; }
+ // define attrSrcPackageLocationMediaNr, attrSrcPackageLocationFilename, etc.
+ defineOnMediaLocationAttr( attrSrcPackageLocation, "SrcPackage", "location" )
///////////////////////////////////////////////////////////////////
//@}
#include "zypp/cache/CacheInitializer.h"
#include "zypp/target/store/PersistentStorage.h"
#include "zypp/cache/Utils.h"
-
+#include "zypp/PathInfo.h"
#include "sqlite-schema.h"
-#define ZYPP_DB_FILE "/var/lib/zypp/zypp.db"
-
using namespace sqlite3x;
using namespace std;
using zypp::debug::Measure;
struct CacheInitializer::Impl
{
Impl( const Pathname &root_r )
- : root(root_r), just_initialized(false)
+ : root(root_r), just_initialized(false),
+ just_reinitialized(false)
{
}
//typedef std::map<media::MediaNr, media::MediaAccessId> MediaMap
shared_ptr<sqlite3x::sqlite3_connection> con;
Pathname root;
bool just_initialized;
+ bool just_reinitialized;
};
CacheInitializer::CacheInitializer( const Pathname &root_r, const Pathname &db_file )
try
{
_pimpl->con.reset( new sqlite3_connection( ( _pimpl->root + db_file).asString().c_str()) );
-
+ _pimpl->con->executenonquery("begin;");
if( ! tablesCreated() )
{
createTables();
_pimpl->just_initialized = true;
- _pimpl->con->close();
- MIL << "Source cache initialized" << std::endl;
+ //_pimpl->con->close();
+ MIL << "Repository cache initialized" << std::endl;
}
else
{
- MIL << "Source cache already initialized" << std::endl;
+ int version = _pimpl->con->executeint("select version from db_info;");
+ if ( version != ZYPP_CACHE_SCHEMA_VERSION )
+ {
+ WAR << "cache schema version is different from ZYpp cache version" << endl;
+ // FIXME should this code ask first?
+ sqlite3_command tables_cmd( *_pimpl->con, "select name from sqlite_master where type='table';");
+ sqlite3_reader reader = tables_cmd.executereader();
+ list<string> tables;
+ while ( reader.read() )
+ {
+ string tablename = reader.getstring(0);
+ if ( tablename != "sqlite_sequence" )
+ tables.push_back(tablename);
+ }
+ reader.close();
+
+ for ( list<string>::const_iterator it = tables.begin();
+ it != tables.end();
+ ++it )
+ {
+ MIL << "Removing table " << *it << endl;
+ _pimpl->con->execute("drop table " + (*it) + ";");
+ }
+
+ createTables();
+ _pimpl->just_reinitialized = true;
+ MIL << "Repository cache re-initialized" << std::endl;
+ return;
+ }
+
+ MIL << "Repository cache already initialized" << std::endl;
}
}
catch( const exception &ex )
ZYPP_RETHROW(Exception(ex.what()));
//ERR << "Exception Occured: " << ex.what() << endl;
}
-
+ _pimpl->con->executenonquery("commit;");
+ _pimpl->con->close();
}
bool CacheInitializer::justInitialized() const
return _pimpl->just_initialized;
}
+bool CacheInitializer::justReinitialized() const
+{
+ return _pimpl->just_reinitialized;
+}
+
CacheInitializer::~CacheInitializer()
{
void CacheInitializer::createTables()
{
- Measure timer("Create database tables");
+ //Measure timer("Create database tables");
MIL << "Initializing cache schema..." << endl;
- sqlite3_transaction trans(*_pimpl->con);
- {
+ //sqlite3_transaction trans(*_pimpl->con);
+ //{
string sql( schemaData, _schemaData_size);
//ERR << "Executing " << statements[i] << endl;
MIL << "Schema size: " << sql.size() << endl;
_pimpl->con->execute(sql.c_str());
- }
- trans.commit();
- timer.elapsed();
+ sqlite3_command version_cmd( *_pimpl->con, "insert into db_info (version) values(:version);");
+ version_cmd.bind(":version", ZYPP_CACHE_SCHEMA_VERSION);
+ version_cmd.executenonquery();
+ //}
+ //trans.commit();
+ //timer.elapsed();
}
std::ostream & CacheInitializer::dumpOn( std::ostream & str ) const
#include "zypp/Pathname.h"
#include "zypp/cache/sqlite3x/sqlite3x.hpp"
+#define ZYPP_CACHE_SCHEMA_VERSION 1000
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
virtual ~CacheInitializer();
/**
+ * \short Has the cache been reinitialized?
+ *
* only true when cache was not initialized before
* and was just initialized with success
*/
bool justInitialized() const;
+
+ /**
+ * \short Has the cache been reinitialized?
+ *
+ * This is true when the cache was already initialized
+ * but an old schema was detected, so the cache
+ * was reinitialized in order to get the new schema
+ */
+ bool justReinitialized() const;
+
protected:
bool tablesCreated() const;
void createTables();
#include "zypp/cache/CacheInitializer.h"
#include "zypp/cache/CacheStore.h"
#include "zypp/cache/CacheException.h"
+#include "zypp/cache/CacheAttributes.h"
using namespace std;
using namespace zypp;
using zypp::debug::Measure;
+/** Append OnMediaLocation attributes to resolvable with ID.
+ * Pass the OnMediaLocation attributes common prefix as 2nd arg. This macro
+ * assumes that the attribute names follow this schema:
+*/
+#define appendOnMediaLocation(ID,OMLATTRPREFIX,OML) \
+do { \
+ appendNumericAttribute( ID, OMLATTRPREFIX##MediaNr(), OML.medianr() ); \
+ appendStringAttribute ( ID, OMLATTRPREFIX##Filename(), OML.filename().asString() ); \
+ appendNumericAttribute( ID, OMLATTRPREFIX##DownloadSize(), OML.downloadSize() ); \
+ appendStringAttribute ( ID, OMLATTRPREFIX##ChecksumType(), OML.checksum().type() ); \
+ appendStringAttribute ( ID, OMLATTRPREFIX##Checksum(), OML.checksum().checksum() ); \
+ appendNumericAttribute( ID, OMLATTRPREFIX##OpenSize(), OML.openSize() ); \
+ appendStringAttribute ( ID, OMLATTRPREFIX##OpenChecksumType(), OML.openChecksum().type() ); \
+ appendStringAttribute ( ID, OMLATTRPREFIX##OpenChecksum(), OML.openChecksum().checksum() );\
+} while(false)
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
append_other_dependency_cmd.reset( new sqlite3_command( con, "insert into other_capabilities ( resolvable_id, dependency_type, refers_kind, value ) values ( :resolvable_id, :dependency_type, :refers_kind, :value );" ));
- append_resolvable_cmd.reset( new sqlite3_command( con, "insert into resolvables ( name, version, release, epoch, arch, kind, repository_id ) values ( :name, :version, :release, :epoch, :arch, :kind, :repository_id );" ));
+ append_resolvable_cmd.reset( new sqlite3_command( con, "insert into resolvables ( name, version, release, epoch, arch, kind, shared_id, repository_id ) values ( :name, :version, :release, :epoch, :arch, :kind, :shared_id, :repository_id );" ));
count_shared_cmd.reset( new sqlite3_command( con, "select count(id) from resolvables where shared_id=:rid;" ));
void CacheStore::appendResObjectAttributes( const data::RecordId &rid,
const data::ResObject_Ptr & res )
{
- appendTranslatedStringAttribute( rid, "ResObject", "description", res->description );
- appendTranslatedStringAttribute( rid, "ResObject", "summary", res->summary );
- appendNumericAttribute( rid, "ResObject", "installedSize", res->installedSize );
- appendNumericAttribute( rid, "ResObject", "buildTime", res->buildTime );
- appendBooleanAttribute( rid, "ResObject", "installOnly", res->installOnly );
- appendStringAttribute( rid, "ResObject", "vendor", res->vendor );
- appendTranslatedStringAttribute( rid, "ResObject", "licenseToConfirm", res->licenseToConfirm );
- appendTranslatedStringAttribute( rid, "ResObject", "insnotify", res->insnotify );
- appendTranslatedStringAttribute( rid, "ResObject", "delnotify", res->delnotify );
+ appendTranslatedStringAttribute( rid, attrResObjectDescription(), res->description );
+ appendTranslatedStringAttribute( rid, attrResObjectSummary(), res->summary );
+ appendNumericAttribute( rid, attrResObjectInstalledSize(), res->installedSize );
+ appendNumericAttribute( rid, attrResObjectBuildTime(), res->buildTime );
+ appendBooleanAttribute( rid, attrResObjectInstallOnly(), res->installOnly );
+ appendStringAttribute( rid, attrResObjectVendor(), res->vendor );
+ appendTranslatedStringAttribute( rid, attrResObjectLicenseToConfirm(), res->licenseToConfirm );
+ appendTranslatedStringAttribute( rid, attrResObjectInsnotify(), res->insnotify );
+ appendTranslatedStringAttribute( rid, attrResObjectDelnotify(), res->delnotify );
}
void CacheStore::appendPackageBaseAttributes( const RecordId & pkgid,
const data::Packagebase_Ptr & package )
{
- appendStringAttribute( pkgid, "Package", "checksum", package->repositoryLocation.fileChecksum.checksum() );
- appendStringAttribute( pkgid, "Package", "checksumType", package->repositoryLocation.fileChecksum.type() );
- appendStringAttribute( pkgid, "Package", "buildhost", package->buildhost );
- appendStringAttribute( pkgid, "Package", "distribution", package->distribution );
- appendStringAttribute( pkgid, "Package", "license", package->license );
- appendStringAttribute( pkgid, "Package", "group", package->packager );
- appendStringAttribute( pkgid, "Package", "url", package->url );
- appendStringAttribute( pkgid, "Package", "operatingSystem", package->operatingSystem );
- appendStringAttribute( pkgid, "Package", "prein", package->prein );
- appendStringAttribute( pkgid, "Package", "postin", package->postin );
- appendStringAttribute( pkgid, "Package", "preun", package->preun );
- appendStringAttribute( pkgid, "Package", "postun", package->postun );
- appendStringContainerAttribute( pkgid, "Package", "keywords", package->keywords.begin(), package->keywords.end() );
- appendStringContainerAttribute( pkgid, "Package", "authors", package->authors.begin(), package->authors.end() );
- appendStringAttribute( pkgid, "Package", "location", package->repositoryLocation.filePath.asString() );
+ appendStringAttribute( pkgid, attrPackageBuildhost(), package->buildhost );
+ appendStringAttribute( pkgid, attrPackageDistribution(), package->distribution );
+ appendStringAttribute( pkgid, attrPackageLicense(), package->license );
+ appendStringAttribute( pkgid, attrPackageGroup(), package->group );
+ appendStringAttribute( pkgid, attrPackagePackager(), package->packager );
+ appendStringAttribute( pkgid, attrPackageUrl(), package->url );
+ appendStringAttribute( pkgid, attrPackageOperatingSystem(), package->operatingSystem );
+ appendStringAttribute( pkgid, attrPackagePrein(), package->prein );
+ appendStringAttribute( pkgid, attrPackagePostin(), package->postin );
+ appendStringAttribute( pkgid, attrPackagePreun(), package->preun );
+ appendStringAttribute( pkgid, attrPackagePostun(), package->postun );
+ appendStringContainerAttribute( pkgid, attrPackageKeywords(), package->keywords.begin(), package->keywords.end() );
+ appendStringContainerAttribute( pkgid, attrPackageAuthors(), package->authors.begin(), package->authors.end() );
+
+ appendOnMediaLocation( pkgid, attrPackageLocation, package->repositoryLocation );
}
RecordId CacheStore::consumePackage( const RecordId & repository_id,
- const data::Package_Ptr & package )
+ const data::Package_Ptr & package )
{
RecordId id = appendResolvable( repository_id, ResTraits<Package>::kind,
NVRA( package->name, package->edition, package->arch ), package->deps );
appendResObjectAttributes( id, package );
appendPackageBaseAttributes( id, package );
+
+ if ( ! package->srcPackageIdent.name.empty() )
+ {
+ appendStringAttribute( id, attrPackageSourcePkgName(), package->srcPackageIdent.name );
+ appendStringAttribute( id, attrPackageSourcePkgEdition(), package->srcPackageIdent.edition.asString() );
+ }
+
return id;
}
RecordId id = appendResolvable( repository_id, ResTraits<SrcPackage>::kind,
NVRA( package->name, package->edition, package->arch ), package->deps );
appendResObjectAttributes( id, package );
- appendPackageBaseAttributes( id, package );
-#warning TBD WRONG IMPLEMENTATION
+
+ appendOnMediaLocation( id, attrSrcPackageLocation, package->repositoryLocation );
return id;
}
appendResObjectAttributes( id, patch );
// patch attributes
- appendNumericAttribute( id, "Patch", "timestamp", patch->timestamp );
- appendStringAttribute( id, "Patch", "category", patch->category );
- appendBooleanAttribute( id, "Patch", "rebootNeeded", patch->rebootNeeded );
- appendBooleanAttribute( id, "Patch", "affectsPkgManager", patch->affectsPkgManager );
+ appendNumericAttribute( id, attrPatchTimestamp(), patch->timestamp );
+ appendStringAttribute( id, attrPatchCategory(), patch->category );
+ appendBooleanAttribute( id, attrPatchRebootNeeded(), patch->rebootNeeded );
+ appendBooleanAttribute( id, attrPatchAffectsPkgManager(), patch->affectsPkgManager );
DBG << "got patch " << patch->name << ", atoms: ";
NVRA( message->name, message->edition, message->arch ), message->deps );
appendResObjectAttributes( id, message );
- appendTranslatedStringAttribute( id, "Message", "text", message->text );
+ appendTranslatedStringAttribute( id, attrMessageText(), message->text );
return id;
}
NVRA( script->name, script->edition, script->arch ), script->deps );
appendResObjectAttributes( id, script );
- appendStringAttribute( id, "Script", "doScript", script->doScript );
- appendStringAttribute( id, "Script", "doScriptLocation", script->doScriptLocation.filePath.asString() );
- appendStringAttribute( id, "Script", "doScriptChecksum", script->doScriptLocation.fileChecksum.checksum() );
- appendStringAttribute( id, "Script", "doScriptChecksumType", script->doScriptLocation.fileChecksum.type() );
- appendStringAttribute( id, "Script", "undoScript", script->undoScript );
- appendStringAttribute( id, "Script", "undoScriptLocation", script->undoScriptLocation.filePath.asString() );
- appendStringAttribute( id, "Script", "undoScriptChecksum", script->undoScriptLocation.fileChecksum.checksum() );
- appendStringAttribute( id, "Script", "undoScriptChecksumType", script->undoScriptLocation.fileChecksum.type() );
+ appendStringAttribute( id, attrScriptDoScript(), script->doScript );
+ appendOnMediaLocation( id, attrScriptDoScriptLocation, script->doScriptLocation );
+ appendStringAttribute( id, attrScriptUndoScript(), script->undoScript );
+ appendOnMediaLocation( id, attrScriptUndoScriptLocation, script->undoScriptLocation );
return id;
}
NVRA( pattern->name, pattern->edition, pattern->arch ), pattern->deps );
appendResObjectAttributes( id, pattern );
- appendBooleanAttribute( id, "Pattern", "isDefault", pattern->isDefault );
- appendBooleanAttribute( id, "Pattern", "userVisible", pattern->userVisible );
- appendTranslatedStringAttribute( id, "Pattern", "category", pattern->category );
- appendStringAttribute( id, "Pattern", "icon", pattern->icon );
- appendStringAttribute( id, "Pattern", "order", pattern->order );
+ appendBooleanAttribute( id, attrPatternIsDefault(), pattern->isDefault );
+ appendBooleanAttribute( id, attrPatternUserVisible(), pattern->userVisible );
+ appendTranslatedStringAttribute( id, attrPatternCategory(), pattern->category );
+ appendStringAttribute( id, attrPatternIcon(), pattern->icon );
+ appendStringAttribute( id, attrPatternOrder(), pattern->order );
return id;
}
NVRA( product->name, product->edition, product->arch ), product->deps );
appendResObjectAttributes( id, product );
- appendTranslatedStringAttribute( id, "Product", "shortName", product->shortName );
- appendTranslatedStringAttribute( id, "Product", "longName", product->longName );
- appendStringContainerAttribute( id, "Product", "flags", product->flags.begin(), product->flags.end() );
- appendStringAttribute( id, "Product", "releasenotesUrl", product->releasenotesUrl.asString() );
- appendStringContainerAttribute( id, "Product", "updateUrls", product->updateUrls );
- appendStringContainerAttribute( id, "Product", "extraUrls", product->extraUrls );
- appendStringContainerAttribute( id, "Product", "optionalUrls", product->optionalUrls );
- appendStringAttribute( id, "Product", "distributionName", product->distributionName );
- appendStringAttribute( id, "Product", "distributionEdition", product->distributionEdition.asString() );
+ appendTranslatedStringAttribute( id, attrProductShortName(), product->shortName );
+ appendTranslatedStringAttribute( id, attrProductLongName(), product->longName );
+ appendStringContainerAttribute( id, attrProductFlags(), product->flags.begin(), product->flags.end() );
+ appendStringAttribute( id, attrProductReleasenotesUrl(), product->releasenotesUrl.asString() );
+ appendStringContainerAttribute( id, attrProductUpdateUrls(), product->updateUrls );
+ appendStringContainerAttribute( id, attrProductExtraUrls(), product->extraUrls );
+ appendStringContainerAttribute( id, attrProductOptionalUrls(), product->optionalUrls );
+ appendStringAttribute( id, attrProductDistributionName(), product->distributionName );
+ appendStringAttribute( id, attrProductDistributionEdition(), product->distributionEdition.asString() );
return id;
}
return data::noRecordId;
}
+void CacheStore::updatePackageLang( const data::RecordId & resolvable_id,
+ const data::Packagebase_Ptr & data_r )
+{
+ appendTranslatedStringAttribute( resolvable_id, attrResObjectSummary(), data_r->summary );
+ appendTranslatedStringAttribute( resolvable_id, attrResObjectDescription(), data_r->description );
+ appendTranslatedStringAttribute( resolvable_id, attrResObjectLicenseToConfirm(), data_r->licenseToConfirm );
+ appendTranslatedStringAttribute( resolvable_id, attrResObjectInsnotify(), data_r->insnotify );
+ appendTranslatedStringAttribute( resolvable_id, attrResObjectDelnotify(), data_r->delnotify );
+}
+
RecordId CacheStore::appendResolvable( const RecordId &repository_id,
const Resolvable::Kind &kind,
const NVRA &nvra,
const data::Dependencies &deps )
{
+ return appendResolvable( repository_id,
+ kind,
+ nvra,
+ deps,
+ data::noRecordId );
+}
+
+data::RecordId
+ CacheStore::appendResolvable( const data::RecordId &repository_id,
+ const Resolvable::Kind &kind,
+ const NVRA &nvra,
+ const data::Dependencies &deps,
+ const data::RecordId &shared_id )
+{
_pimpl->append_resolvable_cmd->bind( ":name", nvra.name );
_pimpl->append_resolvable_cmd->bind( ":version", nvra.edition.version() );
_pimpl->append_resolvable_cmd->bind( ":release", nvra.edition.release() );
_pimpl->append_resolvable_cmd->bind( ":kind", lookupOrAppendType("kind", kind.asString()) );
_pimpl->append_resolvable_cmd->bind( ":repository_id", repository_id );
+ if ( shared_id == data::noRecordId )
+ _pimpl->append_resolvable_cmd->bind(":shared_id");
+ else
+ _pimpl->append_resolvable_cmd->bind( ":shared_id", shared_id );
+
_pimpl->append_resolvable_cmd->executenonquery();
long long id = _pimpl->con.insertid();
_pimpl->insert_resolvable_in_repository_cmd->bind(":resolvable_id", id);
_pimpl->insert_resolvable_in_repository_cmd->executenonquery();*/
- return static_cast<RecordId>(id);
- return 1;
+ return id;
}
void CacheStore::appendDependencies( const RecordId &resolvable_id, const data::Dependencies &deps )
}
}
-// RecordId CacheStore::lookupOrAppendNamedDependencyEntry( const RecordId name_id, const Edition &edition, const zypp::Rel &rel )
-// {
-// _pimpl->select_named_dependency_cmd->bind( ":name_id", name_id);
-// _pimpl->select_named_dependency_cmd->bind( ":version", edition.version() );
-// _pimpl->select_named_dependency_cmd->bind( ":release", edition.release() );
-// _pimpl->select_named_dependency_cmd->bind( ":epoch", static_cast<int>( edition.epoch() ) );
-// _pimpl->select_named_dependency_cmd->bind( ":relation", zypp_rel2db_rel( rel ) );
-// long long id = 0;
-// try {
-// id = _pimpl->select_named_dependency_cmd->executeint64();
-// }
-// catch ( const sqlite3x::database_error &e )
-// {
-// // does not exist
-// _pimpl->append_named_dependency_entry_cmd->bind( ":name_id", name_id);
-// _pimpl->append_named_dependency_entry_cmd->bind( ":version", edition.version() );
-// _pimpl->append_named_dependency_entry_cmd->bind( ":release", edition.release() );
-// _pimpl->append_named_dependency_entry_cmd->bind( ":epoch", static_cast<int>( edition.epoch() ) );
-// _pimpl->append_named_dependency_entry_cmd->bind( ":relation", zypp_rel2db_rel( rel ) );
-// _pimpl->append_named_dependency_entry_cmd->executenonquery();
-// id = _pimpl->con.insertid();
-// return static_cast<RecordId>(id);
-// }
-// return static_cast<RecordId>(id);
-// }
void CacheStore::appendNamedDependency( const RecordId &resolvable_id, zypp::Dep deptype, capability::NamedCap::Ptr cap )
{
if ( !cap )
ZYPP_THROW(Exception("Null HAL capability"));
+ MIL << "HAL cap [ rid: " << resolvable_id << " | deptype: " << deptype << " | cap: "
+ << cap << endl;
+
_pimpl->append_hal_dependency_cmd->bind( ":resolvable_id", resolvable_id );
_pimpl->append_hal_dependency_cmd->bind( ":dependency_type", lookupOrAppendType("deptype", deptype.asString()) );
_pimpl->append_hal_dependency_cmd->bind( ":refers_kind", lookupOrAppendType("kind", cap->refers().asString()) );
_pimpl->append_other_dependency_cmd->bind( ":refers_kind", lookupOrAppendType("kind", cap->refers().asString()) );
_pimpl->append_other_dependency_cmd->bind( ":value", cap->encode());
- _pimpl->append_hal_dependency_cmd->executenonquery();
+ _pimpl->append_other_dependency_cmd->executenonquery();
//delete cmd;
}
//! \todo what's this? _pimpl->insert_patchrpm_cmd->bind(":media_nr", ???);
_pimpl->insert_patchrpm_cmd->bind(":repository_id", repository_id);
- _pimpl->insert_patchrpm_cmd->bind(":location", prpm->location.filePath.asString());
- _pimpl->insert_patchrpm_cmd->bind(":checksum", prpm->location.fileChecksum.checksum());
+ _pimpl->insert_patchrpm_cmd->bind(":location", prpm->location.filename().asString());
+ _pimpl->insert_patchrpm_cmd->bind(":checksum", prpm->location.checksum().checksum());
//! \todo checksum type
- _pimpl->insert_patchrpm_cmd->bind(":download_size", static_cast<ByteCount::SizeType>(prpm->location.fileSize));
+ _pimpl->insert_patchrpm_cmd->bind(":download_size", static_cast<ByteCount::SizeType>(prpm->location.downloadSize()));
_pimpl->insert_patchrpm_cmd->bind(":build_time", prpm->buildTime.asSeconds());
_pimpl->insert_patchrpm_cmd->executenonquery();
//! \todo what's this? _pimpl->insert_deltarpm_cmd->bind(":media_nr", ???);
_pimpl->insert_deltarpm_cmd->bind(":repository_id", repository_id);
- _pimpl->insert_deltarpm_cmd->bind(":location", drpm->location.filePath.asString());
- _pimpl->insert_deltarpm_cmd->bind(":checksum", drpm->location.fileChecksum.checksum());
+ _pimpl->insert_deltarpm_cmd->bind(":location", drpm->location.filename().asString());
+ _pimpl->insert_deltarpm_cmd->bind(":checksum", drpm->location.checksum().checksum());
//! \todo checksum type
- _pimpl->insert_deltarpm_cmd->bind(":download_size", static_cast<ByteCount::SizeType>(drpm->location.fileSize));
+ _pimpl->insert_deltarpm_cmd->bind(":download_size", static_cast<ByteCount::SizeType>(drpm->location.downloadSize()));
_pimpl->insert_deltarpm_cmd->bind(":build_time", drpm->buildTime.asSeconds());
_pimpl->insert_deltarpm_cmd->bind(":baseversion_version", drpm->baseVersion.edition.version());
}
-// RecordId CacheStore::appendDependencyEntry( const RecordId &resolvable_id, zypp::Dep deptype, const Resolvable::Kind &refers )
-// {
-// //DBG << "rid: " << resolvable_id << " deptype: " << deptype << " " << "refers: " << refers << endl;
-// _pimpl->insert_dependency_entry_cmd->bind( ":resolvable_id", resolvable_id );
-//
-// db::DependencyType dt = zypp_deptype2db_deptype(deptype);
-// if ( dt == db::DEP_TYPE_UNKNOWN )
-// {
-// ZYPP_THROW(Exception("Unknown depenency type"));
-// }
-//
-// _pimpl->insert_dependency_entry_cmd->bind( ":dependency_type", zypp_deptype2db_deptype(deptype) );
-// _pimpl->insert_dependency_entry_cmd->bind( ":refers_kind", zypp_kind2db_kind(refers) );
-//
-// _pimpl->insert_dependency_entry_cmd->executenonquery();
-// //delete cmd;
-// long long id = _pimpl->con.insertid();
-// return static_cast<RecordId>(id);
-// }
-
RecordId CacheStore::lookupOrAppendFile( const Pathname &path )
{
RecordId dir_name_id = lookupOrAppendDirName(path.dirname().asString());
// don't bother with writing if the string is empty
if (text.empty()) return;
- RecordId lang_id = lookupOrAppendType("lang",
- locale.code().empty() ? "none" : locale.code() );
+ RecordId lang_id = lookupOrAppendType("lang", locale.code() );
RecordId type_id = lookupOrAppendType( klass, name );
appendStringAttribute( resolvable_id, lang_id, type_id, text );
}
#include "zypp/base/PtrTypes.h"
#include "zypp/RepoStatus.h"
#include "zypp/ProgressData.h"
+#include "zypp/cache/Attribute.h"
///////////////////////////////////////////////////////////////////
namespace zypp
*/
void commit();
+ /** \name Implementation of the \ref ResolvableDataConsumer interface. */
+ //@{
/**
- * Implementation of the \ref ResolvableConsumer interface
+ * Implementation of the \ref ResolvableDataConsumer interface
*
* Consume a package, inserting it in the cache, under
* \param repository_id ownership.
const data::Package_Ptr & package);
/**
- * Implementation of the \ref ResolvableConsumer interface
+ * Implementation of the \ref ResolvableDataConsumer interface
*
* Consume a source package, inserting it in the cache, under
* \param catalog_id ownership.
const data::SrcPackage_Ptr & srcpackage );
/**
- * Implementation of the \ref ResolvableConsumer interface
+ * Implementation of the \ref ResolvableDataConsumer interface
*
* Consume a patch, inserting it in the cache, under
* \param repository_id ownership.
const data::Patch_Ptr & patch );
/**
- * Implementation of the \ref ResolvableConsumer interface.
+ * Implementation of the \ref ResolvableDataConsumer interface.
*
* Consume a package atom, inserting it in the cache, under
* \a repository_id ownership.
const data::PackageAtom_Ptr & atom );
/**
- * Implementation of the \ref ResolvableConsumer interface
+ * Implementation of the \ref ResolvableDataConsumer interface
*
* Consume a message, inserting it in the cache, under
* \param repository_id ownership.
const data::Message_Ptr & message);
/**
- * Implementation of the \ref ResolvableConsumer interface
+ * Implementation of the \ref ResolvableDataConsumer interface
*
* Consume a script, inserting it in the cache, under
* \param repository_id ownership.
const data::Script_Ptr & script);
/**
- * Implementation of the \ref ResolvableConsumer interface
+ * Implementation of the \ref ResolvableDataConsumer interface
*
* Consume a pattern, inserting it in the cache, under
* \param repository_id ownership.
const data::Pattern_Ptr & pattern );
/**
- * Implementation of the \ref ResolvableConsumer interface
+ * Implementation of the \ref ResolvableDataConsumer interface
*
* Consume a product, inserting it in the cache, under
* \param repository_id ownership.
const data::Product_Ptr & product );
/**
- * Implementation of the \ref ResolvableConsumer interface
+ * Implementation of the \ref ResolvableDataConsumer interface
*
* Consume changelog of a resolvable, inserting it in the cache.
* \param repository_id ownership.
const Changelog & changelog );
/**
- * Implementation of the \ref ResolvableConsumer interface
+ * Implementation of the \ref ResolvableDataConsumer interface
*
* Consume filelist of a resolvable, inserting it in the cache.
* \param repository_id ownership.
const data::Filenames & filenames );
/**
+ * Implementation of the \ref ResolvableDataConsumer interface
+ *
+ * Update a packages language specific data (summary, description,
+ * EULA, ins/delnotify).
+ * \param resolvable_id resolvable to be updated
+ * \param data_r Package data
+ */
+ virtual void updatePackageLang( const data::RecordId & resolvable_id,
+ const data::Packagebase_Ptr & data_r );
+ //@}
+ public:
+ /**
* Appends a resolvable to the store.
*
* You have to specify with \a kind of resolvable are you inserting
const data::Dependencies &deps );
/**
+ * \short Appends a resolvable, and sets shared data with another one
+ *
+ * \see appendResolvable
+ * \param shared_id Resolvable that provides data in case
+ * this one does not provide an attribute
+ *
+ * \note Not all attributes can be shared. \ref shared_id is just
+ * a hint for the queries.
+ */
+ data::RecordId appendResolvable( const data::RecordId &repository_id,
+ const Resolvable::Kind &kind,
+ const NVRA &nvra,
+ const data::Dependencies &deps,
+ const data::RecordId &shared_id );
+ /**
* Adds dependencies to the store
*
* A map of dependency lists has to be specified. The map contains
*/
data::RecordId lookupOrAppendType( const std::string &klass,
const std::string &name );
+ /** \overload */
+ data::RecordId lookupOrAppendType( const Attribute &attr )
+ { return lookupOrAppendType( attr.klass, attr.name ); }
/**
* Returns the record id of a repository (Source)
const std::string &klass,
const std::string &name,
int value );
+ /** \overload */
+ void appendNumericAttribute( const data::RecordId &resolvable_id,
+ const Attribute& attr,
+ int value )
+ { appendNumericAttribute( resolvable_id, attr.klass, attr.name, value ); }
/**
* Append a translated string value to a resolvable
const std::string &klass,
const std::string &name,
const TranslatedText &text );
+ /** \overload */
+ void appendTranslatedStringAttribute( const data::RecordId &resolvable_id,
+ const Attribute& attr,
+ const TranslatedText &text )
+ { appendTranslatedStringAttribute( resolvable_id, attr.klass, attr.name, text ); }
/**
* Append a string value to a resolvable
const std::string &klass,
const std::string &name,
const std::string &text );
+ /** \overload */
+ void appendStringAttributeTranslation( const data::RecordId &resolvable_id,
+ const Locale &locale,
+ const Attribute& attr,
+ const std::string &text )
+ { appendStringAttributeTranslation( resolvable_id, locale, attr.klass, attr.name, text ); }
/**
* Append a string value to a resolvable
const std::string &klass,
const std::string &name,
const std::string &value );
+ /** \overload */
+ void appendStringAttribute( const data::RecordId &resolvable_id,
+ const Attribute& attr,
+ const std::string &value )
+ { appendStringAttribute( resolvable_id, attr.klass, attr.name, value ); }
/**
* Append a string value to a resolvable
const data::RecordId &type_id,
const std::string &value );
-
/**
* Append strings from _Iterator to a resolvable.
*
std::string value = str::join(begin, end, ZConfig().cacheDBSplitJoinSeparator());
appendStringAttribute( resolvable_id, klass, name, value );
}
+ /** \overload */
+ template <class _Iterator>
+ void appendStringContainerAttribute( const data::RecordId &resolvable_id,
+ const Attribute& attr,
+ _Iterator begin,
+ _Iterator end )
+ { appendStringContainerAttribute( resolvable_id, attr.klass, attr.name, begin, end ); }
/**
* Append strings from a _Container to a resolvable.
const std::string &name,
const _Container & container )
{ appendStringContainerAttribute( resolvable_id, klass, name, container.begin(), container.end() ); }
+ /** \overload */
+ template <class _Container>
+ void appendStringContainerAttribute( const data::RecordId &resolvable_id,
+ const Attribute& attr,
+ const _Container & container )
+ { appendStringContainerAttribute( resolvable_id, attr.klass, attr.name, container ); }
/**
* Update a known repository checksum and timestamp
const std::string & klass,
const std::string & name,
bool value);
+ /** \overload */
+ void appendBooleanAttribute( const data::RecordId & resolvable_id,
+ const Attribute& attr,
+ bool value)
+ { appendBooleanAttribute( resolvable_id, attr.klass, attr.name, value ); }
+
/** \name Detail Attributes Inserters
* These functions are used by ResolvableConsumer interface functions
#include <iterator>
#include <algorithm>
-
+#include "zypp/base/PtrTypes.h"
+#include "zypp/base/Logger.h"
#include "zypp/cache/CacheTypes.h"
#include "zypp/cache/ResolvableQuery.h"
#include "zypp/Package.h"
using namespace sqlite3x;
using namespace std;
+using namespace zypp;
-namespace zypp { namespace cache {
+typedef shared_ptr<sqlite3_command> sqlite3_command_ptr;
+namespace zypp { namespace cache {
struct ResolvableQuery::Impl
{
Pathname _dbdir;
string _fields;
CacheTypes _type_cache;
-
+ sqlite3_connection _con;
+ sqlite3_command_ptr _cmd_attr_str;
+ sqlite3_command_ptr _cmd_attr_tstr;
+ sqlite3_command_ptr _cmd_attr_num;
+
Impl( const Pathname &dbdir)
: _dbdir(dbdir)
- , _type_cache(dbdir)
+ , _type_cache(dbdir)
{
+ _con.open((dbdir + "zypp.db").asString().c_str());
+ _con.executenonquery("PRAGMA cache_size=8000;");
+
+ _cmd_attr_tstr.reset( new sqlite3_command( _con, "select a.text, l.name from text_attributes a,types l,types t where a.weak_resolvable_id=:rid and a.lang_id=l.id and a.attr_id=t.id and l.class=:lclass and t.class=:tclass and t.name=:tname;") );
+
+
+ _cmd_attr_str.reset( new sqlite3_command( _con, "select a.text from text_attributes a,types l,types t where a.weak_resolvable_id=:rid and a.lang_id=l.id and a.attr_id=t.id and l.class=:lclass and l.name=:lname and t.class=:tclass and t.name=:tname;"));
+
+
+ _cmd_attr_num.reset( new sqlite3_command( _con, "select a.value from numeric_attributes a,types t where a.weak_resolvable_id=:rid and a.attr_id=t.id and t.class=:tclass and t.name=:tname;"));
+
+ MIL << "Creating Resolvable query impl" << endl;
_fields = "id, name, version, release, epoch, arch, kind, installed_size, archive_size, install_only, build_time, install_time, repository_id";
}
~Impl()
{
+ MIL << "Destroying Resolvable query impl" << endl;
}
data::ResObject_Ptr fromRow( sqlite3_reader &reader )
const std::string &name,
const std::string &default_value )
{
- sqlite3_connection con((_dbdir + "zypp.db").asString().c_str());
- try {
- return queryStringAttributeTranslationInternal( con, record_id, Locale(), klass, name, default_value);
- }
- catch ( const Exception &e )
- {
- ZYPP_RETHROW(e);
- }
+ string value;
+ return queryStringAttributeTranslationInternal( _con, record_id, Locale(), klass, name, default_value);
}
const std::string &name,
const std::string &default_value )
{
- sqlite3_connection con((_dbdir + "zypp.db").asString().c_str());
- try {
- return queryStringAttributeTranslationInternal( con, record_id, locale, klass, name, default_value );
- }
- catch ( const Exception &e )
- {
- ZYPP_RETHROW(e);
- }
+ return queryStringAttributeTranslationInternal( _con, record_id, locale, klass, name, default_value );
}
const std::string &name,
const TranslatedText &default_value )
{
- sqlite3_connection con((_dbdir + "zypp.db").asString().c_str());
- try {
- return queryTranslatedStringAttributeInternal( con, record_id, klass, name, default_value );
- }
- catch ( const Exception &e )
- {
- ZYPP_RETHROW(e);
- }
+ return queryTranslatedStringAttributeInternal( _con, record_id, klass, name, default_value );
}
const std::string &name,
bool default_value )
{
- sqlite3_connection con((_dbdir + "zypp.db").asString().c_str());
- try {
- return queryNumericAttributeInternal( con, record_id, klass, name, default_value);
- }
- catch ( const Exception &e )
- {
- ZYPP_RETHROW(e);
- }
+ return ( queryNumericAttributeInternal( _con, record_id, klass, name, default_value) > 0 );
}
int queryNumericAttribute( const data::RecordId &record_id,
const std::string &name,
int default_value )
{
- sqlite3_connection con((_dbdir + "zypp.db").asString().c_str());
- try {
- return queryNumericAttributeInternal( con, record_id, klass, name, default_value);
- }
- catch ( const Exception &e )
- {
- ZYPP_RETHROW(e);
- }
+ return queryNumericAttributeInternal( _con, record_id, klass, name, default_value);
}
private:
const std::string &name,
int default_value )
{
- con.executenonquery("BEGIN;");
- sqlite3_command cmd( con, "select a.value from numeric_attributes a,types t where a.weak_resolvable_id=:rid and a.attr_id=t.id and t.class=:tclass and t.name=:tname;");
+ //con.executenonquery("BEGIN;");
+ _cmd_attr_num->bind(":rid", record_id);
- cmd.bind(":rid", record_id);
+ _cmd_attr_num->bind(":tclass", klass);
+ _cmd_attr_num->bind(":tname", name);
- cmd.bind(":tclass", klass);
- cmd.bind(":tname", name);
-
- sqlite3_reader reader = cmd.executereader();
+ sqlite3_reader reader = _cmd_attr_num->executereader();
if ( reader.read() )
return reader.getint(0);
- else
- return default_value;
+
+ return default_value;
}
TranslatedText queryTranslatedStringAttributeInternal( sqlite3_connection &con,
const TranslatedText &default_value )
{
//con.executenonquery("PRAGMA cache_size=8000;");
- con.executenonquery("BEGIN;");
- sqlite3_command cmd( con, "select a.text, l.name from text_attributes a,types l,types t where a.weak_resolvable_id=:rid and a.lang_id=l.id and a.attr_id=t.id and l.class=:lclass and t.class=:tclass and t.name=:tname;");
+ //con.executenonquery("BEGIN;");
- cmd.bind(":rid", record_id);
- cmd.bind(":lclass", "lang");
+ _cmd_attr_tstr->bind(":rid", record_id);
+ _cmd_attr_tstr->bind(":lclass", "lang");
- cmd.bind(":tclass", klass);
- cmd.bind(":tname", name);
+ _cmd_attr_tstr->bind(":tclass", klass);
+ _cmd_attr_tstr->bind(":tname", name);
TranslatedText result;
- sqlite3_reader reader = cmd.executereader();
- if ( reader.read() )
+ sqlite3_reader reader = _cmd_attr_tstr->executereader();
+
+ int c = 0;
+ while(reader.read())
{
result.setText( reader.getstring(0), Locale( reader.getstring(1) ) );
- return result;
+ c++;
}
- else
- return default_value;
+
+ if ( c>0 )
+ return result;
+
+ return default_value;
}
std::string queryStringAttributeInternal( sqlite3_connection &con,
const std::string &name,
const std::string &default_value )
{
- return queryStringAttributeTranslationInternal( con, record_id, Locale(), klass, name, default_value);
+ return queryStringAttributeTranslationInternal( con, record_id, Locale(), klass, name, default_value );
}
std::string queryStringAttributeTranslationInternal( sqlite3_connection &con,
const Locale &locale,
const std::string &klass,
const std::string &name,
- const std::string &default_value )
+ const std::string &default_value )
{
- //con.executenonquery("PRAGMA cache_size=8000;");
- con.executenonquery("BEGIN;");
- sqlite3_command cmd( con, "select a.text from text_attributes a,types l,types t where a.weak_resolvable_id=:rid and a.lang_id=l.id and a.attr_id=t.id and l.class=:lclass and l.name=:lname and t.class=:tclass and t.name=:tname;");
-
- cmd.bind(":rid", record_id);
- cmd.bind(":lclass", "lang");
+ //con.executenonquery("BEGIN;");
+ _cmd_attr_str->bind(":rid", record_id);
+ _cmd_attr_str->bind(":lclass", "lang");
if (locale == Locale() )
- cmd.bind(":lname", "none");
+ _cmd_attr_str->bind(":lname", "none");
else
- cmd.bind(":lname", locale.code());
+ _cmd_attr_str->bind(":lname", locale.code());
- cmd.bind(":tclass", klass);
- cmd.bind(":tname", name);
+ _cmd_attr_str->bind(":tclass", klass);
+ _cmd_attr_str->bind(":tname", name);
- sqlite3_reader reader = cmd.executereader();
+ sqlite3_reader reader = _cmd_attr_str->executereader();
+
if ( reader.read() )
return reader.getstring(0);
- else
- return default_value;
+
+ return default_value;
}
};
ResolvableQuery::ResolvableQuery( const Pathname &dbdir)
: _pimpl(new Impl(dbdir))
{
+ //MIL << "Creating Resolvable query" << endl;
+}
+
+ResolvableQuery::~ResolvableQuery()
+{
+ //MIL << "Destroying Resolvable query" << endl;
}
//////////////////////////////////////////////////////////////////////////////
#include "zypp/Pathname.h"
#include "zypp/data/ResolvableData.h"
#include "zypp/data/RecordId.h"
+#include "zypp/cache/Attribute.h"
///////////////////////////////////////////////////////////////////
namespace zypp
///////////////////////////////////////////////////////////////////
namespace cache
{ /////////////////////////////////////////////////////////////////
-
+
/**
* The resolvable query class allows you to query for resolvable
* data and properties from the cache.
* first parameter is the resolvable id.
* second parameter is a \ref data::ResObjectData object with the resource
*/
- typedef function<bool( const data::RecordId &,
+ typedef function<bool( const data::RecordId &,
data::ResObject_Ptr )> ProcessResolvable;
-
+
/**
* Constructor
*
*/
ResolvableQuery( const Pathname &dbdir );
+ ~ResolvableQuery();
+
/**
* Query by record id
* \param record_id Resolvable id to query
*/
void query( const data::RecordId &record_id,
ProcessResolvable fnc );
-
+
/**
* Query by matching text
* \param text text to match
*/
void query( const std::string &text,
ProcessResolvable fnc );
-
+
/**
* Queries a specifc attribute for a resolvable
*
const std::string &klass,
const std::string &name,
int default_value = -1 );
+ /** \overload */
+ int queryNumericAttribute( const data::RecordId &record_id,
+ const Attribute& attr,
+ int default_value = -1 )
+ { return queryNumericAttribute( record_id, attr.klass, attr.name, default_value ); }
/**
const std::string &klass,
const std::string &name,
bool default_value = false );
+ /** \overload */
+ bool queryBooleanAttribute( const data::RecordId &record_id,
+ const Attribute& attr,
+ bool default_value = false )
+ { return queryBooleanAttribute( record_id, attr.klass, attr.name, default_value ); }
/**
const std::string &klass,
const std::string &name,
const std::string &default_value = std::string() );
-
+ /** \overload */
+ std::string queryStringAttribute( const data::RecordId &record_id,
+ const Attribute& attr,
+ const std::string &default_value = std::string() )
+ { return queryStringAttribute( record_id, attr.klass, attr.name, default_value ); }
+
/**
* Queries a specifc attribute translation
* for a resolvable.
const std::string &klass,
const std::string &name,
const std::string &default_value = std::string() );
-
+ /** \overload */
+ std::string queryStringAttributeTranslation( const data::RecordId &record_id,
+ const Locale &locale,
+ const Attribute& attr,
+ const std::string &default_value = std::string() )
+ { return queryStringAttributeTranslation( record_id, locale, attr.klass, attr.name, default_value ); }
+
/**
* Queries all translations for a specific attribute
* in a resolvable.
* \param klass Attribute Class
* \param name Attribute Name
*
- * \return all attribute translations or a empty
+ * \return all attribute translations or a empty
* \ref TranslatedString if no record is found.
*/
TranslatedText queryTranslatedStringAttribute( const data::RecordId &record_id,
const std::string &klass,
const std::string &name,
- const TranslatedText &default_vaue = TranslatedText() );
-
+ const TranslatedText &default_value = TranslatedText() );
+ /** \overload */
+ TranslatedText queryTranslatedStringAttribute( const data::RecordId &record_id,
+ const Attribute& attr,
+ const TranslatedText &default_value = TranslatedText() )
+ { return queryTranslatedStringAttribute( record_id, attr.klass, attr.name, default_value ); }
+
/**
* Queries for a specific container attribute
* in a resolvable.
const std::string &name,
_OutputIterator result )
{
-
+
std::string all = queryStringAttribute( record_id, klass, name);
//FIXME use zypp separator
str::split( all, result );
}
-
-
-
+ /** \overload */
+ template<class _OutputIterator>
+ void queryStringContainerAttribute( const data::RecordId &record_id,
+ const Attribute& attr,
+ _OutputIterator result )
+ { queryStringContainerAttribute( record_id, attr.klass, attr.name, result ); }
+
+
+
private:
/** Implementation. */
class Impl;
CREATE TABLE db_info (
version INTEGER
);
---INSERT INTO db_info (version) VALUES ('
+
------------------------------------------------
-- Basic types like archs, attributes, languages
------------------------------------------------
, baseversion_sequence_info TEXT
, repository_id INTEGER REFERENCES repositories(id)
);
+CREATE INDEX delta_package_repository_id ON delta_packages(repository_id);
CREATE TABLE patch_packages (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
, build_time INTEGER
, repository_id INTEGER REFERENCES repositories(id)
);
+CREATE INDEX patch_package_repository_id ON patch_packages(repository_id);
CREATE TABLE patch_packages_baseversions (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
DELETE FROM file_capabilities WHERE resolvable_id = old.id;
DELETE FROM split_capabilities WHERE resolvable_id = old.id;
DELETE FROM other_capabilities WHERE resolvable_id = old.id;
+
+ DELETE FROM text_attributes WHERE weak_resolvable_id = old.id;
+ DELETE FROM numeric_attributes WHERE weak_resolvable_id = old.id;
END;
------------------------------------------------
AFTER DELETE ON repositories
BEGIN
DELETE FROM resolvables WHERE repository_id = old.id;
+ DELETE FROM delta_packages WHERE repository_id = old.id;
+ DELETE FROM patch_packages WHERE repository_id = old.id;
END;
CREATE TRIGGER remove_patch_packages_baseversions
private:\r
friend class sqlite3_command;\r
friend class database_error;\r
-\r
struct sqlite3 *db;\r
-\r
public:\r
sqlite3_connection();\r
sqlite3_connection(const char *db);\r
sqlite3_connection(const wchar_t *db);\r
+ \r
+ void setprogresshandler( int, int(*)(void *), void* );\r
+ \r
~sqlite3_connection();\r
\r
void open(const char *db);\r
void setbusytimeout(int ms);\r
\r
void execute(const std::string &sql);\r
- \r
+\r
void executenonquery(const char *sql);\r
void executenonquery(const wchar_t *sql);\r
void executenonquery(const std::string &sql);\r
{\r
public:\r
database_error(const char *msg);\r
+ database_error(const std::string & msg);\r
database_error(sqlite3_connection &con);\r
};\r
\r
void bind(int index, const void *data, int datalen);\r
void bind(int index, const std::string &data);\r
void bind(int index, const std::wstring &data);\r
- \r
+\r
void bind(const std::string ¶m);\r
void bind(const std::string ¶m, int data);\r
void bind(const std::string ¶m, long long data);\r
$Revision: 1.1 $\r
*/\r
\r
-/* \r
+/*\r
this source contains modifications by Novell Inc.\r
- \r
+\r
Changes:\r
- \r
+\r
* dmacvicar@novell.com\r
Wrap sqlite3_exec\r
\r
if (this->db) sqlite3_close(this->db);\r
}\r
\r
+void sqlite3_connection::setprogresshandler( int n, int(*fnc)(void*), void* ptr )\r
+{\r
+ sqlite3_progress_handler(db, n, fnc, ptr);\r
+}\r
+\r
void sqlite3_connection::open(const char *db)\r
{\r
if (sqlite3_open(db, &this->db)!=SQLITE_OK)\r
- SQLITE3X_THROW(database_error("unable to open database"));\r
+ {\r
+ std::string msg( "unable to open database at " );\r
+ msg += ( db ? db : "NULL" );\r
+ SQLITE3X_THROW(database_error(msg));\r
+ }\r
}\r
\r
void sqlite3_connection::open(const wchar_t *db)\r
void sqlite3_connection::execute(const std::string &sql)\r
{\r
if (!this->db) SQLITE3X_THROW(database_error("database is not open"));\r
- \r
+\r
char *err_msg;\r
- \r
+\r
if ( sqlite3_exec( this->db, sql.c_str(), NULL, NULL, &err_msg ) != SQLITE_OK )\r
{\r
std::string err(err_msg);\r
\r
database_error::database_error(const char *msg) : zypp::Exception(msg)\r
{}\r
+database_error::database_error(const std::string & msg) : zypp::Exception(msg)\r
+{}\r
database_error::database_error(sqlite3_connection &con) : zypp::Exception(sqlite3_errmsg(con.db))\r
{}\r
\r
}
};
+ typedef std::set<CapabilityImpl::Ptr> CapabilityImplPtrSet;
+
/////////////////////////////////////////////////////////////////
} // namespace capability
///////////////////////////////////////////////////////////////////
// << " enhances:" << endl << enhances << endl
}
-
-// COMMENT BLOCK BELOW:
-// Overload 'virtual std::ostream & dumpOn' to realize 'std::ostream & operator<<'.
-// That's the intended way for ReferenceCounted objects.
-//
-/*
-std::ostream& operator<<(std::ostream& out, const zypp::shared_ptr<AtomBase> data)
-{
- out << "Atom data" << endl;
- switch (data->atomType())
- {
- case AtomBase::TypePackage:
- out << " atom type: " << "package" << endl
- << *zypp::dynamic_pointer_cast<Patch>(data);
- break;
- case AtomBase::TypeMessage:
- out << " atom type: " << "message" << endl
- << *zypp::dynamic_pointer_cast<Message>(data);
- break;
- case AtomBase::TypeScript:
- out << " atom type: " << "script" << endl
- << *zypp::dynamic_pointer_cast<Script>(data);
- break;
- default:
- out << "Unknown atom type" << endl;
- }
- return out;
-}
-
-std::ostream& operator<<(std::ostream& out, const Script& data)
-{
- out << " do script: " << data.do_script << endl
- << " undo script: " << data.undo_script << endl
- << " do script location: " << data.do_location << endl
- << " undo script location: " << data.undo_location << endl
- << " do script media: " << data.do_media << endl
- << " undo script media: " << data.undo_media << endl
- << " do checksum type: " << data.do_checksum_type << endl
- << " do checksum: " << data.do_checksum << endl
- << " undo checksum type: " << data.undo_checksum_type << endl
- << " undo checksum: " << data.undo_checksum << endl;
- return out;
-}
-
-
-std::ostream& operator<<(std::ostream& out, const Message& data)
-{
- out << "Message Data: " << endl
- << " name: " << data.name << endl
- << " epoch: " << data.epoch << endl
- << " version: " << data.ver << endl
- << " release: " << data.rel << endl
- << " provides: " << data.provides << endl
- << " conflicts: " << data.conflicts << endl
- << " obsoletes: " << data.obsoletes << endl
- << " freshens: " << data.freshens << endl
- << " requires: " << data.requires << endl
- << " recommends:" << endl << data.recommends << endl
- << " suggests:" << endl << data.suggests << endl
- << " supplements:" << endl << data.supplements << endl
- << " enhances:" << endl << data.enhances << endl
- << " text: " << data.text << endl;
- return out;
-}
-*/
-
} // namespace cache
} // namespace zypp
#include "zypp/Url.h"
#include "zypp/Date.h"
#include "zypp/TranslatedText.h"
+#include "zypp/OnMediaLocation.h"
namespace zypp
{
/** List of files contained in a package (info for UI) */
typedef std::list<std::string> Filenames;
-
- /** Data to retrieve a file from some media. */
- struct Location
- {
- Location()
- : fileSize( -1 ), gzSize( -1 )
- {}
-
- /** Media number (0==no media access required). */
- MediaNr mediaNr;
- /** Path on the media. */
- Pathname filePath;
- /** The uncompressed files size. */
- ByteCount fileSize;
- /** The uncompressed files checksum. */
- CheckSum fileChecksum;
- /** The compressed (gz) files size. */
- ByteCount gzSize;
- /** The compressed (gz) files checksum. */
- CheckSum gzChecksum;
- };
-
///////////////////////////////////////////////////////////////////
DEFINE_PTR_TYPE(Resolvable);
ResObject()
{}
+ /** Raw data to determine \ref shareDataWith */
+ std::string sharedDataTag;
/** Share some data with another resolvable.*/
RecordId shareDataWith;
// Repository related:
/** Repository providing this resolvable. */
RecordId repository;
-
protected:
/** Overload to realize std::ostream & operator\<\<. */
virtual std::ostream & dumpOn( std::ostream & str ) const;
/** Inlined doScript. */
std::string doScript;
/** Location of doScript on the repositories media. */
- Location doScriptLocation;
+ OnMediaLocation doScriptLocation;
/** Inlined undoScript. */
std::string undoScript;
/** Location of undoScript on the repositories media. */
- Location undoScriptLocation;
+ OnMediaLocation undoScriptLocation;
};
///////////////////////////////////////////////////////////////////
/** Inlined Text. */
TranslatedText text;
- /** Location od textfile on the repositories media. */
- //Location repositoryLoaction;
};
///////////////////////////////////////////////////////////////////
Date timestamp;
/** Patch category (recommended, security,...) */
std::string category;
-
+
// Flags:
/** Does the system need to reboot to finish the update process? */
DefaultIntegral<bool,false> rebootNeeded;
virtual PackageType packageType() const = 0;
public:
- /** Location on the repositories media. */
- Location repositoryLocation;
-
/** Rpm group.*/
std::string group;
/** PackageDb keywors (tags). */
/** operating system **/
std::string operatingSystem;
-
+
/** Pre install script. */
std::string prein;
/** Post install script. */
std::string preun;
/** Post uninstall script. */
std::string postun;
+
+ OnMediaLocation repositoryLocation;
};
DEFINE_PTR_TYPE(Package);
// Shared RPM data
- Location location;
+ OnMediaLocation location;
Date buildTime;
Date fileTime;
ByteCount archiveSize; // ??
std::string sequenceInfo;
};
- DeltaBaseVersion baseVersion;
+ DeltaBaseVersion baseVersion;
};
DEFINE_PTR_TYPE(PackageAtom);
/**
* Data Object for YUM package atom.
- *
+ *
* \see zypp/parser/yum/schema/patch.rng
*/
struct PackageAtom : public Package
virtual data::RecordId consumeChangelog ( const data::RecordId & repository_id, const data::Resolvable_Ptr &, const Changelog & ) = 0;
virtual data::RecordId consumeFilelist ( const data::RecordId & repository_id, const data::Resolvable_Ptr &, const data::Filenames & ) = 0;
+
+ virtual void updatePackageLang( const data::RecordId & resolvable_id, const data::Packagebase_Ptr & data_r ) = 0;
};
} // namespace parser
// as far as resonable.
/////////////////////////////////////////////////////////////////
- CheckSum PackageImplIf::checksum() const
- { return CheckSum(); }
-
std::string PackageImplIf::buildhost() const
{ return std::string(); }
Changelog PackageImplIf::changelog() const
{ return Changelog(); }
- Pathname PackageImplIf::location() const
- { return Pathname(); }
-
std::string PackageImplIf::url() const
{ return std::string(); }
ByteCount PackageImplIf::sourcesize() const
{ return ByteCount(); }
+
+ ByteCount PackageImplIf::downloadSize() const
+ { return location().downloadSize(); }
+ OnMediaLocation PackageImplIf::location() const
+ { return OnMediaLocation(); }
+
DiskUsage PackageImplIf::diskusage() const
{ return DiskUsage(); }
#include "zypp/Changelog.h"
#include "zypp/DiskUsage.h"
#include "zypp/PackageKeyword.h"
-#include "zypp/source/PackageDelta.h"
+#include "zypp/repo/PackageDelta.h"
///////////////////////////////////////////////////////////////////
namespace zypp
/** \name Rpm Package Attributes. */
//@{
- virtual CheckSum checksum() const PURE_VIRTUAL;
- /** */
virtual std::string buildhost() const PURE_VIRTUAL;
/** */
virtual std::string distribution() const PURE_VIRTUAL;
/** */
virtual Changelog changelog() const PURE_VIRTUAL;
/** */
- virtual Pathname location() const PURE_VIRTUAL;
/** Don't ship it as class Url, because it might be
* in fact anything but a legal Url. */
virtual std::string url() const PURE_VIRTUAL;
virtual std::list<DeltaRpm> deltaRpms() const PURE_VIRTUAL;
/** */
virtual std::list<PatchRpm> patchRpms() const PURE_VIRTUAL;
+
+ virtual ByteCount downloadSize() const PURE_VIRTUAL;
+
+ virtual OnMediaLocation location() const PURE_VIRTUAL;
//@}
*
*/
#include "zypp/detail/ResObjectImplIf.h"
-#include "zypp/source/SourceImpl.h"
-#include "zypp/SourceFactory.h"
#include "zypp/Repository.h"
///////////////////////////////////////////////////////////////////
Vendor ResObjectImplIf::vendor() const
{ return Vendor(); }
- ByteCount ResObjectImplIf::size() const
- { return ByteCount(); }
-
- ByteCount ResObjectImplIf::archivesize() const
- { return ByteCount(); }
-
- Source_Ref ResObjectImplIf::source() const
- { return Source_Ref::noSource; }
-
Repository ResObjectImplIf::repository() const
{ return Repository::noRepository; }
- unsigned ResObjectImplIf::mediaNr() const
- { return 0; }
-
- unsigned ResObjectImplIf::sourceMediaNr() const
- { return 0; }
-
bool ResObjectImplIf::installOnly() const
{ return false; }
Date ResObjectImplIf::installtime() const
{ return Date(); }
-
- ZmdId ResObjectImplIf::zmdid() const
+
+ unsigned ResObjectImplIf::mediaNr() const
{ return 0; }
+
+ ByteCount ResObjectImplIf::size() const
+ { return ByteCount(); }
+ ByteCount ResObjectImplIf::downloadSize() const
+ { return ByteCount(); }
+
/////////////////////////////////////////////////////////////////
} // namespace detail
///////////////////////////////////////////////////////////////////
#include "zypp/base/Deprecated.h"
#include "zypp/detail/ResImplTraits.h"
#include "zypp/detail/ResObjectFactory.h"
-
+#include "zypp/Repository.h"
#include "zypp/Locale.h"
#include "zypp/ByteCount.h"
#include "zypp/Date.h"
{ /////////////////////////////////////////////////////////////////
class Resolvable;
- class Source_Ref;
class Repository;
///////////////////////////////////////////////////////////////////
virtual ByteCount size() const PURE_VIRTUAL;
/** */
- virtual ByteCount archivesize() const PURE_VIRTUAL;
+ virtual ByteCount downloadSize() const PURE_VIRTUAL;
/** Backlink to the source providing this. */
virtual Repository repository() const PURE_VIRTUAL;
*/
virtual unsigned mediaNr() const PURE_VIRTUAL;
- /** Backlink to the source providing this. */
- virtual Source_Ref source() const PURE_VIRTUAL;
-
- /** Number of the source media that provides the data
- * required for installation. Zero, if no media access
- * is required.
- */
- virtual unsigned sourceMediaNr() const PURE_VIRTUAL;
-
/** */
virtual bool installOnly() const PURE_VIRTUAL;
/** Time of installation, or \c 0 */
virtual Date installtime() const;
-
- /** Id used inside ZMD */
- ZYPP_DEPRECATED virtual ZmdId zmdid() const PURE_VIRTUAL;
+
//@}
public:
// as far as resonable.
/////////////////////////////////////////////////////////////////
- ByteCount SrcPackageImplIf::archivesize() const
- { return ByteCount(); }
+ OnMediaLocation SrcPackageImplIf::location() const
+ { return OnMediaLocation(); }
+
+ ByteCount SrcPackageImplIf::downloadSize() const
+ { return location().downloadSize(); }
DiskUsage SrcPackageImplIf::diskusage() const
{ return DiskUsage(); }
- Pathname SrcPackageImplIf::location() const
- { return Pathname(); }
-
/////////////////////////////////////////////////////////////////
} // namespace detail
///////////////////////////////////////////////////////////////////
typedef SrcPackage ResType;
public:
+ virtual OnMediaLocation location() const PURE_VIRTUAL;
/** */
- virtual ByteCount archivesize() const PURE_VIRTUAL;
+ virtual ByteCount downloadSize() const PURE_VIRTUAL;
/** */
virtual DiskUsage diskusage() const PURE_VIRTUAL;
- /** */
- virtual Pathname location() const PURE_VIRTUAL;
+
};
///////////////////////////////////////////////////////////////////
void IniParser::parse( const InputStream & input_r, const ProgressData::ReceiverFnc & progress )
{
boost::regex rxSection("^\\[(.+)\\]$");
- boost::regex rxKeyValue("^(.+)[[:space:]]*=[[:space:]]*(.+)$");
+ boost::regex rxKeyValue("^(.*[^[:space:]])[ [:space:]]*=[[:space:]]*(.+)$");
MIL << "Start parsing " << input_r << endl;
_inputname = input_r.name();
info.setEnabled( it->second == "1" );
else if ( it->first == "baseurl" )
info.addBaseUrl( Url(it->second) );
+ else if ( it->first == "path" )
+ info.setPath( Pathname(it->second) );
else if ( it->first == "type" )
info.setType(repo::RepoType(it->second));
+ else if ( it->first == "autorefresh" )
+ info.setAutorefresh( it->second == "1" );
+ else if ( it->first == "mirrorlist" )
+ info.setMirrorListUrl(Url(it->second));
+ else if ( it->first == "gpgkey" )
+ info.setGpgKeyUrl( Url(it->second) );
+ else if ( it->first == "gpgcheck" )
+ info.setGpgCheck( it->second == "1" );
+ else
+ ERR << "Unknown attribute " << it->second << " ignored" << endl;
}
MIL << "Linking repo info with file " << file << endl;
info.setFilepath(file);
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <streambuf>
-
-#include <zypp/parser/SAXParser.h>
-#include <zypp/base/Logger.h>
-
-namespace zypp
-{
-namespace parser
-{
-
-static xmlSAXHandler emptySAXHandlerStruct = {
- NULL, /* internalSubset */
- NULL, /* isStandalone */
- NULL, /* hasInternalSubset */
- NULL, /* hasExternalSubset */
- NULL, /* resolveEntity */
- NULL, /* getEntity */
- NULL, /* entityDecl */
- NULL, /* notationDecl */
- NULL, /* attributeDecl */
- NULL, /* elementDecl */
- NULL, /* unparsedEntityDecl */
- NULL, /* setDocumentLocator */
- NULL, /* startDocument */
- NULL, /* endDocument */
- NULL, /* startElement */
- NULL, /* endElement */
- NULL, /* reference */
- NULL, /* characters */
- NULL, /* ignorableWhitespace */
- NULL, /* processingInstruction */
- NULL, /* comment */
- NULL, /* xmlParserWarning */
- NULL, /* xmlParserError */
- NULL, /* xmlParserError */
- NULL, /* getParameterEntity */
- NULL, /* cdataBlock; */
- NULL, /* externalSubset; */
- 1
-};
-
-static xmlSAXHandlerPtr emptySAXHandler = &emptySAXHandlerStruct;
-extern xmlSAXHandlerPtr debugSAXHandler;
-
-/**
- * startElementDebug:
- * @ctxt: An XML parser context
- * @name: The element name
- *
- * called when an opening tag has been processed.
- */
-static void
-startElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar **atts)
-{
- int i;
-
- fprintf(stdout, "SAX.startElement(%s", (char *) name);
- if (atts != NULL) {
- for (i = 0;(atts[i] != NULL);i++) {
- fprintf(stdout, ", %s='", atts[i++]);
- if (atts[i] != NULL)
- fprintf(stdout, "%s'", atts[i]);
- }
- }
- fprintf(stdout, ")\n");
-}
-
-static xmlEntityPtr
-my_getEntity(void *user_data, const xmlChar *name)
-{
- return xmlGetPredefinedEntity(name);
-}
-
-static void
-endElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name)
-{
- fprintf(stdout, "SAX.endElement(%s)\n", (char *) name);
-}
-
-void
-SAXParser::startElement_receiver(void *ctx, const xmlChar *name, const xmlChar **atts)
-{
- SAXParser *rcv = (SAXParser *)(ctx);
- if ( rcv )
- rcv->startElement(std::string( (const char*) name), atts);
-}
-
-void
-SAXParser::characters_receiver (void *ctx, const xmlChar *ch, int len)
-{
- SAXParser *rcv = (SAXParser *)(ctx);
- if ( rcv )
- rcv->characters( ch, len);
-}
-
-void
-SAXParser::endElement_receiver(void *ctx, const xmlChar *name)
-{
- SAXParser *rcv = (SAXParser *)(ctx);
- if ( rcv )
- rcv->endElement(std::string( (const char*) name));
-}
-
-static xmlEntityPtr getEntity_receiver(void *user_data, const xmlChar *name)
-{
- return xmlGetPredefinedEntity(name);
-}
-
-
-void SAXParser::startElement(const std::string name, const xmlChar **atts)
-{
- MIL << "start-element:" << name << std::endl;
-}
-
-void SAXParser::endElement(const std::string name)
-{
- MIL << "end-element:" << name << std::endl;
-}
-
-void SAXParser::characters(const xmlChar *ch, int len)
-{
- MIL << "characters:" << std::string( (const char *)ch, len) << std::endl;
-}
-
-void SAXParser::parseFile( const Pathname &p)
-{
- FILE *f = fopen(p.asString().c_str(), "r");
- if (f != NULL)
- {
- int res = xmlSAXUserParseFile(&_saxHandler, (void *) this, p.asString().c_str());
- if (res != 0)
- {
- fprintf(stdout, "xmlSAXUserParseFile returned error %d\n", res);
- }
- fclose(f);
- }
- else
- {
- fprintf(stdout, "UPS\n");
- }
-}
-
-SAXParser::SAXParser()
-{
- _saxHandler.internalSubset = NULL;
- _saxHandler.isStandalone = NULL;
- _saxHandler.hasInternalSubset = NULL;
- _saxHandler.hasExternalSubset = NULL;
- _saxHandler.resolveEntity = NULL;
- _saxHandler.getEntity = NULL;
- _saxHandler.entityDecl = NULL;
- _saxHandler.notationDecl = NULL;
- _saxHandler.attributeDecl = NULL;
- _saxHandler.elementDecl = NULL;
- _saxHandler.unparsedEntityDecl = NULL;
- _saxHandler.setDocumentLocator = NULL;
- _saxHandler.startDocument = NULL;
- _saxHandler.endDocument = NULL;
- _saxHandler.startElement = NULL;
- _saxHandler.endElement = NULL;
- _saxHandler.reference = NULL;
- _saxHandler.characters = NULL;
- _saxHandler.ignorableWhitespace = NULL;
- _saxHandler.processingInstruction = NULL;
- _saxHandler.comment = NULL;
-
- //_saxHandler.xmlParserWarning = NULL;
- //_saxHandler.xmlParserError = NULL;
- //_saxHandler.xmlParserError = NULL;
-
- _saxHandler.getParameterEntity = NULL;
- _saxHandler.cdataBlock = NULL;
- _saxHandler.externalSubset = NULL;
-
- _saxHandler = emptySAXHandlerStruct;
- //_saxHandler.startDocument = startElement_receiver;
- _saxHandler.startElement = startElement_receiver;
- _saxHandler.endElement = endElement_receiver;
- _saxHandler.getEntity = getEntity_receiver;
- _saxHandler.characters = characters_receiver;
-}
-
-SAXParser::~SAXParser()
-{
-}
-
-} // ns parser
-} // ns zypp
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-
-#ifndef ZYPP_SAXParser_H
-#define ZYPP_SAXParser_H
-
-#include <iosfwd>
-#include <string>
-#include <vector>
-#include <libxml/parser.h>
-
-#include <boost/function.hpp>
-
-#include "zypp/Pathname.h"
-
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-namespace parser
-{ /////////////////////////////////////////////////////////////////
-
- class SAXParser
- {
- public:
-
- SAXParser();
- virtual ~SAXParser();
-
- void parseFile( const Pathname &p);
-
- virtual void startElement(const std::string name, const xmlChar **atts);
- virtual void endElement(const std::string name);
- virtual void characters(const xmlChar *ch, int len);
-
- static void startElement_receiver(void *ctx, const xmlChar *name, const xmlChar **atts);
- static void endElement_receiver(void *ctx, const xmlChar *name);
- static void characters_receiver (void *data, const xmlChar *ch, int len);
- private:
- xmlSAXHandler _saxHandler;
-
- };
-
-} // namespace parser
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_SAXParser_H
void TagParser::parse( const InputStream & input_r, const ProgressData::ReceiverFnc & fnc_r )
{
MIL << "Start parsing " << input_r << endl;
+ if ( ! input_r.stream() )
+ {
+ std::ostringstream s;
+ s << "Can't read bad stream: " << input_r;
+ ZYPP_THROW( ParseException( s.str() ) );
+ }
_inputname = input_r.name();
beginParse();
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+
+#include <iostream>
+#include "zypp/base/Logger.h"
+#include "zypp/base/Iterator.h"
+#include "zypp/base/String.h"
+
+#include <zypp/target/rpm/RpmHeader.h>
+#include <zypp/target/rpm/RpmDb.h>
+
+#include "zypp/parser/plaindir/RepoParser.h"
+#include "zypp/parser/ParseException.h"
+#include "zypp/capability/CapabilityImpl.h"
+#include "zypp/PathInfo.h"
+#include "zypp/ResStore.h"
+#include "zypp/ZConfig.h"
+
+using namespace std;
+using namespace zypp::target::rpm;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+namespace parser
+{ /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+namespace plaindir
+{ /////////////////////////////////////////////////////////////////
+
+static time_t recursive_timestamp( const Pathname &dir )
+{
+ time_t max = PathInfo(dir).mtime();
+ std::list<std::string> dircontent;
+ if (filesystem::readdir( dircontent, dir, false) != 0)
+ { // dont look for dot files
+ ERR << "readdir " << dir << " failed" << endl;
+ return 0;
+ }
+
+ for (std::list<std::string>::const_iterator it = dircontent.begin();
+ it != dircontent.end();
+ ++it)
+ {
+ Pathname dir_path = dir + *it;
+ if ( PathInfo(dir_path).isDir())
+ {
+ time_t val = recursive_timestamp(dir_path);
+ if ( val > max )
+ max = val;
+ }
+ }
+ return max;
+}
+
+RepoStatus dirStatus( const Pathname &dir )
+{
+ RepoStatus status;
+ time_t t = recursive_timestamp(dir);
+ status.setTimestamp(Date(t));
+ status.setChecksum(str::numstring(t));
+ return status;
+}
+
+data::Package_Ptr makePackageDataFromHeader( const RpmHeader::constPtr header,
+ set<string> * filerequires,
+ const Pathname & location, data::RecordId &repoid )
+{
+ if ( ! header )
+ return 0;
+
+ if ( header->isSrc() ) {
+ WAR << "Can't make Package from SourcePackage header" << endl;
+ return 0;
+ }
+
+ data::Package_Ptr pkg = new data::Package;
+
+// typedef std::set<capability::CapabilityImpl::Ptr> DependencyList;
+// typedef std::map<zypp::Dep, DependencyList> Dependencies;
+ pkg->name = header->tag_name();
+// impl->setRepository( repo );
+// if (!location.empty())
+// impl->setLocation( location );
+
+ try {
+ pkg->edition = Edition( header->tag_version(),
+ header->tag_release(),
+ header->tag_epoch());
+ }
+ catch (Exception & excpt_r) {
+ ZYPP_CAUGHT( excpt_r );
+ WAR << "Package " << pkg->name << " has bad edition '"
+ << (header->tag_epoch().empty()?"":(header->tag_epoch()+":"))
+ << header->tag_version()
+ << (header->tag_release().empty()?"":(string("-") + header->tag_release())) << "'";
+ return 0;
+ }
+
+ Arch arch;
+ try {
+ pkg->arch = Arch( header->tag_arch() );
+ }
+ catch (Exception & excpt_r) {
+ ZYPP_CAUGHT( excpt_r );
+ WAR << "Package " << pkg->name << " has bad architecture '" << header->tag_arch() << "'";
+ return 0;
+ }
+
+ pkg->deps[Dep::REQUIRES] = header->tag_requires( filerequires );
+ pkg->deps[Dep::PREREQUIRES] = header->tag_prerequires( filerequires );
+ pkg->deps[Dep::CONFLICTS] = header->tag_conflicts( filerequires );
+ pkg->deps[Dep::OBSOLETES] = header->tag_obsoletes( filerequires );
+ pkg->deps[Dep::ENHANCES] = header->tag_enhances( filerequires );
+ pkg->deps[Dep::SUPPLEMENTS] = header->tag_supplements( filerequires );
+
+// Dependencies deps;
+
+// RecordId shareDataWith;
+// std::string vendor;
+// ByteCount installedSize;
+// Date buildTime;
+// DefaultIntegral<bool,false> installOnly;
+// TranslatedText summary;
+// TranslatedText description;
+// TranslatedText licenseToConfirm;
+// TranslatedText insnotify;
+// TranslatedText delnotify;
+// RecordId repository;
+
+// Location repositoryLocation;
+// std::string group;
+// std::set<std::string> keywords;
+// Changelog changelog;
+// std::list<std::string> authors;
+// std::string buildhost;
+// std::string distribution;
+// std::string license;
+// std::string packager;
+// std::string url;
+// std::string operatingSystem;
+// std::string prein;
+// std::string postin;
+// std::string preun;
+// std::string postun;
+//
+
+ list<string> filenames = header->tag_filenames();
+ pkg->deps[Dep::PROVIDES] = header->tag_provides ( filerequires );
+ static str::smatch what;
+ static const str::regex filenameRegex( "/(s?bin|lib(64)?|etc)/|^/usr/(games/|share/(dict/words|magic\\.mime)$)|^/opt/gnome/games/",
+ str::regex::optimize|str::regex::nosubs );
+
+ for (list<string>::const_iterator filename = filenames.begin();
+ filename != filenames.end();
+ ++filename)
+ {
+ if ( str::regex_search( filename->begin(), filename->end(), what, filenameRegex ) )
+ {
+ try {
+ pkg->deps[Dep::PROVIDES].insert(capability::buildFile( ResTraits<Package>::kind, *filename ));
+ }
+ catch (Exception & excpt_r)
+ {
+ ZYPP_CAUGHT( excpt_r );
+ WAR << "Ignoring invalid capability: " << *filename << endl;
+ }
+ }
+ }
+
+ return pkg;
+}
+
+
+/** RepoParser implementation.
+ * \todo Clean data on exeption.
+ */
+class RepoParser::Impl
+{
+ public:
+ Impl( const data::RecordId & repositoryId_r,
+ data::ResolvableDataConsumer & consumer_r,
+ const ProgressData::ReceiverFnc & fnc_r )
+ : _repositoryId( repositoryId_r )
+ , _consumer( consumer_r )
+ {
+ _ticks.sendTo( fnc_r );
+ }
+ int extract_packages_from_directory( const Pathname & path,
+ bool recursive);
+ /** Main entry to parser. */
+ void parse( const Pathname & reporoot_r );
+ public:
+
+ private:
+ data::RecordId _repositoryId;
+ data::ResolvableDataConsumer & _consumer;
+ ProgressData _ticks;
+
+ private: // these (and _ticks) are actually scoped per parse() run.
+};
+///////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////
+//
+// METHOD NAME : RepoParser::Impl::parse
+// METHOD TYPE : void
+//
+void RepoParser::Impl::parse( const Pathname & reporoot_r )
+{
+ extract_packages_from_directory( reporoot_r, true );
+/*if ( ! _ticks.incr() )
+ ZYPP_THROW( AbortRequestException() );*/
+ // Done
+ if ( ! _ticks.toMax() )
+ ZYPP_THROW( AbortRequestException() );
+}
+
+int RepoParser::Impl::extract_packages_from_directory( const Pathname & path,
+ bool recursive)
+{
+ using target::rpm::RpmHeader;
+ Pathname filename;
+ PathInfo magic;
+ bool distro_magic, pkginfo_magic;
+
+// DBG << "extract_packages_from_directory(.., " << path << ", " << repo.info().alias() << ", " << recursive << ")" << endl;
+
+ /*
+ Check for magic files that indicate how to treat the
+ directory. The files aren't read -- it is sufficient that
+ they exist.
+ */
+
+ magic = PathInfo( path + "/RC_SKIP" );
+ if (magic.isExist()) {
+ return 0;
+ }
+
+ magic = PathInfo( path + "/RC_RECURSIVE" );
+ if (magic.isExist())
+ recursive = true;
+
+ magic = PathInfo( path + "/RC_BY_DISTRO" );
+ distro_magic = magic.isExist();
+
+ pkginfo_magic = true;
+ magic = PathInfo( path + "/RC_IGNORE_PKGINFO" );
+ if (magic.isExist())
+ pkginfo_magic = false;
+
+
+ std::list<std::string> dircontent;
+ if (filesystem::readdir( dircontent, path, false) != 0) { // dont look for dot files
+ ERR << "readdir " << path << " failed" << endl;
+ return -1;
+ }
+
+ for (std::list<std::string>::const_iterator it = dircontent.begin(); it != dircontent.end(); ++it) {
+ Pathname file_path = path + *it;
+ PathInfo file_info( file_path );
+ if (recursive && file_info.isDir()) {
+
+ extract_packages_from_directory( file_path, recursive );
+
+ } else if (file_info.isFile() && file_path.extension() == ".rpm" ) {
+ RpmHeader::constPtr header = RpmHeader::readPackage( file_path, RpmHeader::NOSIGNATURE );
+#warning FIX creation of Package from src.rpm header
+ data::Package_Ptr package = makePackageDataFromHeader( header, NULL, *it, _repositoryId );
+ if (package != NULL) {
+ DBG << "Adding package " << *package << endl;
+ _consumer.consumePackage( _repositoryId, package );
+ }
+ }
+ }
+ return 0;
+}
+///////////////////////////////////////////////////////////////////
+//
+// CLASS NAME : RepoParser
+//
+///////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////
+//
+// METHOD NAME : RepoParser::RepoParser
+// METHOD TYPE : Ctor
+//
+RepoParser::RepoParser( const data::RecordId & repositoryId_r,
+ data::ResolvableDataConsumer & consumer_r,
+ const ProgressData::ReceiverFnc & fnc_r )
+: _pimpl( new Impl( repositoryId_r, consumer_r, fnc_r ) )
+{}
+
+///////////////////////////////////////////////////////////////////
+//
+// METHOD NAME : RepoParser::~RepoParser
+// METHOD TYPE : Dtor
+//
+RepoParser::~RepoParser()
+{}
+
+///////////////////////////////////////////////////////////////////
+//
+// METHOD NAME : RepoParser::parse
+// METHOD TYPE : void
+//
+void RepoParser::parse( const Pathname & reporoot_r )
+{
+ _pimpl->parse( reporoot_r );
+}
+
+/////////////////////////////////////////////////////////////////
+} // namespace plaindir
+///////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////
+} // namespace parser
+///////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/** \file zypp/source/plaindir/PlaindirImpl.h
- *
-*/
-#ifndef ZYPP_SOURCE_PLAINDIR_PLAINDIRIMPL_H
-#define ZYPP_SOURCE_PLAINDIR_PLAINDIRIMPL_H
+
+#ifndef ZYPP_PARSER_PLAINDIR_REPOPARSER_H
+#define ZYPP_PARSER_PLAINDIR_REPOPARSER_H
#include <iosfwd>
-#include <zypp/target/rpm/RpmHeader.h>
-#include <zypp/target/rpm/RpmDb.h>
+#include "zypp/base/PtrTypes.h"
+#include "zypp/base/NonCopyable.h"
+
+#include "zypp/data/RecordId.h"
+#include "zypp/data/ResolvableDataConsumer.h"
-#include "zypp/source/SourceImpl.h"
+#include "zypp/ProgressData.h"
+#include "zypp/RepoStatus.h"
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
- namespace source
+ namespace parser
{ /////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
namespace plaindir
{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : PlaindirImpl
- //
- /** */
- class PlaindirImpl : public SourceImpl
+ /**
+ * \short Gives a cookie for a dir
+ */
+ RepoStatus dirStatus( const Pathname &dir );
+
+ /** Plaindir metadata parser. */
+
+ class RepoParser : private base::NonCopyable
{
public:
- typedef intrusive_ptr<PlaindirImpl> Ptr;
- typedef intrusive_ptr<const PlaindirImpl> constPtr;
-
- public:
- /** Default ctor */
- PlaindirImpl();
+ /** Ctor.
+ *
+ * \param repositoryId_r repository identifier
+ * \param consumer_r consumer of parsed data
+ * \param fnc_r progress reporting function
+ */
+ RepoParser( const data::RecordId & repositoryId_r,
+ data::ResolvableDataConsumer & consumer_r,
+ const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() );
/** Dtor */
- ~PlaindirImpl();
+ ~RepoParser();
- public:
- /** String identifying the type of the source. */
- static std::string typeString()
- { return "Plaindir"; }
-
- /** 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(Source_Ref source_r);
-
- int extract_packages_from_directory (ResStore & store, const Pathname & path, Source_Ref source, bool recursive);
+ /** Parse a local repository located at \a reporoot_r.
+ *
+ * \param reporoot_r The local repositories root directory.
+ * \throw Exception on errors.
+ */
+ void parse( const Pathname & reporoot_r );
+ public:
+ class Impl;
+ private:
+ RW_pointer<Impl,rw_pointer::Scoped<Impl> > _pimpl;
};
///////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
} // namespace plaindir
///////////////////////////////////////////////////////////////////
-
- using plaindir::PlaindirImpl;
-
/////////////////////////////////////////////////////////////////
- } // namespace source
+ } // namespace parser
///////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_PLAINDIR_PLAINDIRIMPL_H
+#endif // ZYPP2_PARSER_SUSETAGS_REPOPARSER_H
#include "zypp/ZConfig.h"
using std::endl;
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "parser::susetags"
///////////////////////////////////////////////////////////////////
namespace zypp
const ProgressData::ReceiverFnc & fnc_r )
{
MIL << "Start parsing " << input_r << endl;
+ if ( ! input_r.stream() )
+ {
+ std::ostringstream s;
+ s << "Can't read bad stream: " << input_r;
+ ZYPP_THROW( ParseException( s.str() ) );
+ }
beginParse();
_pimpl->_inputname = input_r.name();
#include "zypp/parser/susetags/FileReaderBase.h"
#include "zypp/parser/ParseException.h"
#include "zypp/data/ResolvableData.h"
+#include "zypp/PathInfo.h"
using std::endl;
namespace susetags
{ /////////////////////////////////////////////////////////////////
+ inline std::string makeSharedIdent( ResolvableTraits::KindType kind_r,
+ const std::string & name_r,
+ const Edition & edition_r,
+ const Arch & arch_r )
+ {
+ std::string ret( kind_r.asString() );
+ ret += ":";
+ ret += name_r;
+ ret += "-";
+ ret += edition_r.asString();
+ ret += ".";
+ ret += arch_r.asString();
+ return ret;
+ }
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : FileReaderBase::BaseImpl
{}
public:
-
+ /** Parsing Capabilities from string is quite expensive. So we
+ * maintain a little chache to check whether we already parsed some
+ * raw string. If so, we can reuse the result.
+ */
struct CapImplCache
{
template<class _Res>
#include "zypp/parser/susetags/FileReaderBaseImpl.h"
using std::endl;
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "parser::susetags"
///////////////////////////////////////////////////////////////////
namespace zypp
{
ZYPP_THROW( error( tag_r, "Expected [type checksum]") );
}
- _data->repositoryLocation.fileChecksum = CheckSum( words[0], words[1] );
+ _data->repositoryLocation.setChecksum(CheckSum( words[0], words[1] ));
}
/** Consume =Grp:. */
switch ( str::split( tag_r->value, std::back_inserter(words) ) )
{
case 2: // [medianr filename]
- str::strtonum( words[0], _data->repositoryLocation.mediaNr.get() );
- _data->repositoryLocation.filePath = _data->arch.asString();
- _data->repositoryLocation.filePath /= words[1];
+ _data->repositoryLocation.setMedianr( str::strtonum<unsigned>(words[0]) );
+ _data->repositoryLocation.setFilename( Pathname(_data->arch.asString()) / words[1] );
break;
case 3: // [medianr filename dir]
- str::strtonum( words[0], _data->repositoryLocation.mediaNr.get() );
- _data->repositoryLocation.filePath = words[2];
- _data->repositoryLocation.filePath /= words[1];
- break;
+ _data->repositoryLocation.setMedianr( str::strtonum<unsigned>(words[0]) );
+ _data->repositoryLocation.setFilename( Pathname(words[2]) / words[1] );
+ break;
default:
ZYPP_THROW( error( tag_r, "Expected [medianr filename dir]") );
{
ZYPP_THROW( error( tag_r, "Expected [archivesize size]") );
}
- _data->repositoryLocation.fileSize = str::strtonum<ByteCount::SizeType>( words[0] );
+ _data->repositoryLocation.setDownloadSize(str::strtonum<ByteCount::SizeType>( words[0] ));
_data->installedSize = str::strtonum<ByteCount::SizeType>( words[1] );
}
- /** Consume =Shr:. */
+ /** Consume =Shr:.
+ * Raw data to identify the object is the string
+ * <tt>kind:name-version-realease.arch</tt>.
+ */
void consumeShr( const SingleTagPtr & tag_r )
{
-#warning TBD
+ std::vector<std::string> words;
+ if ( str::split( tag_r->value, std::back_inserter(words) ) != 4 )
+ {
+ ZYPP_THROW( error( tag_r, "Expected [name version release arch]") );
+ }
+
+ if ( words[3] == "src" || words[3] == "nosrc")
+ {
+ _data->sharedDataTag = makeSharedIdent( ResTraits<SrcPackage>::kind,
+ words[0],
+ Edition( words[1], words[2] ),
+ Arch() );
+ }
+ else
+ {
+ _data->sharedDataTag = makeSharedIdent( ResTraits<Package>::kind,
+ words[0],
+ Edition( words[1], words[2] ),
+ Arch( words[3] ) );
+ }
}
public: // multi tags
*
*/
#include <iostream>
+#include "zypp/base/Easy.h"
#include "zypp/base/Logger.h"
-
+#include "zypp/base/LogTools.h"
#include "zypp/parser/susetags/PackagesLangFileReader.h"
#include "zypp/parser/susetags/FileReaderBaseImpl.h"
using std::endl;
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "parser::susetags"
///////////////////////////////////////////////////////////////////
namespace zypp
#include "zypp/parser/susetags/FileReaderBaseImpl.h"
using std::endl;
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "parser::susetags"
///////////////////////////////////////////////////////////////////
namespace zypp
#include "zypp/parser/susetags/RepoIndex.h"
using std::endl;
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "parser::susetags"
///////////////////////////////////////////////////////////////////
namespace zypp
*
*/
#include <iostream>
+#include "zypp/base/Easy.h"
#include "zypp/base/Logger.h"
+#include "zypp/base/LogTools.h"
#include "zypp/base/Iterator.h"
#include "zypp/base/String.h"
+#include "zypp/base/Gettext.h"
+#include "zypp/parser/susetags/FileReaderBaseImpl.h"
#include "zypp/parser/susetags/RepoParser.h"
#include "zypp/parser/susetags/ContentFileReader.h"
#include "zypp/parser/susetags/PackagesFileReader.h"
#include "zypp/ZConfig.h"
using std::endl;
+#undef ZYPP_BASE_LOGGER_LOGGROUP
+#define ZYPP_BASE_LOGGER_LOGGROUP "parser::susetags"
///////////////////////////////////////////////////////////////////
namespace zypp
/** \name FileReader callbacks delivering data. */
//@{
+ ///////////////////////////////////////////////////////////////////
void consumeIndex( const RepoIndex_Ptr & data_r )
{
- SEC << "[Index]" << data_r << endl;
+ //SEC << "[Index]" << data_r << endl;
_repoIndex = data_r;
}
+ ///////////////////////////////////////////////////////////////////
void consumeProd( const data::Product_Ptr & data_r )
{
- SEC << "[Prod]" << data_r << endl;
+ MIL << "[Product] " << data_r << endl;
+ ++_stats.prod;
_prodData = data_r;
+ _defaultVendor = data_r->vendor;
_consumer.consumeProduct( _repositoryId, data_r );
}
+ ///////////////////////////////////////////////////////////////////
void consumePkg( const data::Package_Ptr & data_r )
{
- SEC << "[Package]" << data_r << endl;
- _consumer.consumePackage( _repositoryId, data_r );
+ fixVendor( data_r );
+ fixLocationPath( data_r );
+ resolveSharedDataTag( data_r );
+
+ ++_stats.pack;
+ data::RecordId newid = _consumer.consumePackage( _repositoryId, data_r );
+
+ // remember for later reference
+ idMapAdd( makeSharedIdent( ResTraits<Package>::kind,
+ data_r->name,
+ data_r->edition,
+ data_r->arch ),
+ newid );
}
+ ///////////////////////////////////////////////////////////////////
void consumeSrcPkg( const data::SrcPackage_Ptr & data_r )
{
- SEC << "[SrcPackage]" << data_r << endl;
- _consumer.consumeSourcePackage( _repositoryId, data_r );
+ fixVendor( data_r );
+ fixLocationPath( data_r );
+ resolveSharedDataTag( data_r );
+
+ ++_stats.srcp;
+ data::RecordId newid = _consumer.consumeSourcePackage( _repositoryId, data_r );
+
+ // remember for later reference
+ idMapAdd( makeSharedIdent( ResTraits<SrcPackage>::kind,
+ data_r->name,
+ data_r->edition,
+ data_r->arch ),
+ newid );
}
+ ///////////////////////////////////////////////////////////////////
+ void consumePkgLang( const data::Package_Ptr & data_r )
+ {
+ data::RecordId id = idMapGet( makeSharedIdent( ResTraits<Package>::kind,
+ data_r->name,
+ data_r->edition,
+ data_r->arch ) );
+ if ( id != data::noRecordId )
+ {
+ _consumer.updatePackageLang( id, data_r );
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ void consumeSrcPkgLang( const data::SrcPackage_Ptr & data_r )
+ {
+ data::RecordId id = idMapGet( makeSharedIdent( ResTraits<SrcPackage>::kind,
+ data_r->name,
+ data_r->edition,
+ data_r->arch ) );
+ if ( id != data::noRecordId )
+ {
+ _consumer.updatePackageLang( id, data_r );
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////
void consumePat( const data::Pattern_Ptr & data_r )
{
- SEC << "[Pattern]" << data_r << endl;
+ //SEC << "[Pattern]" << data_r << endl;
+ fixVendor( data_r );
+ ++_stats.patt;
_consumer.consumePattern( _repositoryId, data_r );
}
//@}
- public:
+ public:
+ /** Use products vendor if vendor was not specified. */
+ void fixVendor( const data::ResObject_Ptr & data_r )
+ {
+ if ( data_r->vendor.empty() && ! _defaultVendor.empty() )
+ {
+ data_r->vendor = _defaultVendor;
+ }
+ }
+
+ /** Prepend location with 'datadir'. */
+ void fixLocationPath( const data::Packagebase_Ptr & data_r )
+ {
+ Pathname tofix( data_r->repositoryLocation.filename() );
+ data_r->repositoryLocation.setFilename( _datadir / tofix );
+ }
+
+ /** Resolve shared data tag. */
+ void resolveSharedDataTag( const data::Packagebase_Ptr & data_r )
+ {
+ if ( ! data_r->sharedDataTag.empty() )
+ {
+ data_r->shareDataWith = idMapGet( data_r->sharedDataTag );
+ }
+ }
- bool isPatternFile( const std::string & name_r ) const
+ public:
+ /** Throw \ref ParseException if a required file is not
+ * available below \ref _reporoot on disk.
+ */
+ Pathname assertMandatoryFile( const Pathname & file_r ) const
+ {
+ PathInfo inputfile( _reporoot / file_r );
+ if ( ! inputfile.isFile() )
+ {
+ ZYPP_THROW( ParseException( _reporoot.asString() + ": " + _("Required file is missing: ") + file_r.asString() ) );
+ }
+ return inputfile.path();
+ }
+
+ /** Print a warning if an optional file is not
+ * available below \ref _reporoot on disk.
+ */
+ Pathname getOptionalFile( const Pathname & file_r ) const
+ {
+ PathInfo inputfile( _reporoot / file_r );
+ if ( ! inputfile.isFile() )
+ {
+ WAR << _reporoot << ": Skip optional file: " << file_r.asString() << endl;
+ return Pathname();
+ }
+ return inputfile.path();
+ }
+
+ bool isPatternFile( const std::string & name_r ) const
{
return( name_r.size() > 4 && name_r.substr( name_r.size() - 4 ) == ".pat" );
}
it != _repoIndex->metaFileChecksums.end(); ++it )
{
if ( it->first == searchFor )
- return true; // got it
+ {
+ // got it
+ PathInfo inputfile( _reporoot / _descrdir / searchFor );
+ if ( ! inputfile.isFile() )
+ {
+ WAR << "Known and desired file is not on disk: " << inputfile << endl;
+ }
+ else
+ return true; // got it
+ }
}
return false; // not found
}
{
return; // now return...
}
-
// ...or parse
_parsedLocales.insert( toParse ); // don't try again.
- PackagesLangFileReader reader;
- reader.setLocale( toParse );
- reader.setPkgConsumer( bind( &Impl::consumePkg, this, _1 ) );
- reader.setSrcPkgConsumer( bind( &Impl::consumeSrcPkg, this, _1 ) );
- reader.parse( _descrdir / ("packages." + toParse.code()) );
+ Pathname inputfile( getOptionalFile( _descrdir / ("packages." + toParse.code()) ) );
+ if ( ! inputfile.empty() )
+ {
+ PackagesLangFileReader reader;
+ reader.setLocale( toParse );
+ reader.setPkgConsumer( bind( &Impl::consumePkgLang, this, _1 ) );
+ reader.setSrcPkgConsumer( bind( &Impl::consumeSrcPkgLang, this, _1 ) );
+ reader.parse( inputfile );
+ }
- if ( ! _ticks.incr() )
- ZYPP_THROW( AbortRequestException() );
+ if ( ! _ticks.incr( PathInfo(inputfile).size() ) )
+ ZYPP_THROW( AbortRequestException() );
+ }
+
+ private:
+ void idMapAdd( const std::string & key_r, data::RecordId value_r )
+ {
+ if ( _idMap[key_r] != data::noRecordId )
+ {
+ WAR << "Multiple record ids for " << key_r
+ << " (first " << _idMap[key_r] << ", now " << value_r << ")" << endl;
+ }
+ _idMap[key_r] = value_r;
+ }
+
+ data::RecordId idMapGet( const std::string & key_r )
+ {
+ data::RecordId ret = _idMap[key_r];
+ if ( ret == data::noRecordId )
+ {
+ WAR << "No record id for " << key_r << endl;
+ }
+ return ret;
}
private:
private: // these (and _ticks) are actually scoped per parse() run.
RepoIndex_Ptr _repoIndex;
data::Product_Ptr _prodData;
- Pathname _descrdir; // full path
- Pathname _datadir; // full path
+ std::string _defaultVendor;
+ Pathname _reporoot; // full path
+ Pathname _descrdir; // path below reporoot
+ Pathname _datadir; // path below reporoot
/** Translations processed by \ref parseLocaleIf so far.*/
std::set<Locale> _parsedLocales;
+
+ /** Remember the record ids of created packages and soucepackages. */
+ std::map<std::string,data::RecordId> _idMap;
+
+ struct Stats {
+ DefaultIntegral<unsigned,0> prod;
+ DefaultIntegral<unsigned,0> patt;
+ DefaultIntegral<unsigned,0> pack;
+ DefaultIntegral<unsigned,0> srcp;
+ };
+ Stats _stats;
};
///////////////////////////////////////////////////////////////////
{
_prodData = 0;
_repoIndex = 0;
+ _defaultVendor.clear();
+ _reporoot = reporoot_r;
_descrdir = _datadir = Pathname();
_parsedLocales.clear();
// Content file first to get the repoindex
{
+ Pathname inputfile( assertMandatoryFile( "content" ) );
ContentFileReader content;
content.setProductConsumer( bind( &Impl::consumeProd, this, _1 ) );
content.setRepoIndexConsumer( bind( &Impl::consumeIndex, this, _1 ) );
- content.parse( reporoot_r / "content" );
+ content.parse( inputfile );
}
if ( ! _repoIndex )
{
DBG << _repoIndex << endl;
// Prepare parsing
- _descrdir = reporoot_r / _repoIndex->descrdir;
- _datadir = reporoot_r / _repoIndex->datadir;
+ _descrdir = _repoIndex->descrdir; // path below reporoot
+ _datadir = _repoIndex->datadir; // path below reporoot
_ticks.name( "Parsing susetags repo at " + reporoot_r.asString() );
- _ticks.range( _repoIndex->metaFileChecksums.size() );
+
+ // calculate progress range based on file sizes to parse
+ int jobssize = 0;
+ for ( RepoIndex::FileChecksumMap::const_iterator it = _repoIndex->metaFileChecksums.begin();
+ it != _repoIndex->metaFileChecksums.end(); ++it )
+ {
+ jobssize += PathInfo(getOptionalFile(_descrdir / it->first)).size();
+
+ }
+ MIL << "Total job size: " << jobssize << endl;
+
+ _ticks.range(jobssize);
+
if ( ! _ticks.toMin() )
ZYPP_THROW( AbortRequestException() );
// Start with packages
{
+ Pathname inputfile( assertMandatoryFile( _descrdir / "packages" ) );
PackagesFileReader reader;
reader.setPkgConsumer( bind( &Impl::consumePkg, this, _1 ) );
reader.setSrcPkgConsumer( bind( &Impl::consumeSrcPkg, this, _1 ) );
- reader.parse( _descrdir / "packages" );
+
+ CombinedProgressData packageprogress( _ticks, PathInfo(inputfile).size() );
+ reader.parse( inputfile, packageprogress );
}
- if ( ! _ticks.incr() )
- ZYPP_THROW( AbortRequestException() );
- // Now process packages.lang
- // Always parse 'en'. For each wanted locale at least
- // some fallback, if locale is not present.
+ // Now process packages.lang. Always parse 'en'.
+ // At least packages.en is mandatory, because the file might
+ // contain license texts.
+ assertMandatoryFile( _descrdir / "packages.en" );
parseLocaleIf( Locale("en") );
- parseLocaleIf( Locale("de_DE") );
+ // For each wanted locale at least
+ // some fallback, if locale is not present.
parseLocaleIf( ZConfig().defaultTextLocale() );
// Now process the rest of RepoIndex
{
if ( isPatternFile( it->first ) )
{
- PatternFileReader reader;
- reader.setConsumer( bind( &Impl::consumePat, this, _1 ) );
- reader.parse( _descrdir / it->first );
+ Pathname inputfile( getOptionalFile( _descrdir / it->first) );
+ if ( ! inputfile.empty() )
+ {
+ PatternFileReader reader;
+ reader.setConsumer( bind( &Impl::consumePat, this, _1 ) );
+ CombinedProgressData patternprogress( _ticks, PathInfo(inputfile).size() );
+ reader.parse( inputfile, patternprogress );
+ }
}
-
- if ( ! _ticks.incr() )
- ZYPP_THROW( AbortRequestException() );
}
// Done
if ( ! _ticks.toMax() )
ZYPP_THROW( AbortRequestException() );
+
+ MIL << "DONE " << reporoot_r << "("
+ << _stats.prod << " products, "
+ << _stats.patt << " patterns, "
+ << _stats.pack << " packages, "
+ << _stats.srcp << " srcpackages)" << endl;
}
///////////////////////////////////////////////////////////////////
//
+++ /dev/null
-Makefile.in
-Makefile
-.deps
-.libs
-*.o
-*.lo
-*.a
-*.la
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/tagfile/TagFileParser.cc
- *
-*/
-#include <iostream>
-#include <fstream>
-#include <sstream>
-
-#include <boost/tokenizer.hpp>
-#include <boost/algorithm/string.hpp>
-
-#include "zypp/base/Logger.h"
-#include "zypp/base/PtrTypes.h"
-#include "zypp/base/String.h"
-#include "zypp/PathInfo.h"
-
-#include "zypp/parser/tagfile/TagFileParser.h"
-#include "zypp/parser/ParseException.h"
-
-
-#undef ZYPP_BASE_LOGGER_LOGGROUP
-#define ZYPP_BASE_LOGGER_LOGGROUP "TagFileParser"
-
-using namespace std;
-using namespace boost;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace parser
- { /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace tagfile
- { /////////////////////////////////////////////////////////////////
-
- void dumpRegexpResults( const boost::smatch &what )
- {
- for ( unsigned int k=0; k < what.size(); k++)
- {
- XXX << "[match "<< k << "] [" << what[k] << "]" << std::endl;
- }
- }
-
- void dumpRegexpResults2( const boost::smatch &what )
- {
- for ( unsigned int k=0; k < what.size(); k++)
- {
- DBG << "[match "<< k << "] [" << what[k] << "]" << std::endl;
- }
- }
-
- TagFileParser::TagFileParser( ParserProgress::Ptr progress ) : _progress(progress)
- {
- }
-
- void TagFileParser::beginParse()
- {
- }
-
- void TagFileParser::endParse()
- {
- }
-
- void TagFileParser::consume( const SingleTag &tag )
- {
- }
-
- void TagFileParser::consume( const MultiTag &tag )
- {
- }
-
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : Parser::parse
- // METHOD TYPE : void
- //
- void TagFileParser::parse( const Pathname & file_r)
- {
- // save parsed filename for debug
- int previous_progress = 0;
- int new_progress = 0;
- _file_r = file_r;
- _file_size = 0;
- _line_number = 0;
- _file_size = PathInfo(file_r).size();
- std::ifstream file(file_r.asString().c_str());
- int readed = 0;
-
- boost::regex rxComment("^[[:space:]]*#(.*)$");
- boost::regex rxMStart("^\\+([^[:space:]^\\.]+)(\\.([^[:space:]]+))?:$");
- boost::regex rxMEnd("^\\-([^[:space:]^\\.]+)(\\.([^[:space:]]+))?:$");
- boost::regex rxSStart("^=([^[:space:]^\\.]+)(\\.([^[:space:]]+))?:[[:space:]]*(.*)$");
- boost::regex rxEmpty("^([[:space:]]*)$");
-
- if (!file) {
- ZYPP_THROW (ParseException( "Can't open " + file_r.asString() ) );
- }
-
- std::string buffer;
- // read vendor
- MIL << "Started parsing " << file_r << std::endl;
- beginParse();
- while(file && !file.eof())
- {
- getline(file, buffer);
- _line_number++;
- readed += buffer.size();
-
- boost::smatch what;
- if(boost::regex_match(buffer, what, rxComment, boost::match_extra))
- {
- XXX << "comment" << std::endl;
- // comment # something
- // str::strtonum(buffer, entry_r.count);
- dumpRegexpResults(what);
- }
- else if(boost::regex_match(buffer, what, rxMStart, boost::match_extra))
- {
- MultiTag tag;
- tag.name = what[1];
- tag.modifier = what[3];
-
- XXX << "start list" << std::endl;
- dumpRegexpResults(what);
- // start of list +Something.lang:
- // lang is optional
- // str::strtonum(buffer, entry_r.count);
- std::string element;
- boost::smatch element_what;
- getline(file, element);
- _line_number++;
- readed += element.size();
- // while we dont find the list terminator
- while(!file.eof())
- {
- // avoid regexping in most cases.
- if ( element[0] == '-' )
- {
- if ( boost::regex_match(element, element_what, rxMEnd, boost::match_extra) )
- {
- // end list element? we check that it is the same as the opening tag, otherwise it is all broken!
- if ( tag.name != element_what[1] )
- ZYPP_THROW(ParseException("Expecting tag -" + tag.name + " for closing. Found -" + element_what[1]));
-
- // no problem, is a real close list tag
- break;
- }
- }
-
- // if we are in a multi tag (list), we cannot start a list inside a list, so if we find a
- // + sign, we check it. We dont just regexp every entry because it is very expensive
- if ( element[0] == '+' )
- {
- if ( boost::regex_match(element, element_what, rxMStart, boost::match_extra) )
- {
- if ( tag.name != element_what[1] )
- ZYPP_THROW(ParseException("MultiTag +" + element_what[1] + " started before closing +" + tag.name));
- else
- ZYPP_THROW(ParseException("MultiTag +" + tag.name + " duplicate opening tag"));
- }
- }
-
- tag.values.push_back(element);
-
- XXX << element << std::endl;
- getline(file, element);
- _line_number++;
- readed += element.size();
- //dumpRegexpResults(element_what);
- }
- XXX << "end list" << std::endl;
- consume(tag);
- // end of list
- }
- else if(boost::regex_match(buffer, what, rxSStart, boost::match_extra))
- {
- SingleTag tag;
- tag.name = what[1];
- tag.modifier = what[3];
- tag.value = what[4];
- XXX << "assign" << std::endl;
- // start of list
- // str::strtonum(buffer, entry_r.count);
- dumpRegexpResults(what);
- consume(tag);
- }
- else if(boost::regex_match(buffer, what, rxEmpty, boost::match_extra))
- {
- XXX << "empty line" << std::endl;
- }
- else
- {
- // https://bugzilla.novell.com/show_bug.cgi?id=160607
- // before we used to throw a parse error exception if we dont find
- // a key value line. But package descriptions usually are broken
- // and contain multiple lines for single line tags, etc.
- stringstream ss;
- ss << "Parse error, unrecognized line [" << buffer << "]. Be sure " << _file_r << " line " << _line_number << " misses a tag or comment.";
- ZYPP_THROW( ParseException( ss.str() ) );
- }
-
- new_progress = (int)((((float)readed)/((float)_file_size))*100);
- if ( _progress && new_progress != previous_progress )
- _progress->progress( new_progress );
- previous_progress = new_progress;
-
- }
- endParse();
- MIL << "Done parsing " << file_r << std::endl;
- }
-
- /////////////////////////////////////////////////////////////////
- } // namespace tagfile
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
- } // namespace parser
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/tagfile/TagFileParser.h
- *
-*/
-#ifndef ZYPP_PARSER_TAGFILE2_H
-#define ZYPP_PARSER_TAGFILE2_H
-
-#include <iosfwd>
-#include <map>
-#include <list>
-
-#include <boost/regex.hpp>
-
-#include "zypp/parser/ParserProgress.h"
-#include "zypp/Pathname.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace parser
- { /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace tagfile
- { /////////////////////////////////////////////////////////////////
-
- void dumpRegexpResults( const boost::smatch &what );
- void dumpRegexpResults2( const boost::smatch &what );
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : TagFileParser
- //
- /** Tagfile parser. */
- class TagFileParser
- {
- public:
- struct MultiTag
- {
- std::string name;
- std::string modifier;
- std::list<std::string> values;
- };
-
- struct SingleTag
- {
- std::string name;
- std::string modifier;
- std::string value;
- };
-
- TagFileParser( ParserProgress::Ptr progress );
- virtual ~TagFileParser()
- {}
-
- /* Parse file and invoke consume on each tag found.
- * \throw ParseException
- * \todo more doc on Ecaptions.
- */
- virtual void parse( const Pathname & file_r);
-
- /*
- * Called when start parsing
- */
- virtual void beginParse();
- /*
- * Called when a single tag is found
- */
- virtual void consume( const SingleTag &tag );
- /*
- * Called when a multiple tag is found
- */
- virtual void consume( const MultiTag &tag );
- /*
- * Called when the parse is done
- */
- virtual void endParse();
-
- protected:
- ParserProgress::Ptr _progress;
- Pathname _file_r;
- int _file_size;
- int _line_number;
- };
- /////////////////////////////////////////////////////////////////
- } // namespace parser
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
- } // namespace tagfile
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-//
-#endif // ZYPP_PARSER_TAGFILE_SelectionSelFilePPARSER_H
TranslatedText license_to_confirm;
std::string vendor;
ByteCount size;
- ByteCount archive_size;
+ ByteCount downloadSize;
bool install_only;
Date build_time;
Date install_time;
dataPtr->size = str::strtonum<ByteCount::SizeType>(_helper.content(child));
}
else if (name == "archive-size") {
- dataPtr->archive_size = str::strtonum<ByteCount::SizeType>(_helper.content(child));
+ dataPtr->downloadSize = str::strtonum<ByteCount::SizeType>(_helper.content(child));
}
else if (name == "install-only") {
dataPtr->install_only = (_helper.content(child) == "true") ? true : false;
#include <libxml/tree.h>
#include <zypp/base/Logger.h>
#include <zypp/parser/xmlstore/schemanames.h>
-
+#include "zypp/repo/RepoType.h"
#include "XMLSourceCacheParser.h"
using namespace std;
XMLSourceCacheParser::XMLSourceCacheParser()
{ }
- XMLSourceCacheParser::XMLSourceCacheParser(SourceInfo_Ptr &entry)
- : zypp::parser::XMLNodeIterator<SourceInfo_Ptr>(entry)
+ XMLSourceCacheParser::XMLSourceCacheParser(RepoInfo_Ptr &entry)
+ : zypp::parser::XMLNodeIterator<RepoInfo_Ptr>(entry)
{ }
}
// do the actual processing
- SourceInfo_Ptr
+ RepoInfo_Ptr
XMLSourceCacheParser::process(const xmlTextReaderPtr reader)
{
assert(reader);
- SourceInfo_Ptr dataPtr( new source::SourceInfo );
+ RepoInfo_Ptr dataPtr( new RepoInfo );
xmlNodePtr dataNode = xmlTextReaderExpand(reader);
assert(dataNode);
}
else if (name == "type")
{
- dataPtr->setType(_helper.content(child));
- }
- else if (name == "product-dir")
- {
- dataPtr->setPath(_helper.content(child));
- }
- else if (name == "cache-dir")
- {
- dataPtr->setCacheDir(_helper.content(child));
+ dataPtr->setType(repo::RepoType(_helper.content(child)));
}
else if (name == "alias")
{
}
else if (name == "url")
{
- dataPtr->setUrl(_helper.content(child));
+ dataPtr->addBaseUrl(_helper.content(child));
}
else
{
XMLSourceCacheParser::XMLSourceCacheParser(std::istream &is, const std::string &baseUrl)
- : zypp::parser::XMLNodeIterator<SourceInfo_Ptr>(is, baseUrl, SOURCESCHEMA)
+ : zypp::parser::XMLNodeIterator<RepoInfo_Ptr>(is, baseUrl, SOURCESCHEMA)
{
fetchNext();
}
#ifndef XMLSourceCacheParser_h
#define XMLSourceCacheParser_h
-#include <zypp/source/SourceInfo.h>
+#include <zypp/RepoInfo.h>
#include <zypp/parser/XMLNodeIterator.h>
#include <zypp/parser/LibXMLHelper.h>
#include <list>
{
namespace xmlstore
{
- typedef shared_ptr<source::SourceInfo> SourceInfo_Ptr;
+ typedef shared_ptr<RepoInfo> RepoInfo_Ptr;
/*
* Use this class as an iterator that produces, one after one,
* You can query the exit status with errorStatus().
*/
- class XMLSourceCacheParser : public zypp::parser::XMLNodeIterator<SourceInfo_Ptr>
+ class XMLSourceCacheParser : public zypp::parser::XMLNodeIterator<RepoInfo_Ptr>
{
public:
XMLSourceCacheParser(std::istream &is, const std::string &baseUrl);
XMLSourceCacheParser();
- XMLSourceCacheParser(SourceInfo_Ptr & entry);
+ XMLSourceCacheParser(RepoInfo_Ptr & entry);
virtual ~XMLSourceCacheParser();
private:
virtual bool isInterested(const xmlNodePtr nodePtr);
- virtual SourceInfo_Ptr process(const xmlTextReaderPtr reader);
- void parseSourceList(SourceInfo_Ptr dataPtr, xmlNodePtr node);
+ virtual RepoInfo_Ptr process(const xmlTextReaderPtr reader);
+ void parseSourceList(RepoInfo_Ptr dataPtr, xmlNodePtr node);
zypp::parser::LibXMLHelper _helper;
};
} // namespace parser
// xpath: //package/checksum
if (reader_r->name() == "checksum")
{
- package_ptr->repositoryLocation.fileChecksum = CheckSum(
+ package_ptr->repositoryLocation.setChecksum(CheckSum(
reader_r->getAttribute("type").asString(),
- reader_r.nodeText().asString());
+ reader_r.nodeText().asString()));
// ignoring pkgid attribute
return true;
}
package_ptr->installedSize = str::strtonum<ByteCount::SizeType>( reader_r->getAttribute("installed").asString() );
// rpm package size
- package_ptr->repositoryLocation.fileSize = str::strtonum<ByteCount::SizeType>( reader_r->getAttribute("package").asString() );
+ package_ptr->repositoryLocation.setDownloadSize(str::strtonum<ByteCount::SizeType>( reader_r->getAttribute("package").asString() ));
return true;
}
// xpath: //package/location
if (reader_r->name() == "location")
{
- package_ptr->repositoryLocation.filePath = reader_r->getAttribute("href").asString();
+ package_ptr->repositoryLocation.setFilename(reader_r->getAttribute("href").asString());
return true;
}
*
* \return true if the package node or current subnode has been consumed
* (no further processing is required), false otherwise.
+ * \throws ParseException if a serious error is encountered while parsing
*/
bool consumePackageNode(xml::Reader & reader_r, data::Package_Ptr & package_ptr);
* Processes RPM dependency tags (rpm:entry, rpm:requires, ...).
*
* \return true if a dependency tag has been encountered, false otherwise.
+ * \throws ParseException if a serious error is encountered while parsing
*/
bool consumeDependency(xml::Reader & reader_r, data::Dependencies & deps_r);
// xpath: /patch/atoms/package/patchrpm/location
if (reader_r->name() == "location")
{
- _patchrpm->location.filePath = reader_r->getAttribute("href").asString();
+ _patchrpm->location.setFilename(reader_r->getAttribute("href").asString());
// ignoring attribute 'base'
return true;
}
// xpath: /patch/atoms/package/patchrpm/checksum
if (reader_r->name() == "checksum")
{
- _patchrpm->location.fileChecksum = CheckSum(
+ _patchrpm->location.setChecksum(CheckSum(
reader_r->getAttribute("type").asString(),
- reader_r.nodeText().asString());
+ reader_r.nodeText().asString()));
return true;
}
if (reader_r->name() == "size")
{
// size of the rpm file
- _patchrpm->location.fileSize = str::strtonum<ByteCount::SizeType>(
- reader_r->getAttribute("package").asString());
+ _patchrpm->location.setDownloadSize(str::strtonum<ByteCount::SizeType>(
+ reader_r->getAttribute("package").asString()));
// size of ??
_patchrpm->archiveSize = str::strtonum<ByteCount::SizeType>(
// xpath: /patch/atoms/package/deltarpm/location
if (reader_r->name() == "location")
{
- _deltarpm->location.filePath = reader_r->getAttribute("href").asString();
+ _deltarpm->location.setFilename(reader_r->getAttribute("href").asString());
// ignoring attribute 'base'
return true;
}
// xpath: /patch/atoms/package/deltarpm/checksum
if (reader_r->name() == "checksum")
{
- _deltarpm->location.fileChecksum = CheckSum(
+ _deltarpm->location.setChecksum(CheckSum(
reader_r->getAttribute("type").asString(),
- reader_r.nodeText().asString());
+ reader_r.nodeText().asString()));
return true;
}
if (reader_r->name() == "size")
{
// size of the rpm file
- _deltarpm->location.fileSize = str::strtonum<ByteCount::SizeType>(
- reader_r->getAttribute("package").asString());
+ _deltarpm->location.setDownloadSize(str::strtonum<ByteCount::SizeType>(
+ reader_r->getAttribute("package").asString()));
// size of ??
_deltarpm->archiveSize = str::strtonum<ByteCount::SizeType>(
// ignoring reader_r->getAttribute("xml:base").asString();
// xsd:anyURI do script file path
- script->doScriptLocation.filePath = reader_r->getAttribute("href").asString();
+ script->doScriptLocation.setFilename(reader_r->getAttribute("href").asString());
return true;
}
// xpath: /patch/atoms/script/do-checksum
if (reader_r->name() == "do-checksum")
{
- script->doScriptLocation.fileChecksum = CheckSum(
+ script->doScriptLocation.setChecksum(CheckSum(
reader_r->getAttribute("type").asString(),
- reader_r.nodeText().asString());
+ reader_r.nodeText().asString()));
return true;
}
// ignoring reader_r->getAttribute("xml:base").asString();
// xsd:anyURI undo script file path
- script->undoScriptLocation.filePath = reader_r->getAttribute("href").asString();
+ script->undoScriptLocation.setFilename(reader_r->getAttribute("href").asString());
return true;
}
// xpath: /patch/atoms/script/undo-checksum
if (reader_r->name() == "undo-checksum")
{
- script->undoScriptLocation.fileChecksum = CheckSum(
+ script->undoScriptLocation.setChecksum(CheckSum(
reader_r->getAttribute("type").asString(),
- reader_r.nodeText().asString());
+ reader_r.nodeText().asString()));
return true;
}
}
if ( reader_r->name() == "location" )
{
_tag = tag_Location;
- _location.filename( reader_r->getAttribute("href").asString() );
+ _location.setFilename( reader_r->getAttribute("href").asString() );
return true;
}
if ( reader_r->name() == "checksum" )
_tag = tag_CheckSum;
string checksum_type = reader_r->getAttribute("type").asString() ;
string checksum_vaue = reader_r.nodeText().asString();
- _location.checksum( CheckSum( checksum_type, checksum_vaue ) );
+ _location.setChecksum( CheckSum( checksum_type, checksum_vaue ) );
return true;
}
if ( reader_r->name() == "timestamp" )
*
* \param the xml reader object reading the file
* \return true to tell the reader to continue, false to tell it to stop
+ * \throws AbortRequestException if user request for aborting the parsing
+ * has been received through progress reporting callback.
*
* \note Semantics of this method's return value also differs from other
* consume* methods. While this method's return value tells the the
if (reader_r->nodeType() == XML_READER_TYPE_ELEMENT)
{
+ // xpath: /metadata
if (reader_r->name() == "metadata")
{
unsigned total_packages;
return true;
}
+ // xpath: /metdata/package (+)
if (reader_r->name() == "package")
{
tag(tag_package);
else if ( reader_r->nodeType() == XML_READER_TYPE_END_ELEMENT )
{
+ // xpath: /metdata/package (+)
if (reader_r->name() == "package")
{
if (_package && _callback)
return true;
}
+ // xpath: /metdata
if (reader_r->name() == "metadata")
{
_ticks.toMax();
* \param primary_file the primary.xml.gz file you want to read
* \param callback function to process \ref _package data.
* \param progress progress reporting function
+ * \throws AbortRequestException if user request for aborting the parsing
+ * has been received through progress reporting callback.
*
* \see PrimaryFileReader::ProcessPackage
*/
#include "zypp/ZConfig.h"
#include "zypp/base/Logger.h"
-
+#include "zypp/PathInfo.h"
#include "zypp/base/UserRequestException.h"
#include "zypp/repo/yum/ResourceType.h"
namespace yum
{
-
- /** \todo make this through ZYppCallbacks.h */
- bool progress_function(ProgressData::value_type p)
- {
- cout << "Parsing $name_would_come_in_handy [" << p << "%]" << endl;
-// cout << "\rParsing $name_would_come_in_handy [" << p << "%]" << flush;
- return true;
- }
-
-
/**
* Structure encapsulating YUM parser data type and filename.
*/
:
_repository_id(repository_id), _consumer(consumer), _options(options)
{
- _ticks.name("RepoParser");
+ _ticks.name("YUM RepoParser");
_ticks.sendTo(progress);
}
cache_dir + "/repodata/repomd.xml",
bind(&RepoParser::Impl::repomd_CB, this, _1, _2));
+ long long totalsize = 0;
+ for(list<RepoParserJob>::const_iterator it = _jobs.begin();
+ it != _jobs.end(); ++it)
+ {
+ RepoParserJob job = *it;
+ totalsize += PathInfo(cache_dir + job.filename()).size();
+ }
- _ticks.range(_jobs.size());
+ MIL << "Total files size: " << totalsize << endl;
+ _ticks.range(totalsize);
_ticks.toMin();
-
+
doJobs(cache_dir);
_ticks.toMax();
it != _jobs.end(); ++it)
{
RepoParserJob job = *it;
-
- MIL << "going to parse " << job.type() << " file " << job.filename() << endl;
-
+ // FIXME better way to do progress here?
+ int jobsize = PathInfo(cache_dir + job.filename()).size();
+
+ MIL << "going to parse " << job.type() << " file "
+ << job.filename() << " (" << jobsize << " bytes)" << endl;
+
switch(job.type().toEnum())
{
// parse primary.xml.gz
case ResourceType::PRIMARY_e:
{
+ CombinedProgressData jobrcv( _ticks, jobsize );
PrimaryFileReader(
cache_dir + job.filename(),
bind(&RepoParser::Impl::primary_CB, this, _1),
- &progress_function);
+ jobrcv);
break;
}
bind(&RepoParser::Impl::patches_CB, this, _1, _2));
// reset progress reporter max value (number of jobs changed if
// there are patches to parse)
- _ticks.range(_jobs.size());
+ _ticks.range( _ticks.max() + jobsize );
+ // increase in the total bytes of the file
+ if (!_ticks.incr( jobsize ))
+ ZYPP_THROW(AbortRequestException());
break;
}
PatchFileReader(
cache_dir + job.filename(),
bind(&RepoParser::Impl::patch_CB, this, _1));
+ // increase in the total bytes of the file
+ if (!_ticks.incr( jobsize ))
+ ZYPP_THROW(AbortRequestException());
break;
}
{
if (!_options.skipOther)
{
+ CombinedProgressData jobrcv( _ticks, jobsize );
OtherFileReader(
cache_dir + job.filename(),
bind(&RepoParser::Impl::other_CB, this, _1, _2),
- &progress_function);
+ jobrcv);
}
else
+ {
MIL << "skipping other.xml.gz";
+ // increase in the total bytes of the file
+ if (!_ticks.incr( jobsize ))
+ ZYPP_THROW(AbortRequestException());
+ }
break;
}
{
if (!_options.skipFilelists)
{
+ CombinedProgressData jobrcv( _ticks, jobsize );
FilelistsFileReader(
cache_dir + job.filename(),
bind(&RepoParser::Impl::filelist_CB, this, _1, _2),
- &progress_function);
+ jobrcv);
}
else
+ {
MIL << "skipping filelists.xml.gz";
-
+ // increase in the total bytes of the file
+ if (!_ticks.incr( jobsize ))
+ ZYPP_THROW(AbortRequestException());
+ }
break;
}
PatternFileReader(
cache_dir + job.filename(),
bind(&RepoParser::Impl::pattern_CB, this, _1));
+ // increase in the total bytes of the file
+ if (!_ticks.incr( jobsize ))
+ ZYPP_THROW(AbortRequestException());
break;
}
ProductFileReader(
cache_dir + job.filename(),
bind(&RepoParser::Impl::product_CB, this, _1));
+ // increase in the total bytes of the file
+ if (!_ticks.incr( jobsize ))
+ ZYPP_THROW(AbortRequestException());
break;
}
<< job.filename() << endl;
}
}
-
- if (!_ticks.incr())
- ZYPP_THROW(AbortRequestException());
}
}
if ( reader_r->name() == "location" )
{
_tag = tag_Location;
- _location.filename( reader_r->getAttribute("href").asString() );
+ _location.setFilename( reader_r->getAttribute("href").asString() );
// ignoring attribute xml:base
return true;
}
_tag = tag_CheckSum;
string checksum_type = reader_r->getAttribute("type").asString() ;
string checksum_vaue = reader_r.nodeText().asString();
- _location.checksum( CheckSum( checksum_type, checksum_vaue ) );
+ _location.setChecksum( CheckSum( checksum_type, checksum_vaue ) );
return true;
}
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMFileListParser.cc
- *
-*/
-
-#include <sys/types.h>
-#include <regex.h>
-
-#include <zypp/parser/yum/YUMFileListParser.h>
-#include <istream>
-#include <string>
-#include "zypp/parser/xml_parser_assert.h"
-#include <libxml/xmlstring.h>
-#include <libxml/xmlreader.h>
-#include <libxml/tree.h>
-#include <zypp/parser/LibXMLHelper.h>
-#include <zypp/parser/yum/schemanames.h>
-#include <iostream>
-#include <zypp/base/Logger.h>
-#include <zypp/ZYppFactory.h>
-#include <boost/regex.hpp>
-#include <boost/algorithm/string.hpp>
-
-using namespace std;
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-static boost::regex filenameRegex("^.*(/bin/|/sbin/|/lib/|/lib64/|/etc/|/usr/share/dict/words/|/usr/games/|/usr/share/magic\\.mime|/opt/gnome/games).*$");
-static regex_t filenameRegexT;
-static bool filenameRegexOk = false;
-
-YUMFileListParser::YUMFileListParser(std::istream &is, const std::string& baseUrl, parser::ParserProgress::Ptr progress )
- : XMLNodeIterator<YUMFileListData_Ptr>(is, baseUrl,FILELISTSCHEMA, progress)
- , _zypp_architecture( getZYpp()->architecture() )
-{
- fetchNext();
-}
-
-YUMFileListParser::YUMFileListParser()
- : _zypp_architecture( getZYpp()->architecture() )
-{ }
-
-YUMFileListParser::YUMFileListParser(YUMFileListData_Ptr& entry)
- : XMLNodeIterator<YUMFileListData_Ptr>(entry)
- , _zypp_architecture( getZYpp()->architecture() )
-{ }
-
-
-
-YUMFileListParser::~YUMFileListParser()
-{}
-
-
-
-
-// select for which elements process() will be called
-bool
-YUMFileListParser::isInterested(const xmlNodePtr nodePtr)
-{
- bool result = (_helper.isElement(nodePtr)
- && _helper.name(nodePtr) == "package");
- return result;
-}
-
-
-// do the actual processing
-YUMFileListData_Ptr
-YUMFileListParser::process(const xmlTextReaderPtr reader)
-{
- xml_assert(reader);
- YUMFileListData_Ptr dataPtr = new YUMFileListData;
- xmlNodePtr dataNode = xmlTextReaderExpand(reader);
- xml_assert(dataNode);
-
- dataPtr->pkgId = _helper.attribute(dataNode,"pkgid");
- dataPtr->name = _helper.attribute(dataNode,"name");
- dataPtr->arch = _helper.attribute(dataNode,"arch");
- try
- {
- if (!Arch(dataPtr->arch).compatibleWith( _zypp_architecture ))
- {
- dataPtr = NULL; // skip <package>, incompatible architecture
- return dataPtr;
- }
- }
- catch ( const Exception & excpt_r )
- {
- ZYPP_CAUGHT( excpt_r );
- DBG << "Skipping malformed " << dataPtr->arch << endl;
- dataPtr = NULL;
- return dataPtr;
- }
-
- for (xmlNodePtr child = dataNode->children;
- child != 0;
- child = child->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "version")
- {
- dataPtr->epoch = _helper.attribute(child,"epoch");
- dataPtr->ver = _helper.attribute(child,"ver");
- dataPtr->rel = _helper.attribute(child,"rel");
- }
- else if (name == "file")
- {
- string filename = _helper.content( child );
- if (!filenameRegexOk)
- {
- const char * filenameRegexPattern = "/(s?bin|lib(64)?|etc)/|^/usr/(games/|share/(dict/words|magic\\.mime)$)|^/opt/gnome/games/";
- regcomp (&filenameRegexT, filenameRegexPattern, REG_EXTENDED | REG_NOSUB);
- //MIL << "regcomp " << r;
- filenameRegexOk = true;
- }
-
- bool match;
- match = !regexec (&filenameRegexT, filename.c_str(), 0 /*nmatch*/, NULL /*pmatch*/, 0 /*flags*/);
-
- if (match)
- dataPtr->files.push_back( FileData( filename, _helper.attribute( child, "type" ) ) );
- }
- else
- {
- WAR << "YUM <filelists> contains the unknown element <" << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
- //std::cout << dataPtr->files.size() << std::endl;
- return dataPtr;
-}
-
-
-} // namespace yum
-} // namespace parser
-} // namespace zypp
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMFileListParser.h
- *
-*/
-
-
-#ifndef YUMFileListParser_h
-#define YUMFileListParser_h
-
-
-#include <zypp/parser/yum/YUMParserData.h>
-#include <zypp/parser/XMLNodeIterator.h>
-#include <zypp/parser/LibXMLHelper.h>
-#include <list>
-#include <zypp/Arch.h>
-
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-/**
-* @short Parser for YUM filelists files
-* Use this class as an iterator that produces, one after one,
-* YUMFileListData_Ptr(s) for the XML package elements.
-* Here's an example:
-*
-* for (YUMFileListParser iter(anIstream, baseUrl),
-* iter != YUMFileListParser.end(), // or: iter() != 0, or ! iter.atEnd()
-* ++iter) {
-* doSomething(*iter)
-* }
-*
-* The iterator owns the pointer (i.e., caller must not delete it)
-* until the next ++ operator is called. At this time, it will be
-* destroyed (and a new ENTRYTYPE is created.)
-*
-* If the input is fundamentally flawed so that it makes no sense to
-* continue parsing, XMLNodeIterator will log it and consider the input as finished.
-* You can query the exit status with errorStatus().
-*/
-class YUMFileListParser : public XMLNodeIterator<YUMFileListData_Ptr>
-{
-public:
- /**
- * Constructor.
- * @param is the istream to read from
- * @param baseUrl the base URL of the XML document. Can be left empty.
- */
- YUMFileListParser(std::istream &is, const std::string &baseUrl, parser::ParserProgress::Ptr progress = parser::ParserProgress::Ptr() );
- YUMFileListParser();
- YUMFileListParser(YUMFileListData_Ptr& entry);
-
-
- /**
- * Destructor.
- */
- virtual ~YUMFileListParser();
-
-private:
- /**
- * decides if the parser is interested in the node (and subtree) of an element.
- * @param nodePtr the XML node
- * @return true if the parser is interested.
- */
- virtual bool isInterested(const xmlNodePtr nodePtr);
-
- /**
- * creates a new object from the xml subtree
- * @param reader
- * @return
- */
- virtual YUMFileListData_Ptr process(const xmlTextReaderPtr reader);
-
- /**
- * converts the xml stuff to c++ stuff and filters the right namespaces
- */
- LibXMLHelper _helper;
- Arch _zypp_architecture;
-};
-} // namespace yum
-} // namespace parser
-} // namespace zypp
-
-#endif
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMGroupParser.cc
- *
-*/
-
-#include <zypp/parser/yum/YUMGroupParser.h>
-#include <zypp/parser/LibXMLHelper.h>
-#include <istream>
-#include <string>
-#include "zypp/parser/xml_parser_assert.h"
-#include <libxml/xmlreader.h>
-#include <libxml/tree.h>
-#include <zypp/base/Logger.h>
-#include <zypp/parser/yum/schemanames.h>
-
-using namespace std;
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-YUMGroupParser::YUMGroupParser()
-{ }
-
-YUMGroupParser::YUMGroupParser(YUMGroupData_Ptr& entry)
- : XMLNodeIterator<YUMGroupData_Ptr>(entry)
-{ }
-
-
-YUMGroupParser::~YUMGroupParser()
-{ }
-
-
-// select for which elements process() will be called
-bool
-YUMGroupParser::isInterested(const xmlNodePtr nodePtr)
-{
- return _helper.isElement(nodePtr) && _helper.name(nodePtr) == "group";
-}
-
-// do the actual processing
-YUMGroupData_Ptr
-YUMGroupParser::process(const xmlTextReaderPtr reader)
-{
- xml_assert(reader);
- YUMGroupData_Ptr dataPtr = new YUMGroupData;
- xmlNodePtr dataNode = xmlTextReaderExpand(reader);
- xml_assert(dataNode);
-
- for (xmlNodePtr child = dataNode->children;
- child && child != dataNode;
- child = child->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "groupid")
- {
- dataPtr->groupId = _helper.content(child);
- }
- else if (name == "name")
- {
- dataPtr->name.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
- }
- else if (name == "default")
- {
- dataPtr->default_ = _helper.content(child);
- }
- else if (name == "uservisible")
- {
- dataPtr->userVisible = _helper.content(child);
- }
- else if (name == "description")
- {
- dataPtr->description.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
- ERR << "description has " << dataPtr->description.locales().size() << std::endl;
- }
- else if (name == "grouplist")
- {
- parseGrouplist(dataPtr, child);
- }
- else if (name == "packagelist")
- {
- parsePackageList(dataPtr, child);
- }
- else
- {
- WAR << "YUM <group> contains the unknown element <" << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
- return dataPtr;
-} /* end process */
-
-void YUMGroupParser::parseGrouplist(YUMGroupData_Ptr dataPtr,
- xmlNodePtr node)
-{
- xml_assert(dataPtr);
- xml_assert(node);
-
- for (xmlNodePtr child = node->children;
- child != 0;
- child = child ->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "metapkg" || name == "groupreq")
- {
- dataPtr->grouplist.push_back
- (MetaPkg(_helper.attribute(child,"type"),
- _helper.content(child)));
- }
- else
- {
- WAR << "YUM <grouplist> contains the unknown element <" << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
-}
-
-
-void YUMGroupParser::parsePackageList(YUMGroupData_Ptr dataPtr,
- xmlNodePtr node)
-{
- xml_assert(dataPtr);
- xml_assert(node);
-
- for (xmlNodePtr child = node->children;
- child != 0;
- child = child ->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "packagereq")
- {
- dataPtr->packageList.push_back
- (PackageReq(_helper.attribute(child,"type"),
- _helper.attribute(child,"epoch"),
- _helper.attribute(child,"ver"),
- _helper.attribute(child,"rel"),
- _helper.content(child)));
- }
- else
- {
- WAR << "YUM <packagelist> contains the unknown element <" << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
-}
-
-
-
-YUMGroupParser::YUMGroupParser(std::istream &is, const std::string &baseUrl, parser::ParserProgress::Ptr progress )
- : XMLNodeIterator<YUMGroupData_Ptr>(is, baseUrl,GROUPSCHEMA, progress)
-{
- fetchNext();
-}
-
-} // namespace yum
-} // namespace parser
-} // namespace zypp
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMGroupParser.h
- *
-*/
-
-
-
-#ifndef YUMGroupParser_h
-#define YUMGroupParser_h
-
-#include <zypp/parser/yum/YUMParserData.h>
-#include <zypp/parser/XMLNodeIterator.h>
-#include <zypp/parser/LibXMLHelper.h>
-#include <list>
-
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-/**
-*
-* @short Parser for YUM group files.
-*
-* Use this class as an iterator that produces, one after one,
-* YUMGroupData_Ptr(s) for the XML group elements.
-* Here's an example:
-*
-* for (YUMGroupParser iter(anIstream, baseUrl),
-* iter != YUMFileListParser.end(), // or: iter() != 0, or ! iter.atEnd()
-* ++iter) {
-* doSomething(*iter)
-* }
-*
-* The iterator owns the pointer (i.e., caller must not delete it)
-* until the next ++ operator is called. At this time, it will be
-* destroyed (and a new ENTRYTYPE is created.)
-*
-* If the input is fundamentally flawed so that it makes no sense to
-* continue parsing, XMLNodeIterator will log it and consider the input as finished.
-* You can query the exit status with errorStatus().
-*/
-class YUMGroupParser : public XMLNodeIterator<YUMGroupData_Ptr>
-{
-public:
- YUMGroupParser(std::istream &is, const std::string &baseUrl, parser::ParserProgress::Ptr progress = parser::ParserProgress::Ptr() );
- YUMGroupParser();
- YUMGroupParser(YUMGroupData_Ptr& entry);
- virtual ~YUMGroupParser();
-
-private:
- virtual bool isInterested(const xmlNodePtr nodePtr);
- virtual YUMGroupData_Ptr process(const xmlTextReaderPtr reader);
- void parseGrouplist(YUMGroupData_Ptr dataPtr,
- xmlNodePtr node);
- void parsePackageList(YUMGroupData_Ptr dataPtr,
- xmlNodePtr node);
-
- LibXMLHelper _helper;
-};
-} // namespace yum
-} // namespace parser
-} // namespace zypp
-
-#endif
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMOtherParser.cc
- *
-*/
-
-
-
-#include <zypp/parser/yum/YUMOtherParser.h>
-#include <istream>
-#include <string>
-#include "zypp/parser/xml_parser_assert.h"
-#include <libxml/xmlstring.h>
-#include <libxml/xmlreader.h>
-#include <libxml/tree.h>
-#include <zypp/parser/LibXMLHelper.h>
-#include <zypp/base/Logger.h>
-#include <zypp/parser/yum/schemanames.h>
-#include <zypp/ZYppFactory.h>
-
-using namespace std;
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-
-YUMOtherParser::YUMOtherParser(std::istream &is, const std::string& baseUrl, parser::ParserProgress::Ptr progress )
- : XMLNodeIterator<YUMOtherData_Ptr>(is, baseUrl,OTHERSCHEMA, progress)
- , _zypp_architecture( getZYpp()->architecture() )
-{
- fetchNext();
-}
-
-YUMOtherParser::YUMOtherParser()
- : _zypp_architecture( getZYpp()->architecture() )
-{ }
-
-YUMOtherParser::YUMOtherParser(YUMOtherData_Ptr& entry)
- : XMLNodeIterator<YUMOtherData_Ptr>(entry)
- , _zypp_architecture( getZYpp()->architecture() )
-{ }
-
-
-
-YUMOtherParser::~YUMOtherParser()
-{}
-
-
-
-
-// select for which elements process() will be called
-bool
-YUMOtherParser::isInterested(const xmlNodePtr nodePtr)
-{
- bool result = (_helper.isElement(nodePtr)
- && _helper.name(nodePtr) == "package");
- return result;
-}
-
-
-// do the actual processing
-YUMOtherData_Ptr
-YUMOtherParser::process(const xmlTextReaderPtr reader)
-{
- xml_assert(reader);
- YUMOtherData_Ptr dataPtr = new YUMOtherData;
- xmlNodePtr dataNode = xmlTextReaderExpand(reader);
- xml_assert(dataNode);
-
- dataPtr->pkgId = _helper.attribute(dataNode,"pkgid");
- dataPtr->name = _helper.attribute(dataNode,"name");
- dataPtr->arch = _helper.attribute(dataNode,"arch");
-
- try
- {
- if (!Arch(dataPtr->arch).compatibleWith( _zypp_architecture ))
- {
- return NULL; // skip <package>, incompatible architecture
- }
- }
- catch ( const Exception & excpt_r )
- {
- ZYPP_CAUGHT( excpt_r );
- DBG << "Skipping malformed " << dataPtr->arch << endl;
- return NULL;
- }
-
- for (xmlNodePtr child = dataNode->children;
- child != 0;
- child = child->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "version")
- {
- dataPtr->epoch = _helper.attribute(child,"epoch");
- dataPtr->ver = _helper.attribute(child,"ver");
- dataPtr->rel = _helper.attribute(child,"rel");
- }
- else if (name == "changelog")
- {
-#if 0
- dataPtr->changelog.push_back
- (ChangelogEntry(_helper.attribute(child,"author"),
- _helper.attribute(child,"date"),
- _helper.content(child)));
-#endif
- }
- else
- {
- WAR << "YUM <otherdata> contains the unknown element <" << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
- return dataPtr;
-}
-
-} // namespace yum
-} // namespace parser
-} // namespace zypp
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMOtherParser.h
- *
-*/
-
-
-#ifndef YUMOtherParser_h
-#define YUMOtherParser_h
-
-
-#include <zypp/parser/yum/YUMParserData.h>
-#include <zypp/parser/XMLNodeIterator.h>
-#include <zypp/parser/LibXMLHelper.h>
-#include <list>
-#include <zypp/Arch.h>
-
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-/**
-* @short Parser for YUM other.xml files
-* Use this class as an iterator that produces, one after one,
-* YUMOtherData_Ptr(s) for the XML package elements.
-* Here's an example:
-*
-* for (YUMOtherParser iter(anIstream, baseUrl),
-* iter != YUMOtherParser.end(), // or: iter() != 0, or ! iter.atEnd()
-* ++iter) {
-* doSomething(*iter)
-* }
-*
-* The iterator owns the pointer (i.e., caller must not delete it)
-* until the next ++ operator is called. At this time, it will be
-* destroyed (and a new ENTRYTYPE is created.)
-*
-* If the input is fundamentally flawed so that it makes no sense to
-* continue parsing, XMLNodeIterator will log it and consider the input as finished.
-* You can query the exit status with errorStatus().
-*/
-class YUMOtherParser : public XMLNodeIterator<YUMOtherData_Ptr>
-{
-public:
- /**
- * Constructor.
- * @param is the istream to read from
- * @param baseUrl the base URL of the XML document. Can be left empty.
- */
- YUMOtherParser(std::istream &is, const std::string &baseUrl, parser::ParserProgress::Ptr progress = parser::ParserProgress::Ptr() );
-
- YUMOtherParser();
- YUMOtherParser(YUMOtherData_Ptr& entry);
-
- /**
- * Destructor.
- */
- virtual ~YUMOtherParser();
-
-private:
- /**
- * decides if the parser is interested in the node (and subtree) of an element.
- * @param nodePtr the XML node
- * @return true if the parser is interested.
- */
- virtual bool isInterested(const xmlNodePtr nodePtr);
-
- /**
- * creates a new object from the xml subtree
- * @param reader
- * @return
- */
- virtual YUMOtherData_Ptr process(const xmlTextReaderPtr reader);
-
- /**
- * converts the xml stuff to c++ stuff and filters the right namespaces
- */
- LibXMLHelper _helper;
- Arch _zypp_architecture;
-};
-} // namespace yum
-} // namespace parser
-} // namespace zypp
-
-#endif
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMParserData.cc
- *
-*/
-
-#include <iostream>
-
-#include <zypp/parser/yum/YUMParserData.h>
-
-using namespace std;
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-YUMDependency::YUMDependency()
-{ }
-
-YUMDependency::YUMDependency(const std::string& kind,
- const std::string& name,
- const std::string& flags,
- const std::string& epoch,
- const std::string& ver,
- const std::string& rel,
- const std::string& pre)
- : kind(kind),
- name(name),
- flags(flags),
- epoch(epoch),
- ver(ver),
- rel(rel),
- pre(pre)
-{ };
-
-YUMDependency::YUMDependency(const std::string& kind,
- const std::string& encoded)
- : kind(kind),
- encoded(encoded)
-{ };
-
-bool YUMDependency::isEncoded() const
-{
- return !encoded.empty();
-}
-
-YUMDirSize::YUMDirSize()
-{ }
-
-YUMDirSize::YUMDirSize(const std::string& path,
- const std::string& sizeKByte,
- const std::string& fileCount)
- : path(path), sizeKByte(sizeKByte), fileCount(fileCount)
-{ }
-
-YUMRepomdData::YUMRepomdData()
-{ }
-
-YUMPrimaryData::YUMPrimaryData()
- : installOnly( false )
-{ }
-
-FileData::FileData()
-{ }
-
-YUMPatchData::YUMPatchData()
- : rebootNeeded( false )
- , packageManager( false )
-{ }
-
-FileData::FileData(const std::string &name,
- const std::string &type)
- : name(name), type(type)
-{ }
-
-
-YUMGroupData::YUMGroupData()
-{ }
-
-YUMPatternData::YUMPatternData()
-{ }
-
-MetaPkg::MetaPkg()
-{ }
-
-MetaPkg::MetaPkg(const std::string& type,
- const std::string& name)
- : type(type), name(name)
-{ }
-
-PackageReq::PackageReq()
-{ }
-
-PackageReq::PackageReq(const std::string& type,
- const std::string& epoch,
- const std::string& ver,
- const std::string& rel,
- const std::string& name)
- : type(type), epoch(epoch), ver(ver), rel(rel), name(name)
-{ }
-
-ChangelogEntry::ChangelogEntry()
-{ }
-
-ChangelogEntry::ChangelogEntry(const std::string& author,
- const std::string& date,
- const std::string& entry)
- : author(author), date(date), entry(entry)
-{ }
-
-
-YUMFileListData::YUMFileListData()
-{ }
-
-YUMOtherData::YUMOtherData()
-{ }
-
-
-/* Define pointer classes */
-
-IMPL_PTR_TYPE(YUMRepomdData);
-IMPL_PTR_TYPE(YUMPrimaryData);
-IMPL_PTR_TYPE(YUMGroupData);
-IMPL_PTR_TYPE(YUMPatternData);
-IMPL_PTR_TYPE(YUMFileListData);
-IMPL_PTR_TYPE(YUMOtherData);
-IMPL_PTR_TYPE(YUMPatchData);
-IMPL_PTR_TYPE(YUMPatchesData);
-IMPL_PTR_TYPE(YUMProductData);
-IMPL_PTR_TYPE(YUMPatchPackage);
-IMPL_PTR_TYPE(YUMPatchScript);
-IMPL_PTR_TYPE(YUMPatchMessage);
-
-/* output operators */
-
-namespace
-{
-/**
- * @short Generic stream output for lists of Ptrs
- * @param out the ostream where the output goes to
- * @param aList the list to output
- * @return is out
- */
-template<class T>
-ostream& operator<<(ostream &out, const list<T>& aList)
-{
- typedef typename list<T>::const_iterator IterType;
- for (IterType iter = aList.begin();
- iter != aList.end();
- ++iter)
- {
- if (iter != aList.begin())
- out << endl;
- operator<<(out,*iter);
- }
- return out;
-}
-}
-
-/**
- * Join a list of strings into a single string
- * @param aList the list of strings
- * @param joiner what to put between the list elements
- * @return the joined string
- */
-string join(const list<string>& aList,
- const string& joiner)
-{
- string res;
- for (list<string>::const_iterator iter = aList.begin();
- iter != aList.end();
- ++ iter)
- {
- if (iter != aList.begin())
- res += joiner;
- res += *iter;
- }
- return res;
-}
-
-ostream& operator<<(ostream &out, const YUMDependency& data)
-{
- if (! data.kind.empty())
- out << "[" << data.kind << "] ";
- out << data.name << " " << data.flags << " ";
- if (! data.epoch.empty())
- out << data.epoch << "-";
- out << data.ver << "-" << data.rel ;
- if (! data.pre.empty() && data.pre != "0")
- out << " (pre=" << data.pre << ")";
- return out;
-}
-
-ostream& operator<<(ostream &out, const YUMDirSize& data)
-{
- out << data.path
- << ": " << data.sizeKByte << " kByte, "
- << data.fileCount << " files";
- return out;
-}
-
-ostream& operator<<(ostream &out, const FileData& data)
-{
- out << data.name;
- if (! data.type.empty())
- {
- out << ": " << data.type;
- }
- return out;
-}
-
-ostream& operator<<(ostream &out, const MetaPkg& data)
-{
- out << "type: " << data.type
- << ", name: " << data.name;
- return out;
-}
-
-ostream& operator<<(ostream &out, const PackageReq& data)
-{
- out << "[" << data.type << "] "
- << data.name
- << " " << data.epoch
- << "-" << data.ver
- << "-" << data.rel;
- return out;
-}
-
-ostream& operator<<(ostream &out, const ChangelogEntry& data)
-{
- out << data.date
- << " - " << data.author << endl
- << data.entry;
- return out;
-}
-
-ostream& operator<<(ostream &out, const YUMRepomdData& data)
-{
- out << "Repomd Data: " << endl
- << " type: '" << data.type << "'" << endl
- << " location: '" << data.location << "'" <<endl
- << " checksumType: '" << data.checksumType << "'" << endl
- << " checksum: '" << data.checksum << "'" << endl
- << " timestamp: '" << data.timestamp << "'" << endl
- << " openChecksumType: '" << data.openChecksumType << "'" << endl
- << " openChecksum: '" << data.openChecksum << "'" << endl;
- return out;
-}
-
-ostream& operator<<(ostream &out, const YUMPrimaryData& data)
-{
- out << "-------------------------------------------------" << endl
- << "Primary Data: " << endl
- << "name: '" << data.name << "'" << endl
- << "type: '" << data.type << "'" << endl
- << " arch: '" << data.arch << "'" << endl
- << " ver: '" << data.ver << "'" << endl
- << "checksumType: '" << data.checksumType << "'" << endl
- << "checksumPkgid: '" << data.checksumPkgid << "'" << endl
- << "checksum: '" << data.checksum << "'" << endl
- << "summary: '" << data.summary << "'" << endl
- << "description: '" << data.description << "'" << endl
- << "packager: '" << data.packager << "'" << endl
- << "url: '" << data.url << "'" << endl
- << "timeFile: '" << data.timeFile << "'" << endl
- << "timeBuild: '" << data.timeBuild << "'" << endl
- << "sizePackage: '" << data.sizePackage << "'" << endl
- << "sizeInstalled: '" << data.sizeInstalled << "'" << endl
- << "sizeArchive: '" << data.sizeArchive << "'" << endl
- << "location: '" << data.location << "'" << endl
- << "license: '" << data.license << "'" << endl
- << "vendor: '" << data.vendor << "'" << endl
- << "group: '" << data.group << "'" << endl
- << "buildhost: '" << data.buildhost << "'" << endl
- << "sourcerpm: '" << data.sourcerpm << "'" << endl
- << "headerStart: '" << data.headerStart << "'" << endl
- << "headerEnd: '" << data.headerEnd << "'" << endl
- << "provides:" << endl
- << data.provides << endl
- << "conflicts:" << endl
- << data.conflicts << endl
- << "obsoletes:" << endl
- << data.obsoletes << endl
- << "requires:" << endl
- << data.requires << endl
- << "recommends:" << endl
- << data.recommends << endl
- << "suggests:" << endl
- << data.suggests << endl
- << "supplements:" << endl
- << data.supplements << endl
- << "enhances:" << endl
- << data.enhances << endl
- << "files:" << endl
- << data.files << endl
- << "authors: " << join(data.authors,", ") << endl
- << "keywords: " << join(data.keywords,", ") << endl
- << "media: " << data.media << endl
- << "dirsizes: " << endl
- << data.dirSizes << endl
- << "freshens: " << endl
- << data.freshens << endl
- << "install-only: '" << data.installOnly << "'" << endl
- << "License to confirm:" << endl
- << data.license_to_confirm << endl;
- return out;
-}
-
-ostream& operator<<(ostream &out, const YUMGroupData& data)
-{
- out << "-------------------------------------------------" << endl
- << "Group Data: " << endl
- << "group-id: '" << data.groupId << "'" << endl
- << "name:" << endl
- << data.name << endl
- << "default: '" << data.default_ << "'" << endl
- << "user-visible: '" << data.userVisible << "'" << endl
- << "description:" << endl
- << data.description << endl
- << "grouplist:" << endl
- << data.grouplist << endl
- << "packageList:" << endl
- << data.packageList << endl;
- return out;
-}
-
-ostream& operator<<(ostream &out, const YUMPatternData& data)
-{
- out << "-------------------------------------------------" << endl
- << "Pattern Data: " << endl
- << "name:" << data.name << endl
- << "summary: '" << data.summary << "'" << endl
- << "default: '" << data.default_ << "'" << endl
- << "user-visible: '" << data.userVisible << "'" << endl
- << "description:" << endl << data.description << endl
- << "category: " << data.category << endl
- << "icon: " << data.icon << endl
- << "script: " << data.script << endl
- << "provides:" << endl << data.provides << endl
- << "conflicts:" << endl << data.conflicts << endl
- << "obsoletes:" << endl << data.obsoletes << endl
- << "requires:" << endl << data.requires << endl
- << "recommends:" << endl << data.recommends << endl
- << "suggests:" << endl << data.suggests << endl
- << "supplements:" << endl << data.supplements << endl
- << "enhances:" << endl << data.enhances << endl
- << "freshens: " << endl << data.freshens << endl;
- return out;
-}
-
-ostream& operator<<(ostream &out, const YUMFileListData& data)
-{
- out << "-------------------------------------------------" << endl
- << "File List: " << endl
- << "pkgid: " << data.pkgId << endl
- << "package: " << data.name << " "
- << data.epoch << "-" << data.ver << "-" << data.rel << endl
- << "files:" << endl
- << data.files << endl;
- return out;
-}
-
-ostream& operator<<(ostream& out, const YUMOtherData& data)
-{
- out << "-------------------------------------------------" << endl
- << "Other: " << endl
- << "pkgid: " << data.pkgId
- << "package: " << data.name << " "
- << data.epoch << "-" << data.ver << "-" << data.rel << endl
- << "Changelog:" << endl
- << data.changelog << endl;
- return out;
-}
-
-ostream& operator<<(ostream &out, const YUMPatchData& data)
-{
- out << "-------------------------------------------------" << endl
- << "Patch Data: " << endl
- << " patch ID: " << data.patchId << endl
- << " timestamp: '" << data.timestamp << "'" << endl
- << " engine: '" << data.engine << "'" << endl
- << " name: " << data.name << endl
- << " summary: " << data.summary << endl
- << " description: " << data.description << endl
- << " license to confirm:" << endl
- << data.license_to_confirm << endl
- << " epoch: " << data.epoch << endl
- << " version: " << data.ver << endl
- << " release: " << data.rel << endl
- << " architecture: " << data.arch << endl
- << " provides: " << data.provides << endl
- << " conflicts: " << data.conflicts << endl
- << " obsoletes: " << data.obsoletes << endl
- << " freshens: " << data.freshens << endl
- << " requires: " << data.requires << endl
- << " recommends:" << endl << data.recommends << endl
- << " suggests:" << endl << data.suggests << endl
- << " supplements:" << endl << data.supplements << endl
- << " enhances:" << endl << data.enhances << endl
- << " category: " << data.category << endl
- << " reboot needed: " << data.rebootNeeded << endl
- << " affects package manager: " << data.packageManager << endl
- << " update script: " << data.updateScript << endl
- << " atoms:" << endl
- << data.atoms;
- return out;
-}
-
-ostream& operator<<(ostream &out, const YUMPatchesData& data)
-{
- out << "-------------------------------------------------" << endl
- << "Patches Entry Data: " << endl
- << " patch ID: " << data.id << endl
- << " location: " << data.location << endl
- << " checksumType: '" << data.checksumType << "'" << endl
- << " checksum: '" << data.checksum << "'" << endl;
- return out;
-}
-
-ostream& operator<<(ostream &out, const YUMProductData& data)
-{
- out << "-------------------------------------------------" << endl
- << "Product Data: " << endl
- << " type: " << data.type << endl
- << " vendor: " << data.vendor << endl
- << " name: " << data.name << endl
- << " display name: " << data.summary << endl
- << " short name: " << data.short_name << endl
- << " description: " << data.description << endl
- << " epoch: " << data.epoch << endl
- << " version: " << data.ver << endl
- << " release: " << data.rel << endl
- << " provides: " << data.provides << endl
- << " conflicts: " << data.conflicts << endl
- << " obsoletes: " << data.obsoletes << endl
- << " freshens: " << data.freshens << endl
- << " requires: " << data.requires << endl
- << " recommends:" << endl << data.recommends << endl
- << " suggests:" << endl << data.suggests << endl
- << " supplements:" << endl << data.supplements << endl
- << " enhances:" << endl << data.enhances << endl;
- return out;
-}
-
-std::ostream& operator<<(std::ostream& out, const zypp::shared_ptr<YUMPatchAtom> data)
-{
- out << "Atom data" << endl;
- switch (data->atomType())
- {
- case YUMPatchAtom::Package:
- out << " atom type: " << "package" << endl
- << *zypp::dynamic_pointer_cast<YUMPatchPackage>(data);
- break;
- case YUMPatchAtom::Message:
- out << " atom type: " << "message" << endl
- << *zypp::dynamic_pointer_cast<YUMPatchMessage>(data);
- break;
- case YUMPatchAtom::Script:
- out << " atom type: " << "script" << endl
- << *zypp::dynamic_pointer_cast<YUMPatchScript>(data);
- break;
- default:
- out << "Unknown atom type" << endl;
- }
- return out;
-}
-
-std::ostream& operator<<(std::ostream& out, const YUMPatchMessage& data)
-{
- out << "Message Data: " << endl
- << " name: " << data.name << endl
- << " epoch: " << data.epoch << endl
- << " version: " << data.ver << endl
- << " release: " << data.rel << endl
- << " provides: " << data.provides << endl
- << " conflicts: " << data.conflicts << endl
- << " obsoletes: " << data.obsoletes << endl
- << " freshens: " << data.freshens << endl
- << " requires: " << data.requires << endl
- << " recommends:" << endl << data.recommends << endl
- << " suggests:" << endl << data.suggests << endl
- << " supplements:" << endl << data.supplements << endl
- << " enhances:" << endl << data.enhances << endl
- << " text: " << data.text << endl;
- return out;
-}
-
-std::ostream& operator<<(std::ostream& out, const YUMPatchScript& data)
-{
- out << "Script Data: " << endl
- << " name: " << data.name << endl
- << " epoch: " << data.epoch << endl
- << " version: " << data.ver << endl
- << " release: " << data.rel << endl
- << " provides: " << data.provides << endl
- << " conflicts: " << data.conflicts << endl
- << " obsoletes: " << data.obsoletes << endl
- << " freshens: " << data.freshens << endl
- << " requires: " << data.requires << endl
- << " recommends:" << endl << data.recommends << endl
- << " suggests:" << endl << data.suggests << endl
- << " supplements:" << endl << data.supplements << endl
- << " enhances:" << endl << data.enhances << endl
- << " do script: " << data.do_script << endl
- << " undo script: " << data.undo_script << endl
- << " do script location: " << data.do_location << endl
- << " undo script location: " << data.undo_location << endl
- << " do script media: " << data.do_media << endl
- << " undo script media: " << data.undo_media << endl
- << " do checksum type: " << data.do_checksum_type << endl
- << " do checksum: " << data.do_checksum << endl
- << " undo checksum type: " << data.undo_checksum_type << endl
- << " undo checksum: " << data.undo_checksum << endl;
- return out;
-}
-
-std::ostream& operator<<(std::ostream& out, const YUMPatchPackage& data)
-{
- out << "Package Data: " << endl
- << " name: '" << data.name << "'" << endl
- << " type: '" << data.type << "'" << endl
- << " arch: '" << data.arch << "'" << endl
- << " ver: '" << data.ver << "'" << endl
- << " checksumType: '" << data.checksumType << "'" << endl
- << " checksumPkgid: '" << data.checksumPkgid << "'" << endl
- << " checksum: '" << data.checksum << "'" << endl
- << " summary: '" << data.summary << "'" << endl
- << " description: '" << data.description << "'" << endl
- << " packager: '" << data.packager << "'" << endl
- << " url: '" << data.url << "'" << endl
- << " timeFile: '" << data.timeFile << "'" << endl
- << " timeBuild: '" << data.timeBuild << "'" << endl
- << " sizePackage: '" << data.sizePackage << "'" << endl
- << " sizeInstalled: '" << data.sizeInstalled << "'" << endl
- << " sizeArchive: '" << data.sizeArchive << "'" << endl
- << " location: '" << data.location << "'" << endl
- << " license: '" << data.license << "'" << endl
- << " license to confirm:" << endl
- << data.license_to_confirm << endl
- << " vendor: '" << data.vendor << "'" << endl
- << " group: '" << data.group << "'" << endl
- << " buildhost: '" << data.buildhost << "'" << endl
- << " sourcerpm: '" << data.sourcerpm << "'" << endl
- << " headerStart: '" << data.headerStart << "'" << endl
- << " headerEnd: '" << data.headerEnd << "'" << endl
- << " provides:" << endl
- << data.provides << endl
- << " conflicts:" << endl
- << data.conflicts << endl
- << " obsoletes:" << endl
- << data.obsoletes << endl
- << " requires:" << endl
- << data.requires << endl
- << " recommends:" << endl
- << data.recommends << endl
- << " suggests:" << endl
- << data.suggests << endl
- << " supplements:" << endl
- << data.supplements << endl
- << " enhances:" << endl
- << data.enhances << endl
- << " files:" << endl
- << data.files << endl
- << " authors: " << join(data.authors,", ") << endl
- << " keywords: " << join(data.keywords,", ") << endl
- << " media: " << data.media << endl
- << " dirsizes: " << endl
- << data.dirSizes << endl
- << " freshens: " << endl
- << data.freshens << endl
- << " install-only: '" << data.installOnly << "'" << endl
- << " files:" << endl
- << data.files << endl
- << " Changelog:" << endl
- << data.changelog << endl
- << data.plainRpms
- << data.patchRpms
- << data.deltaRpms;
- return out;
-}
-
-std::ostream& operator<<(std::ostream& out, const YUMPlainRpm& data)
-{
- out << " Plain RPM:" << endl
- << " arch: " << data.arch << endl
- << " filename: " << data.filename << endl
- << " download size: " << data.downloadsize << endl
- << " MD5: " << data.md5sum << endl
- << " build time: " << data.buildtime << endl;
- return out;
-}
-
-std::ostream& operator<<(std::ostream& out, const YUMEdition& data)
-{
- out << " epoch: " << data.epoch << endl
- << " version: " << data.ver << endl
- << " release: " << data.rel << endl;
- return out;
-}
-
-std::ostream& operator<<(std::ostream& out, const YUMPatchBaseVersion& data)
-{
- out << " Patch base version:" << endl
- << data.edition;
- return out;
-}
-
-std::ostream& operator<<(std::ostream& out, const YUMPatchRpm& data)
-{
- out << " Patch RPM:" << endl
- << " arch: " << data.arch << endl
- << " filename: " << data.filename << endl
- << " location: '" << data.location << "'" <<endl
- << " media: " << data.media << endl
- << " checksumType: '" << data.checksumType << "'" << endl
- << " checksum: '" << data.checksum << "'" << endl
- << " download size: " << data.downloadsize << endl
- << " MD5: " << data.md5sum << endl
- << " build time: " << data.buildtime << endl
- << data.baseVersions;
- return out;
-}
-
-std::ostream& operator<<(std::ostream& out, const YUMDeltaBaseVersion& data)
-{
- out << " Delta base version:" << endl
- << data.edition
- << " MD5: " << data.md5sum << endl
- << " build time: " << data.buildtime << endl
- << " sequence info: " << data.sequence_info << endl;
- return out;
-}
-
-std::ostream& operator<<(std::ostream& out, const YUMDeltaRpm& data)
-{
- out << " Delta RPM:" << endl
- << " arch: " << data.arch << endl
- << " filename: " << data.filename << endl
- << " location: '" << data.location << "'" <<endl
- << " media: " << data.media << endl
- << " checksumType: '" << data.checksumType << "'" << endl
- << " checksum: '" << data.checksum << "'" << endl
- << " download size: " << data.downloadsize << endl
- << " MD5: " << data.md5sum << endl
- << " build time: " << data.buildtime << endl
- << data.baseVersion << endl;
- return out;
-}
-
-} // namespace yum
-} // namespace parser
-} // namespace zypp
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMParserData.h
- *
- *
- * Purpose: Declares the various YUMData classes, which are rather dumb
- * structure-like classes that hold the data of specific YUM
- * repository files. The parsers (YUM...Parser) create these objects,
- * and the YUM installation source use them to build more
- * sophisticated objects.
-/-*/
-
-#ifndef YUMParserData_h
-#define YUMParserData_h
-
-#include "zypp/base/ReferenceCounted.h"
-#include "zypp/base/NonCopyable.h"
-#include "zypp/Pathname.h"
-#include "zypp/TranslatedText.h"
-#include <string>
-#include <list>
-#include <iosfwd>
-#include <zypp/base/PtrTypes.h>
-
-using namespace zypp::base;
-
-
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-DEFINE_PTR_TYPE( YUMRepomdData );
-DEFINE_PTR_TYPE( YUMPrimaryData );
-DEFINE_PTR_TYPE( YUMGroupData );
-DEFINE_PTR_TYPE( YUMPatternData );
-DEFINE_PTR_TYPE( YUMFileListData );
-DEFINE_PTR_TYPE( YUMOtherData );
-DEFINE_PTR_TYPE( YUMPatchData );
-DEFINE_PTR_TYPE( YUMPatchesData );
-DEFINE_PTR_TYPE( YUMProductData );
-DEFINE_PTR_TYPE( YUMPatchPackage );
-DEFINE_PTR_TYPE( YUMPatchScript );
-DEFINE_PTR_TYPE( YUMPatchMessage );
-
-/**
-* @short Holds dependency data
-*/
-class YUMDependency
-{
-public:
- YUMDependency();
- YUMDependency(const std::string& kind,
- const std::string& name,
- const std::string& flags,
- const std::string& epoch,
- const std::string& ver,
- const std::string& rel,
- const std::string& pre );
- YUMDependency(const std::string& kind,
- const std::string& encoded );
- bool isEncoded() const;
- std::string kind;
- std::string name;
- std::string flags;
- std::string epoch;
- std::string ver;
- std::string rel;
- std::string pre;
- // in case we only store the encoded string
- std::string encoded;
-};
-
-/**
-* @short Holds data about how much space will be needed per directory
-**/
-class YUMDirSize
-{
-public:
- YUMDirSize();
- YUMDirSize(const std::string& path,
- const std::string& size,
- const std::string& fileCount);
- const std::string path;
- const std::string sizeKByte;
- const std::string fileCount;
-};
-
-/**
- * @short Holds Data about file and file type
- * (directory, plain) within other YUM data
- **/
-class FileData
-{
-public:
- std::string name;
- std::string type;
- FileData();
- FileData(const std::string &name,
- const std::string &type);
-};
-
-/**
- * @short Defines "meta packages" that are in YUMGroupData
- * FIXME: I'm not certain what this is ;-)
- **/
-class MetaPkg
-{
-public:
- MetaPkg();
- MetaPkg(const std::string& type,
- const std::string& name);
- std::string type;
- std::string name;
-};
-
-/**
- * @short A Package reference, e.g. within YUMGroupData
- * this is without architecture.
- **/
-class PackageReq
-{
-public:
- PackageReq();
- PackageReq(const std::string& type,
- const std::string& epoch,
- const std::string& ver,
- const std::string& rel,
- const std::string& name);
- std::string type;
- std::string epoch;
- std::string ver;
- std::string rel;
- std::string name;
-};
-
-/**
-* @short A single changelog entry
-**/
-class ChangelogEntry
-{
-public:
- ChangelogEntry();
- ChangelogEntry(const std::string& author,
- const std::string& date,
- const std::string& entry);
- std::string author;
- std::string date;
- std::string entry;
-};
-
-class YUMObjectData : public base::ReferenceCounted, private base::NonCopyable
-{
-public:
-
- std::string name;
- std::string epoch;
- std::string ver;
- std::string rel;
- std::string arch;
- std::list<YUMDependency> provides;
- std::list<YUMDependency> conflicts;
- std::list<YUMDependency> obsoletes;
- std::list<YUMDependency> freshens;
- std::list<YUMDependency> requires;
- std::list<YUMDependency> prerequires;
- std::list<YUMDependency> recommends;
- std::list<YUMDependency> suggests;
- std::list<YUMDependency> supplements;
- std::list<YUMDependency> enhances;
-};
-
-class YUMPatchAtom : public YUMObjectData
-{
-public:
- enum AtomType { Package, Script, Message };
- virtual AtomType atomType() = 0;
-};
-
-class YUMPlainRpm
-{
-public:
- std::string arch;
- std::string filename;
- std::string downloadsize;
- std::string md5sum;
- std::string buildtime;
-};
-
-struct YUMEdition
-{
- std::string epoch;
- std::string ver;
- std::string rel;
-};
-std::ostream& operator<<(std::ostream& out, const YUMEdition& data);
-
-struct YUMPatchBaseVersion
-{
- YUMEdition edition;
-};
-std::ostream& operator<<(std::ostream& out, const YUMPatchBaseVersion& data);
-
-struct YUMPatchRpm
-{
- std::string arch;
- std::string filename;
- std::string downloadsize;
- std::string md5sum;
- std::string buildtime;
- std::list<YUMPatchBaseVersion> baseVersions;
- std::string checksumType;
- std::string checksum;
- std::string location;
- std::string media;
-};
-std::ostream& operator<<(std::ostream& out, const YUMPatchRpm& data);
-
-struct YUMDeltaBaseVersion
-{
- YUMEdition edition;
- std::string md5sum;
- std::string buildtime;
- std::string sequence_info;
-};
-std::ostream& operator<<(std::ostream& out, const YUMDeltaBaseVersion& data);
-
-struct YUMDeltaRpm
-{
- std::string arch;
- std::string filename;
- std::string downloadsize;
- std::string md5sum;
- std::string buildtime;
- YUMDeltaBaseVersion baseVersion;
- std::string checksumType;
- std::string checksum;
- std::string location;
- std::string media;
-};
-std::ostream& operator<<(std::ostream& out, const YUMDeltaRpm& data);
-
-
-
-class YUMPatchPackage : public YUMPatchAtom
-{
-public:
- YUMPatchPackage() : installOnly( false )
- {};
- virtual AtomType atomType()
- {
- return Package;
- };
- // data for primary
- std::string arch;
- std::string type;
- std::string checksumType;
- std::string checksumPkgid;
- std::string checksum;
- std::string summary;
- std::string description;
- std::string packager;
- std::string url;
- std::string timeFile;
- std::string timeBuild;
- std::string sizePackage;
- std::string sizeInstalled;
- std::string sizeArchive;
- std::string location;
- std::string license;
- TranslatedText license_to_confirm;
- std::string vendor;
- std::string group;
- std::string buildhost;
- std::string sourcerpm;
- std::string headerStart;
- std::string headerEnd;
- std::list<FileData> files;
- // SuSE specific data
- std::list<std::string> authors;
- std::list<std::string> keywords;
- std::string media;
- std::list<YUMDirSize> dirSizes;
- bool installOnly;
- // Change Log
- std::list<ChangelogEntry> changelog;
- // Package Files
- std::list<YUMPlainRpm> plainRpms;
- std::list<YUMPatchRpm> patchRpms;
- std::list<YUMDeltaRpm> deltaRpms;
-};
-
-class YUMPatchScript : public YUMPatchAtom
-{
-public:
- YUMPatchScript()
- {};
- virtual AtomType atomType()
- {
- return Script;
- };
- std::string do_script;
- std::string undo_script;
- std::string do_location;
- std::string undo_location;
- std::string do_media;
- std::string undo_media;
- std::string do_checksum_type;
- std::string do_checksum;
- std::string undo_checksum_type;
- std::string undo_checksum;
-};
-
-class YUMPatchMessage : public YUMPatchAtom
-{
-public:
- YUMPatchMessage()
- {};
- virtual AtomType atomType()
- {
- return Message;
- };
- TranslatedText text;
-};
-
-
-/**
- * @short Holds the metadata about a YUM repository
- **/
-class YUMRepomdData : public base::ReferenceCounted, private base::NonCopyable
-{
-public:
- YUMRepomdData();
- std::string type;
- std::string location;
- std::string checksumType;
- std::string checksum;
- std::string timestamp;
- std::string openChecksumType;
- std::string openChecksum;
-};
-
-/**
- * @short Describes a package in a YUM repository
- **/
-class YUMPrimaryData : public YUMObjectData
-{
-public:
- YUMPrimaryData();
- std::string type;
- std::string arch;
- std::string checksumType;
- std::string checksumPkgid;
- std::string checksum;
- std::string summary;
- std::string description;
- std::string packager;
- std::string url;
- std::string timeFile;
- std::string timeBuild;
- std::string sizePackage;
- std::string sizeInstalled;
- std::string sizeArchive;
- Pathname location;
- std::string license;
- std::string vendor;
- std::string group;
- std::string buildhost;
- std::string sourcerpm;
- std::string headerStart;
- std::string headerEnd;
- std::list<FileData> files;
-
- // SuSE specific data
- std::list<std::string> authors;
- std::list<std::string> keywords;
- std::string media;
- std::list<YUMDirSize> dirSizes;
- bool installOnly;
- TranslatedText license_to_confirm;
-};
-
-/**
-* @short Describes the groups in a YUM repository
-**/
-
-class YUMGroupData : public base::ReferenceCounted, private base::NonCopyable
-{
-public:
-
- YUMGroupData();
- std::string groupId;
- TranslatedText name;
- std::string default_;
- std::string userVisible;
- TranslatedText description;
- std::list<MetaPkg> grouplist;
- std::list<PackageReq> packageList;
-};
-
-/**
-* @short Describes the patterns in a YUM repository
-**/
-
-class YUMPatternData : public YUMObjectData
-{
-public:
-
- YUMPatternData();
- std::string name;
- std::string epoch;
- std::string ver;
- std::string rel;
- std::string arch;
- TranslatedText summary;
- std::string default_;
- std::string userVisible;
- TranslatedText description;
- TranslatedText category;
- std::string icon;
- std::string script;
-};
-
-/**
- * @short Contains the file list for a YUM package.
- **/
-class YUMFileListData : public base::ReferenceCounted, private base::NonCopyable
-{
-public:
-
- YUMFileListData();
-
- std::string pkgId;
- std::string name;
- std::string arch;
- std::string epoch;
- std::string ver;
- std::string rel;
- std::list<FileData> files;
-};
-
-/**
-* @short Data from other.mxl, i.e., changelogs
-**/
-class YUMOtherData : public base::ReferenceCounted, private base::NonCopyable
-{
-public:
- YUMOtherData();
- std::string pkgId;
- std::string name;
- std::string arch;
- std::string epoch;
- std::string ver;
- std::string rel;
- std::list<ChangelogEntry> changelog;
-};
-
-/* ** YUMPatchData not yet finalized **/
-
-class YUMPatchData : public YUMObjectData
-{
-public:
- YUMPatchData();
- ~YUMPatchData()
- {
- }
-
- std::string patchId;
- std::string timestamp;
- std::string engine;
- TranslatedText summary;
- TranslatedText description;
- TranslatedText license_to_confirm;
- std::string category;
- bool rebootNeeded;
- bool packageManager;
- std::string updateScript;
- std::list<shared_ptr<YUMPatchAtom> > atoms;
-};
-
-class YUMPatchesData : public base::ReferenceCounted, private base::NonCopyable
-{
-public:
- YUMPatchesData()
- {};
- ~YUMPatchesData()
- {};
-
- std::string location;
- std::string id;
- std::string checksumType;
- std::string checksum;
-};
-
-class YUMProductData : public YUMObjectData
-{
-public:
- YUMProductData()
- {};
- ~YUMProductData()
- {};
-
- std::string type;
- std::string vendor;
- std::string name;
- TranslatedText summary;
- TranslatedText description;
- TranslatedText short_name;
- // those are suse specific tags
- std::string distribution_name;
- std::string distribution_edition;
- std::string releasenotesurl;
-};
-
-/* Easy output (\todo move to class decl.) */
-std::ostream& operator<<(std::ostream &out, const YUMDependency& data);
-std::ostream& operator<<(std::ostream &out, const YUMDirSize& data);
-std::ostream& operator<<(std::ostream &out, const YUMRepomdData& data);
-std::ostream& operator<<(std::ostream &out, const FileData& data);
-std::ostream& operator<<(std::ostream &out, const MetaPkg& data);
-std::ostream& operator<<(std::ostream &out, const PackageReq& data);
-std::ostream& operator<<(std::ostream &out, const ChangelogEntry& data);
-std::ostream& operator<<(std::ostream &out, const YUMRepomdData& data);
-std::ostream& operator<<(std::ostream &out, const YUMPrimaryData& data);
-std::ostream& operator<<(std::ostream &out, const YUMGroupData& data);
-std::ostream& operator<<(std::ostream &out, const YUMPatternData& data);
-std::ostream& operator<<(std::ostream &out, const YUMFileListData& data);
-std::ostream& operator<<(std::ostream& out, const YUMOtherData& data);
-std::ostream& operator<<(std::ostream& out, const YUMPatchData& data);
-std::ostream& operator<<(std::ostream& out, const YUMPatchesData& data);
-std::ostream& operator<<(std::ostream& out, const YUMProductData& data);
-std::ostream& operator<<(std::ostream& out, const zypp::shared_ptr<YUMPatchAtom> data);
-std::ostream& operator<<(std::ostream& out, const YUMPatchMessage& data);
-std::ostream& operator<<(std::ostream& out, const YUMPatchScript& data);
-std::ostream& operator<<(std::ostream& out, const YUMPatchPackage& data);
-std::ostream& operator<<(std::ostream& out, const YUMPlainRpm& data);
-
-} // namespace yum
-} // namespace parser
-} // namespace zypp
-
-
-
-
-
-
-#endif
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMPatchParser.cc
- *
-*/
-
-#include <zypp/parser/yum/YUMPatchParser.h>
-#include <zypp/parser/yum/YUMPrimaryParser.h>
-#include <istream>
-#include <string>
-#include "zypp/parser/xml_parser_assert.h"
-#include <libxml/xmlreader.h>
-#include <libxml/tree.h>
-#include <zypp/parser/LibXMLHelper.h>
-#include <zypp/base/Logger.h>
-#include <zypp/parser/yum/schemanames.h>
-#include <zypp/ZYppFactory.h>
-
-using namespace std;
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-YUMPatchParser::~YUMPatchParser()
-{ }
-
-YUMPatchParser::YUMPatchParser(std::istream &is, const std::string& baseUrl, parser::ParserProgress::Ptr progress )
- : XMLNodeIterator<YUMPatchData_Ptr>(is, baseUrl,PATCHSCHEMA, progress)
- , _zypp_architecture( getZYpp()->architecture() )
-{
- fetchNext();
-}
-
-YUMPatchParser::YUMPatchParser()
- : _zypp_architecture( getZYpp()->architecture() )
-{ }
-
-YUMPatchParser::YUMPatchParser(YUMPatchData_Ptr& entry)
- : XMLNodeIterator<YUMPatchData_Ptr>(entry)
- , _zypp_architecture( getZYpp()->architecture() )
-{ }
-
-
-// select for which elements process() will be called
-bool
-YUMPatchParser::isInterested(const xmlNodePtr nodePtr)
-{
- return _helper.isElement(nodePtr) && _helper.name(nodePtr) == "patch";
-}
-
-// do the actual processing
-YUMPatchData_Ptr
-YUMPatchParser::process(const xmlTextReaderPtr reader)
-{
- xml_assert(reader);
- YUMPatchData_Ptr patchPtr = new YUMPatchData;
- xmlNodePtr dataNode = xmlTextReaderExpand(reader);
- xml_assert(dataNode);
- patchPtr->timestamp = _helper.attribute(dataNode,"timestamp");
- patchPtr->patchId = _helper.attribute(dataNode,"patchid");
- patchPtr->engine = _helper.attribute(dataNode,"engine");
-
- // default values for optional entries
- patchPtr->rebootNeeded = false;
- patchPtr->packageManager = false;
-
- // FIXME move the respective method to a common class, inherit it
- YUMPrimaryParser prim;
-
- for (xmlNodePtr child = dataNode->children;
- child && child != dataNode;
- child = child->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "name")
- {
- patchPtr->name = _helper.content(child);
- }
- else if (name == "arch")
- {
- patchPtr->arch = _helper.content(child);
- try
- {
- if (!Arch(patchPtr->arch).compatibleWith( _zypp_architecture ))
- {
- patchPtr = NULL; // skip <patch>, incompatible architecture
- break;
- }
- }
- catch ( const Exception & excpt_r )
- {
- ZYPP_CAUGHT( excpt_r );
- DBG << "Skipping malformed " << patchPtr->arch << endl;
- patchPtr = NULL;
- break;
- }
- }
- else if (name == "summary")
- {
- patchPtr->summary.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
- }
- else if (name == "description")
- {
- patchPtr->description.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
- }
- else if (name == "license-to-confirm")
- {
- patchPtr->license_to_confirm.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
- }
- else if (name == "version")
- {
- patchPtr->epoch = _helper.attribute(child,"epoch");
- patchPtr->ver = _helper.attribute(child,"ver");
- patchPtr->rel = _helper.attribute(child,"rel");
- }
- else if (name == "provides")
- {
- prim.parseDependencyEntries(& patchPtr->provides, child);
- }
- else if (name == "conflicts")
- {
- prim.parseDependencyEntries(& patchPtr->conflicts, child);
- }
- else if (name == "obsoletes")
- {
- prim.parseDependencyEntries(& patchPtr->obsoletes, child);
- }
- else if (name == "prerequires")
- {
- prim.parseDependencyEntries(& patchPtr->prerequires, child);
- }
- else if (name == "requires")
- {
- prim.parseDependencyEntries(& patchPtr->requires, child);
- }
- else if (name == "recommends")
- {
- prim.parseDependencyEntries(& patchPtr->recommends, child);
- }
- else if (name == "suggests")
- {
- prim.parseDependencyEntries(& patchPtr->suggests, child);
- }
- else if (name == "supplements")
- {
- prim.parseDependencyEntries(& patchPtr->supplements, child);
- }
- else if (name == "enhances")
- {
- prim.parseDependencyEntries(& patchPtr->enhances, child);
- }
- else if (name == "freshens")
- {
- prim.parseDependencyEntries(& patchPtr->freshens, child);
- }
- else if (name == "category")
- {
- patchPtr->category = _helper.content(child);
- }
- else if (name == "reboot-needed")
- {
- patchPtr->rebootNeeded = true;
- }
- else if (name == "package-manager")
- {
- patchPtr->packageManager = true;
- }
- else if (name == "update-script")
- {
- patchPtr->updateScript = _helper.content(child);
- }
- else if (name == "atoms")
- {
- parseAtomsNode(patchPtr, child);
- }
- else
- {
- WAR << "YUM <data> contains the unknown element <" << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
- return patchPtr;
-} /* end process */
-
-
-void
-YUMPatchParser::parseAtomsNode(YUMPatchData_Ptr dataPtr,
- xmlNodePtr formatNode)
-{
- xml_assert(formatNode);
- for (xmlNodePtr child = formatNode->children;
- child != 0;
- child = child ->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- XXX << "parseAtomsNode(" << name << ")" << endl;
- if (name == "package")
- {
- parsePackageNode( dataPtr, child );
- }
- else if (name == "script")
- {
- parseScriptNode( dataPtr, child );
- }
- else if (name == "message")
- {
- parseMessageNode( dataPtr, child );
- }
- else
- {
- WAR << "YUM <atoms> contains the unknown element <" << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
-}
-
-void
-YUMPatchParser::parseFormatNode(YUMPatchPackage *dataPtr,
- xmlNodePtr formatNode)
-{
- xml_assert(formatNode);
- dataPtr->installOnly = false;
-
- // FIXME move the respective method to a common class, inherit it
- YUMPrimaryParser prim;
-
- for (xmlNodePtr child = formatNode->children;
- child != 0;
- child = child ->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "license")
- {
- dataPtr->license = _helper.content(child);
- }
- else if (name == "vendor")
- {
- dataPtr->vendor = _helper.content(child);
- }
- else if (name == "group")
- {
- dataPtr->group = _helper.content(child);
- }
- else if (name == "buildhost")
- {
- dataPtr->buildhost = _helper.content(child);
- }
- else if (name == "sourcerpm")
- {
- dataPtr->sourcerpm = _helper.content(child);
- }
- else if (name == "header-range")
- {
- dataPtr->headerStart = _helper.attribute(child,"start");
- dataPtr->headerEnd = _helper.attribute(child,"end");
- }
- else if (name == "provides")
- {
- prim.parseDependencyEntries(& dataPtr->provides, child);
- }
- else if (name == "conflicts")
- {
- prim.parseDependencyEntries(& dataPtr->conflicts, child);
- }
- else if (name == "obsoletes")
- {
- prim.parseDependencyEntries(& dataPtr->obsoletes, child);
- }
- else if (name == "prerequires")
- {
- prim.parseDependencyEntries(& dataPtr->prerequires, child);
- }
- else if (name == "requires")
- {
- prim.parseDependencyEntries(& dataPtr->requires, child);
- }
- else if (name == "recommends")
- {
- prim.parseDependencyEntries(& dataPtr->recommends, child);
- }
- else if (name == "suggests")
- {
- prim.parseDependencyEntries(& dataPtr->suggests, child);
- }
- else if (name == "supplements")
- {
- prim.parseDependencyEntries(& dataPtr->supplements, child);
- }
- else if (name == "enhances")
- {
- prim.parseDependencyEntries(& dataPtr->enhances, child);
- }
- else if (name == "file")
- {
- dataPtr->files.push_back
- (FileData(_helper.content(child),
- _helper.attribute(child,"type")));
- }
- /* SUSE specific elements */
- else if (name == "authors")
- {
- prim.parseAuthorEntries(& dataPtr->authors, child);
- }
- else if (name == "keywords")
- {
- prim.parseKeywordEntries(& dataPtr->keywords, child);
- }
- else if (name == "dirsizes")
- {
- prim.parseDirsizeEntries(& dataPtr->dirSizes, child);
- }
- else if (name == "freshens")
- {
- prim.parseDependencyEntries(& dataPtr->freshens, child);
- }
- else if (name == "install-only")
- {
- dataPtr->installOnly = true;
- }
- else
- {
- WAR << "YUM <atom/package/format> contains the unknown element <"
- << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
-}
-
-void
-YUMPatchParser::parsePkgPlainRpmNode(YUMPatchPackage *dataPtr,
- xmlNodePtr formatNode)
-{
- YUMPlainRpm plainRpm;
- plainRpm.arch = _helper.attribute( formatNode, "arch" );
- plainRpm.filename = _helper.attribute( formatNode, "filename" );
- plainRpm.downloadsize = _helper.attribute( formatNode, "downloadsize" );
- plainRpm.md5sum = _helper.attribute( formatNode, "md5sum" );
- plainRpm.buildtime = _helper.attribute( formatNode, "buildtime" );
- for (xmlNodePtr child = formatNode->children;
- child != 0;
- child = child ->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- WAR << "YUM <atom/package/pkgfiles/plain> contains the unknown element <"
- << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- dataPtr->plainRpms.push_back(plainRpm);
-}
-
-void
-YUMPatchParser::parsePkgPatchRpmNode(YUMPatchPackage *dataPtr,
- xmlNodePtr formatNode)
-{
- YUMPatchRpm patchRpm;
- patchRpm.arch = _helper.attribute( formatNode, "arch" );
- patchRpm.filename = _helper.attribute( formatNode, "filename" );
- patchRpm.downloadsize = _helper.attribute( formatNode, "downloadsize" );
- patchRpm.md5sum = _helper.attribute( formatNode, "md5sum" );
- patchRpm.buildtime = _helper.attribute( formatNode, "buildtime" );
- patchRpm.media = "1";
- for (xmlNodePtr child = formatNode->children;
- child != 0;
- child = child ->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "base-version")
- {
- YUMPatchBaseVersion base_version;
- parsePkgPatchBaseVersionNode( &base_version, child);
- patchRpm.baseVersions.push_back( base_version );
- }
- else if (name == "location")
- {
- patchRpm.location = _helper.attribute(child,"href");
- patchRpm.media = _helper.attribute(child,"base","#1");
- int pos = patchRpm.media.find("#");
- if (pos > 0)
- patchRpm.media = patchRpm.media.substr(pos + 1);
- }
- else if (name == "media")
- {
- patchRpm.media = _helper.content(child);
- }
- else if (name == "checksum")
- {
- patchRpm.checksumType = _helper.attribute(child,"type");
- patchRpm.checksum = _helper.content(child);
- }
- else if (name == "time")
- {
- patchRpm.buildtime = _helper.attribute(child,"build");
- }
- else if (name == "size")
- {
- patchRpm.downloadsize = _helper.attribute(child,"package");
- }
- else
- {
- WAR << "YUM <atom/package/pkgfiles/patch> contains the unknown element <"
- << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
- dataPtr->patchRpms.push_back(patchRpm);
-}
-
-void
-YUMPatchParser::parsePkgDeltaRpmNode(YUMPatchPackage *dataPtr,
- xmlNodePtr formatNode)
-{
- YUMDeltaRpm deltaRpm;
- deltaRpm.arch = _helper.attribute( formatNode, "arch" );
- deltaRpm.filename = _helper.attribute( formatNode, "filename" );
- deltaRpm.downloadsize = _helper.attribute( formatNode, "downloadsize" );
- deltaRpm.md5sum = _helper.attribute( formatNode, "md5sum" );
- deltaRpm.buildtime = _helper.attribute( formatNode, "buildtime" );
- deltaRpm.media = "1";
- for (xmlNodePtr child = formatNode->children;
- child != 0;
- child = child ->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "base-version")
- {
- parsePkgDeltaBaseVersionNode( &(deltaRpm.baseVersion), child);
- }
- else if (name == "location")
- {
- deltaRpm.location = _helper.attribute(child,"href");
- deltaRpm.media = _helper.attribute(child,"base","#1");
- int pos = deltaRpm.media.find("#");
- if (pos > 0)
- deltaRpm.media = deltaRpm.media.substr(pos + 1);
- }
- else if (name == "media")
- {
- deltaRpm.media = _helper.content(child);
- }
- else if (name == "checksum")
- {
- deltaRpm.checksumType = _helper.attribute(child,"type");
- deltaRpm.checksum = _helper.content(child);
- }
- else if (name == "time")
- {
- deltaRpm.buildtime = _helper.attribute(child,"build");
- }
- else if (name == "size")
- {
- deltaRpm.downloadsize = _helper.attribute(child,"package");
- }
- else
- {
- WAR << "YUM <atom/package/pkgfiles/delta> contains the unknown element <"
- << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
- dataPtr->deltaRpms.push_back(deltaRpm);
-}
-
-
-void
-YUMPatchParser::parsePkgPatchBaseVersionNode(YUMPatchBaseVersion *dataPtr,
- xmlNodePtr formatNode)
-{
- dataPtr->edition.epoch = _helper.attribute( formatNode, "epoch" );
- dataPtr->edition.ver = _helper.attribute( formatNode, "ver" );
- dataPtr->edition.rel = _helper.attribute( formatNode, "rel" );
-}
-
-void
-YUMPatchParser::parsePkgDeltaBaseVersionNode(YUMDeltaBaseVersion *dataPtr,
- xmlNodePtr formatNode)
-{
- dataPtr->edition.epoch = _helper.attribute( formatNode, "epoch" );
- dataPtr->edition.ver = _helper.attribute( formatNode, "ver" );
- dataPtr->edition.rel = _helper.attribute( formatNode, "rel" );
- dataPtr->md5sum = _helper.attribute( formatNode, "md5sum" );
- dataPtr->buildtime = _helper.attribute( formatNode, "buildtime" );
- dataPtr->sequence_info = _helper.attribute( formatNode, "sequence_info" );
-}
-
-void
-YUMPatchParser::parsePkgFilesNode(YUMPatchPackage *dataPtr,
- xmlNodePtr formatNode)
-{
- for (xmlNodePtr child = formatNode->children;
- child != 0;
- child = child ->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "plainrpm")
- {
- parsePkgPlainRpmNode( dataPtr, child );
- }
- else if (name == "patchrpm")
- {
- parsePkgPatchRpmNode( dataPtr, child );
- }
- else if (name == "deltarpm")
- {
- parsePkgDeltaRpmNode( dataPtr, child );
- }
- else
- {
- WAR << "YUM <atom/package/pkgfiles> contains the unknown element <"
- << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
-}
-
-
-
-
-
-
-void
-YUMPatchParser::parsePackageNode(YUMPatchData_Ptr dataPtr,
- xmlNodePtr formatNode)
-{
- shared_ptr<YUMPatchPackage> package(new YUMPatchPackage);
- package->type = _helper.attribute(formatNode,"type");
- package->installOnly = false;
- package->media = "1";
-
- // FIXME move the respective method to a common class, inherit it
- YUMPrimaryParser prim;
-
- for (xmlNodePtr child = formatNode->children;
- child != 0;
- child = child ->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- XXX << "parsePackageNode(" << name << ")" << endl;
- if (name == "name")
- {
- package->name = _helper.content(child);
- }
- else if (name == "arch")
- {
- package->arch = _helper.content(child);
- }
- else if (name == "version")
- {
- package->epoch = _helper.attribute(child,"epoch");
- package->ver = _helper.attribute(child,"ver");
- package->rel = _helper.attribute(child,"rel");
- }
- else if (name == "checksum")
- {
- package->checksumType = _helper.attribute(child,"type");
- package->checksumPkgid = _helper.attribute(child,"pkgid");
- package->checksum = _helper.content(child);
- }
- else if (name == "summary")
- {
- package->summary = _helper.content(child);
- }
- else if (name == "description")
- {
- package->description = _helper.content(child);
- }
- else if (name == "packager")
- {
- package->packager = _helper.content(child);
- }
- else if (name == "url")
- {
- package->url = _helper.content(child);
- }
- else if (name == "time")
- {
- package->timeFile = _helper.attribute(child,"file");
- package->timeBuild = _helper.attribute(child,"build");
- }
- else if (name == "size")
- {
- package->sizePackage = _helper.attribute(child,"package");
- package->sizeInstalled = _helper.attribute(child,"installed");
- package->sizeArchive = _helper.attribute(child,"archive");
- }
- else if (name == "location")
- {
- package->location = _helper.attribute(child,"href");
- package->media = _helper.attribute(child,"base","#1");
- int pos = package->media.find("#");
- if (pos > 0)
- package->media = package->media.substr(pos + 1);
- }
- else if (name == "format")
- {
- parseFormatNode (&*package, child);
- }
- else if (name == "pkgfiles")
- {
- parsePkgFilesNode (&*package, child);
- }
- else if (name == "license-to-confirm")
- {
- package->license_to_confirm.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
- }
- else
- {
- WAR << "YUM <atoms/package> contains the unknown element <"
- << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
- dataPtr->atoms.push_back(package);
-}
-
-void
-YUMPatchParser::parseScriptNode(YUMPatchData_Ptr dataPtr,
- xmlNodePtr formatNode)
-{
- shared_ptr<YUMPatchScript> script(new YUMPatchScript);
- script->do_media = "1";
- script->undo_media = "1";
-
- // FIXME move the respective method to a common class, inherit it
- YUMPrimaryParser prim;
-
- for (xmlNodePtr child = formatNode->children;
- child != 0;
- child = child ->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "name")
- {
- script->name = _helper.content(child);
- }
- else if (name == "version")
- {
- script->epoch = _helper.attribute(child,"epoch");
- script->ver = _helper.attribute(child,"ver");
- script->rel = _helper.attribute(child,"rel");
- }
- else if (name == "do")
- {
- script->do_script = _helper.content(child);
- }
- else if (name == "undo")
- {
- script->undo_script = _helper.content(child);
- }
- else if (name == "do-location")
- {
- script->do_location = _helper.attribute(child,"href");
- script->do_media = _helper.attribute(child,"base","#1");
- int pos = script->do_media.find("#");
- if (pos > 0)
- script->do_media = script->do_media.substr(pos + 1);
- }
- else if (name == "undo-location")
- {
- script->undo_location = _helper.attribute(child,"href");
- script->undo_media = _helper.attribute(child,"base","#1");
- int pos = script->undo_media.find("#");
- if (pos > 0)
- script->undo_media = script->undo_media.substr(pos + 1);
- }
- else if (name == "do-checksum")
- {
- script->do_checksum_type = _helper.attribute(child,"type");
- script->do_checksum = _helper.content(child);
- }
- else if (name == "undo-checksum")
- {
- script->undo_checksum_type = _helper.attribute(child,"type");
- script->undo_checksum = _helper.content(child);
- }
- else if (name == "provides")
- {
- prim.parseDependencyEntries(& script->provides, child);
- }
- else if (name == "conflicts")
- {
- prim.parseDependencyEntries(& script->conflicts, child);
- }
- else if (name == "obsoletes")
- {
- prim.parseDependencyEntries(& script->obsoletes, child);
- }
- else if (name == "requires")
- {
- prim.parseDependencyEntries(& script->requires, child);
- }
- else if (name == "prerequires")
- {
- prim.parseDependencyEntries(& script->prerequires, child);
- }
- else if (name == "recommends")
- {
- prim.parseDependencyEntries(& script->recommends, child);
- }
- else if (name == "suggests")
- {
- prim.parseDependencyEntries(& script->suggests, child);
- }
- else if (name == "supplements")
- {
- prim.parseDependencyEntries(& script->supplements, child);
- }
- else if (name == "enhances")
- {
- prim.parseDependencyEntries(& script->enhances, child);
- }
- else if (name == "freshens")
- {
- prim.parseDependencyEntries(& script->freshens, child);
- }
- else
- {
- WAR << "YUM <atoms/script> contains the unknown element <"
- << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
- dataPtr->atoms.push_back(script);
-}
-
-void
-YUMPatchParser::parseMessageNode(YUMPatchData_Ptr dataPtr,
- xmlNodePtr formatNode)
-{
- shared_ptr<YUMPatchMessage> message(new YUMPatchMessage);
-
- // FIXME move the respective method to a common class, inherit it
- YUMPrimaryParser prim;
-
- for (xmlNodePtr child = formatNode->children;
- child != 0;
- child = child ->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "name")
- {
- message->name = _helper.content(child);
- }
- else if (name == "version")
- {
- message->epoch = _helper.attribute(child,"epoch");
- message->ver = _helper.attribute(child,"ver");
- message->rel = _helper.attribute(child,"rel");
- }
- else if (name == "text")
- {
- message->text.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
- }
- else if (name == "provides")
- {
- prim.parseDependencyEntries(& message->provides, child);
- }
- else if (name == "conflicts")
- {
- prim.parseDependencyEntries(& message->conflicts, child);
- }
- else if (name == "obsoletes")
- {
- prim.parseDependencyEntries(& message->obsoletes, child);
- }
- else if (name == "prerequires")
- {
- prim.parseDependencyEntries(& message->prerequires, child);
- }
- else if (name == "requires")
- {
- prim.parseDependencyEntries(& message->requires, child);
- }
- else if (name == "recommends")
- {
- prim.parseDependencyEntries(& message->recommends, child);
- }
- else if (name == "suggests")
- {
- prim.parseDependencyEntries(& message->suggests, child);
- }
- else if (name == "supplements")
- {
- prim.parseDependencyEntries(& message->supplements, child);
- }
- else if (name == "enhances")
- {
- prim.parseDependencyEntries(& message->enhances, child);
- }
- else if (name == "freshens")
- {
- prim.parseDependencyEntries(& message->freshens, child);
- }
- else
- {
- WAR << "YUM <atoms/message> contains the unknown element <"
- << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
- dataPtr->atoms.push_back(message);
-}
-
-} // namespace yum
-} // namespace parser
-} // namespace zypp
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMPatchParser.h
- *
-*/
-
-
-
-#ifndef YUMPatchParser_h
-#define YUMPatchParser_h
-
-#include <zypp/parser/yum/YUMParserData.h>
-#include <zypp/parser/XMLNodeIterator.h>
-#include <zypp/parser/LibXMLHelper.h>
-#include <zypp/Arch.h>
-#include <list>
-
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-/**
-* @short Parser for YUM primary.xml files (containing package metadata)
-* Use this class as an iterator that produces, one after one,
-* YUMPatchData_Ptr(s) for the XML package elements in the input.
-* Here's an example:
-*
-* for (YUMPatchParser iter(anIstream, baseUrl),
-* iter != YUMOtherParser.end(), // or: iter() != 0, or ! iter.atEnd()
-* ++iter) {
-* doSomething(*iter)
-* }
-*
-* The iterator owns the pointer (i.e., caller must not delete it)
-* until the next ++ operator is called. At this time, it will be
-* destroyed (and a new ENTRYTYPE is created.)
-*
-* If the input is fundamentally flawed so that it makes no sense to
-* continue parsing, XMLNodeIterator will log it and consider the input as finished.
-* You can query the exit status with errorStatus().
-*/
-class YUMPatchParser : public XMLNodeIterator<YUMPatchData_Ptr>
-{
-public:
- YUMPatchParser(std::istream &is, const std::string &baseUrl, parser::ParserProgress::Ptr progress = parser::ParserProgress::Ptr());
- YUMPatchParser();
- YUMPatchParser(YUMPatchData_Ptr& entry);
- virtual ~YUMPatchParser();
-
-private:
- virtual bool isInterested(const xmlNodePtr nodePtr);
- virtual YUMPatchData_Ptr process(const xmlTextReaderPtr reader);
- void parseAtomsNode(YUMPatchData_Ptr dataPtr, xmlNodePtr formatNode);
- void parsePackageNode(YUMPatchData_Ptr dataPtr, xmlNodePtr formatNode);
- void parseMessageNode(YUMPatchData_Ptr dataPtr, xmlNodePtr formatNode);
- void parseScriptNode(YUMPatchData_Ptr dataPtr, xmlNodePtr formatNode);
- void parseFormatNode(YUMPatchPackage *dataPtr, xmlNodePtr formatNode);
- void parsePkgFilesNode(YUMPatchPackage *dataPtr, xmlNodePtr formatNode);
- void parsePkgPlainRpmNode(YUMPatchPackage *dataPtr, xmlNodePtr formatNode);
- void parsePkgPatchRpmNode(YUMPatchPackage *dataPtr, xmlNodePtr formatNode);
- void parsePkgDeltaRpmNode(YUMPatchPackage *dataPtr, xmlNodePtr formatNode);
- void parsePkgPatchBaseVersionNode(YUMPatchBaseVersion *dataPtr, xmlNodePtr formatNode);
- void parsePkgDeltaBaseVersionNode(YUMDeltaBaseVersion *dataPtr, xmlNodePtr formatNode);
- LibXMLHelper _helper;
- Arch _zypp_architecture;
-};
-} // namespace yum
-} // namespace parser
-} // namespace zypp
-
-#endif
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMPatchesParser.cc
- *
-*/
-
-#include <zypp/parser/yum/YUMPatchesParser.h>
-#include <zypp/parser/yum/YUMPrimaryParser.h>
-#include <istream>
-#include <string>
-#include "zypp/parser/xml_parser_assert.h"
-#include <libxml/xmlreader.h>
-#include <libxml/tree.h>
-#include <zypp/parser/LibXMLHelper.h>
-#include <zypp/base/Logger.h>
-#include <zypp/parser/yum/schemanames.h>
-
-using namespace std;
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-YUMPatchesParser::~YUMPatchesParser()
-{ }
-
-YUMPatchesParser::YUMPatchesParser(std::istream &is, const std::string& baseUrl, parser::ParserProgress::Ptr progress )
- : XMLNodeIterator<YUMPatchesData_Ptr>(is, baseUrl,PATCHESSCHEMA, progress)
-{
- fetchNext();
-}
-
-YUMPatchesParser::YUMPatchesParser()
-{ }
-
-YUMPatchesParser::YUMPatchesParser(YUMPatchesData_Ptr& entry)
- : XMLNodeIterator<YUMPatchesData_Ptr>(entry)
-{ }
-
-
-// select for which elements process() will be called
-bool
-YUMPatchesParser::isInterested(const xmlNodePtr nodePtr)
-{
- return _helper.isElement(nodePtr) && _helper.name(nodePtr) == "patch";
-}
-
-// do the actual processing
-YUMPatchesData_Ptr
-YUMPatchesParser::process(const xmlTextReaderPtr reader)
-{
- xml_assert(reader);
- YUMPatchesData_Ptr patchPtr = new YUMPatchesData;
- xmlNodePtr dataNode = xmlTextReaderExpand(reader);
- xml_assert(dataNode);
-
- patchPtr->id = _helper.attribute(dataNode,"id");
-
- for (xmlNodePtr child = dataNode->children;
- child && child != dataNode;
- child = child->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "location")
- {
- patchPtr->location = _helper.attribute(child,"href");
- }
- else if (name == "checksum")
- {
- patchPtr->checksumType = _helper.attribute(child,"type");
- patchPtr->checksum = _helper.content(child);
- }
- else
- {
- WAR << "YUM <data> contains the unknown element <" << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
- return patchPtr;
-} /* end process */
-
-
-} // namespace yum
-} // namespace parser
-} // namespace zypp
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMPatchesParser.h
- *
-*/
-
-
-
-#ifndef YUMPatchesParser_h
-#define YUMPatchesParser_h
-
-#include <zypp/parser/yum/YUMParserData.h>
-#include <zypp/parser/XMLNodeIterator.h>
-#include <zypp/parser/LibXMLHelper.h>
-#include <list>
-
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-/**
-* @short Parser for YUM primary.xml files (containing package metadata)
-* Use this class as an iterator that produces, one after one,
-* YUMPatchesData_Ptr(s) for the XML package elements in the input.
-* Here's an example:
-*
-* for (YUMPatchesParser iter(anIstream, baseUrl),
-* iter != YUMOtherParser.end(), // or: iter() != 0, or ! iter.atEnd()
-* ++iter) {
-* doSomething(*iter)
-* }
-*
-* The iterator owns the pointer (i.e., caller must not delete it)
-* until the next ++ operator is called. At this time, it will be
-* destroyed (and a new ENTRYTYPE is created.)
-*
-* If the input is fundamentally flawed so that it makes no sense to
-* continue parsing, XMLNodeIterator will log it and consider the input as finished.
-* You can query the exit status with errorStatus().
-*/
-class YUMPatchesParser : public XMLNodeIterator<YUMPatchesData_Ptr>
-{
-public:
- YUMPatchesParser(std::istream &is, const std::string &baseUrl, parser::ParserProgress::Ptr progress = parser::ParserProgress::Ptr());
- YUMPatchesParser();
- YUMPatchesParser(YUMPatchesData_Ptr& entry);
- virtual ~YUMPatchesParser();
-
-private:
- virtual bool isInterested(const xmlNodePtr nodePtr);
- virtual YUMPatchesData_Ptr process(const xmlTextReaderPtr reader);
- LibXMLHelper _helper;
-};
-} // namespace yum
-} // namespace parser
-} // namespace zypp
-
-#endif
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMPatternParser.cc
- *
-*/
-
-#include <zypp/parser/yum/YUMPatternParser.h>
-#include <zypp/parser/yum/YUMPrimaryParser.h>
-#include <zypp/parser/LibXMLHelper.h>
-#include <istream>
-#include <string>
-#include "zypp/parser/xml_parser_assert.h"
-#include <libxml/xmlreader.h>
-#include <libxml/tree.h>
-#include <zypp/base/Logger.h>
-#include <zypp/parser/yum/schemanames.h>
-
-using namespace std;
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-YUMPatternParser::YUMPatternParser()
-{ }
-
-YUMPatternParser::YUMPatternParser(YUMPatternData_Ptr& entry)
- : XMLNodeIterator<YUMPatternData_Ptr>(entry)
-{ }
-
-
-YUMPatternParser::~YUMPatternParser()
-{ }
-
-
-// select for which elements process() will be called
-bool
-YUMPatternParser::isInterested(const xmlNodePtr nodePtr)
-{
- return _helper.isElement(nodePtr) && _helper.name(nodePtr) == "pattern";
-}
-
-// do the actual processing
-YUMPatternData_Ptr
-YUMPatternParser::process(const xmlTextReaderPtr reader)
-{
- xml_assert(reader);
- YUMPatternData_Ptr dataPtr = new YUMPatternData;
- xmlNodePtr dataNode = xmlTextReaderExpand(reader);
- xml_assert(dataNode);
-
- // FIXME move the respective method to a common class, inherit it
- YUMPrimaryParser prim;
-
- for (xmlNodePtr child = dataNode->children;
- child && child != dataNode;
- child = child->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "name")
- {
- dataPtr->name = _helper.content(child);
- }
- else if (name == "summary")
- {
- dataPtr->summary.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
- }
- else if (name == "default")
- {
- dataPtr->default_ = _helper.content(child);
- }
- else if (name == "uservisible")
- {
- dataPtr->userVisible = _helper.content(child);
- }
- else if (name == "description")
- {
- dataPtr->description.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
- }
- else if (name == "category")
- {
-#warning FIXME pattern category is translatable
- dataPtr->category.setText(_helper.content(child));
- }
- else if (name == "icon")
- {
- dataPtr->icon = _helper.content(child);
- }
- else if (name == "script")
- {
- dataPtr->script = _helper.content(child);
- }
- else if (name == "provides")
- {
- prim.parseDependencyEntries(& dataPtr->provides, child);
- }
- else if (name == "conflicts")
- {
- prim.parseDependencyEntries(& dataPtr->conflicts, child);
- }
- else if (name == "obsoletes")
- {
- prim.parseDependencyEntries(& dataPtr->obsoletes, child);
- }
- else if (name == "prerequires")
- {
- prim.parseDependencyEntries(& dataPtr->prerequires, child);
- }
- else if (name == "requires")
- {
- prim.parseDependencyEntries(& dataPtr->requires, child);
- }
- else if (name == "recommends")
- {
- prim.parseDependencyEntries(& dataPtr->recommends, child);
- }
- else if (name == "suggests")
- {
- prim.parseDependencyEntries(& dataPtr->suggests, child);
- }
- else if (name == "supplements")
- {
- prim.parseDependencyEntries(& dataPtr->supplements, child);
- }
- else if (name == "enhances")
- {
- prim.parseDependencyEntries(& dataPtr->enhances, child);
- }
- else if (name == "freshens")
- {
- prim.parseDependencyEntries(& dataPtr->freshens, child);
- }
- else
- {
- WAR << "YUM <pattern> contains the unknown element <" << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
- return dataPtr;
-} /* end process */
-
-
-YUMPatternParser::YUMPatternParser(std::istream &is, const std::string &baseUrl, parser::ParserProgress::Ptr progress )
- : XMLNodeIterator<YUMPatternData_Ptr>(is, baseUrl,PATTERNSCHEMA, progress)
-{
- fetchNext();
-}
-
-} // namespace yum
-} // namespace parser
-} // namespace zypp
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMPatternParser.h
- *
-*/
-
-
-
-#ifndef YUMPatternParser_h
-#define YUMPatternParser_h
-
-#include <zypp/parser/yum/YUMParserData.h>
-#include <zypp/parser/XMLNodeIterator.h>
-#include <zypp/parser/LibXMLHelper.h>
-#include <list>
-
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-/**
-*
-* @short Parser for YUM pattern files.
-*
-* Use this class as an iterator that produces, one after one,
-* YUMPatternData_Ptr(s) for the XML pattern elements.
-* Here's an example:
-*
-* for (YUMPatternParser iter(anIstream, baseUrl),
-* iter != YUMFileListParser.end(), // or: iter() != 0, or ! iter.atEnd()
-* ++iter) {
-* doSomething(*iter)
-* }
-*
-* The iterator owns the pointer (i.e., caller must not delete it)
-* until the next ++ operator is called. At this time, it will be
-* destroyed (and a new ENTRYTYPE is created.)
-*
-* If the input is fundamentally flawed so that it makes no sense to
-* continue parsing, XMLNodeIterator will log it and consider the input as finished.
-* You can query the exit status with errorStatus().
-*/
-class YUMPatternParser : public XMLNodeIterator<YUMPatternData_Ptr>
-{
-public:
- YUMPatternParser(std::istream &is, const std::string &baseUrl, parser::ParserProgress::Ptr progress = parser::ParserProgress::Ptr() );
- YUMPatternParser();
- YUMPatternParser(YUMPatternData_Ptr& entry);
- virtual ~YUMPatternParser();
-
-private:
- virtual bool isInterested(const xmlNodePtr nodePtr);
- virtual YUMPatternData_Ptr process(const xmlTextReaderPtr reader);
-
- LibXMLHelper _helper;
-};
-} // namespace yum
-} // namespace parser
-} // namespace zypp
-
-#endif
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMPrimaryParser.cc
- *
-*/
-
-#include <zypp/parser/yum/YUMPrimaryParser.h>
-#include <istream>
-#include <string>
-#include "zypp/parser/xml_parser_assert.h"
-#include <libxml/xmlstring.h>
-#include <libxml/xmlreader.h>
-#include <libxml/tree.h>
-#include <zypp/parser/LibXMLHelper.h>
-#include <zypp/base/Logger.h>
-#include <zypp/parser/yum/schemanames.h>
-#include <zypp/ZYppFactory.h>
-
-using namespace std;
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-
-YUMPrimaryParser::YUMPrimaryParser(std::istream &is, const std::string& baseUrl, parser::ParserProgress::Ptr progress )
- : XMLNodeIterator<YUMPrimaryData_Ptr>(is, baseUrl,PRIMARYSCHEMA, progress)
- , _zypp_architecture( getZYpp()->architecture() )
-{
- if (is.fail())
- {
- ERR << "Bad stream" << endl;
- }
- fetchNext();
-}
-
-YUMPrimaryParser::YUMPrimaryParser(const Pathname &filename, const std::string &baseUrl, parser::ParserProgress::Ptr progress )
- : XMLNodeIterator<YUMPrimaryData_Ptr>(filename, baseUrl,PRIMARYSCHEMA, progress)
- , _zypp_architecture( getZYpp()->architecture() )
-{
- fetchNext();
-}
-
-YUMPrimaryParser::YUMPrimaryParser()
- : _zypp_architecture( getZYpp()->architecture() )
-{ }
-
-YUMPrimaryParser::YUMPrimaryParser(YUMPrimaryData_Ptr& entry)
- : XMLNodeIterator<YUMPrimaryData_Ptr>(entry)
- , _zypp_architecture( getZYpp()->architecture() )
-{ }
-
-
-YUMPrimaryParser::~YUMPrimaryParser()
-{}
-
-
-
-
-// select for which elements process() will be called
-bool
-YUMPrimaryParser::isInterested(const xmlNodePtr nodePtr)
-{
- bool result = (_helper.isElement(nodePtr)
- && _helper.name(nodePtr) == "package");
- return result;
-}
-
-
-// do the actual processing
-YUMPrimaryData_Ptr
-YUMPrimaryParser::process(const xmlTextReaderPtr reader)
-{
- xml_assert(reader);
- YUMPrimaryData_Ptr dataPtr = new YUMPrimaryData;
- xmlNodePtr dataNode = xmlTextReaderExpand(reader);
- xml_assert(dataNode);
-
- dataPtr->type = _helper.attribute(dataNode,"type");
- dataPtr->installOnly = false;
- dataPtr->media = "1";
-
- for (xmlNodePtr child = dataNode->children;
- child != 0;
- child = child->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "name")
- {
- dataPtr->name = _helper.content(child);
- }
- else if (name == "arch")
- {
- dataPtr->arch = _helper.content(child);
- try
- {
- if (!Arch(dataPtr->arch).compatibleWith( _zypp_architecture ))
- {
- dataPtr = NULL; // skip <package>, incompatible architecture
- break;
- }
- }
- catch ( const Exception & excpt_r )
- {
- ZYPP_CAUGHT( excpt_r );
- DBG << "Skipping malformed " << dataPtr->arch << endl;
- dataPtr = NULL;
- break;
- }
- }
- else if (name == "version")
- {
- dataPtr->epoch = _helper.attribute(child,"epoch");
- dataPtr->ver = _helper.attribute(child,"ver");
- dataPtr->rel = _helper.attribute(child,"rel");
- }
- else if (name == "checksum")
- {
- dataPtr->checksumType = _helper.attribute(child,"type");
- dataPtr->checksumPkgid = _helper.attribute(child,"pkgid");
- dataPtr->checksum = _helper.content(child);
- }
- else if (name == "summary")
- {
- dataPtr->summary = _helper.content(child);
- }
- else if (name == "description")
- {
- dataPtr->description = _helper.content(child);
- }
- else if (name == "packager")
- {
- dataPtr->packager = _helper.content(child);
- }
- else if (name == "url")
- {
- dataPtr->url = _helper.content(child);
- }
- else if (name == "time")
- {
- dataPtr->timeFile = _helper.attribute(child,"file");
- dataPtr->timeBuild = _helper.attribute(child,"build");
- }
- else if (name == "size")
- {
- dataPtr->sizePackage = _helper.attribute(child,"package");
- dataPtr->sizeInstalled = _helper.attribute(child,"installed");
- dataPtr->sizeArchive = _helper.attribute(child,"archive");
- }
- else if (name == "location")
- {
- dataPtr->location = _helper.attribute(child,"href");
- dataPtr->media = _helper.attribute(child,"base","#1");
- int pos = dataPtr->media.find("#");
- if (pos > 0)
- dataPtr->media = dataPtr->media.substr(pos + 1);
- }
- else if (name == "format")
- {
- parseFormatNode(dataPtr, child);
- }
- else if (name == "license-to-confirm")
- {
- dataPtr->license_to_confirm.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
- }
- else
- {
- WAR << "YUM <metadata> contains the unknown element <" << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
- return dataPtr;
-} /* end process */
-
-
-
-void
-YUMPrimaryParser::parseFormatNode(YUMPrimaryData_Ptr dataPtr,
- xmlNodePtr formatNode)
-{
- if (dataPtr == NULL) return; // skipping
- xml_assert(formatNode);
- dataPtr->installOnly = false;
- for (xmlNodePtr child = formatNode->children;
- child != 0;
- child = child ->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "license")
- {
- dataPtr->license = _helper.content(child);
- }
- else if (name == "vendor")
- {
- dataPtr->vendor = _helper.content(child);
- }
- else if (name == "group")
- {
- dataPtr->group = _helper.content(child);
- }
- else if (name == "buildhost")
- {
- dataPtr->buildhost = _helper.content(child);
- }
- else if (name == "sourcerpm")
- {
- dataPtr->sourcerpm = _helper.content(child);
- }
- else if (name == "header-range")
- {
- dataPtr->headerStart = _helper.attribute(child,"start");
- dataPtr->headerEnd = _helper.attribute(child,"end");
- }
- else if (name == "provides")
- {
- parseDependencyEntries(& dataPtr->provides, child);
- }
- else if (name == "conflicts")
- {
- parseDependencyEntries(& dataPtr->conflicts, child);
- }
- else if (name == "obsoletes")
- {
- parseDependencyEntries(& dataPtr->obsoletes, child);
- }
- else if (name == "prerequires")
- {
- parseDependencyEntries(& dataPtr->prerequires, child);
- }
- else if (name == "requires")
- {
- parseDependencyEntries(& dataPtr->requires, child);
- }
- else if (name == "recommends")
- {
- parseDependencyEntries(& dataPtr->recommends, child);
- }
- else if (name == "suggests")
- {
- parseDependencyEntries(& dataPtr->suggests, child);
- }
- else if (name == "supplements")
- {
- parseDependencyEntries(& dataPtr->supplements, child);
- }
- else if (name == "enhances")
- {
- parseDependencyEntries(& dataPtr->enhances, child);
- }
- else if (name == "file")
- {
- dataPtr->files.push_back
- (FileData(_helper.content(child),
- _helper.attribute(child,"type")));
- }
- /* SUSE specific elements */
- else if (name == "authors")
- {
- parseAuthorEntries(& dataPtr->authors, child);
- }
- else if (name == "keywords")
- {
- parseKeywordEntries(& dataPtr->keywords, child);
- }
- else if (name == "dirsizes")
- {
- parseDirsizeEntries(& dataPtr->dirSizes, child);
- }
- else if (name == "freshens")
- {
- parseDependencyEntries(& dataPtr->freshens, child);
- }
- else if (name == "install-only")
- {
- dataPtr->installOnly = true;
- }
- else if (name == "license-to-confirm")
- {
- dataPtr->license_to_confirm.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
- }
- else
- {
- WAR << "YUM <format> contains the unknown element <" << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
-}
-
-
-void
-YUMPrimaryParser::parseDependencyEntries(std::list<YUMDependency> *depList,
- xmlNodePtr depNode)
-{
- xml_assert(depList);
- xml_assert(depNode);
-
- for (xmlNodePtr child = depNode->children;
- child != 0;
- child = child ->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- // we have 2 format for entries
- // For YUM repositories
- // <entry kind="package" name="foo" epoch="2" ver="3" rel="4" flags="LE"/>
- // The slightly modified YUM format the storage backend uses.
- // <capability kind="package" >foo-devel <= 3:4-5</capability>
-
- if (name == "entry")
- {
- if ( _helper.content(child).empty() )
- {
- depList->push_back
- (YUMDependency(_helper.attribute(child,"kind"),
- _helper.attribute(child,"name"),
- _helper.attribute(child,"flags"),
- _helper.attribute(child,"epoch"),
- _helper.attribute(child,"ver"),
- _helper.attribute(child,"rel"),
- _helper.attribute(child,"pre")));
- }
- else
- { // only for backward compat, before we renamed the tag to capability
- depList->push_back
- (YUMDependency(_helper.attribute(child,"kind"),
- _helper.content(child)));
- }
- }
- else if ( name == "capability" )
- {
- depList->push_back
- (YUMDependency(_helper.attribute(child,"kind"),
- _helper.content(child)));
- }
- else
- {
- WAR << "YUM dependency within <format> contains the unknown element <" << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
-}
-
-void
-YUMPrimaryParser::parseAuthorEntries(std::list<std::string> *authors,
- xmlNodePtr node)
-{
- xml_assert(authors);
- xml_assert(node);
-
- for (xmlNodePtr child = node->children;
- child != 0;
- child = child ->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "author")
- {
- authors->push_back(_helper.content(child));
- }
- else
- {
- WAR << "YUM <authors> contains the unknown element <" << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
-}
-
-void YUMPrimaryParser::parseKeywordEntries(std::list<std::string> *keywords,
- xmlNodePtr node)
-{
- xml_assert(keywords);
- xml_assert(node);
-
- for (xmlNodePtr child = node->children;
- child != 0;
- child = child ->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "keyword")
- {
- keywords->push_back(_helper.content(child));
- }
- else
- {
- WAR << "YUM <keywords> contains the unknown element <" << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
-}
-
-void YUMPrimaryParser::parseDirsizeEntries(std::list<YUMDirSize> *sizes,
- xmlNodePtr node)
-{
- xml_assert(sizes);
- xml_assert(node);
-
- for (xmlNodePtr child = node->children;
- child != 0;
- child = child ->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "dirsize")
- {
- sizes->push_back(YUMDirSize(_helper.attribute(child,"path"),
- _helper.attribute(child,"size-kbyte"),
- _helper.attribute(child,"filecount")));
- }
- else
- {
- WAR << "YUM <dirsizes> contains the unknown element <" << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
-}
-
-} // namespace yum
-} // namespace parser
-} // namespace zypp
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMPrimaryParser.h
- *
-*/
-
-
-
-#ifndef YUMPrimaryParser_h
-#define YUMPrimaryParser_h
-
-#include <zypp/parser/yum/YUMParserData.h>
-#include <zypp/parser/XMLNodeIterator.h>
-#include <zypp/parser/LibXMLHelper.h>
-#include <zypp/Arch.h>
-#include <list>
-
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-/**
-* @short Parser for YUM primary.xml files (containing package metadata)
-* Use this class as an iterator that produces, one after one,
-* YUMPrimaryData_Ptr(s) for the XML package elements in the input.
-* Here's an example:
-*
-* for (YUMPrimaryParser iter(anIstream, baseUrl),
-* iter != YUMOtherParser.end(), // or: iter() != 0, or ! iter.atEnd()
-* ++iter) {
-* doSomething(*iter)
-* }
-*
-* The iterator owns the pointer (i.e., caller must not delete it)
-* until the next ++ operator is called. At this time, it will be
-* destroyed (and a new ENTRYTYPE is created.)
-*
-* If the input is fundamentally flawed so that it makes no sense to
-* continue parsing, XMLNodeIterator will log it and consider the input as finished.
-* You can query the exit status with errorStatus().
-*/
-class YUMPrimaryParser : public XMLNodeIterator<YUMPrimaryData_Ptr>
-{
-public:
- YUMPrimaryParser(std::istream &is, const std::string &baseUrl, parser::ParserProgress::Ptr progress = parser::ParserProgress::Ptr() );
- YUMPrimaryParser(const Pathname &filename, const std::string &baseUrl, parser::ParserProgress::Ptr progress = parser::ParserProgress::Ptr() );
- YUMPrimaryParser();
- YUMPrimaryParser(YUMPrimaryData_Ptr& entry);
- virtual ~YUMPrimaryParser();
-
-private:
- // FIXME move needed method to a common class, inherit it
- friend class YUMPatchParser;
- friend class YUMProductParser;
- friend class YUMPatternParser;
- virtual bool isInterested(const xmlNodePtr nodePtr);
- virtual YUMPrimaryData_Ptr process(const xmlTextReaderPtr reader);
- void parseFormatNode(YUMPrimaryData_Ptr dataPtr,
- xmlNodePtr formatNode);
- void parseDependencyEntries(std::list<YUMDependency> *depList,
- xmlNodePtr depNode);
- void parseAuthorEntries(std::list<std::string> *authors,
- xmlNodePtr node);
- void parseKeywordEntries(std::list<std::string> *keywords,
- xmlNodePtr node);
- void parseDirsizeEntries(std::list<YUMDirSize> *sizes,
- xmlNodePtr node);
-
- LibXMLHelper _helper;
- Arch _zypp_architecture;
-};
-} // namespace yum
-} // namespace parser
-} // namespace zypp
-
-#endif
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMProductParser.cc
- *
-*/
-
-#include <istream>
-#include <string>
-#include "zypp/ZYppFactory.h"
-#include "zypp/ZYpp.h"
-#include "zypp/parser/xml_parser_assert.h"
-#include <libxml/xmlreader.h>
-#include <libxml/tree.h>
-#include "zypp/parser/yum/YUMProductParser.h"
-#include "zypp/parser/yum/YUMPrimaryParser.h"
-#include "zypp/parser/LibXMLHelper.h"
-#include "zypp/base/Logger.h"
-#include "zypp/parser/yum/schemanames.h"
-
-using namespace std;
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-YUMProductParser::~YUMProductParser()
-{ }
-
-YUMProductParser::YUMProductParser(std::istream &is, const std::string& baseUrl, parser::ParserProgress::Ptr progress )
- : XMLNodeIterator<YUMProductData_Ptr>(is, baseUrl,PRODUCTSCHEMA, progress)
- , _zypp_architecture( getZYpp()->architecture() )
-{
- fetchNext();
-}
-
-YUMProductParser::YUMProductParser()
- : _zypp_architecture( getZYpp()->architecture() )
-{ }
-
-YUMProductParser::YUMProductParser(YUMProductData_Ptr& entry)
- : XMLNodeIterator<YUMProductData_Ptr>(entry)
- , _zypp_architecture( getZYpp()->architecture() )
-{ }
-
-
-// select for which elements process() will be called
-bool
-YUMProductParser::isInterested(const xmlNodePtr nodePtr)
-{
- return _helper.isElement(nodePtr) && _helper.name(nodePtr) == "product";
-}
-
-// do the actual processing
-YUMProductData_Ptr
-YUMProductParser::process(const xmlTextReaderPtr reader)
-{
- xml_assert(reader);
- YUMProductData_Ptr productPtr = new YUMProductData;
- xmlNodePtr dataNode = xmlTextReaderExpand(reader);
- xml_assert(dataNode);
- productPtr->type = _helper.attribute(dataNode,"type");
-
- // FIXME move the respective method to a common class, inherit it
- YUMPrimaryParser prim;
-
- for (xmlNodePtr child = dataNode->children;
- child && child != dataNode;
- child = child->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "name")
- {
- productPtr->name = _helper.content(child);
- }
- else if (name == "arch")
- {
- productPtr->arch = _helper.content(child);
- try
- {
- if (!Arch(productPtr->arch).compatibleWith( _zypp_architecture ))
- {
- productPtr = NULL; // skip <package>, incompatible architecture
- break;
- }
- }
- catch ( const Exception & excpt_r )
- {
- ZYPP_CAUGHT( excpt_r );
- DBG << "Skipping malformed " << productPtr->arch << endl;
- productPtr = NULL;
- break;
- }
- }
- else if (name == "vendor")
- {
- productPtr->vendor = _helper.content(child);
- }
- else if (name == "release-notes-url")
- {
- productPtr->releasenotesurl = _helper.content(child);
- }
- else if (name == "displayname")
- {
- productPtr->summary.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
- }
- else if (name == "shortname")
- {
- productPtr->short_name.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
- }
- else if (name == "description")
- {
- productPtr->description.setText(_helper.content(child), Locale(_helper.attribute(child,"lang")));
- }
- else if (name == "version")
- {
- productPtr->epoch = _helper.attribute(child,"epoch");
- productPtr->ver = _helper.attribute(child,"ver");
- productPtr->rel = _helper.attribute(child,"rel");
- }
- else if (name == "distribution-name")
- {
- productPtr->distribution_name = _helper.content(child);
- }
- else if (name == "distribution-edition")
- {
- productPtr->distribution_edition = _helper.content(child);
- }
- else if (name == "provides")
- {
- prim.parseDependencyEntries(& productPtr->provides, child);
- }
- else if (name == "conflicts")
- {
- prim.parseDependencyEntries(& productPtr->conflicts, child);
- }
- else if (name == "obsoletes")
- {
- prim.parseDependencyEntries(& productPtr->obsoletes, child);
- }
- else if (name == "prerequires")
- {
- prim.parseDependencyEntries(& productPtr->prerequires, child);
- }
- else if (name == "requires")
- {
- prim.parseDependencyEntries(& productPtr->requires, child);
- }
- else if (name == "recommends")
- {
- prim.parseDependencyEntries(& productPtr->recommends, child);
- }
- else if (name == "suggests")
- {
- prim.parseDependencyEntries(& productPtr->suggests, child);
- }
- else if (name == "supplements")
- {
- prim.parseDependencyEntries(& productPtr->supplements, child);
- }
- else if (name == "enhances")
- {
- prim.parseDependencyEntries(& productPtr->enhances, child);
- }
- else if (name == "freshens")
- {
- prim.parseDependencyEntries(& productPtr->freshens, child);
- }
- else
- {
- WAR << "YUM <data> contains the unknown element <" << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
- return productPtr;
-} /* end process */
-
-
-
-} // namespace yum
-} // namespace parser
-} // namespace zypp
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMProductParser.h
- *
-*/
-
-
-
-#ifndef YUMProductParser_h
-#define YUMProductParser_h
-
-#include "zypp/parser/yum/YUMParserData.h"
-#include "zypp/parser/XMLNodeIterator.h"
-#include "zypp/parser/LibXMLHelper.h"
-#include <list>
-
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-/**
-* @short Parser for YUM primary.xml files (containing package metadata)
-* Use this class as an iterator that produces, one after one,
-* YUMProductData_Ptr(s) for the XML package elements in the input.
-* Here's an example:
-*
-* for (YUMProductParser iter(anIstream, baseUrl),
-* iter != YUMOtherParser.end(), // or: iter() != 0, or ! iter.atEnd()
-* ++iter) {
-* doSomething(*iter)
-* }
-*
-* The iterator owns the pointer (i.e., caller must not delete it)
-* until the next ++ operator is called. At this time, it will be
-* destroyed (and a new ENTRYTYPE is created.)
-*
-* If the input is fundamentally flawed so that it makes no sense to
-* continue parsing, XMLNodeIterator will log it and consider the input as finished.
-* You can query the exit status with errorStatus().
-*/
-class YUMProductParser : public XMLNodeIterator<YUMProductData_Ptr>
-{
-public:
- YUMProductParser(std::istream &is, const std::string &baseUrl, parser::ParserProgress::Ptr progress = parser::ParserProgress::Ptr());
- YUMProductParser();
- YUMProductParser(YUMProductData_Ptr& entry);
- virtual ~YUMProductParser();
-
-private:
- virtual bool isInterested(const xmlNodePtr nodePtr);
- virtual YUMProductData_Ptr process(const xmlTextReaderPtr reader);
- LibXMLHelper _helper;
- Arch _zypp_architecture;
-};
-} // namespace yum
-} // namespace parser
-} // namespace zypp
-
-#endif
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMRepomdParser.cc
- *
-*/
-
-#include <zypp/parser/yum/YUMRepomdParser.h>
-#include <zypp/parser/LibXMLHelper.h>
-#include <istream>
-#include <string>
-#include "zypp/parser/xml_parser_assert.h"
-#include <libxml/xmlreader.h>
-#include <libxml/tree.h>
-#include <zypp/base/Logger.h>
-#include <zypp/parser/yum/schemanames.h>
-
-using namespace std;
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-YUMRepomdParser::~YUMRepomdParser()
-{ }
-
-YUMRepomdParser::YUMRepomdParser()
-{ }
-
-YUMRepomdParser::YUMRepomdParser(YUMRepomdData_Ptr& entry)
- : XMLNodeIterator<YUMRepomdData_Ptr>(entry)
-{ }
-
-
-// select for which elements process() will be called
-bool
-YUMRepomdParser::isInterested(const xmlNodePtr nodePtr)
-{
- return _helper.isElement(nodePtr) && _helper.name(nodePtr) == "data";
-}
-
-// do the actual processing
-YUMRepomdData_Ptr
-YUMRepomdParser::process(const xmlTextReaderPtr reader)
-{
- xml_assert(reader);
- YUMRepomdData_Ptr repoPtr = new YUMRepomdData;
- xmlNodePtr dataNode = xmlTextReaderExpand(reader);
- xml_assert(dataNode);
- repoPtr->type = _helper.attribute(dataNode,"type");
-
- for (xmlNodePtr child = dataNode->children;
- child && child != dataNode;
- child = child->next)
- {
- if (_helper.isElement(child))
- {
- string name = _helper.name(child);
- if (name == "location")
- {
- repoPtr->location = _helper.attribute(child,"href");
- }
- else if (name == "checksum")
- {
- repoPtr->checksumType = _helper.attribute(child,"type");
- repoPtr->checksum = _helper.content(child);
- }
- else if (name == "timestamp")
- {
- repoPtr->timestamp = _helper.content(child);
- }
- else if (name == "open-checksum")
- {
- repoPtr->openChecksumType = _helper.attribute(child, "type");
- repoPtr->openChecksum = _helper.content(child);
- }
- else
- {
- WAR << "YUM <data> contains the unknown element <" << name << "> "
- << _helper.positionInfo(child) << ", skipping" << endl;
- }
- }
- }
- return repoPtr;
-} /* end process */
-
-
-YUMRepomdParser::YUMRepomdParser(std::istream &is, const std::string &baseUrl, parser::ParserProgress::Ptr progress)
- : XMLNodeIterator<YUMRepomdData_Ptr>(is, baseUrl,REPOMDSCHEMA, progress)
-{
- fetchNext();
-}
-
-} // namespace yum
-} // namespace parser
-} // namespace zypp
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/parser/yum/YUMRepomdParser.h
- *
-*/
-
-
-
-#ifndef YUMRepomdParser_h
-#define YUMRepomdParser_h
-
-#include <zypp/parser/yum/YUMParserData.h>
-#include <zypp/parser/XMLNodeIterator.h>
-#include <zypp/parser/LibXMLHelper.h>
-
-namespace zypp
-{
-namespace parser
-{
-namespace yum
-{
-
-/**
-* @short Parser for YUM repomd.xml files (describing the repository)
-* Use this class as an iterator that produces, one after one,
-* YUMRepomdData_Ptr(s) for the XML package elements.
-* Here's an example:
-*
-* for (YUMRepomdParser iter(anIstream, baseUrl),
-* iter != YUMOtherParser.end(), // or: iter() != 0, or ! iter.atEnd()
-* ++iter) {
-* doSomething(*iter)
-* }
-*
-* The iterator owns the pointer (i.e., caller must not delete it)
-* until the next ++ operator is called. At this time, it will be
-* destroyed (and a new ENTRYTYPE is created.)
-*
-* If the input is fundamentally flawed so that it makes no sense to
-* continue parsing, XMLNodeIterator will log it and consider the input as finished.
-* You can query the exit status with errorStatus().
-*/
-class YUMRepomdParser : public XMLNodeIterator<YUMRepomdData_Ptr>
-{
-public:
- YUMRepomdParser(std::istream &is, const std::string &baseUrl, parser::ParserProgress::Ptr progress = parser::ParserProgress::Ptr() );
- YUMRepomdParser();
- YUMRepomdParser(YUMRepomdData_Ptr& entry);
- virtual ~YUMRepomdParser();
-
-private:
- virtual bool isInterested(const xmlNodePtr nodePtr);
- virtual YUMRepomdData_Ptr process(const xmlTextReaderPtr reader);
-
- LibXMLHelper _helper;
-};
-} // namespace yum
-} // namespace parser
-} // namespace zypp
-
-#endif
for ( PoolItemList items = order.computeNextSet(); ! items.empty(); items = order.computeNextSet() )
{
- MIL << "order.computeNextSet: " << items.size() << " resolvables" << endl;
+ XXX << "order.computeNextSet: " << items.size() << " resolvables" << endl;
///////////////////////////////////////////////////////////////////
// items contains all objects we could install now. Pick all objects
// from current media, or best media if none for current. Alwayys pick
if (!cobj)
continue;
- if ( ! cobj->sourceMediaNr() ) {
+ if ( ! cobj->mediaNr() ) {
XXX << "No media access required for " << *cit << endl;
order.setInstalled( *cit );
other_list.push_back( *cit );
continue;
}
- if ( cobj->source().numericId() == last_prio &&
- cobj->sourceMediaNr() == last_medianum ) {
+ if ( cobj->repository().numericId() == last_prio &&
+ cobj->mediaNr() == last_medianum ) {
// prefer packages on current media.
XXX << "Stay with current media " << *cit << endl;
last_list.push_back( *cit );
if ( order_r == ORDER_BY_MEDIANR )
{
- if ( cobj->sourceMediaNr() < best_medianum ) {
+ if ( cobj->mediaNr() < best_medianum ) {
best_list.clear(); // new best
- } else if ( cobj->sourceMediaNr() == best_medianum ) {
- if ( cobj->source().numericId() < best_prio ) {
+ } else if ( cobj->mediaNr() == best_medianum ) {
+ if ( cobj->repository().numericId() < best_prio ) {
best_list.clear(); // new best
- } else if ( cobj->source().numericId() == best_prio ) {
+ } else if ( cobj->repository().numericId() == best_prio ) {
XXX << "Add to best list " << *cit << endl;
best_list.push_back( *cit ); // same as best -> add
continue;
}
else // default: ORDER_BY_SOURCE
{
- if ( cobj->source().numericId() < best_prio ) {
+ if ( cobj->repository().numericId() < best_prio ) {
best_list.clear(); // new best
- } else if ( cobj->source().numericId() == best_prio ) {
- if ( cobj->sourceMediaNr() < best_medianum ) {
+ } else if ( cobj->repository().numericId() == best_prio ) {
+ if ( cobj->mediaNr() < best_medianum ) {
best_list.clear(); // new best
- } else if ( cobj->sourceMediaNr() == best_medianum ) {
+ } else if ( cobj->mediaNr() == best_medianum ) {
XXX << "Add to best list " << *cit << endl;
best_list.push_back( *cit ); // same as best -> add
continue;
if ( best_list.empty() )
{
- XXX << "NEW BEST LIST [S" << cobj->source().numericId() << ":" << cobj->sourceMediaNr()
+ XXX << "NEW BEST LIST [S" << cobj->repository().numericId() << ":" << cobj->mediaNr()
<< "] (last [S" << best_prio << ":" << best_medianum << "])" << endl;
- best_prio = cobj->source().numericId();
- best_medianum = cobj->sourceMediaNr();
+ best_prio = cobj->repository().numericId();
+ best_medianum = cobj->mediaNr();
// first package or new best
XXX << "Add to best list " << *cit << endl;
best_list.push_back( *cit );
}
else
{
- MIL << "SET CONTINUE [S" << best_prio << ":" << best_medianum << "]" << endl;
+ XXX << "SET CONTINUE [S" << best_prio << ":" << best_medianum << "]" << endl;
}
for ( PoolItemList::iterator it = take_list.begin(); it != take_list.end(); ++it )
} // for all sets computed
+ MIL << "order done" << endl;
if ( instbackup_r.size() != instlist_r.size() )
{
ERR << "***************** Lost packages in InstallOrder sort." << endl;
#include <iosfwd>
#include <map>
+#include "zypp/base/Easy.h"
#include "zypp/pool/PoolTraits.h"
#include "zypp/ResPoolProxy.h"
#include "zypp/ZYppFactory.h"
namespace pool
{ /////////////////////////////////////////////////////////////////
-
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : NameHash
typedef PoolTraits::size_type size_type;
typedef PoolTraits::Inserter Inserter;
typedef PoolTraits::Deleter Deleter;
- typedef PoolTraits::AdditionalCapSet AdditionalCapSet;
+ typedef PoolTraits::AdditionalCapSet AdditionalCapSet;
+ typedef PoolTraits::RepoContainerT KnownRepositories;
public:
/** Default ctor */
{ return _store.end(); }
/**
- * Handling additional requirement. E.G. need package "foo" and package
+ * Handling additional requirement. E.G. need package "foo" and package
* "foo1" which has a greater version than 1.0:
*
* Capset capset;
- * capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo"));
+ * capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo"));
* capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo1 > 1.0"));
*
* setAdditionalRequire( capset );
/**
* Handling additional conflicts. E.G. do not install anything which provides "foo":
*
- * Capset capset;
+ * Capset capset;
* capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo"));
*
- * setAdditionalConflict( capset );
- */
+ * setAdditionalConflict( capset );
+ */
void setAdditionalConflict( const AdditionalCapSet & capset ) const
- { _additionaConflict = capset; }
+ { _additionaConflict = capset; }
AdditionalCapSet & additionaConflict() const
{ return _additionaConflict; }
-
+
/**
* Handling additional provides. This is used for ignoring a requirement.
* e.G. Do ignore the requirement "foo":
*
- * Capset capset;
+ * Capset capset;
* capset.insert (CapFactory().parse( ResTraits<Package>::kind, "foo"));
*
- * setAdditionalProvide( cap );
- */
+ * setAdditionalProvide( cap );
+ */
void setAdditionalProvide( const AdditionalCapSet & capset ) const
{ _additionaProvide = capset; }
AdditionalCapSet & additionaProvide() const
_additionalRequire.clear();
_additionaConflict.clear();
_additionaProvide.clear();
-
+ // don't miss to invalidate ResPoolProxy
+ invalidateProxy();
return;
}
void eraseInstalled() const;
public:
+ /** Access list of Repositories that contribute ResObjects.
+ * Built on demand.
+ */
+ const KnownRepositories & knownRepositories() const
+ {
+ if ( ! _knownRepositoriesPtr )
+ {
+ _knownRepositoriesPtr.reset( new KnownRepositories );
+ for_( it, _store.begin(), _store.end() )
+ {
+ if ( (*it)->repository() != Repository::noRepository )
+ {
+ _knownRepositoriesPtr->insert( (*it)->repository() );
+ }
+ }
+ }
+
+ return *_knownRepositoriesPtr;
+ }
+
+ public:
/** \name Save and restore state. */
//@{
void SaveState( const ResObject::Kind & kind_r );
return *_poolProxy;
}
void invalidateProxy()
- { _poolProxy.reset(); }
+ {
+ _poolProxy.reset();
+ _knownRepositoriesPtr.reset();
+ }
mutable shared_ptr<ResPoolProxy> _poolProxy;
+
+ private:
+ /** Set of known repositories built on demand.
+ * Invalidated on any Pool content change. Rebuilt on next access.
+ */
+ mutable scoped_ptr<KnownRepositories> _knownRepositoriesPtr;
};
///////////////////////////////////////////////////////////////////
#include "zypp/PoolItem.h"
#include "zypp/Capability.h"
-#include "zypp/CapAndItem.h"
#include "zypp/Dep.h"
#include "zypp/ResStatus.h"
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
+
+ class CapAndItem;
+ class Repository;
+
///////////////////////////////////////////////////////////////////
namespace pool
{ /////////////////////////////////////////////////////////////////
typedef ItemContainerT::const_iterator byName_iterator;
// internal organization
- typedef std::list<CapAndItem> CapItemContainerT; // (why,who) pairs
+ typedef std::list<zypp::CapAndItem> CapItemContainerT; // (why,who) pairs
typedef std::map<std::string,CapItemContainerT> CapItemStoreT; // capability.index -> (why,who) pairs
typedef std::map<Dep,CapItemStoreT> DepCapItemContainerT; // Dep -> (capability.index -> (why,who) pairs)
/** hashed by capability index */
typedef const_capitemiterator byCapabilityIndex_iterator;
+ /* list of known Repositories */
+ typedef std::set<Repository> RepoContainerT;
+ typedef RepoContainerT::const_iterator repository_iterator;
+
typedef PoolImpl Impl;
typedef shared_ptr<PoolImpl> Impl_Ptr;
typedef shared_ptr<const PoolImpl> Impl_constPtr;
/** Map of CapSet and "who" has set it*/
typedef std::map<ResStatus::TransactByValue,CapSet> AdditionalCapSet;
-
+
};
///////////////////////////////////////////////////////////////////
#include "zypp/base/Logger.h"
#include "zypp/base/String.h"
-#include "zypp/source/Applydeltarpm.h"
+#include "zypp/repo/Applydeltarpm.h"
#include "zypp/ExternalProgram.h"
#include "zypp/AutoDispose.h"
#include "zypp/PathInfo.h"
public:
- Impl( const std::set<Repository> & repos )
+ Impl( const std::list<Repository> & repos )
: repos(repos)
{
Impl * clone() const
{ return new Impl( *this ); }
- std::set<Repository> repos;
+ std::list<Repository> repos;
};
///////////////////////////////////////////////////////////////////
return str << "DeltaCandidates::Impl";
}
- DeltaCandidates::DeltaCandidates(const std::set<Repository> & repos)
+ DeltaCandidates::DeltaCandidates(const std::list<Repository> & repos)
: _pimpl( new Impl(repos) )
{}
std::list<PatchRpm> candidates;
// query all repos
- for ( std::set<Repository>::const_iterator it = _pimpl->repos.begin();
+ for ( std::list<Repository>::const_iterator it = _pimpl->repos.begin();
it != _pimpl->repos.end();
++it )
{
std::list<DeltaRpm> candidates;
// query all repos
- for ( std::set<Repository>::const_iterator it = _pimpl->repos.begin();
+ for ( std::list<Repository>::const_iterator it = _pimpl->repos.begin();
it != _pimpl->repos.end();
++it )
{
#define ZYPP_REPO_DELTACANDIDATES_H
#include <iosfwd>
-#include <set>
+#include <list>
#include "zypp/base/PtrTypes.h"
#include "zypp/base/Function.h"
/**
* \short Candidate delta and patches for a package
+ *
+ * Basically a container that given N repositories,
+ * gets all patches and deltas from them for a given
+ * package.
*/
class DeltaCandidates
{
* \param repos Set of repositories providing patch and delta packages
* \param installed_callback Will be used to ask if a package is installed or not
*/
- DeltaCandidates( const std::set<Repository> & repos );
+ DeltaCandidates( const std::list<Repository> & repos );
/** Dtor */
~DeltaCandidates();
#include "zypp/base/LogTools.h"
-#include "zypp/source/PackageDelta.h"
+#include "zypp/repo/PackageDelta.h"
using std::endl;
const Date & buildtime() const { return _buildtime;}
public:
- PatchRpm & location( const OnMediaLocation & val_r ) { _location = val_r; return *this; }
- PatchRpm & baseversions( const BaseVersions & val_r ) { _baseversions = val_r; return *this; }
- PatchRpm & baseversion( const BaseVersion & val_r ) { _baseversions.push_back( val_r ); return *this; }
- PatchRpm & buildtime( const Date & val_r ) { _buildtime = val_r; return *this; }
+ PatchRpm & setLocation( const OnMediaLocation & val_r ) { _location = val_r; return *this; }
+ PatchRpm & setBaseversions( const BaseVersions & val_r ) { _baseversions = val_r; return *this; }
+ PatchRpm & addBaseversion( const BaseVersion & val_r ) { _baseversions.push_back( val_r ); return *this; }
+ PatchRpm & setBuildtime( const Date & val_r ) { _buildtime = val_r; return *this; }
private:
OnMediaLocation _location;
const std::string & sequenceinfo() const { return _sequenceinfo; }
public:
- BaseVersion & edition( const Edition & val_r ) { _edition = val_r; return *this; }
- BaseVersion & buildtime( const Date & val_r ) { _buildtime = val_r; return *this; }
- BaseVersion & checksum( const CheckSum & val_r ) { _checksum = val_r; return *this; }
- BaseVersion & sequenceinfo( const std::string & val_r ) { _sequenceinfo = val_r; return *this; }
+ BaseVersion & setEdition( const Edition & val_r ) { _edition = val_r; return *this; }
+ BaseVersion & setBuildtime( const Date & val_r ) { _buildtime = val_r; return *this; }
+ BaseVersion & setChecksum( const CheckSum & val_r ) { _checksum = val_r; return *this; }
+ BaseVersion & setSequenceinfo( const std::string & val_r ) { _sequenceinfo = val_r; return *this; }
private:
Edition _edition;
const Date & buildtime() const { return _buildtime;}
public:
- DeltaRpm & location( const OnMediaLocation & val_r ) { _location = val_r; return *this; }
- DeltaRpm & baseversion( const BaseVersion & val_r ) { _baseversion = val_r; return *this; }
- DeltaRpm & buildtime( const Date & val_r ) { _buildtime = val_r; return *this; }
+ DeltaRpm & setLocation( const OnMediaLocation & val_r ) { _location = val_r; return *this; }
+ DeltaRpm & setBaseversion( const BaseVersion & val_r ) { _baseversion = val_r; return *this; }
+ DeltaRpm & setBuildtime( const Date & val_r ) { _buildtime = val_r; return *this; }
private:
OnMediaLocation _location;
#include "zypp/Repository.h"
#include "zypp/repo/PackageProvider.h"
#include "zypp/repo/RepoProvideFile.h"
-#include "zypp/source/Applydeltarpm.h"
-#include "zypp/source/PackageDelta.h"
+#include "zypp/repo/Applydeltarpm.h"
+#include "zypp/repo/PackageDelta.h"
#include "zypp/detail/ImplConnect.h"
#include "zypp/RepoInfo.h"
}
} while ( _retry );
- report()->finish( _package, source::DownloadResolvableReport::NO_ERROR, std::string() );
+ report()->finish( _package, repo::DownloadResolvableReport::NO_ERROR, std::string() );
MIL << "provided Package " << _package << " at " << ret << endl;
return ret;
}
// no patch/delta -> provide full package
ManagedFile ret;
- OnMediaLocation loc;
- loc.medianr( _package->mediaNr() )
- .filename( _package->location() )
- .checksum( _package->checksum() )
- .downloadsize( _package->archivesize() );
-
+ OnMediaLocation loc = _package->location();
+
ProvideFilePolicy policy;
policy.progressCB( bind( &PackageProvider::progressPackageDownload, this, _1 ) );
policy.failOnChecksumErrorCB( bind( &PackageProvider::failOnChecksumError, this ) );
return ManagedFile();
report()->startDeltaDownload( delta_r.location().filename(),
- delta_r.location().downloadsize() );
+ delta_r.location().downloadSize() );
ManagedFile delta;
try
{
Pathname destination( Pathname::dirname( delta ) / defRpmFileName( _package ) );
/* just to ease testing with non remote sources */
- if ( ! _package->source().remote() )
- destination = Pathname("/tmp") / defRpmFileName( _package );
+ // FIXME removed API
+ //if ( ! _package->source().remote() )
+ // destination = Pathname("/tmp") / defRpmFileName( _package );
/**/
if ( ! applydeltarpm::provide( delta, destination,
return ManagedFile();
report()->startPatchDownload( patch_r.location().filename(),
- patch_r.location().downloadsize() );
+ patch_r.location().downloadSize() );
ManagedFile patch;
try
{
std::string package_str = _package->name() + "-" + _package->edition().asString();
// TranslatorExplanation %s = package being checked for integrity
- switch ( report()->problem( _package, source::DownloadResolvableReport::INVALID, str::form(_("Package %s fails integrity check. Do you want to retry?"), package_str.c_str() ) ) )
+ switch ( report()->problem( _package, repo::DownloadResolvableReport::INVALID, str::form(_("Package %s fails integrity check. Do you want to retry?"), package_str.c_str() ) ) )
{
- case source::DownloadResolvableReport::RETRY:
+ case repo::DownloadResolvableReport::RETRY:
_retry = true;
break;
- case source::DownloadResolvableReport::IGNORE:
+ case repo::DownloadResolvableReport::IGNORE:
ZYPP_THROW(SkipRequestException("User requested skip of corrupted file"));
break;
default:
/////////////////////////////////////////////////////////////////
- } // namespace source
+ } // namespace repo
///////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
} // namespace zypp
class PackageProvider : private base::NonCopyable
{
typedef shared_ptr<void> ScopedGuard;
- typedef callback::SendReport<source::DownloadResolvableReport> Report;
+ typedef callback::SendReport<repo::DownloadResolvableReport> Report;
typedef detail::ResImplTraits<Package::Impl>::constPtr PackageImpl_constPtr;
typedef packagedelta::DeltaRpm DeltaRpm;
* We redirect the static report triggered from Repository::provideFile
* to feed the ProvideFilePolicy callbacks.
*/
- struct DownloadFileReportHack : public callback::ReceiveReport<source::SourceReport>
+ struct DownloadFileReportHack : public callback::ReceiveReport<repo::RepoReport>
{
virtual bool progress( int value )
{
DownloadFileReportHack dumb;
dumb._redirect = bind( mem_fun_ref( &ProvideFilePolicy::progress ),
ref( policy_r ), _1 );
- callback::TempConnect<source::SourceReport> temp( dumb );
+ callback::TempConnect<repo::RepoReport> temp( dumb );
Url url;
RepoInfo info = repo_r.info();
const RepoType RepoType::RPMMD(RepoType::RPMMD_e);
const RepoType RepoType::YAST2(RepoType::YAST2_e);
- //const RepoType RepoType::NONE(RepoType::NONE_e);
+ const RepoType RepoType::RPMPLAINDIR(RepoType::RPMPLAINDIR_e);
+ const RepoType RepoType::NONE(RepoType::NONE_e);
RepoType::RepoType(const std::string & strval_r)
: _type(parse(strval_r))
_table["susetags"] = RepoType::YAST2_e;
_table["yast"] = RepoType::YAST2_e;
_table["yast2"] = RepoType::YAST2_e;
+ _table["plaindir"] = RepoType::RPMPLAINDIR_e;
_table["NONE"] = _table["none"] = RepoType::NONE_e;
}
// initialize it
_table[RPMMD_e] = "rpm-md";
_table[YAST2_e] = "yast2";
+ _table[RPMPLAINDIR_e] = "plaindir";
_table[NONE_e] = "NONE";
}
return _table[_type];
{
namespace repo
{
-
+
/**
* \short Repository type enumeration
*
{
static const RepoType RPMMD;
static const RepoType YAST2;
- //static const RepoType NONE;
-
+ static const RepoType RPMPLAINDIR;
+ static const RepoType NONE;
+
enum Type
{
NONE_e,
RPMMD_e,
- YAST2_e
+ YAST2_e,
+ RPMPLAINDIR_e,
};
+ RepoType() : _type(NONE_e) {}
+
RepoType(Type type) : _type(type) {}
explicit RepoType(const std::string & strval_r);
const Type toEnum() const { return _type; }
-
+
RepoType::Type parse(const std::string & strval_r);
const std::string & asString() const;
+#include "zypp/base/Logger.h"
#include "zypp/repo/RepositoryImpl.h"
+using namespace zypp;
+using namespace std;
+
namespace zypp { namespace repo {
IMPL_PTR_TYPE(RepositoryImpl)
RepositoryImpl::RepositoryImpl( const RepoInfo &info )
- : _info(info)
+ : _restore_lazy_initialized(false),
+ _info(info)
{
}
-const RepoInfo RepositoryImpl::info() const
+const RepoInfo & RepositoryImpl::info() const
{
return _info;
}
const ResStore & RepositoryImpl::resolvables() const
{
+ if ( ! _restore_lazy_initialized )
+ {
+ const_cast<RepositoryImpl*>(this)->createResolvables();
+ const_cast<RepositoryImpl*>(this)->_restore_lazy_initialized = true;
+ }
return _store;
}
+void RepositoryImpl::createResolvables()
+{
+ WAR << "createResolvables() not implemented" << endl;
+}
+
+void RepositoryImpl::createPatchAndDeltas()
+{
+ WAR << "createPatchAndDeltas() not implemented" << endl;
+}
+
const std::list<packagedelta::PatchRpm> &
RepositoryImpl::patchRpms() const
{
return _patchRpms;
}
-
+
const std::list<packagedelta::DeltaRpm> &
RepositoryImpl::deltaRpms() const
{
{
friend std::ostream & operator<<( std::ostream & str, const RepositoryImpl & obj );
public:
-
+
/**
* \short Ctor.
* \param info What is known about this source at construction time.
*
*/
RepositoryImpl( const RepoInfo &info = RepoInfo() );
-
+
+ /**
+ * \short Dtor
+ */
+ ~RepositoryImpl();
+
/**
* \short Information about this repository
* You can't change this information after creation.
* Use \ref RepoManager for that.
*/
- const RepoInfo info() const;
-
- /**
- * \short Dtor
- */
- ~RepositoryImpl();
+ const RepoInfo & info() const;
const ResStore & resolvables() const;
- struct null {};
-
const std::list<packagedelta::PatchRpm> & patchRpms() const;
const std::list<packagedelta::DeltaRpm> & deltaRpms() const;
-
+
+ virtual void createResolvables();
+ virtual void createPatchAndDeltas();
public:
+ struct null {};
+
/** Offer default Impl. */
static RepositoryImpl_Ptr nullimpl()
{
Repository selfRepository()
{ return Repository( this ); }
+
protected:
- RepoInfo _info;
-
ResStore _store;
-
std::list<packagedelta::PatchRpm> _patchRpms;
std::list<packagedelta::DeltaRpm> _deltaRpms;
+ bool _restore_lazy_initialized;
+ private:
+ RepoInfo _info;
};
}
}
#include <fstream>
-#include "zypp/source/SUSEMediaVerifier.h"
+#include "zypp/repo/SUSEMediaVerifier.h"
using namespace std;
namespace zypp
{
-namespace source
+namespace repo
{
SUSEMediaVerifier::SUSEMediaVerifier(const std::string & vendor_r, const std::string & id_r, const media::MediaNr media_nr)
namespace zypp
{
- namespace source
+ namespace repo
{
class SUSEMediaVerifier : public zypp::media::MediaVerifierBase
#include "zypp/base/Logger.h"
#include "zypp/repo/RepositoryImpl.h"
#include "AtomImpl.h"
-
+#include "zypp/cache/CacheAttributes.h"
using namespace std;
using namespace zypp::detail;
-using namespace::zypp::repo;
+//using namespace::zypp::repo;
///////////////////////////////////////////////////////////////////
namespace zypp { namespace repo { namespace cached {
TranslatedText AtomImpl::summary() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "summary" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectSummary() );
}
TranslatedText AtomImpl::description() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "description" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDescription() );
}
TranslatedText AtomImpl::insnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "insnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectInsnotify() );
}
TranslatedText AtomImpl::delnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "delnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDelnotify() );
}
TranslatedText AtomImpl::licenseToConfirm() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "licenseToConfirm" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectLicenseToConfirm() );
}
Vendor AtomImpl::vendor() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "ResObject", "vendor" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrResObjectVendor() );
}
-
ByteCount AtomImpl::size() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "size" );
-}
-
-ByteCount AtomImpl::archivesize() const
-{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "archivesize" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectInstalledSize() );
}
bool AtomImpl::installOnly() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "ResObject", "installOnly" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrResObjectInstallOnly() );
}
Date AtomImpl::buildtime() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "buildtime" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectBuildTime() );
}
Date AtomImpl::installtime() const
return Date();
}
-//////////////////////////////////////////
-// DEPRECATED
-//////////////////////////////////////////
-
-Source_Ref AtomImpl::source() const
-{
- return Source_Ref::noSource;
-}
-
unsigned AtomImpl::mediaNr() const
{
return 1;
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual Source_Ref source() const;
virtual unsigned mediaNr() const;
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
#include "zypp/base/Logger.h"
#include "zypp/repo/RepositoryImpl.h"
#include "MessageImpl.h"
+#include "zypp/cache/CacheAttributes.h"
using namespace std;
TranslatedText MessageImpl::summary() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "summary" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectSummary() );
}
TranslatedText MessageImpl::description() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "description" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDescription() );
}
TranslatedText MessageImpl::insnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "insnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectInsnotify() );
}
TranslatedText MessageImpl::delnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "delnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDelnotify() );
}
TranslatedText MessageImpl::licenseToConfirm() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "licenseToConfirm" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectLicenseToConfirm() );
}
Vendor MessageImpl::vendor() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "ResObject", "vendor" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrResObjectVendor() );
}
ByteCount MessageImpl::size() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "size" );
-}
-
-ByteCount MessageImpl::archivesize() const
-{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "archivesize" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectInstalledSize() );
}
bool MessageImpl::installOnly() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "ResObject", "installOnly" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrResObjectInstallOnly() );
}
Date MessageImpl::buildtime() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "buildtime" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectBuildTime() );
}
Date MessageImpl::installtime() const
return Date();
}
-//////////////////////////////////////////
-// DEPRECATED
-//////////////////////////////////////////
-
-Source_Ref MessageImpl::source() const
-{
- return Source_Ref::noSource;
-}
-
unsigned MessageImpl::mediaNr() const
{
return 1;
TranslatedText MessageImpl::text() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "Message", "text" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrMessageText() );
}
Patch::constPtr MessageImpl::patch() const
{
return 0;
}
-
+
/////////////////////////////////////////////////////////////////
} } } // namespace zypp::repo::cached
///////////////////////////////////////////////////////////////////
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual Source_Ref source() const;
virtual unsigned mediaNr() const;
// MESSAGE
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
#include "zypp/base/Logger.h"
#include "zypp/repo/RepositoryImpl.h"
#include "PackageImpl.h"
-
+#include "zypp/cache/CacheAttributes.h"
using namespace std;
using namespace zypp::detail;
TranslatedText PackageImpl::summary() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "summary" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectSummary() );
}
TranslatedText PackageImpl::description() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "description" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDescription() );
}
TranslatedText PackageImpl::insnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "insnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectInsnotify() );
}
TranslatedText PackageImpl::delnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "delnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDelnotify() );
}
TranslatedText PackageImpl::licenseToConfirm() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "licenseToConfirm" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectLicenseToConfirm() );
}
Vendor PackageImpl::vendor() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "ResObject", "vendor" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrResObjectVendor() );
}
-
ByteCount PackageImpl::size() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "size" );
-}
-
-ByteCount PackageImpl::archivesize() const
-{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "archivesize" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectInstalledSize() );
}
bool PackageImpl::installOnly() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "ResObject", "installOnly" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrResObjectInstallOnly() );
}
Date PackageImpl::buildtime() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "buildtime" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectBuildTime() );
}
Date PackageImpl::installtime() const
return Date();
}
-unsigned PackageImpl::repositoryMediaNr() const
-{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "repositoryMediaNr" );
-}
-
-//////////////////////////////////////////
-// DEPRECATED
-//////////////////////////////////////////
-
-Source_Ref PackageImpl::source() const
-{
- return Source_Ref::noSource;
-}
-
-unsigned PackageImpl::mediaNr() const
-{
- return 1;
-}
-
-CheckSum PackageImpl::checksum() const
-{
- return CheckSum();
-}
-
std::string PackageImpl::buildhost() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "buildhost" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageBuildhost() );
}
std::string PackageImpl::distribution() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "distribution" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageDistribution() );
}
Label PackageImpl::license() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "license" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageLicense() );
}
std::string PackageImpl::packager() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "packager" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackagePackager() );
}
PackageGroup PackageImpl::group() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "group" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageGroup() );
}
PackageImpl::Keywords PackageImpl::keywords() const
{
PackageImpl::Keywords keywords;
- _repository->resolvableQuery().queryStringContainerAttribute( _id, "Package", "keywords", std::inserter(keywords, keywords.begin()) );
+ _repository->resolvableQuery().queryStringContainerAttribute( _id, cache::attrPackageKeywords(), std::inserter(keywords, keywords.begin()) );
return keywords;
}
return Changelog();
}
-Pathname PackageImpl::location() const
+OnMediaLocation PackageImpl::location() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "location" );
+ OnMediaLocation loc;
+ string chktype = _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageLocationChecksumType() );
+ string chkvalue = _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageLocationChecksum() );
+ loc.setChecksum(CheckSum(chktype, chkvalue));
+
+ loc.setFilename( _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageLocationFilename() ) );
+
+ loc.setDownloadSize( _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrPackageLocationDownloadSize() ) );
+ loc.setOpenSize( _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrPackageLocationOpenSize() ) );
+
+ loc.setMedianr( _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrPackageLocationMediaNr() ) );
+
+ chktype = _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageLocationOpenChecksumType() );
+ chkvalue = _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageLocationOpenChecksum() );
+ loc.setOpenChecksum(CheckSum(chktype, chkvalue));
+
+ return loc;
}
std::string PackageImpl::url() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "url" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageUrl() );
}
std::string PackageImpl::os() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "operatingSystem" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackageOperatingSystem() );
}
Text PackageImpl::prein() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "prein" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackagePrein() );
}
Text PackageImpl::postin() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "postin" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackagePostin() );
}
Text PackageImpl::preun() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "preun" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackagePreun() );
}
Text PackageImpl::postun() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Package", "postun" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPackagePostun() );
}
ByteCount PackageImpl::sourcesize() const
list<string> PackageImpl::authors() const
{
list<string> authors;
- _repository->resolvableQuery().queryStringContainerAttribute( _id, "Package", "authors", back_inserter(authors) );
+ _repository->resolvableQuery().queryStringContainerAttribute( _id, cache::attrPackageAuthors(), back_inserter(authors) );
return authors;
}
// {
// return std::list<DeltaRpm>();
// }
-//
+//
// std::list<PatchRpm> PackageImpl::patchRpms() const
// {
// return std::list<PatchRpm>();
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual Source_Ref source() const;
- virtual unsigned mediaNr() const;
-
// PACKAGE
- virtual CheckSum checksum() const;
virtual std::string buildhost() const;
virtual std::string distribution() const;
virtual Label license() const;
virtual PackageGroup group() const;
virtual Keywords keywords() const;
virtual Changelog changelog() const;
- virtual Pathname location() const;
virtual std::string url() const;
virtual std::string os() const;
virtual Text prein() const;
virtual DiskUsage diskusage() const;
virtual std::list<std::string> authors() const;
virtual std::list<std::string> filenames() const;
+ virtual OnMediaLocation location() const;
+
/*virtual std::list<DeltaRpm> deltaRpms() const;
virtual std::list<PatchRpm> patchRpms() const;
- */
- virtual unsigned repositoryMediaNr() const;
-
+ */
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
#include "zypp/base/Logger.h"
#include "zypp/repo/RepositoryImpl.h"
#include "PatchImpl.h"
+#include "zypp/cache/CacheAttributes.h"
using namespace std;
TranslatedText PatchImpl::summary() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "summary" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectSummary() );
}
TranslatedText PatchImpl::description() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "description" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDescription() );
}
TranslatedText PatchImpl::insnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "insnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectInsnotify() );
}
TranslatedText PatchImpl::delnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "delnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDelnotify() );
}
TranslatedText PatchImpl::licenseToConfirm() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "licenseToConfirm" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectLicenseToConfirm() );
}
Vendor PatchImpl::vendor() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "ResObject", "vendor" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrResObjectVendor() );
}
ByteCount PatchImpl::size() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "size" );
-}
-
-ByteCount PatchImpl::archivesize() const
-{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "archivesize" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectInstalledSize() );
}
bool PatchImpl::installOnly() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "ResObject", "installOnly" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrResObjectInstallOnly() );
}
Date PatchImpl::buildtime() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "buildtime" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectBuildTime() );
}
Date PatchImpl::installtime() const
return Date();
}
-//////////////////////////////////////////
-// DEPRECATED
-//////////////////////////////////////////
-
-Source_Ref PatchImpl::source() const
-{
- return Source_Ref::noSource;
-}
-
unsigned PatchImpl::mediaNr() const
{
return 1;
std::string PatchImpl::id() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Patch", "id" );
+#warning DUBIOUS ATTRIBUTE
+ return "";
+ //return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPatchId() );
}
Date PatchImpl::timestamp() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "Patch", "timestamp" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrPatchTimestamp() );
}
std::string PatchImpl::category() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Patch", "category" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPatchCategory() );
}
bool PatchImpl::reboot_needed() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "Patch", "rebootNeeded" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrPatchRebootNeeded() );
}
bool PatchImpl::affects_pkg_manager() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "Patch", "affectsPkgManager" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrPatchAffectsPkgManager() );
}
bool PatchImpl::interactive() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "Patch", "interactive" );
+#warning DUBIOUS ATTRIBUTE
+ return false;
+ //return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrPatchInteractive() );
}
PatchImpl::AtomList PatchImpl::all_atoms() const
{
+#warning DUBIOUS ATTRIBUTE
return PatchImpl::AtomList();
}
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual Source_Ref source() const;
virtual unsigned mediaNr() const;
// PATCH
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
#include "zypp/base/Logger.h"
#include "zypp/repo/RepositoryImpl.h"
#include "PatternImpl.h"
+#include "zypp/cache/CacheAttributes.h"
using namespace std;
TranslatedText PatternImpl::summary() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "summary" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectSummary() );
}
TranslatedText PatternImpl::description() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "description" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDescription() );
}
TranslatedText PatternImpl::insnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "insnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectInsnotify() );
}
TranslatedText PatternImpl::delnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "delnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDelnotify() );
}
TranslatedText PatternImpl::licenseToConfirm() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "licenseToConfirm" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectLicenseToConfirm() );
}
Vendor PatternImpl::vendor() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "ResObject", "vendor" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrResObjectVendor() );
}
ByteCount PatternImpl::size() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "size" );
-}
-
-ByteCount PatternImpl::archivesize() const
-{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "archivesize" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectInstalledSize() );
}
bool PatternImpl::installOnly() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "ResObject", "installOnly" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrResObjectInstallOnly() );
}
Date PatternImpl::buildtime() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "buildtime" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectBuildTime() );
}
Date PatternImpl::installtime() const
}
//////////////////////////////////////////
-// DEPRECATED
-//////////////////////////////////////////
-
-Source_Ref PatternImpl::source() const
-{
- return Source_Ref::noSource;
-}
-
-unsigned PatternImpl::mediaNr() const
-{
- return 1;
-}
-
-//////////////////////////////////////////
// PATTERN
/////////////////////////////////////////
bool PatternImpl::isDefault() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "Pattern", "isDefault" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrPatternIsDefault() );
}
bool PatternImpl::userVisible() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "Pattern", "userVisible" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrPatternUserVisible() );
}
TranslatedText PatternImpl::category() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "Pattern", "isDefault" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrPatternCategory() );
}
Pathname PatternImpl::icon() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Pattern", "icon" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPatternIcon() );
}
Pathname PatternImpl::script() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Pattern", "script" );
+#warning DUBIOUS ATTRIBUTE
+ return "";
+ //return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPatternScript() );
}
Label PatternImpl::order() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Pattern", "order" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrPatternOrder() );
}
//std::set<std::string> install_packages( const Locale & lang = Locale("") ) const;
// const CapSet & PatternImpl::includes() const
// {
-//
+//
// }
-//
+//
// const CapSet & PatternImpl::extends() const
// {
-//
+//
// }
/////////////////////////////////////////////////////////////////
public:
PatternImpl( const data::RecordId &id, repo::cached::RepoImpl::Ptr repository_r );
-
+
virtual TranslatedText summary() const;
virtual TranslatedText description() const;
virtual TranslatedText insnotify() const;
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
-
- virtual Source_Ref source() const;
- virtual unsigned mediaNr() const;
-
+
// PATTERN
virtual bool isDefault() const;
virtual bool userVisible() const;
//virtual std::set<std::string> install_packages( const Locale & lang = Locale("") ) const;
// virtual const CapSet & includes() const;
// virtual const CapSet & extends() const;
-
-
+
+
virtual Repository repository() const;
-
- protected:
+
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
#include "zypp/base/Logger.h"
#include "zypp/repo/RepositoryImpl.h"
#include "ProductImpl.h"
+#include "zypp/cache/CacheAttributes.h"
using namespace std;
TranslatedText ProductImpl::summary() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "summary" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectSummary() );
}
TranslatedText ProductImpl::description() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "description" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDescription() );
}
TranslatedText ProductImpl::insnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "insnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectInsnotify() );
}
TranslatedText ProductImpl::delnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "delnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDelnotify() );
}
TranslatedText ProductImpl::licenseToConfirm() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "licenseToConfirm" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectLicenseToConfirm() );
}
Vendor ProductImpl::vendor() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "ResObject", "vendor" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrResObjectVendor() );
}
ByteCount ProductImpl::size() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "size" );
-}
-
-ByteCount ProductImpl::archivesize() const
-{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "archivesize" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectInstalledSize() );
}
bool ProductImpl::installOnly() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "ResObject", "installOnly" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrResObjectInstallOnly() );
}
Date ProductImpl::buildtime() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "buildtime" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectBuildTime() );
}
Date ProductImpl::installtime() const
}
//////////////////////////////////////////
-// DEPRECATED
-//////////////////////////////////////////
-
-Source_Ref ProductImpl::source() const
-{
- return Source_Ref::noSource;
-}
-
-unsigned ProductImpl::mediaNr() const
-{
- return 1;
-}
-
-//////////////////////////////////////////
// PRODUCT
/////////////////////////////////////////
std::string ProductImpl::category() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Product", "category" );
+#warning DUBIOUS ATTRIBUTE
+ return "";
+ //return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrProductCategory() );
}
Url ProductImpl::releaseNotesUrl() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Product", "releaseNotesUrl" );
+#warning DUBIOUS ATTRIBUTE
+ return Url();
+ //return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrProductReleaseNotesUrl() );
}
std::list<Url> ProductImpl::updateUrls() const
{
std::list<Url> urls;
- _repository->resolvableQuery().queryStringContainerAttribute( _id, "Product", "updateUrls", back_inserter(urls) );
+ _repository->resolvableQuery().queryStringContainerAttribute( _id, cache::attrProductUpdateUrls(), back_inserter(urls) );
return urls;
}
std::list<Url> ProductImpl::extraUrls() const
{
std::list<Url> urls;
- _repository->resolvableQuery().queryStringContainerAttribute( _id, "Product", "extraUrls", back_inserter(urls) );
+ _repository->resolvableQuery().queryStringContainerAttribute( _id, cache::attrProductExtraUrls(), back_inserter(urls) );
return urls;
}
std::list<Url> ProductImpl::optionalUrls() const
{
std::list<Url> urls;
- _repository->resolvableQuery().queryStringContainerAttribute( _id, "Product", "optionalUrls", back_inserter(urls) );
+ _repository->resolvableQuery().queryStringContainerAttribute( _id, cache::attrProductOptionalUrls(), back_inserter(urls) );
return urls;
}
list<string> ProductImpl::flags() const
{
list<string> flags;
- _repository->resolvableQuery().queryStringContainerAttribute( _id, "Product", "flags", back_inserter(flags) );
+ _repository->resolvableQuery().queryStringContainerAttribute( _id, cache::attrProductFlags(), back_inserter(flags) );
return flags;
}
TranslatedText ProductImpl::shortName() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "Product", "shortName" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrProductShortName() );
}
std::string ProductImpl::distributionName() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Product", "distributionName" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrProductDistributionName() );
}
Edition ProductImpl::distributionEdition() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Product", "distributionEdition" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrProductDistributionEdition() );
}
/////////////////////////////////////////////////////////////////
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
-
- virtual Source_Ref source() const;
- virtual unsigned mediaNr() const;
-
+
// PRODUCT
virtual std::string category() const;
virtual Url releaseNotesUrl() const;
virtual Edition distributionEdition() const;
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
#include <iostream>
#include <map>
+#include "zypp/base/Gettext.h"
#include "zypp/base/Logger.h"
#include "zypp/base/Measure.h"
#include "zypp/capability/Capabilities.h"
#include "zypp/CapFactory.h"
#include "zypp/Package.h"
+#include "zypp/SrcPackage.h"
+#include "zypp/Product.h"
#include "zypp/Pattern.h"
#include "zypp/Patch.h"
#include "zypp/Message.h"
#include "zypp/repo/cached/RepoImpl.h"
#include "zypp/repo/cached/PackageImpl.h"
+#include "zypp/repo/cached/SrcPackageImpl.h"
+#include "zypp/repo/cached/ProductImpl.h"
#include "zypp/repo/cached/PatternImpl.h"
#include "zypp/repo/cached/PatchImpl.h"
#include "zypp/repo/cached/MessageImpl.h"
#include "zypp/repo/cached/ScriptImpl.h"
#include "zypp/repo/cached/AtomImpl.h"
+#include "zypp/cache/CacheAttributes.h"
using namespace zypp::detail;
using namespace zypp::cache;
namespace cached
{ /////////////////////////////////////////////////////////////////
-RepoImpl::RepoImpl( const RepoInfo &repoinfo, const Pathname &dbdir, const data::RecordId &repository_id )
- : RepositoryImpl(repoinfo),
- _dbdir(dbdir),
- _type_cache(dbdir),
- _repository_id(repository_id),
- _rquery(dbdir)
+RepoImpl::RepoImpl( const RepoOptions &opts )
+ : RepositoryImpl(opts.repoinfo)
+ , _type_cache(opts.dbdir)
+ , _rquery(opts.dbdir)
+ , _options(opts)
{
}
RepoImpl::~RepoImpl()
{
-
+ MIL << "Destroying repo '" << info().alias() << "'" << endl;
}
+static int global_progress_handler(void* ptr)
+{
+ MIL << "BOOOOOOOOOH" << std::endl;
+ //RepoImpl *r = dynamic_cast<RepoImpl *>(ptr);
+ RepoImpl *r = (RepoImpl *)(ptr);
+ if ( r )
+ return r->progress_handler(ptr);
+
+ return 1;
+}
void RepoImpl::factoryInit()
{
MIL << "Plaindir repository initialized." << std::endl;
}
-void read_capabilities( sqlite3_connection &con, map<data::RecordId, NVRAD> &nvras );
+void read_capabilities( sqlite3_connection &con,
+ map<data::RecordId, NVRAD> &nvras,
+ ProgressData &progress );
+int RepoImpl::progress_handler(void* ptr)
+{
+ if ( _ticks.tick() )
+ return 1;
+ return 1;
+}
+
void RepoImpl::createResolvables()
{
+ _ticks = ProgressData();
+ _ticks.sendTo(_options.readingResolvablesProgress);
+ _ticks.name(str::form(_( "Reading '%s' repository cache"), info().alias().c_str()));
+
debug::Measure m("create resolvables");
CapFactory capfactory;
try
- {
- sqlite3_connection con((_dbdir + "zypp.db").asString().c_str());
+ {
+ sqlite3_connection con((_options.dbdir + "zypp.db").asString().c_str());
+ //con.setprogresshandler(100, global_progress_handler, (void*)this);
+
con.executenonquery("PRAGMA cache_size=8000;");
con.executenonquery("BEGIN;");
+// We could use this to calculate total resolvables
+// sqlite3_command total_cmd("select count(id) from resolvables where repository_id=:repository_id;");
+// total_cmd.bind(":repository_id", _repository_id);
+// int total = total_cmd.executeint();
+
sqlite3_command cmd( con, "select id,name,version,release,epoch,arch,kind from resolvables where repository_id=:repository_id;");
- cmd.bind(":repository_id", _repository_id);
+ cmd.bind(":repository_id", _options.repository_id);
map<data::RecordId, pair<Resolvable::Kind, NVRAD> > nvras;
-
+
sqlite3_reader reader = cmd.executereader();
while(reader.read())
{
_type_cache.archFor(reader.getint(5)),
deps ) );
}
-
+
MIL << "Done reading resolvables nvra" << endl;
- read_capabilities( con, nvras);
+ _ticks.tick();
+
+ read_capabilities( con, _options.repository_id, nvras );
+
+ _ticks.tick();
for ( map<data::RecordId, pair<Resolvable::Kind, NVRAD> >::const_iterator it = nvras.begin(); it != nvras.end(); ++it )
{
{
ResImplTraits<cached::PackageImpl>::Ptr impl = new cached::PackageImpl(it->first, this);
Package::Ptr package = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (package);
+ _store.insert( package );
+ }
+ else if ( it->second.first == ResTraits<SrcPackage>::kind )
+ {
+ ResImplTraits<cached::SrcPackageImpl>::Ptr impl = new cached::SrcPackageImpl(it->first, this);
+ SrcPackage::Ptr srcpackage = detail::makeResolvableFromImpl( it->second.second, impl );
+ _store.insert( srcpackage );
+ }
+ else if ( it->second.first == ResTraits<Product>::kind )
+ {
+ ResImplTraits<cached::ProductImpl>::Ptr impl = new cached::ProductImpl(it->first, this);
+ Product::Ptr product = detail::makeResolvableFromImpl( it->second.second, impl );
+ _store.insert( product );
}
else if ( it->second.first == ResTraits<Pattern>::kind )
{
ResImplTraits<cached::PatternImpl>::Ptr impl = new cached::PatternImpl(it->first, this);
Pattern::Ptr pattern = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (pattern);
+ _store.insert( pattern );
}
else if ( it->second.first == ResTraits<Patch>::kind )
{
ResImplTraits<cached::PatchImpl>::Ptr impl = new cached::PatchImpl(it->first, this);
Patch::Ptr patch = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (patch);
+ _store.insert( patch );
}
else if ( it->second.first == ResTraits<Message>::kind )
{
ResImplTraits<cached::MessageImpl>::Ptr impl = new cached::MessageImpl(it->first, this);
Message::Ptr message = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (message);
+ _store.insert( message );
}
else if ( it->second.first == ResTraits<Script>::kind )
{
ResImplTraits<cached::ScriptImpl>::Ptr impl = new cached::ScriptImpl(it->first, this);
Script::Ptr script = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (script);
+ _store.insert( script );
}
else if ( it->second.first == ResTraits<Atom>::kind )
{
ResImplTraits<cached::AtomImpl>::Ptr impl = new cached::AtomImpl(it->first, this);
Atom::Ptr atom = detail::makeResolvableFromImpl( it->second.second, impl );
- _store.insert (atom);
+ _store.insert( atom );
}
}
con.executenonquery("COMMIT;");
+ con.setprogresshandler(00, NULL, NULL);
}
catch(exception &ex) {
cerr << "Exception Occured: " << ex.what() << endl;
}
//extract_packages_from_directory( _store, thePath, selfRepositoryRef(), true );
-
}
static CheckSum encoded_string_to_checksum( const std::string &encoded )
void RepoImpl::createPatchAndDeltas()
{
+ _ticks = ProgressData();
+ _ticks.sendTo(_options.readingPatchDeltasProgress );
+ _ticks.name(str::form(_( "Reading patch and delta rpms from '%s' repository cache"), info().alias().c_str()));
+
try
- {
- sqlite3_connection con((_dbdir + "zypp.db").asString().c_str());
+ {
+ sqlite3_connection con((_options.dbdir + "zypp.db").asString().c_str());
+ //con.setprogresshandler(500, global_progress_handler, (void*)this);
con.executenonquery("PRAGMA cache_size=8000;");
con.executenonquery("BEGIN;");
string pp_bv_query =
"SELECT version, release, epoch "
"FROM patch_packages_baseversions WHERE patch_package_id = :patch_package_id";
-
+
string delta_query =
// 0 1 2 3 4 5 6 7 8 9 10
"SELECT id, media_nr, location, checksum, download_size, build_time, baseversion_version, baseversion_release, baseversion_epoch, baseversion_checksum, baseversion_build_time "
// 11
", baseversion_sequence_info "
"FROM delta_packages WHERE repository_id=:repository_id;";
-
+
// bind the master repo id to the query
sqlite3_command deltas_cmd( con, delta_query);
- deltas_cmd.bind(":repository_id", _repository_id);
+ deltas_cmd.bind(":repository_id", _options.repository_id);
sqlite3_reader reader = deltas_cmd.executereader();
while ( reader.read() )
{
zypp::OnMediaLocation on_media;
- on_media.medianr(reader.getint(1));
- on_media.filename(reader.getstring(2));
-
+ on_media.setMedianr(reader.getint(1));
+ on_media.setFilename(reader.getstring(2));
+
string checksum_string(reader.getstring(3));
CheckSum checksum = encoded_string_to_checksum(checksum_string);
if ( checksum.empty() )
ERR << "Wrong checksum for delta, skipping..." << endl;
continue;
}
- on_media.checksum(checksum);
- on_media.downloadsize(reader.getint(4));
-
+ on_media.setChecksum(checksum);
+ on_media.setDownloadSize(reader.getint(4));
+
packagedelta::DeltaRpm::BaseVersion baseversion;
- baseversion.edition( Edition(reader.getstring(6), reader.getstring(7), reader.getstring(8) ) );
-
+ baseversion.setEdition( Edition(reader.getstring(6), reader.getstring(7), reader.getstring(8) ) );
+
checksum_string = reader.getstring(9);
checksum = encoded_string_to_checksum(checksum_string);
if ( checksum.empty() )
ERR << "Wrong checksum for delta, skipping..." << endl;
continue;
}
- baseversion.checksum(checksum);
- baseversion.buildtime(reader.getint(10));
- baseversion.sequenceinfo(reader.getstring(11));
-
+ baseversion.setChecksum(checksum);
+ baseversion.setBuildtime(reader.getint(10));
+ baseversion.setSequenceinfo(reader.getstring(11));
+
zypp::packagedelta::DeltaRpm delta;
- delta.location( on_media );
- delta.baseversion( baseversion );
- delta.buildtime(reader.getint(5));
-
- //impl->addDeltaRpm(delta);
+ delta.setLocation( on_media );
+ delta.setBaseversion( baseversion );
+ delta.setBuildtime(reader.getint(5));
+
+ _deltaRpms.push_back(delta);
}
-
+
// patch rpms
// bind the master package id to the query
// bind the master repo id to the query
sqlite3_command pp_cmd( con, pp_query);
sqlite3_command pp_bv_cmd( con, pp_bv_query);
- pp_cmd.bind(":repository_id", _repository_id);
+ pp_cmd.bind(":repository_id", _options.repository_id);
reader = pp_cmd.executereader();
while ( reader.read() )
{
long long patch_package_id = reader.getint64(0);
-
+
zypp::OnMediaLocation on_media;
- on_media.medianr( reader.getint(1) );
- on_media.filename( reader.getstring(2) );
-
+ on_media.setMedianr( reader.getint(1) );
+ on_media.setFilename( reader.getstring(2) );
+
string checksum_string(reader.getstring(3));
CheckSum checksum = encoded_string_to_checksum(checksum_string);
if ( checksum.empty() )
ERR << "Wrong checksum for delta, skipping..." << endl;
continue;
}
- on_media.checksum(checksum);
- on_media.downloadsize(reader.getint(4));
-
+ on_media.setChecksum(checksum);
+ on_media.setDownloadSize(reader.getint(4));
+
zypp::packagedelta::PatchRpm patch;
- patch.location( on_media );
- patch.buildtime(reader.getint(5));
-
+ patch.setLocation( on_media );
+ patch.setBuildtime(reader.getint(5));
+
pp_bv_cmd.bind( ":patch_package_id", patch_package_id );
-
+
sqlite3_reader bv_reader = pp_bv_cmd.executereader();
while (bv_reader.read())
{
packagedelta::PatchRpm::BaseVersion baseversion = packagedelta::PatchRpm::BaseVersion( bv_reader.getstring(0) , bv_reader.getstring(1), bv_reader.getint(2) );
- patch.baseversion(baseversion);
+ patch.addBaseversion(baseversion);
}
-
- //impl->addPatchRpm(patch);
+
+ _patchRpms.push_back(patch);
}
+ con.setprogresshandler(0, NULL, NULL);
}
catch(exception &ex) {
cerr << "Exception Occured: " << ex.what() << endl;
}
}
-
+
ResolvableQuery RepoImpl::resolvableQuery()
{
return _rquery;
}
-void RepoImpl::read_capabilities( sqlite3_connection &con, map<data::RecordId, pair<Resolvable::Kind, NVRAD> > &nvras )
+void RepoImpl::read_capabilities( sqlite3_connection &con,
+ data::RecordId repo_id,
+ map<data::RecordId, pair<Resolvable::Kind, 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;");
// {
// 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;");
+ 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, resolvables res where v.name_id=n.id and v.resolvable_id=res.id and res.repository_id=:repo_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, resolvables res where f.id=fc.file_id and f.dir_name_id=dn.id and f.file_name_id=fn.id and fc.resolvable_id=res.id and res.repository_id=:repo_id;");
+ sqlite3_command select_hal_cmd( con, "select hc.refers_kind, hc.name, hc.value, hc.relation, hc.dependency_type, hc.resolvable_id from hal_capabilities hc, resolvables res where hc.resolvable_id=res.id and res.repository_id=:repo_id;");
+
+ sqlite3_command select_modalias_cmd( con, "select mc.refers_kind, mc.name, mc.value, mc.relation, mc.dependency_type, mc.resolvable_id from modalias_capabilities mc, resolvables res where mc.resolvable_id=res.id and res.repository_id=:repo_id;");
+
+ sqlite3_command select_other_cmd( con, "select oc.refers_kind, oc.value, oc.dependency_type, oc.resolvable_id from other_capabilities oc, resolvables res where oc.resolvable_id=res.id and res.repository_id=:repo_id;");
+
+
{
debug::Measure mnc("read named capabilities");
+ select_named_cmd.bind(":repo_id", repo_id);
sqlite3_reader reader = select_named_cmd.executereader();
while ( reader.read() )
{
-
+
Resolvable::Kind refer = _type_cache.kindFor(reader.getint(0));
Rel rel = _type_cache.relationFor(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 = _type_cache.deptypeFor(reader.getint(6));
- nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(ncap) ) );
+ zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(6));
+ nvras[rid].second[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 = _type_cache.deptypeFor(reader.getint(6));
- nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(vcap) ) );
+ nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(vcap) ) );
}
}
}
-
+
{
debug::Measure mnf("read file capabilities");
+ select_file_cmd.bind(":repo_id", repo_id);
sqlite3_reader reader = select_file_cmd.executereader();
while ( reader.read() )
{
capability::FileCap *fcap = new capability::FileCap( refer, reader.getstring(1) + "/" + reader.getstring(2) );
zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(3));
data::RecordId rid = reader.getint64(4);
- nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(fcap) ) );
+ nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(fcap) ) );
+ }
+ }
+
+ {
+ debug::Measure mnf("read hal capabilities");
+ select_hal_cmd.bind(":repo_id", repo_id);
+ sqlite3_reader reader = select_hal_cmd.executereader();
+ while ( reader.read() )
+ {
+ //select hc.refers_kind, hc.name, hc.value, hc.relation, hc.dependency_type, hc.resolvable_id from hal_capabilities hc
+
+ Resolvable::Kind refer = _type_cache.kindFor(reader.getint(0));
+
+ Rel rel = _type_cache.relationFor(reader.getint(3));
+ capability::HalCap *hcap = new capability::HalCap( refer, reader.getstring(1), rel, reader.getstring(2) );
+ zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(4));
+ data::RecordId rid = reader.getint64(5);
+ nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(hcap) ) );
+ }
+ }
+
+ {
+ debug::Measure mnf("read modalias capabilities");
+ select_modalias_cmd.bind(":repo_id", repo_id);
+ sqlite3_reader reader = select_modalias_cmd.executereader();
+ while ( reader.read() )
+ {
+
+ //select mc.refers_kind, mc.name, mc.value, mc.relation, mc.dependency_type, mc.resolvable_id from modalias_capabilities mc;
+ Resolvable::Kind refer = _type_cache.kindFor(reader.getint(0));
+
+ Rel rel = _type_cache.relationFor(reader.getint(3));
+ capability::ModaliasCap *mcap = new capability::ModaliasCap( refer, reader.getstring(1), rel, reader.getstring(2) );
+ zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(4));
+ data::RecordId rid = reader.getint64(5);
+ nvras[rid].second[deptype].insert( capfactory.fromImpl( capability::CapabilityImpl::Ptr(mcap) ) );
+ }
+ }
+
+ {
+ debug::Measure mnf("read other capabilities");
+ select_other_cmd.bind(":repo_id", repo_id);
+ sqlite3_reader reader = select_other_cmd.executereader();
+ while ( reader.read() )
+ {
+ //select oc.refers_kind, oc.value, oc.dependency_type, oc.resolvable_id from other_capabilities oc;
+
+ Resolvable::Kind refer = _type_cache.kindFor(reader.getint(0));
+ capability::CapabilityImpl::Ptr cap = capability::parse( refer, reader.getstring(1));
+
+ if ( !cap )
+ {
+ ERR << "Invalid capability " << reader.getstring(1) << endl;
+ }
+
+ zypp::Dep deptype = _type_cache.deptypeFor(reader.getint(2));
+ data::RecordId rid = reader.getint64(3);
+ nvras[rid].second[deptype].insert( capfactory.fromImpl(cap) );
}
}
#include "zypp/Arch.h"
#include "zypp/Rel.h"
#include "zypp/Pathname.h"
+#include "zypp/ProgressData.h"
#include "zypp/data/RecordId.h"
#include "zypp/repo/RepositoryImpl.h"
#include "zypp/ResStore.h"
namespace cached
{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : RepoImpl
- //
- /** */
+ struct RepoOptions
+ {
+ RepoOptions( const RepoInfo &repoinfo_,
+ const Pathname &dbdir_,
+ const data::RecordId &repository_id_ )
+
+ : repoinfo(repoinfo_)
+ , dbdir(dbdir_)
+ , repository_id(repository_id_)
+ {}
+
+
+ ProgressData::ReceiverFnc readingResolvablesProgress;
+ ProgressData::ReceiverFnc readingPatchDeltasProgress;
+ RepoInfo repoinfo;
+ Pathname dbdir;
+ data::RecordId repository_id;
+ };
+
+ /**
+ * \short Cached repository implementation
+ *
+ * Reads attributes on demand from cache
+ */
class RepoImpl : public repo::RepositoryImpl
{
public:
public:
/** Default ctor */
- RepoImpl( const RepoInfo &repoinfo, const Pathname &dbdir, const data::RecordId &repository_id );
+ RepoImpl( const RepoOptions &opts );
/** Dtor */
~RepoImpl();
void factoryInit();
public:
+ virtual void createResolvables();
+ virtual void createPatchAndDeltas();
cache::ResolvableQuery resolvableQuery();
- void createResolvables();
- void createPatchAndDeltas();
- protected:
- void read_capabilities( sqlite3x::sqlite3_connection &con, std::map<data::RecordId, std::pair<Resolvable::Kind, NVRAD> > &nvras );
- Pathname _dbdir;
- cache::CacheTypes _type_cache;
- data::RecordId _repository_id;
-
+ private:
+ void read_capabilities( sqlite3x::sqlite3_connection &con,
+ data::RecordId repo_id,
+ std::map<data::RecordId,
+ std::pair<Resolvable::Kind, NVRAD> > &nvras );
+ cache::CacheTypes _type_cache;
cache::ResolvableQuery _rquery;
+ RepoOptions _options;
+ ProgressData _ticks;
+ public:
+ int progress_handler(void*);
};
///////////////////////////////////////////////////////////////////
#include "zypp/base/Logger.h"
#include "zypp/repo/RepositoryImpl.h"
#include "ScriptImpl.h"
+#include "zypp/cache/CacheAttributes.h"
using namespace std;
TranslatedText ScriptImpl::summary() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "summary" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectSummary() );
}
TranslatedText ScriptImpl::description() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "description" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDescription() );
}
TranslatedText ScriptImpl::insnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "insnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectInsnotify() );
}
TranslatedText ScriptImpl::delnotify() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "delnotify" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDelnotify() );
}
TranslatedText ScriptImpl::licenseToConfirm() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "ResObject", "licenseToConfirm" );
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectLicenseToConfirm() );
}
Vendor ScriptImpl::vendor() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "ResObject", "vendor" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrResObjectVendor() );
}
ByteCount ScriptImpl::size() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "size" );
-}
-
-ByteCount ScriptImpl::archivesize() const
-{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "archivesize" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectInstalledSize() );
}
bool ScriptImpl::installOnly() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "ResObject", "installOnly" );
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrResObjectInstallOnly() );
}
Date ScriptImpl::buildtime() const
{
- return _repository->resolvableQuery().queryNumericAttribute( _id, "ResObject", "buildtime" );
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectBuildTime() );
}
Date ScriptImpl::installtime() const
return Date();
}
-//////////////////////////////////////////
-// DEPRECATED
-//////////////////////////////////////////
-
-Source_Ref ScriptImpl::source() const
-{
- return Source_Ref::noSource;
-}
-
unsigned ScriptImpl::mediaNr() const
{
return 1;
Pathname ScriptImpl::do_script() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Script", "doScript" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrScriptDoScript() );
}
Pathname ScriptImpl::undo_script() const
{
- return _repository->resolvableQuery().queryStringAttribute( _id, "Script", "undoScript" );
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrScriptUndoScript() );
}
bool ScriptImpl::undo_available() const
{
- return _repository->resolvableQuery().queryBooleanAttribute( _id, "Script", "undoAvailable", false );
+#warning DUBIOUS ATTRIBUTE
+ return false;
+ //return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrScriptUndoAvailable(), false );
}
-
+
/////////////////////////////////////////////////////////////////
} } } // namespace zypp::repo::cached
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual Source_Ref source() const;
virtual unsigned mediaNr() const;
// SCRIPT
virtual Repository repository() const;
- protected:
+ private:
repo::cached::RepoImpl::Ptr _repository;
data::RecordId _id;
};
| /_____||_| |_| |_| |
| |
\---------------------------------------------------------------------*/
-/** \file zmd/backend/dbsource/SrcPackageImpl.h
- *
+/** \file zypp/repo/cached/SrcPackageImpl.cc
*/
#include "SrcPackageImpl.h"
-#include "zypp/source/SourceImpl.h"
#include "zypp/TranslatedText.h"
#include "zypp/base/String.h"
#include "zypp/base/Logger.h"
+#include "zypp/cache/CacheAttributes.h"
using namespace std;
using namespace zypp::detail;
/** Default ctor
*/
-SrcPackageImpl::SrcPackageImpl (Source_Ref source_r)
- : _source (source_r)
- , _install_only(false)
- , _size_installed(0)
- , _size_archive(0)
- , _data_loaded(false)
+SrcPackageImpl::SrcPackageImpl ( const data::RecordId & id, repo::cached::RepoImpl::Ptr repository_r )
+ : _repository( repository_r )
+ , _id( id )
{}
-Source_Ref
-SrcPackageImpl::source() const
+Repository SrcPackageImpl::repository() const
{
- return _source;
+ return _repository->selfRepository();
}
-/** Package summary */
+///////////////////////////////////////////////////
+// ResObject Attributes
+///////////////////////////////////////////////////
+
TranslatedText SrcPackageImpl::summary() const
{
- return _summary;
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectSummary() );
}
-/** Package description */
TranslatedText SrcPackageImpl::description() const
{
- return _description;
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDescription() );
}
-PackageGroup SrcPackageImpl::group() const
+TranslatedText SrcPackageImpl::insnotify() const
{
- return _group;
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectInsnotify() );
}
-Pathname SrcPackageImpl::location() const
+TranslatedText SrcPackageImpl::delnotify() const
{
- return _location;
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectDelnotify() );
}
-ByteCount SrcPackageImpl::size() const
+TranslatedText SrcPackageImpl::licenseToConfirm() const
+{
+ return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, cache::attrResObjectLicenseToConfirm() );
+}
+
+Vendor SrcPackageImpl::vendor() const
{
- return _size_installed;
+ return _repository->resolvableQuery().queryStringAttribute( _id, cache::attrResObjectVendor() );
}
-/** */
-ByteCount SrcPackageImpl::archivesize() const
+ByteCount SrcPackageImpl::size() const
{
- return _size_archive;
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectInstalledSize() );
}
bool SrcPackageImpl::installOnly() const
{
- return _install_only;
+ return _repository->resolvableQuery().queryBooleanAttribute( _id, cache::attrResObjectInstallOnly() );
}
-unsigned SrcPackageImpl::mediaNr() const
+Date SrcPackageImpl::buildtime() const
{
- return _media_nr;
+ return _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrResObjectBuildTime() );
}
-Vendor SrcPackageImpl::vendor() const
+Date SrcPackageImpl::installtime() const
+{
+ return Date();
+}
+
+////////////////////////////////////////////////////////
+// SRC PACKAGE
+////////////////////////////////////////////////////////
+
+OnMediaLocation SrcPackageImpl::location() const
{
- return "suse";
+ OnMediaLocation loc;
+ string chktype = _repository->resolvableQuery().queryStringAttribute( _id, cache::attrSrcPackageLocationChecksumType() );
+ string chkvalue = _repository->resolvableQuery().queryStringAttribute( _id, cache::attrSrcPackageLocationChecksum() );
+ loc.setChecksum(CheckSum(chktype, chkvalue));
+ loc.setFilename( _repository->resolvableQuery().queryStringAttribute( _id, cache::attrSrcPackageLocationFilename() ) );
+ loc.setDownloadSize( _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrSrcPackageLocationDownloadSize() ) );
+ loc.setMedianr( _repository->resolvableQuery().queryNumericAttribute( _id, cache::attrSrcPackageLocationMediaNr() ) );
+ return loc;
}
/////////////////////////////////////////////////////////////////
#ifndef CachedRepoSrcPackageImpl_H
#define CachedRepoSrcPackageImpl_H
-#include "zypp/detail/PackageImpl.h"
-#include "zypp/Source.h"
-//#include <sqlite3.h>
+#include "zypp/detail/SrcPackageImpl.h"
+#include "zypp/repo/cached/RepoImpl.h"
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
namespace repo
-{
+{ /////////////////////////////////////////////////////////////////
namespace cached
{
///////////////////////////////////////////////////////////////////
//
- // CLASS NAME : CachedSourcePackageImpl
+ // CLASS NAME : SourcePackageImpl
//
class SrcPackageImpl : public detail::SrcPackageImplIf
{
public:
- SrcPackageImpl( Source_Ref source_r );
+ SrcPackageImpl( const data::RecordId &id, repo::cached::RepoImpl::Ptr repository_r );
+
+ virtual Repository repository() const;
virtual TranslatedText summary() const;
virtual TranslatedText description() const;
+ virtual TranslatedText insnotify() const;
+ virtual TranslatedText delnotify() const;
+ virtual TranslatedText licenseToConfirm() const;
+ virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual PackageGroup group() const;
- virtual ByteCount archivesize() const;
- virtual Pathname location() const;
virtual bool installOnly() const;
- virtual Source_Ref source() const;
- virtual unsigned mediaNr() const;
- virtual Vendor vendor() const;
-
- protected:
- Source_Ref _source;
- TranslatedText _summary;
- TranslatedText _description;
- PackageGroup _group;
- Pathname _location;
- bool _install_only;
- unsigned _media_nr;
-
- ByteCount _size_installed;
- ByteCount _size_archive;
-
- bool _data_loaded;
+ virtual Date buildtime() const;
+ virtual Date installtime() const;
+
+ virtual OnMediaLocation location() const;
+ private:
+ repo::cached::RepoImpl::Ptr _repository;
+ data::RecordId _id;
};
/////////////////////////////////////////////////////////////////
} // ns cached
return _size;
}
-ByteCount AtomImpl::archivesize() const
-{
- return _archivesize;
-}
-
bool AtomImpl::installOnly() const
{
return _install_only;
return _installtime;
}
-unsigned AtomImpl::mediaNr() const
-{
- return _media_nr;
-}
-
/////////////////////////////////////////////////////////////////
} } } // namespace zypp::repo::memory
///////////////////////////////////////////////////////////////////
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual unsigned mediaNr() const;
-
virtual Repository repository() const;
protected:
TranslatedText _license_to_confirm;
Vendor _vendor;
ByteCount _size;
- ByteCount _archivesize;
bool _install_only;
Date _buildtime;
Date _installtime;
/** Default ctor
*/
-MessageImpl::MessageImpl (const data::RecordId &id, memory::RepoImpl::Ptr repository_r)
- : _repository (repository_r),
- _id(id)
+MessageImpl::MessageImpl ( memory::RepoImpl::Ptr repo, data::Message_Ptr ptr)
+ : _repository(repo),
+
+ _summary(ptr->summary),
+ _description(ptr->description),
+ _insnotify(ptr->insnotify),
+ _delnotify(ptr->delnotify),
+ _license_to_confirm(ptr->licenseToConfirm),
+ _vendor(ptr->vendor),
+ _size(ptr->installedSize),
+ _install_only(false),
+ _buildtime(ptr->buildTime),
+
+ _text(ptr->text)
{}
Repository
return _size;
}
-ByteCount MessageImpl::archivesize() const
-{
- return _archivesize;
-}
-
bool MessageImpl::installOnly() const
{
return _install_only;
return _installtime;
}
-unsigned MessageImpl::mediaNr() const
-{
- return _media_nr;
-}
-
-
-//////////////////////////////////////////
-// DEPRECATED
-//////////////////////////////////////////
-
-Source_Ref MessageImpl::source() const
-{
- return Source_Ref::noSource;
-}
-
-unsigned MessageImpl::mediaNr() const
-{
- return 1;
-}
-
//////////////////////////////////////////
// MESSAGE
/////////////////////////////////////////
TranslatedText MessageImpl::text() const
{
- return _repository->resolvableQuery().queryTranslatedStringAttribute( _id, "Message", "text" );
+ return _text;
}
Patch::constPtr MessageImpl::patch() const
{
public:
- MessageImpl( const data::RecordId &id, repo::memory::RepoImpl::Ptr repository_r );
-
+ MessageImpl( memory::RepoImpl::Ptr repo, data::Message_Ptr ptr);
+
virtual TranslatedText summary() const;
virtual TranslatedText description() const;
virtual TranslatedText insnotify() const;
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
-
- virtual Source_Ref source() const;
- virtual unsigned mediaNr() const;
-
+
// MESSAGE
virtual TranslatedText text() const;
virtual Patch::constPtr patch() const;
-
+
virtual Repository repository() const;
-
+
protected:
repo::memory::RepoImpl::Ptr _repository;
-
+
//ResObject
TranslatedText _summary;
TranslatedText _description;
TranslatedText _license_to_confirm;
Vendor _vendor;
ByteCount _size;
- ByteCount _archivesize;
bool _install_only;
Date _buildtime;
Date _installtime;
- unsigned _media_nr;
+
+ TranslatedText _text;
};
/////////////////////////////////////////////////////////////////
} // namespace memory
_license_to_confirm(ptr->licenseToConfirm),
_vendor(ptr->vendor),
_size(ptr->installedSize),
- _archivesize(ptr->repositoryLocation.fileSize),
_install_only(false),
_buildtime(ptr->buildTime),
- _media_nr(ptr->repositoryLocation.mediaNr),
-
+
_group(ptr->group),
_keywords(),
_authors(ptr->authors),
_license(ptr->license),
- _location(ptr->repositoryLocation.filePath),
_diskusage(),
- _checksum(ptr->repositoryLocation.fileChecksum)
+ _location(ptr->repositoryLocation)
{
}
return _size;
}
-ByteCount PackageImpl::archivesize() const
-{
- return _archivesize;
-}
-
bool PackageImpl::installOnly() const
{
return _install_only;
return _installtime;
}
-unsigned PackageImpl::mediaNr() const
+OnMediaLocation PackageImpl::location() const
{
- return _media_nr;
+ return _location;
}
////////////////////////////////////////////////////
-CheckSum PackageImpl::checksum() const
-{
- return _checksum;
-}
-
string PackageImpl::buildhost() const
{
return string();
return Changelog();
}
-Pathname PackageImpl::location() const
-{
- return _location;
-}
-
string PackageImpl::url() const
{
return string();
#define ZYPP_SOURCE_MEMORYPACKAGEIMPL_H
#include "zypp/detail/PackageImplIf.h"
-#include "zypp/Source.h"
#include "zypp/data/ResolvableData.h"
#include "zypp/DiskUsage.h"
#include "zypp/CheckSum.h"
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual unsigned mediaNr() const;
-
- virtual CheckSum checksum() const;
+
virtual std::string buildhost() const;
virtual std::string distribution() const;
virtual Label license() const;
virtual PackageGroup group() const;
virtual Keywords keywords() const;
virtual Changelog changelog() const;
- virtual Pathname location() const;
+ virtual OnMediaLocation location() const;
virtual std::string url() const;
virtual std::string os() const;
virtual Text prein() const;
TranslatedText _license_to_confirm;
Vendor _vendor;
ByteCount _size;
- ByteCount _archivesize;
bool _install_only;
Date _buildtime;
Date _installtime;
- unsigned _media_nr;
+
PackageGroup _group;
Keywords _keywords;
std::list<std::string> _authors;
Label _license;
- Pathname _location;
DiskUsage _diskusage;
- CheckSum _checksum;
+ OnMediaLocation _location;
private:
};
///////////////////////////////////////////////////////////////////
_license_to_confirm(ptr->licenseToConfirm),
_vendor(ptr->vendor),
_size(ptr->installedSize),
- //_archivesize(ptr->repositoryLocation.fileSize),
_install_only(false),
_buildtime(ptr->buildTime),
- //_media_nr(ptr->repositoryLocation.mediaNr),
_patch_id(ptr->id),
_timestamp(ptr->timestamp),
return _size;
}
-ByteCount PatchImpl::archivesize() const
-{
- return _archivesize;
-}
-
bool PatchImpl::installOnly() const
{
return _install_only;
return _installtime;
}
-unsigned PatchImpl::mediaNr() const
-{
- return _media_nr;
-}
-
//////////////////////////////////////////
// PATCH
/////////////////////////////////////////
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual unsigned mediaNr() const;
// PATCH
virtual std::string id() const;
TranslatedText _license_to_confirm;
Vendor _vendor;
ByteCount _size;
- ByteCount _archivesize;
bool _install_only;
Date _buildtime;
Date _installtime;
- unsigned _media_nr;
// patch
std::string _patch_id;
_license_to_confirm(ptr->licenseToConfirm),
_vendor(ptr->vendor),
_size(ptr->installedSize),
- //_archivesize(ptr->repositoryLocation.fileSize),
_install_only(false),
_buildtime(ptr->buildTime)
- //_media_nr(ptr->repositoryLocation.mediaNr)
//TODO pattern attrs
{
return _size;
}
-ByteCount PatternImpl::archivesize() const
-{
- return _archivesize;
-}
-
bool PatternImpl::installOnly() const
{
return _install_only;
return _installtime;
}
-unsigned PatternImpl::mediaNr() const
-{
- return _media_nr;
-}
-
-
///////////////////////////////////////
TranslatedText PatternImpl::category() const
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual unsigned mediaNr() const;
virtual TranslatedText category() const;
virtual bool userVisible() const;
TranslatedText _license_to_confirm;
Vendor _vendor;
ByteCount _size;
- ByteCount _archivesize;
bool _install_only;
Date _buildtime;
Date _installtime;
- unsigned _media_nr;
// Pattern
TranslatedText _category;
_license_to_confirm(ptr->licenseToConfirm),
_vendor(ptr->vendor),
_size(ptr->installedSize),
- //_archivesize(ptr->repositoryLocation.fileSize),
_install_only(false),
_buildtime(ptr->buildTime)
- //_media_nr(ptr->repositoryLocation.mediaNr)
// TODO products attrs
{}
return _size;
}
-ByteCount ProductImpl::archivesize() const
-{
- return _archivesize;
-}
-
bool ProductImpl::installOnly() const
{
return _install_only;
return _installtime;
}
-unsigned ProductImpl::mediaNr() const
-{
- return _media_nr;
-}
-
///////////////////////////////////////////
std::string ProductImpl::category() const
#include "zypp/CheckSum.h"
#include "zypp/CapSet.h"
#include "zypp/detail/ProductImplIf.h"
-#include "zypp/Source.h"
#include "zypp/data/ResolvableData.h"
#include "zypp/TranslatedText.h"
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
- virtual unsigned mediaNr() const;
virtual std::string category() const;
virtual Url releaseNotesUrl() const;
TranslatedText _license_to_confirm;
Vendor _vendor;
ByteCount _size;
- ByteCount _archivesize;
bool _install_only;
Date _buildtime;
Date _installtime;
- unsigned _media_nr;
std::string _category;
std::string _dist_name;
/** Default ctor
*/
-ScriptImpl::ScriptImpl (const data::RecordId &id, memory::RepoImpl::Ptr repository_r)
- : _repository (repository_r),
+ScriptImpl::ScriptImpl ( memory::RepoImpl::Ptr repo, data::Script_Ptr ptr)
+ : _repository (repo),
_summary(ptr->summary),
_description(ptr->description),
_insnotify(ptr->insnotify),
_license_to_confirm(ptr->licenseToConfirm),
_vendor(ptr->vendor),
_size(ptr->installedSize),
- _archivesize(ptr->repositoryLocation.fileSize),
_install_only(false),
- _buildtime(ptr->buildTime),
- _media_nr(ptr->repositoryLocation.mediaNr)
+ _buildtime(ptr->buildTime)
//TODO script attrs
{}
return _size;
}
-ByteCount ScriptImpl::archivesize() const
-{
- return _archivesize;
-}
-
bool ScriptImpl::installOnly() const
{
return _install_only;
return _installtime;
}
-unsigned ScriptImpl::mediaNr() const
-{
- return _media_nr;
-}
-
-
//////////////////////////////////////////
// MESSAGE
/////////////////////////////////////////
{
public:
- ScriptImpl( const data::RecordId &id, repo::memory::RepoImpl::Ptr repository_r );
+ ScriptImpl( memory::RepoImpl::Ptr repo, data::Script_Ptr ptr);
virtual TranslatedText summary() const;
virtual TranslatedText description() const;
virtual TranslatedText licenseToConfirm() const;
virtual Vendor vendor() const;
virtual ByteCount size() const;
- virtual ByteCount archivesize() const;
virtual bool installOnly() const;
virtual Date buildtime() const;
virtual Date installtime() const;
-
- virtual Source_Ref source() const;
- virtual unsigned mediaNr() const;
-
+
// SCRIPT
virtual Pathname do_script() const;
virtual Pathname undo_script() const;
TranslatedText _license_to_confirm;
Vendor _vendor;
ByteCount _size;
- ByteCount _archivesize;
bool _install_only;
Date _buildtime;
Date _installtime;
- unsigned _media_nr;
};
/////////////////////////////////////////////////////////////////
} // namespace memory
// METHOD NAME : SrcPackageImpl::SrcPackageImpl
// METHOD TYPE : Ctor
//
-SrcPackageImpl::SrcPackageImpl(data::SrcPackage_Ptr ptr)
- : _media_number( 1 )
+SrcPackageImpl::SrcPackageImpl( memory::RepoImpl::Ptr repo, data::SrcPackage_Ptr ptr)
+ : _repository(repo),
+
+ _summary(ptr->summary),
+ _description(ptr->description),
+ _insnotify(ptr->insnotify),
+ _delnotify(ptr->delnotify),
+ _license_to_confirm(ptr->licenseToConfirm),
+ _vendor(ptr->vendor),
+ _size(ptr->installedSize),
+ _install_only(false),
+ _buildtime(ptr->buildTime),
+
+ _location(ptr->repositoryLocation)
{}
///////////////////////////////////////////////////////////////////
SrcPackageImpl::~SrcPackageImpl()
{}
+///////////////////////////////////////////////////
+// ResObject Attributes
+///////////////////////////////////////////////////
-Pathname SrcPackageImpl::location() const
+TranslatedText SrcPackageImpl::summary() const
{
- return _location;
+ return _summary;
+}
+
+TranslatedText SrcPackageImpl::description() const
+{
+ return _description;
+}
+
+TranslatedText SrcPackageImpl::insnotify() const
+{
+ return _insnotify;
+}
+
+TranslatedText SrcPackageImpl::delnotify() const
+{
+ return _delnotify;
+}
+
+TranslatedText SrcPackageImpl::licenseToConfirm() const
+{
+ return _license_to_confirm;
}
-ByteCount SrcPackageImpl::archivesize() const
+Vendor SrcPackageImpl::vendor() const
{
- return _archivesize;
+ return _vendor;
}
+ByteCount SrcPackageImpl::size() const
+{
+ return _size;
+}
+
+bool SrcPackageImpl::installOnly() const
+{
+ return _install_only;
+}
+
+Date SrcPackageImpl::buildtime() const
+{
+ return _buildtime;
+}
+
+Date SrcPackageImpl::installtime() const
+{
+ return _installtime;
+}
+
+
DiskUsage SrcPackageImpl::diskusage() const
{
return _diskusage;
}
-unsigned SrcPackageImpl::sourceMediaNr() const
+OnMediaLocation SrcPackageImpl::location() const
{
- return _media_number;
+ return _location;
}
/////////////////////////////////////////////////////////////////
#include "zypp/detail/SrcPackageImplIf.h"
#include "zypp/DiskUsage.h"
#include "zypp/data/ResolvableData.h"
+#include "zypp/repo/memory/RepoImpl.h"
///////////////////////////////////////////////////////////////////
namespace zypp
*/
struct SrcPackageImpl : public zypp::detail::SrcPackageImplIf
{
- SrcPackageImpl(data::SrcPackage_Ptr ptr);
+ SrcPackageImpl( memory::RepoImpl::Ptr repo, data::SrcPackage_Ptr ptr);
virtual ~SrcPackageImpl();
- /** */
- virtual Pathname location() const;
- /** */
- virtual ByteCount archivesize() const;
- /** */
+ virtual TranslatedText summary() const;
+ virtual TranslatedText description() const;
+ virtual TranslatedText insnotify() const;
+ virtual TranslatedText delnotify() const;
+ virtual TranslatedText licenseToConfirm() const;
+ virtual Vendor vendor() const;
+ virtual ByteCount size() const;
+ virtual bool installOnly() const;
+ virtual Date buildtime() const;
+ virtual Date installtime() const;
+
virtual DiskUsage diskusage() const;
- /** */
- virtual unsigned sourceMediaNr() const;
-
+ virtual OnMediaLocation location() const;
private:
- ByteCount _archivesize;
- unsigned _media_number;
- Pathname _location;
+ repo::memory::RepoImpl::Ptr _repository;
+
+ //ResObject
+ TranslatedText _summary;
+ TranslatedText _description;
+ TranslatedText _insnotify;
+ TranslatedText _delnotify;
+ TranslatedText _license_to_confirm;
+ Vendor _vendor;
+ ByteCount _size;
+ bool _install_only;
+ Date _buildtime;
+ Date _installtime;
+
+ OnMediaLocation _location;
DiskUsage _diskusage;
};
///////////////////////////////////////////////////////////////////
void Downloader::download( const Pathname &dest_dir,
const ProgressData::ReceiverFnc & progress )
{
- MediaSetAccess media(_url, _path);
+ MediaSetAccess media(_url);
Fetcher fetcher;
- fetcher.enqueue( OnMediaLocation().filename("/content") );
+
+ fetcher.enqueue( OnMediaLocation().setFilename( "/media.1/media") );
+ fetcher.start( dest_dir, media );
+ fetcher.reset();
+
+
+ SignatureFileChecker sigchecker;
+
+ Pathname sig = _path + "/content.asc";
+ if ( media.doesFileExist(sig) )
+ {
+ fetcher.enqueue( OnMediaLocation().setFilename(sig) );
+ fetcher.start( dest_dir, media );
+ fetcher.reset();
+
+ sigchecker = SignatureFileChecker( dest_dir + sig );
+ }
+
+ Pathname key = _path + "/content.key";
+ if ( media.doesFileExist(key) )
+ {
+ fetcher.enqueue( OnMediaLocation().setFilename(key) );
+ fetcher.start( dest_dir, media );
+ fetcher.reset();
+ sigchecker.addPublicKey(dest_dir + key);
+ }
+
+
+ fetcher.enqueue( OnMediaLocation().setFilename( _path + "/content"), sigchecker );
fetcher.start( dest_dir, media );
fetcher.reset();
- std::ifstream file((dest_dir + "/content").asString().c_str());
+ std::ifstream file((dest_dir + _path + "/content").asString().c_str());
std::string buffer;
Pathname descr_dir;
- // Note this code assumes DESCR comes before as META
-
+ // FIXME Note this code assumes DESCR comes before as META
+ string value;
while (file && !file.eof())
{
getline(file, buffer);
if ( str::split( buffer, std::back_inserter(words) ) != 4 )
{
// error
- ZYPP_THROW(Exception("bad DESCR line"));
+ ZYPP_THROW(Exception("bad META line"));
+ }
+ OnMediaLocation location;
+ location.setFilename( _path + descr_dir + words[3]).setChecksum( CheckSum( words[1], words[2] ) );
+ fetcher.enqueueDigested(location);
+ }
+ else if (buffer.substr( 0, 3 ) == "KEY")
+ {
+ std::vector<std::string> words;
+ if ( str::split( buffer, std::back_inserter(words) ) != 4 )
+ {
+ // error
+ ZYPP_THROW(Exception("bad KEY line"));
}
OnMediaLocation location;
- location.filename( descr_dir + words[3]).checksum( CheckSum( words[1], words[2] ) );
- fetcher.enqueue(location);
+ location.setFilename( _path + words[3]).setChecksum( CheckSum( words[1], words[2] ) );
+ fetcher.enqueueDigested(location);
}
}
file.close();
_dest_dir = dest_dir;
if ( _media.doesFileExist(keypath) )
- _fetcher.enqueue( OnMediaLocation().filename(keypath) );
+ _fetcher.enqueue( OnMediaLocation().setFilename(keypath) );
if ( _media.doesFileExist(sigpath) )
- _fetcher.enqueue( OnMediaLocation().filename(sigpath) );
+ _fetcher.enqueue( OnMediaLocation().setFilename(sigpath) );
_fetcher.start( dest_dir, _media );
if ( PathInfo( dest_dir + keypath ).isExist() )
sigchecker.addPublicKey(dest_dir + keypath );
- _fetcher.enqueue( OnMediaLocation().filename(repomdpath), sigchecker );
+ _fetcher.enqueue( OnMediaLocation().setFilename(repomdpath), sigchecker );
_fetcher.start( dest_dir, _media);
if ( ! progress.tick() )
{
if (must_visit != item)
{
- WAR << "** dependency loop: " << ITEMNAME(item) << " -> " << ITEMNAME(must_visit) << endl;
+ // log only the 1st occurrence.
+ std::string lstr( ITEMNAME(item) );
+ lstr += " -> ";
+ lstr += ITEMNAME(must_visit);
+ if ( _logset.insert( lstr ).second )
+ {
+ WAR << "** dependency loop: " << lstr << endl;
+ }
}
}
else
#ifndef ZYPP_SOLVER_DETAIL_INSTALLORDER_H
#define ZYPP_SOLVER_DETAIL_INSTALLORDER_H
+#include <string>
#include <list>
#include <map>
+#include <set>
#include "zypp/PoolItem.h"
#include "zypp/ResPool.h"
unsigned _numrun;
+ std::set<std::string> _logset;
+
private:
void rdfsvisit (PoolItem_Ref item);
//---------------------------------------------------------------------------
void
-Resolver::addSubscribedSource (Source_Ref source)
+Resolver::addSubscribedSource (Repository repo)
{
- _subscribed.insert(source);
+ _subscribed.insert(repo);
}
void
ResolverContext_Ptr _establish_context;
bool _timed_out;
- std::set<Source_Ref> _subscribed;
+ std::set<Repository> _subscribed;
Arch _architecture;
ResPool pool (void) const;
void setPool (const ResPool & pool) { _pool = pool; }
- void addSubscribedSource (Source_Ref source);
+ void addSubscribedSource (Repository source);
void addPoolItemToInstall (PoolItem_Ref item);
void addPoolItemsToInstallFromList (PoolItemList & rl);
misc_info->setOtherPoolItem (otherItem);
if (NVRA(item.resolvable()) == NVRA(otherItem.resolvable())
&& status.isBySolver() && statusOtherItem.isBySolver()) {
- // If there has already been selected another item by the solver (e.g. from another source)
+ // If there has already been selected another item by the solver (e.g. from another repo)
// we will take that.
// Bug 224698
addInfo( misc_info );
Package::constPtr pkg = asKind<Package>(res); // try to access it as a package
if (pkg) { // if its !=NULL, get size information
- _download_size += pkg->archivesize();
+ _download_size += pkg->downloadSize();
_install_size += pkg->size();
}
priority = 0;
else {
#endif
- priority = getSourcePriority (item->source());
+ priority = getRepoPriority (item->repository());
// }
if (priority < _min_priority) _min_priority = priority;
misc_info->setOtherPoolItem (otherItem);
if (NVRA(item.resolvable()) == NVRA(otherItem.resolvable())
&& status.isBySolver() && statusOtherItem.isBySolver()) {
- // If there has already been selected another item by the solver (e.g. from another source)
+ // If there has already been selected another item by the solver (e.g. from another repo)
// we will take that.
// Bug 224698
addInfo( misc_info );
pkg = asKind<Package>(res); // try to access it as a package
if (pkg) { // if its !=NULL, get size information
- _download_size += pkg->archivesize();
+ _download_size += pkg->downloadSize();
_install_size += pkg->size();
}
priority = 0;
else {
#endif
- priority = getSourcePriority (item->source());
+ priority = getRepoPriority (item->repository());
// }
if (priority < _min_priority) _min_priority = priority;
int
-ResolverContext::getSourcePriority (Source_Ref source) const
+ResolverContext::getRepoPriority (Repository repo) const
{
- if (source.subscribed())
- return source.priority();
- return source.priorityUnsubscribed();
+#warning fix repo priority
+ return 0;
+// if (repo.subscribed())
+// return repo.priority();
+// return repository.priorityUnsubscribed();
}
//---------------------------------------------------------------------------
void
ResolverContext::collectCompareInfo (int & cmpVersion, // Version compare of ACCUMULATED items
- int & cmpSource, // compare of Sources
+ int & cmpRepo, // compare of Repositories
ResolverContext_Ptr compareContext)
{
- Source_Ref userSource; // Source Id of items which have been selected by the user for installation
- // It is empty, if there are different sources
- bool differentUserSources = false;
- Source_Ref userSourceCompare; // Source Id of items which have been selected by the user for installation
- // It is empty, if there are different sources
- bool differentUserCompareSources = false;
- SourceCounter thisMap; // Map of to be installed sources with an item counter
- SourceCounter compareMap; // Map of to be installed sources with an item counter
+ Repository userRepo; // Repo Id of items which have been selected by the user for installation
+ // It is empty, if there are different repos
+ bool differentUserRepos = false;
+ Repository userRepoCompare; // Repo Id of items which have been selected by the user for installation
+ // It is empty, if there are different repos
+ bool differentUserCompareRepos = false;
+ RepositoryCounter thisMap; // Map of to be installed repositorys with an item counter
+ RepositoryCounter compareMap; // Map of to be installed repositorys with an item counter
PoolItemList installList = getMarked(1);
PoolItemList compareList = compareContext->getMarked(1);; // List of comparing items which has to be installed
for ( PoolItemList::const_iterator thisIt = installList.begin();
thisIt != installList.end(); thisIt++ )
{
- // evaluate, if the user selected packages (items) has the same source
+ // evaluate, if the user selected packages (items) has the same repository
ResStatus status = getStatus (*thisIt);
if (status.isByUser()
|| thisIt->status().isByUser())
{
- if (userSource == Source_Ref::noSource
- && !differentUserSources)
+ if (userRepo == Repository::noRepository
+ && !differentUserRepos)
{
- userSource = thisIt->resolvable()->source();
+ userRepo = thisIt->resolvable()->repository();
}
- else if (userSource != thisIt->resolvable()->source())
+ else if (userRepo != thisIt->resolvable()->repository())
{
- differentUserSources = true; // there are other items of other sources which have been set by the user
+ differentUserRepos = true; // there are other items of other repositorys which have been set by the user
}
}
// collecting relationship between channels and installed items
- if (thisMap.find (thisIt->resolvable()->source()) == thisMap.end()) {
- thisMap[thisIt->resolvable()->source()] = 1;
+ if (thisMap.find (thisIt->resolvable()->repository()) == thisMap.end()) {
+ thisMap[thisIt->resolvable()->repository()] = 1;
}
else {
- thisMap[thisIt->resolvable()->source()] += 1;
+ thisMap[thisIt->resolvable()->repository()] += 1;
}
- _XDEBUG ("Count of left " << thisIt->resolvable()->source() << ": " << thisMap[thisIt->resolvable()->source()] << " : " << *(thisIt->resolvable()));
+ _XDEBUG ("Count of left " << thisIt->resolvable()->repository() << ": " << thisMap[thisIt->resolvable()->repository()] << " : " << *(thisIt->resolvable()));
// Comparing versions
while (itCompare != compareList.end() )
// Testcase: freshen-tests/exercise-7f-test
// Testcase: freshen-tests/exercise-7-test
cmpVersion += thisIt->resolvable()->edition().compare( itCompare->resolvable()->edition());
- _XDEBUG ("Version: " << *(thisIt->resolvable()) << "[" << thisIt->resolvable()->source() << "]" << endl
+ _XDEBUG ("Version: " << *(thisIt->resolvable()) << "[" << thisIt->resolvable()->repository() << "]" << endl
<< " <--> " << endl
- << "Version: " << *(itCompare->resolvable()) << "[" << itCompare->resolvable()->source() << "]"
+ << "Version: " << *(itCompare->resolvable()) << "[" << itCompare->resolvable()->repository() << "]"
<< " --> cmpVersion : " << cmpVersion);
- // evaluate if the user selected packages (items) has the same source
- ResObject::constPtr sourceItem = itCompare->resolvable();
+ // evaluate if the user selected packages (items) has the same repository
+ ResObject::constPtr repositoryItem = itCompare->resolvable();
ResStatus compStatus = compareContext->getStatus(*itCompare);
if (compStatus.isByUser()
|| itCompare->status().isByUser())
{
- if (userSourceCompare == Source_Ref::noSource
- && !differentUserCompareSources)
- userSourceCompare = sourceItem->source();
- else if (userSourceCompare != sourceItem->source())
- differentUserCompareSources = true; // there are other items of other sources which have been set by the user
+ if (userRepoCompare == Repository::noRepository
+ && !differentUserCompareRepos)
+ userRepoCompare = repositoryItem->repository();
+ else if (userRepoCompare != repositoryItem->repository())
+ differentUserCompareRepos = true; // there are other items of other repositorys which have been set by the user
}
// collecting relationship between channels and installed items
- if (compareMap.find (sourceItem->source()) == compareMap.end())
- compareMap[sourceItem->source()] = 1;
+ if (compareMap.find (repositoryItem->repository()) == compareMap.end())
+ compareMap[repositoryItem->repository()] = 1;
else
- compareMap[sourceItem->source()] += 1;
- _XDEBUG ("Count of right " << sourceItem->source() << ": " << compareMap[sourceItem->source()] << " : " << *(itCompare->resolvable()));
+ compareMap[repositoryItem->repository()] += 1;
+ _XDEBUG ("Count of right " << repositoryItem->repository() << ": " << compareMap[repositoryItem->repository()] << " : " << *(itCompare->resolvable()));
itCompare++;
} else if (cmp > 0 )
itCompare++;
// comparing the rest of the other install list
while (itCompare != compareList.end() )
{
- // evaluate if the user selected packages (items) has the same source
- ResObject::constPtr sourceItem = itCompare->resolvable();
+ // evaluate if the user selected packages (items) has the same repository
+ ResObject::constPtr repositoryItem = itCompare->resolvable();
ResStatus compStatus = compareContext->getStatus(*itCompare);
if (compStatus.isByUser()
|| itCompare->status().isByUser())
{
- if (userSourceCompare == Source_Ref::noSource
- && !differentUserCompareSources)
- userSourceCompare = sourceItem->source();
- else if (userSourceCompare != sourceItem->source())
- differentUserCompareSources = true; // there are other items of other sources which have been set by the user
+ if (userRepoCompare == Repository::noRepository
+ && !differentUserCompareRepos)
+ userRepoCompare = repositoryItem->repository();
+ else if (userRepoCompare != repositoryItem->repository())
+ differentUserCompareRepos = true; // there are other items of other repositorys which have been set by the user
}
// collecting relationship between channels and installed items
- if (compareMap.find (sourceItem->source()) == compareMap.end())
- compareMap[sourceItem->source()] = 1;
+ if (compareMap.find (repositoryItem->repository()) == compareMap.end())
+ compareMap[repositoryItem->repository()] = 1;
else
- compareMap[sourceItem->source()] += 1;
- _XDEBUG ("Count of right" << sourceItem->source() << ": " << compareMap[sourceItem->source()] << " : "
+ compareMap[repositoryItem->repository()] += 1;
+ _XDEBUG ("Count of right" << repositoryItem->repository() << ": " << compareMap[repositoryItem->repository()] << " : "
<< *(itCompare->resolvable()));
itCompare++;
}
- // evaluate cmpSource
- cmpSource = 0;
+ // evaluate cmpRepo
+ cmpRepo = 0;
int cmpCompare = 0;
- if (!differentUserSources)
+ if (!differentUserRepos)
{
// user selected items which has to be installed has only one channel;
- // cmpSource = number of items of that channel
- cmpSource = thisMap[userSource];
+ // cmpRepo = number of items of that channel
+ cmpRepo = thisMap[userRepo];
}
- if (!differentUserCompareSources) {
+ if (!differentUserCompareRepos) {
// user selected items which has to be installed has only one channel;
// cmpCompare = number of items of that channel
- cmpCompare = compareMap[userSourceCompare];
+ cmpCompare = compareMap[userRepoCompare];
}
- _XDEBUG ("cmpSource = " << cmpSource << " ; cmpCompare = " << cmpCompare << " ; sizeof compareMap:" << compareMap.size());
+ _XDEBUG ("cmpRepo = " << cmpRepo << " ; cmpCompare = " << cmpCompare << " ; sizeof compareMap:" << compareMap.size());
if (compareMap.size() == 1
&& thisMap.size() == 1
- && userSource == userSourceCompare) {
- // We have only one source from which all items will be instaled.
+ && userRepo == userRepoCompare) {
+ // We have only one repository from which all items will be instaled.
// So we will regards the complete amount of installed/updated packages
// Testcase basic-exercises/exercise-14-test
- cmpSource = 0;
+ cmpRepo = 0;
} else {
// The solutions has different channels with user selected items.
// Take the solution with the greater account of items in this channel
// Testcase basic-exercises/exercise-solution-order-test
- cmpSource = cmpSource - cmpCompare;
+ cmpRepo = cmpRepo - cmpCompare;
}
- if (cmpSource == 0)
+ if (cmpRepo == 0)
{
// less amount of channels are better
- cmpSource = compareMap.size() - thisMap.size();
+ cmpRepo = compareMap.size() - thisMap.size();
}
- _XDEBUG ("End comparing two solutions-------- Version compare: " << cmpVersion << " Source compare: "<< cmpSource);
+ _XDEBUG ("End comparing two solutions-------- Version compare: " << cmpVersion << " Repo compare: "<< cmpRepo);
}
int
// collecting all data for comparing both resultion results
int cmpVersion = 0; // Version compare of ACCUMULATED items
- int cmpSource = 0; // compare of Sources
+ int cmpRepo = 0; // compare of Repos
- collectCompareInfo (cmpVersion, cmpSource, context);
+ collectCompareInfo (cmpVersion, cmpRepo, context);
if (_preferHighestVersion) {
// comparing versions
cmp = cmpVersion;
DBG << "Comparing versions returned :" << cmp << endl;
if (cmp == 0) {
// High numbers are good... we don't want solutions containing low-priority channels.
- // Source priority which has been set externally
+ // Repo priority which has been set externally
cmp = num_cmp (_min_priority, context->_min_priority);
DBG << "Comparing priority returned :" << cmp << endl;
if (cmp == 0) {
cmp = rev_num_cmp (churn_factor (this), churn_factor (context));
DBG << "Comparing churn_factor returned :" << cmp << endl;
if (cmp == 0) {
- // Comparing sources regarding the items which has to be installed
- cmp = cmpSource;
- DBG << "Comparing sources returned :" << cmp << endl;
+ // Comparing repositorys regarding the items which has to be installed
+ cmp = cmpRepo;
+ DBG << "Comparing repositorys returned :" << cmp << endl;
if (cmp == 0) {
// High numbers are bad. Bigger #s means more penalties.
cmp = rev_num_cmp (_other_penalties, context->_other_penalties);
DBG << "Comparing churn_factor returned :" << cmp << endl;
if (cmp == 0) {
// High numbers are good... we don't want solutions containing low-priority channels.
- // Source priority which has been set externally
+ // Repo priority which has been set externally
cmp = num_cmp (_min_priority, context->_min_priority);
DBG << "Comparing priority returned :" << cmp << endl;
if (cmp == 0) {
cmp = cmpVersion;
DBG << "Comparing versions returned :" << cmp << endl;
if (cmp == 0) {
- // Comparing sources regarding the items which has to be installed
- cmp = cmpSource;
- DBG << "Comparing sources returned :" << cmp << endl;
+ // Comparing repositorys regarding the items which has to be installed
+ cmp = cmpRepo;
+ DBG << "Comparing repositorys returned :" << cmp << endl;
if (cmp == 0) {
// High numbers are bad. Bigger #s means more penalties.
cmp = rev_num_cmp (_other_penalties, context->_other_penalties);
#include "zypp/ResPool.h"
#include "zypp/PoolItem.h"
#include "zypp/Capability.h"
-#include "zypp/Source.h"
+#include "zypp/Repository.h"
#include "zypp/solver/detail/Types.h"
#include "zypp/solver/detail/ResolverInfo.h"
typedef void (*MarkedPoolItemFn) (PoolItem_Ref item, const ResStatus & status, void *data);
typedef void (*MarkedPoolItemPairFn) (PoolItem_Ref item1, const ResStatus & status1, PoolItem_Ref item2, const ResStatus & status2, void *data);
typedef std::multimap<PoolItem_Ref,Capability> IgnoreMap;
-typedef std::map<Source_Ref ,int> SourceCounter;
+typedef std::map<Repository ,int> RepositoryCounter;
///////////////////////////////////////////////////////////////////
//
void spew (void);
void spewInfo (void) const;
- int getSourcePriority (Source_Ref source) const;
+ int getRepoPriority (Repository source) const;
};
///////////////////////////////////////////////////////////////////
#include <sstream>
#include "zypp/solver/detail/ResolverInfo.h"
-#include "zypp/Source.h"
+#include "zypp/Repository.h"
#include "zypp/Capability.h"
#include "zypp/base/String.h"
#include "zypp/base/Gettext.h"
if (item->arch() != "") {
os << '.' << item->arch();
}
- Source_Ref s = item->source();
+ Repository s = item->repository();
if (s) {
- string alias = s.alias();
+ string alias = s.info().alias();
if (!alias.empty()
&& alias != "@system")
{
- os << '[' << s.alias() << ']';
+ os << '[' << s.info().alias() << ']';
}
}
return os.str();
QueueItemInstall_Ptr install_qitem = dynamic_pointer_cast<QueueItemInstall>(new_qitem);
/* Penalties are negative priorities */
- int penalty;
- Source_Ref src = install_qitem->item()->source();
- penalty = - src.priority();
-
+#warning FIX priorities
+ int penalty = 0;
+ Repository repo = install_qitem->item()->repository();
+ //penalty = - src.priority();
install_qitem->setOtherPenalty (penalty);
}
if (qitem->isInstall() && qitem2->isInstall()) {
PoolItem_Ref r = (dynamic_pointer_cast<QueueItemInstall>(qitem))->item();
PoolItem_Ref r2 = (dynamic_pointer_cast<QueueItemInstall>(qitem2))->item();
- Source_Ref source = r->source();
- Source_Ref source2 = r2->source();
+ Repository repo1 = r->repository();
+ Repository repo2 = r2->repository();
int priority, priority2;
- priority = _context->getSourcePriority( source );
- priority2 = _context->getSourcePriority( source2 );
+ priority = _context->getRepoPriority( repo1 );
+ priority2 = _context->getRepoPriority( repo2 );
if (priority != priority2 && r->name() == r2->name()) {
if (r->edition().compare(r2->edition()) == 0
zypp::base::LogControl::instance().logfile( "/var/log/YaST2/y2log" );
ResPool pool = resolver.pool();
- SourceTable sourceTable;
+ RepositoryTable repoTable;
PoolItemList items_to_install;
PoolItemList items_to_remove;
HelixResolvable system (dumpPath + "/solver-system.xml");
// system channel
system.addResolvable (res);
} else {
- // source channels
- ResObject::constPtr sourceItem = it->resolvable();
- Source_Ref source = sourceItem->source();
- if (sourceTable.find (source) == sourceTable.end()) {
- sourceTable[source] = new HelixResolvable(dumpPath + "/"
- + numstring(source.numericId())
+ // repo channels
+ ResObject::constPtr repoItem = it->resolvable();
+ Repository repo = repoItem->repository();
+ if (repoTable.find (repo) == repoTable.end()) {
+ repoTable[repo] = new HelixResolvable(dumpPath + "/"
+ + numstring(repo.numericId())
+ "-package.xml");
}
- sourceTable[source]->addResolvable (res);
+ repoTable[repo]->addResolvable (res);
}
if ( it->status().isToBeInstalled()
// writing control file "*-test.xml"
HelixControl control (dumpPath + "/solver-test.xml",
- sourceTable,
+ repoTable,
resolver.architecture());
for (PoolItemList::const_iterator iter = items_to_install.begin(); iter != items_to_install.end(); iter++) {
//---------------------------------------------------------------------------
HelixControl::HelixControl(const std::string & controlPath,
- const SourceTable & sourceTable,
+ const RepositoryTable & repoTable,
const Arch & systemArchitecture,
const std::string & systemPath)
:dumpFile (controlPath)
<< "<test>" << endl
<< "<setup arch=\"" << systemArchitecture << "\">" << endl
<< TAB << "<system file=\"" << systemPath << "\"/>" << endl;
- for ( SourceTable::const_iterator it = sourceTable.begin();
- it != sourceTable.end(); ++it ) {
- Source_Ref source = it->first;
- *file << TAB << "<channel file=\"" << numstring(source.numericId())
- << "-package.xml\" name=\"" << numstring(source.numericId())
+ for ( RepositoryTable::const_iterator it = repoTable.begin();
+ it != repoTable.end(); ++it ) {
+ Repository repo = it->first;
+ *file << TAB << "<channel file=\"" << numstring(repo.numericId())
+ << "-package.xml\" name=\"" << numstring(repo.numericId())
<< "\" />" << endl;
}
*file << "</setup>" << endl
void HelixControl::installResolvable(const ResObject::constPtr &resObject)
{
- Source_Ref source = resObject->source();
- *file << "<install channel=\"" << numstring(source.numericId()) << "\" kind=\"" << toLower (resObject->kind().asString()) << "\""
+ Repository repo = resObject->repository();
+ *file << "<install channel=\"" << numstring(repo.numericId()) << "\" kind=\"" << toLower (resObject->kind().asString()) << "\""
<< " name=\"" << resObject->name() << "\"" << " arch=\"" << resObject->arch().asString() << "\""
<< " version=\"" << resObject->edition().version() << "\"" << " release=\"" << resObject->edition().release() << "\""
<< " edition=\"" << resObject->edition().asString() << "\"" << "/>" << endl;
void HelixControl::deleteResolvable(const ResObject::constPtr &resObject)
{
- Source_Ref source = resObject->source();
+ Repository repo = resObject->repository();
*file << "<uninstall " << " kind=\"" << toLower (resObject->kind().asString()) << "\""
<< " name=\"" << resObject->name() << "\"" << "/>" << endl;
}
};
DEFINE_PTR_TYPE(HelixResolvable);
-typedef std::map<Source_Ref, HelixResolvable_Ptr> SourceTable;
+typedef std::map<Repository, HelixResolvable_Ptr> RepositoryTable;
///////////////////////////////////////////////////////////////////
//
public:
HelixControl (const std::string & controlPath,
- const SourceTable & sourceTable,
+ const RepositoryTable & sourceTable,
const Arch & systemArchitecture,
const std::string & systemPath = "solver-system.xml");
HelixControl ();
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/MediaSet.cc
- *
-*/
-#include <iostream>
-#include "zypp/base/Logger.h"
-
-#include "zypp/SourceFactory.h"
-#include "zypp/source/MediaSet.h"
-#include "zypp/ZYppCallbacks.h"
-
-#include <fstream>
-
-using std::endl;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
-
- IMPL_PTR_TYPE(MediaSet);
-
- MediaSet::MediaSet(const Source_Ref & source_r)
- {
- _source = source_r;
- }
- MediaSet::~MediaSet()
- {
- MIL << "Called MediaSet destructor" << endl;
- release();
- MIL << "Closing all medias of source" << endl;
- media::MediaManager media_mgr;
- for (MediaMap::iterator it = medias.begin(); it != medias.end(); it++)
- {
- MIL << "Closing media " << it->second << endl;
- media_mgr.close(it->second);
- }
- }
-
- void MediaSet::redirect (media::MediaNr medianr, media::MediaAccessId media_id)
- {
- media::MediaManager media_mgr;
- MediaMap::iterator it( medias.find(medianr));
- if( it != medias.end() && media_mgr.isOpen(it->second)) {
- try {
- DBG << "Closing media access id " << it->second << endl;
- media_mgr.close(it->second);
- }
- // paranoia ...
- catch (const Exception & excpt_r) {
- ZYPP_CAUGHT(excpt_r);
- }
- }
- try {
- MIL << "Adding media verifier to redirected medium" << endl;
- media_mgr.delVerifier(media_id);
- media_mgr.addVerifier(media_id, _source.verifier(medianr));
- }
- catch (const Exception & excpt_r)
- {
-#warning FIXME: If media data is not set, verifier is not set. Should the media be refused instead?
- ZYPP_CAUGHT(excpt_r);
- WAR << "Verifier not found" << endl;
- }
-
- medias[medianr] = media_id;
- }
-
- void MediaSet::reattach(const Pathname &attach_point)
- {
- media::MediaManager media_mgr;
- media_mgr.setAttachPrefix(attach_point);
- for (MediaMap::iterator it = medias.begin(); it != medias.end(); it++)
- {
- Url url = media_mgr.url(it->second);
- std::string scheme = url.getScheme();
- if (scheme == "http" || scheme == "ftp" || scheme == "https" || scheme == "ftps")
- {
- media_mgr.release(it->second);
- media_mgr.attach(it->second);
- }
- }
- }
-
- void MediaSet::reset()
- {
- media::MediaManager media_mgr;
- for (MediaMap::iterator it = medias.begin(); it != medias.end(); it++)
- {
- if( media_mgr.isOpen(it->second)) {
- try {
- DBG << "Closing media access id " << it->second << endl;
- media_mgr.close(it->second);
- }
- // paranoia ...
- catch (const Exception & excpt_r) {
- ZYPP_CAUGHT(excpt_r);
- }
- }
- }
- medias = MediaMap();
- }
-
- void MediaSet::release()
- {
- MIL << "Releasing all medias of source" << endl;
- media::MediaManager media_mgr;
- for (MediaMap::iterator it = medias.begin(); it != medias.end(); it++)
- {
- if (media_mgr.isAttached(it->second))
- {
- MIL << "Releasing media " << it->second << endl;
- media_mgr.release(it->second, false);
- }
- else
- {
- MIL << "Media " << it->second << " not attached" << endl;
- }
- }
- }
-
- media::MediaAccessId MediaSet::getMediaAccessId (media::MediaNr medianr, bool noattach)
- {
- media::MediaManager media_mgr;
-
- if (medias.find(medianr) != medias.end())
- {
- media::MediaAccessId id = medias[medianr];
- if (! noattach && ! media_mgr.isAttached(id))
- media_mgr.attachDesiredMedia(id);
- return id;
- }
- Url url = _source.url();
- url = rewriteUrl (url, medianr);
- media::MediaAccessId id = media_mgr.open(url, _source.path());
- try {
- MIL << "Adding media verifier" << endl;
- media_mgr.delVerifier(id);
- media_mgr.addVerifier(id, _source.verifier(medianr));
- }
- catch (const Exception & excpt_r)
- {
-#warning FIXME: If media data is not set, verifier is not set. Should the media be refused instead?
- ZYPP_CAUGHT(excpt_r);
- WAR << "Verifier not found" << endl;
- }
- medias[medianr] = id;
-
- if (! noattach)
- media_mgr.attachDesiredMedia(id);
-
- return id;
- }
-
- Url MediaSet::rewriteUrl (const Url & url_r, const media::MediaNr medianr)
- {
- std::string scheme = url_r.getScheme();
- if (scheme == "cd" || scheme == "dvd")
- return url_r;
-
- DBG << "Rewriting url " << url_r << endl;
-
- if( scheme == "iso")
- {
- std::string isofile = url_r.getQueryParam("iso");
- boost::regex e("^(.*(cd|dvd))([0-9]+)(\\.iso)$", boost::regex::icase);
- boost::smatch what;
- if(boost::regex_match(isofile, what, e, boost::match_extra))
- {
- Url url( url_r);
-
- isofile = what[1] + str::numstring(medianr) + what[4];
- url.setQueryParam("iso", isofile);
-
- DBG << "Url rewrite result: " << url << endl;
- return url;
- }
- }
- else
- {
- std::string pathname = url_r.getPathName();
- boost::regex e("^(.*(cd|dvd))([0-9]+)(/?)$", boost::regex::icase);
- boost::smatch what;
- if(boost::regex_match(pathname, what, e, boost::match_extra))
- {
- Url url( url_r);
-
- pathname = what[1] + str::numstring(medianr) + what[4];
- url.setPathName(pathname);
-
- DBG << "Url rewrite result: " << url << endl;
-
- return url;
- }
- }
- return url_r;
- }
-
- std::ostream & MediaSet::dumpOn( std::ostream & str ) const
- { return str << "MediaSet"; }
-
-
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/MediaSet.h
- *
-*/
-#ifndef ZYPP_SOURCE_MEDIASET_H
-#define ZYPP_SOURCE_MEDIASET_H
-
-#include <iosfwd>
-#include <string>
-
-#include "zypp/base/ReferenceCounted.h"
-#include "zypp/base/NonCopyable.h"
-#include "zypp/base/PtrTypes.h"
-#include "zypp/Source.h"
-
-#include "zypp/media/MediaManager.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
-
- DEFINE_PTR_TYPE(MediaSet);
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : MediaSet
- //
- class MediaSet : public base::ReferenceCounted, private base::NonCopyable
- {
- friend std::ostream & operator<<( std::ostream & str, const MediaSet & obj );
-
- public:
- MediaSet(const Source_Ref & source_r);
-
- ~MediaSet();
-
- /**
- * Get the media access ID to specified media
- *
- * \throws MediaNotDesiredException if no_attach is false and no desired
- * media is found.
- */
- media::MediaAccessId getMediaAccessId (media::MediaNr medianr, bool no_attach = false);
-
- /** Redirect specified media to a new MediaId */
- void redirect (media::MediaNr medianr, media::MediaAccessId media_id);
- /**
- * Reattach the source if it is not mounted, but downloaded,
- * to different directory
- *
- * \throws Exception
- */
- void reattach(const Pathname &attach_point);
- /** Reset the handles to the medias */
- void reset();
- /**
- * Release all medias in the set
- */
- void release();
-
- protected:
-
- /** Overload to realize stream output. */
- virtual std::ostream & dumpOn( std::ostream & str ) const;
-
- typedef std::map<media::MediaNr, media::MediaAccessId> MediaMap;
- /** Mapping between each CD and Media Access ID */
- MediaMap medias;
- /** Refference to the source */
- Source_Ref _source;
-
- /** Rewrite the URL according to media number */
- Url rewriteUrl (const Url & url_r, const media::MediaNr medianr);
-
- };
- ///////////////////////////////////////////////////////////////////
-
- /** \relates MediaSet Stream output */
- inline std::ostream & operator<<( std::ostream & str, const MediaSet & obj )
- { return obj.dumpOn( str ); }
-
-
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_MEDIASET_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/PackageProvider.cc
- *
-*/
-#include <iostream>
-#include <sstream>
-#include "zypp/base/Logger.h"
-#include "zypp/base/Gettext.h"
-
-#include "zypp/Source.h"
-#include "zypp/source/PackageProvider.h"
-#include "zypp/source/SourceProvideFile.h"
-#include "zypp/source/Applydeltarpm.h"
-#include "zypp/source/PackageDelta.h"
-#include "zypp/detail/ImplConnect.h"
-
-using std::endl;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : PackageProviderPolicy
- //
- ///////////////////////////////////////////////////////////////////
-
- bool PackageProviderPolicy::queryInstalled( const std::string & name_r,
- const Edition & ed_r,
- const Arch & arch_r ) const
- {
- if ( _queryInstalledCB )
- return _queryInstalledCB( name_r, ed_r, arch_r );
- return false;
- }
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : PackageProvider
- //
- ///////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- namespace
- { /////////////////////////////////////////////////////////////////
-
- inline std::string defRpmFileName( const Package::constPtr & package )
- {
- std::ostringstream ret;
- ret << package->name() << '-' << package->edition() << '.' << package->arch() << ".rpm";
- return ret.str();
- }
-
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
- PackageProvider::PackageProvider( const Package::constPtr & package,
- const PackageProviderPolicy & policy_r )
- : _policy( policy_r )
- , _package( package )
- , _implPtr( detail::ImplConnect::resimpl( _package ) )
- {}
-
- PackageProvider::~PackageProvider()
- {}
-
- ManagedFile PackageProvider::providePackage() const
- {
- MIL << "provide Package " << _package << endl;
- ScopedGuard guardReport( newReport() );
- ManagedFile ret;
- do {
- _retry = false;
- report()->start( _package, _package->source().url() );
- try // ELIMINATE try/catch by providing a log-guard
- {
- ret = doProvidePackage();
- }
- catch ( const Exception & excpt )
- {
- ERR << "Failed to provide Package " << _package << endl;
- if ( ! _retry )
- {
- ZYPP_RETHROW( excpt );
- }
- }
- } while ( _retry );
-
- report()->finish( _package, source::DownloadResolvableReport::NO_ERROR, std::string() );
- MIL << "provided Package " << _package << " at " << ret << endl;
- return ret;
- }
-
- ManagedFile PackageProvider::doProvidePackage() const
- {
- // check whether to process patch/delta rpms
- if ( _package->source().remote() )
- {
- std::list<DeltaRpm> deltaRpms( _implPtr->deltaRpms() );
- std::list<PatchRpm> patchRpms( _implPtr->patchRpms() );
-
- if ( ! ( deltaRpms.empty() && patchRpms.empty() )
- && queryInstalled() )
- {
- if ( ! deltaRpms.empty() && applydeltarpm::haveApplydeltarpm() )
- {
- for( std::list<DeltaRpm>::const_iterator it = deltaRpms.begin();
- it != deltaRpms.end(); ++it )
- {
- DBG << "tryDelta " << *it << endl;
- ManagedFile ret( tryDelta( *it ) );
- if ( ! ret->empty() )
- return ret;
- }
- }
-
- if ( ! patchRpms.empty() )
- {
- for( std::list<PatchRpm>::const_iterator it = patchRpms.begin();
- it != patchRpms.end(); ++it )
- {
- DBG << "tryPatch " << *it << endl;
- ManagedFile ret( tryPatch( *it ) );
- if ( ! ret->empty() )
- return ret;
- }
- }
- }
- }
- else
- {
- // allow patch rpm from local source
- std::list<PatchRpm> patchRpms( _implPtr->patchRpms() );
- if ( ! patchRpms.empty() && queryInstalled() )
- {
- for( std::list<PatchRpm>::const_iterator it = patchRpms.begin();
- it != patchRpms.end(); ++it )
- {
- DBG << "tryPatch " << *it << endl;
- ManagedFile ret( tryPatch( *it ) );
- if ( ! ret->empty() )
- return ret;
- }
- }
- }
-
- // no patch/delta -> provide full package
- ManagedFile ret;
- OnMediaLocation loc;
- loc.medianr( _package->sourceMediaNr() )
- .filename( _package->location() )
- .checksum( _package->checksum() )
- .downloadsize( _package->archivesize() );
-
- ProvideFilePolicy policy;
- policy.progressCB( bind( &PackageProvider::progressPackageDownload, this, _1 ) );
- policy.failOnChecksumErrorCB( bind( &PackageProvider::failOnChecksumError, this ) );
-
- return source::provideFile( _package->source(), loc, policy );
- }
-
- ManagedFile PackageProvider::tryDelta( const DeltaRpm & delta_r ) const
- {
- if ( delta_r.baseversion().edition() != Edition::noedition
- && ! queryInstalled( delta_r.baseversion().edition() ) )
- return ManagedFile();
-
- if ( ! applydeltarpm::quickcheck( delta_r.baseversion().sequenceinfo() ) )
- return ManagedFile();
-
- report()->startDeltaDownload( delta_r.location().filename(),
- delta_r.location().downloadsize() );
- ManagedFile delta;
- try
- {
- ProvideFilePolicy policy;
- policy.progressCB( bind( &PackageProvider::progressDeltaDownload, this, _1 ) );
- delta = source::provideFile( _package->source(), delta_r.location(), policy );
- }
- catch ( const Exception & excpt )
- {
- report()->problemDeltaDownload( excpt.asUserString() );
- return ManagedFile();
- }
- report()->finishDeltaDownload();
-
- report()->startDeltaApply( delta );
- if ( ! applydeltarpm::check( delta_r.baseversion().sequenceinfo() ) )
- {
- report()->problemDeltaApply( _("applydeltarpm check failed.") );
- return ManagedFile();
- }
-
- Pathname destination( Pathname::dirname( delta ) / defRpmFileName( _package ) );
- /* just to ease testing with non remote sources */
- if ( ! _package->source().remote() )
- destination = Pathname("/tmp") / defRpmFileName( _package );
- /**/
-
- if ( ! applydeltarpm::provide( delta, destination,
- bind( &PackageProvider::progressDeltaApply, this, _1 ) ) )
- {
- report()->problemDeltaApply( _("applydeltarpm failed.") );
- return ManagedFile();
- }
- report()->finishDeltaApply();
-
- return ManagedFile( destination, filesystem::unlink );
- }
-
- ManagedFile PackageProvider::tryPatch( const PatchRpm & patch_r ) const
- {
- // installed edition is in baseversions?
- const PatchRpm::BaseVersions & baseversions( patch_r.baseversions() );
-
- if ( std::find_if( baseversions.begin(), baseversions.end(),
- bind( &PackageProvider::queryInstalled, this, _1 ) )
- == baseversions.end() )
- return ManagedFile();
-
- report()->startPatchDownload( patch_r.location().filename(),
- patch_r.location().downloadsize() );
- ManagedFile patch;
- try
- {
- ProvideFilePolicy policy;
- policy.progressCB( bind( &PackageProvider::progressPatchDownload, this, _1 ) );
- patch = source::provideFile( _package->source(), patch_r.location(), policy );
- }
- catch ( const Exception & excpt )
- {
- report()->problemPatchDownload( excpt.asUserString() );
- return ManagedFile();
- }
- report()->finishPatchDownload();
-
- return patch;
- }
-
- PackageProvider::ScopedGuard PackageProvider::newReport() const
- {
- _report.reset( new Report );
- return shared_ptr<void>( static_cast<void*>(0),
- // custom deleter calling _report.reset()
- // (cast required as reset is overloaded)
- bind( mem_fun_ref( static_cast<void (shared_ptr<Report>::*)()>(&shared_ptr<Report>::reset) ),
- ref(_report) ) );
- }
-
- PackageProvider::Report & PackageProvider::report() const
- { return *_report; }
-
- bool PackageProvider::progressDeltaDownload( int value ) const
- { return report()->progressDeltaDownload( value ); }
-
- void PackageProvider::progressDeltaApply( int value ) const
- { return report()->progressDeltaApply( value ); }
-
- bool PackageProvider::progressPatchDownload( int value ) const
- { return report()->progressPatchDownload( value ); }
-
- bool PackageProvider::progressPackageDownload( int value ) const
- { return report()->progress( value, _package ); }
-
- bool PackageProvider::failOnChecksumError() const
- {
- std::string package_str = _package->name() + "-" + _package->edition().asString();
-
- // TranslatorExplanation %s = package being checked for integrity
- switch ( report()->problem( _package, source::DownloadResolvableReport::INVALID, str::form(_("Package %s fails integrity check. Do you want to retry?"), package_str.c_str() ) ) )
- {
- case source::DownloadResolvableReport::RETRY:
- _retry = true;
- break;
- case source::DownloadResolvableReport::IGNORE:
- ZYPP_THROW(source::SkipRequestedException("User requested skip of corrupted file"));
- break;
- default:
- break;
- }
- return true; // anyway a failure
- }
-
- bool PackageProvider::queryInstalled( const Edition & ed_r ) const
- { return _policy.queryInstalled( _package->name(), ed_r, _package->arch() ); }
-
-
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/PackageProvider.h
- *
-*/
-#ifndef ZYPP_SOURCE_PACKAGEPROVIDER_H
-#define ZYPP_SOURCE_PACKAGEPROVIDER_H
-
-#include <iosfwd>
-
-#include "zypp/base/NonCopyable.h"
-
-#include "zypp/ZYppCallbacks.h"
-#include "zypp/Source.h"
-#include "zypp/Package.h"
-#include "zypp/ManagedFile.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : PackageProviderPolicy
- //
- /** */
- class PackageProviderPolicy
- {
- public:
- /** Get installed Editions callback signature. */
- typedef function<bool ( const std::string &, const Edition &, const Arch & )> QueryInstalledCB;
-
- /** Set callback. */
- PackageProviderPolicy & queryInstalledCB( QueryInstalledCB queryInstalledCB_r )
- { _queryInstalledCB = queryInstalledCB_r; return *this; }
-
- /** Evaluate callback. */
- bool queryInstalled( const std::string & name_r,
- const Edition & ed_r,
- const Arch & arch_r ) const;
-
- private:
- QueryInstalledCB _queryInstalledCB;
- };
- ///////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : PackageProvider
- //
- /** Provide a package from a Source.
- * Use available delta/patch-rpm if apropriate.
- */
- class PackageProvider : private base::NonCopyable
- {
- typedef shared_ptr<void> ScopedGuard;
- typedef callback::SendReport<source::DownloadResolvableReport> Report;
-
- typedef detail::ResImplTraits<Package::Impl>::constPtr PackageImpl_constPtr;
- typedef packagedelta::DeltaRpm DeltaRpm;
- typedef packagedelta::PatchRpm PatchRpm;
-
-
- public:
- /** Ctor taking the Package to provide. */
- PackageProvider( const Package::constPtr & package,
- const PackageProviderPolicy & policy_r = PackageProviderPolicy() );
- ~PackageProvider();
-
- public:
- /** Provide the package.
- * \throws Exception.
- */
- ManagedFile providePackage() const;
-
- private:
- ManagedFile doProvidePackage() const;
- ManagedFile tryDelta( const DeltaRpm & delta_r ) const;
- ManagedFile tryPatch( const PatchRpm & patch_r ) const;
-
- private:
- ScopedGuard newReport() const;
- Report & report() const;
- bool progressDeltaDownload( int value ) const;
- void progressDeltaApply( int value ) const;
- bool progressPatchDownload( int value ) const;
- bool progressPackageDownload( int value ) const;
- bool failOnChecksumError() const;
- bool queryInstalled( const Edition & ed_r = Edition() ) const;
-
- private:
- PackageProviderPolicy _policy;
- Package::constPtr _package;
- PackageImpl_constPtr _implPtr;
- mutable bool _retry;
- mutable shared_ptr<Report> _report;
-
- };
- ///////////////////////////////////////////////////////////////////
-
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_PACKAGEPROVIDER_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/SourceImpl.cc
- *
-*/
-#include <iostream>
-#include <fstream>
-#include "zypp/base/Logger.h"
-#include "zypp/base/Gettext.h"
-#include "zypp/base/Random.h"
-#include "zypp/Digest.h"
-#include "zypp/SourceFactory.h"
-#include "zypp/source/SourceImpl.h"
-#include "zypp/ZYppCallbacks.h"
-#include "zypp/SourceManager.h"
-#include "zypp/ZYppFactory.h"
-#include <fstream>
-
-using std::endl;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-
-IMPL_PTR_TYPE(SourceImpl);
-
-class DownloadProgressPackageReceiver : public callback::ReceiveReport<media::DownloadProgressReport>
-{
- callback::SendReport <DownloadResolvableReport> & _report;
- Resolvable::constPtr _resolvable;
-
-public:
-
- DownloadProgressPackageReceiver ( callback::SendReport <DownloadResolvableReport> & report_r, Resolvable::constPtr resolvable_r )
- : _report (report_r), _resolvable (resolvable_r)
- {}
-
- virtual ~DownloadProgressPackageReceiver ()
- {}
- virtual void reportbegin()
- {}
- virtual void reportend()
- {}
-
- /**
- * Inform about progress
- * Return true on abort
- */
- virtual bool progress( int percent, const Url& )
- {
- return _report->progress( percent, _resolvable );
- }
-};
-
-
-class DownloadProgressFileReceiver : public callback::ReceiveReport<media::DownloadProgressReport>
-{
- callback::SendReport<SourceReport> & _report;
-
-public:
-
- DownloadProgressFileReceiver ( callback::SendReport<SourceReport> & report_r )
- : _report (report_r)
- {}
-
- virtual ~DownloadProgressFileReceiver ()
- {}
- virtual void reportbegin()
- {}
- virtual void reportend()
- {}
-
- /**
- * Inform about progress
- * Return true on abort
- */
- virtual bool progress( int percent, const Url& url )
- {
- return _report->progress( percent);
- }
-};
-
-/** Ctor, excl. for nullimpl only.
- * Nullimpl has no Id (\c 0).
- */
-SourceImpl::SourceImpl( const null & )
- : base::ProvideNumericId<SourceImpl,Source_Ref::NumericId>( NULL )
- , _res_store_initialized(true)
-{}
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : SourceImpl::SourceImpl
-// METHOD TYPE : Ctor
-//
-SourceImpl::SourceImpl()
- : _enabled(true)
- , _autorefresh(true)
- , _priority (0)
- , _priority_unsubscribed (0)
- , _subscribed(false)
- , _base_source(false)
- , _res_store_initialized(false)
-{}
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : SourceImpl::factoryCtor
-// METHOD TYPE : void
-//
-void SourceImpl::factoryCtor( const media::MediaId & media_r,
- const Pathname & path_r,
- const std::string & alias_r,
- const Pathname cache_dir_r,
- bool base_source,
- bool auto_refresh )
-{
- _media_set = new MediaSet( selfSourceRef() );
- _url = media_mgr.url( media_r );
- _media_set->redirect( 1, media_r );
- _path = path_r;
- _alias = alias_r;
- _cache_dir = cache_dir_r;
- _subscribed = true;
- _base_source = base_source;
-
- MIL << "Setting autorefresh: " << auto_refresh << endl;
- _autorefresh = auto_refresh;
-
- try
- {
- factoryInit();
- }
- catch ( Exception & excpt )
- {
- _store.clear();
- ZYPP_RETHROW( excpt );
- }
-}
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : SourceImpl::factoryInit
-// METHOD TYPE : void
-//
-void SourceImpl::factoryInit()
-{
- ZYPP_THROW( Exception( "FactoryInit not implemented!" ) );
-}
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : SourceImpl::~SourceImpl
-// METHOD TYPE : Dtor
-//
-SourceImpl::~SourceImpl()
-{
- if (_media_set)
- {
- media::MediaAccessId _media = _media_set->getMediaAccessId( 1, true );
- media_mgr.release (_media, false);
- }
-}
-
-bool SourceImpl::enabled() const
-{
- return _enabled;
-}
-
-void SourceImpl::disable()
-{
- _enabled = false;
-}
-
-bool SourceImpl::autorefresh() const
-{
- return _autorefresh;
-}
-
-void SourceImpl::setAutorefresh( bool enable )
-{
- MIL << "Changing source [" << alias() << "] [" << url() << "] to autorefresh: " << enable << endl;
- _autorefresh = enable;
-}
-
-const ResStore & SourceImpl::resolvables() const
-{
- if ( !_res_store_initialized )
- {
- // cast away const to allow late init
- Source_Ref self( const_cast<SourceImpl*>(this)->selfSourceRef() );
- const_cast<SourceImpl*>(this)->createResolvables(self);
- const_cast<SourceImpl*>(this)->_res_store_initialized = true;
- }
- return _store;
-}
-
-std::set<zypp::Resolvable::Kind> SourceImpl::resolvableKinds() const
- {
- return std::set<zypp::Resolvable::Kind>();
- }
-
-const ResStore SourceImpl::resolvables(zypp::Resolvable::Kind kind) const
-{
- Source_Ref self( const_cast<SourceImpl*>(this)->selfSourceRef() );
- return const_cast<SourceImpl*>(this)->provideResolvablesByKind(self, kind);
-}
-
-Pathname SourceImpl::tmpMetadataDir() const
-{
- if ( !_tmp_metadata_dir_ptr )
- _tmp_metadata_dir_ptr.reset(new filesystem::TmpDir(getZYpp()->tmpPath()));
- return _tmp_metadata_dir_ptr->path();
-}
-
-Date SourceImpl::timestamp() const
-{
- return Date::now();
-}
-
-std::string SourceImpl::checksum() const
-{
- return base::random_string(48);
-}
-
-void SourceImpl::dirInfo(const unsigned media_nr,
- std::list<std::string> &retlist,
- const Pathname &path_r,
- bool dots ) const
-{
- DBG << "reading " << path_r << " file list" << endl;
- media::MediaAccessId _media = _media_set->getMediaAccessId( media_nr );
- media_mgr.dirInfo( _media, retlist, path_r, dots );
-}
-
-const Pathname SourceImpl::providePackage( Package::constPtr package )
-{
- bool retry = true;
- bool digest_ok = false;
- Pathname file;
- callback::SendReport<source::DownloadResolvableReport> report;
- DownloadProgressPackageReceiver download_report( report, package );
-
- while (retry)
- {
- report->start( package, package->source().url() );
-
- callback::TempConnect<media::DownloadProgressReport> tmp_download( download_report );
-
- try
- {
- file = provideJustFile( package->location(), package->sourceMediaNr());
- }
- catch (const Exception &e)
- {
- ERR << "Failed to provide " << package << " from " << url() << " in source " << alias() << std::endl;
- ZYPP_RETHROW (e);
- }
-
- report->finish( package, source::DownloadResolvableReport::NO_ERROR, "" );
-
- CheckSum checksum = package->checksum();
- std::string calculated_digest;
-
- // check digest
- try
- {
- std::ifstream is(file.asString().c_str(), std::ifstream::binary);
- calculated_digest = Digest::digest(checksum.type(), is);
- is.close();
- }
- catch (std::exception &e)
- {
- ERR << "Can't open " << file << " for integrity check." << std::endl;
- }
-
- if ( checksum.checksum() == calculated_digest )
- {
- MIL << package->location() << " ok. [" << calculated_digest << "]" << std::endl;
- digest_ok = true;
- retry = false;
- }
-
- if (!digest_ok)
- {
- std::string package_str = package->name() + "-" + package->edition().asString();
-
- // TranslatorExplanation %s = package
- source::DownloadResolvableReport::Action useraction = report->problem(package, source::DownloadResolvableReport::INVALID, str::form(_("Package %s fails integrity check. Do you want to retry, or abort installation?"), package_str.c_str() ));
-
- if ( useraction == source::DownloadResolvableReport::ABORT )
- {
- ZYPP_THROW(Exception("Package " + package->location().asString() + " fails integrity check. Expected: [" + checksum.checksum() + "] Read: [" + calculated_digest + "] (" + checksum.type() + ")"));
- }
- else if ( useraction == source::DownloadResolvableReport::RETRY )
- {
- retry = true;
- }
- }
- }
- return file;
-}
-
-void SourceImpl::getPossiblyCachedMetadataFile( const Pathname &file_to_download, const Pathname &destination, const Pathname &cached_file, const CheckSum &checksum )
-{
- Pathname downloaded_file;
- Url file_url( url().asString() + file_to_download.asString() );
- // if we have a cached file and its the same
- if ( PathInfo(cached_file).isExist() && (! checksum.empty()) && is_checksum( cached_file, checksum ) )
- {
- MIL << "file " << file_url << " found in previous cache. Using cached copy." << std::endl;
- // checksum is already checked.
- // we could later implement double failover and try to download if file copy fails.
- if ( filesystem::copy(cached_file, destination) != 0 )
- ZYPP_THROW(SourceIOException("Can't copy " + cached_file.asString() + " to " + destination.asString()));
- }
- else
- {
- try
- {
- // we dont have it or its not the same, download it.
- downloaded_file = provideFile( file_to_download);
- }
- catch (const Exception & excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- ZYPP_THROW(SourceIOException("Can't provide " + downloaded_file.asString() + " : " + excpt_r.msg() ));
- }
-
- if ( filesystem::copy(downloaded_file, destination) != 0 )
- ZYPP_THROW(SourceIOException("Can't copy " + downloaded_file.asString() + " to " + destination.asString()));
-
- callback::SendReport<DigestReport> report;
- if ( checksum.empty() )
- {
- MIL << "File " << file_url << " has no checksum available." << std::endl;
- if ( report->askUserToAcceptNoDigest(file_to_download) )
- {
- MIL << "User accepted " << file_url << " with no checksum." << std::endl;
- return;
- }
- else
- {
- ZYPP_THROW(SourceMetadataException( file_url.asString() + " " + N_(" miss checksum.") ));
- }
- }
- else
- {
- if (! is_checksum( destination, checksum))
- ZYPP_THROW(SourceMetadataException( file_url.asString() + " " + N_(" fails checksum verification.") ));
- }
-
- }
-}
-
-void SourceImpl::resetMediaVerifier()
-{
- try
- {
- media::MediaManager media_mgr;
- MIL << "Reseting media verifier" << std::endl;
-
- // don't try to attach media
- media::MediaAccessId _media = _media_set->getMediaAccessId(1, true);
- media_mgr.delVerifier(_media);
- media_mgr.addVerifier(_media, media::MediaVerifierRef(new media::NoVerifier()));
- }
- catch (const Exception & excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- WAR << "Media Verifier not found." << endl;
- }
-}
-
-const Pathname SourceImpl::provideFile(const Pathname & file_r,
- const unsigned media_nr,
- bool cached,
- bool checkonly )
-{
- bool retry = true;
- Pathname downloaded_file;
- callback::SendReport<source::SourceReport> report;
- DownloadProgressFileReceiver download_report( report );
- Url file_url( url().asString() + file_r.asString() );
-
- callback::TempConnect<media::DownloadProgressReport> tmp_download( download_report );
-
- while (retry)
- {
- // TranslatorExplanation %s = file being downloaded
- report->start( selfSourceRef(), str::form( _("Downloading %s"), file_url.asString().c_str() ) );
- try
- {
- downloaded_file = provideJustFile(file_r, media_nr, cached, checkonly);
- report->finish( selfSourceRef(), str::form( _("Downloading %s"), file_url.asString().c_str() ), SourceReport::NO_ERROR, str::form(_("Downloaded %s from %s"), file_r.asString().c_str(), url().asString().c_str()) );
- retry = false;
- }
- catch ( const SkipRequestedException &e )
- {
- // TranslatorExplanation %s = file being downloaded
- report->finish( selfSourceRef(), str::form( _("Downloading %s"), file_url.asString().c_str() ), SourceReport::IO, str::form(_("Can't provide %s from %s"), file_r.asString().c_str(), url().asString().c_str()) );
- ZYPP_RETHROW(e);
- }
- catch (const Exception &e)
- {
- // TranslatorExplanation %s = file that was not able to download
- if ( report->problem(selfSourceRef(), SourceReport::IO, str::form(_("Can't provide %s from %s"), file_r.asString().c_str(), url().asString().c_str())) != SourceReport::RETRY )
- {
- report->finish( selfSourceRef(), str::form( _("Downloading %s"), file_url.asString().c_str() ), SourceReport::IO, str::form(_("Can't provide %s from %s"), file_r.asString().c_str(), url().asString().c_str()) );
- ZYPP_THROW(Exception("Can't provide " + file_r.asString() + " from " + url().asString() ));
- }
- }
-
- }
- return downloaded_file;
-}
-
-const Pathname SourceImpl::tryToProvideFile( const Pathname & file, const unsigned media_nr )
-{
- media::MediaAccessId _media = _media_set->getMediaAccessId( media_nr);
- media_mgr.provideFile (_media, file, false, false);
- return media_mgr.localPath( _media, file );
-}
-
-void SourceImpl::copyLocalMetadata(const Pathname &src, const Pathname &dst) const
-{
- // refuse to use stupid paths as cache dir
- if (dst == Pathname("/") )
- ZYPP_THROW(Exception("I refuse to use / as local dir"));
-
- if (0 != assert_dir(dst, 0755))
- ZYPP_THROW(Exception("Cannot create local directory" + dst.asString()));
-
- MIL << "Cleaning up local dir" << std::endl;
- filesystem::clean_dir(dst);
- MIL << "Copying " << src << " content to local : " << dst << std::endl;
-
- if ( copy_dir_content( src, dst) != 0)
- {
- filesystem::clean_dir(dst);
- ZYPP_THROW(Exception( "Can't copy downloaded data to local dir. local dir cleaned."));
- }
-}
-
-const Pathname SourceImpl::provideJustFile(const Pathname & file_r,
- const unsigned media_nr,
- bool cached,
- bool checkonly )
-{
- callback::SendReport<media::MediaChangeReport> report;
-
- SourceFactory source_factory;
-
- // get the mediaId, but don't try to attach it here
- media::MediaAccessId _media = _media_set->getMediaAccessId( media_nr, true );
- do
- {
- try
- {
- DBG << "Going to try provide file " << file_r << " from " << media_nr << endl;
-
- // try to attach the media
- _media = _media_set->getMediaAccessId( media_nr ); // in case of redirect
- media_mgr.provideFile (_media, file_r, cached, checkonly);
- break;
- }
- catch ( Exception & excp )
- {
- ZYPP_CAUGHT(excp);
- media::MediaChangeReport::Action user;
-
- do
- {
-
- DBG << "Media couldn't provide file " << file_r << " , releasing." << endl;
- try
- {
- media_mgr.release (_media, false);
- }
- catch (const Exception & excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- MIL << "Failed to release media " << _media << endl;
- }
- MIL << "Releasing all medias of all sources" << endl;
- try
- {
- zypp::SourceManager::sourceManager()->releaseAllSources();
- }
- catch (const zypp::Exception& excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- ERR << "Failed to release all sources" << endl;
- }
-
- // set up the reason
- media::MediaChangeReport::Error reason
- = media::MediaChangeReport::INVALID;
-
- if ( typeid(excp) == typeid( media::MediaFileNotFoundException ) ||
- typeid(excp) == typeid( media::MediaNotAFileException ) )
- {
- reason = media::MediaChangeReport::NOT_FOUND;
- }
- else if ( typeid(excp) == typeid( media::MediaNotDesiredException) ||
- typeid(excp) == typeid( media::MediaNotAttachedException) )
- {
- reason = media::MediaChangeReport::WRONG;
- }
-
- user = checkonly ? media::MediaChangeReport::ABORT :
- report->requestMedia (
- source_factory.createFrom( this ),
- media_nr,
- reason,
- excp.asUserString()
- );
-
- DBG << "ProvideFile exception caught, callback answer: " << user << endl;
-
- if ( user == media::MediaChangeReport::ABORT )
- {
- DBG << "Aborting" << endl;
- ZYPP_RETHROW ( excp );
- }
- else if ( user == media::MediaChangeReport::IGNORE )
- {
- DBG << "Skipping" << endl;
- ZYPP_THROW ( SkipRequestedException("User-requested skipping of a file") );
- }
- else if ( user == media::MediaChangeReport::EJECT )
- {
- DBG << "Eject: try to release" << endl;
- try
- {
- zypp::SourceManager::sourceManager()->releaseAllSources();
- }
- catch (const zypp::Exception& excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- ERR << "Failed to release all sources" << endl;
- }
-
- try
- {
- media_mgr.release (_media, true); // one more release needed for eject
- }
- catch (const zypp::media::MediaNotEjectedException & excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- ERR << "Failed to eject" << endl;
- break;
- }
- // FIXME: this will not work, probably
- }
- else if ( user == media::MediaChangeReport::RETRY ||
- user == media::MediaChangeReport::CHANGE_URL )
- {
- // retry
- DBG << "Going to try again" << endl;
-
- // not attaching, media set will do that for us
- // this could generate uncaught exception (#158620)
-
- break;
- }
- else
- {
- DBG << "Don't know, let's ABORT" << endl;
-
- ZYPP_RETHROW ( excp );
- }
- }
- while ( user == media::MediaChangeReport::EJECT );
- }
-
- // retry or change URL
- }
- while ( true );
-
- return media_mgr.localPath( _media, file_r );
-}
-
-const Pathname SourceImpl::provideDirTree(const Pathname & path_r, const unsigned media_nr)
-{
- callback::SendReport<media::MediaChangeReport> report;
- SourceFactory source_factory;
- // get the mediaId, but don't try to attach it here
- media::MediaAccessId _media = _media_set->getMediaAccessId( media_nr, true );
- do
- {
- try
- {
- DBG << "Going to try provide tree " << path_r << " from " << media_nr << endl;
- // try to attach the media
- _media = _media_set->getMediaAccessId( media_nr ); // in case of redirect
- media_mgr.provideDirTree (_media, path_r);
- break;
- }
- catch ( Exception & excp )
- {
- ZYPP_CAUGHT(excp);
- media::MediaChangeReport::Action user;
-
- do
- {
- DBG << "Media couldn't provide tree " << path_r << " , releasing." << endl;
- try
- {
- media_mgr.release (_media, false);
- }
- catch (const Exception & excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- MIL << "Failed to release media " << _media << endl;
- }
- MIL << "Releasing all medias of all sources" << endl;
- try
- {
- zypp::SourceManager::sourceManager()->releaseAllSources();
- }
- catch (const zypp::Exception& excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- ERR << "Failed to release all sources" << endl;
- }
- // set up the reason
- media::MediaChangeReport::Error reason = media::MediaChangeReport::INVALID;
-
- if ( typeid(excp) == typeid( media::MediaFileNotFoundException ) || typeid(excp) == typeid( media::MediaNotAFileException ) )
- {
- reason = media::MediaChangeReport::NOT_FOUND;
- }
- else if ( typeid(excp) == typeid( media::MediaNotDesiredException) || typeid(excp) == typeid( media::MediaNotAttachedException) )
- {
- reason = media::MediaChangeReport::WRONG;
- }
- user = report->requestMedia ( source_factory.createFrom( this ), media_nr, reason, excp.asUserString() );
-
- DBG << "ProvideFile exception caught, callback answer: " << user << endl;
-
- if ( user == media::MediaChangeReport::ABORT )
- {
- DBG << "Aborting" << endl;
- ZYPP_RETHROW ( excp );
- }
- else if ( user == media::MediaChangeReport::EJECT )
- {
- DBG << "Eject: try to release" << endl;
- try
- {
- zypp::SourceManager::sourceManager()->releaseAllSources();
- }
- catch (const zypp::Exception& excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- ERR << "Failed to release all sources" << endl;
- }
- media_mgr.release (_media, true); // one more release needed for eject
- // FIXME: this will not work, probably
- }
- else if ( user == media::MediaChangeReport::RETRY ||
- user == media::MediaChangeReport::CHANGE_URL )
- {
- // retry
- DBG << "Going to try again" << endl;
-
- // not attaching, media set will do that for us
- // this could generate uncaught exception (#158620)
-
- break;
- }
- else
- {
- DBG << "Don't know, let's ABORT" << endl;
-
- ZYPP_RETHROW ( excp );
- }
- }
- while ( user == media::MediaChangeReport::EJECT );
- }
- // retry or change URL
- }
- while ( true );
- return media_mgr.localPath( _media, path_r );
-}
-
-const void SourceImpl::releaseFile(const Pathname & file_r,
- const unsigned media_nr)
-{
- DBG << "releaseFile(" << file_r << ", " << media_nr << ")" << endl;
- media::MediaAccessId _media = _media_set->getMediaAccessId( media_nr, true );
- media_mgr.releaseFile(_media, file_r);
-}
-
-const void SourceImpl::releaseDir(const Pathname & path_r,
- const unsigned media_nr,
- const bool recursive)
-{
- DBG << "releaseDir(" << path_r << ", " << media_nr << (recursive?", recursive":"") << ")" << endl;
- media::MediaAccessId _media = _media_set->getMediaAccessId( media_nr, true );
- if (recursive)
- media_mgr.releasePath(_media, path_r);
- else
- media_mgr.releaseDir(_media, path_r);
-}
-
-void SourceImpl::changeMedia( const media::MediaId & media_r, const Pathname & path_r )
-{
- DBG << "changeMedia(" << path_r << ")" << endl;
- _url = media_mgr.url( media_r );
- _media_set->reset();
- _media_set->redirect( 1, media_r );
- _path = path_r;
-}
-
-void SourceImpl::enable()
-{
-// if (autorefresh())
-// refresh();
- _enabled = true;
-}
-
-void SourceImpl::createResolvables(Source_Ref source_r)
-{
- WAR << "createResolvables not implemented by the source" << endl;
-}
-
-ResStore SourceImpl::provideResolvablesByKind(Source_Ref source_r, zypp::Resolvable::Kind kind)
-{
- WAR << "provideResolvablesByKind not implemented by the source" << endl;
- return ResStore();
-}
-
-void SourceImpl::storeMetadata(const Pathname & cache_dir_r)
-{}
-
-void SourceImpl::refresh()
-{
- MIL << "Refreshing" << endl;
- // TODO: will this work in chroot?
- // TODO: better download somewhere else and then copy over
- try
- {
- storeMetadata( _cache_dir );
- }
- catch ( const zypp::Exception & excpt )
- {
- ERR << "Unable to refresh the source cache" << endl;
- if ( ! _cache_dir.empty() && _cache_dir != "/" )
- filesystem::clean_dir( _cache_dir );
-
- ZYPP_RETHROW( excpt );
- }
-}
-
-void SourceImpl::redirect(unsigned media_nr, const Url & new_url)
-{
- DBG << "redirect(" << new_url << ")" << endl;
- media::MediaAccessId id = media_mgr.open( new_url );
- _media_set->redirect( media_nr, id );
-}
-void SourceImpl::reattach(const Pathname &attach_point)
-{
- DBG << "reattach(" << attach_point << ")" << endl;
- _media_set->reattach( attach_point );
-}
-
-void SourceImpl::release()
-{
- if (_media_set)
- _media_set->release();
-}
-
-media::MediaVerifierRef SourceImpl::verifier(unsigned media_nr)
-{
- return media::MediaVerifierRef(new media::NoVerifier());
-}
-
-/////////////////////////////////////////////////////////////////
-// attribute accessors
-
-std::string SourceImpl::type (void) const
-{
- return "undefined";
-}
-
-std::string SourceImpl::id (void) const
-{
- return _id;
-}
-
-void SourceImpl::setId (const std::string id_r)
-{
- _id = id_r;
-}
-
-unsigned SourceImpl::priority (void) const
-{
- return _priority;
-}
-
-void SourceImpl::setPriority (unsigned p)
-{
- _priority = p;
-}
-
-unsigned SourceImpl::priorityUnsubscribed (void) const
-{
- return _priority_unsubscribed;
-}
-
-void SourceImpl::setPriorityUnsubscribed (unsigned p)
-{
- _priority_unsubscribed = p;
-}
-
-bool SourceImpl::subscribed (void) const
-{
- return _subscribed;
-}
-
-void SourceImpl::setSubscribed (bool s)
-{
- _subscribed = s;
-}
-
-const Pathname & SourceImpl::cacheDir (void)
-{
- return _cache_dir;
-}
-
-Url SourceImpl::url (void) const
-{
- return _url;
-}
-
-void SourceImpl::setUrl( const Url & url )
-{
- _url = url;
-}
-
-bool SourceImpl::remote() const
-{
- bool downloads = false;
- try
- {
- downloads = media::MediaManager::downloads(_url);
- }
- catch (const zypp::Exception &e)
- {
- // should not happen, but ...
- ZYPP_CAUGHT(e);
- }
- return downloads;
-}
-
-const Pathname & SourceImpl::path (void) const
-{
- return _path;
-}
-
-unsigned SourceImpl::numberOfMedia(void) const
-{
- return 1;
-}
-
-std::string SourceImpl::vendor (void) const
-{
- return "";
-}
-
-const std::list<Pathname> SourceImpl::publicKeys()
-{
- return std::list<Pathname>();
-}
-
-std::string SourceImpl::unique_id (void) const
-{
- return "";
-}
-
-/////////////////////////////////////////////////////////////////
-
-std::ostream & SourceImpl::dumpOn( std::ostream & str ) const
-{
- str << "Source[" << numericId() << "|" << type();
- if ( !_alias.empty() )
- str << "|" << _alias;
- str << "]";
-
- str << "{"
- << _url << "(" << _path << ")";
- if ( ! _cache_dir.empty() )
- str << "; cache " << _cache_dir;
-
- str << "; autorefresh: " << _autorefresh;
- str << "; enabled: " << _enabled;
- str << "}";
-
- return str;
-}
-
-SourceImpl::Verifier::Verifier(const std::string & vendor_r, const std::string & id_r, const media::MediaNr media_nr)
- : _media_vendor(vendor_r)
- , _media_id(id_r)
- , _media_nr(media_nr)
-{}
-
-bool SourceImpl::Verifier::isDesiredMedia(const media::MediaAccessRef &ref)
-{
- if (_media_vendor.empty() || _media_id.empty())
- return true;
-#warning TODO define what does missing media_id/media_vendor mean
-
- Pathname media_file = "/media." + str::numstring(_media_nr) + "/media";
- ref->provideFile (media_file);
- media_file = ref->localPath(media_file);
- std::ifstream str(media_file.asString().c_str());
- std::string vendor;
- std::string id;
-
-#warning check the stream status
- getline(str, vendor);
- getline(str, id);
-
- return (vendor == _media_vendor && id == _media_id );
-}
-
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/SourceImpl.h
- *
-*/
-#ifndef ZYPP_SOURCE_SOURCEIMPL_H
-#define ZYPP_SOURCE_SOURCEIMPL_H
-
-#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 "zypp/Source.h"
-#include "zypp/ResStore.h"
-#include "zypp/Pathname.h"
-#include "zypp/CheckSum.h"
-#include "zypp/media/MediaManager.h"
-#include "zypp/source/MediaSet.h"
-#include "zypp/TmpPath.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
-
- DEFINE_PTR_TYPE(SourceImpl);
-
- /** Base class for Source prober.
- *
- * Source probe implementations get a attached media id
- * and return a bool, wether the source is a source
- * of this type
- */
- class SourceProber
- {
- public:
- SourceProber( media::MediaAccessId media_id, const Pathname &path )
- : _media_id(media_id), _path(path)
- {}
-
- virtual ~SourceProber()
- {}
-
- virtual bool operator()() = 0;
-
- protected:
- media::MediaAccessId _media_id;
- Pathname _path;
- };
-
- class SourceEventHandler
- {
- public:
- typedef boost::shared_ptr<SourceEventHandler> Ptr;
- SourceEventHandler( boost::function<void (int)> fnc )
- : _fnc(fnc)
- {
-
- };
- ~SourceEventHandler()
- {};
- void progress(int p)
- {
- if (_fnc)
- _fnc(p);
- }
-
- private:
- boost::function<void (int)> _fnc;
- int _file_size;
- int no_lines;
- };
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : SourceImpl
- //
- /** Base class for concrete Source implementations.
- *
- * Public access via \ref Source_Ref interface.
- *
- * Constructed by \ref SourceFactory, via default ctor to
- * create the object, followed by a call to \ref factoryCtor.
- * \ref factoryCtor initializes the remaining data members and
- * calls \ref factoryInit to let implementations actually retrieve
- * the metadata.
- *
- * \todo Provide class NoSourceImpl and protect it against manipulation
- * of data via set methods (or erase them).
- */
- class SourceImpl : public base::ReferenceCounted
- , public base::ProvideNumericId<SourceImpl,Source_Ref::NumericId>
- , private base::NonCopyable
- {
- media::MediaManager media_mgr;
-
- friend std::ostream & operator<<( std::ostream & str, const SourceImpl & obj );
-
- public:
- /** Ctor substitute.
- * Called by SourceFactory to initialize the Source. Actions performed
- * are too complex for a real ctor. So factoryCtor initializes the
- * appropriate data members and then calls \ref factoryInit to
- * launch the Source.
- *
- * Common cleanup in case \ref factoryInit throws:
- * \li clear _store
- *
- * \throw EXCEPTION on fail
- */
- void factoryCtor( const media::MediaId & media_r,
- const Pathname & path_r,
- const std::string & alias_r,
- const Pathname cache_dir_r,
- bool base_source, bool auto_refresh);
-
- /** SourceImpl MediaVerifier. */
- class Verifier;
-
- public:
-
- /** All resolvables provided by this source. */
- const ResStore & resolvables(Source_Ref) const
- { return resolvables(); }
- const ResStore & resolvables() const;
- const ResStore resolvables(zypp::Resolvable::Kind kind) const;
-
- /**
- * Provide a file to local filesystem
- *
- * \throws Exception
- *
- */
- const Pathname provideFile(const Pathname & file,
- const unsigned media_nr = 1,
- bool cached = false,
- bool checkonly = false);
- /**
- * Provide a file to local filesystem
- * if the file does not exists, throws an exception, but
- * does not release the media, useful to provide
- * optional files you want to check if they exists
- *
- * \throws Exception
- *
- */
- const Pathname tryToProvideFile( const Pathname & file, const unsigned media_nr = 1 );
-
- /**
- * Provide a directory to local filesystem
- *
- * \throws Exception
- *
- */
- const Pathname provideDirTree(const Pathname & path,
- const unsigned media_nr = 1);
-
- const void releaseFile(const Pathname & file_r,
- const unsigned media_nr = 1);
-
- const void releaseDir(const Pathname & path_r,
- const unsigned media_nr = 1,
- const bool recursive = false);
-
- const Pathname providePackage( Package::constPtr package );
-
- /**
- * Provide info about a directory
- *
- * \throws Exception
- *
- */
- void dirInfo( const unsigned media_nr,
- std::list<std::string> &retlist,
- const Pathname &path_r,
- bool dots = true) const;
-
- void changeMedia(const media::MediaId & media_r, const Pathname & path_r);
-
- bool enabled() const;
- void enable();
- void disable();
- bool autorefresh() const;
- void setAutorefresh( bool enable_r );
- void refresh();
-
- virtual void storeMetadata(const Pathname & cache_dir_r);
-
- /**
- * default implementation returns now()
- * so the source is always reread when in doubt
- */
- virtual Date timestamp() const;
-
- virtual std::string checksum() const;
-
- std::string alias (void) const
- { return _alias; }
-
- void setAlias (const std::string & alias)
- { _alias = alias; }
-
- virtual std::string id (void) const;
- virtual void setId (const std::string id_r);
- virtual unsigned priority (void) const;
- virtual void setPriority (unsigned p);
- virtual unsigned priorityUnsubscribed (void) const;
- virtual void setPriorityUnsubscribed (unsigned p);
- virtual bool subscribed (void) const;
- virtual void setSubscribed (bool s);
- virtual const Pathname & cacheDir (void);
- virtual const std::list<Pathname> publicKeys();
-
- virtual std::string type(void) const;
-
- Url url (void) const;
- void setUrl( const Url & url );
- bool remote () const;
- bool baseSource () const
- { return _base_source; }
-
- const Pathname & path (void) const;
-
- virtual unsigned numberOfMedia(void) const;
-
- virtual std::string vendor (void) const;
-
- virtual std::string unique_id (void) const;
-
- virtual void redirect(unsigned media_nr, const Url & new_url);
- /**
- * Reattach the source if it is not mounted, but downloaded,
- * to different directory
- *
- * \throws Exception
- */
- void reattach(const Pathname &attach_point);
- /**
- * Release all medias attached by the source
- */
- void release();
-
- /**
- * Get media verifier for the specified medium. In the
- * default installation, an instance of media::NoVerifier is
- * returned. The specific implementations of the sources
- * should overload this method to return a proper verifier.
- *
- * \param media_nr number of the medium
- *
- * \return instance of a media verifier for the given medium.
- */
- virtual media::MediaVerifierRef verifier(unsigned media_nr);
-
- virtual std::set<zypp::Resolvable::Kind> resolvableKinds() const;
-
- /** Provide Source_Ref back to \c this. */
- Source_Ref selfSourceRef()
- { return Source_Ref( this ); }
- protected:
-
-
- /**
- * Provide a file to local filesystem on the given path,
- * no checking or progress information redirection.
- * used by \ref provideFile and \ref providePackage.
- * If \c checkonly is true, no media change callback
- * will be invoked.
- *
- * \param path file with a path to be provided by the source
- * \param media_nr number of the media to look for the path
- * \param cached provide a cached copy of the file, if available
- * \param checkonly just check if it is possible to provide the file
- *
- * \return the local path for the provided file
- *
- * \throws Exception
- *
- */
- const Pathname provideJustFile(const Pathname & path,
- const unsigned media_nr = 1,
- bool cached = false,
- bool checkonly = false);
-
- void copyLocalMetadata(const Pathname &src, const Pathname &dst) const;
-
- /**
- * function that creates the tmp metadata dir if it was not created.
- * this directory is used when cache_dir is not set (design flaw FIXME)
- */
- Pathname tmpMetadataDir() const;
-
- /**
- * reset the media verifier to no verifier
- */
- void resetMediaVerifier();
-
- /**
- * checks if a file exists in cache
- * if no, downloads it, copies it in given destination, and check matching checksum
- * if yes, compares checksum and copies it to destination locally
- * \throw EXCEPTION on download/copy failure and user abort
- */
- void getPossiblyCachedMetadataFile( const Pathname &file_to_download, const Pathname &destination, const Pathname &cached_file, const CheckSum &checksum );
-
- protected:
- /** All resolvables provided by this source. */
- ResStore _store;
- /** URL of the media */
- Url _url;
- /** Path to the source on the media */
- Pathname _path;
- /** The source is enabled */
- bool _enabled;
- /** If the source metadata should be autorefreshed */
- bool _autorefresh;
- /** (user defined) alias of the source */
- std::string _alias;
- /** Directory holding metadata cache */
- Pathname _cache_dir;
- /** (user defined) id of the source
- mostly used for ZENworks */
- std::string _id;
- /** (user defined) default priority of the source */
- unsigned _priority;
- /** (user defined) unsubscribed priority of the source */
- unsigned _priority_unsubscribed;
- /** subscribed?, solver prefers subscribed sources */
- bool _subscribed;
- /** source contains base product? */
- bool _base_source;
-
- private:
- mutable shared_ptr<filesystem::TmpDir> _tmp_metadata_dir_ptr;
- ///////////////////////////////////////////////////////////////////
- // no playground below this line ;)
- ///////////////////////////////////////////////////////////////////
- protected:
- /** Default Ctor.
- * Just create the object and prepare the data members. Then wait
- * for the \ref factoryCtor call to launch the Source.
- */
- SourceImpl();
-
- /** Ctor substitute invoked by \ref factoryCtor.
- * Derived implementations use this to load the
- * metadata.
- *
- * Baseclass implementation could do tasks which are
- * common to all sources.
- *
- * \throw EXCEPTION on fail
- */
- virtual void factoryInit();
-
- /** Dtor. */
- virtual ~SourceImpl();
-
- /** Overload to realize stream output. */
- virtual std::ostream & dumpOn( std::ostream & str ) const;
-
- /** Set of medias of the product */
- intrusive_ptr<MediaSet> _media_set;
-
- private:
- /** Late initialize the ResStore. */
- virtual void createResolvables(Source_Ref source_r);
-
- /** Provide only resolvable of a certain kind. */
- virtual ResStore provideResolvablesByKind(Source_Ref source_r, zypp::Resolvable::Kind kind);
-
- /** Whether the ResStore is initialized. */
- bool _res_store_initialized;
-
- public:
- /** Whether the ResStore is initialized.
- * If we know that noone has seen the resolvables yet, we can skip
- * them too, eg. when deleting a source. (#174840)
- */
- bool resStoreInitialized () const
- { return _res_store_initialized; }
-
- private:
- /** Helper indicating creation of nullimpl. */
- struct null {};
-
- /** Ctor, excl. for nullimpl only.
- * Nullimpl has no Id (\c 0).
- */
- SourceImpl( const null & );
-
- public:
- /** Offer default Impl. */
- static SourceImpl_Ptr nullimpl()
- {
- static SourceImpl_Ptr _nullimpl( new SourceImpl( null() ) );
- return _nullimpl;
- }
-
- };
- ///////////////////////////////////////////////////////////////////
-
- /** \relates SourceImpl Stream output */
- inline std::ostream & operator<<( std::ostream & str, const SourceImpl & obj )
- { return obj.dumpOn( str ); }
-
- ///////////////////////////////////////////////////////////////////
-
- /** SourceImpl MediaVerifier.
- */
- class SourceImpl::Verifier : public media::MediaVerifierBase
- {
- public:
- /** ctor */
- Verifier (const std::string & vendor_r, const std::string & id_r, const media::MediaNr media_nr = 1);
- /*
- ** Check if the specified attached media contains
- ** the desired media number (e.g. SLES10 CD1).
- */
- virtual bool
- isDesiredMedia(const media::MediaAccessRef &ref);
-
- private:
- std::string _media_vendor;
- std::string _media_id;
- media::MediaNr _media_nr;
- SourceImpl_Ptr _source;
- };
-
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_SOURCEIMPL_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/SourceInfo.cc
- *
-*/
-
-#include <string>
-#include <iostream>
-#include "zypp/source/SourceInfo.h"
-
-using namespace boost;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-namespace source
-{
-
- SourceInfo::SourceInfo()
- : _enabled (indeterminate)
- , _autorefresh(indeterminate)
- , _base_source( indeterminate )
- {
-
- }
-
- SourceInfo::SourceInfo( const Url & url, const Pathname & path, const std::string & alias, const Pathname & cache_dir, tribool autorefresh)
- : _enabled (true),
- _autorefresh(autorefresh),
- _base_source( indeterminate ),
- _url(url),
- _cache_dir(cache_dir),
- _path(path),
- _alias(alias)
- {
-
- }
-
- SourceInfo & SourceInfo::setEnabled( boost::tribool enabled )
- {
- _enabled = enabled;
- return *this;
- }
-
- SourceInfo & SourceInfo::setAutorefresh( boost::tribool autorefresh )
- {
- _autorefresh = autorefresh;
- return *this;
- }
-
- SourceInfo & SourceInfo::setBaseSource( bool val_r )
- {
- _base_source = val_r;
- return *this;
- }
-
- SourceInfo & SourceInfo::setUrl( const Url &url )
- {
- _url = url;
- return *this;
- }
-
- SourceInfo & SourceInfo::setPath( const Pathname &p )
- {
- _path = p;
- return *this;
- }
-
- SourceInfo & SourceInfo::setAlias( const std::string &alias )
- {
- _alias = alias;
- return *this;
- }
-
- SourceInfo & SourceInfo::setType( const std::string &t )
- {
- _type = t;
- return *this;
- }
-
- SourceInfo & SourceInfo::setCacheDir( const Pathname &p )
- {
- _cache_dir = p;
- return *this;
- }
-
- SourceInfo & SourceInfo::setDescription( const std::string &description )
- {
- _description = description;
- return *this;
- }
-
- SourceInfo & SourceInfo::setChecksum( const CheckSum &checksum )
- {
- _checksum = checksum;
- return *this;
- }
-
- SourceInfo & SourceInfo::setTimestamp( const Date ×tamp )
- {
- _timestamp = timestamp;
- return *this;
- }
-
- tribool SourceInfo::enabled() const
- { return _enabled; }
-
- tribool SourceInfo::autorefresh() const
- { return _autorefresh; }
-
- boost::tribool SourceInfo::baseSource() const
- { return _base_source; }
-
- Pathname SourceInfo::cacheDir() const
- { return _cache_dir; }
-
- Pathname SourceInfo::path() const
- { return _path; }
-
- std::string SourceInfo::alias() const
- { return _alias; }
-
- std::string SourceInfo::description() const
- { return _description; }
-
- CheckSum SourceInfo::checksum() const
- { return _checksum; }
-
- Date SourceInfo::timestamp() const
- { return _timestamp; }
-
- std::string SourceInfo::type() const
- { return _type; }
-
- Url SourceInfo::url() const
- { return _url; }
-
- std::ostream & SourceInfo::dumpOn( std::ostream & str ) const
- {
- str << "--------------------------------------" << std::endl;
- str << "- alias : " << alias() << std::endl;
- str << "- url : " << url() << std::endl;
- str << "- type : " << type() << std::endl;
- str << "- basesource : " << baseSource() << 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
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/SourceInfo.h
- *
-*/
-#ifndef ZYPP_SourceInfo_H
-#define ZYPP_SourceInfo_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
-{ /////////////////////////////////////////////////////////////////
-namespace source
-{
-
- class SourceInfo
- {
- public:
-
- SourceInfo();
-
- SourceInfo( const Url & url, const Pathname & path, const std::string & alias = "", const Pathname & cache_dir = "", boost::tribool autorefresh = boost::indeterminate );
-
- SourceInfo & setEnabled( boost::tribool enabled );
- SourceInfo & setAutorefresh( boost::tribool autorefresh );
- SourceInfo & setBaseSource( bool val_r );
- SourceInfo & setUrl( const Url &url );
- SourceInfo & setPath( const Pathname &p );
- SourceInfo & setAlias( const std::string &alias );
- SourceInfo & setType( const std::string &t );
- SourceInfo & setCacheDir( const Pathname &p );
- SourceInfo & setDescription( const std::string &description );
- SourceInfo & setChecksum( const CheckSum &checksum );
- SourceInfo & setTimestamp( const Date ×tamp );
- boost::tribool enabled() const;
- boost::tribool autorefresh() const;
- boost::tribool baseSource() 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_source;
- std::string _type;
- Url _url;
- Pathname _cache_dir;
- Pathname _path;
- std::string _alias;
- std::string _description;
- CheckSum _checksum;
- Date _timestamp;
- };
-
- /** \relates SourceInfo Stream output */
- inline std::ostream & operator<<( std::ostream & str, const SourceInfo & obj )
- { return obj.dumpOn( str ); }
-
- typedef std::list<SourceInfo> SourceInfoList;
-}
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SourceInfo_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/SourceProvideFile.cc
- *
-*/
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include "zypp/base/Logger.h"
-
-#include "zypp/source/SourceProvideFile.h"
-#include "zypp/ZYppCallbacks.h"
-
-using std::endl;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- //
- // provideFile
- //
- ///////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- namespace
- { /////////////////////////////////////////////////////////////////
-
- /** Hack to extract progress information from source::DownloadFileReport.
- * We redirect the static report triggered from Source_Ref::provideFile
- * to feed the ProvideFilePolicy callbacks.
- */
- struct DownloadFileReportHack : public callback::ReceiveReport<source::SourceReport>
- {
- virtual bool progress( int value )
- {
- if ( _redirect )
- return _redirect( value );
- return true;
- }
- function<bool ( int )> _redirect;
- };
-
- /** ManagedFile Dispose functor.
- * The Pathname argument is ignored, as Source_Ref::releaseFile expects the filename
- * relative to the medias root (i.e. same args as to provideFile).
- */
- struct SourceReleaseFile
- {
- SourceReleaseFile( Source_Ref source_r, const Pathname & location_r, unsigned mediaNr_r )
- : _source( source_r ), _location( location_r ), _medianr( mediaNr_r )
- {}
-
- void operator()( const Pathname & /*UNUSED*/ )
- {
- _source.releaseFile( _location, _medianr );
- }
-
- Source_Ref _source;
- Pathname _location;
- unsigned _medianr;
- };
-
- /////////////////////////////////////////////////////////////////
- } // namespace
- ///////////////////////////////////////////////////////////////////
-
- ManagedFile provideFile( Source_Ref source_r,
- const OnMediaLocation & loc_r,
- const ProvideFilePolicy & policy_r )
- {
- MIL << "sourceProvideFile " << loc_r << endl;
- // Arrange DownloadFileReportHack to recieve the source::DownloadFileReport
- // and redirect download progress triggers to call the ProvideFilePolicy
- // callback.
- DownloadFileReportHack dumb;
- dumb._redirect = bind( mem_fun_ref( &ProvideFilePolicy::progress ),
- ref( policy_r ), _1 );
- callback::TempConnect<source::SourceReport> temp( dumb );
-
-
- ManagedFile ret( source_r.provideFile( loc_r.filename(), loc_r.medianr() ),
- SourceReleaseFile( source_r, loc_r.filename(), loc_r.medianr() ) );
-
- if ( loc_r.checksum().empty() )
- {
- // no checksum in metadata
- WAR << "No checksum in metadata " << loc_r << endl;
- }
- else
- {
- std::ifstream input( ret->asString().c_str() );
- CheckSum retChecksum( loc_r.checksum().type(), input );
- input.close();
-
- if ( loc_r.checksum() != retChecksum )
- {
- // failed integity check
- std::ostringstream err;
- err << "File " << ret << " fails integrity check. Expected: [" << loc_r.checksum() << "] Got: [";
- if ( retChecksum.empty() )
- err << "Failed to compute checksum";
- else
- err << retChecksum;
- err << "]";
-
- if ( policy_r.failOnChecksumError() )
- ZYPP_THROW( Exception( err.str() ) );
- else
- WAR << "NO failOnChecksumError: " << err.str() << endl;
- }
- }
-
- MIL << "sourceProvideFile at " << ret << endl;
- return ret;
- }
-
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/SourceProvideFile.h
- *
-*/
-#ifndef ZYPP_SOURCE_SOURCEPROVIDEFILE_H
-#define ZYPP_SOURCE_SOURCEPROVIDEFILE_H
-
-#include <iosfwd>
-
-#include "zypp/base/Function.h"
-#include "zypp/base/Functional.h"
-#include "zypp/Source.h"
-#include "zypp/ManagedFile.h"
-#include "zypp/OnMediaLocation.h"
-#include "zypp/ProvideFilePolicy.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- //
- // provideFile
- //
- ///////////////////////////////////////////////////////////////////
-
- /** Provide a file from a Source.
- * Let \a source_r provide the file described by \a loc_r. In case
- * \a loc_r contains a checksum, the file is verified. \a policy_r
- * provides callback hooks for download progress reporting and behaviour
- * on failed checksum verification.
- *
- * \throws Exception
- */
- ManagedFile provideFile( Source_Ref source_r,
- const OnMediaLocation & loc_r,
- const ProvideFilePolicy & policy_r = ProvideFilePolicy() );
-
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_SOURCEPROVIDEFILE_H
+++ /dev/null
-Makefile.in
-Makefile
-.deps
-.libs
-*.o
-*.lo
-*.a
-*.la
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-
-#include <iostream>
-#include "zypp/base/Logger.h"
-
-#include "zypp/source/plaindir/PlaindirImpl.h"
-
-using std::endl;
-using namespace std;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
-namespace plaindir
-{ /////////////////////////////////////////////////////////////////
-
-PlaindirImpl::PlaindirImpl()
-{
-
-}
-
-PlaindirImpl::~PlaindirImpl()
-{
-
-}
-
-
-void PlaindirImpl::factoryInit()
-{
- if ( ! ( (url().getScheme() == "file") || (url().getScheme() == "dir") ) )
- {
- ZYPP_THROW( Exception( "Plaindir only supports local paths, scheme [" + url().getScheme() + "] is not local" ) );
- }
-
- MIL << "Plaindir source initialized." << std::endl;
- MIL << " Url : " << url() << std::endl;
- MIL << " Path : " << path() << std::endl;
-}
-
-void PlaindirImpl::createResolvables(Source_Ref source_r)
-{
- Pathname thePath = Pathname(url().getPathName()) + path();
- MIL << "Going to read dir " << thePath << std::endl;
-
- extract_packages_from_directory( _store, thePath, selfSourceRef(), true );
-}
-
-int PlaindirImpl::extract_packages_from_directory (ResStore & store, const Pathname & path, Source_Ref source, bool recursive)
-{
- using target::rpm::RpmHeader;
-
- Pathname filename;
- PathInfo magic;
- bool distro_magic, pkginfo_magic;
-
- DBG << "extract_packages_from_directory(.., " << path << ", " << source.alias() << ", " << recursive << ")" << endl;
-
- /*
- Check for magic files that indicate how to treat the
- directory. The files aren't read -- it is sufficient that
- they exist.
- */
-
- magic = PathInfo( path + "/RC_SKIP" );
- if (magic.isExist()) {
- return 0;
- }
-
- magic = PathInfo( path + "/RC_RECURSIVE" );
- if (magic.isExist())
- recursive = true;
-
- magic = PathInfo( path + "/RC_BY_DISTRO" );
- distro_magic = magic.isExist();
-
- pkginfo_magic = true;
- magic = PathInfo( path + "/RC_IGNORE_PKGINFO" );
- if (magic.isExist())
- pkginfo_magic = false;
-
-
- std::list<std::string> dircontent;
- if (filesystem::readdir( dircontent, path, false) != 0) { // dont look for dot files
- ERR << "readdir " << path << " failed" << endl;
- return -1;
- }
-
- for (std::list<std::string>::const_iterator it = dircontent.begin(); it != dircontent.end(); ++it) {
- Pathname file_path = path + *it;
- PathInfo file_info( file_path );
- if (recursive && file_info.isDir()) {
-
- extract_packages_from_directory( store, file_path, source, recursive );
-
- } else if (file_info.isFile() && file_path.extension() == ".rpm" ) {
- RpmHeader::constPtr header = RpmHeader::readPackage( file_path, RpmHeader::NOSIGNATURE );
-#warning FIX creation of Package from src.rpm header
- Package::Ptr package = target::rpm::RpmDb::makePackageFromHeader( header, NULL, *it, source );
- if (package != NULL) {
- DBG << "Adding package " << *package << endl;
- store.insert( package );
- }
- }
- }
- return 0;
-}
-
-
-
-
-
- /////////////////////////////////////////////////////////////////
- } // namespace plaindir
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/MediaMetadataParser.cc
- *
-*/
-#include <iostream>
-#include <fstream>
-#include <sstream>
-
-#include <boost/tokenizer.hpp>
-#include <boost/algorithm/string.hpp>
-
-#include "zypp/base/Logger.h"
-#include "zypp/base/Exception.h"
-#include "zypp/base/PtrTypes.h"
-#include "zypp/base/String.h"
-
-#include "zypp/parser/ParseException.h"
-#include "zypp/parser/tagfile/TagFileParser.h"
-#include "zypp/source/susetags/MediaMetadataParser.h"
-#include <boost/regex.hpp>
-
-using namespace std;
-using namespace boost;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace susetags
-{ /////////////////////////////////////////////////////////////////
-
-static void dumpRegexpResults( const boost::smatch &what )
-{
- for ( unsigned int k=0; k < what.size(); k++)
- {
- DBG << "[match "<< k << "] [" << what[k] << "]" << std::endl;
- }
-}
-
-/*
-File: media
-Location /media.N/ directory on media
-Content two or more lines of ASCII as follows
-<vendor>
-<YYYYMMDDHHMMSS>
-[<media count>]
-[<media flags>]
-[<media names>]
-
-Currently defined flags:
-
-doublesided
-media is double sided, YaST will ask for 'front side' for odd-numbered media and 'back side' for even-numbered media.
-The default is single-sided media.
-
-<media names> may define alternate strings to use when asking to insert a certain media.
-They are defined as <key><whitespace><value> pairs, separated by \n.
-
-*/
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : Parser::parse
-// METHOD TYPE : void
-//
-void MediaMetadataParser::parse( const Pathname & file_r, MediaEntry &entry_r )
-{
- std::ifstream file(file_r.asString().c_str());
- if (!file)
- {
- ZYPP_THROW(Exception("Can't read media file "+file_r.asString()));
- }
-
- std::string buffer;
- // read vendor
- getline(file, entry_r.vendor);
- // read timestamp
- getline(file, entry_r.timestamp);
- // skip flags for now
- std::string media_count_str;
-
- getline(file, buffer);
- regex is_digit_rx("^[\\d]+$");
- boost::smatch what_digit;
-
- // for the first line here we dont have to consume one if
- // there was no media
- bool consume = false;
-
- if (boost::regex_match(buffer, what_digit, is_digit_rx))
- {
- // it was the media count
- str::strtonum(buffer, entry_r.count);
- // consume another line
- consume = true;
- }
- else
- {
- // media count defaults to 1
- entry_r.count = 1;
- }
-
- while (file && !file.eof())
- {
- // probably is the first line after we dont find the media number
- if (consume)
- getline(file, buffer);
-
- // only skip once
- consume = true;
- boost::regex e("^MEDIA([\\d]+)(\\.([_A-Za-z]+)){0,1} (.+)$");
- boost::smatch what;
- if (boost::regex_match(buffer, what, e, boost::match_extra))
- {
- if ( what.size() < 5 )
- {
- ZYPP_THROW (Exception("Can't match MEDIA in '" + buffer + "'"));
- }
-
- dumpRegexpResults(what);
-
- unsigned int number = 1;
- str::strtonum( what[1], number);
- std::string lang = what[3];
- std::string desc = what[4];
- entry_r.alternate_names[number][lang] = desc;
- }
- else
- {
- ZYPP_THROW (Exception("Can't find MEDIA in '" + buffer + "'"));
- }
-
- }
-}
-
-/////////////////////////////////////////////////////////////////
-} // namespace tagfile
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace parser
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/MediaMetadataParser.h
- *
-*/
-#ifndef ZYPP_PARSER_TAGFILE_MediaMetadataPARSER_H
-#define ZYPP_PARSER_TAGFILE_MediaMetadataPARSER_H
-
-#include <iosfwd>
-#include <set>
-#include <map>
-#include <list>
-
-#include "zypp/Pathname.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace susetags
- { /////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : MediaMetadataParser
- //
- /** Tagfile parser. */
- struct MediaMetadataParser
- {
- struct MediaEntry
- {
- std::string vendor;
- std::string timestamp;
- unsigned int count;
- std::set<std::string> flags;
- // map media number to ( map language -> description string )
- // entry.alternate_names[1]["de"] -> "SUSE Linux"
- std::map< unsigned int, std::map<std::string, std::string> > alternate_names;
- };
-
- virtual ~MediaMetadataParser()
- {}
-
- /* Parse file and invoke consume on each tag found.
- * \throw ParseException
- * \todo more doc on Ecaptions.
- */
- void parse( const Pathname & file_r, MediaEntry &entry_r );
- /* Parse a key.modifier (std::list of std::strings)
- * That means, translatable tag with multiple values
- * the default modifier will get the modifier of default (LABEL.de, LABEL as LANGUAGE.default)
- */
- };
- ///////////////////////////////////////////////////////////////////
-
- /////////////////////////////////////////////////////////////////
- } // namespace tagfile
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
- } // namespace parser
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-//
-#endif // ZYPP_PARSER_TAGFILE_MediaMetadataPPARSER_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/MediaPatchesMetadataParser.cc
- *
-*/
-#include <iostream>
-#include <fstream>
-#include <sstream>
-
-#include <boost/tokenizer.hpp>
-#include <boost/algorithm/string.hpp>
-
-#include "zypp/base/Logger.h"
-#include "zypp/base/PtrTypes.h"
-#include "zypp/base/String.h"
-
-#include "zypp/parser/ParseException.h"
-#include "zypp/parser/tagfile/TagFileParser.h"
-#include "zypp/source/susetags/MediaPatchesMetadataParser.h"
-#include <boost/regex.hpp>
-
-using namespace std;
-using namespace boost;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace susetags
-{ /////////////////////////////////////////////////////////////////
-
-/*
- File: media
- Location /media.N/ directory on media
- Content two or more lines of ASCII as follows
- <vendor>
- <YYYYMMDDHHMMSS>
- [<media count>]
- [<media flags>]
- [<media names>]
-
- Currently defined flags:
-
- doublesided
- media is double sided, YaST will ask for 'front side' for odd-numbered media and 'back side' for even-numbered media.
- The default is single-sided media.
-
- <media names> may define alternate strings to use when asking to insert a certain media.
- They are defined as <key><whitespace><value> pairs, separated by \n.
-
-*/
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : Parser::parse
-// METHOD TYPE : void
-//
-void MediaPatchesMetadataParser::parse( const Pathname & file_r, MediaPatchesEntry &entry_r )
-{
- std::ifstream file(file_r.asString().c_str());
- if (!file)
- {
- ZYPP_THROW(Exception("Can't read patches file "+file_r.asString()));
- }
- std::string buffer;
- // read vendor
- getline(file, buffer);
-
- regex rx("^([\\S]+)( (.*))?$");
- boost::smatch what;
-
- if (boost::regex_match(buffer, what, rx))
- {
- //dumpRegexpResults(what);
- entry_r.dir = Pathname(what[1]);
- entry_r.comment = what[3];
- }
- else
- {
- // throw exception?
- }
-
- while (file && !file.eof())
- {
- getline(file, buffer);
- rx = boost::regex("^(.+)-(.+)$");
- if (boost::regex_match(buffer, what, rx, boost::match_extra))
- {
- zypp::parser::tagfile::dumpRegexpResults(what);
- entry_r.products.insert(std::pair<std::string, std::string>(what[1],what[2]));
- }
- else
- {
- // throw exception?
- }
-
- }
-}
-
-/////////////////////////////////////////////////////////////////
-} // namespace tagfile
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace parser
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/MediaPatchesMetadataParser.h
- *
-*/
-#ifndef ZYPP_PARSER_TAGFILE_MediaPatchesMetadataPARSER_H
-#define ZYPP_PARSER_TAGFILE_MediaPatchesMetadataPARSER_H
-
-#include <iosfwd>
-#include <set>
-#include <map>
-#include <list>
-
-#include "zypp/Pathname.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace susetags
- { /////////////////////////////////////////////////////////////////
-
- /*
- Location /media.1/ directory
- Content one line of ASCII as follows
- <directory> <whitespace> <optional comment>
- zero or more lines specifying exclusive products: <productname>-<productversion>
- */
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : MediaPatchesMetadataParser
- //
- /** Tagfile parser. */
- struct MediaPatchesMetadataParser
- {
- struct MediaPatchesEntry
- {
- Pathname dir;
- std::string comment;
- // set of pairs (productname, version)
- std::set< std::pair<std::string, std::string> > products;
- };
-
- virtual ~MediaPatchesMetadataParser()
- {}
-
- /* Parse file and invoke consume on each tag found.
- * \throw ParseException
- * \todo more doc on Ecaptions.
- */
- void parse( const Pathname & file_r, MediaPatchesEntry &entry_r );
- };
- ///////////////////////////////////////////////////////////////////
-
- /////////////////////////////////////////////////////////////////
- } // namespace tagfile
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
- } // namespace parser
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-//
-#endif // ZYPP_PARSER_TAGFILE_MediaPatchesMetadataPPARSER_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/PackagesLangParser.cc
- *
-*/
-#include <iostream>
-#include "zypp/base/Logger.h"
-
-#include "zypp/parser/ParseException.h"
-
-#include "zypp/source/susetags/PackagesLangParser.h"
-#include "zypp/parser/tagfile/TagFileParser.h"
-#include "zypp/Package.h"
-#include "zypp/source/susetags/SuseTagsImpl.h"
-#include "zypp/source/susetags/SuseTagsPackageImpl.h"
-
-#include "zypp/ZYppFactory.h"
-
-using std::endl;
-using namespace zypp::parser;
-using namespace zypp::parser::tagfile;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace susetags
-{ /////////////////////////////////////////////////////////////////
-
-struct PackagesLangParser : public parser::tagfile::TagFileParser
-{
- const PkgContent & _content;
- const Locale & _lang;
- PkgImplPtr _current;
-
- NVRA _nvra;
- int _count;
- std::set<NVRA> _notfound;
- Arch _system_arch;
-
- SuseTagsImpl::Ptr _sourceImpl;
-
- PackagesLangParser ( parser::ParserProgress::Ptr progress, SuseTagsImpl::Ptr sourceimpl , const PkgContent & content_r, const Locale & lang_r )
- : parser::tagfile::TagFileParser(progress)
- ,_content( content_r )
- , _lang( lang_r)
- , _count(0)
- , _sourceImpl( sourceimpl )
-
- {
- ZYpp::Ptr z = getZYpp();
- _system_arch = z->architecture();
- }
-
- /* Consume SingleTag data. */
- virtual void consume( const SingleTag & stag_r )
- {
- if ( stag_r.name == "Pkg" )
- {
- std::vector<std::string> words;
- str::split( stag_r.value, std::back_inserter(words) );
-
- if ( str::split( stag_r.value, std::back_inserter(words) ) != 4 )
- ZYPP_THROW( ParseException( "[" + _file_r.asString() + "] Parse error in tag Pkg, expected [name version release arch], found: [" + stag_r.value + "]" ) );
-
- Arch arch( words[3] );
- _nvra = NVRA( words[0], Edition(words[1],words[2]), arch );
- // only discard the package if it is not compatible AND it does not provide data
- // to other packages
-
- if (!arch.compatibleWith( _system_arch ) && !_sourceImpl->_provides_shared_data[_nvra])
- {
- _current = NULL;
- return;
- }
- _count++;
- }
- else if ( stag_r.name == "Sum" )
- {
- _sourceImpl->_package_data[_nvra]._summary = TranslatedText( stag_r.value, _lang);
- }
- }
-
- /* Consume MulitTag data. */
- virtual void consume( const MultiTag & mtag_r )
- {
- //if ( _current == NULL )
- // return;
-
- if ( mtag_r.name == "Des" )
- {
- _sourceImpl->_package_data[_nvra]._description = TranslatedText (mtag_r.values, _lang);
- }
- else if ( mtag_r.name == "Ins" )
- {
- _sourceImpl->_package_data[_nvra]._insnotify = TranslatedText (mtag_r.values, _lang);
- }
- else if ( mtag_r.name == "Del" )
- {
- _sourceImpl->_package_data[_nvra]._delnotify = TranslatedText (mtag_r.values, _lang);
- }
- else if ( mtag_r.name == "Eul" )
- {
- _sourceImpl->_package_data[_nvra]._license_to_confirm = TranslatedText (mtag_r.values, _lang);
- }
- }
-};
-
-////////////////////////////////////////////////////////////////////////////
-
-void parsePackagesLang( parser::ParserProgress::Ptr progress, SuseTagsImpl::Ptr sourceimpl, const Pathname & file_r, const Locale & lang_r, const PkgContent & content_r )
-{
- PackagesLangParser p( progress, sourceimpl, content_r, lang_r);
- MIL << "Package descriptions/translations parser: [" << file_r << "]. Source [" << sourceimpl->selfSourceRef().alias() << "] at URL:[" << sourceimpl->selfSourceRef().url().asString() << "]. Starting with " << content_r.size() << " packages" << std::endl;
- try
- {
- p.parse( file_r );
- }
- catch (ParseException &e)
- {
- ZYPP_CAUGHT(e);
- ERR << "Bad Source [" << sourceimpl->selfSourceRef().alias() << "] at URL:[" << sourceimpl->selfSourceRef().url().asString() << "]. Packages descriptions/translations " << file_r << " is broken. You will not see translations." << std::endl;
- return;
- }
-
- MIL << "Source [" << sourceimpl->selfSourceRef().alias() << "] at URL:[" << sourceimpl->selfSourceRef().url().asString() << "]. packages.LANG parser done. [ Total packages: " << content_r.size() << " ] [ Package data: " << sourceimpl->_package_data.size() << " ]" << std::endl;
-
- return;
-}
-
-/////////////////////////////////////////////////////////////////
-} // namespace susetags
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/PackagesLangParser.h
- *
-*/
-#ifndef ZYPP_SOURCE_SUSETAGS_PACKAGESLANGPARSER_H
-#define ZYPP_SOURCE_SUSETAGS_PACKAGESLANGPARSER_H
-
-#include <iosfwd>
-#include <list>
-
-#include "zypp/Pathname.h"
-#include "zypp/Package.h"
-#include "zypp/source/susetags/PackagesParser.h"
-#include "zypp/source/susetags/SuseTagsImpl.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace susetags
- { /////////////////////////////////////////////////////////////////
-
- /** \deprecated Just temporary.
- * \throws ParseException and others.
- */
- void parsePackagesLang( parser::ParserProgress::Ptr progress, SuseTagsImpl::Ptr sourceimpl, const Pathname & file_r, const Locale & lang_r, const PkgContent & content_r );
-
- /////////////////////////////////////////////////////////////////
- } // namespace susetags
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_SUSETAGS_PACKAGESLANGPARSER_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/PackagesParser.cc
- *
-*/
-#include <sstream>
-#include <iostream>
-
-#include <boost/regex.hpp>
-
-#include "zypp/base/Logger.h"
-
-#include "zypp/parser/ParseException.h"
-
-#include "zypp/source/susetags/PackagesParser.h"
-#include "zypp/parser/tagfile/TagFileParser.h"
-#include "zypp/Arch.h"
-#include "zypp/Package.h"
-#include "zypp/CapFactory.h"
-#include "zypp/CapSet.h"
-
-#include "zypp/ZYppFactory.h"
-
-using namespace std;
-using namespace zypp::parser;
-using namespace zypp::parser::tagfile;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace susetags
-{ /////////////////////////////////////////////////////////////////
-
-class PackageDiskUsageParser : public parser::tagfile::TagFileParser
-{
-public:
- PkgDiskUsage result;
- NVRAD _current_nvrad;
- bool _pkg_pending;
- boost::regex sizeEntryRX;
-
- PackageDiskUsageParser( parser::ParserProgress::Ptr progress ) : parser::tagfile::TagFileParser(progress)
- {}
-
- virtual void beginParse()
- {
- _pkg_pending = false;
- sizeEntryRX = boost::regex("^(.*/)[[:space:]]([[:digit:]]+)[[:space:]]([[:digit:]]+)[[:space:]]([[:digit:]]+)[[:space:]]([[:digit:]]+)$");
- }
-
- /* Consume SingleTag data. */
- virtual void consume( const SingleTag & stag_r )
- {
- if ( stag_r.name == "Pkg" )
- {
- std::vector<std::string> words;
- if ( str::split( stag_r.value, std::back_inserter(words) ) != 4 )
- ZYPP_THROW( ParseException( "packages.DU - Expected [name version release arch], got [" + stag_r.value +"]") );
-
- _pkg_pending = true;
- _current_nvrad = NVRAD( words[0], Edition(words[1],words[2]), Arch(words[3]) );
- }
- else if ( stag_r.name == "Ver" )
- {
- if (stag_r.value != "2.0")
- WAR << "packages.DU " << stag_r.name << "=" << stag_r.value << ", should be 2.0" << endl;
- }
- else
- {
- //ZYPP_THROW( ParseException( "Unknown tag" ) );
- ERR << "packages.DU - ERROR! found unexpected tag " << stag_r.name << std::endl;
- }
- }
-
- /* Consume MulitTag data. */
- virtual void consume( const MultiTag & mtag_r )
- {
- if ( ! _pkg_pending )
- return;
-
- if ( mtag_r.name == "Dir" )
- {
- DiskUsage usage;
- for (std::list<std::string>::const_iterator it = mtag_r.values.begin(); it != mtag_r.values.end(); ++it )
- {
- boost::smatch what;
- if (boost::regex_match(*it, what, sizeEntryRX, boost::match_extra))
- {
- //zypp::parser::tagfile::dumpRegexpResults(what);
- // build the disk usage info
- usage.add( what[1], str::strtonum<unsigned int>(what[2]) + str::strtonum<unsigned int>(what[3]), str::strtonum<unsigned int>(what[4]) + str::strtonum<unsigned int>(what[5]));
- }
- else
- {
- ZYPP_THROW( ParseException( std::string("Error parsing package size entry") + "[" + *it + "]" ) );
- }
- }
- result[_current_nvrad] = usage;
- _pkg_pending = false;
- }
- }
-
- virtual void endParse()
- {
- }
-};
-
-
-struct PackagesParser : public parser::tagfile::TagFileParser
-{
- PkgContent _result;
-
- Source_Ref _source;
- SuseTagsImpl::Ptr _sourceImpl;
-
- bool _isPendingPkg;
- PkgImplPtr _pkgImpl;
- SrcPkgImplPtr _srcPkgImpl;
- NVRAD _nvrad;
- bool _isShared;
-
- Arch _system_arch;
-
- PackagesParser( parser::ParserProgress::Ptr progress, Source_Ref source, SuseTagsImpl::Ptr sourceimpl)
- : parser::tagfile::TagFileParser(progress)
- , _source( source )
- , _sourceImpl( sourceimpl )
- , _isPendingPkg( false )
- , _isShared( false )
-
- {
- ZYpp::Ptr z = getZYpp();
- _system_arch = z->architecture();
- }
-
- PkgContent result() const
- {
- return _result;
- }
-
- void collectPkg()
- {
- if ( _isPendingPkg )
- {
- _pkgImpl->_sourceImpl = _sourceImpl;
- // if the package does not depend on other package for its data
- // then use its own nvrad as an index
- if ( !_isShared )
- {
- _pkgImpl->_data_index = _pkgImpl->_nvra;
- _sourceImpl->_is_shared[ _pkgImpl->_nvra] = false;
- }
- else
- {
- _sourceImpl->_is_shared[ _pkgImpl->_nvra] = true;
- }
-
- if (_srcPkgImpl == NULL // only if its not a src/nosrc
- && _nvrad.arch.compatibleWith( _system_arch ) )
- {
- _result.insert( PkgContent::value_type( _nvrad, _pkgImpl ) );
- }
- _isPendingPkg = false;
- }
- }
-
- void collectDeps( const std::list<std::string> & depstr_r, CapSet & capset )
- {
- for ( std::list<std::string>::const_iterator it = depstr_r.begin();
- it != depstr_r.end(); ++it )
- {
- if ( (*it).empty() )
- {
- stringstream ss;
- WAR << "[" << _source.alias() << "] at URL:[" << _source.url().asString() << "]. Emtpy capability on " << _file_r << " line " << _line_number << ". Ignoring." << endl;
- }
-
- try
- {
- capset.insert( CapFactory().parse( ResTraits<Package>::kind, *it ) );
- }
- catch (Exception & excpt_r)
- {
- stringstream ss;
- ss << "Bad source [" << _source.alias() << "] at URL:[" << _source.url().asString() << "]. Can't parse capability: [" << *it << "] on " << _file_r << " line " << _line_number;
- ZYPP_THROW( ParseException( ss.str() ) );
- }
- }
- }
-
- /* Consume SingleTag data. */
- virtual void consume( const SingleTag & stag_r )
- {
- if ( stag_r.name == "Pkg" )
- {
- // reset
- // this means this is either the first package, or we just finished parsing a package and a new one is starting
- // collect previous pending package if needed
- collectPkg();
- // reset
- _isShared = false;
- std::vector<std::string> words;
- str::split( stag_r.value, std::back_inserter(words) );
-
- if ( str::split( stag_r.value, std::back_inserter(words) ) != 4 )
- ZYPP_THROW( ParseException("Bad source ["+ _source.alias() +"] at URL:[" + _source.url().asString() + "]. error, we expected NVRA here, got: " + stag_r.value ) );
-
- std::string arch = words[3];
-#warning read comment in file
- // warning: according to autobuild, this is the wrong check
- // a 'src/norsrc' packages is determined by _not_ having a "=Src:" tag in packages
- // However, the 'arch' string we're checking here must be remembered since
- // it determines the directory below the <DATADIR> where the real package
- // can be found.
- if (arch == "src"
- || arch == "nosrc")
- {
- arch = "noarch";
- _srcPkgImpl = SrcPkgImplPtr( new source::susetags::SuseTagsSrcPackageImpl( _source ) );
- }
- else
- _srcPkgImpl = NULL;
-
- _pkgImpl = PkgImplPtr( new source::susetags::SuseTagsPackageImpl( _source ) );
- _nvrad = NVRAD( words[0], Edition( words[1], words[2] ), Arch( arch ) );
- _pkgImpl->_nvra = NVRA( words[0], Edition( words[1], words[2] ), Arch( arch ) );
-
- _isPendingPkg = true;
-
- }
- else if ( stag_r.name == "Cks" )
- {
- std::vector<std::string> words;
- if ( str::split( stag_r.value, std::back_inserter(words) ) != 2 )
- ZYPP_THROW( ParseException("Bad source ["+ _source.alias() +"] at URL:[" + _source.url().asString() + "]. Key: [" + stag_r.name + "] - Expected [type checksum], got [" + stag_r.value +"]"));
-
- _pkgImpl->_checksum = CheckSum(words[0], words[1]);
- }
- else if ( stag_r.name == "Shr" )
- {
- // shared description tags
- std::vector<std::string> words;
- str::split( stag_r.value, std::back_inserter(words) );
-
- if ( str::split( stag_r.value, std::back_inserter(words) ) != 4 )
- ZYPP_THROW( ParseException("Bad source ["+ _source.alias() +"] at URL:[" + _source.url().asString() + "]. Shr tag is wrong, expected NVRA, got: " + stag_r.value ) );
-
- std::string arch = words[3];
- NVRA shared_desc( words[0], Edition( words[1], words[2] ), Arch(arch));
- XXX << "package " << _nvrad << " shares data with " << shared_desc << std::endl;
- _isShared = true;
- _pkgImpl->_data_index = shared_desc;
- // mark the refering package as a package providing data to others
- // because we cant filter those by architecture to save memory
- // or we run in missing package descriptions for x86_64 packages
- // which depends on a ppc package for its data.
- _sourceImpl->_provides_shared_data[ _pkgImpl->_data_index] = true;
- }
- if ( stag_r.name == "Grp" )
- {
- _pkgImpl->_group = stag_r.value;
- }
- if ( stag_r.name == "Vnd" )
- {
- _pkgImpl->_vendor = stag_r.value;
- }
- if ( stag_r.name == "Lic" )
- {
- _pkgImpl->_license = stag_r.value;
- }
- if ( stag_r.name == "Tim" )
- {
- _pkgImpl->_buildtime = Date(str::strtonum<time_t>(stag_r.value));
- }
- if ( stag_r.name == "Siz" )
- {
- std::vector<std::string> words;
- if ( str::split( stag_r.value, std::back_inserter(words) ) != 2 )
- ZYPP_THROW( ParseException("Bad source ["+ _source.alias() +"] at URL:[" + _source.url().asString() + "]. Siz tag wrong. Got [" + stag_r.value + "]" ) );
-
- _pkgImpl->_archivesize = str::strtonum<unsigned long>(words[0]);
- _pkgImpl->_size = str::strtonum<unsigned long>(words[1]);
- }
- if ( stag_r.name == "Loc" )
- {
- std::vector<std::string> words;
- unsigned int howmany = str::split( stag_r.value, std::back_inserter(words) );
- _pkgImpl->_media_number = 1;
- if ( howmany >= 2 )
- {
- _pkgImpl->_media_number = str::strtonum<unsigned int>(words[0]);
- // if a 3rd value is given, use it as the directory specifier, else default to the architecture
- _pkgImpl->_location = _sourceImpl->sourceDir( (howmany > 2) ? words[2] : _nvrad.arch.asString() ) + words[1];
- }
- else
- {
- ZYPP_THROW( ParseException("Bad source ["+ _source.alias() +"] at URL:[" + _source.url().asString() + "]. Bad [Loc] tag. Got: [" + stag_r.value + "]"));
- }
- // ignore path
- }
- }
-
- /* Consume MulitTag data. */
- virtual void consume( const MultiTag & mtag_r )
- {
- if ( ! _isPendingPkg )
- return;
-
- if ( mtag_r.name == "Prv" )
- {
- collectDeps( mtag_r.values, _nvrad[Dep::PROVIDES] );
- }
- else if ( mtag_r.name == "Prq" )
- {
- collectDeps( mtag_r.values, _nvrad[Dep::PREREQUIRES] );
- }
- else if ( mtag_r.name == "Req" )
- {
- collectDeps( mtag_r.values, _nvrad[Dep::REQUIRES] );
- }
- else if ( mtag_r.name == "Con" )
- {
- collectDeps( mtag_r.values, _nvrad[Dep::CONFLICTS] );
- }
- else if ( mtag_r.name == "Obs" )
- {
- collectDeps( mtag_r.values, _nvrad[Dep::OBSOLETES] );
- }
- else if ( mtag_r.name == "Rec" )
- {
- collectDeps( mtag_r.values, _nvrad[Dep::RECOMMENDS] );
- }
- else if ( mtag_r.name == "Sup" )
- {
- collectDeps( mtag_r.values, _nvrad[Dep::SUPPLEMENTS] );
- }
- else if ( mtag_r.name == "Sug" )
- {
- collectDeps( mtag_r.values, _nvrad[Dep::SUGGESTS] );
- }
- else if ( mtag_r.name == "Fre" )
- {
- collectDeps( mtag_r.values, _nvrad[Dep::FRESHENS] );
- }
- else if ( mtag_r.name == "Enh" )
- {
- collectDeps( mtag_r.values, _nvrad[Dep::ENHANCES] );
- }
- else if ( mtag_r.name == "Kwd" )
- {
- _pkgImpl->_keywords.insert( mtag_r.values.begin(), mtag_r.values.end() );
- }
- else if ( mtag_r.name == "Aut" )
- {
- _pkgImpl->_authors = mtag_r.values;
- }
- }
-
- virtual void endParse()
- {
- // collect last package if there is one
- collectPkg();
- }
-};
-
-////////////////////////////////////////////////////////////////////////////
-
-PkgContent parsePackages( parser::ParserProgress::Ptr progress, Source_Ref source_r, SuseTagsImpl::Ptr sourceImpl_r, const Pathname & file_r )
-{
- MIL << "Starting to parse packages " << file_r << std::endl;
- PackagesParser p( progress, source_r, sourceImpl_r );
- try
- {
- p.parse( file_r );
- }
- catch (ParseException &e)
- {
- ZYPP_CAUGHT(e);
- ERR << "Source [" << source_r.alias() << "] at URL:[" << source_r.url().asString() << "] has a broken packages file." << std::endl;
- ZYPP_RETHROW(e);
- }
- return p.result();
-}
-
-PkgDiskUsage parsePackagesDiskUsage( parser::ParserProgress::Ptr progress, const Pathname & file_r )
-{
- MIL << "Starting to parse packages disk usage " << file_r << std::endl;
- PackageDiskUsageParser duParser(progress);
- try
- {
- duParser.parse(file_r);
- }
- catch (ParseException &e)
- {
- ZYPP_CAUGHT(e);
- ERR << "Broken disk usage file " << file_r << ". Ignoring." << std::endl;
- ZYPP_RETHROW(e);
- }
- return duParser.result;
-}
-
-/////////////////////////////////////////////////////////////////
-} // namespace susetags
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/PackagesParser.h
- *
-*/
-#ifndef ZYPP_SOURCE_SUSETAGS_PACKAGESPARSER_H
-#define ZYPP_SOURCE_SUSETAGS_PACKAGESPARSER_H
-
-#include <iosfwd>
-#include <list>
-
-#include "zypp/base/PtrTypes.h"
-#include "zypp/Pathname.h"
-#include "zypp/Package.h"
-#include "zypp/DiskUsage.h"
-#include "zypp/NVRAD.h"
-#include "zypp/parser/ParserProgress.h"
-#include "zypp/source/susetags/SuseTagsImpl.h"
-#include "zypp/source/susetags/SuseTagsPackageImpl.h"
-#include "zypp/source/susetags/SuseTagsSrcPackageImpl.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace susetags
- { /////////////////////////////////////////////////////////////////
-
- typedef detail::ResImplTraits<SuseTagsPackageImpl>::Ptr PkgImplPtr;
- typedef detail::ResImplTraits<SuseTagsSrcPackageImpl>::Ptr SrcPkgImplPtr;
- typedef std::map<NVRAD, PkgImplPtr> PkgContent;
- typedef std::map<NVRAD, DiskUsage> PkgDiskUsage;
-
- /** \deprecated Just temporary.
- * \throws ParseException and others.
- */
- PkgContent parsePackages( parser::ParserProgress::Ptr progress, Source_Ref source_r, SuseTagsImpl::Ptr, const Pathname & file_r );
- PkgDiskUsage parsePackagesDiskUsage( parser::ParserProgress::Ptr progress, const Pathname & file_r );
-
- /////////////////////////////////////////////////////////////////
- } // namespace susetags
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_SUSETAGS_PACKAGESPARSER_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/PatternTagFileParser.cc
- *
-*/
-#include <iostream>
-#include <fstream>
-#include <sstream>
-
-#include <boost/tokenizer.hpp>
-#include <boost/algorithm/string.hpp>
-
-#include "zypp/base/Logger.h"
-#include "zypp/base/PtrTypes.h"
-#include "zypp/base/String.h"
-#include "zypp/CapFactory.h"
-
-#include "zypp/source/susetags/PatternTagFileParser.h"
-#include "zypp/parser/ParseException.h"
-#include <boost/regex.hpp>
-
-#undef ZYPP_BASE_LOGGER_LOGGROUP
-#define ZYPP_BASE_LOGGER_LOGGROUP "PatternsTagFileParser"
-
-using namespace std;
-using namespace boost;
-using namespace zypp::parser;
-using namespace zypp::parser::tagfile;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace susetags
-{ /////////////////////////////////////////////////////////////////
-
-struct PatternTagFileParser::Scrap
-{
- std::string _parser_version;
- std::string _name;
- std::string _version;
- std::string _release;
- std::string _arch;
- std::list<std::string> _suggests;
- std::list<std::string> _recommends;
- std::list<std::string> _requires;
- std::list<std::string> _conflicts;
- std::list<std::string> _provides;
- std::list<std::string> _obsoletes;
- std::list<std::string> _freshens;
- std::list<std::string> _supplements;
- std::list<std::string> _pkgsuggests;
- std::list<std::string> _pkgrecommends;
- std::list<std::string> _pkgrequires;
- std::list<std::string> _includes;
- std::list<std::string> _extends;
-};
-
-Pattern::Ptr parsePattern( parser::ParserProgress::Ptr progress, Source_Ref source_r, const Pathname & file_r )
-{
- MIL << "Starting to parse pattern " << file_r << std::endl;
- PatternTagFileParser p(progress);
- try
- {
- p.parse( file_r );
- }
- catch (ParseException &e)
- {
- ZYPP_CAUGHT(e);
- ERR << "Pattern " << file_r << " is broken." << std::endl;
- return 0L;
- }
- // attach the source
- p.patImpl->_source = source_r;
- return p.result;
-}
-
-PatternTagFileParser::PatternTagFileParser( parser::ParserProgress::Ptr progress )
- : parser::tagfile::TagFileParser(progress)
-{
- patImpl = new SuseTagsPatternImpl;
- _scrap.reset( new Scrap );
-}
-
-void PatternTagFileParser::consume( const SingleTag &tag )
-{
- if ( tag.name == "Sum" )
- {
- patImpl->_summary.setText(tag.value, Locale(tag.modifier));
- }
- else if ( tag.name == "Ver" )
- {
- _scrap->_parser_version = tag.value;
- }
- else if ( tag.name == "Pat" )
- {
- std::string line = tag.value;
- std::vector<std::string> words;
-
- if (str::split( line, std::back_inserter(words), " " ) != 4 )
- ZYPP_THROW( ParseException( "Expected [name version release arch] ], got [" + tag.value +"]") );
-
- _scrap->_name = words[0];
- _scrap->_version = words[1];
- _scrap->_release = words[2];
- _scrap->_arch = words[3];
- }
- else if ( tag.name == "Vis" )
- {
- patImpl->_visible = (tag.value == "true") ? true : false;
- }
- else if ( tag.name == "Cat" )
- {
- patImpl->_category.setText(tag.value, Locale(tag.modifier));
- }
- else if ( tag.name == "Ico" )
- {
- patImpl->_icon = tag.value;
- }
- else if ( tag.name == "Ord" )
- {
- patImpl->_order = tag.value;
- }
-}
-
-void PatternTagFileParser::consume( const MultiTag &tag )
-{
- if ( tag.name == "Des" )
- {
- std::string buffer;
- for (std::list<std::string>::const_iterator it = tag.values.begin(); it != tag.values.end(); ++it)
- {
- buffer += (*it + "\n");
- }
- patImpl->_description.setText(buffer, Locale(tag.modifier));
- }
- if ( tag.name == "Req" )
- {
- _scrap->_requires = tag.values;
- }
- else if ( tag.name == "Rec" )
- {
- _scrap->_recommends = tag.values;
- }
- else if ( tag.name == "Prv" )
- {
- _scrap->_provides = tag.values;
- }
- else if ( tag.name == "Obs" )
- {
- _scrap->_obsoletes = tag.values;
- }
- else if ( tag.name == "Con" )
- {
- _scrap->_conflicts = tag.values;
- }
- else if ( tag.name == "Sup" )
- {
- _scrap->_supplements = tag.values;
- }
- else if ( tag.name == "Sug" )
- {
- _scrap->_suggests = tag.values;
- }
- else if ( tag.name == "Fre" )
- {
- _scrap->_freshens = tag.values;
- }
- else if ( tag.name == "Prq" ) // package requires
- {
- _scrap->_pkgrequires = tag.values;
- }
- else if ( tag.name == "Prc" ) // package recommends
- {
- _scrap->_pkgrecommends = tag.values;
- }
- else if ( tag.name == "Psg" ) // package suggests
- {
- _scrap->_pkgsuggests = tag.values;
- }
- else if ( tag.name == "Inc" ) // UI hint: includes
- {
- _scrap->_includes = tag.values;
- }
- else if ( tag.name == "Ext" ) // UI hint: extends
- {
- _scrap->_extends = tag.values;
- }
-}
-
-void PatternTagFileParser::parseDeps( const std::list<std::string> & strdeps, CapSet & capset, const Resolvable::Kind & kind )
-{
- CapFactory f;
- for (std::list<std::string>::const_iterator it = strdeps.begin(); it != strdeps.end(); it++)
- {
- if ( (*it).empty() )
- {
- stringstream ss;
- WAR << "Emtpy capability on " << _file_r << " line " << _line_number << ". Ignoring." << endl;
- }
-
- try
- {
- Capability cap = f.parse( kind, *it );
- capset.insert( cap );
- }
- catch ( const Exception &e )
- {
- stringstream ss;
- ss << "Broken capability [" << *it << "]" << _file_r << " line " << _line_number;
- ZYPP_THROW( ParseException( ss.str() ) );
- }
- }
- return;
-}
-
-void PatternTagFileParser::endParse()
-{
-#warning FIXME how to insert the specific language packages
- Dependencies _deps;
-
- parseDeps( _scrap->_recommends, _deps[Dep::RECOMMENDS] );
- parseDeps( _scrap->_requires, _deps[Dep::REQUIRES] );
- parseDeps( _scrap->_conflicts, _deps[Dep::CONFLICTS] );
- parseDeps( _scrap->_provides, _deps[Dep::PROVIDES] );
- parseDeps( _scrap->_obsoletes, _deps[Dep::OBSOLETES] );
- parseDeps( _scrap->_suggests, _deps[Dep::SUGGESTS] );
- parseDeps( _scrap->_supplements, _deps[Dep::SUPPLEMENTS] );
- parseDeps( _scrap->_freshens, _deps[Dep::FRESHENS] );
- parseDeps( _scrap->_pkgrecommends, _deps[Dep::RECOMMENDS], ResTraits<Package>::kind );
- parseDeps( _scrap->_pkgrequires, _deps[Dep::REQUIRES], ResTraits<Package>::kind );
- parseDeps( _scrap->_pkgsuggests, _deps[Dep::SUGGESTS], ResTraits<Package>::kind );
- parseDeps( _scrap->_includes, patImpl->_includes );
- parseDeps( _scrap->_extends, patImpl->_extends );
-
- Arch arch;
- if (!_scrap->_arch.empty())
- arch = Arch(_scrap->_arch);
-
- NVRAD nvrad = NVRAD( _scrap->_name, Edition( _scrap->_version, _scrap->_release, std::string() ), arch, _deps );
- result = detail::makeResolvableFromImpl( nvrad, patImpl );
-}
-/////////////////////////////////////////////////////////////////
-} // namespace tagfile
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace parser
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/PatternTagFileParser.h
- *
-*/
-#ifndef ZYPP_PARSER_TAGFILE_PATTERNTAGFILEPARSER_H
-#define ZYPP_PARSER_TAGFILE_PATTERNTAGFILEPARSER_H
-
-#include <iosfwd>
-#include <set>
-#include <map>
-#include <list>
-
-#include "zypp/parser/tagfile/TagFileParser.h"
-#include "zypp/Pattern.h"
-#include "zypp/source/susetags/SuseTagsPatternImpl.h"
-#include "zypp/Pathname.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace susetags
- { /////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : PatternTagFileParser
- //
- /** Tagfile parser. */
- struct PatternTagFileParser : public zypp::parser::tagfile::TagFileParser
- {
- Pattern::Ptr result;
- detail::ResImplTraits<SuseTagsPatternImpl>::Ptr patImpl;
-
- PatternTagFileParser( parser::ParserProgress::Ptr progress );
- virtual ~PatternTagFileParser()
- {}
-
- void parseDeps( const std::list<std::string> & strdeps, CapSet & capset, const Resolvable::Kind & kind = ResTraits<Pattern>::kind );
-
- void consume( const SingleTag &tag );
- void consume( const MultiTag &tag );
- void endParse();
-
-private:
- struct Scrap;
- shared_ptr<Scrap> _scrap;
- };
- ///////////////////////////////////////////////////////////////////
- /**
- * returns null if parse fails
- */
- Pattern::Ptr parsePattern( parser::ParserProgress::Ptr progress, Source_Ref source_r, const Pathname & file_r );
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
- } // namespace susetags
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-//
-#endif // ZYPP_PARSER_TAGFILE_PATTERNTAGFILEPPARSER_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/ProductMetadataParser.cc
- *
-*/
-#include <iostream>
-#include <fstream>
-#include <sstream>
-
-#include <boost/tokenizer.hpp>
-#include <boost/algorithm/string.hpp>
-
-#include "zypp/ZYppFactory.h"
-#include "zypp/base/Logger.h"
-#include "zypp/base/PtrTypes.h"
-#include "zypp/base/String.h"
-
-#include "zypp/CapFactory.h"
-
-#include "zypp/parser/ParseException.h"
-#include "zypp/source/susetags/ProductMetadataParser.h"
-#include "zypp/source/susetags/SuseTagsProductImpl.h"
-#include <boost/regex.hpp>
-
-#undef ZYPP_BASE_LOGGER_LOGGROUP
-#define ZYPP_BASE_LOGGER_LOGGROUP "ProductMetadataParser"
-
-using namespace std;
-using namespace boost;
-using namespace zypp::parser;
-
-typedef find_iterator<string::iterator> string_find_iterator;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace susetags
-{/////////////////////////////////////////////////////////////////
-
-static void replace_variables( std::string &text )
-{
- string::size_type pos = text.find("%a");
- if (pos != string::npos)
- {
- Arch sysarch( getZYpp()->architecture() );
- text.replace( pos, 2, sysarch.asString() );
- }
-}
-
-ProductMetadataParser::ProductMetadataParser()
-{
- prodImpl = new SuseTagsProductImpl;
-}
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : Parser::parse
-// METHOD TYPE : void
-//
-void ProductMetadataParser::parse( const Pathname & file_r, Source_Ref source_r )
-{
- std::ifstream file(file_r.asString().c_str());
-
- if (!file)
- {
- ZYPP_THROW (Exception("Bad source ["+ source_r.alias() +"] at URL:[" + source_r.url().asString() + "]. Can't open product file: [" + file_r.asString() + "]"));
- }
-
- std::string buffer;
- volatile_content = false;
- boost::regex e("^(([A-Z]+)(\\.([_A-Z0-9a-z]+)){0,1}) (.+)$");
- while (file && !file.eof())
- {
- getline(file, buffer);
- boost::smatch what;
- if (boost::regex_match(buffer, what, e, boost::match_extra))
- {
- if ( what.size() < 5 )
- {
- ZYPP_THROW (Exception("Corrupt source? ["+ source_r.alias() +"] at URL:[" + source_r.url().asString() + "]. Can't parse line: [" + buffer + "]"));
- }
-
- std::string key = what[2];
- std::string value = what[5];
- std::string modifier = what[4];
- if (key == "PRODUCT")
- {
- string s(value);
- std::replace(s.begin(), s.end(), ' ', '_');
- prodImpl->_name = s;
- }
- else if (key == "VERSION")
- prodImpl->_version = value;
- else if (key == "DISTPRODUCT")
- prodImpl->_dist_name = value;
- else if (key == "DISTVERSION")
- prodImpl->_dist_version = value;
- else if (key == "BASEPRODUCT")
- prodImpl->_base_product = value;
- else if (key == "BASEVERSION")
- prodImpl->_base_version = value;
- else if (key == "YOUTYPE")
- prodImpl->_you_type = value;
- else if (key == "VENDOR")
- prodImpl->_vendor = value;
- else if (key == "SHORTLABEL")
- prodImpl->_shortlabel = value;
- else if (key == "RELNOTESURL")
- {
- // Url class throws in case of invalid URL
- try
- {
- // replace variables like %a
- replace_variables(value);
-
- Url url (value) ;
- prodImpl->_release_notes_url = url;
- }
- catch ( ... )
- {
- prodImpl->_release_notes_url = Url();
- }
- }
- else if (key == "UPDATEURLS")
- {
- std::list<std::string> items;
- boost::algorithm::split(items, value, is_space());
- std::list<std::string>::const_iterator
- b = items.begin(),
- e = items.end(),
- i;
- for (i = b; i != e; ++i)
- {
- // Url class throws in case of invalid URL
- try
- {
- Url url = *i;
- prodImpl->_update_urls.push_back( url );
- }
- catch ( ... )
- {
- ZYPP_THROW (Exception("Bad source ["+ source_r.alias() +"] at URL:[" + source_r.url().asString() + "]. Ilegal update Url: [" + *i + "]"));
- }
- }
- }
- else if (key == "EXTRAURLS")
- {
- std::list<std::string> items;
- boost::algorithm::split(items, value, is_space());
- std::list<std::string>::const_iterator
- b = items.begin(),
- e = items.end(),
- i;
- for (i = b; i != e; ++i)
- {
- // Url class throws in case of invalid URL
- try
- {
- Url url = *i;
- prodImpl->_extra_urls.push_back( url );
- }
- catch ( ... )
- {
- ZYPP_THROW (Exception("Bad source ["+ source_r.alias() +"] at URL:[" + source_r.url().asString() + "]. Ilegal optional Url: [" + *i + "]"));
- }
- }
- }
- else if (key == "OPTIONALURLS")
- {
- std::list<std::string> items;
- boost::algorithm::split(items, value, is_space());
- std::list<std::string>::const_iterator
- b = items.begin(),
- e = items.end(),
- i;
- for (i = b; i != e; ++i)
- {
- // Url class throws in case of invalid URL
- try
- {
- Url url = *i;
- prodImpl->_optional_urls.push_back( url );
- }
- catch ( ... )
- {
- ZYPP_THROW (Exception("Bad source ["+ source_r.alias() +"] at URL:[" + source_r.url().asString() + "]. Ilegal optional Url: [" + *i + "]"));
- }
- }
- }
- else if (key == "ARCH")
- parseLine( key, modifier, value, prodImpl->_arch);
- else if (key == "DEFAULTBASE")
- prodImpl->_default_base = value;
- else if (key == "PREREQUIRES")
- parseDependencies( key, value, prodImpl->_deps, Dep::PREREQUIRES);
- else if (key == "REQUIRES")
- parseDependencies( key, value, prodImpl->_deps, Dep::REQUIRES);
- else if (key == "PROVIDES")
- parseDependencies( key, value, prodImpl->_deps, Dep::PROVIDES);
- else if (key == "CONFLICTS")
- parseDependencies( key, value, prodImpl->_deps, Dep::CONFLICTS);
- else if (key == "OBSOLETES")
- parseDependencies( key, value, prodImpl->_deps, Dep::OBSOLETES);
- else if (key == "RECOMMENDS")
- parseDependencies( key, value, prodImpl->_deps, Dep::RECOMMENDS);
- else if (key == "SUGGESTS")
- parseDependencies( key, value, prodImpl->_deps, Dep::SUGGESTS);
- else if (key == "SUPPLEMENTS")
- parseDependencies( key, value, prodImpl->_deps, Dep::SUPPLEMENTS);
- else if (key == "ENHANCES")
- parseDependencies( key, value, prodImpl->_deps, Dep::ENHANCES);
- else if (key == "LINGUAS")
- parseLine( key, value, prodImpl->_languages);
- else if (key == "LABEL")
- parseLine( key, modifier, value, prodImpl->_summary);
- else if (key == "DESCRDIR")
- prodImpl->_description_dir = value;
- else if (key == "DATADIR")
- prodImpl->_data_dir = value;
- else if (key == "FLAGS")
- parseLine( key, value, prodImpl->_flags);
- else if (key == "LANGUAGE")
- prodImpl->_language = value;
- else if (key == "TIMEZONE")
- prodImpl->_timezone = value;
- else if (key == "META")
- parseFileCheckSum( key, value, prodImpl->_descr_files_checksums);
- else if (key == "KEY")
- parseFileCheckSum( key, value, prodImpl->_signing_keys);
- else if (key == "VOLATILE_CONTENT")
- volatile_content = true;
- else
- {
- WAR << "In source ["+ source_r.alias() +"] at URL:[" + source_r.url().asString() + "]. Unknown key: [" + key + "] with value [" + value + "]" << std::endl;
- //ZYPP_THROW (Exception("Corrupt source ["+ source_r.alias() +"] at URL:[" + source_r.url().asString() + "]. Unknown key: [" + key + "] with value [" + value + "]"));
- }
- }
- else if (!buffer.empty())
- {
- WAR << "Ignoring line [" << buffer << "] in source ["<< source_r.alias() << "] at URL:[" + source_r.url().asString() << "]." << std::endl;
- }
- } // end while
- // finished parsing, store result
- // Collect basic Resolvable data
-
- try
- {
- // calculate product architecture by looking through ARCH.xxx lines (key of prodImpl->_arch)
- // and taking the 'best' (first) architectures.
-
- Arch sysarch( getZYpp()->architecture() );
- Arch prodarch( Arch_noarch ); // default to noarch
-
- // find matching ARCH.xxx line
-
- std::map< std::string, std::list<std::string> >::const_iterator it = prodImpl->_arch.find( sysarch.asString() );
-
- // if no matching ARCH.xxx line found, search best matching
-
- if (it == prodImpl->_arch.end())
- {
- WAR << "Product does not fully support systems architecture (" << sysarch << ")" << endl;
-
- for (std::map< std::string, std::list<std::string> >::const_iterator it1 = prodImpl->_arch.begin(); it1 != prodImpl->_arch.end(); ++it1)
- {
- Arch arch( it1->first );
- if (!arch.compatibleWith( sysarch ))
- { // filter out incompatbile ones
- continue;
- }
- if (arch.compare( prodarch ) > 0)
- { // found better than current
- prodarch = arch; // set new current
- it = it1;
- }
- }
- }
-
- // oops, still no match found ?
-
- if (it == prodImpl->_arch.end()
- || it->second.empty())
- {
- ERR << "Product incompatible with systems architecture (" << sysarch << ")" << endl;
- }
- else
- {
- MIL << "Found matching/best arch " << it->first << endl;
-
- prodarch = Arch( it->second.front() ); // first arch of matching ARCH.xxx line is best
- }
-
- MIL << "Product arch is " << prodarch << endl;
-
- // Insert a "Provides" _dist_name" == _dist_version"
- CapFactory capfactory;
- prodImpl->_deps[Dep::PROVIDES].insert( capfactory.parse( ResTraits<Product>::kind,
- prodImpl->_dist_name,
- Rel::EQ,
- Edition( prodImpl->_dist_version ) ) );
-
- NVRAD dataCollect( prodImpl->_name, Edition( prodImpl->_version ), prodarch, prodImpl->_deps );
-
- result = detail::makeResolvableFromImpl( dataCollect, prodImpl );
- }
- catch (const Exception & excpt_r)
- {
- ZYPP_THROW(Exception("Error creating product: " + excpt_r.msg()));
- }
-
- prodImpl->_source = source_r;
- prodImpl->_category = source_r.baseSource() ? "base" : "add-on";
- INT << "Product category set to " << prodImpl->_category << endl;
-}
-
-void ProductMetadataParser::parseLine( const string &key, const string &modif, const string &value, map< string, list<string> > &container)
-{
- if ( modif.size() == 0)
- parseLine( key, value, container["default"]);
- else
- parseLine( key, value, container[modif]);
-}
-
-void ProductMetadataParser::parseLine( const std::string &key, const std::string &lang, const std::string &value, TranslatedText &container)
-{
- if ( lang.size() == 0)
- container.setText(value, Locale());
- else
- container.setText(value, Locale(lang));
-}
-
-void ProductMetadataParser::parseLine( const string &key, const string &modif, const string &value, map< string, string > &container)
-{
- if ( modif.size() == 0)
- container["default"] = value;
- else
- container[modif] = value;
-}
-
-void ProductMetadataParser::parseLine( const string &key, const string &value, std::list<std::string> &container)
-{
- str::split( value, std::back_inserter(container), " ");
-}
-
-void ProductMetadataParser::parseDependencies( const string &key, const string &value, Dependencies & deps, Dep deptag )
-{
- std::list<std::string> splitted;
- str::split( value, std::back_inserter(splitted), " ");
- Resolvable::Kind kind;
- std::string name;
- CapFactory f;
- for (std::list<std::string>::const_iterator it = splitted.begin(); it != splitted.end(); ++it)
- {
- string name = *it;
- string::size_type colon = name.find(":");
- kind = ResTraits<Package>::kind;
- if (colon != string::npos)
- {
- string skind( name, 0, colon );
- name.erase( 0, colon+1 );
- DBG << "kind " << skind << ", name " << name << endl;
- if (skind == "pattern") kind = ResTraits<Pattern>::kind;
- else if (skind == "patch") kind = ResTraits<Patch>::kind;
- else if (skind == "selection") kind = ResTraits<Selection>::kind;
- else if (skind == "product") kind = ResTraits<Product>::kind;
- else if (skind != "package") ERR << "Bad kind in content::" << key << " '" << skind << "'" << endl;
- }
- std::list<std::string>::const_iterator next = it;
- ++next;
- if (next != splitted.end())
- { // check for "op edition"
- string val = *next;
- if (val.find_first_of("<>=") != string::npos) // next token is op
- {
- if (++next != splitted.end())
- { // ensure edition follows
- name += " ";
- name += val;
- name += " ";
- name += *next;
- it = next;
- }
- }
- }
- DBG << "parsing[" << name << "]" << endl;
- try
- {
- deps[deptag].insert( f.parse( kind, name ) );
- }
- catch (Exception & excpt_r)
- {
- ZYPP_CAUGHT( excpt_r );
- ERR << "Ignoring invalid " << key << " entry '" << name << "'" << endl;
- }
- }
-}
-
-void ProductMetadataParser::parseFileCheckSum( const std::string &key, const std::string &value, std::map<std::string, CheckSum> &container)
-{
- std::list<std::string> splitted;
- str::split( value, std::back_inserter(splitted), " ");
- if (splitted.size() != 3)
- {
- ZYPP_THROW (Exception("Parse error in checksum entry. Expected [algorithm checksum filename], got [" + value + "]"));
- }
- else
- {
- std::string checksum_type = splitted.front();
- splitted.pop_front();
- std::string checksum_str = splitted.front();
- splitted.pop_front();
- std::string filename = splitted.front();
- splitted.pop_front();
- MIL << "Checksum for " << filename << " is " << checksum_str << " (" << checksum_type << ")" << std::endl;
- container[filename] = CheckSum(checksum_type, checksum_str);
- }
-}
-/////////////////////////////////////////////////////////////////
-} // namespace susetags
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/ProductMetadataParser.h
- *
-*/
-#ifndef ZYPP_SOURCE_SUSETAGS_PRODUCTMETADATAPARSER_H
-#define ZYPP_SOURCE_SUSETAGS_PRODUCTMETADATAPARSER_H
-
-#include <iosfwd>
-#include <set>
-#include <map>
-#include <list>
-
-#include "zypp/CheckSum.h"
-#include "zypp/Pathname.h"
-#include "zypp/Product.h"
-#include "zypp/source/susetags/SuseTagsProductImpl.h"
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
- namespace susetags
- { /////////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : ProductMetadataParser
-//
- /** Tagfile parser. */
- struct ProductMetadataParser
- {
- Product::Ptr result;
- detail::ResImplTraits<SuseTagsProductImpl>::Ptr prodImpl;
- ProductMetadataParser();
- virtual ~ProductMetadataParser()
- {}
-
- /* Parse file and invoke consume on each tag found.
- * \throw ParseException
- * \todo more doc on Ecaptions.
- */
- void parse( const Pathname & file_r, Source_Ref source_r);
- /* Parse a key.modifier (std::list of std::strings)
- * That means, translatable tag with multiple values
- * the default modifier will get the modifier of default (LABEL.de, LABEL as LANGUAGE.default)
- */
- void parseLine( const std::string &key, const std::string &modif, const std::string &value, std::map< std::string, std::list<std::string> > &container);
-
- void parseLine( const std::string &key, const std::string &lang, const std::string &value, TranslatedText &container);
- /*
- * same as above, but the value is a single std::string, this means, translatable tags, with only 1 value
- */
- void parseLine( const std::string &key,const std::string &modif, const std::string &value, std::map< std::string, std::string > &container);
- /*
- * Non translatable tag with multiple values
- */
- void parseLine( const std::string &key, const std::string &value, std::list<std::string> &container);
- /*
- * Dependency (REQUIRES, PROVIDES, CONFLICTS, ...) capabilites line
- */
- void parseDependencies( const std::string &key, const std::string &value, zypp::Dependencies & deps, zypp::Dep deptag );
- /*
- */
- void parseFileCheckSum( const std::string &key, const std::string &value, std::map<std::string, CheckSum> &container);
-
-
- bool volatile_content;
-
- };
-///////////////////////////////////////////////////////////////////
-
-/////////////////////////////////////////////////////////////////
- } // namespace tagfile
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
- } // namespace parser
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-//
-#endif // ZYPP_SOURCE_SUSETAGS_PRODUCTMETADATAPARSER_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/SelectionTagFileParser.cc
- *
-*/
-#include <iostream>
-#include <fstream>
-#include <sstream>
-
-#include <boost/tokenizer.hpp>
-#include <boost/algorithm/string.hpp>
-
-#include "zypp/base/Logger.h"
-#include "zypp/base/PtrTypes.h"
-#include "zypp/base/String.h"
-#include "zypp/CapFactory.h"
-#include "zypp/ZYpp.h"
-
-#include "zypp/parser/ParseException.h"
-#include "zypp/parser/ParserProgress.h"
-#include "zypp/source/susetags/SelectionTagFileParser.h"
-#include <boost/regex.hpp>
-
-#undef ZYPP_BASE_LOGGER_LOGGROUP
-#define ZYPP_BASE_LOGGER_LOGGROUP "SelectionsTagFileParser"
-
-using namespace std;
-using namespace boost;
-using namespace zypp::parser;
-using namespace zypp::parser::tagfile;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace susetags
-{ /////////////////////////////////////////////////////////////////
-
-Selection::Ptr parseSelection( parser::ParserProgress::Ptr progress, Source_Ref source_r, const Pathname & file_r )
-{
- MIL << "Parsing selection " << file_r << " on source [" << source_r.alias() << "] at URL:[" << source_r.url().asString() << "]." << std::endl;
-
- SelectionTagFileParser p(progress);
- try
- {
- p.parse( file_r );
- }
- catch (ParseException &e)
- {
- ZYPP_CAUGHT(e);
- ERR << "Selection " << file_r << " on source [" << source_r.alias() << "] at URL:[" << source_r.url().asString() << "] is broken. Ignoring selection." << std::endl;
-
- return 0L;
- }
- // attach the source
- p.selImpl->_source = source_r;
- return p.result;
-
-}
-
-SelectionTagFileParser::SelectionTagFileParser( parser::ParserProgress::Ptr progress )
- : parser::tagfile::TagFileParser(progress)
-{
- selImpl = new SuseTagsSelectionImpl;
- _locales = zypp::getZYpp()->getRequestedLocales();
-}
-
-void SelectionTagFileParser::consume( const SingleTag &tag )
-{
- //MIL << "about to consume " << tag.name << " with " << tag.value << std::endl;
- if ( tag.name == "Sum" )
- {
- selImpl->_summary.setText(tag.value, Locale(tag.modifier));
- }
- else if ( tag.name == "Ver" )
- {
- selImpl->_parser_version = tag.value;
- }
- else if ( tag.name == "Sel" )
- {
- std::string line = tag.value;
- std::vector<std::string> words;
- str::split( line, std::back_inserter(words), " " );
-
- switch ( words.size() )
- {
- case 4: // name version release arch
- selImpl->_name = words[0];
- selImpl->_version = words[1];
- selImpl->_release = words[2];
- selImpl->_arch = words[3];
- break;
- case 3: // name version release [arch]
- selImpl->_name = words[0];
- selImpl->_version = words[1];
- selImpl->_release = words[2];
- break;
- case 2: // name [version release] arch
- selImpl->_name = words[0];
- selImpl->_arch = words[1];
- break;
- case 1: // name [version release arch]
- selImpl->_name = words[0];
- break;
- default:
- ZYPP_THROW( ParseException( "Selection " + _file_r.asString() + ". Expected [name [version] [release] [arch] ], got [" + tag.value +"]"));
- break;
- }
- }
- else if ( tag.name == "Vis" )
- {
- selImpl->_visible = (tag.value == "true") ? true : false;
- }
- else if ( tag.name == "Cat" )
- {
- selImpl->_category = tag.value;
- }
- else if ( tag.name == "Ord" )
- {
- selImpl->_order = tag.value;
- }
-}
-
-void SelectionTagFileParser::consume( const MultiTag &tag )
-{
- if ( tag.name == "Des" )
- {
- std::string buffer;
- for (std::list<std::string>::const_iterator it = tag.values.begin(); it != tag.values.end(); ++it)
- {
- buffer += (*it + "\n");
- }
- selImpl->_description.setText(buffer, Locale(tag.modifier));
- }
- if ( tag.name == "Req" )
- {
- selImpl->_requires.insert( tag.values.begin(), tag.values.end());
- }
- else if ( tag.name == "Rec" )
- {
- selImpl->_recommends.insert( tag.values.begin(), tag.values.end());
- }
- else if ( tag.name == "Prv" )
- {
- selImpl->_provides.insert( tag.values.begin(), tag.values.end());
- }
- else if ( tag.name == "Con" )
- {
- selImpl->_conflicts.insert( tag.values.begin(), tag.values.end());
- }
- else if ( tag.name == "Obs" )
- {
- selImpl->_obsoletes.insert( tag.values.begin(), tag.values.end());
- }
- else if ( tag.name == "Ins" )
- {
- selImpl->_inspacks[Locale(tag.modifier)].insert( tag.values.begin(), tag.values.end());
- }
- else if ( tag.name == "Del" )
- {
- selImpl->_delpacks[Locale(tag.modifier)].insert( tag.values.begin(), tag.values.end());
- }
-}
-
-void SelectionTagFileParser::endParse()
-{
-#warning Dont do this language stuff in selections
- CapFactory _f;
- Dependencies _deps;
-
- // get the inspacks without locale modifier
-
- for (std::set<std::string>::const_iterator it = selImpl->_inspacks[Locale()].begin(); it != selImpl->_inspacks[Locale()].end(); it++)
- {
- Capability _cap = _f.parse( ResTraits<Package>::kind, *it);
- _deps[Dep::RECOMMENDS].insert(_cap);
- }
-
- // for every requested locale, get the corresponding locale-specific inspacks
- for (ZYpp::LocaleSet::const_iterator loc = _locales.begin(); loc != _locales.end(); ++loc)
- {
- Locale l( *loc );
- std::set<std::string> locale_packs = selImpl->_inspacks[l];
- if (locale_packs.empty())
- {
- l = Locale( l.language().code() );
- locale_packs = selImpl->_inspacks[l];
- }
- for (std::set<std::string>::const_iterator it = locale_packs.begin(); it != locale_packs.end(); it++)
- {
- Capability _cap = _f.parse( ResTraits<Package>::kind, *it);
- _deps[Dep::RECOMMENDS].insert(_cap);
- }
- }
-
- // get the delpacks without locale modifier
-
- for (std::set<std::string>::const_iterator it = selImpl->_delpacks[Locale()].begin(); it != selImpl->_delpacks[Locale()].end(); it++)
- {
- Capability _cap = _f.parse( ResTraits<Package>::kind, *it);
- _deps[Dep::OBSOLETES].insert(_cap);
- }
-
- // for every requested locale, get the corresponding locale-specific delpacks
-#warning fallback to LanguageCode (i.e. en) if Locale (i.e. en_US) does not match
- for (ZYpp::LocaleSet::const_iterator loc = _locales.begin(); loc != _locales.end(); ++loc)
- {
- for (std::set<std::string>::const_iterator it = selImpl->_delpacks[*loc].begin(); it != selImpl->_delpacks[*loc].end(); it++)
- {
- Capability _cap = _f.parse( ResTraits<Package>::kind, *it);
- _deps[Dep::OBSOLETES].insert(_cap);
- }
- }
-
- // now the real recommends
-
- for (std::set<std::string>::const_iterator it = selImpl->_recommends.begin(); it != selImpl->_recommends.end(); it++)
- {
- Capability _cap = _f.parse( ResTraits<Selection>::kind, *it );
- _deps[Dep::RECOMMENDS].insert(_cap);
- }
-
- for (std::set<std::string>::const_iterator it = selImpl->_requires.begin(); it != selImpl->_requires.end(); it++)
- {
- Capability _cap = _f.parse( ResTraits<Selection>::kind, *it );
- _deps[Dep::REQUIRES].insert(_cap);
- }
-
- for (std::set<std::string>::const_iterator it = selImpl->_provides.begin(); it != selImpl->_provides.end(); it++)
- {
- Capability _cap = _f.parse( ResTraits<Selection>::kind, *it );
- _deps[Dep::PROVIDES].insert(_cap);
- }
-
- for (std::set<std::string>::const_iterator it = selImpl->_conflicts.begin(); it != selImpl->_conflicts.end(); it++)
- {
- Capability _cap = _f.parse( ResTraits<Selection>::kind, *it );
- _deps[Dep::CONFLICTS].insert(_cap);
- }
-
- for (std::set<std::string>::const_iterator it = selImpl->_obsoletes.begin(); it != selImpl->_obsoletes.end(); it++)
- {
- Capability _cap = _f.parse( ResTraits<Selection>::kind, *it );
- _deps[Dep::OBSOLETES].insert(_cap);
- }
-#warning: The set<string> dependencies are still kept in the selImpl but are not needed anymore
- Arch arch;
- Edition edition = Edition::noedition;
- if (!selImpl->_arch.empty())
- arch = Arch(selImpl->_arch);
-
- if ( ! selImpl->_version.empty() )
- edition = Edition(selImpl->_version, selImpl->_release, std::string());
-
- NVRAD nvrad = NVRAD( selImpl->_name, edition, arch, _deps );
- result = detail::makeResolvableFromImpl( nvrad, selImpl );
-}
-/////////////////////////////////////////////////////////////////
-} // namespace tagfile
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace parser
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/SelectionTagFileParser.h
- *
-*/
-#ifndef ZYPP_PARSER_TAGFILE_SELECTIONTAGFILEPARSER_H
-#define ZYPP_PARSER_TAGFILE_SELECTIONTAGFILEPARSER_H
-
-#include <iosfwd>
-#include <set>
-#include <map>
-#include <list>
-
-#include "zypp/parser/tagfile/TagFileParser.h"
-#include "zypp/Selection.h"
-#include "zypp/source/susetags/SuseTagsSelectionImpl.h"
-
-#include "zypp/ZYppFactory.h"
-#include "zypp/Pathname.h"
-#include "zypp/Source.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace susetags
- { /////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : SelectionTagFileParser
- //
- /** Tagfile parser. */
- struct SelectionTagFileParser : public zypp::parser::tagfile::TagFileParser
- {
- Selection::Ptr result;
- detail::ResImplTraits<SuseTagsSelectionImpl>::Ptr selImpl;
-
- SelectionTagFileParser( parser::ParserProgress::Ptr progress );
- virtual ~SelectionTagFileParser()
- {}
-
- void consume( const SingleTag &tag );
- void consume( const MultiTag &tag );
- void endParse();
-
-private:
- ZYpp::LocaleSet _locales;
- };
- ///////////////////////////////////////////////////////////////////
- Selection::Ptr parseSelection( parser::ParserProgress::Ptr progress, Source_Ref source_r, const Pathname & file_r );
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
- } // namespace susetags
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-//
-#endif // ZYPP_PARSER_TAGFILE_SELECTIONTAGFILEPPARSER_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/SuseTagsImpl.cc
-*
-*/
-#include <iostream>
-#include <fstream>
-
-#include <boost/bind.hpp>
-
-#include "zypp/base/Logger.h"
-#include "zypp/base/Exception.h"
-#include "zypp/base/Gettext.h"
-
-#include "zypp/PathInfo.h"
-#include "zypp/Digest.h"
-#include "zypp/CheckSum.h"
-#include "zypp/KeyRing.h"
-
-#include "zypp/parser/ParserProgress.h"
-#include "zypp/source/susetags/SuseTagsImpl.h"
-#include "zypp/source/susetags/PackagesParser.h"
-#include "zypp/source/susetags/PackagesLangParser.h"
-#include "zypp/source/susetags/SelectionTagFileParser.h"
-#include "zypp/source/susetags/PatternTagFileParser.h"
-#include "zypp/source/susetags/ProductMetadataParser.h"
-
-#include "zypp/SourceFactory.h"
-#include "zypp/ZYppCallbacks.h"
-#include "zypp/ZYppFactory.h"
-
-using std::endl;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace susetags
-{ /////////////////////////////////////////////////////////////////
-
-
-struct NullParseProgress
-{
- NullParseProgress( Pathname /*file*/ )
- //: _file(file)
- {}
- void operator()( int /*p*/ )
- {}
- //Pathname _file;
-};
-
-struct SourceEventHandler
-{
- SourceEventHandler( callback::SendReport<SourceReport> &report ) : _report(report)
- {}
-
- void operator()( int p )
- {
- _report->progress(p);
- }
-
- callback::SendReport<SourceReport> &_report;
-};
-
-
-bool SuseTagsProber::operator()()
-{
- MIL << "Probing for YaST source..." << std::endl;
- bool result = false;
- media::MediaManager mm;
- result = mm.doesFileExist(_media_id, _path + Pathname("/content"));
-
- if ( result )
- {
- MIL << "YaST source detected..." << std::endl;
- return true;
- }
-
- MIL << "Not a YaST source..." << std::endl;
- return false;
-}
-
-static bool translation_needed( const Locale &trans )
-{
- ZYpp::Ptr z = getZYpp();
- Locale lang( z->getTextLocale() );
-
- while ( (lang != Locale()))
- {
- if ( trans == lang )
- {
- DBG << lang << " is needed" << std::endl;
- return true;
- }
- lang = lang.fallback();
- }
- return false;
-}
-
-static std::string read_line_from_file( const Pathname &file )
-{
- std::string buffer;
- std::string token;
- std::ifstream is(file.asString().c_str());
- if ( is.good() )
- {
- while(is && !is.eof())
- {
- getline(is, buffer);
- token += buffer;
- }
- is.close();
- }
- return token;
-}
-
-static void write_line_to_file( const Pathname &file, const std::string &line )
-{
- std::ofstream os(file.asString().c_str());
- if ( os.good() )
- {
- os << line << endl;;
- }
- os.close();
-}
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : SuseTagsImpl::SuseTagsImpl
-// METHOD TYPE : Ctor
-//
-SuseTagsImpl::SuseTagsImpl()
-{}
-
-const Pathname SuseTagsImpl::metadataRoot() const
-{
- return _cache_dir.empty() ? tmpMetadataDir() : _cache_dir;
-}
-
-const Pathname SuseTagsImpl::contentFile() const
-{
- return metadataRoot() + "/DATA" + "content";
-}
-
-const Pathname SuseTagsImpl::contentFileSignature() const
-{
- return metadataRoot() + "/DATA" + "content.asc";
-}
-
-const Pathname SuseTagsImpl::contentFileKey() const
-{
- return metadataRoot() + "/DATA" + "/content.key";
-}
-
-const Pathname SuseTagsImpl::mediaFile() const
-{
- return metadataRoot() + "MEDIA/media.1/media";
-}
-
-const Pathname SuseTagsImpl::descrDir() const
-{
- return metadataRoot() + "DATA/descr";
-}
-
-const Pathname SuseTagsImpl::dataDir() const
-{
- return _data_dir;
-}
-
-const Pathname SuseTagsImpl::mediaDescrDir() const
-{
- return _media_descr_dir;
-}
-
-std::set<zypp::Resolvable::Kind>
- SuseTagsImpl::resolvableKinds() const
- {
- std::set<zypp::Resolvable::Kind> kinds;
-
- kinds.insert( ResTraits<zypp::Product>::kind );
-
- if ( PathInfo(descrDir() + "patterns").isExist() )
- kinds.insert( ResTraits<zypp::Pattern>::kind );
-
- if ( PathInfo(descrDir() + "selections").isExist() )
- kinds.insert( ResTraits<zypp::Selection>::kind );
-
- if ( PathInfo(descrDir() + "packages").isExist() )
- kinds.insert( ResTraits<zypp::Package>::kind );
-
- return kinds;
- }
-
-bool SuseTagsImpl::downloadNeeded(const Pathname & localdir)
-{
- // we only check if the locale was stored in cache
- if ( PathInfo( localdir + "/locale" ).isExist() )
- {
- ZYpp::Ptr z = getZYpp();
- Locale lang( z->getTextLocale() );
-
- std::string old_locale = read_line_from_file(localdir + "/locale");
- // if it is different we need to redownload what changed
- if ( lang != old_locale )
- return true;
- }
-
- Pathname new_media_file;
- try
- {
- new_media_file = tryToProvideFile("media.1/media");
- }
- catch ( const Exception &e )
- {
- MIL << "media file used to determine if source changed not found. Assuming refresh needed." << std::endl;
- return true;
- }
-
- // before really download all the data and init the cache, check
- // if the source has really changed, otherwise, make it quick
- Pathname cached_media_file = localdir + "/MEDIA/media.1/media";
- if ( cacheExists() )
- {
- CheckSum old_media_file_checksum( "SHA1", filesystem::sha1sum(cached_media_file));
- CheckSum new_media_file_checksum( "SHA1", filesystem::sha1sum(new_media_file));
- if ( (new_media_file_checksum == old_media_file_checksum) && (!new_media_file_checksum.empty()) && (! old_media_file_checksum.empty()))
- {
- MIL << "susetags source " << alias() << " has not changed. Refresh completed. SHA1 of media.1/media file is " << old_media_file_checksum.checksum() << std::endl;
- return false;
- }
- }
- MIL << "susetags source " << alias() << " has changed. Refresh needed." << std::endl;
- return true;
-}
-
-void SuseTagsImpl::readMediaFile(const Pathname &p)
-{
- media::MediaManager media_mgr;
-
- std::ifstream pfile( p.asString().c_str() );
- if ( pfile.bad() )
- {
- ZYPP_THROW(SourceIOException("Can't read media.1/media") );
- }
- _media_vendor = str::getline( pfile, str::TRIM );
- if ( pfile.fail() )
- {
- ZYPP_THROW(SourceIOException("Can't read media.1/media") );
- }
- _media_id = str::getline( pfile, str::TRIM );
- if ( pfile.fail() )
- {
- ZYPP_THROW(SourceIOException("Can't read media.1/media") );
- }
- std::string media_count_str = str::getline( pfile, str::TRIM );
- if ( pfile.fail() )
- {
- ZYPP_THROW(SourceIOException("Can't read media.1/media") );
- }
- _media_count = str::strtonum<unsigned>( media_count_str );
-
- try
- {
- MIL << "Adding susetags media verifier: " << endl;
- MIL << "Vendor: " << _media_vendor << endl;
- MIL << "Media ID: " << _media_id << endl;
-
- // get media ID, but not attaching
- media::MediaAccessId _media = _media_set->getMediaAccessId(1, true);
- media_mgr.delVerifier(_media);
- media_mgr.addVerifier(_media, media::MediaVerifierRef(
- new SourceImpl::Verifier ( _media_vendor, _media_id) ));
- }
- catch (const Exception & excpt_r)
- {
-#warning FIXME: If media data is not set, verifier is not set. Should the media
- ZYPP_CAUGHT(excpt_r);
- WAR << "Verifier not found" << endl;
- }
-}
-
-TmpDir SuseTagsImpl::downloadMetadata()
-{
- resetMediaVerifier();
-
- TmpDir tmpdir;
- MIL << "Downloading metadata to " << tmpdir.path() << std::endl;
-
- Pathname local_dir = tmpdir.path();
-
-
- ZYpp::Ptr z = getZYpp();
- Locale lang( z->getTextLocale() );
-
- try
- {
- write_line_to_file(local_dir + "/locale", lang.code());
- }
- catch (Exception &e)
- {
- ZYPP_THROW(SourceIOException("Can't write current locale to cache " + local_dir.asString() ));
- }
-
- // (#163196)
- // before we used _descr_dir, which is is wrong if we
- // store metadata already running from cache
- // because it points to a local file and not
- // to the media. So use the original media descr_dir.
- Pathname media_src;
- Pathname descr_src;
- Pathname content_src;
-
- // init the cache structure
- if (0 != assert_dir(local_dir + "DATA", 0755))
- ZYPP_THROW(SourceIOException("Cannot create /DATA directory in download dir." + local_dir.asString()));
- if (0 != assert_dir(local_dir + "MEDIA", 0755))
- ZYPP_THROW(SourceIOException("Cannot create /MEDIA directory in download dir." + local_dir.asString()));
- if (0 != assert_dir(local_dir + "PUBLICKEYS", 0755))
- ZYPP_THROW(SourceIOException("Cannot create /PUBLICKEYS directory in download dir." + local_dir.asString()));
-
- try
- {
- media_src = provideDirTree("media.1");
- }
- catch (Exception &e)
- {
- ZYPP_THROW(SourceIOException("Can't provide " + _path.asString() + "/media.1 from " + url().asString() ));
- }
-
- if ( filesystem::copy_dir(media_src, local_dir + "MEDIA") != 0 )
- ZYPP_THROW(SourceIOException("Unable to copy media directory to " + (local_dir + "/MEDIA").asString()));
-
- MIL << "cached media directory" << std::endl;
-
- // media is provided, now we can install a media verifier.
- readMediaFile(local_dir + "/MEDIA/media.1/media");
-
- try
- {
- content_src = provideFile( _path + "content");
- }
- catch (Exception &e)
- {
- ZYPP_THROW(SourceIOException("Can't provide " + _path.asString() + "/content from " + url().asString() ));
- }
-
- if ( filesystem::copy(content_src, local_dir + "DATA/content") != 0)
- ZYPP_THROW(SourceIOException("Unable to copy the content file to " + (local_dir + "DATA/content").asString()));
-
- // get the list of cache keys
- std::list<std::string> files;
- dirInfo( 1, files, _path);
-
- // cache all the public keys
- for ( std::list<std::string>::const_iterator it = files.begin(); it != files.end(); ++it)
- {
- std::string filename = *it;
- if ( filename.substr(0, 10) == "gpg-pubkey" )
- {
- // we add them later
- }
- else if ( (filename == "content.asc") || (filename == "content.key"))
- {
- Pathname src_data;
- try
- {
- src_data = provideFile(_path + filename);
- }
- catch (Exception &e)
- {
- ZYPP_THROW(SourceIOException("Can't provide " + filename + " from " + url().asString() + ". File was listed as available."));
- }
-
- if ( filesystem::copy( src_data, local_dir + "DATA/" + filename) != 0 )
- ZYPP_THROW(SourceIOException("Unable to copy " + filename + " to " + (local_dir + "/DATA").asString()));
-
- if ( filename == "content.key" )
- z->keyRing()->importKey(local_dir + "DATA/content.key", false);
-
- MIL << "cached " << filename << std::endl;
- }
- }
-
- // verify it is a valid content file
- MIL << "SuseTags source: checking 'content' file vailidity using digital signature.." << endl;
- // verify the content file
- bool valid = z->keyRing()->verifyFileSignatureWorkflow( local_dir + "/DATA/content", (path() + "content").asString() + " (" + url().asString() + ")", local_dir + "/DATA/content.asc");
-
- // the source is not valid and the user did not want to continue
- if (!valid)
- ZYPP_THROW (SourceUserRejectedException( "Error. Source signature does not validate and user does not want to continue. "));
-
- // now we have the content file copied, we need to init data and descrdir from the product
- readContentFile(local_dir + "/DATA/content");
-
- // if the content file key is trusted then import all the keys of the content file
- if ( PathInfo(local_dir + "DATA/content.key").isExist() )
- {
- std::string key_id = z->keyRing()->readSignatureKeyId(local_dir + "DATA/content.key");
-
- if ( ! key_id.empty() )
- {
- bool content_trusted = z->keyRing()->isKeyTrusted(key_id);
- MIL << "content file is " << ( content_trusted ? "" : " not " ) << " trusted" << std::endl;
-
- for ( std::map<std::string, CheckSum>::const_iterator it = _prodImpl->_signing_keys.begin(); it != _prodImpl->_signing_keys.end(); ++it)
- {
- std::string key = it->first;
- MIL << "Importing key " << key << " if it did not exists" << std::endl;
-
- getPossiblyCachedMetadataFile( _path + key, local_dir + "PUBLICKEYS/" + key, _cache_dir + "PUBLICKEYS/" + key, _prodImpl->_signing_keys[key] );
-
- z->keyRing()->importKey(local_dir + "PUBLICKEYS/" + key, content_trusted);
- }
- }
- }
-
- // make sure a local descr dir exists
- if ( assert_dir( local_dir + "/DATA/descr") != 0 )
- ZYPP_THROW (SourceIOException( "Error. Can't create local descr directory. "));
-
- // we can get the list of files in description dir in 2 ways
- // from the checksum list, or ls'ing the dir via directory.yast
- if ( ! _prodImpl->_descr_files_checksums.empty() )
- {
- // iterate through all available checksums
- for ( std::map<std::string, CheckSum>::const_iterator it = _prodImpl->_descr_files_checksums.begin(); it != _prodImpl->_descr_files_checksums.end(); ++it)
- {
- std::string key = it->first;
-
- // check if it is a package language file we can skip
- if ( (key.substr(0, 9) == "packages." ) && (key != "packages.DU" ))
- {
- MIL << key << " is a package translation." << std::endl;
- std::string language = key.substr( 9, key.size() - 9 );
-
- // check if it needs to be downloaded
- if ( ! translation_needed( Locale(language) ) )
- continue;
- }
-
- getPossiblyCachedMetadataFile( mediaDescrDir() + key, local_dir + "/DATA/descr" + key, _cache_dir + "/DATA/descr" + key, _prodImpl->_descr_files_checksums[key] );
- }
- }
- else
- {
- // in case we dont have list of valid files in content file, we just glob for them
- std::list<std::string> descr_dir_file_list;
- try
- {
- dirInfo( 1, descr_dir_file_list, mediaDescrDir());
- }
- catch (Exception &e)
- {
- ZYPP_THROW(SourceIOException("Can't list description directory content from " + url().asString() ));
- }
-
- for ( std::list<std::string>::const_iterator it = descr_dir_file_list.begin(); it != descr_dir_file_list.end(); ++it)
- {
- std::string filename = *it;
-
- // check if it is a package language file we can skip
- if ( (filename.substr(0, 9) == "packages." ) && (filename != "packages.DU" ))
- {
- MIL << filename << " is a package translation." << std::endl;
- std::string language = filename.substr( 9, filename.size() - 9 );
-
- // check if it needs to be downloaded
- if ( ! translation_needed( Locale(language) ) )
- continue;
- }
-
- getPossiblyCachedMetadataFile( mediaDescrDir() + filename, local_dir + "/DATA/descr" + filename, _cache_dir + "/DATA/descr" + filename, CheckSum() );
- }
- }
-
- return tmpdir;
-}
-
-void SuseTagsImpl::initCacheDir(const Pathname & cache_dir_r)
-{
- // refuse to use stupid paths as cache dir
- if (cache_dir_r == Pathname("/") )
- ZYPP_THROW(SourceIOException("I refuse to use / as cache dir"));
-
- if (0 != assert_dir(cache_dir_r.dirname(), 0700))
- ZYPP_THROW(SourceIOException("Cannot create cache directory" + cache_dir_r.asString()));
-
- filesystem::clean_dir(cache_dir_r);
- filesystem::mkdir(cache_dir_r + "DATA");
- filesystem::mkdir(cache_dir_r + "MEDIA");
- //filesystem::mkdir(cache_dir_r + "DESCRIPTION");
- filesystem::mkdir(cache_dir_r + "PUBLICKEYS");
-}
-
-void SuseTagsImpl::storeMetadata(const Pathname & cache_dir_r)
-{
- if ( !_cache_dir.empty() )
- {
- saveMetadataTo(cache_dir_r);
- }
- else
- {
- // no previous cache, use the data read temporarely
- copyLocalMetadata(tmpMetadataDir(), cache_dir_r);
- }
-
- MIL << "Metadata saved in " << cache_dir_r << ". Setting as cache." << std::endl;
- _cache_dir = cache_dir_r;
-}
-
-void SuseTagsImpl::saveMetadataTo(const Pathname & dir_r)
-{
- TmpDir download_tmp_dir;
-
- bool need_to_refresh = true;
- try
- {
- need_to_refresh = downloadNeeded(dir_r);
- }
- catch (Exception &e)
- {
- ZYPP_THROW(SourceIOException("Can't check if source has changed or not. Aborting refresh."));
- }
-
- if ( need_to_refresh )
- {
- MIL << "SuseTags source " << alias() << " has changed since last download. Re-reading metadata into " << dir_r << endl;
- }
- else
- {
- MIL << "SUSEtags source " << alias() << " has not changed. Refresh completed. timestamp of media file is the same." << std::endl;
- return;
- }
-
- download_tmp_dir = downloadMetadata();
- copyLocalMetadata(download_tmp_dir, dir_r);
-
- // download_tmp_dir go out of scope now but it is ok as we already copied the content.
-}
-
-bool SuseTagsImpl::cacheExists() const
-{
- MIL << "Checking if source cache exists in "<< _cache_dir << std::endl;
- bool exists = true;
-
- bool data_exists = PathInfo(_cache_dir + "DATA").isExist();
- exists = exists && data_exists;
-
- //bool description_exists = PathInfo(_cache_dir + "DESCRIPTION").isExist();
- //exists = exists && description_exists;
-
- bool media_exists = PathInfo(_cache_dir + "MEDIA").isExist();
- exists = exists && media_exists;
-
- bool media_file_exists = PathInfo(_cache_dir + "MEDIA/media.1/media").isExist();
- exists = exists && media_file_exists;
-
- MIL << "DATA " << (data_exists ? "exists" : "not found") << ", MEDIA " << (media_exists ? "exists" : "not found") << ", MEDIA/media.1/media " << (media_file_exists ? "exists" : "not found") << std::endl;
- return exists;
-}
-
-void SuseTagsImpl::factoryInit()
-{
- bool cache = cacheExists();
- if ( cache )
- {
- MIL << "Cached metadata found in [" << _cache_dir << "]." << endl;
- // we need to read the content file to init data dir and descr dir
- // in the media.
- readMediaFile(mediaFile());
- readContentFile(contentFile());
-
- if ( autorefresh() )
- storeMetadata(_cache_dir);
- }
- else
- {
- if ( _cache_dir.empty() || !PathInfo(_cache_dir).isExist() )
- {
- MIL << "Cache dir not set. Downloading to temp dir: " << tmpMetadataDir() << std::endl;
- // as we have no local dir set we use a tmp one, but we use a member variable because
- // it cant go out of scope while the source exists.
- saveMetadataTo(tmpMetadataDir());
- }
- else
- {
- MIL << "Cached metadata not found in [" << _cache_dir << "]. Will download." << std::endl;
- saveMetadataTo(_cache_dir);
- }
- }
-
- if ( alias().empty() )
- setAlias(_product->summary());
-
- MIL << "SUSETags source initialized." << std::endl;
- MIL << " Url : " << url() << std::endl;
- MIL << " alias : " << alias() << std::endl;
- MIL << " Path : " << path() << std::endl;
- MIL << " Data : " << dataDir() << std::endl;
- MIL << " Metadata : " << metadataRoot() << (_cache_dir.empty() ? " [TMP]" : " [CACHE]") << std::endl;
- MIL << " N-Media : " << numberOfMedia() << std::endl;
-}
-
-void SuseTagsImpl::createResolvables(Source_Ref source_r)
-{
- provideProducts ( source_r, _store );
- providePackages ( source_r, _store );
- provideSelections ( source_r, _store );
- providePatterns ( source_r, _store );
-}
-
-const std::list<Pathname> SuseTagsImpl::publicKeys()
-{
- std::list<std::string> files;
- std::list<Pathname> paths;
-
- MIL << "Reading public keys..." << std::endl;
- filesystem::readdir(files, metadataRoot() + "PUBLICKEYS");
- for ( std::list<std::string>::const_iterator it = files.begin(); it != files.end(); ++it)
- paths.push_back(Pathname(*it));
-
- MIL << "read " << files.size() << " keys from cache " << metadataRoot() << std::endl;
- return paths;
-}
-
-ResStore SuseTagsImpl::createResolvablesByKind(Source_Ref source_r, Resolvable::Kind kind)
-{
- ResStore store;
-
- if ( kind == ResTraits<Product>::kind )
- provideProducts ( source_r, store );
- else if ( kind == ResTraits<Package>::kind )
- providePackages ( source_r, store );
- else if ( kind == ResTraits<Selection>::kind )
- provideSelections ( source_r, store );
- else if ( kind == ResTraits<Pattern>::kind )
- providePatterns ( source_r, store );
- return store;
-}
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : SuseTagsImpl::~SuseTagsImpl
-// METHOD TYPE : Dtor
-//
-SuseTagsImpl::~SuseTagsImpl()
-{}
-
-Pathname SuseTagsImpl::sourceDir( const std::string & dir )
-{
- return Pathname( _data_dir + Pathname( dir ) + "/");
-}
-
-media::MediaVerifierRef SuseTagsImpl::verifier(media::MediaNr media_nr)
-{
- return media::MediaVerifierRef(
- new SourceImpl::Verifier (_media_vendor, _media_id, media_nr));
-}
-
-unsigned SuseTagsImpl::numberOfMedia(void) const
-{
- return _media_count;
-}
-
-std::string SuseTagsImpl::vendor (void) const
-{
- return _prodImpl->vendor();
-}
-
-std::string SuseTagsImpl::unique_id (void) const
-{
- return _media_id;
-}
-
-Date SuseTagsImpl::timestamp() const
-{
- return PathInfo(contentFile()).mtime();
-}
-
-void SuseTagsImpl::readContentFile(const Pathname &content_file)
-{
- SourceFactory factory;
- try
- {
- DBG << "Going to parse content file " << content_file << endl;
-
- ProductMetadataParser p;
- p.parse( content_file, factory.createFrom(this) );
- _product = p.result;
-
- // data dir is the same, it is determined by the content file
- _data_dir = _path + p.prodImpl->_data_dir;
- // description dir also changes when using cache
- _media_descr_dir = _path + p.prodImpl->_description_dir;
-
- MIL << "Read product: " << _product->summary() << endl;
-
- _prodImpl = p.prodImpl;
- }
- catch ( const Exception & e )
- {
- ZYPP_THROW (SourceMetadataException("Cannot parse content file: " + e.msg()));
- }
-}
-
-void SuseTagsImpl::provideProducts(Source_Ref source_r, ResStore &store)
-{
- MIL << "Adding product: " << _product->summary() << " to the store" << endl;
- store.insert( _product );
-}
-
-void SuseTagsImpl::providePackages(Source_Ref source_r, ResStore &store)
-{
- Pathname p = descrDir() + "packages";
-
- //verifyFile( p, "packages");
-
- DBG << "Going to parse " << p << endl;
-
- parser::ParserProgress::Ptr progress;
- //progress.reset( new parser::ParserProgress(npp) );
-
- callback::SendReport<SourceReport> report;
- SourceEventHandler npp(report);
-
- progress.reset( new parser::ParserProgress( npp ) );
- report->start( selfSourceRef(), _("Reading packages file") );
-
- PkgContent content;
-
- try
- {
- content = parsePackages( progress, source_r, this, p );
- }
- catch ( const Exception &e )
- {
- report->finish( selfSourceRef(), _("Reading packages file"), source::SourceReport::INVALID, e.msg() );
- ZYPP_THROW(SourceMetadataException("Can't parse packages file: " + e.msg()));
- }
- report->finish( selfSourceRef(), _("Reading packages file"), source::SourceReport::NO_ERROR, "" );
-
-#warning Should use correct locale and locale fallback list
- // note, this locale detection has nothing to do with translated text.
- // basically we are only loading the data we need. Instead of parsing all
- // package description we fill the TranslatedText properties only
- // with the detected locale.
-
- ZYpp::Ptr z = getZYpp();
- Locale lang( z->getTextLocale() );
-
- std::string packages_lang_prefix( "packages." );
- std::string packages_lang_name;
-
- // get the list of available packages.X trsnlation files
- std::list<std::string> all_files;
- filesystem::readdir(all_files, descrDir());
-
- std::list<std::string> _pkg_translations;
- for ( std::list<std::string>::const_iterator it = all_files.begin(); it != all_files.end(); ++it)
- {
- if ( ((*it).substr(0, 9) == "packages." ) && ((*it) != "packages.DU" ))
- {
- MIL << *it << " available as package data translation." << std::endl;
- _pkg_translations.push_back(*it);
- }
- }
-
- // find the most apropiate file
- bool trymore = true;
- while ( (lang != Locale()) && trymore )
- {
- packages_lang_name = packages_lang_prefix + lang.code();
- MIL << "Translation candidate: " << lang.code() << std::endl;
- try
- {
- // only provide it if it exists
- if ( find( _pkg_translations.begin(), _pkg_translations.end(), packages_lang_name ) != _pkg_translations.end() )
- {
- p = descrDir() + packages_lang_name;
- if ( PathInfo(p).isExist() )
- {
- MIL << packages_lang_name << " found" << std::endl;
- DBG << "Going to parse " << p << endl;
- //verifyFile( p, packages_lang_name);
-
- SourceEventHandler lang_progress_handler(report);
- progress.reset( new parser::ParserProgress( lang_progress_handler ) );
-
- // TranslatorExplanation %s = language name
- report->start( selfSourceRef(), str::form(_("Reading translation: %s"), packages_lang_name.c_str()) );
- parsePackagesLang( progress, this, p, lang, content );
- trymore = false;
- // TranslatorExplanation %s = language name
- report->finish( selfSourceRef(), str::form(_("Reading translation: %s"), packages_lang_name.c_str()), source::SourceReport::NO_ERROR, "" );
- }
- else
- {
- ERR << packages_lang_name << " can't be provided, even if it should" << endl;
- }
- }
- else
- {
- MIL << "Skipping translation candidate " << packages_lang_name << " (not present in media)" << endl;
- }
- }
- catch ( const Exception &e )
- {
- report->finish( selfSourceRef(), str::form(_("Reading translation: %s"), packages_lang_name.c_str()), source::SourceReport::INVALID, e.msg() );
- ZYPP_CAUGHT(e);
- }
- lang = lang.fallback();
- }
-
- MIL << _package_data.size() << " packages holding real data" << std::endl;
- MIL << content.size() << " packages parsed" << std::endl;
-
- int counter =0;
- for ( std::map<NVRA, DefaultFalseBool>::const_iterator it = _is_shared.begin(); it != _is_shared.end(); ++it)
- {
- if ( it->second)
- counter++;
- }
-
- MIL << counter << " packages sharing data" << std::endl;
-
-
- PkgDiskUsage du;
- try
- {
- p = descrDir() + + "packages.DU";
- //verifyFile( p, "packages.DU");
- parser::ParserProgress::Ptr progress;
- NullParseProgress npp(p);
- progress.reset( new parser::ParserProgress(npp) );
- du = parsePackagesDiskUsage(progress, p);
- }
- catch (Exception & excpt_r)
- {
- WAR << "Problem trying to parse the disk usage info" << endl;
- }
-
- for (PkgContent::const_iterator it = content.begin(); it != content.end(); ++it)
- {
- it->second->_diskusage = du[it->first /* NVRAD */];
- Package::Ptr pkg = detail::makeResolvableFromImpl( it->first, it->second );
- store.insert( pkg );
-
- //MIL << "Package " << pkg->summary() << std::endl;
- //MIL << " " << pkg->description() << std::endl;
- //MIL << "----------------------------------" << std::endl;
-
- }
- DBG << "SuseTagsImpl (fake) from " << p << ": "
- << content.size() << " packages" << endl;
-}
-
-void SuseTagsImpl::provideSelections(Source_Ref source_r, ResStore &store)
-{
- Pathname p;
-
- bool file_found = true;
-
- // parse selections
- p = descrDir() + "selections";
- if ( ! PathInfo(p).isExist() )
- {
- MIL << p << " not found." << endl;
- file_found = false;
- }
-
- if (file_found)
- {
- //verifyFile( p, "selections");
- std::ifstream sels (p.asString().c_str());
-
- while (sels && !sels.eof())
- {
- std::string selfile;
- getline(sels,selfile);
-
- if (selfile.empty() ) continue;
- DBG << "Going to parse selection " << selfile << endl;
-
- Pathname file = descrDir() + selfile;
- //verifyFile( file, selfile);
-
- MIL << "Selection file to parse " << file << endl;
- parser::ParserProgress::Ptr progress;
- NullParseProgress npp(file);
- progress.reset( new parser::ParserProgress(npp) );
- Selection::Ptr sel( parseSelection( progress, source_r, file ) );
-
- if (sel)
- {
- DBG << "Selection:" << sel << endl;
- store.insert( sel );
- DBG << "Parsing of " << file << " done" << endl;
- }
- else
- {
- DBG << "Parsing of " << file << " failed" << endl;
- }
-
-
- }
- }
-}
-
-void SuseTagsImpl::providePatterns(Source_Ref source_r, ResStore &store)
-{
- Pathname p;
-
- // parse patterns
- bool file_found = true;
-
- p = descrDir() + "patterns";
- if ( ! PathInfo(p).isExist() )
- {
- MIL << p << " not found." << endl;
- file_found = false;
- }
-
- if ( file_found )
- {
- //verifyFile( p, "patterns");
- std::ifstream pats (p.asString().c_str());
-
- while (pats && !pats.eof())
- {
- std::string patfile;
- getline(pats,patfile);
-
- if (patfile.empty() ) continue;
-
- DBG << "Going to parse pattern " << patfile << endl;
-
- Pathname file = descrDir() + patfile;
-
- MIL << "Pattern file to parse " << file << endl;
- parser::ParserProgress::Ptr progress;
- NullParseProgress npp(file);
- progress.reset( new parser::ParserProgress(npp) );
- Pattern::Ptr pat( parsePattern( progress, source_r, file ) );
-
- if (pat)
- {
- DBG << "Pattern:" << pat << endl;
- _store.insert( pat );
- DBG << "Parsing of " << file << " done" << endl;
- }
- else
- {
- DBG << "Parsing of " << file << " failed" << endl;
- }
- }
- }
-}
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : SuseTagsImpl::dumpOn
-// METHOD TYPE : std::ostream &
-//
-std::ostream & SuseTagsImpl::dumpOn( std::ostream & str ) const
-{
- return SourceImpl::dumpOn( str );
-}
-
-/////////////////////////////////////////////////////////////////
-} // namespace susetags
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/SuseTagsImpl.h
- *
-*/
-#ifndef ZYPP_SOURCE_SUSETAGS_SUSETAGSIMPL_H
-#define ZYPP_SOURCE_SUSETAGS_SUSETAGSIMPL_H
-
-#include <iosfwd>
-#include <string>
-
-#include "zypp/Pathname.h"
-#include "zypp/source/SourceImpl.h"
-#include "zypp/base/DefaultFalseBool.h"
-#include "zypp/Product.h"
-#include "zypp/CheckSum.h"
-#include "zypp/source/susetags/SuseTagsProductImpl.h"
-#include "zypp/source/susetags/SuseTagsPackageImpl.h"
-
-using namespace zypp::filesystem;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace susetags
- { /////////////////////////////////////////////////////////////////
-
- /**
- * Functor to probe
- */
- class SuseTagsProber : public SourceProber
- {
- public:
- SuseTagsProber( media::MediaAccessId media_id, const Pathname &path ) : SourceProber( media_id, path )
- {}
-
- virtual ~SuseTagsProber()
- {}
-
- virtual bool operator()();
- };
-
- struct SuseTagsPackageImplData
- {
- SuseTagsPackageImplData()
- {}
-
- TranslatedText _summary;
- TranslatedText _description;
- TranslatedText _insnotify;
- TranslatedText _delnotify;
- TranslatedText _license_to_confirm;
- std::list<std::string> _authors;
- };
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : SuseTagsImpl
- //
- /** */
- class SuseTagsImpl : public SourceImpl
- {
- public:
- typedef source::susetags::SuseTagsProber Prober;
- typedef intrusive_ptr<SuseTagsImpl> Ptr;
- typedef intrusive_ptr<const SuseTagsImpl> constPtr;
-
- public:
- /** Default Ctor.
- * Just initilizes data members. Metadata retrieval
- * is delayed untill \ref factoryInit.
- */
- SuseTagsImpl();
- /** Dtor */
- ~SuseTagsImpl();
-
- public:
- virtual std::string type(void) const
- {
- return typeString();
- }
-
- /** Text used for identifying the type of the source.
- * Used by the \ref SourceFactory when creating a
- * source of a given type only.
- */
- static std::string typeString(void)
- {
- return "YaST";
- }
- virtual Date timestamp() const;
- virtual unsigned numberOfMedia(void) const;
- virtual std::string vendor (void) const;
- virtual const std::list<Pathname> publicKeys();
- virtual std::string unique_id (void) const;
-
- Pathname sourceDir( const std::string & dir );
- virtual void storeMetadata(const Pathname & cache_dir_r);
- virtual std::set<zypp::Resolvable::Kind> resolvableKinds() const;
- /**
- * Get media verifier for the specified media
- */
- virtual media::MediaVerifierRef verifier(media::MediaNr media_nr);
-
- protected:
- /** Stream output. */
- virtual std::ostream & dumpOn( std::ostream & str ) const;
- void initCacheDir(const Pathname & cache_dir_r);
- bool cacheExists() const;
- private:
- /** Ctor substitute.
- * Actually get the metadata.
- * \throw EXCEPTION on fail
- */
- virtual void factoryInit();
- virtual void createResolvables(Source_Ref source_r);
-
- /** Provide only resolvables of a certain kind. */
- virtual ResStore createResolvablesByKind(Source_Ref source_r, zypp::Resolvable::Kind kind);
-
-
- const Pathname metadataRoot() const;
- const Pathname contentFile() const;
- const Pathname contentFileKey() const;
- const Pathname contentFileSignature() const;
- const Pathname descrDir() const;
- const Pathname mediaFile() const;
-
- void saveMetadataTo(const Pathname & dir_r);
-
- /**
- * description dir in original media
- * it is not always the same so it
- * requires the content file to be parsed
- */
- const Pathname mediaDescrDir() const;
-
- /**
- * data dir in original media
- * it is not always the same so it
- * requires the content file to be parsed
- */
- const Pathname dataDir() const;
-
- /**
- * reads content file, initializes the
- * data and media descr dir
- * and saves the product object
- * but it does not add it to the store yet
- */
- void readContentFile(const Pathname &p);
-
- /**
- * reads a media file and installs
- * a media verifier if available
- */
- void readMediaFile(const Pathname &p);
-
- TmpDir downloadMetadata();
- bool downloadNeeded(const Pathname &localdir);
-
- void provideProducts(Source_Ref source_r, ResStore& store);
- void providePackages(Source_Ref source_r, ResStore& store);
- void provideSelections(Source_Ref source_r, ResStore& store);
- void provideSelection(Source_Ref source_r, ResStore& store);
- void providePatterns(Source_Ref source_r, ResStore& store);
-
- unsigned _media_count;
-
- // data dir we are using
- // depends if we are on media or
- // cache
- Pathname _data_dir;
-
- // descr dir on media.
- // we need it if we refresh
- // already running from cache
- Pathname _media_descr_dir;
-
- std::string _media_vendor;
- std::string _media_id;
- /**
- * pointer to the product implementation
- * we need it to access the checksums if we are in verify mode
- */
- detail::ResImplTraits<SuseTagsProductImpl>::Ptr _prodImpl;
- Product::Ptr _product;
- public:
-
- // shared data between packages with same NVRA
- std::map<NVRA, SuseTagsPackageImplData> _package_data;
- // list of packages which depend on another package for its data
- std::map<NVRA, DefaultFalseBool> _is_shared;
- // list of packages which provide data to another package
- std::map<NVRA, DefaultFalseBool> _provides_shared_data;
-
- // list of translation files
- std::list<std::string> _pkg_translations;
- };
- ///////////////////////////////////////////////////////////////////
-
- /////////////////////////////////////////////////////////////////
- } // namespace susetags
- ///////////////////////////////////////////////////////////////////
-
- using susetags::SuseTagsImpl;
-
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_SUSETAGS_SUSETAGSIMPL_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/SuseTagsPackageImpl.cc
- *
-*/
-
-#include "zypp/source/susetags/SuseTagsImpl.h"
-#include "zypp/source/susetags/SuseTagsPackageImpl.h"
-
-using namespace std;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace susetags
-{ /////////////////////////////////////////////////////////////////
-
-IMPL_PTR_TYPE(SuseTagsImpl);
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : PackageImpl::PackageImpl
-// METHOD TYPE : Ctor
-//
-SuseTagsPackageImpl::SuseTagsPackageImpl(Source_Ref source_r)
- : _media_number( 1 )
- , _source( source_r )
-{}
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : PackageImpl::~PackageImpl
-// METHOD TYPE : Dtor
-//
-SuseTagsPackageImpl::~SuseTagsPackageImpl()
-{}
-
-TranslatedText SuseTagsPackageImpl::summary() const
-{
- return _sourceImpl->_package_data[_data_index]._summary;
-}
-
-TranslatedText SuseTagsPackageImpl::description() const
-{
- return _sourceImpl->_package_data[_data_index]._description;
-}
-
-TranslatedText SuseTagsPackageImpl::insnotify() const
-{
- return _sourceImpl->_package_data[_data_index]._insnotify;
-}
-
-TranslatedText SuseTagsPackageImpl::delnotify() const
-{
- return _sourceImpl->_package_data[_data_index]._delnotify;
-}
-
-TranslatedText SuseTagsPackageImpl::licenseToConfirm() const
-{
- return _sourceImpl->_package_data[_data_index]._license_to_confirm;
-}
-
-Source_Ref SuseTagsPackageImpl::source() const
-{
- return _source;
-}
-
-unsigned SuseTagsPackageImpl::sourceMediaNr() const
-{
- return _media_number;
-}
-
-CheckSum SuseTagsPackageImpl::checksum() const
-{
- return _checksum;
-}
-
-Date SuseTagsPackageImpl::buildtime() const
-{
- return _buildtime;
-}
-
-std::string SuseTagsPackageImpl::buildhost() const
-{
- return std::string();
-}
-
-Date SuseTagsPackageImpl::installtime() const
-{
- return Date();
-} // it was never installed
-
-std::string SuseTagsPackageImpl::distribution() const
-{
- return std::string();
-}
-
-Vendor SuseTagsPackageImpl::vendor() const
-{
- return( _vendor.empty() ? _source.vendor() : _vendor );
-}
-
-Label SuseTagsPackageImpl::license() const
-{
- return _license;
-}
-
-std::string SuseTagsPackageImpl::packager() const
-{
- return std::string();
-}
-
-PackageGroup SuseTagsPackageImpl::group() const
-{
- return _group;
-}
-
-SuseTagsPackageImpl::Keywords SuseTagsPackageImpl::keywords() const
-{
- return _keywords;
-}
-
-Changelog SuseTagsPackageImpl::changelog() const
-{
- return Changelog();
-}
-
-Pathname SuseTagsPackageImpl::location() const
-{
- return _location;
-}
-
-std::string SuseTagsPackageImpl::url() const
-{
- return std::string();
-}
-
-std::string SuseTagsPackageImpl::os() const
-{
- return std::string();
-}
-
-Text SuseTagsPackageImpl::prein() const
-{
- return Text();
-}
-
-Text SuseTagsPackageImpl::postin() const
-{
- return Text();
-}
-
-Text SuseTagsPackageImpl::preun() const
-{
- return Text();
-}
-
-Text SuseTagsPackageImpl::postun() const
-{
- return Text();
-}
-
-ByteCount SuseTagsPackageImpl::size() const
-{
- return _size;
-}
-
-ByteCount SuseTagsPackageImpl::sourcesize() const
-// FIXME
-{
- return 0;
-}
-
-ByteCount SuseTagsPackageImpl::archivesize() const
-{
- return _archivesize;
-}
-
-DiskUsage SuseTagsPackageImpl::diskusage() const
-{
- return _diskusage;
-}
-
-std::list<std::string> SuseTagsPackageImpl::authors() const
-{
- return _sourceImpl->_package_data[_data_index]._authors;
-}
-
-std::list<std::string> SuseTagsPackageImpl::filenames() const
-{
- return std::list<std::string>();
-}
-
-std::list<detail::PackageImplIf::DeltaRpm> SuseTagsPackageImpl::deltaRpms() const
-{
- return detail::PackageImplIf::deltaRpms();
-}
-
-std::list<detail::PackageImplIf::PatchRpm> SuseTagsPackageImpl::patchRpms() const
-{
- return detail::PackageImplIf::patchRpms();
-}
-
-bool SuseTagsPackageImpl::installOnly() const
-{
- return false;
-}
-
-/////////////////////////////////////////////////////////////////
-} // namespace susetags
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace
-///////////////////////////////////////////////////////////////////
-
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/SuseTagsPackageImpl.h
- *
-*/
-#ifndef ZYPP_SOURCE_SUSETAGSPACKAGEIMPL_H
-#define ZYPP_SOURCE_SUSETAGSPACKAGEIMPL_H
-
-#include "zypp/detail/PackageImplIf.h"
-#include "zypp/Source.h"
-#include "zypp/DiskUsage.h"
-#include "zypp/CheckSum.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
- namespace susetags
- { /////////////////////////////////////////////////////////////////
-
- DEFINE_PTR_TYPE(SuseTagsImpl);
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : PackageImpl
- //
- /**
- */
- struct SuseTagsPackageImpl : public zypp::detail::PackageImplIf
- {
- SuseTagsPackageImpl(Source_Ref source_r);
- virtual ~SuseTagsPackageImpl();
-
- /** \name ResObject attributes. */
- //@{
- virtual TranslatedText summary() const;
- virtual TranslatedText description() const;
- virtual TranslatedText insnotify() const;
- virtual TranslatedText delnotify() const;
- virtual TranslatedText licenseToConfirm() const;
- virtual Source_Ref source() const;
- virtual unsigned sourceMediaNr() const;
- //@}
-
- virtual CheckSum checksum() const;
- /** */
- virtual Date buildtime() const;
- /** */
- virtual std::string buildhost() const;
- /** */
- virtual Date installtime() const;
- /** */
- virtual std::string distribution() const;
- /** */
- virtual Vendor vendor() const;
- /** */
- virtual Label license() const;
- /** */
- virtual std::string packager() const;
- /** */
- virtual PackageGroup group() const;
- /** */
- virtual Keywords keywords() const;
- /** */
- virtual Changelog changelog() const;
- /** */
- virtual Pathname location() const;
- /** Don't ship it as class Url, because it might be
- * in fact anything but a legal Url. */
- virtual std::string url() const;
- /** */
- virtual std::string os() const;
- /** */
- virtual Text prein() const;
- /** */
- virtual Text postin() const;
- /** */
- virtual Text preun() const;
- /** */
- virtual Text postun() const;
- /** */
- virtual ByteCount size() const;
- /** */
- virtual ByteCount sourcesize() const;
- /** */
- virtual ByteCount archivesize() const;
- /** */
- virtual DiskUsage diskusage() const;
- /** */
- virtual std::list<std::string> authors() const;
- /** */
- virtual std::list<std::string> filenames() const;
- /** */
- virtual std::list<DeltaRpm> deltaRpms() const;
- /** */
- virtual std::list<PatchRpm> patchRpms() const;
- /** */
- virtual bool installOnly() const;
-
- // which entry in sourceImpl::_package_data has
- // the shared data for this package
- NVRA _data_index;
- NVRA _nvra;
-
- PackageGroup _group;
- Keywords _keywords;
- std::list<std::string> _authors;
- ByteCount _size;
- ByteCount _archivesize;
- Vendor _vendor;
- Label _license;
- Date _buildtime;
- unsigned _media_number;
- Pathname _location;
- DiskUsage _diskusage;
- CheckSum _checksum;
-
- SuseTagsImpl_Ptr _sourceImpl;
-
-private:
- Source_Ref _source;
- };
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
- } // namespace susetags
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_DETAIL_PACKAGEIMPL_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/SuseTagsPatternImpl.cc
- *
-*/
-#include "zypp/source/susetags/SuseTagsPatternImpl.h"
-
-using namespace std;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace susetags
-{
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : PatternImpl::PatternImpl
-// METHOD TYPE : Ctor
-//
-SuseTagsPatternImpl::SuseTagsPatternImpl()
-{}
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : PatternImpl::~PatternImpl
-// METHOD TYPE : Dtor
-//
-SuseTagsPatternImpl::~SuseTagsPatternImpl()
-{}
-
-Source_Ref SuseTagsPatternImpl::source() const
-{
- return _source;
-}
-
-TranslatedText SuseTagsPatternImpl::summary() const
-{
- return _summary;
-}
-
-TranslatedText SuseTagsPatternImpl::description() const
-{
- return _description;
-}
-
-TranslatedText SuseTagsPatternImpl::category() const
-{
- return _category;
-}
-
-bool SuseTagsPatternImpl::userVisible() const
-{
- return _visible;
-}
-
-Label SuseTagsPatternImpl::order() const
-{
- return _order;
-}
-
-Pathname SuseTagsPatternImpl::icon() const
-{
- return _icon;
-}
-
-const CapSet & SuseTagsPatternImpl::includes() const
-{
- return _includes;
-}
-
-const CapSet & SuseTagsPatternImpl::extends() const
-{
- return _extends;
-}
-
-
-/////////////////////////////////////////////////////////////////
-} // namespace detail
-///////////////////////////////////////////////////////////////////
-}
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/SuseTagsPatternImpl.h
- *
-*/
-#ifndef ZYPP_DETAIL_SUSETAGS_PATTERNIMPL_H
-#define ZYPP_DETAIL_SUSETAGS_PATTERNIMPL_H
-
-#include "zypp/detail/PatternImplIf.h"
-#include "zypp/Source.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
- namespace susetags
- {
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : PatternImpl
- //
- /**
- */
- struct SuseTagsPatternImpl : public zypp::detail::PatternImplIf
- {
-public:
- SuseTagsPatternImpl();
- virtual ~SuseTagsPatternImpl();
-
- virtual TranslatedText summary() const;
- virtual TranslatedText description() const;
- virtual TranslatedText category() const;
- virtual bool userVisible() const;
- virtual Label order() const;
- virtual Pathname icon() const;
- virtual Source_Ref source() const;
- virtual const CapSet & includes() const;
- virtual const CapSet & extends() const;
-
- TranslatedText _summary;
- TranslatedText _description;
- TranslatedText _category;
- bool _visible;
- std::string _order;
- Pathname _icon;
-
- CapSet _includes;
- CapSet _extends;
-
- Source_Ref _source;
- };
- ///////////////////////////////////////////////////////////////////
-
- /////////////////////////////////////////////////////////////////
- } // namespace susetags
- ///////////////////////////////////////////////////////////////////
- } // namespace source
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_DETAIL_PATTERNIMPL_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/SuseTagsProductImpl.cc
- *
-*/
-#include "zypp/source/susetags/SuseTagsProductImpl.h"
-
-using namespace std;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace susetags
- { /////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : SuseTagsProductImpl::SuseTagsProductImpl
- // METHOD TYPE : Ctor
- //
- SuseTagsProductImpl::SuseTagsProductImpl()
- {}
-
- ///////////////////////////////////////////////////////////////////
- //
- // METHOD NAME : SuseTagsProductImpl::~SuseTagsProductImpl
- // METHOD TYPE : Dtor
- //
- SuseTagsProductImpl::~SuseTagsProductImpl()
- {}
-
-
- std::string SuseTagsProductImpl::category() const
- {
- return _category;
- }
-
- Label SuseTagsProductImpl::vendor() const
- {
- return _vendor;
- }
-
- TranslatedText SuseTagsProductImpl::summary() const
- {
- return _summary;
- }
-
- Source_Ref SuseTagsProductImpl::source() const
- {
- return _source;
- }
-
- Url SuseTagsProductImpl::releaseNotesUrl() const
- {
- return _release_notes_url;
- }
-
- std::list<Url> SuseTagsProductImpl::updateUrls() const
- {
- return _update_urls;
- }
-
- std::list<Url> SuseTagsProductImpl::extraUrls() const
- {
- return _extra_urls;
- }
-
- std::list<Url> SuseTagsProductImpl::optionalUrls() const
- {
- return _optional_urls;
- }
-
- std::list<std::string> SuseTagsProductImpl::flags() const
- {
- return _flags;
- }
-
- TranslatedText SuseTagsProductImpl::shortName() const
- {
- return TranslatedText(_shortlabel);
- }
-
- std::string SuseTagsProductImpl::distributionName() const
- {
- return _dist_name;
- }
-
- Edition SuseTagsProductImpl::distributionEdition() const
- {
- return _dist_version;
- }
-
- /////////////////////////////////////////////////////////////////
- } // namespace susetags
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/SuseTagsProductImpl.h
- *
-*/
-#ifndef ZYPP_DETAIL_SUSETAGS_PRODUCTIMPL_H
-#define ZYPP_DETAIL_SUSETAGS_PRODUCTIMPL_H
-
-#include <map>
-
-#include "zypp/CheckSum.h"
-#include "zypp/CapSet.h"
-#include "zypp/detail/ProductImplIf.h"
-#include "zypp/Source.h"
-#include "zypp/TranslatedText.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace susetags
- { /////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : ProductImpl
- //
- /**
- */
- struct SuseTagsProductImpl : public zypp::detail::ProductImplIf
- {
- public:
- SuseTagsProductImpl();
- virtual ~SuseTagsProductImpl();
-
- virtual std::string category() const;
- virtual Label vendor() const;
- virtual TranslatedText summary() const;
- virtual Source_Ref source() const;
- virtual Url releaseNotesUrl() const;
-
- virtual std::list<Url> updateUrls() const;
- virtual std::list<Url> extraUrls() const;
- virtual std::list<Url> optionalUrls() const;
-
- virtual std::list<std::string> flags() const;
- virtual TranslatedText shortName() const;
- virtual std::string distributionName() const;
- virtual Edition distributionEdition() const;
-
- std::string _category;
-
- std::string _name;
- std::string _version;
- std::string _dist_name;
- Edition _dist_version;
-
- std::string _base_product;
- std::string _base_version;
- std::string _you_type;
- std::string _shortlabel;
- std::string _vendor;
- Url _release_notes_url;
-
- std::list<Url> _update_urls;
- std::list<Url> _extra_urls;
- std::list<Url> _optional_urls;
-
- std::map< std::string, std::list<std::string> > _arch; // map of 'arch : "arch1 arch2 arch3"', arch1 being 'best', arch3 being 'noarch' (ususally)
- std::string _default_base;
- Dependencies _deps;
- std::list<std::string> _languages;
- TranslatedText _summary;
- std::string _description_dir;
- std::string _data_dir;
- std::list<std::string> _flags;
- std::string _language;
- std::string _timezone;
-
- std::map<std::string, CheckSum> _descr_files_checksums;
- std::map<std::string, CheckSum> _signing_keys;
-
- Source_Ref _source;
-
- };
- ///////////////////////////////////////////////////////////////////
-
- /////////////////////////////////////////////////////////////////
- } // namespace susetags
- ///////////////////////////////////////////////////////////////////
- } // namespace source
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_DETAIL_PRODUCTIMPL_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/SuseTagsSelectionImpl.cc
- *
-*/
-#include "zypp/source/susetags/SuseTagsSelectionImpl.h"
-
-using namespace std;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace susetags
-{
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : SelectionImpl::SelectionImpl
-// METHOD TYPE : Ctor
-//
-SuseTagsSelectionImpl::SuseTagsSelectionImpl()
-{}
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : SelectionImpl::~SelectionImpl
-// METHOD TYPE : Dtor
-//
-SuseTagsSelectionImpl::~SuseTagsSelectionImpl()
-{}
-
-
-TranslatedText SuseTagsSelectionImpl::summary() const
-{
- return _summary;
-}
-
-TranslatedText SuseTagsSelectionImpl::description() const
-{
- return _description;
-}
-
-Label SuseTagsSelectionImpl::category() const
-{
- return _category;
-}
-
-bool SuseTagsSelectionImpl::visible() const
-{
- return _visible;
-}
-
-Label SuseTagsSelectionImpl::order() const
-{
- return _order;
-}
-
-const std::set<std::string> SuseTagsSelectionImpl::suggests() const
- {
- return _suggests;
- }
-
-const std::set<std::string> SuseTagsSelectionImpl::recommends() const
- {
- return _recommends;
- }
-
-const std::set<std::string> SuseTagsSelectionImpl::install_packages( const Locale & lang) const
- {
- //_inspacks[lang];
- //if(_inspacks.contains(lang))
- return ( _inspacks.find(lang)->second);
- //else
- //return std::set<std::string>();
- }
-
-Source_Ref SuseTagsSelectionImpl::source() const
-{
- return _source;
-}
-/////////////////////////////////////////////////////////////////
-} // namespace detail
-///////////////////////////////////////////////////////////////////
-}
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/SuseTagsSelectionImpl.h
- *
-*/
-#ifndef ZYPP_DETAIL_SUSETAGS_SELECTIONIMPL_H
-#define ZYPP_DETAIL_SUSETAGS_SELECTIONIMPL_H
-
-#include "zypp/detail/SelectionImplIf.h"
-#include "zypp/Source.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
- namespace susetags
- {
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : SelectionImpl
- //
- /**
- */
- struct SuseTagsSelectionImpl : public zypp::detail::SelectionImplIf
- {
-public:
- SuseTagsSelectionImpl();
- virtual ~SuseTagsSelectionImpl();
-
- virtual TranslatedText summary() const;
- virtual TranslatedText description() const;
- virtual Label category() const;
- virtual bool visible() const;
- virtual Label order() const;
-
- virtual const std::set<std::string> suggests() const PURE_VIRTUAL;
- virtual const std::set<std::string> recommends() const PURE_VIRTUAL;
- virtual const std::set<std::string> install_packages( const Locale & lang = Locale("") ) const;
- virtual Source_Ref source() const;
-
- TranslatedText _summary;
- TranslatedText _description;
- std::string _parser_version;
- std::string _name;
- std::string _version;
- std::string _release;
- std::string _arch;
- std::string _order;
- std::string _category;
- bool _visible;
-
- std::set<std::string> _suggests;
- std::set<std::string> _recommends;
- std::set<std::string> _requires;
- std::set<std::string> _conflicts;
- std::set<std::string> _provides;
- std::set<std::string> _obsoletes;
- std::map< Locale, std::set<std::string> > _inspacks;
- std::map< Locale, std::set<std::string> > _delpacks;
-
- Source_Ref _source;
- };
- ///////////////////////////////////////////////////////////////////
-
- /////////////////////////////////////////////////////////////////
- } // namespace susetags
- ///////////////////////////////////////////////////////////////////
- } // namespace source
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_DETAIL_SELECTIONIMPL_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/SuseTagsSrcPackageImpl.cc
- *
-*/
-#include "zypp/source/susetags/SuseTagsSrcPackageImpl.h"
-
-using namespace std;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace susetags
-{ /////////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : SrcPackageImpl::SrcPackageImpl
-// METHOD TYPE : Ctor
-//
-SuseTagsSrcPackageImpl::SuseTagsSrcPackageImpl(Source_Ref source_r)
- : _source( source_r )
- , _media_number( 1 )
-{}
-
-///////////////////////////////////////////////////////////////////
-//
-// METHOD NAME : SrcPackageImpl::~SrcPackageImpl
-// METHOD TYPE : Dtor
-//
-SuseTagsSrcPackageImpl::~SuseTagsSrcPackageImpl()
-{}
-
-
-Pathname SuseTagsSrcPackageImpl::location() const
-{
- return _location;
-}
-
-ByteCount SuseTagsSrcPackageImpl::archivesize() const
-{
- return _archivesize;
-}
-
-DiskUsage SuseTagsSrcPackageImpl::diskusage() const
-{
- return _diskusage;
-}
-
-Source_Ref SuseTagsSrcPackageImpl::source() const
-{
- return _source;
-}
-
-unsigned SuseTagsSrcPackageImpl::sourceMediaNr() const
-{
- return _media_number;
-}
-
-/////////////////////////////////////////////////////////////////
-} // namespace susetags
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace
-///////////////////////////////////////////////////////////////////
-
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/susetags/SuseTagsSrcPackageImpl.h
- *
-*/
-#ifndef ZYPP_SOURCE_SUSETAGSSRCPackageIMPL_H
-#define ZYPP_SOURCE_SUSETAGSSRCPackageIMPL_H
-
-#include "zypp/detail/SrcPackageImplIf.h"
-#include "zypp/Source.h"
-#include "zypp/DiskUsage.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
- namespace susetags
- { /////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : SrcPackageImpl
- //
- /**
- */
- struct SuseTagsSrcPackageImpl : public zypp::detail::SrcPackageImplIf
- {
- SuseTagsSrcPackageImpl(Source_Ref source_r);
- virtual ~SuseTagsSrcPackageImpl();
-
- /** */
- virtual Pathname location() const;
- /** */
- virtual ByteCount archivesize() const;
- /** */
- virtual DiskUsage diskusage() const;
- /** */
- virtual unsigned sourceMediaNr() const;
-
-private:
- Source_Ref _source;
- ByteCount _archivesize;
- unsigned _media_number;
- Pathname _location;
- DiskUsage _diskusage;
-public:
- Source_Ref source() const;
- };
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
- } // namespace susetags
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_SUSETAGS_SRCPACKAGEIMPL_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/yum/YUMAtomImpl.cc
- *
-*/
-
-#include "zypp/source/yum/YUMAtomImpl.h"
-
-using namespace std;
-using namespace zypp::detail;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace yum
-{
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : YUMAtomImpl
-//
-///////////////////////////////////////////////////////////////////
-
-/** Default ctor
-*/
-YUMAtomImpl::YUMAtomImpl(
- Source_Ref source_r
-)
- : _source(source_r)
-{}
-
-Source_Ref YUMAtomImpl::source() const
-{
- return _source;
-}
-
-
-} // namespace yum
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/yum/YUMAtomImpl.h
- *
-*/
-#ifndef ZYPP_SOURCE_YUM_YUMATOMIMPL_H
-#define ZYPP_SOURCE_YUM_YUMATOMIMPL_H
-
-#include "zypp/source/SourceImpl.h"
-#include "zypp/detail/AtomImpl.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace yum
-{ //////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : YUMAtomImpl
-//
-/** Class representing a message
-*/
-class YUMAtomImpl : public detail::AtomImplIf
-{
-public:
- /** Default ctor */
- YUMAtomImpl(
- Source_Ref source_r
- );
-
-private:
- Source_Ref _source;
-public:
- Source_Ref source() const;
-};
-///////////////////////////////////////////////////////////////////
-} // namespace yum
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_YUM_YUMATOMIMPL_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/yum/YUMGroupImpl.cc
- *
-*/
-
-#include "zypp/source/yum/YUMGroupImpl.h"
-#include "zypp/CapFactory.h"
-
-using namespace std;
-using namespace zypp::detail;
-using namespace zypp::parser::yum;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace yum
-{
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : YUMGroupImpl
-//
-///////////////////////////////////////////////////////////////////
-
-/** Default ctor
-*/
-YUMGroupImpl::YUMGroupImpl(
- Source_Ref source_r,
- const zypp::parser::yum::YUMGroupData & parsed
-)
- : _summary(parsed.name)
- , _description(parsed.description)
- , _user_visible(parsed.userVisible == "true")
- , _source(source_r)
-{
-// to name std::string groupId;
-// as _summary std::list<multilang> name;
-// _description
-}
-
-YUMGroupImpl::~YUMGroupImpl()
-{}
-
-/** Is to be visible for user? */
-bool YUMGroupImpl::visible() const
-{
- return _user_visible;
-}
-
-TranslatedText YUMGroupImpl::summary() const
-{
- return _summary;
-}
-
-TranslatedText YUMGroupImpl::description() const
-{
- return _description;
-}
-
-Label YUMGroupImpl::order() const
-{
-#warning Ordering support in YUM?
- return Label("0");
-}
-
-Label YUMGroupImpl::category() const
-{
-#warning Category support in YUM missing!
- return Label("base");
-}
-
-Source_Ref YUMGroupImpl::source() const
-{
- return _source;
-}
-
-
-} // namespace yum
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/yum/YUMGroupImpl.h
- *
-*/
-#ifndef ZYPP_SOURCE_YUM_YUMGROUPIMPL_H
-#define ZYPP_SOURCE_YUM_YUMGROUPIMPL_H
-
-#include "zypp/source/SourceImpl.h"
-#include "zypp/detail/SelectionImplIf.h"
-#include "zypp/parser/yum/YUMParserData.h"
-#include "zypp/Edition.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace yum
-{ //////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : YUMGroupImpl
-//
-/** Class representing a message
-*/
-class YUMGroupImpl : public detail::SelectionImplIf
-{
-public:
- /** Default ctor */
- YUMGroupImpl(
- Source_Ref source_r,
- const zypp::parser::yum::YUMGroupData & parsed
- );
-
- virtual ~YUMGroupImpl();
-
- /** */
- virtual TranslatedText summary() const;
- /** */
- virtual TranslatedText description() const;
- /** */
- virtual Label category() const;
- /** */
- virtual bool visible() const;
- /** */
- virtual Label order() const;
-
-protected:
- TranslatedText _summary;
- TranslatedText _description;
- bool _user_visible;
-private:
- Source_Ref _source;
-public:
- Source_Ref source() const;
-};
-///////////////////////////////////////////////////////////////////
-} // namespace yum
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_YUM_YUMGROUPIMPL_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/yum/YUMMessageImpl.cc
- *
-*/
-
-#include "zypp/source/yum/YUMMessageImpl.h"
-
-using namespace std;
-using namespace zypp::detail;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace yum
-{
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : YUMMessageImpl
-//
-///////////////////////////////////////////////////////////////////
-
-/** Default ctor
-*/
-YUMMessageImpl::YUMMessageImpl(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPatchMessage & parsed,
- Patch::constPtr patch
-)
- : _source(source_r)
- , _patch(patch)
-{
- _text = parsed.text;
-}
-/** Get the text of the message */
-TranslatedText YUMMessageImpl::text() const
-{
- return _text;
-}
-
-Source_Ref YUMMessageImpl::source() const
-{
- return _source;
-}
-
-/** Patch the message belongs to - if any */
-Patch::constPtr YUMMessageImpl::patch() const
-{
- return _patch;
-}
-
-} // namespace yum
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/yum/YUMMessageImpl.h
- *
-*/
-#ifndef ZYPP_SOURCE_YUM_YUMMESSAGEIMPL_H
-#define ZYPP_SOURCE_YUM_YUMMESSAGEIMPL_H
-
-#include "zypp/source/SourceImpl.h"
-#include "zypp/detail/MessageImpl.h"
-#include "zypp/parser/yum/YUMParserData.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace yum
-{ //////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : YUMMessageImpl
-//
-/** Class representing a message
-*/
-class YUMMessageImpl : public detail::MessageImplIf
-{
-public:
- /** Default ctor */
- YUMMessageImpl(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPatchMessage & parsed,
- Patch::constPtr patch
- );
- /** Get the text of the message */
- virtual TranslatedText text() const;
- /** Patch the message belongs to - if any */
- Patch::constPtr patch() const;
-
-
-protected:
- /** The text of the message */
- TranslatedText _text;
-private:
- Source_Ref _source;
- Patch::constPtr _patch;
-public:
- Source_Ref source() const;
- friend class YUMSourceImpl;
-};
-///////////////////////////////////////////////////////////////////
-} // namespace yum
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_YUM_YUMMESSAGEIMPL_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/yum/YUMPackageImpl.cc
- *
-*/
-
-#include "zypp/source/yum/YUMPackageImpl.h"
-#include "zypp/base/String.h"
-#include "zypp/base/Logger.h"
-
-using namespace std;
-using namespace zypp::detail;
-using namespace zypp::parser::yum;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace yum
-{
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : YUMPackageImpl
-//
-///////////////////////////////////////////////////////////////////
-
-/** Default ctor
-*/
-YUMPackageImpl::YUMPackageImpl(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPrimaryData & parsed,
- const zypp::parser::yum::YUMFileListData & filelist,
- const zypp::parser::yum::YUMOtherData & other
-)
- : _summary(parsed.summary),
- _description(parsed.description),
- _license_to_confirm(parsed.license_to_confirm), // TODO add to metadata
- _buildtime(str::strtonum<time_t>(parsed.timeBuild)),
- _buildhost(parsed.buildhost),
- _url(parsed.url),
- _vendor( parsed.vendor),
- _license( parsed.license),
- _packager(parsed.packager),
- _group(parsed.group),
- _changelog(), // TODO
- _type(parsed.type),
- _authors(parsed.authors),
- _keywords( parsed.keywords.begin(), parsed.keywords.end() ),
- _mediaNumber(str::strtonum<unsigned int>(parsed.media)),
- _checksum(parsed.checksumType,
- parsed.checksum),
- _filenames(),
- _location(parsed.location),
- _delta_rpms(),
- _patch_rpms(),
- _install_only(parsed.installOnly),
- _package_size(str::strtonum<unsigned int>(parsed.sizePackage)),
- _size(str::strtonum<unsigned int>(parsed.sizeInstalled)),
- _source(source_r)
-{
- for (std::list<FileData>::const_iterator it = filelist.files.begin();
- it != filelist.files.end();
- it++)
- {
- _filenames.push_back(it->name);
- }
- for (std::list<zypp::parser::yum::ChangelogEntry>::const_iterator
- it = other.changelog.begin();
- it != other.changelog.end();
- it++)
- {
- _changelog.push_back(ChangelogEntry(strtol(it->date.c_str(), 0, 10),
- it->author,
- it->entry));
- }
-}
-
-/** Package summary */
-TranslatedText YUMPackageImpl::summary() const
-{
- return _summary;
-}
-
-/** Package description */
-TranslatedText YUMPackageImpl::description() const
-{
- return _description;
-}
-
-/** */
-TranslatedText YUMPackageImpl::licenseToConfirm() const
-{
- return _license_to_confirm;
-}
-
-/** */
-ByteCount YUMPackageImpl::size() const
-{
- return _size;
-}
-
-/** */
-Date YUMPackageImpl::buildtime() const
-{
- return _buildtime;
-}
-
-/** */
-std::string YUMPackageImpl::buildhost() const
-{
- return _buildhost;
-}
-
-/** */
-Date YUMPackageImpl::installtime() const
-{
- return PackageImplIf::installtime();
-}
-
-/** */
-std::string YUMPackageImpl::distribution() const
-#warning fixme
-{
- return string();
-}
-
-/** */
-Vendor YUMPackageImpl::vendor() const
-{
- return _vendor;
-}
-
-/** */
-Label YUMPackageImpl::license() const
-{
- return _license;
-}
-
-/** */
-std::string YUMPackageImpl::packager() const
-{
- return _packager;
-}
-
-/** */
-PackageGroup YUMPackageImpl::group() const
-{
- return _group;
-}
-
-/** */
-Changelog YUMPackageImpl::changelog() const
-{
- return _changelog;
-}
-
-/** */
-Pathname YUMPackageImpl::location() const
-{
- return _location;
-}
-
-/** Don't ship it as class Url, because it might be
- * in fact anything but a legal Url. */
-std::string YUMPackageImpl::url() const
-{
- return _url;
-}
-
-/** */
-std::string YUMPackageImpl::os() const
-// metadata doesn't priovide this attribute
-{
- return PackageImplIf::os();
-}
-
-/** */
-Text YUMPackageImpl::prein() const
-// metadata doesn't priovide this attribute
-{
- return PackageImplIf::prein();
-}
-
-/** */
-Text YUMPackageImpl::postin() const
-// metadata doesn't priovide this attribute
-{
- return PackageImplIf::postin();
-}
-
-/** */
-Text YUMPackageImpl::preun() const
-// metadata doesn't priovide this attribute
-{
- return PackageImplIf::preun();
-}
-
-/** */
-Text YUMPackageImpl::postun() const
-// metadata doesn't priovide this attribute
-{
- return PackageImplIf::postun();
-}
-
-/** */
-ByteCount YUMPackageImpl::sourcesize() const
-#warning fixme
-{
- return 0;
-}
-
-/** */
-ByteCount YUMPackageImpl::archivesize() const
-{
- return _package_size;
-}
-
-/** */
-std::list<std::string> YUMPackageImpl::authors() const
-{
- return _authors;
-}
-
-/** */
-std::list<std::string> YUMPackageImpl::filenames() const
-{
- return _filenames;
-}
-
-/** */
-std::string YUMPackageImpl::type() const
-{
- return _type;
-}
-
-/** */
-YUMPackageImpl::Keywords YUMPackageImpl::keywords() const
-{
- return _keywords;
-}
-
-bool YUMPackageImpl::installOnly() const
-{
- return _install_only;
-}
-
-unsigned YUMPackageImpl::sourceMediaNr() const
-{
- return _mediaNumber;
-}
-
-CheckSum YUMPackageImpl::checksum() const
-{
- return _checksum;
-}
-
-std::list<detail::PackageImplIf::DeltaRpm> YUMPackageImpl::deltaRpms() const
-{
- return _delta_rpms;
-}
-
-std::list<detail::PackageImplIf::PatchRpm> YUMPackageImpl::patchRpms() const
-{
- return _patch_rpms;
-}
-
-Source_Ref YUMPackageImpl::source() const
-{
- return _source;
-}
-
-} // namespace yum
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/yum/YUMPackageImpl.h
- *
-*/
-#ifndef ZYPP_SOURCE_YUM_YUMPACKAGEIMPL_H
-#define ZYPP_SOURCE_YUM_YUMPACKAGEIMPL_H
-
-#include "zypp/source/SourceImpl.h"
-#include "zypp/detail/PackageImpl.h"
-#include "zypp/parser/yum/YUMParserData.h"
-#include "zypp/Changelog.h"
-#include "zypp/CheckSum.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace yum
-{ //////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : YUMPackageImpl
-//
-/** Class representing a package
-*/
-class YUMPackageImpl : public detail::PackageImplIf
-{
-public:
- /** Default ctor
- */
- YUMPackageImpl(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPrimaryData & parsed,
- const zypp::parser::yum::YUMFileListData & filelist,
- const zypp::parser::yum::YUMOtherData & other
- );
-
- /** Package summary */
- virtual TranslatedText summary() const;
- /** Package description */
- virtual TranslatedText description() const;
- /** */
- virtual TranslatedText licenseToConfirm() const;
- /** */
- virtual ByteCount size() const;
- /** */
- virtual Date buildtime() const;
- /** */
- virtual std::string buildhost() const;
- /** */
- virtual Date installtime() const;
- /** */
- virtual std::string distribution() const;
- /** */
- virtual Vendor vendor() const;
- /** */
- virtual Label license() const;
- /** */
- virtual std::string packager() const;
- /** */
- virtual PackageGroup group() const;
- /** */
- virtual Changelog changelog() const;
- /** */
- virtual Pathname location() const;
- /** Don't ship it as class Url, because it might be
- * in fact anything but a legal Url. */
- virtual std::string url() const;
- /** */
- virtual std::string os() const;
- /** */
- virtual Text prein() const;
- /** */
- virtual Text postin() const;
- /** */
- virtual Text preun() const;
- /** */
- virtual Text postun() const;
- /** */
- virtual ByteCount sourcesize() const;
- /** */
- virtual ByteCount archivesize() const;
- /** */
- virtual std::list<std::string> authors() const;
- /** */
- virtual std::list<std::string> filenames() const;
- /** */
- virtual std::string type() const;
- /** */
- virtual Keywords keywords() const;
- /** */
- virtual bool installOnly() const;
- /** */
- virtual unsigned sourceMediaNr() const;
- /** */
- virtual CheckSum checksum() const;
- /** */
- virtual std::list<DeltaRpm> deltaRpms() const;
- /** */
- virtual std::list<PatchRpm> patchRpms() const;
-
-protected:
- TranslatedText _summary;
- TranslatedText _description;
- TranslatedText _license_to_confirm;
- Date _buildtime;
- std::string _buildhost;
- std::string _url;
- Vendor _vendor;
- Label _license;
- std::string _packager;
- PackageGroup _group;
- Changelog _changelog;
- std::string _type;
- std::list<std::string> _authors;
- Keywords _keywords;
- unsigned _mediaNumber;
- CheckSum _checksum;
- std::list<std::string> _filenames;
- Pathname _location;
- std::list<DeltaRpm> _delta_rpms;
- std::list<PatchRpm> _patch_rpms;
-
- bool _install_only;
-
- unsigned int _package_size;
- unsigned int _size;
-
- /*
- unsigned _size_package;
- std::string _sourcepkg;
- std::list<DirSize> _dir_sizes;
- */
- /*
- std::list<ChangelogEntry> changelog;
- */
-private:
- Source_Ref _source;
-public:
- Source_Ref source() const;
-
- friend class YUMSourceImpl;
-
-};
-///////////////////////////////////////////////////////////////////
-} // namespace yum
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_YUM_YUMPACKAGEIMPL_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/yum/YUMPatchImpl.cc
- *
-*/
-
-#include "zypp/source/yum/YUMPatchImpl.h"
-#include "zypp/source/yum/YUMSourceImpl.h"
-#include <zypp/CapFactory.h>
-#include "zypp/parser/yum/YUMParserData.h"
-#include <zypp/parser/yum/YUMParser.h>
-#include "zypp/Package.h"
-#include "zypp/Script.h"
-#include "zypp/Message.h"
-#include "zypp/base/Logger.h"
-
-
-using namespace std;
-using namespace zypp::detail;
-using namespace zypp::parser::yum;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace yum
-{
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : YUMPatchImpl
-//
-///////////////////////////////////////////////////////////////////
-
-/** Default ctor
- * \bug CANT BE CONSTUCTED THAT WAY ANYMORE
-*/
-YUMPatchImpl::YUMPatchImpl(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPatchData & parsed,
- YUMSourceImpl & srcimpl_r
-)
- : _source(source_r)
-{
- _patch_id = parsed.patchId;
- _timestamp = str::strtonum<time_t>(parsed.timestamp);
- _category = parsed.category;
- _reboot_needed = parsed.rebootNeeded;
- _affects_pkg_manager = parsed.packageManager;
- std::string updateScript;
- _summary = parsed.summary;
- _description = parsed.description;
- _license_to_confirm = parsed.license_to_confirm;
-#if 0 // not active any more, see YUMSourceImpl::createPatch()
- // now process the atoms
- CapFactory _f;
- Capability cap( _f.parse(
- ResType::TraitsType::kind,
- parsed.name,
- Rel::EQ,
- Edition(parsed.ver, parsed.rel, parsed.epoch)
- ));
- for (std::list<shared_ptr<YUMPatchAtom> >::const_iterator it
- = parsed.atoms.begin();
- it != parsed.atoms.end();
- it++)
- {
- switch ((*it)->atomType())
- {
- case YUMPatchAtom::Package:
- {
- shared_ptr<YUMPatchPackage> package_data
- = dynamic_pointer_cast<YUMPatchPackage>(*it);
- Atom::Ptr atom = srcimpl_r.augmentPackage( _source, *package_data );
- _atoms.push_back(atom);
- break;
- }
- case YUMPatchAtom::Message:
- {
- shared_ptr<YUMPatchMessage> message_data
- = dynamic_pointer_cast<YUMPatchMessage>(*it);
- Message::Ptr message = srcimpl_r.createMessage(_source, *message_data);
- _atoms.push_back(message);
- break;
- }
- case YUMPatchAtom::Script:
- {
- shared_ptr<YUMPatchScript> script_data
- = dynamic_pointer_cast<YUMPatchScript>(*it);
- Script::Ptr script = srcimpl_r.createScript(_source, *script_data);
- _atoms.push_back(script);
- break;
- }
- default:
- ERR << "Unknown type of atom" << endl;
- }
- for (AtomList::iterator it = _atoms.begin();
- it != _atoms.end();
- it++)
- {
- (*it)->injectRequires(cap);
- }
-
- }
-#endif
-}
-
-std::string YUMPatchImpl::id() const
-{
- return _patch_id;
-}
-Date YUMPatchImpl::timestamp() const
-{
- return _timestamp;
-}
-
-TranslatedText YUMPatchImpl::summary() const
-{
- return _summary;
-}
-
-TranslatedText YUMPatchImpl::description() const
-{
- return _description;
-}
-
-TranslatedText YUMPatchImpl::licenseToConfirm() const
-{
- return _license_to_confirm;
-}
-
-std::string YUMPatchImpl::category() const
-{
- return _category;
-}
-
-bool YUMPatchImpl::reboot_needed() const
-{
- return _reboot_needed;
-}
-
-bool YUMPatchImpl::affects_pkg_manager() const
-{
- return _affects_pkg_manager;
-}
-
-YUMPatchImpl::AtomList YUMPatchImpl::all_atoms() const
-{
- return _atoms;
-}
-
-Source_Ref YUMPatchImpl::source() const
-{
- return _source;
-}
-
-} // namespace yum
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/yum/YUMPatchImpl.h
- *
-*/
-#ifndef ZYPP_SOURCE_YUM_YUMPATCHIMPL_H
-#define ZYPP_SOURCE_YUM_YUMPATCHIMPL_H
-
-#include "zypp/source/SourceImpl.h"
-#include "zypp/detail/PatchImpl.h"
-#include "zypp/parser/yum/YUMParserData.h"
-#include "zypp/source/yum/YUMSourceImpl.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace yum
-{ //////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : YUMPatchImpl
-//
-/** Class representing a patch
-*/
-class YUMPatchImpl : public detail::PatchImplIf
-{
-public:
- /** Default ctor */
- YUMPatchImpl(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPatchData & parsed,
- YUMSourceImpl & srcimpl_r
- );
- /** Patch ID */
- virtual std::string id() const;
- /** Patch time stamp */
- virtual Date timestamp() const;
- /** Patch category (recommended, security,...) */
- virtual std::string category() const;
- /** Does the system need to reboot to finish the update process? */
- virtual bool reboot_needed() const;
- /** Does the patch affect the package manager itself? */
- virtual bool affects_pkg_manager() const;
- /** The list of all atoms building the patch */
- virtual AtomList all_atoms() const;
-
- /** Patch summary */
- virtual TranslatedText summary() const;
- /** Patch description */
- virtual TranslatedText description() const;
-
- virtual TranslatedText licenseToConfirm() const;
-
-protected:
- std::string _patch_id;
- Date _timestamp;
- TranslatedText _summary;
- TranslatedText _description;
- std::string _category;
- bool _reboot_needed;
- bool _affects_pkg_manager;
- AtomList _atoms;
- TranslatedText _license_to_confirm;
-private:
- Source_Ref _source;
-public:
- Source_Ref source() const;
- friend class YUMSourceImpl;
-};
-///////////////////////////////////////////////////////////////////
-} // namespace yum
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_YUM_YUMPATCHIMPL_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/yum/YUMPatternImpl.cc
- *
-*/
-
-#include "zypp/source/yum/YUMPatternImpl.h"
-#include "zypp/CapFactory.h"
-
-using namespace std;
-using namespace zypp::detail;
-using namespace zypp::parser::yum;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace yum
-{
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : YUMPatternImpl
-//
-///////////////////////////////////////////////////////////////////
-
-/** Default ctor
-*/
-YUMPatternImpl::YUMPatternImpl(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPatternData & parsed
-)
- : _user_visible(parsed.userVisible == "true")
- , _summary(parsed.summary)
- , _description(parsed.description)
- , _default(parsed.default_ == "true")
- , _category(parsed.category)
- , _icon(parsed.icon)
- , _script(parsed.script)
- , _source(source_r)
-{ }
-
-/** Is to be visible for user? */
-bool YUMPatternImpl::userVisible() const
-{
- return _user_visible;
-}
-
-TranslatedText YUMPatternImpl::summary() const
-{
- return _summary;
-}
-
-TranslatedText YUMPatternImpl::description() const
-{
- return _description;
-}
-
-Source_Ref YUMPatternImpl::source() const
-{
- return _source;
-}
-
-/** */
-bool YUMPatternImpl::isDefault() const
-{
- return _default;
-}
-/** */
-TranslatedText YUMPatternImpl::category() const
-{
- return _category;
-}
-/** */
-Pathname YUMPatternImpl::icon() const
-{
- return _icon;
-}
-/** */
-Pathname YUMPatternImpl::script() const
-{
- return _script;
-}
-
-
-} // namespace yum
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/yum/YUMPatternImpl.h
- *
-*/
-#ifndef ZYPP_SOURCE_YUM_YUMPATTERNIMPL_H
-#define ZYPP_SOURCE_YUM_YUMPATTERNIMPL_H
-
-#include "zypp/source/SourceImpl.h"
-#include "zypp/detail/PatternImplIf.h"
-#include "zypp/parser/yum/YUMParserData.h"
-#include "zypp/Edition.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace yum
-{ //////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : YUMPatternImpl
-//
-/** Class representing a message
-*/
-class YUMPatternImpl : public detail::PatternImplIf
-{
-public:
- /** Default ctor */
- YUMPatternImpl(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPatternData & parsed
- );
- /** Is to be visible for user? */
- virtual bool userVisible() const;
- /** */
- virtual TranslatedText summary() const;
- /** */
- virtual TranslatedText description() const;
- /** */
- virtual bool isDefault() const;
- /** */
- virtual TranslatedText category() const;
- /** */
- virtual Pathname icon() const;
- /** */
- virtual Pathname script() const;
-
-
-protected:
- bool _user_visible;
- TranslatedText _summary;
- TranslatedText _description;
- bool _default;
- TranslatedText _category;
- Pathname _icon;
- Pathname _script;
-private:
- Source_Ref _source;
-public:
- Source_Ref source() const;
-};
-///////////////////////////////////////////////////////////////////
-} // namespace yum
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_YUM_YUMPATTERNIMPL_H
+++ /dev/null
-/*---------------------------------------------------------------------\
- | ____ _ __ __ ___ |
- | |__ / \ / / . \ . \ |
- | / / \ V /| _/ _/ |
- | / /__ | | | | | | |
- | /_____||_| |_| |_| |
- | |
- \---------------------------------------------------------------------*/
-/** \file zypp/source/yum/YUMProductImpl.cc
- *
-*/
-
-#include "zypp/source/yum/YUMProductImpl.h"
-#include "zypp/source/yum/YUMSourceImpl.h"
-#include <zypp/CapFactory.h>
-#include "zypp/parser/yum/YUMParserData.h"
-#include <zypp/parser/yum/YUMParser.h>
-#include "zypp/Package.h"
-#include "zypp/Script.h"
-#include "zypp/Message.h"
-#include "zypp/base/Logger.h"
-
-
-using namespace std;
-using namespace zypp::detail;
-using namespace zypp::parser::yum;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace source
- { /////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- namespace yum
- { /////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////////////////////
- //
- // CLASS NAME : YUMProductImpl
- //
- ///////////////////////////////////////////////////////////////////
-
- /** Default ctor
- * \bug CANT BE CONSTUCTED THAT WAY ANYMORE
- */
- YUMProductImpl::YUMProductImpl(
- Source_Ref source_r,
- const zypp::parser::yum::YUMProductData & parsed
- )
- : _category(parsed.type),
- _vendor(parsed.vendor),
- _short_name(parsed.short_name),
- _distribution_name(parsed.distribution_name),
- _distribution_edition(Edition(parsed.distribution_edition)),
- _source(source_r)
- {
- }
-
- std::string YUMProductImpl::category() const
- {
- return _category;
- }
-
- Label YUMProductImpl::vendor() const
- {
- return _vendor;
- }
-
- TranslatedText YUMProductImpl::summary() const
- {
- return _summary;
- }
-
- TranslatedText YUMProductImpl::description() const
- {
- return _description;
- }
-
- Source_Ref YUMProductImpl::source() const
- {
- return _source;
- }
-
- std::list<std::string> YUMProductImpl::flags() const
- {
- return ProductImplIf::flags();
- }
-
- TranslatedText YUMProductImpl::shortName() const
- {
- return _short_name;
- }
-
- std::string YUMProductImpl::distributionName() const
- {
- return _distribution_name;
- }
-
- Edition YUMProductImpl::distributionEdition() const
- {
- return _distribution_edition;
- }
-
- /////////////////////////////////////////////////////////////////
- } // namespace yum
- /////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
- } // namespace source
- ///////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/yum/YUMProductImpl.h
- *
-*/
-#ifndef ZYPP_SOURCE_YUM_YUMPRODUCTIMPL_H
-#define ZYPP_SOURCE_YUM_YUMPRODUCTIMPL_H
-
-#include "zypp/source/SourceImpl.h"
-#include "zypp/detail/ProductImpl.h"
-#include "zypp/parser/yum/YUMParserData.h"
-#include "zypp/source/yum/YUMSourceImpl.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace yum
-{ //////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : YUMProductImpl
-//
-/** Class representing a patch
-*/
-class YUMProductImpl : public detail::ProductImplIf
-{
-public:
- /** Default ctor */
- YUMProductImpl(
- Source_Ref source_r,
- const zypp::parser::yum::YUMProductData & parsed
- );
- virtual std::string category() const;
- virtual Label vendor() const;
- virtual TranslatedText summary() const;
- virtual TranslatedText description() const;
- virtual std::list<std::string> flags() const;
- virtual TranslatedText shortName() const;
- virtual std::string distributionName() const;
- virtual Edition distributionEdition() const;
-protected:
- std::string _category;
- Label _vendor;
- TranslatedText _summary;
- TranslatedText _description;
- TranslatedText _short_name;
- std::string _distribution_name;
- Edition _distribution_edition;
-private:
- Source_Ref _source;
-public:
- Source_Ref source() const;
-
-};
-///////////////////////////////////////////////////////////////////
-} // namespace yum
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_YUM_YUMPRODUCTIMPL_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/yum/YUMScriptImpl.cc
-*/
-
-#include "zypp/source/yum/YUMScriptImpl.h"
-#include "zypp/Arch.h"
-#include "zypp/Edition.h"
-#include "zypp/base/Gettext.h"
-#include "zypp/ZYppFactory.h"
-
-#include "zypp/source/yum/YUMSourceImpl.h"
-
-#include <fstream>
-
-
-using namespace std;
-using namespace zypp::detail;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace yum
-{
-
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : YUMScriptImpl
-//
-///////////////////////////////////////////////////////////////////
-
-/** Default ctor
-*/
-YUMScriptImpl::YUMScriptImpl(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPatchScript & parsed
-)
- : _do_script(parsed.do_script)
- , _undo_script(parsed.undo_script)
- , _do_location(parsed.do_location)
- , _undo_location(parsed.undo_location)
- , _do_media(1)
- , _undo_media(1)
- , _do_checksum(parsed.do_checksum_type, parsed.do_checksum)
- , _undo_checksum(parsed.undo_checksum_type, parsed.undo_checksum)
- , _source(source_r)
-{
- unsigned do_media = strtol(parsed.do_media.c_str(), 0, 10);
- if (do_media > 0)
- _do_media = do_media;
- unsigned undo_media = strtol(parsed.undo_media.c_str(), 0, 10);
- if (undo_media > 0)
- _undo_media = undo_media;
-}
-
-Pathname YUMScriptImpl::do_script() const
-{
- if (_do_script != "")
- {
- if ( !_tmp_do_script )
- _tmp_do_script.reset(new filesystem::TmpFile(getZYpp()->tmpPath(), "zypp-yum-do-script-"));
-
- Pathname pth = _tmp_do_script->path();
- // FIXME check success
- ofstream st(pth.asString().c_str());
-
- if ( !st )
- {
- ZYPP_THROW(Exception(N_("Cannot create a file needed to perform update installation.")));
- }
-
- st << _do_script << endl;
- return pth;
- }
- else if (_do_location != "" && _do_location != "/")
- {
- Pathname script = source().provideFile(_do_location, _do_media);
- if (! filesystem::is_checksum(script, _do_checksum))
- {
- ZYPP_THROW(Exception(N_("The script file failed the checksum test.")));
- }
- return script;
- }
- else
- {
- return Pathname();
- }
-}
-/** Get the script to undo the change */
-Pathname YUMScriptImpl::undo_script() const
-{
- if (_undo_script != "")
- {
- if ( !_tmp_undo_script )
- _tmp_undo_script.reset(new filesystem::TmpFile(getZYpp()->tmpPath(), "zypp-yum-undo-script-"));
-
- Pathname pth = _tmp_undo_script->path();
- // FIXME check success
- ofstream st(pth.asString().c_str());
-
- if ( !st )
- {
- ZYPP_THROW(Exception(N_("Cannot create a file needed to perform update installation.")));
- }
-
- st << _undo_script << endl;
- return pth;
- }
- else if (_undo_location != "" && _undo_location != "/")
- {
- Pathname script = source().provideFile(_undo_location, _undo_media);
- if (! filesystem::is_checksum(script, _undo_checksum) )
- {
- ZYPP_THROW(Exception(N_("The script file failed the checksum test.")));
- }
- return script;
- }
- else return Pathname();
-}
-/** Check whether script to undo the change is available */
-bool YUMScriptImpl::undo_available() const
-{
- return _undo_script != ""
- || (_undo_location != "" && _undo_location != "/");
-}
-
-Source_Ref YUMScriptImpl::source() const
-{
- return _source;
-}
-
-
-
-} // namespace yum
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/yum/YUMScriptImpl.h
- *
-*/
-#ifndef ZYPP_SOURCE_YUM_YUMSCRIPTIMPL_H
-#define ZYPP_SOURCE_YUM_YUMSCRIPTIMPL_H
-
-#include "zypp/source/SourceImpl.h"
-#include "zypp/detail/ScriptImpl.h"
-#include "zypp/parser/yum/YUMParserData.h"
-#include "zypp/TmpPath.h"
-#include "zypp/CheckSum.h"
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace yum
-{ //////////////////////////////////////////////////////////////
-
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : YUMScriptImpl
-//
-/** Class representing an update script */
-class YUMScriptImpl : public detail::ScriptImplIf
-{
-public:
- /** Default ctor */
- YUMScriptImpl(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPatchScript & parsed
- );
- /** Get the script to perform the change */
- virtual Pathname do_script() const;
- /** Get the script to undo the change */
- virtual Pathname undo_script() const;
- /** Check whether script to undo the change is available */
- virtual bool undo_available() const;
-
-protected:
- /** The script to perform the change */
- std::string _do_script;
- /** The script to undo the change */
- std::string _undo_script;
- /** Location of external do script on the medium */
- Pathname _do_location;
- /** Location of external undo script on the medium */
- Pathname _undo_location;
- /** Media number of the do script */
- unsigned _do_media;
- /** Media number of the undo script */
- unsigned _undo_media;
-
- mutable shared_ptr<filesystem::TmpFile> _tmp_do_script;
- mutable shared_ptr<filesystem::TmpFile> _tmp_undo_script;
-
- CheckSum _do_checksum;
- CheckSum _undo_checksum;
-private:
- Source_Ref _source;
-public:
- Source_Ref source() const;
-};
-///////////////////////////////////////////////////////////////////
-} // namespace yum
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_YUM_YUMSCRIPTIMPL_H
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/yum/YUMSourceImpl.cc
-*
-*/
-
-#include "zypp/source/yum/YUMSourceImpl.h"
-#include "zypp/source/yum/YUMAtomImpl.h"
-#include "zypp/source/yum/YUMPackageImpl.h"
-#include "zypp/source/yum/YUMScriptImpl.h"
-#include "zypp/source/yum/YUMMessageImpl.h"
-#include "zypp/source/yum/YUMPatchImpl.h"
-#include "zypp/source/yum/YUMProductImpl.h"
-#include "zypp/source/yum/YUMGroupImpl.h"
-#include "zypp/source/yum/YUMPatternImpl.h"
-
-#include "zypp/NVRA.h"
-#include "zypp/PathInfo.h"
-#include "zypp/base/Logger.h"
-#include "zypp/base/Exception.h"
-#include "zypp/CapFactory.h"
-#include "zypp/Digest.h"
-#include "zypp/ExternalProgram.h"
-#include "zypp/TmpPath.h"
-#include "zypp/ZYppFactory.h"
-#include "zypp/KeyRing.h"
-
-#include "zypp/parser/yum/YUMParser.h"
-#include "zypp/SourceFactory.h"
-#include "zypp/ZYppCallbacks.h"
-#include "zypp/SilentCallbacks.h"
-
-#include "zypp/base/GzStream.h"
-#include "zypp/base/Gettext.h"
-#include "zypp/PathInfo.h"
-
-#include <fstream>
-
-using namespace std;
-using namespace zypp::detail;
-using namespace zypp::parser::yum;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace yum
-{
-
-bool YUMProber::operator()()
-{
- MIL << "Probing for YUM source..." << std::endl;
- bool result = false;
- media::MediaManager mm;
- result = mm.doesFileExist(_media_id, _path + Pathname("/repodata/repomd.xml"));
- if ( result )
- {
- MIL << "YUM source detected..." << std::endl;
- return true;
- }
-
- MIL << "Not a YUM source..." << std::endl;
- return false;
-}
-
-struct YUMSourceEventHandler
-{
- YUMSourceEventHandler( callback::SendReport<SourceReport> &report ) : _report(report)
- {}
-
- void operator()( int p )
- {
- _report->progress(p);
- }
-
- callback::SendReport<SourceReport> &_report;
-};
-
-static long int get_stream_size( const Pathname &p )
-{
- ifgzstream input( p.asString().c_str() );
-
- if ( input.bad() )
- ZYPP_THROW(Exception("Can't read " + p.asString() + " to calculate compressed stream size"));
-
- // get the size of the stream
- DBG << "Getting size of the stream." << std::endl;
- input.seekg (0, ios::end);
- long int stream_size = input.tellg();
- DBG << "XML stream size: " << stream_size << std::endl;
- return stream_size;
-}
-
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : YUMSourceImpl
-//
-///////////////////////////////////////////////////////////////////
-
-YUMSourceImpl::YUMSourceImpl()
-{}
-
-Date YUMSourceImpl::timestamp() const
-{
- return PathInfo(repomdFile()).mtime();
-}
-
-bool YUMSourceImpl::cacheExists()
-{
- bool exists = PathInfo(repomdFile()).isExist();
- if (exists)
- MIL << "YUM cache found at " << _cache_dir << std::endl;
- else
- MIL << "YUM cache not found" << std::endl;
-
- return exists;
-}
-
-const Pathname YUMSourceImpl::metadataRoot() const
-{
- return _cache_dir.empty() ? tmpMetadataDir() : _cache_dir;
-}
-
-const Pathname YUMSourceImpl::repomdFile() const
-{
- return metadataRoot() + "/repodata/repomd.xml";
-}
-
-const Pathname YUMSourceImpl::repomdFileSignature() const
-{
- return metadataRoot() + "/repodata/repomd.xml.asc";
-}
-
-const Pathname YUMSourceImpl::repomdFileKey() const
-{
- return metadataRoot() + "/repodata/repomd.xml.key";
-}
-
-const TmpDir YUMSourceImpl::downloadMetadata()
-{
- TmpDir tmpdir;
- int copy_result;
- MIL << "Downloading metadata to " << tmpdir.path() << std::endl;
-
- Pathname local_dir = tmpdir.path();
- if (0 != assert_dir(local_dir + "/repodata" , 0755))
- ZYPP_THROW(Exception("Cannot create /repodata in download directory"));
-
- MIL << "Storing data to tmp dir " << local_dir << endl;
-
- // first read list of all files in the repository
- Pathname remote_repomd;
- try
- {
- remote_repomd = provideFile(_path + "/repodata/repomd.xml");
- }
- catch (Exception &e)
- {
- ZYPP_CAUGHT(e);
- ZYPP_THROW(SourceIOException("Can't provide " + _path.asString() + "/repodata/repomd.xml from " + url().asString() ));
- }
-
- // provide optional files
- Pathname remote_repomd_key;
- Pathname remote_repomd_signature;
- try
- {
- remote_repomd_key = tryToProvideFile( _path + "/repodata/repomd.xml.key");
- }
- catch ( const Exception &e )
- {
- WAR << "Repository does not contain repomd signing key" << std::endl;
- }
-
- try
- {
- remote_repomd_signature = tryToProvideFile( _path + "/repodata/repomd.xml.asc");
- }
- catch ( const Exception &e )
- {
- WAR << "Repository does not contain repomd signature" << std::endl;
- }
-
- copy_result = filesystem::copy( remote_repomd, local_dir + "/repodata/repomd.xml");
- if ( copy_result != 0 )
- ZYPP_THROW(SourceIOException("Can't copy " + remote_repomd.asString() + " to " + local_dir.asString() + "/repodata/repomd.xml"));
-
- if (PathInfo(remote_repomd_key).isExist())
- {
- copy_result = filesystem::copy( remote_repomd_key, local_dir + "/repodata/repomd.xml.key");
- if ( copy_result != 0 )
- ZYPP_THROW(SourceIOException("Can't copy " + remote_repomd_key.asString() + " to " + local_dir.asString() + "/repodata/repomd.xml.key"));
-
- getZYpp()->keyRing()->importKey(local_dir + "/repodata/repomd.xml.key" , false);
- }
-
- if (PathInfo(remote_repomd_signature).isExist())
- {
- copy_result = filesystem::copy( remote_repomd_signature, local_dir + "/repodata/repomd.xml.asc");
- if ( copy_result != 0 )
- ZYPP_THROW(SourceIOException("Can't copy " + remote_repomd_signature.asString() + " to " + local_dir.asString() + "/repodata/repomd.xml.asc"));
- }
-
- DBG << "Reading file " << remote_repomd << endl;
- ifstream repo_st(remote_repomd.asString().c_str());
-
- callback::SendReport<SourceReport> report;
- report->start( selfSourceRef(), _("Reading index files") );
- YUMRepomdParser repomd(repo_st, "");
-
-
- for (; ! repomd.atEnd(); ++repomd)
- {
- if ((*repomd)->type == "other") // don't parse 'other.xml' (#159316)
- continue;
-
- getPossiblyCachedMetadataFile( _path + (*repomd)->location, local_dir + (*repomd)->location, _cache_dir + (*repomd)->location, CheckSum((*repomd)->checksumType, (*repomd)->checksum) );
-
- // if it is a patch, we read the patches individually
- if ((*repomd)->type == "patches")
- {
- // use the local copy now
- Pathname patches_list = local_dir + (*repomd)->location;
- MIL << "Reading patches file " << patches_list << std::endl;
- ifgzstream st ( patches_list.asString().c_str() );
- YUMPatchesParser patch(st, "");
- for (; !patch.atEnd(); ++patch)
- {
- getPossiblyCachedMetadataFile( _path + (*patch)->location, local_dir + (*patch)->location, _cache_dir + (*patch)->location, CheckSum((*patch)->checksumType, (*patch)->checksum) );
- } // end of single patch parsing
- }// end of patches file parsing
- } // end of copying
- report->finish( selfSourceRef(), _("Reading index files"), source::SourceReport::NO_ERROR, "" );
-
-
- // check signature
- MIL << "Checking [" << (local_dir + "/repodata/repomd.xml") << "] signature" << endl;
- if (! getZYpp()->keyRing()->verifyFileSignatureWorkflow(local_dir + "/repodata/repomd.xml", (_path + "/repodata/repomd.xml").asString()+ " (" + url().asString() + ")", local_dir + "/repodata/repomd.xml.asc"))
- ZYPP_THROW(SourceMetadataException(N_("The signed repomd.xml file failed the signature check.")));
-
- // ok, now we have a consistent repo in the tmpdir.
- return tmpdir;
-}
-
-void YUMSourceImpl::factoryInit()
-{
- resetMediaVerifier();
-
- bool cache = cacheExists();
- if ( cache )
- {
- DBG << "Cached metadata found in [" << _cache_dir << "]." << endl;
- if ( autorefresh() )
- storeMetadata(_cache_dir);
- else
- readRepomd();
- }
- else
- {
- if ( _cache_dir.empty() || !PathInfo(_cache_dir).isExist() )
- {
- DBG << "Cache dir not set. Downloading to temp dir: " << tmpMetadataDir() << std::endl;
- // as we have no local dir set we use a tmp one, but we use a member variable because
- // it cant go out of scope while the source exists.
- saveMetadataTo(tmpMetadataDir());
- }
- else
- {
- DBG << "Cached metadata not found in [" << _cache_dir << "]. Will download." << std::endl;
- saveMetadataTo(_cache_dir);
- }
- readRepomd();
- }
-
- MIL << "YUM source initialized." << std::endl;
- MIL << " Url : " << url() << std::endl;
- MIL << " Alias : " << alias() << std::endl;
- MIL << " Path : " << path() << std::endl;
- MIL << " Metadata : " << metadataRoot() << (_cache_dir.empty() ? " [TMP]" : " [CACHE]") << std::endl;
-}
-
-bool YUMSourceImpl::downloadNeeded(const Pathname & localdir)
-{
- // we can only assume repomd intact means the source changed if the source is signed.
- if ( cacheExists() && PathInfo( repomdFileSignature() ).isExist() )
- {
- Pathname remote_repomd;
- try
- {
- remote_repomd = provideFile(_path + "/repodata/repomd.xml");
- }
- catch (Exception &e)
- {
- ZYPP_THROW(Exception("Can't provide " + _path.asString() + "/repodata/repomd.xml from " + url().asString() ));
- }
-
- CheckSum old_repomd_checksum( "SHA1", filesystem::sha1sum(localdir + "/repodata/repomd.xml"));
- CheckSum new_repomd_checksum( "SHA1", filesystem::sha1sum(remote_repomd));
- if ( (new_repomd_checksum == old_repomd_checksum) && (!new_repomd_checksum.empty()) && (! old_repomd_checksum.empty()))
- {
- return false;
- }
- }
- return true;
-}
-
-void YUMSourceImpl::storeMetadata(const Pathname & cache_dir_r)
-{
- if ( !_cache_dir.empty() )
- {
- saveMetadataTo(cache_dir_r);
- }
- else
- {
- // no previous cache, use the data read temporarely
- copyLocalMetadata(tmpMetadataDir(), cache_dir_r);
- }
-
- MIL << "Metadata saved in " << cache_dir_r << ". Setting as cache." << std::endl;
- _cache_dir = cache_dir_r;
-
- readRepomd();
-}
-
-void YUMSourceImpl::saveMetadataTo(const Pathname & dir_r)
-{
- TmpDir download_tmp_dir;
-
- bool need_to_refresh = true;
- try
- {
- need_to_refresh = downloadNeeded(dir_r);
- }
- catch (Exception &e)
- {
- ZYPP_THROW(Exception("Can't check if source has changed or not. Aborting refresh."));
- }
-
- if ( need_to_refresh )
- {
- MIL << "YUM source '" << alias() << "' has changed since last download. Re-reading metadata into " << dir_r << endl;
- }
- else
- {
- MIL << "YUM source '" << alias() << "' has not changed. Refresh completed. SHA1 of repomd.xml file is the same." << std::endl;
- return;
- }
-
- try
- {
- download_tmp_dir = downloadMetadata();
- }
- catch (Exception &e)
- {
- ZYPP_THROW(Exception("Downloading metadata failed (is YUM source?) or user did not accept remote source. Aborting refresh."));
- }
-
- copyLocalMetadata(download_tmp_dir, dir_r);
-
- // download_tmp_dir go out of scope now but it is ok as we already copied the content.
-}
-
-
-void YUMSourceImpl::readRepomd()
-{
- _repo_primary.clear();
- _repo_files.clear();
- _repo_group.clear();
- _repo_pattern.clear();
- _repo_product.clear();
- _repo_patches.clear();
-
- parser::ParserProgress::Ptr progress;
- callback::SendReport<SourceReport> report;
- YUMSourceEventHandler npp(report);
- progress.reset( new parser::ParserProgress( npp ) );
-
- report->start( selfSourceRef(), "Parsing index file" );
- try
- {
- DBG << "Reading ifgz file " << repomdFile() << endl;
- ifgzstream repo_st(repomdFile().asString().c_str());
- YUMRepomdParser repomd(repo_st, "", progress);
- for (; ! repomd.atEnd(); ++repomd)
- {
- // note that we skip adding other.xml to the list of files to provide
- if ((*repomd)->type == "primary")
- _repo_primary.push_back(*repomd);
- else if ((*repomd)->type == "filelists")
- _repo_files.push_back(*repomd);
- else if ((*repomd)->type == "group")
- _repo_group.push_back(*repomd);
- else if ((*repomd)->type == "pattern")
- _repo_pattern.push_back(*repomd);
- else if ((*repomd)->type == "product")
- _repo_product.push_back(*repomd);
- else if ((*repomd)->type == "patches")
- _repo_patches.push_back(*repomd);
- else if ((*repomd)->type != "other") // type "other" is ok, anything else not
- ERR << "Unknown type of repo file: " << (*repomd)->type << endl;
- }
- report->finish( selfSourceRef(), "Parsing index file", source::SourceReport::NO_ERROR, "" );
- }
- catch ( const Exception & excpt_r )
- {
- ZYPP_CAUGHT( excpt_r ); // log the caught exception
- report->finish( selfSourceRef(), "Parsing index file", source::SourceReport::INVALID, "" );
- ZYPP_THROW( SourceMetadataException("Error parsing repomd.xml file") );
-
- }
-}
-
-std::set<zypp::Resolvable::Kind>
-YUMSourceImpl::resolvableKinds() const
-{
- std::set<zypp::Resolvable::Kind> kinds;
-
- if (_repo_product.size() > 0 )
- kinds.insert( ResTraits<zypp::Product>::kind );
-
- if (_repo_pattern.size() > 0 )
- kinds.insert( ResTraits<zypp::Pattern>::kind );
-
- if (_repo_group.size() > 0 )
- kinds.insert( ResTraits<zypp::Selection>::kind );
-
- if (_repo_primary.size() > 0 )
- kinds.insert( ResTraits<zypp::Package>::kind );
-
- if (_repo_patches.size() > 0 )
- kinds.insert( ResTraits<zypp::Patch>::kind );
-
- return kinds;
-}
-
-void YUMSourceImpl::provideProducts(Source_Ref source_r, ResStore& store)
-{
- Pathname filename;
- callback::SendReport<SourceReport> report;
-
- try
- {
- for (std::list<YUMRepomdData_Ptr>::const_iterator it = _repo_product.begin();
- it != _repo_product.end();
- it++)
- {
- filename = metadataRoot() + (*it)->location;
- ifgzstream st ( filename.asString().c_str() );
-
- parser::ParserProgress::Ptr progress;
- callback::SendReport<SourceReport> report;
- YUMSourceEventHandler npp(report);
- progress.reset( new parser::ParserProgress( npp ) );
-
- // TranslatorExplanation %s = product file
- report->start( selfSourceRef(), str::form(_("Reading product from %s"), filename.asString().c_str()) );
-
- YUMProductParser product(st, "", progress);
- for (; !product.atEnd(); ++product)
- {
- Product::Ptr p = createProduct( source_r, **product );
- store.insert (p);
- }
-
- if (product.errorStatus())
- {
- // TranslatorExplanation %s = product file
- report->finish( selfSourceRef(), str::form(_("Reading product from %s"), filename.asString().c_str()), source::SourceReport::INVALID, product.errorStatus()->msg() );
- ZYPP_THROW(SourceMetadataException( "Error reading product from " + filename.asString()+ " : " + product.errorStatus()->msg()));
- }
- else
- {
- // TranslatorExplanation %s = product file
- report->finish( selfSourceRef(), str::form(_("Reading product from %s"), filename.asString().c_str()), source::SourceReport::NO_ERROR, "" );
- }
- }
- }
- catch ( const Exception &e )
- {
- ZYPP_CAUGHT(e);
- // TranslatorExplanation %s = product file
- report->finish( selfSourceRef(), str::form(_("Reading product from %s"), filename.asString().c_str()), source::SourceReport::INVALID, e.msg() );
- ZYPP_THROW(SourceMetadataException(e.msg()));
- }
-
-}
-
-void YUMSourceImpl::providePackages(Source_Ref source_r, ResStore& store)
-{
- Pathname filename;
- callback::SendReport<SourceReport> report;
-
- // now put other and filelist data to structures for easier find
- map<NVRA, YUMFileListData_Ptr> files_data;
- map<NVRA, YUMOtherData_Ptr> other_data;
-
- try
- {
- for (std::list<YUMRepomdData_Ptr>::const_iterator it
- = _repo_files.begin();
- it != _repo_files.end();
- it++)
- {
- Pathname filename = metadataRoot() + (*it)->location;
- DBG << "Reading ifgz file " << filename << endl;
- ifgzstream st( filename.asString().c_str() );
-
- parser::ParserProgress::Ptr progress;
- YUMSourceEventHandler npp(report);
- progress.reset( new parser::ParserProgress( npp, get_stream_size(filename) ) );
- // TranslatorExplanation %s = package file list
- report->start( selfSourceRef(), str::form(_("Reading filelist from %s"), filename.asString().c_str()) );
-
- YUMFileListParser filelist ( st, "", progress );
- for (; ! filelist.atEnd(); ++filelist)
- {
- if (*filelist == NULL) continue; // skip incompatible archs
- NVRA nvra( (*filelist)->name,
- Edition( (*filelist)->ver, (*filelist)->rel, str::strtonum<int>( (*filelist)->epoch ) ),
- Arch ( (*filelist)->arch ) );
- files_data[nvra] = *filelist;
- }
-
- if (filelist.errorStatus())
- {
- // TranslatorExplanation %s = package file list
- report->finish( selfSourceRef(), str::form(_("Reading filelist from %s"), filename.asString().c_str()), source::SourceReport::INVALID, filelist.errorStatus()->msg() );
- ZYPP_THROW(SourceMetadataException( "Error reading filelists from " + filename.asString()+ " : " + filelist.errorStatus()->msg()));
- }
- else
- {
- // TranslatorExplanation %s = package file list
- report->finish( selfSourceRef(), str::form(_("Reading filelist from %s"), filename.asString().c_str()), source::SourceReport::NO_ERROR, "" );
- }
- }
- }
- catch ( const Exception &e )
- {
- ZYPP_CAUGHT(e);
- // TranslatorExplanation %s = package file list
- report->finish( selfSourceRef(),str::form(_("Reading filelist from %s"), filename.asString().c_str()), source::SourceReport::INVALID, e.msg() );
- ZYPP_THROW(SourceMetadataException(e.msg()));
- }
-
- try
- {
- // now read primary data, merge them with filelist and changelog
- for (std::list<YUMRepomdData_Ptr>::const_iterator it = _repo_primary.begin(); it != _repo_primary.end(); it++)
- {
- filename = metadataRoot() + (*it)->location;
- DBG << "Reading file " << filename << endl;
-
- parser::ParserProgress::Ptr progress;
- YUMSourceEventHandler npp(report);
- progress.reset( new parser::ParserProgress( npp ) );
- // TranslatorExplanation %s = packages file
- report->start( selfSourceRef(), str::form(_("Reading packages from %s"), filename.asString().c_str()) );
-
- ifgzstream st ( filename.asString().c_str() );
-
- YUMPrimaryParser prim(st, "", progress);
- //YUMPrimaryParser prim(filename.asString(), "", progress);
- for (; !prim.atEnd(); ++prim)
- {
- if (*prim == NULL) continue; // incompatible arch detected during parsing
-
- Arch arch;
- if (!(*prim)->arch.empty())
- arch = Arch((*prim)->arch);
-
- NVRA nvra( (*prim)->name,
- Edition( (*prim)->ver, (*prim)->rel, str::strtonum<int>( (*prim)->epoch ) ),
- arch );
- map<NVRA, YUMOtherData_Ptr>::iterator found_other = other_data.find( nvra );
- map<NVRA, YUMFileListData_Ptr>::iterator found_files = files_data.find( nvra );
-
- YUMFileListData filelist_empty;
- YUMOtherData other_empty;
- ResImplTraits<YUMPackageImpl>::Ptr impl;
- Package::Ptr p = createPackage( source_r, **prim, found_files != files_data.end()
- ? *(found_files->second)
- : filelist_empty,
- found_other != other_data.end()
- ? *(found_other->second)
- : other_empty,
- impl
- );
- ImplAndPackage iap = { impl, p };
- _package_impl[nvra] = iap;
-// MIL << "inserting package "<< p->name() << std::endl;
- store.insert (p);
- }
-
- if (prim.errorStatus())
- {
- // TranslatorExplanation %s = packages file
- report->finish( selfSourceRef(), str::form(_("Reading packages from %s"), filename.asString().c_str()), source::SourceReport::INVALID, prim.errorStatus()->msg() );
- ZYPP_THROW(SourceMetadataException( "Error packages from " + filename.asString()+ " : " + prim.errorStatus()->msg()));
- }
- else
- {
- // TranslatorExplanation %s = packages file
- report->finish( selfSourceRef(), str::form(_("Reading packages from %s"), filename.asString().c_str()), source::SourceReport::NO_ERROR, "" );
- }
- }
- }
- catch ( const Exception &e )
- {
- ZYPP_CAUGHT(e);
- // TranslatorExplanation %s = packages file
- report->finish( selfSourceRef(), str::form(_("Reading packages from %s"), filename.asString().c_str()), source::SourceReport::INVALID, e.msg() );
- ZYPP_THROW(SourceMetadataException(e.msg()));
- }
-
-}
-
-void YUMSourceImpl::provideSelections(Source_Ref source_r, ResStore& store)
-{
- callback::SendReport<SourceReport> report;
- Pathname filename;
- try
- {
- for (std::list<YUMRepomdData_Ptr>::const_iterator it = _repo_group.begin();
- it != _repo_group.end();
- it++)
- {
- Pathname filename = metadataRoot() + (*it)->location;
- DBG << "Reading file " << filename << endl;
- ifgzstream st ( filename.asString().c_str() );
-
- parser::ParserProgress::Ptr progress;
- YUMSourceEventHandler npp(report);
- progress.reset( new parser::ParserProgress( npp ) );
- // TranslatorExplanation %s = selection metadata file
- report->start( selfSourceRef(), str::form(_("Reading selection from %s"), filename.asString().c_str()) );
-
- YUMGroupParser group(st, "", progress);
- for (; !group.atEnd(); ++group)
- {
- Selection::Ptr p = createGroup( source_r, **group );
- store.insert (p);
- }
-
- if (group.errorStatus())
- {
- // TranslatorExplanation %s = selection metadata file
- report->finish( selfSourceRef(), str::form(_("Reading selection from %s"), filename.asString().c_str()), source::SourceReport::INVALID, group.errorStatus()->msg() );
- ZYPP_THROW(SourceMetadataException( "Error Parsing selection " + filename.asString()+ " : " + group.errorStatus()->msg()));
- }
- else
- {
- // TranslatorExplanation %s = selection metadata file
- report->finish( selfSourceRef(), str::form(_("Reading selection from %s"), filename.asString().c_str()), source::SourceReport::NO_ERROR, "" );
- }
- }
- }
- catch ( const Exception &e )
- {
- ZYPP_CAUGHT(e);
- // TranslatorExplanation %s = selection metadata file
- report->finish( selfSourceRef(), str::form(_("Reading selection from %s"), filename.asString().c_str()), source::SourceReport::INVALID, e.msg() );
- ZYPP_THROW(SourceMetadataException(e.msg()));
- }
-
-}
-
-void YUMSourceImpl::providePatterns(Source_Ref source_r, ResStore& store)
-{
- callback::SendReport<SourceReport> report;
- Pathname filename;
- try
- {
- for (std::list<YUMRepomdData_Ptr>::const_iterator it = _repo_pattern.begin();
- it != _repo_pattern.end(); it++)
- {
- Pathname filename = metadataRoot() + (*it)->location;
-
- DBG << "Reading file " << filename << endl;
- ifgzstream st ( filename.asString().c_str() );
-
- parser::ParserProgress::Ptr progress;
- YUMSourceEventHandler npp(report);
- progress.reset( new parser::ParserProgress( npp ) );
- // TranslatorExplanation %s = pattern metadata file
- report->start( selfSourceRef(), str::form(_("Reading pattern from %s"), filename.asString().c_str()) );
-
- YUMPatternParser pattern(st, "", progress);
- for (; !pattern.atEnd(); ++pattern)
- {
- Pattern::Ptr p = createPattern( source_r, **pattern );
- store.insert (p);
- }
-
- if (pattern.errorStatus())
- {
- // TranslatorExplanation %s = pattern metadata file
- report->finish( selfSourceRef(), str::form(_("Reading pattern from %s"), filename.asString().c_str()), source::SourceReport::INVALID, pattern.errorStatus()->msg() );
- ZYPP_THROW(SourceMetadataException( "Error parsing pattern" + filename.asString()+ " : " + pattern.errorStatus()->msg()));
- }
- else
- {
- // TranslatorExplanation %s = pattern metadata file
- report->finish( selfSourceRef(), str::form(_("Reading pattern from %s"), filename.asString().c_str()), source::SourceReport::NO_ERROR, "" );
- }
- }
- }
- catch ( const Exception &e )
- {
- ZYPP_CAUGHT(e);
- // TranslatorExplanation %s = pattern metadata file
- report->finish( selfSourceRef(), str::form(_("Reading pattern from %s"), filename.asString().c_str()), source::SourceReport::INVALID, e.msg() );
- ZYPP_THROW(SourceMetadataException(e.msg()));
- }
-
-}
-
-void YUMSourceImpl::providePatches(Source_Ref source_r, ResStore& store)
-{
- std::list<std::string> patch_files;
- callback::SendReport<SourceReport> report;
- Pathname filename;
-
- try
- {
- for (std::list<YUMRepomdData_Ptr>::const_iterator it = _repo_patches.begin();
- it != _repo_patches.end();
- it++)
- {
- filename = metadataRoot() + (*it)->location;
-
- DBG << "Reading file " << filename << endl;
- ifgzstream st ( filename.asString().c_str() );
-
- parser::ParserProgress::Ptr progress;
- YUMSourceEventHandler npp(report);
- progress.reset( new parser::ParserProgress( npp ) );
- // TranslatorExplanation %s = patches index file
- report->start( selfSourceRef(), str::form(_("Reading patches index %s"), filename.asString().c_str()) );
- YUMPatchesParser patch(st, "", progress);
-
- for (; !patch.atEnd(); ++patch)
- {
- string filename = (*patch)->location;
- patch_files.push_back(filename);
- }
-
- if (patch.errorStatus())
- {
- // TranslatorExplanation %s = patches index file
- report->finish( selfSourceRef(), str::form(_("Reading patches index %s"), filename.asString().c_str()), source::SourceReport::INVALID, patch.errorStatus()->msg() );
- ZYPP_THROW(SourceMetadataException( "Error Parsing patch " + filename.asString()+ " : " + patch.errorStatus()->msg()));
- }
- else
- {
- // TranslatorExplanation %s = patches index file
- report->finish( selfSourceRef(), str::form(_("Reading patches index %s"), filename.asString().c_str()), source::SourceReport::NO_ERROR, "" );
- }
- }
- }
- catch ( const Exception &e )
- {
- ZYPP_CAUGHT(e);
- // TranslatorExplanation %s = patches index file
- report->finish( selfSourceRef(), str::form(_("Reading patches index %s"), filename.asString().c_str()), source::SourceReport::INVALID, e.msg() );
- ZYPP_THROW(SourceMetadataException(e.msg()));
- }
-
- try
- {
- //---------------------------------
- // now the individual patch files
- for (std::list<std::string>::const_iterator it = patch_files.begin();
- it != patch_files.end();
- it++)
- {
- filename = metadataRoot() + *it;
- DBG << "Reading file " << filename << endl;
-
- //FIXME error handling
- ifgzstream st ( filename.asString().c_str() );
-
- parser::ParserProgress::Ptr progress;
- YUMSourceEventHandler npp(report);
- progress.reset( new parser::ParserProgress( npp ) );
-
- // TranslatorExplanation %s = patch metadata file
- report->start( selfSourceRef(), str::form(_("Reading patch %s"), filename.asString().c_str()) );
-
- YUMPatchParser ptch(st, "", progress);
- for (; !ptch.atEnd(); ++ptch)
- {
- Patch::Ptr p = createPatch( source_r, **ptch );
- store.insert (p);
- Patch::AtomList atoms = p->atoms();
- for (Patch::AtomList::iterator at = atoms.begin(); at != atoms.end(); at++)
- {
- _store.insert (*at);
- }
- }
-
- if (ptch.errorStatus())
- {
- // TranslatorExplanation %s = patch metadata file
- report->finish( selfSourceRef(), str::form(_("Reading patch %s"), filename.asString().c_str()), source::SourceReport::INVALID, ptch.errorStatus()->msg() );
- ZYPP_THROW(SourceMetadataException( "Error Parsing patch " + filename.asString()+ " : " + ptch.errorStatus()->msg()));
- }
- else
- {
- // TranslatorExplanation %s = patch metadata file
- report->finish( selfSourceRef(), str::form(_("Reading patch %s"), filename.asString().c_str()), source::SourceReport::NO_ERROR, "" );
- }
- }
- }
- catch ( const Exception &e )
- {
- ERR << "Cannot read patch metadata" << endl;
- ZYPP_CAUGHT(e);
- // TranslatorExplanation %s = patch metadata file
- report->finish( selfSourceRef(), str::form(_("Reading patch %s"), filename.asString().c_str()), source::SourceReport::INVALID, e.msg() );
- ZYPP_THROW(SourceMetadataException(e.msg()));
- }
-}
-
-ResStore YUMSourceImpl::provideResolvablesByKind(Source_Ref source_r, zypp::Resolvable::Kind kind)
-{
- ResStore store;
-
- //readRepomd();
-
- if ( kind == ResTraits<Product>::kind )
- provideProducts ( selfSourceRef(), store );
- else if ( kind == ResTraits<Package>::kind )
- providePackages (selfSourceRef(), store );
- else if ( kind == ResTraits<Selection>::kind )
- provideSelections ( selfSourceRef(), store );
- else if ( kind == ResTraits<Pattern>::kind )
- providePatterns ( selfSourceRef(), store );
- else if ( kind == ResTraits<Pattern>::kind )
- providePatches ( selfSourceRef(), store );
-
- return store;
-}
-
-void YUMSourceImpl::createResolvables(Source_Ref source_r)
-{
-
- //readRepomd();
- provideProducts(selfSourceRef(), _store);
- providePackages(selfSourceRef(), _store);
- provideSelections(selfSourceRef(), _store);
- providePatterns(selfSourceRef(), _store);
- providePatches(selfSourceRef(), _store);
-
-}
-
-
-Package::Ptr YUMSourceImpl::createPackage(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPrimaryData & parsed,
- const zypp::parser::yum::YUMFileListData & filelist,
- const zypp::parser::yum::YUMOtherData & other,
- ResImplTraits<YUMPackageImpl>::Ptr & impl
-)
-{
- try
- {
- impl = new YUMPackageImpl( source_r, parsed, filelist, other );
-
- Dependencies deps( createDependencies( parsed, ResTraits<Package>::kind ) );
-
- CapFactory f;
-
- for (std::list<FileData>::const_iterator it = filelist.files.begin();
- it != filelist.files.end();
- it++)
- {
- deps[Dep::PROVIDES].insert( f.parse( ResTraits<Package>::kind, it->name ) );
- }
-
- Arch arch;
- if (!parsed.arch.empty())
- arch = Arch(parsed.arch);
-
- // Collect basic Resolvable data
- NVRAD dataCollect( parsed.name,
- Edition( parsed.ver, parsed.rel, parsed.epoch ),
- arch,
- deps
- );
- Package::Ptr package = detail::makeResolvableFromImpl(
- dataCollect, impl
- );
- return package;
- }
- catch (const Exception & excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- ZYPP_THROW(Exception("Cannot create package object"));
- }
- return 0L;
-}
-
-Atom::Ptr YUMSourceImpl::augmentPackage(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPatchPackage & parsed
-)
-{
- try
- {
- Arch arch;
- if (!parsed.arch.empty())
- arch = Arch( parsed.arch );
-
- Edition edition( parsed.ver, parsed.rel, parsed.epoch );
- NVRA nvra( parsed.name,
- edition,
- arch );
-
- DBG << "augmentPackage(" << nvra << ")" << endl;
-
- // create Atom
- CapFactory f;
- Dependencies deps = createDependencies( parsed, ResTraits<Package>::kind );
-// deps[Dep::REQUIRES].insert( f.parse( ResTraits<Package>::kind, parsed.name, Rel::EQ, edition ) );
- NVRAD atomdata( nvra, deps );
- ResImplTraits<YUMAtomImpl>::Ptr atomimpl = new YUMAtomImpl( source_r );
- Atom::Ptr atom = detail::makeResolvableFromImpl( atomdata, atomimpl );
-
- //source_r
- PackageImplMapT::const_iterator it = _package_impl.find( nvra );
- if (it == _package_impl.end())
- {
- WAR << "Patch augments non-existant package " << nvra << endl;
- }
- else
- {
- ResImplTraits<YUMPackageImpl>::Ptr impl = it->second.impl;
-
- if (!parsed.location.empty())
- {
- impl->_location = parsed.location;
- impl->_mediaNumber = str::strtonum<unsigned>( parsed.media );
- impl->_checksum = CheckSum(parsed.checksumType, parsed.checksum);
- }
- impl->_install_only = parsed.installOnly;
-
- //DBG << "Inserting patch RPMs" << endl;
- impl->_patch_rpms = std::list<YUMPackageImpl::PatchRpm>();
- for ( std::list<YUMPatchRpm>::const_iterator it = parsed.patchRpms.begin();
- it != parsed.patchRpms.end(); ++it )
- {
- YUMPackageImpl::PatchRpm patch_rpm;
-
- patch_rpm.location( OnMediaLocation()
- .medianr( str::strtonum<unsigned>( it->media ) )
- .filename( it->location )
- .checksum( CheckSum( it->checksumType, it->checksum ) )
- .downloadsize( str::strtonum<ByteCount::SizeType>( it->downloadsize ) ) );
-
- for ( std::list<YUMPatchBaseVersion>::const_iterator bvit = it->baseVersions.begin();
- bvit != it->baseVersions.end(); ++bvit )
- {
- patch_rpm.baseversion( Edition( bvit->edition.ver,
- bvit->edition.rel,
- bvit->edition.epoch ) );
- }
-
- patch_rpm.buildtime( str::strtonum<Date::ValueType>( it->buildtime ) );
-
- impl->_patch_rpms.push_back( patch_rpm );
- }
-
- //DBG << "Inserting delta RPMs" << endl;
- impl->_delta_rpms = std::list<YUMPackageImpl::DeltaRpm>();
- for ( std::list<YUMDeltaRpm>::const_iterator it = parsed.deltaRpms.begin();
- it != parsed.deltaRpms.end(); ++it )
- {
- YUMPackageImpl::DeltaRpm delta_rpm;
-
- delta_rpm.location( OnMediaLocation()
- .medianr( str::strtonum<unsigned>( it->media ) )
- .filename( it->location )
- .checksum( CheckSum( it->checksumType, it->checksum ) )
- .downloadsize( str::strtonum<ByteCount::SizeType>( it->downloadsize ) ) );
-
- const YUMDeltaBaseVersion & ybv( it->baseVersion );
- delta_rpm.baseversion( YUMPackageImpl::DeltaRpm::BaseVersion()
- .edition( Edition( ybv.edition.ver,
- ybv.edition.rel,
- ybv.edition.epoch ) )
- .buildtime( str::strtonum<Date::ValueType>( ybv.buildtime ) )
- .checksum( CheckSum::md5( ybv.md5sum ) )
- .sequenceinfo( ybv.sequence_info )
- );
-
- delta_rpm.buildtime( str::strtonum<Date::ValueType>( it->buildtime ) );
-
- impl->_delta_rpms.push_back( delta_rpm );
- }
- }
- return atom;
- }
- catch (const Exception & excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- ZYPP_THROW(Exception("Cannot create augmented package object"));
- }
- return 0L;
-}
-
-Selection::Ptr YUMSourceImpl::createGroup(
- Source_Ref source_r,
- const zypp::parser::yum::YUMGroupData & parsed
-)
-{
- try
- {
- ResImplTraits<YUMGroupImpl>::Ptr impl(new YUMGroupImpl(source_r, parsed));
- // Collect basic Resolvable data
- NVRAD dataCollect( parsed.groupId,
- Edition::noedition, // group has just a name,
- Arch_noarch, // pattern has edition & arch
- createGroupDependencies(parsed));
- Selection::Ptr group = detail::makeResolvableFromImpl(
- dataCollect, impl
- );
- return group;
- }
- catch (const Exception & excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- ZYPP_THROW(Exception("Cannot create package group object"));
- }
- return 0L;
-}
-
-Pattern::Ptr YUMSourceImpl::createPattern(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPatternData & parsed
-)
-{
- try
- {
- ResImplTraits<YUMPatternImpl>::Ptr impl(new YUMPatternImpl(source_r, parsed));
- // Collect basic Resolvable data
- Arch arch;
- if (!parsed.arch.empty())
- arch = Arch(parsed.arch);
-
- NVRAD dataCollect( parsed.name,
- Edition( parsed.ver, parsed.rel, parsed.epoch ),
- arch,
- createDependencies(parsed, ResTraits<Pattern>::kind));
- Pattern::Ptr pattern = detail::makeResolvableFromImpl(
- dataCollect, impl
- );
- return pattern;
- }
- catch (const Exception & excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- ZYPP_THROW(Exception("Cannot create installation pattern object"));
- }
- return 0L;
-}
-
-Message::Ptr YUMSourceImpl::createMessage(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPatchMessage & parsed,
- Patch::constPtr patch
-)
-{
- try
- {
- ResImplTraits<YUMMessageImpl>::Ptr impl(new YUMMessageImpl(source_r, parsed, patch));
- Arch arch;
- if (!parsed.arch.empty())
- arch = Arch(parsed.arch);
- // Collect basic Resolvable data
- NVRAD dataCollect( parsed.name,
- Edition( parsed.ver, parsed.rel, parsed.epoch ),
- arch,
- createDependencies(parsed,
- ResTraits<Message>::kind)
- );
- Message::Ptr message = detail::makeResolvableFromImpl(
- dataCollect, impl
- );
- return message;
- }
- catch (const Exception & excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- ZYPP_THROW(Exception("Cannot create message object"));
- }
- return 0L;
-}
-
-Script::Ptr YUMSourceImpl::createScript(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPatchScript & parsed
-)
-{
- try
- {
- ResImplTraits<YUMScriptImpl>::Ptr impl(new YUMScriptImpl(source_r, parsed));
- Arch arch;
- if (!parsed.arch.empty())
- arch = Arch(parsed.arch);
- // Collect basic Resolvable data
- NVRAD dataCollect( parsed.name,
- Edition( parsed.ver, parsed.rel, parsed.epoch ),
- arch,
- createDependencies(parsed,
- ResTraits<Script>::kind)
- );
- Script::Ptr script = detail::makeResolvableFromImpl(
- dataCollect, impl
- );
- return script;
- }
- catch (const Exception & excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- ZYPP_THROW(Exception("Cannot create script object"));
- }
- return 0L;
-}
-
-Product::Ptr YUMSourceImpl::createProduct(
- Source_Ref source_r,
- const zypp::parser::yum::YUMProductData & parsed
-)
-{
- try
- {
- ResImplTraits<YUMProductImpl>::Ptr impl(new YUMProductImpl(source_r, parsed));
-
- // Collect basic Resolvable data
- Arch arch;
- if (!parsed.arch.empty())
- arch = Arch(parsed.arch);
-
- string name(parsed.name);
- std::replace(name.begin(), name.end(), ' ', '_');
-
- NVRAD dataCollect( name,
- Edition( parsed.ver, parsed.rel, parsed.epoch ),
- arch,
- createDependencies(parsed,
- ResTraits<Product>::kind)
- );
- Product::Ptr product = detail::makeResolvableFromImpl(
- dataCollect, impl
- );
- return product;
- }
- catch (const Exception & excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- ZYPP_THROW(Exception("Cannot create product object"));
- }
- return 0L;
-}
-
-Patch::Ptr YUMSourceImpl::createPatch(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPatchData & parsed
-)
-{
- try
- {
- ResImplTraits<YUMPatchImpl>::Ptr impl(new YUMPatchImpl(source_r, parsed, *this));
-
- Arch arch;
- if (!parsed.arch.empty())
- arch = Arch(parsed.arch);
-
- // Collect basic Resolvable data
- NVRAD dataCollect( parsed.name,
- Edition( parsed.ver, parsed.rel, parsed.epoch ),
- arch,
- createDependencies( parsed,
- ResTraits<Patch>::kind)
- );
- Patch::Ptr patch = detail::makeResolvableFromImpl(
- dataCollect, impl
- );
- // now process the atoms
- CapFactory _f;
- Capability cap( _f.parse(
- Patch::TraitsType::kind,
- parsed.name,
- Rel::EQ,
- Edition(parsed.ver, parsed.rel, parsed.epoch)
- ));
-
- // maps name to parser data in order to find 'best' architectureC
- typedef std::map<std::string, shared_ptr<YUMPatchPackage> > PkgAtomsMap;
- PkgAtomsMap pkg_atoms;
-
- for (std::list<shared_ptr<YUMPatchAtom> >::const_iterator it
- = parsed.atoms.begin();
- it != parsed.atoms.end();
- it++)
- {
- switch ((*it)->atomType())
- {
- // for packages, try to find best architecture for name-version-release first (#168840)
- // we can't use the name alone as there might be different editions for the same name
- // with different architecture.
- // So we only choose the best architecture if name-version-edition matches (#170098)
-
- case YUMPatchAtom::Package:
- {
- shared_ptr<YUMPatchPackage> package_data
- = dynamic_pointer_cast<YUMPatchPackage>(*it);
- string atomkey( package_data->name + "-" + package_data->epoch + ":" + package_data->ver + "-" + package_data->rel );
-
- // check if atomkey is already known
- PkgAtomsMap::iterator pa_pos = pkg_atoms.find( atomkey );
- if (pa_pos != pkg_atoms.end())
- {
- try
- {
- Arch oldarch, newarch;
- if (!(pa_pos->second->arch.empty())) oldarch = Arch( pa_pos->second->arch );
- if (!(package_data->arch.empty())) newarch = Arch( package_data->arch );
- if (newarch.compatibleWith( getZYpp()->architecture() ) )
- { // new one is compatible (if not, we don't care)
-
- if (!oldarch.compatibleWith( getZYpp()->architecture() ) // old one is not compatible
- || oldarch.compare( newarch ) < 0) // or compatible but worse
- {
- pa_pos->second = package_data; // new one is it !
- }
- }
- }
- catch ( const Exception & excpt_r )
- {
- ZYPP_CAUGHT( excpt_r );
- ERR << "Package " << package_data->name << " in patch's atomlist has bad architecture '" << package_data->arch << "'" << endl;
- }
- }
- else
- {
- pkg_atoms[atomkey] = package_data; // first occurence of this atomkey
- }
- break;
- }
- case YUMPatchAtom::Message:
- {
- shared_ptr<YUMPatchMessage> message_data
- = dynamic_pointer_cast<YUMPatchMessage>(*it);
- Message::Ptr message = createMessage(source_r, *message_data, patch);
- impl->_atoms.push_back(message);
- break;
- }
- case YUMPatchAtom::Script:
- {
- shared_ptr<YUMPatchScript> script_data
- = dynamic_pointer_cast<YUMPatchScript>(*it);
- Script::Ptr script = createScript(source_r, *script_data);
- impl->_atoms.push_back(script);
- break;
- }
- default:
- ERR << "Unknown type of atom" << endl;
- }
-#if 0 // atoms require their patch, why ?
- for (Patch::AtomList::iterator it = impl->_atoms.begin();
- it != impl->_atoms.end();
- it++)
- {
- (*it)->injectRequires(cap);
- }
-#endif
- }
-
- for (PkgAtomsMap::const_iterator pa_pos = pkg_atoms.begin(); pa_pos != pkg_atoms.end(); ++pa_pos)
- {
- Atom::Ptr atom = augmentPackage( source_r, *(pa_pos->second) );
- impl->_atoms.push_back(atom);
- }
-
- return patch;
- }
- catch (const Exception & excpt_r)
- {
- ZYPP_CAUGHT(excpt_r);
- ZYPP_THROW(Exception("Cannot create patch object"));
- }
- return 0L;
-}
-
-Dependencies YUMSourceImpl::createDependencies(
- const zypp::parser::yum::YUMObjectData & parsed,
- const Resolvable::Kind my_kind
-)
-{
- Dependencies _deps;
- for (std::list<YUMDependency>::const_iterator it = parsed.provides.begin();
- it != parsed.provides.end();
- it++)
- {
- _deps[Dep::PROVIDES].insert(createCapability(*it, my_kind));
- }
-
- for (std::list<YUMDependency>::const_iterator it = parsed.conflicts.begin();
- it != parsed.conflicts.end();
- it++)
- {
- _deps[Dep::CONFLICTS].insert(createCapability(*it, my_kind));
- }
-
- for (std::list<YUMDependency>::const_iterator it = parsed.obsoletes.begin();
- it != parsed.obsoletes.end();
- it++)
- {
- _deps[Dep::OBSOLETES].insert(createCapability(*it, my_kind));
- }
-
- for (std::list<YUMDependency>::const_iterator it = parsed.freshens.begin();
- it != parsed.freshens.end();
- it++)
- {
- _deps[Dep::FRESHENS].insert(createCapability(*it, my_kind));
- }
-
- for (std::list<YUMDependency>::const_iterator it = parsed.recommends.begin();
- it != parsed.recommends.end();
- it++)
- {
- _deps[Dep::RECOMMENDS].insert(createCapability(*it, my_kind));
- }
-
- for (std::list<YUMDependency>::const_iterator it = parsed.suggests.begin();
- it != parsed.suggests.end();
- it++)
- {
- _deps[Dep::SUGGESTS].insert(createCapability(*it, my_kind));
- }
-
- for (std::list<YUMDependency>::const_iterator it = parsed.supplements.begin();
- it != parsed.supplements.end();
- it++)
- {
- _deps[Dep::SUPPLEMENTS].insert(createCapability(*it, my_kind));
- }
-
- for (std::list<YUMDependency>::const_iterator it = parsed.enhances.begin();
- it != parsed.enhances.end();
- it++)
- {
- _deps[Dep::ENHANCES].insert(createCapability(*it, my_kind));
- }
-
- for (std::list<YUMDependency>::const_iterator it = parsed.prerequires.begin();
- it != parsed.prerequires.end();
- it++)
- {
- _deps[Dep::PREREQUIRES].insert(createCapability(*it, my_kind));
- }
-
- for (std::list<YUMDependency>::const_iterator it = parsed.requires.begin();
- it != parsed.requires.end();
- it++)
- {
- if (it->pre == "1")
- _deps[Dep::PREREQUIRES].insert(createCapability(*it, my_kind));
- else
- _deps[Dep::REQUIRES].insert(createCapability(*it, my_kind));
- }
-
- return _deps;
-}
-
-Dependencies YUMSourceImpl::createGroupDependencies(
- const zypp::parser::yum::YUMGroupData & parsed
-)
-{
- Dependencies _deps;
-
- for (std::list<PackageReq>::const_iterator it = parsed.packageList.begin();
- it != parsed.packageList.end();
- it++)
- {
- Dep _dep_kind = Dep::REQUIRES;
- if (it->type == "mandatory" || it->type == "")
- {
- _dep_kind = Dep::REQUIRES;
- }
- else if (it->type == "default")
- {
- _dep_kind = Dep::RECOMMENDS;
- }
- else if (it->type == "optional")
- {
- _dep_kind = Dep::SUGGESTS;
- }
- _deps[_dep_kind].insert(createCapability(YUMDependency(
- "",
- it->name,
- "EQ",
- it->epoch,
- it->ver,
- it->rel,
- ""
- ),
- ResTraits<Package>::kind));
- }
- for (std::list<MetaPkg>::const_iterator it = parsed.grouplist.begin();
- it != parsed.grouplist.end();
- it++)
- {
- Dep _dep_kind = Dep::REQUIRES;
- if (it->type == "mandatory" || it->type == "")
- {
- _dep_kind = Dep::REQUIRES;
- }
- else if (it->type == "default")
- {
- _dep_kind = Dep::RECOMMENDS;
- }
- else if (it->type == "optional")
- {
- _dep_kind = Dep::SUGGESTS;
- }
- _deps[_dep_kind].insert(createCapability(YUMDependency(
- "",
- it->name,
- "",
- "",
- "",
- "",
- ""
- ),
- ResTraits<Selection>::kind));
- }
- return _deps;
-}
-
-Capability YUMSourceImpl::createCapability(const YUMDependency & dep,
- const Resolvable::Kind & my_kind)
-{
- CapFactory _f;
- Resolvable::Kind _kind = dep.kind == "" ? my_kind : Resolvable::Kind(dep.kind);
- Capability cap;
- if ( ! dep.isEncoded() )
- {
- cap = _f.parse(
- _kind,
- dep.name,
- Rel(dep.flags),
- Edition(dep.ver, dep.rel, dep.epoch)
- );
- }
- else
- {
- cap = _f.parse( _kind, dep.encoded );
- }
- return cap;
-}
-
-} // namespace yum
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
+++ /dev/null
-/*---------------------------------------------------------------------\
-| ____ _ __ __ ___ |
-| |__ / \ / / . \ . \ |
-| / / \ V /| _/ _/ |
-| / /__ | | | | | | |
-| /_____||_| |_| |_| |
-| |
-\---------------------------------------------------------------------*/
-/** \file zypp/source/yum/YUMSourceImpl.h
- *
-*/
-#ifndef ZYPP_SOURCE_YUM_YUMSOURCEIMPL_H
-#define ZYPP_SOURCE_YUM_YUMSOURCEIMPL_H
-
-#include "zypp/source/SourceImpl.h"
-#include "zypp/detail/ResImplTraits.h"
-#include "zypp/source/yum/YUMPackageImpl.h"
-#include "zypp/parser/yum/YUMParserData.h"
-#include "zypp/Package.h"
-#include "zypp/Atom.h"
-#include "zypp/Message.h"
-#include "zypp/Script.h"
-#include "zypp/Patch.h"
-#include "zypp/Product.h"
-#include "zypp/Selection.h"
-#include "zypp/Pattern.h"
-
-using namespace zypp::parser::yum;
-using namespace zypp::filesystem;
-
-///////////////////////////////////////////////////////////////////
-namespace zypp
-{ /////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////
-namespace source
-{ /////////////////////////////////////////////////////////////////
-namespace yum
-{ //////////////////////////////////////////////////////////////
-
-/**
- * Functor to probe
- */
-class YUMProber : public SourceProber
-{
-public:
- YUMProber( media::MediaAccessId media_id, const Pathname &path ) : SourceProber( media_id, path )
- {}
-
- virtual ~YUMProber()
- {}
-
- virtual bool operator()();
-
-};
-
-/**
- * class representing a YUM collection of metadata
- */
-
-///////////////////////////////////////////////////////////////////
-//
-// CLASS NAME : YUMSourceImpl
-//
-/** Class representing a YUM installation source
-*/
-class YUMSourceImpl : public SourceImpl
-{
-public:
-
- typedef source::yum::YUMProber Prober;
-
- /** Default Ctor.
- * Just initilizes data members. Metadata retrieval
- * is delayed untill \ref factoryInit.
- */
- YUMSourceImpl();
-
-public:
-
- virtual Date timestamp() const;
- virtual void storeMetadata(const Pathname & cache_dir_r);
-
- virtual std::set<zypp::Resolvable::Kind> resolvableKinds() const;
-
- virtual std::string type(void) const
- {
- return typeString();
- }
-
- /** Text used for identifying the type of the source.
- * Used by the \ref SourceFactory when creating a
- * source of a given type only.
- */
- static std::string typeString(void)
- {
- return "YUM";
- }
-
- /**
- * is the download of metadata from the url needed
- * \param localdir
- */
- bool downloadNeeded(const Pathname & localdir);
-
- Package::Ptr createPackage(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPrimaryData & parsed,
- const zypp::parser::yum::YUMFileListData & filelist,
- const zypp::parser::yum::YUMOtherData & other,
- zypp::detail::ResImplTraits<zypp::source::yum::YUMPackageImpl>::Ptr & impl
- );
- Atom::Ptr augmentPackage(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPatchPackage & parsed
- );
- Selection::Ptr createGroup(
- Source_Ref source_r,
- const zypp::parser::yum::YUMGroupData & parsed
- );
- Pattern::Ptr createPattern(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPatternData & parsed
- );
- Message::Ptr createMessage(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPatchMessage & parsed,
- Patch::constPtr patch
- );
- Script::Ptr createScript(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPatchScript & parsed
- );
- Patch::Ptr createPatch(
- Source_Ref source_r,
- const zypp::parser::yum::YUMPatchData & parsed
- );
- Product::Ptr createProduct(
- Source_Ref source_r,
- const zypp::parser::yum::YUMProductData & parsed
- );
-
-
- Dependencies createDependencies(
- const zypp::parser::yum::YUMObjectData & parsed,
- const Resolvable::Kind my_kind
- );
-
- Dependencies createGroupDependencies(
- const zypp::parser::yum::YUMGroupData & parsed
- );
-
- Capability createCapability(const YUMDependency & dep,
- const Resolvable::Kind & my_kind);
-private:
- /** Ctor substitute.
- * Actually get the metadata.
- * \throw EXCEPTION on fail
- */
- virtual void factoryInit();
-
- ///** Check checksums of metadata files
- // * \throw EXCEPTION on fail
- // */
- //void checkMetadataChecksums() const;
-
- void readRepomd();
-
- virtual void createResolvables(Source_Ref source_r);
- virtual ResStore provideResolvablesByKind(Source_Ref source_r, zypp::Resolvable::Kind kind);
-
- void provideProducts(Source_Ref source_r, ResStore& store);
- void providePackages(Source_Ref source_r, ResStore& store);
- void provideSelections(Source_Ref source_r, ResStore& store);
- void providePatterns(Source_Ref source_r, ResStore& store);
- void providePatches(Source_Ref source_r, ResStore& store);
-
- std::list<YUMRepomdData_Ptr> _repo_primary;
- std::list<YUMRepomdData_Ptr> _repo_files;
- std::list<YUMRepomdData_Ptr> _repo_group;
- std::list<YUMRepomdData_Ptr> _repo_pattern;
- std::list<YUMRepomdData_Ptr> _repo_product;
- std::list<YUMRepomdData_Ptr> _repo_patches;
-
-
-private:
-
- const Pathname metadataRoot() const;
- bool cacheExists();
-
- const TmpDir downloadMetadata();
- void saveMetadataTo(const Pathname & dir_r);
- const Pathname repomdFile() const;
- const Pathname repomdFileSignature() const;
- const Pathname repomdFileKey() const;
-
- typedef struct
- {
- zypp::detail::ResImplTraits<zypp::source::yum::YUMPackageImpl>::Ptr impl;
- zypp::Package::Ptr package;
- }
- ImplAndPackage;
-
- typedef std::map<zypp::NVRA, ImplAndPackage> PackageImplMapT;
- PackageImplMapT _package_impl;
-
-};
-
-///////////////////////////////////////////////////////////////////
-} // namespace yum
-/////////////////////////////////////////////////////////////////
-} // namespace source
-///////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////
-} // namespace zypp
-///////////////////////////////////////////////////////////////////
-#endif // ZYPP_SOURCE_YUM_YUMSOURCEIMPL_H
#include "zypp/base/Logger.h"
#include "zypp/base/Exception.h"
-
+#include "zypp/PathInfo.h"
#include "zypp/target/CommitPackageCacheReadAhead.h"
using std::endl;
std::ostream & operator<<( std::ostream & str, const IMediaKey & obj )
{
- return str << "[S" << obj._source.numericId() << ":" << obj._mediaNr << "]"
- << " " << obj._source.alias();
+ return str << "[S" << obj._repository.numericId() << ":" << obj._mediaNr << "]"
+ << " " << obj._repository.info().alias();
}
///////////////////////////////////////////////////////////////////
//
bool CommitPackageCacheReadAhead::onInteractiveMedia( const PoolItem & pi ) const
{
- if ( pi->sourceMediaNr() == 0 ) // no media access at all
+ if ( pi->mediaNr() == 0 ) // no media access at all
return false;
- std::string scheme( pi->source().url().getScheme() );
- return ( scheme == "dvd" || scheme == "cd" );
+ //std::string scheme( pi->source().url().getScheme() );
+ //return ( scheme == "dvd" || scheme == "cd" );
+#warning "FIX CommitPackageCacheReadAhead::onInteractiveMedia"
+ return false;
}
///////////////////////////////////////////////////////////////////
if ( _cacheMap.find( *it ) == _cacheMap.end() )
{
addToCache[*it];
- addSize += it->resolvable()->archivesize();
+ addSize += it->resolvable()->downloadSize();
}
}
}
// copy it to the cachedir
std::string destName( str::form( "S%lu_%u_%s",
- it->first->source().numericId(),
- it->first->sourceMediaNr(),
+ it->first->repository().numericId(),
+ it->first->mediaNr(),
fromSource.value().basename().c_str() ) );
ManagedFile fileInCache( _cacheDir->path() / destName,
#include "zypp/base/Exception.h"
#include "zypp/base/DefaultIntegral.h"
-#include "zypp/Source.h"
+#include "zypp/Repository.h"
#include "zypp/TmpPath.h"
#include "zypp/target/CommitPackageCacheImpl.h"
explicit
IMediaKey( const ResObject::constPtr & obj_r )
- : _source( obj_r->source() )
- , _mediaNr( obj_r->sourceMediaNr() )
+ : _repository( obj_r->repository() )
+ , _mediaNr( obj_r->mediaNr() )
{}
- IMediaKey( const Source_Ref & source_r, unsigned mediaNr_r )
- : _source( source_r )
+ IMediaKey( const Repository & repo, unsigned mediaNr_r )
+ : _repository( repo )
, _mediaNr( mediaNr_r )
{}
bool operator==( const IMediaKey & rhs ) const
- { return( _source == rhs._source && _mediaNr == rhs._mediaNr ); }
+ { return( _repository == rhs._repository && _mediaNr == rhs._mediaNr ); }
bool operator!=( const IMediaKey & rhs ) const
{ return ! operator==( rhs ); }
bool operator<( const IMediaKey & rhs ) const
{
- return( _source.numericId() < rhs._source.numericId()
- || ( _source.numericId() == rhs._source.numericId()
+ return( _repository.numericId() < rhs._repository.numericId()
+ || ( _repository.numericId() == rhs._repository.numericId()
&& _mediaNr < rhs._mediaNr ) );
}
- Source_Ref _source;
+ Repository _repository;
DefaultIntegral<unsigned,0> _mediaNr;
};
///////////////////////////////////////////////////////////////////
#include "zypp/base/Exception.h"
#include "zypp/base/Iterator.h"
#include "zypp/base/Gettext.h"
+#include "zypp/base/UserRequestException.h"
+
#include "zypp/PoolItem.h"
#include "zypp/Resolvable.h"
#include "zypp/ResObject.h"
#include "zypp/Selection.h"
#include "zypp/Script.h"
#include "zypp/Message.h"
-#include "zypp/Source.h"
#include "zypp/Url.h"
#include "zypp/CapMatchHelper.h"
#include "zypp/pool/GetResolvablesToInsDel.h"
#include "zypp/solver/detail/Helper.h"
-#ifdef ZYPP_REFACTORING
#include "zypp/repo/DeltaCandidates.h"
#include "zypp/repo/PackageProvider.h"
-#else
-#include "zypp/source/PackageProvider.h"
-#endif
using namespace std;
using namespace zypp;
}
};
- /** Let the Source provide the package.
+ /**
+ * \short Let the Source provide the package.
+ * \p pool_r \ref ResPool used to get candidates
+ * \p pi item to be commited
*/
- static ManagedFile sourceProvidePackage( const PoolItem & pi )
+ struct RepoProvidePackage
{
- // Redirect PackageProvider queries for installed editions
- // (in case of patch/delta rpm processing) to rpmDb.
-#ifdef ZYPP_REFACTORING
- repo::PackageProviderPolicy packageProviderPolicy;
-#else
- source::PackageProviderPolicy packageProviderPolicy;
-#endif
- packageProviderPolicy.queryInstalledCB( QueryInstalledEditionHelper() );
-
- Package::constPtr p = asKind<Package>(pi.resolvable());
-#ifdef ZYPP_REFACTORING
- // FIXME no repo list
- std::set<Repository> repos;
- repo::DeltaCandidates deltas(repos);
- repo::PackageProvider pkgProvider( p, deltas, packageProviderPolicy );
-#else
- source::PackageProvider pkgProvider( p, packageProviderPolicy );
-#endif
- return pkgProvider.providePackage();
- }
-
+ ResPool _pool;
+ RepoProvidePackage( ResPool pool_r )
+ : _pool(pool_r)
+ {
+
+ }
+
+ ManagedFile operator()( const PoolItem & pi )
+ {
+ // Redirect PackageProvider queries for installed editions
+ // (in case of patch/delta rpm processing) to rpmDb.
+ repo::PackageProviderPolicy packageProviderPolicy;
+ packageProviderPolicy.queryInstalledCB( QueryInstalledEditionHelper() );
+
+ Package::constPtr p = asKind<Package>(pi.resolvable());
+
+
+ // Build a repository list for repos
+ // contributing to the pool
+ std::list<Repository> repos;
+ for ( ResPool::repository_iterator it = _pool.knownRepositoriesBegin();
+ it != _pool.knownRepositoriesEnd();
+ ++it )
+ {
+ repos.push_back(*it);
+ }
+
+ repo::DeltaCandidates deltas(repos);
+ repo::PackageProvider pkgProvider( p, deltas, packageProviderPolicy );
+ return pkgProvider.providePackage();
+ }
+ };
///////////////////////////////////////////////////////////////////
IMPL_PTR_TYPE(TargetImpl);
ResObject::constPtr res( it->resolvable() );
if ( hitUnwantedMedia
- || ( res->sourceMediaNr() && res->sourceMediaNr() != policy_r.restrictToMedia() ) )
+ || ( res->mediaNr() && res->mediaNr() != policy_r.restrictToMedia() ) )
{
hitUnwantedMedia = true;
result._remaining.push_back( *it );
{
Resolvable::constPtr res( it->resolvable() );
Package::constPtr pkg( asKind<Package>(res) );
- if (pkg && policy_r.restrictToMedia() != pkg->sourceMediaNr()) // check medianr for packages only
+ if (pkg && policy_r.restrictToMedia() != pkg->mediaNr()) // check medianr for packages only
{
- XXX << "Package " << *pkg << ", wrong media " << pkg->sourceMediaNr() << endl;
+ XXX << "Package " << *pkg << ", wrong media " << pkg->mediaNr() << endl;
result._srcremaining.push_back( *it );
}
else
bool abort = false;
// remember the last used source (if any)
- Source_Ref lastUsedSource;
+ Repository lastUsedRepo;
+ RepoProvidePackage repoProvidePackage(pool_r);
// prepare the package cache.
CommitPackageCache packageCache( items_r.begin(), items_r.end(),
- root() / "tmp", sourceProvidePackage );
+ root() / "tmp", repoProvidePackage );
for (TargetImpl::PoolItemList::const_iterator it = items_r.begin(); it != items_r.end(); it++)
{
{
localfile = packageCache.get( it );
}
- catch ( const source::SkipRequestedException & e )
+ catch ( const SkipRequestException &e )
{
ZYPP_CAUGHT( e );
WAR << "Skipping package " << p << " in commit" << endl;
continue;
}
- lastUsedSource = p->source(); // remember the package source
+ lastUsedRepo = p->repository(); // remember the package source
#warning Exception handling
// create a installation progress report proxy
// In the case of 'commit any media', end of commit means we're completely
// done and don't need the source's media anyways.
- if (lastUsedSource)
+ if (lastUsedRepo)
{ // if a source was used
- lastUsedSource.release(); // release their medias
+ //lastUsedRepo.release(); // release their medias
}
if ( abort )
return true;
}
- void
- TargetImpl::getResolvablesToInsDel ( const ResPool pool_r,
- TargetImpl::PoolItemList & dellist_r,
- TargetImpl::PoolItemList & instlist_r,
- TargetImpl::PoolItemList & srclist_r ) const
- {
- pool::GetResolvablesToInsDel collect( pool_r );
- MIL << "GetResolvablesToInsDel: " << endl << collect << endl;
- dellist_r.swap( collect._toDelete );
- instlist_r.swap( collect._toInstall );
- srclist_r.swap( collect._toSrcinstall );
- }
-
Date TargetImpl::timestamp() const
{
Date ts_rpm;
typedef std::set<PoolItem_Ref> PoolItemSet;
public:
- /** JUST FOR TESTSUITE */
- /** Sort according to prereqs and media numbers */
- void getResolvablesToInsDel ( const ResPool pool_r,
- PoolItemList & dellist_r,
- PoolItemList & instlist_r,
- PoolItemList & srclist_r ) const;
-
-
- public:
/** Ctor. */
TargetImpl(const Pathname & root_r = "/");
/** Dtor. */
return empty_list;
}
+inline static void insertCaps( CapSet &capset, capability::CapabilityImplPtrSet ptrset, CapFactory &factory )
+{
+ for ( capability::CapabilityImplPtrSet::const_iterator it = ptrset.begin();
+ it != ptrset.end();
+ ++it )
+ {
+ capset.insert( factory.fromImpl(*it) );
+ }
+}
//
// make Package::Ptr from RpmHeader
// return NULL on error
//
-Package::Ptr RpmDb::makePackageFromHeader( const RpmHeader::constPtr header, set<string> * filerequires, const Pathname & location, Source_Ref source )
+Package::Ptr RpmDb::makePackageFromHeader( const RpmHeader::constPtr header,
+ set<string> * filerequires,
+ const Pathname & location, Repository repo )
{
if ( ! header )
return 0;
// create dataprovider
detail::ResImplTraits<RPMPackageImpl>::Ptr impl( new RPMPackageImpl( header ) );
- impl->setSource( source );
+ impl->setRepository( repo );
if (!location.empty())
- impl->setLocation( location );
+ impl->setLocation( OnMediaLocation().setFilename(location) );
Edition edition;
try
arch );
list<string> filenames = impl->filenames();
- dataCollect[Dep::PROVIDES] = header->tag_provides ( filerequires );
CapFactory capfactory;
-
+ insertCaps( dataCollect[Dep::PROVIDES], header->tag_provides( filerequires ), capfactory );
+
static str::smatch what;
static const str::regex filenameRegex( "/(s?bin|lib(64)?|etc)/|^/usr/(games/|share/(dict/words|magic\\.mime)$)|^/opt/gnome/games/",
str::regex::optimize|str::regex::nosubs );
{
try
{
- dataCollect[Dep::PROVIDES].insert( capfactory.parse(ResTraits<Package>::kind, *filename) );
+ dataCollect[Dep::PROVIDES].insert(capfactory.fromImpl(capability::buildFile(ResTraits<Package>::kind, *filename) ));
}
catch (Exception & excpt_r)
{
}
}
- dataCollect[Dep::REQUIRES] = header->tag_requires( filerequires );
- dataCollect[Dep::PREREQUIRES] = header->tag_prerequires( filerequires );
- dataCollect[Dep::CONFLICTS] = header->tag_conflicts( filerequires );
- dataCollect[Dep::OBSOLETES] = header->tag_obsoletes( filerequires );
- dataCollect[Dep::ENHANCES] = header->tag_enhances( filerequires );
- dataCollect[Dep::SUPPLEMENTS] = header->tag_supplements( filerequires );
+ insertCaps( dataCollect[Dep::REQUIRES], header->tag_requires( filerequires ), capfactory );
+ insertCaps( dataCollect[Dep::PREREQUIRES], header->tag_prerequires( filerequires ), capfactory );
+ insertCaps( dataCollect[Dep::CONFLICTS], header->tag_conflicts( filerequires ), capfactory );
+ insertCaps( dataCollect[Dep::OBSOLETES], header->tag_obsoletes( filerequires ), capfactory );
+ insertCaps( dataCollect[Dep::ENHANCES], header->tag_enhances( filerequires ), capfactory );
+ insertCaps( dataCollect[Dep::SUPPLEMENTS], header->tag_supplements( filerequires ), capfactory );
try
{
return pptr;
}
-
const list<Package::Ptr> & RpmDb::doGetPackages(callback::SendReport<ScanDBReport> & report)
{
if ( packagesValid() )
continue;
}
- Package::Ptr pptr = makePackageFromHeader( *iter, &_filerequires, location, Source_Ref() );
+ Package::Ptr pptr = makePackageFromHeader( *iter, &_filerequires, location, Repository() );
if ( ! pptr )
{
WAR << "Failed to make package from database header '" << name << "'" << endl;
#include "zypp/ExternalProgram.h"
#include "zypp/Package.h"
-#include "zypp/Source.h"
#include "zypp/KeyRing.h"
#include "zypp/target/rpm/RpmHeader.h"
* return NULL on error
**/
- static Package::Ptr makePackageFromHeader( const RpmHeader::constPtr header, std::set<std::string> * filerequires, const Pathname & location, Source_Ref source );
+ static Package::Ptr makePackageFromHeader( const RpmHeader::constPtr header,
+ std::set<std::string> * filerequires,
+ const Pathname & location, Repository repo );
///////////////////////////////////////////////////////////////////
//
#include "zypp/base/Exception.h"
using namespace std;
+using namespace zypp::capability;
namespace zypp
{
//
// DESCRIPTION :
//
-CapSet RpmHeader::PkgRelList_val( tag tag_r, bool pre, set<string> * freq_r ) const
+CapabilityImplPtrSet RpmHeader::PkgRelList_val( tag tag_r, bool pre, set<string> * freq_r ) const
{
- CapSet ret;
+ CapabilityImplPtrSet ret;
int_32 kindFlags = 0;
int_32 kindVersion = 0;
if ((pre && (f & RPMSENSE_PREREQ))
|| ((! pre) && !(f & RPMSENSE_PREREQ)))
{
- CapFactory _f;
try
{
- Capability cap = _f.parse(
+ CapabilityImpl::Ptr cap = capability::buildVersioned(
ResTraits<Package>::kind,
n,
op,
//
//
// METHOD NAME : RpmHeader::tag_provides
-// METHOD TYPE : CapSet
+// METHOD TYPE : CapabilityImplPtrSet
//
// DESCRIPTION :
//
-CapSet RpmHeader::tag_provides( set<string> * freq_r ) const
+CapabilityImplPtrSet RpmHeader::tag_provides( set<string> * freq_r ) const
{
return PkgRelList_val( RPMTAG_PROVIDENAME, false, freq_r );
}
//
//
// METHOD NAME : RpmHeader::tag_requires
-// METHOD TYPE : CapSet
+// METHOD TYPE : CapabilityImplPtrSet
//
// DESCRIPTION :
//
-CapSet RpmHeader::tag_requires( set<string> * freq_r ) const
+CapabilityImplPtrSet RpmHeader::tag_requires( set<string> * freq_r ) const
{
return PkgRelList_val( RPMTAG_REQUIRENAME, false, freq_r );
}
//
//
// METHOD NAME : RpmHeader::tag_requires
-// METHOD TYPE : CapSet
+// METHOD TYPE : CapabilityImplPtrSet
//
// DESCRIPTION :
//
-CapSet RpmHeader::tag_prerequires( set<string> * freq_r ) const
+CapabilityImplPtrSet RpmHeader::tag_prerequires( set<string> * freq_r ) const
{
return PkgRelList_val( RPMTAG_REQUIRENAME, true, freq_r );
}
//
//
// METHOD NAME : RpmHeader::tag_conflicts
-// METHOD TYPE : CapSet
+// METHOD TYPE : CapabilityImplPtrSet
//
// DESCRIPTION :
//
-CapSet RpmHeader::tag_conflicts( set<string> * freq_r ) const
+CapabilityImplPtrSet RpmHeader::tag_conflicts( set<string> * freq_r ) const
{
return PkgRelList_val( RPMTAG_CONFLICTNAME, false, freq_r );
}
//
//
// METHOD NAME : RpmHeader::tag_obsoletes
-// METHOD TYPE : CapSet
+// METHOD TYPE : CapabilityImplPtrSet
//
// DESCRIPTION :
//
-CapSet RpmHeader::tag_obsoletes( set<string> * freq_r ) const
+CapabilityImplPtrSet RpmHeader::tag_obsoletes( set<string> * freq_r ) const
{
return PkgRelList_val( RPMTAG_OBSOLETENAME, false, freq_r );
}
//
//
// METHOD NAME : RpmHeader::tag_enhances
-// METHOD TYPE : CapSet
+// METHOD TYPE : CapabilityImplPtrSet
//
// DESCRIPTION :
//
-CapSet RpmHeader::tag_enhances( set<string> * freq_r ) const
+CapabilityImplPtrSet RpmHeader::tag_enhances( set<string> * freq_r ) const
{
#ifdef HAVE_RPM_ENHANCES
return PkgRelList_val( RPMTAG_ENHANCESNAME, false, freq_r );
#else
- return CapSet();
+ return CapabilityImplPtrSet();
#endif
}
//
//
// METHOD NAME : RpmHeader::tag_supplements
-// METHOD TYPE : CapSet
+// METHOD TYPE : CapabilityImplPtrSet
//
// DESCRIPTION :
//
-CapSet RpmHeader::tag_supplements( set<string> * freq_r ) const
+CapabilityImplPtrSet RpmHeader::tag_supplements( set<string> * freq_r ) const
{
- return CapSet();
+ return CapabilityImplPtrSet();
#warning NEEDS RPMTAG_SUPPLEMENTSNAME
#if 0
return PkgRelList_val( RPMTAG_SUPPLEMENTSNAME, false, freq_r );
#include "zypp/CapSetFwd.h"
#include "zypp/Pathname.h"
#include "zypp/DiskUsage.h"
+#include "zypp/capability/CapabilityImpl.h"
+
namespace zypp
{
private:
- CapSet PkgRelList_val( tag tag_r, bool pre, std::set<std::string> * freq_r = 0 ) const;
+ capability::CapabilityImplPtrSet PkgRelList_val( tag tag_r, bool pre, std::set<std::string> * freq_r = 0 ) const;
public:
/**
* If <code>freq_r</code> is not NULL, file dependencies found are inserted.
**/
- CapSet tag_provides ( std::set<std::string> * freq_r = 0 ) const;
+ capability::CapabilityImplPtrSet tag_provides ( std::set<std::string> * freq_r = 0 ) const;
/**
* @see #tag_provides
**/
- CapSet tag_requires ( std::set<std::string> * freq_r = 0 ) const;
+ capability::CapabilityImplPtrSet tag_requires ( std::set<std::string> * freq_r = 0 ) const;
/**
* @see #tag_provides
**/
- CapSet tag_prerequires ( std::set<std::string> * freq_r = 0 ) const;
+ capability::CapabilityImplPtrSet tag_prerequires ( std::set<std::string> * freq_r = 0 ) const;
/**
* @see #tag_provides
**/
- CapSet tag_conflicts( std::set<std::string> * freq_r = 0 ) const;
+ capability::CapabilityImplPtrSet tag_conflicts( std::set<std::string> * freq_r = 0 ) const;
/**
* @see #tag_provides
**/
- CapSet tag_obsoletes( std::set<std::string> * freq_r = 0 ) const;
+ capability::CapabilityImplPtrSet tag_obsoletes( std::set<std::string> * freq_r = 0 ) const;
/**
* @see #tag_provides
**/
- CapSet tag_enhances( std::set<std::string> * freq_r = 0 ) const;
+ capability::CapabilityImplPtrSet tag_enhances( std::set<std::string> * freq_r = 0 ) const;
/**
* @see #tag_provides
**/
- CapSet tag_supplements( std::set<std::string> * freq_r = 0 ) const;
+ capability::CapabilityImplPtrSet tag_supplements( std::set<std::string> * freq_r = 0 ) const;
ByteCount tag_size() const;
ByteCount tag_archivesize() const;
_type("rpm"), // FIXME in the future
_filenames(data->tag_filenames()),
// _disk_usage(data->diskusage),
- _size(data->tag_size()),
- _archivesize(data->tag_archivesize())
+ _size(data->tag_size())
{
// we know we are reading english.
_description.setText(data->tag_description(), Locale("en"));
data->tag_du(_disk_usage);
+ _location.setDownloadSize(data->tag_archivesize());
}
/** Package summary */
}
/** */
-Pathname RPMPackageImpl::location() const
+OnMediaLocation RPMPackageImpl::location() const
{
return _location;
}
}
/** */
-ByteCount RPMPackageImpl::archivesize() const
-{
- return _archivesize;
-}
-
-/** */
std::list<std::string> RPMPackageImpl::filenames() const
{
return _filenames;
}
/** */
-Source_Ref RPMPackageImpl::source() const
+Repository RPMPackageImpl::repository() const
{
- return _source;
+ return _repository;
}
} // namespace rpm
#define ZYPP_TARGET_RPM_RPMPACKAGEIMPL_H
#include "zypp/detail/PackageImplIf.h"
-#include "zypp/Source.h"
#include "zypp/Changelog.h"
#include "zypp/target/rpm/RpmHeader.h"
virtual PackageGroup group() const;
/** */
virtual Changelog changelog() const;
- /** */
- virtual Pathname location() const;
+
/** Don't ship it as class Url, because it might be
* in fact anything but a legal Url. */
virtual std::string url() const;
/** */
virtual ByteCount sourcesize() const;
/** */
- virtual ByteCount archivesize() const;
- /** */
virtual std::list<std::string> filenames() const;
/** */
virtual std::string type() const;
/** */
virtual DiskUsage diskUsage() const;
/** */
- virtual Source_Ref source() const;
+ virtual Repository repository() const;
/** for 'local' RPMs */
- void setLocation (const Pathname & pathname)
+ void setLocation (const OnMediaLocation &loc)
{
- _location = pathname;
+ _location = loc;
}
- void setSource (Source_Ref source)
+
+ OnMediaLocation location() const;
+
+ void setRepository (Repository repo)
{
- _source = source;
+ _repository = repo;
}
protected:
std::string _packager;
PackageGroup _group;
Changelog _changelog;
- Pathname _location; // for 'local' rpms
std::string _type;
std::list<std::string> _filenames;
DiskUsage _disk_usage;
ByteCount _size;
- ByteCount _archivesize;
- Source_Ref _source;
+ Repository _repository;
+ OnMediaLocation _location;
};
///////////////////////////////////////////////////////////////////
} // namespace rpm
virtual std::set<std::string> flags( const std::string &key ) const = 0;
virtual bool hasFlag( const std::string &key, const std::string &flag ) const = 0;
- /////////////////////////////////////////////////////////
- // SOURCES API
- ////////////////////////////////////////////////////////
- /**
- * Query for installed Sources
- */
- virtual source::SourceInfoList storedSources() const = 0;
- /**
- * Query for installed Sources
- */
- virtual void storeSource(const source::SourceInfo &data) = 0;
- /**
- * Query for installed Sources
- */
- virtual void deleteSource(const std::string &alias) = 0;
-
private:
/** Pointer to implementation */
class Private;
return d->backend->hasFlag(key, flag);
}
-/////////////////////////////////////////////////////////
-// SOURCES API
-////////////////////////////////////////////////////////
-
-source::SourceInfoList
-PersistentStorage::storedSources() const
-{
- return d->backend->storedSources();
-}
-
-void
-PersistentStorage::storeSource(const source::SourceInfo &data)
-{
- d->backend->storeSource(data);
-}
-
-void
-PersistentStorage::deleteSource(const std::string &alias)
-{
- d->backend->deleteSource(alias);
-}
-
/******************************************************************
**
** FUNCTION NAME : operator<<
#include <zypp/Url.h>
#include <zypp/Date.h>
#include <zypp/Patch.h>
-#include <zypp/source/SourceInfo.h>
-
-using namespace zypp::source;
///////////////////////////////////////////////////////////////////
namespace zypp
std::set<std::string> flags( const std::string &key ) const;
bool hasFlag( const std::string &key, const std::string &flag ) const;
- /////////////////////////////////////////////////////////
- // SOURCES API
- ////////////////////////////////////////////////////////
- /**
- * Query for installed Sources
- */
- std::list<SourceInfo> storedSources() const;
- /**
- * Add a new installed source
- */
- void storeSource(const SourceInfo &data);
- /**
- * Delete an installed source
- */
- void deleteSource(const std::string &alias);
-
private:
class Private;
shared_ptr<Private> d;
#include "zypp/base/Logger.h"
#include "zypp/base/Exception.h"
#include "zypp/base/Random.h"
-
+#include "zypp/base/Gettext.h"
#include "zypp/CapFactory.h"
#include "zypp/Digest.h"
-#include "zypp/Source.h"
-#include "zypp/SourceManager.h"
#include "zypp/ExternalProgram.h"
#include "zypp/target/store/xml/XMLPatchImpl.h"
#include <zypp/ZYpp.h>
#include <zypp/PathInfo.h>
-#include "zypp/parser/xmlstore/XMLSourceCacheParser.h"
-
#include "boost/filesystem/operations.hpp" // includes boost/filesystem/path.hpp
#include "boost/filesystem/fstream.hpp" // ditto
impl->_delete_notify = parsed.delete_notify;
impl->_license_to_confirm = parsed.license_to_confirm;
impl->_size = parsed.size;
- impl->_archive_size = parsed.archive_size;
+ impl->_downloadSize = parsed.downloadSize;
impl->_install_only = parsed.install_only;
impl->_build_time = parsed.build_time;
impl->_install_time = parsed.install_time;
impl->_delete_notify = parsed.delete_notify;
impl->_license_to_confirm = parsed.license_to_confirm;
impl->_size = parsed.size;
- impl->_archive_size = parsed.archive_size;
+ impl->_downloadSize = parsed.downloadSize;
impl->_install_only = parsed.install_only;
impl->_build_time = parsed.build_time;
impl->_install_time = parsed.install_time;
impl->_delete_notify = parsed.delete_notify;
impl->_license_to_confirm = parsed.license_to_confirm;
impl->_size = parsed.size;
- impl->_archive_size = parsed.archive_size;
+ impl->_downloadSize = parsed.downloadSize;
impl->_install_only = parsed.install_only;
impl->_build_time = parsed.build_time;
impl->_install_time = parsed.install_time;
impl->_delete_notify = parsed.delete_notify;
impl->_license_to_confirm = parsed.license_to_confirm;
impl->_size = parsed.size;
- impl->_archive_size = parsed.archive_size;
+ impl->_downloadSize = parsed.downloadSize;
impl->_install_only = parsed.install_only;
impl->_build_time = parsed.build_time;
impl->_install_time = parsed.install_time;
impl->_delete_notify = parsed.delete_notify;
impl->_license_to_confirm = parsed.license_to_confirm;
impl->_size = parsed.size;
- impl->_archive_size = parsed.archive_size;
+ impl->_downloadSize = parsed.downloadSize;
impl->_install_only = parsed.install_only;
impl->_build_time = parsed.build_time;
impl->_install_time = parsed.install_time;
impl->_delete_notify = parsed.delete_notify;
impl->_license_to_confirm = parsed.license_to_confirm;
impl->_size = parsed.size;
- impl->_archive_size = parsed.archive_size;
+ impl->_downloadSize = parsed.downloadSize;
impl->_install_only = parsed.install_only;
impl->_build_time = parsed.build_time;
impl->_install_time = parsed.install_time;
impl->_delete_notify = parsed.delete_notify;
impl->_license_to_confirm = parsed.license_to_confirm;
impl->_size = parsed.size;
- impl->_archive_size = parsed.archive_size;
+ impl->_downloadSize = parsed.downloadSize;
impl->_install_only = parsed.install_only;
impl->_build_time = parsed.build_time;
impl->_install_time = parsed.install_time;
return str;
}
-/////////////////////////////////////////////////////////
-// SOURCES API
-////////////////////////////////////////////////////////
-
-source::SourceInfoList
-XMLFilesBackend::storedSources() const
-{
- path source_p = path(d->root.asString()) / path(ZYPP_DB_DIR) / path ("sources");
- source::SourceInfoList sources;
- DBG << "Reading source cache in " << source_p.string() << std::endl;
- directory_iterator end_iter;
- // return empty list if the dir does not exist
- if ( !exists( source_p ) )
- {
- ERR << "path " << source_p.string() << " does not exists. Required to read source cache " << std::endl;
- return source::SourceInfoList();
- }
-
- for ( directory_iterator dir_itr( source_p ); dir_itr != end_iter; ++dir_itr )
- {
- DBG << "[source-list] - " << dir_itr->leaf() << std::endl;
- //sources.insert( sourceDataFromCacheFile( source_p + "/" + dir_itr->leaf() ) );
- std::string full_path = (source_p / dir_itr->leaf()).string();
- std::ifstream anIstream(full_path.c_str());
- zypp::parser::xmlstore::XMLSourceCacheParser iter(anIstream, "");
- for (; ! iter.atEnd(); ++iter) {
- source::SourceInfo data = **iter;
- sources.push_back(data);
- }
- }
- MIL << "done reading source cache" << std::endl;
- return sources;
-
-}
-
-void
-XMLFilesBackend::storeSource(const source::SourceInfo &data)
-{
- // serialize and save a file
- std::string xml = toXML(data);
- path source_p = path(d->root.asString()) / path(ZYPP_DB_DIR) / path ("sources");
-
- // generate a filename
- if (data.alias().size() == 0)
- {
- ZYPP_THROW(Exception("Cant save source with empty alias"));
- }
-
- //DBG << std::endl << xml << std::endl;
- std::ofstream file;
- //DBG << filename << std::endl;
- try
- {
- std::stringstream message_stream(data.alias());
- std::string full_path = (source_p / Digest::digest("MD5", message_stream)).string();
-
- file.open(full_path.c_str());
- file << xml;
- file.close();
- }
- catch ( std::exception &e )
- {
- ERR << "Error saving source " << data.alias() << " in the cache" << std::endl;
- ZYPP_THROW(Exception(e.what()));
- }
- updateTimestamp();
-}
-
-void
-XMLFilesBackend::deleteSource(const std::string &alias)
-{
- // just delete the files
- path source_p = path(d->root.asString()) / path(ZYPP_DB_DIR) / path ("sources");
- try
- {
- std::stringstream message_stream(alias);
- std::string full_path = (source_p / Digest::digest("MD5", message_stream)).string();
- remove(full_path);
- }
- catch ( std::exception &e )
- {
- ERR << "Error deleting source " << alias << " in the cache" << std::endl;
- ZYPP_THROW(Exception(e.what()));
- }
- updateTimestamp();
-}
-
/////////////////////////////////////////////////////////////////
} // namespace storage
///////////////////////////////////////////////////////////////////
std::set<std::string> flagsFromFile( const std::string &filename ) const;
void updateTimestamp() const;
- /////////////////////////////////////////////////////////
- // SOURCES API
- ////////////////////////////////////////////////////////
- public:
- /**
- * Query for installed Sources
- */
- virtual source::SourceInfoList storedSources() const;
- /**
- * Query for installed Sources
- */
- virtual void storeSource(const source::SourceInfo &data);
- /**
- * Query for installed Sources
- */
- virtual void deleteSource(const std::string &alias);
-
protected:
#include "zypp/base/Logger.h"
#include "zypp/CapFactory.h"
-#include "zypp/Source.h"
#include "zypp/Url.h"
#include "zypp/ResObject.h"
out << translatedTextToXML(pipp->licenseToConfirm(), "license-to-confirm");
out << " <vendor>" << xml_escape(obj->vendor()) << "</vendor>" << endl;
out << " <size>" << static_cast<ByteCount::SizeType>(obj->size()) << "</size>" << endl;
- out << " <archive-size>" << static_cast<ByteCount::SizeType>(obj->archivesize()) << "</archive-size>" << endl;
+ out << " <archive-size>" << static_cast<ByteCount::SizeType>(obj->downloadSize()) << "</archive-size>" << endl;
out << " <install-only>" << ( obj->installOnly() ? "true" : "false" ) << "</install-only>" << endl;
out << " <build-time>" << obj->buildtime().asSeconds() << "</build-time>" << endl;
// we assume we serialize on storeObject, set install time to NOW
out << " <distribution-name>" << xml_escape(obj->distributionName()) << "</distribution-name>" << endl;
out << " <distribution-edition>" << xml_escape(obj->distributionEdition().asString()) << "</distribution-edition>" << endl;
- out << " <source>" << xml_escape(obj->source().alias()) << "</source>" << endl;
+ out << " <source>" << xml_escape(obj->repository().info().alias()) << "</source>" << endl;
out << " <release-notes-url>" << xml_escape(obj->releaseNotesUrl().asString()) << "</release-notes-url>" << endl;
out << " <update-urls>" << endl;
return out.str();
}
-template<>
-string toXML( const source::SourceInfo &obj )
-{
- stringstream out;
- out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
- out << "<source version=\"" << SERIALIZER_VERSION << "\" xmlns=\"http://www.novell.com/metadata/zypp/xml-store\">" << endl;
- out << " <enabled>" << obj.enabled() << "</enabled>" << endl;
- out << " <auto-refresh>" << obj.autorefresh() << "</auto-refresh>" << endl;
- out << " <product-dir>" << obj.path() << "</product-dir>" << endl;
- out << " <cache-dir>" << obj.cacheDir() << "</cache-dir>" << endl;
- out << " <type>" << xml_escape(obj.type()) << "</type>" << endl;
- out << " <url>" << xml_escape(obj.url().asCompleteString()) << "</url>" << endl;
- out << " <alias>" << xml_escape(obj.alias()) << "</alias>" << endl;
- out << "</source>" << endl;
- return out.str();
-}
-
/////////////////////////////////////////////////////////////////
} // namespace storage
///////////////////////////////////////////////////////////////////
template<>
std::string toXML( const Language::constPtr &obj );
-template<>
-std::string toXML( const source::SourceInfo &obj );
-
/////////////////////////////////////////////////////////////////
} // namespace storage
///////////////////////////////////////////////////////////////////
#ifndef ZYPP_TARGET_XMLSTORE_ATOMIMPL_H
#define ZYPP_TARGET_XMLSTORE_ATOMIMPL_H
-#include "zypp/source/SourceImpl.h"
#include "zypp/detail/AtomImpl.h"
///////////////////////////////////////////////////////////////////
{ return _vendor; }
virtual ByteCount size() const
{ return _size; }
- virtual ByteCount archivesize() const
- { return _archive_size; }
+ virtual ByteCount downloadSize() const
+ { return _downloadSize; }
virtual unsigned sourceMediaNr() const
{ return 0; }
virtual bool installOnly() const
TranslatedText _license_to_confirm;
std::string _vendor;
ByteCount _size;
- ByteCount _archive_size;
+ ByteCount _downloadSize;
bool _install_only;
Date _build_time;
Date _install_time;
{ return _vendor; }
virtual ByteCount size() const
{ return _size; }
- virtual ByteCount archivesize() const
- { return _archive_size; }
+ virtual ByteCount downloadSize() const
+ { return _downloadSize; }
virtual unsigned sourceMediaNr() const
{ return 0; }
virtual bool installOnly() const
TranslatedText _license_to_confirm;
std::string _vendor;
ByteCount _size;
- ByteCount _archive_size;
+ ByteCount _downloadSize;
bool _install_only;
Date _build_time;
Date _install_time;
{ return _vendor; }
virtual ByteCount size() const
{ return _size; }
- virtual ByteCount archivesize() const
- { return _archive_size; }
+ virtual ByteCount downloadSize() const
+ { return _downloadSize; }
virtual unsigned sourceMediaNr() const
{ return 0; }
virtual bool installOnly() const
TranslatedText _license_to_confirm;
std::string _vendor;
ByteCount _size;
- ByteCount _archive_size;
+ ByteCount _downloadSize;
bool _install_only;
Date _build_time;
Date _install_time;
{ return _vendor; }
virtual ByteCount size() const
{ return _size; }
- virtual ByteCount archivesize() const
- { return _archive_size; }
+ virtual ByteCount downloadSize() const
+ { return _downloadSize; }
virtual unsigned sourceMediaNr() const
{ return 0; }
virtual bool installOnly() const
TranslatedText _license_to_confirm;
std::string _vendor;
ByteCount _size;
- ByteCount _archive_size;
+ ByteCount _downloadSize;
bool _install_only;
Date _build_time;
Date _install_time;
#ifndef ZYPP_STORAGE_XMLPRODUCTIMPL_H
#define ZYPP_STORAGE_XMLPRODUCTIMPL_H
-#include "zypp/Source.h"
#include "zypp/detail/ProductImplIf.h"
///////////////////////////////////////////////////////////////////
{ return _vendor; }
virtual ByteCount size() const
{ return _size; }
- virtual ByteCount archivesize() const
- { return _archive_size; }
+ virtual ByteCount downloadSize() const
+ { return _downloadSize; }
virtual unsigned sourceMediaNr() const
{ return 0; }
virtual bool installOnly() const
TranslatedText _license_to_confirm;
std::string _vendor;
ByteCount _size;
- ByteCount _archive_size;
+ ByteCount _downloadSize;
bool _install_only;
Date _build_time;
Date _install_time;
TranslatedText _short_name;
std::string _dist_name;
Edition _dist_version;
-
- Source_Ref _source;
};
///////////////////////////////////////////////////////////////////
{ return _vendor; }
virtual ByteCount size() const
{ return _size; }
- virtual ByteCount archivesize() const
- { return _archive_size; }
+ virtual ByteCount downloadSize() const
+ { return _downloadSize; }
virtual unsigned sourceMediaNr() const
{ return 0; }
virtual bool installOnly() const
TranslatedText _license_to_confirm;
std::string _vendor;
ByteCount _size;
- ByteCount _archive_size;
+ ByteCount _downloadSize;
bool _install_only;
Date _build_time;
Date _install_time;
{ return _vendor; }
virtual ByteCount size() const
{ return _size; }
- virtual ByteCount archivesize() const
- { return _archive_size; }
+ virtual ByteCount downloadSize() const
+ { return _downloadSize; }
virtual unsigned sourceMediaNr() const
{ return 0; }
virtual bool installOnly() const
TranslatedText _license_to_confirm;
std::string _vendor;
ByteCount _size;
- ByteCount _archive_size;
+ ByteCount _downloadSize;
bool _install_only;
Date _build_time;
Date _install_time;
ZYppImpl::ZYppImpl()
: _textLocale( defaultTextLocale() )
, _pool()
- , _sourceFeed( _pool )
, _target(0)
, _resolver( new Resolver(_pool.accessor()) )
, _architecture( defaultArchitecture() )
#include "zypp/TmpPath.h"
#include "zypp/ResPoolManager.h"
-#include "zypp/SourceFeed.h"
#include "zypp/Target.h"
#include "zypp/Resolver.h"
#include "zypp/Locale.h"
{ return _pool.proxy(); }
/** */
- SourceFeed_Ref sourceFeed() const
- { return _sourceFeed; }
-
- /** */
KeyRing_Ptr keyRing() const
{ return _keyring; }
/** */
ResPoolManager _pool;
/** */
- SourceFeed_Ref _sourceFeed;
- /** */
Target_Ptr _target;
/** */
Resolver_Ptr _resolver;