Author: dmacvicar Date: Tue Jul 31 17:04:36 2007 New Revision: 6337 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6337&view=rev Log: initial version of a repository migrator Added: trunk/libzypp/tools/migrate-sources/ trunk/libzypp/tools/migrate-sources/CMakeLists.txt trunk/libzypp/tools/migrate-sources/migrate-sources.cc Modified: trunk/libzypp/tools/CMakeLists.txt trunk/libzypp/zypp/repo/RepoType.cc Modified: trunk/libzypp/tools/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tools/CMakeLists.txt?rev=6337&r1=6336&r2=6337&view=diff ============================================================================== --- trunk/libzypp/tools/CMakeLists.txt (original) +++ trunk/libzypp/tools/CMakeLists.txt Tue Jul 31 17:04:36 2007 @@ -1,3 +1,4 @@ ADD_SUBDIRECTORY( registration ) ADD_SUBDIRECTORY( package-manager ) ADD_SUBDIRECTORY( cachetools ) +ADD_SUBDIRECTORY( migrate-sources ) \ No newline at end of file Added: trunk/libzypp/tools/migrate-sources/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tools/migrate-sources/CMakeLists.txt?rev=6337&view=auto ============================================================================== --- trunk/libzypp/tools/migrate-sources/CMakeLists.txt (added) +++ trunk/libzypp/tools/migrate-sources/CMakeLists.txt Tue Jul 31 17:04:36 2007 @@ -0,0 +1,7 @@ +SET( migrate_SRCS +migrate-sources.cc +) + +ADD_EXECUTABLE( migrate-sources ${migrate_SRCS} ) +TARGET_LINK_LIBRARIES( migrate-sources zypp ) +TARGET_LINK_LIBRARIES( migrate-sources xml2 ) \ No newline at end of file Added: trunk/libzypp/tools/migrate-sources/migrate-sources.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/tools/migrate-sources/migrate-sources.cc?rev=6337&view=auto ============================================================================== --- trunk/libzypp/tools/migrate-sources/migrate-sources.cc (added) +++ trunk/libzypp/tools/migrate-sources/migrate-sources.cc Tue Jul 31 17:04:36 2007 @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ + +#include <iostream> +#include <fstream> + +#include "zypp/base/Logger.h" +#include "zypp/ZYpp.h" +#include "zypp/zypp_detail/ZYppReadOnlyHack.h" +#include "zypp/ZYppFactory.h" +#include "zypp/PathInfo.h" +#include "zypp/cache/CacheFSCK.h" + +#include "zypp/parser/xmlstore/XMLSourceCacheParser.h" + +#undef ZYPP_BASE_LOGGER_LOGGROUP +#define ZYPP_BASE_LOGGER_LOGGROUP "zypp-cache" + + +using namespace std; +using namespace zypp; + +static void migrate_sources( const Pathname &root, const Pathname &dir ) +{ + Pathname source_p = root + dir; + + RepoInfoList sources; + DBG << "Reading source cache in " << source_p << std::endl; + + list<Pathname> entries; + if ( filesystem::readdir( entries, source_p, false ) != 0 ) + ZYPP_THROW(Exception("failed to read directory")); + + for ( list<Pathname>::const_iterator it = entries.begin(); it != entries.end(); ++it ) + { + MIL << "Processing " << *it << endl; + + std::ifstream anIstream((*it).c_str()); + zypp::parser::xmlstore::XMLSourceCacheParser iter(anIstream, ""); + for (; ! iter.atEnd(); ++iter) { + RepoInfo data = **iter; + cout << data << endl << endl << endl; + } + + } +} + +void usage() +{ + cout << "Commands:" << endl; + cout << "migrate-sources root-path" << endl; +} + +//----------------------------------------------------------------------------- + +int +main (int argc, char **argv) +{ + MIL << "-------------------------------------" << endl; + + if (argc > 1) + { + migrate_sources(argv[1], "/var/lib/zypp/db/sources"); + } + else + { + usage(); + } + + return 0; +} Modified: trunk/libzypp/zypp/repo/RepoType.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/RepoType.cc?rev=6337&r1=6336&r2=6337&view=diff ============================================================================== --- trunk/libzypp/zypp/repo/RepoType.cc (original) +++ trunk/libzypp/zypp/repo/RepoType.cc Tue Jul 31 17:04:36 2007 @@ -37,8 +37,13 @@ _table["rpmmd"] = RepoType::RPMMD_e; _table["rpm-md"] = RepoType::RPMMD_e; _table["yum"] = RepoType::RPMMD_e; + _table["YUM"] = RepoType::RPMMD_e; _table["susetags"] = RepoType::YAST2_e; _table["yast"] = RepoType::YAST2_e; + _table["YaST"] = RepoType::YAST2_e; + _table["YaST2"] = RepoType::YAST2_e; + _table["YAST"] = RepoType::YAST2_e; + _table["YAST2"] = RepoType::YAST2_e; _table["yast2"] = RepoType::YAST2_e; _table["plaindir"] = RepoType::RPMPLAINDIR_e; _table["NONE"] = _table["none"] = RepoType::NONE_e; -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org