using namespace std;
using namespace zypp;
using namespace zypp::filesystem;
-using namespace zypp::repo;
void repostatus_test()
{
case RepoType::RPMMD_e :
case RepoType::YAST2_e :
{
-// string cmd = "repo2solv.sh \"";
-// cmd += rawpath.asString() + "\" > " + solvfile.asString();
-// int ret = system (cmd.c_str());
-// if (WIFEXITED (ret) && WEXITSTATUS (ret) != 0)
-// ZYPP_THROW(RepoUnknownTypeException());
MIL << "Executing solv converter" << endl;
string cmd( str::form( "/usr/bin/repo2solv.sh \"%s\" > %s", rawpath.asString().c_str(), solvfile.asString().c_str() ) );
ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout );
MIL << " " << output;
}
int ret = prog.close();
+ if ( ret != 0 )
+ ZYPP_THROW(RepoUnknownTypeException());
}
break;
default:
void Target::load()
{ _pimpl->load(); }
- const ResStore & Target::resolvables()
- { return _pimpl->resolvables(); }
-
ResStore::resfilter_const_iterator Target::byKindBegin( const ResObject::Kind & kind_r ) const
{ return _pimpl->byKindBegin( kind_r ); }
target::rpm::RpmDb & Target::rpmDb()
{ return _pimpl->rpm(); }
-#ifndef STORAGE_DISABLED
- /** enables the storage target */
- bool Target::isStorageEnabled() const
- { return _pimpl->isStorageEnabled(); }
-
- void Target::enableStorage(const Pathname &root_r)
- { _pimpl->enableStorage(root_r); }
-#endif
-
Pathname Target::root() const
{ return _pimpl->root(); }
public:
- /** All resolvables provided by the target. */
- const ResStore & resolvables();
-
/**
* load resolvables into the pool
*/
ResObject::constPtr whoOwnsFile (const std::string & path_str) const;
-#ifndef STORAGE_DISABLED
- /** enables the storage target */
- bool isStorageEnabled() const;
- void enableStorage(const Pathname &root_r);
-#endif
-
/** Set the log file for target */
bool setInstallationLogfile(const Pathname & path_r);
// METHOD TYPE : Ctor
//
TargetImpl::TargetImpl(const Pathname & root_r)
- : _root(root_r), _storage_enabled(false)
+ : _root(root_r)
{
_rpm.initDatabase(root_r);
MIL << "Initialized target on " << _root << endl;
MIL << "Targets closed" << endl;
}
- bool TargetImpl::isStorageEnabled() const
- {
- return _storage_enabled;
- }
-
void TargetImpl::load()
{
Pathname rpmsolv = _root + ZConfig::instance().repoCachePath() + "_rpm.solv";
MIL << "Target loaded: " << system.solvablesSize() << " resolvables" << endl;
}
- void TargetImpl::enableStorage(const Pathname &root_r)
- {
- }
-
Pathname TargetImpl::root() const
{
return _root;
}
- void TargetImpl::loadKindResolvables( const Resolvable::Kind kind )
- {
- // FIXME remove this
- }
-
ResStore::resfilter_const_iterator TargetImpl::byKindBegin( const ResObject::Kind & kind_r ) const
{
TargetImpl *ptr = const_cast<TargetImpl *>(this);
- ptr->loadKindResolvables(kind_r);
resfilter::ResFilter filter = ByKind(kind_r);
return make_filter_iterator( filter, _store.begin(), _store.end() );
}
ResStore::resfilter_const_iterator TargetImpl::byKindEnd( const ResObject::Kind & kind_r ) const
{
TargetImpl *ptr = const_cast<TargetImpl *>(this);
- ptr->loadKindResolvables(kind_r);
resfilter::ResFilter filter = ByKind(kind_r);
return make_filter_iterator( filter, _store.end(), _store.end() );
}
- const ResStore & TargetImpl::resolvables()
- {
- return _store;
- }
-
void TargetImpl::reset()
{
// FIXME remove
public:
- /** All resolvables in the target. */
- const ResStore & resolvables();
-
/**
* load resolvables of certain kind in the internal store
* and return a iterator
return res._result;
}
- /** enables the storage target */
- bool isStorageEnabled() const;
- void enableStorage(const Pathname &root_r);
-
/** Commit ordered changes
* @param pool_r only needed for #160792
* @return uncommitted ones (due to error)
void reset();
protected:
- void loadKindResolvables( const Resolvable::Kind kind );
/** All resolvables provided by the target. */
ResStore _store;
/** Path to the target */
Pathname _root;
/** RPM database */
rpm::RpmDb _rpm;
-#ifndef STORAGE_DISABLED
- zypp::storage::PersistentStorage _storage;
- bool _storage_enabled;
- std::map< const Resolvable::Kind, DefaultFalseBool> _resstore_loaded;
-#endif
private:
/** Null implementation */
static TargetImpl_Ptr _nullimpl;
#endif
}
_target = new Target( root );
- _target->enableStorage( root );
}
void ZYppImpl::finishTarget()