From ebaacf547304dad96a48cd0e4735df1926394bed Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P Date: Thu, 10 Aug 2006 14:22:42 +0000 Subject: [PATCH] delay resolvable loading, fix location --- devel/devel.dmacvicar/testbed.cc | 2 +- zypp/source/plaindir/PlaindirImpl.cc | 15 ++++++++++----- zypp/source/plaindir/PlaindirImpl.h | 3 +++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/devel/devel.dmacvicar/testbed.cc b/devel/devel.dmacvicar/testbed.cc index b64e5e0..9af1434 100644 --- a/devel/devel.dmacvicar/testbed.cc +++ b/devel/devel.dmacvicar/testbed.cc @@ -50,7 +50,7 @@ int main() try { ZYpp::Ptr z = getZYpp(); - z->initializeTarget("/"); + //z->initializeTarget("/"); //SourceManager_Ptr manager = SourceManager::sourceManager(); diff --git a/zypp/source/plaindir/PlaindirImpl.cc b/zypp/source/plaindir/PlaindirImpl.cc index c533311..b6612a4 100644 --- a/zypp/source/plaindir/PlaindirImpl.cc +++ b/zypp/source/plaindir/PlaindirImpl.cc @@ -43,13 +43,17 @@ void PlaindirImpl::factoryInit() 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 ); - MIL << "Plaindir source initialized." << std::endl; - MIL << " Url : " << url() << std::endl; - MIL << " Path : " << path() << std::endl; } int PlaindirImpl::extract_packages_from_directory (ResStore & store, const Pathname & path, Source_Ref source, bool recursive) @@ -92,6 +96,7 @@ int PlaindirImpl::extract_packages_from_directory (ResStore & store, const Pathn for (std::list::const_iterator it = dircontent.begin(); it != dircontent.end(); ++it) { Pathname file_path = path + *it; + //Pathname file_path = *it; PathInfo file_info( file_path ); if (recursive && file_info.isDir()) { @@ -105,8 +110,8 @@ int PlaindirImpl::extract_packages_from_directory (ResStore & store, const Pathn if (string(*it, ++dotpos) != "rpm") continue; target::rpm::RpmHeader::constPtr header = target::rpm::RpmHeader::readPackage( file_path ); - Package::Ptr package = target::rpm::RpmDb::makePackageFromHeader( header, NULL, file_path, source ); - + //Package::Ptr package = target::rpm::RpmDb::makePackageFromHeader( header, NULL, file_path, source ); + Package::Ptr package = target::rpm::RpmDb::makePackageFromHeader( header, NULL, *it, source ); if (package != NULL) { DBG << "Adding package " << *package << endl; store.insert( package ); diff --git a/zypp/source/plaindir/PlaindirImpl.h b/zypp/source/plaindir/PlaindirImpl.h index 783b59d..8c828ed 100644 --- a/zypp/source/plaindir/PlaindirImpl.h +++ b/zypp/source/plaindir/PlaindirImpl.h @@ -55,6 +55,9 @@ namespace zypp virtual std::string type() const { return typeString(); } + virtual void createResolvables(Source_Ref source_r); + + private: /** Ctor substitute. * Actually get the metadata. -- 2.7.4