Author: dmacvicar
Date: Tue Jan 15 23:53:08 2008
New Revision: 8299
URL: http://svn.opensuse.org/viewcvs/zypp?rev=8299&view=rev
Log:
- disable the solvstore for now and use the sat parsers for now
to get something working fast
- more work on the repo manager, implement most methods, especially
the status one, using a cookie file (untested)
- tomorrow I will try to add the solv files to the pool
Modified:
branches/tmp/ma/jump_sat/libzypp/tools/registration/CMakeLists.txt
branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc
branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.h
branches/tmp/ma/jump_sat/libzypp/zypp/RepoStatus.cc
branches/tmp/ma/jump_sat/libzypp/zypp/cache/SolvStore.cc
Modified: branches/tmp/ma/jump_sat/libzypp/tools/registration/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/tools/registration/CMakeLists.txt?rev=8299&r1=8298&r2=8299&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/tools/registration/CMakeLists.txt (original)
+++ branches/tmp/ma/jump_sat/libzypp/tools/registration/CMakeLists.txt Tue Jan 15 23:53:08 2008
@@ -5,5 +5,6 @@
ADD_EXECUTABLE( zypp-query-pool ${querypool_SRC} )
TARGET_LINK_LIBRARIES( zypp-query-pool zypp )
TARGET_LINK_LIBRARIES( zypp-query-pool xml2 )
+TARGET_LINK_LIBRARIES( zypp-query-pool ${SATSOLVER_LIBRARY} )
INSTALL(TARGETS zypp-query-pool RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/zypp )
\ No newline at end of file
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc?rev=8299&r1=8298&r2=8299&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/RepoManager.cc Tue Jan 15 23:53:08 2008
@@ -42,6 +42,7 @@
#include "zypp/ZYppCallbacks.h"
#include "satsolver/pool.h"
+#include "satsolver/repo.h"
#include "satsolver/repo_solv.h"
using namespace std;
@@ -665,7 +666,10 @@
assert_alias(info);
Pathname rawpath = rawcache_path_for_repoinfo(_pimpl->options, info);
- cache::SolvStore store(_pimpl->options.repoCachePath);
+ Pathname base = _pimpl->options.repoCachePath + Pathname(info.alias());
+ Pathname solvfile = base.extend(".solv");
+
+ //cache::SolvStore store(_pimpl->options.repoCachePath);
RepoStatus raw_metadata_status = metadataStatus(info);
if ( raw_metadata_status.empty() )
@@ -674,11 +678,11 @@
}
bool needs_cleaning = false;
- if ( store.isCached( info.alias() ) )
+ if ( isCached( info ) )
{
MIL << info.alias() << " is already cached." << endl;
- data::RecordId id = store.lookupRepository(info.alias());
- RepoStatus cache_status = store.repositoryStatus(info.alias());
+ //data::RecordId id = store.lookupRepository(info.alias());
+ RepoStatus cache_status = cacheStatus(info);
if ( cache_status.checksum() == raw_metadata_status.checksum() )
{
@@ -702,17 +706,18 @@
if (needs_cleaning)
{
- Pathname name = _pimpl->options.repoCachePath;
- data::RecordId id = store.lookupRepository(info.alias());
- ostringstream os;
- os << id.get();
- name += os.str() + ".solv";
- unlink (name);
- cleanCacheInternal( store, info);
+// Pathname name = _pimpl->options.repoCachePath;
+// //data::RecordId id = store.lookupRepository(info.alias());
+// ostringstream os;
+// os << id.get();
+// name += os.str() + ".solv";
+// unlink (name);
+// cleanCacheInternal( store, info);
+ cleanCache(info);
}
MIL << info.alias() << " building cache..." << endl;
- data::RecordId id = store.lookupOrAppendRepository(info.alias());
+ //data::RecordId id = store.lookupOrAppendRepository(info.alias());
// do we have type?
repo::RepoType repokind = info.type();
@@ -733,12 +738,8 @@
case RepoType::RPMMD_e :
case RepoType::YAST2_e :
{
- Pathname name = _pimpl->options.repoCachePath;
- ostringstream os;
- os << id.get();
- name += os.str() + ".solv";
string cmd = "repo2solv.sh \"";
- cmd += rawpath.asString() + "\" > " + name.asString();
+ cmd += rawpath.asString() + "\" > " + solvfile.asString();
int ret = system (cmd.c_str());
if (WIFEXITED (ret) && WEXITSTATUS (ret) != 0)
ZYPP_THROW(RepoUnknownTypeException());
@@ -747,7 +748,7 @@
default:
break;
}
-
+#if 0
switch ( repokind.toEnum() )
{
case RepoType::RPMMD_e :
@@ -768,6 +769,7 @@
// no error
}
break;
+#endif
#if 0
case RepoType::RPMPLAINDIR_e :
{
@@ -780,16 +782,16 @@
parser.parse(url.getPathName());
}
break;
-#endif
+
default:
ZYPP_THROW(RepoUnknownTypeException());
}
-
+#endif
// update timestamp and checksum
- store.updateRepositoryStatus(id, raw_metadata_status);
-
+ //store.updateRepositoryStatus(id, raw_metadata_status);
+ setCacheStatus(info.alias(), raw_metadata_status);
MIL << "Commit cache.." << endl;
- store.commit();
+ //store.commit();
//progress.toMax();
}
@@ -862,7 +864,41 @@
RepoStatus RepoManager::cacheStatus( const RepoInfo &info ) const
{
Pathname name = _pimpl->options.repoCachePath;
- return RepoStatus(name + Pathname(info.alias()).extend(".solv"));
+ RepoStatus status;
+ Pathname base = _pimpl->options.repoCachePath + name + Pathname(info.alias());
+ Pathname solvfile = base.extend(".solv");
+ Pathname cookiefile = base.extend(".cookie");
+
+ std::ifstream file(cookiefile.c_str());
+ if (!file) {
+ ZYPP_THROW (Exception( "Can't open " + cookiefile.asString() ) );
+ }
+
+ std::string buffer;
+ while(file && !file.eof()) {
+ getline(file, buffer);
+ }
+
+ std::vectorstd::string words;
+ if ( str::split( buffer, std::back_inserter(words) ) != 2 )
+ ZYPP_THROW (Exception( "corrupt file " + cookiefile.asString() ) );
+
+ status.setTimestamp(Date(str::strtonum