-------------------------------------------------------------------
-Sat Nov 4 13:07:50 CET 2006 - mvidner@suse.cz
+Sat Nov 4 15:15:07 CET 2006 - mvidner@suse.cz
+- Ported zypper (except zypp-checkpatches) to libzypp-1.x.x.
- Show patch messages.
-- Callbacks: added compatibility defines for libzypp 1.x.x,
- fixed more warnings about unused variables.
+- Callbacks: fixed more warnings about unused variables.
-------------------------------------------------------------------
Fri Nov 3 17:48:09 CET 2006 - mvidner@suse.cz
void cond_init_target () {
static bool done = false;
if (!done) {
+#ifdef LIBZYPP_1xx
+ cerr_v << "Initializing Target (old way)" << endl;
+ God->initTarget("/", true);
+#else
cerr_v << "Initializing Target" << endl;
God->initializeTarget("/");
+#endif
done = true;
}
}
token_stream << "[" << src.alias() << "| " << src.url() << src.timestamp() << "]";
MIL << "Source: " << src.alias() << " from " << src.timestamp() << std::endl;
}
-
+
+#ifdef LIBZYPP_1xx
+ token_stream << "[" << "target" << "| " << Date::now() << "]"; // too bad
+#else
token_stream << "[" << "target" << "| " << God->target()->timestamp() << "]";
+#endif
//static std::string digest(const std::string& name, std::istream& is
token = Digest::digest("sha1", token_stream);
}
-/*
-static void print_source_list( const std::list<zypp::source::SourceInfo> &sources )
-{
- for( std::list<zypp::source::SourceInfo>::const_iterator it = sources.begin() ;
- it != sources.end() ; ++it )
- {
- SourceInfo source = *it;
- cout << ( source.enabled() ? "[x]" : "[ ]" );
- cout << ( source.autorefresh() ? "* " : " " );
- if ( source.alias() != source.url().asString() )
- cout << source.alias() << " (" << source.url() << ")" << endl;
- else
- cout << source.url() << endl;
- }
-}*/
+#ifdef LIBZYPP_1xx
+typedef zypp::SourceManager::SourceInfo SourceInfo;
+#else
+using zypp::source::SourceInfo;
+#endif
-static void print_source_list(const std::list<zypp::source::SourceInfo> &sources )
+static void print_source_list(const std::list<SourceInfo> &sources )
{
Table tbl;
TableHeader th;
tbl << th;
int i = 1;
- for( std::list<zypp::source::SourceInfo>::const_iterator it = sources.begin() ;
+ for( std::list<SourceInfo>::const_iterator it = sources.begin() ;
it != sources.end() ; ++it, ++i )
{
SourceInfo source = *it;
// this is probably the closest possible compatibility arrangement
if (gSettings.is_rug_compatible)
{
+#ifdef LIBZYPP_1xx
+ tr << "Active";
+#else
tr << (source.enabled() ? "Active" : "Disabled");
+#endif
}
// zypper status (enabled, autorefresh)
else
{
+#ifdef LIBZYPP_1xx
+ tr << "Yes";
+ tr << (source.autorefresh ? "Yes" : "No");
+#else
tr << (source.enabled() ? "Yes" : "No");
tr << (source.autorefresh() ? "Yes" : "No");
+#endif
}
+#ifdef LIBZYPP_1xx
+ tr << source.type;
+ tr << source.alias;
+ tr << source.url.asString();
+#else
tr << source.type();
tr << source.alias();
tr << source.url().asString();
+#endif
tbl << tr;
}
cout << tbl;
void list_system_sources()
{
- zypp::storage::PersistentStorage store;
-
- std::list<zypp::source::SourceInfo> sources;
+ std::list<SourceInfo> sources;
try
{
+#ifdef LIBZYPP_1xx
+ sources = SourceManager::sourceManager()->knownSourceInfos ("/");
+#else
+ zypp::storage::PersistentStorage store;
store.init( "/" );
sources = store.storedSources();
+#endif
}
catch ( const Exception &e )
{
void refresh_sources()
{
+#ifdef LIBZYPP_1xx
+ cerr << "Sorry, not implemented yet for libzypp-1.x.x" << endl;
+#else
zypp::storage::PersistentStorage store;
- std::list<zypp::source::SourceInfo> sources;
+ std::list<SourceInfo> sources;
try
{
exit(-1);
}
- for(std::list<zypp::source::SourceInfo>::const_iterator it = sources.begin();
+ for(std::list<SourceInfo>::const_iterator it = sources.begin();
it != sources.end() ; ++it)
{
try
}
cout << _("All sytem sources have been refreshed.") << endl;
+#endif
}
MediaWrapper::MediaWrapper (const string& filename_or_url) {
cout << "Warning! No sources. Operating only over the installed resolvables. You will not be able to install stuff" << endl;
}
+#ifdef LIBZYPP_1xx
// dont add rpms
+ God->initTarget("/", true);
+#else
God->initializeTarget("/");
+#endif
std::string token = calculate_token();
}
+#ifdef LIBZYPP_1xx
+typedef zypp::SourceManager::SourceInfo SourceInfo;
+#else
+using zypp::source::SourceInfo;
+#endif
+
int main(int argc, char **argv)
{
const char *logfile = getenv("ZYPP_LOGFILE");
KeyRingCallbacks keyring_callbacks;
DigestCallbacks digest_callbacks;
+#ifdef LIBZYPP_1xx
// dont add rpms
+ God->initTarget("/", true);
+#else
God->initializeTarget("/");
+#endif
std::string token;
stringstream token_stream;
+#ifdef LIBZYPP_1xx
+ token_stream << "[" << "target" << "| " << Date::now() << "]"; // too bad
+#else
token_stream << "[" << "target" << "| " << God->target()->timestamp() << "]";
-
- std::list<source::SourceInfo> new_sources = manager->knownSourceInfos("/");
+#endif
+
+ std::list<SourceInfo> new_sources = manager->knownSourceInfos("/");
MIL << "Found " << new_sources.size() << " sources." << endl;
- for ( std::list<source::SourceInfo>::iterator it = new_sources.begin(); it != new_sources.end(); ++it)
+ for ( std::list<SourceInfo>::iterator it = new_sources.begin(); it != new_sources.end(); ++it)
{
+#ifdef LIBZYPP_1xx
+ Url url = it->url;
+#else
Url url = it->url();
+#endif
+
std::string scheme( url.getScheme());
if ( (scheme == "cd" || scheme == "dvd") )
if ( ! it->enabled() )
{
- MIL << "Skipping disabled source: url:[" << it->url().asString() << "] product_dir:[" << it->path() << "] alias:[" << it->alias() << "] cache_dir:[" << it->cacheDir() << "] auto_refresh:[ " << it->autorefresh() << "]" << endl;
+ MIL << "Skipping disabled source: url:[" << url.asString() << "] product_dir:[" << it->path() << "] alias:[" << it->alias() << "] cache_dir:[" << it->cacheDir() << "] auto_refresh:[ " << it->autorefresh() << "]" << endl;
continue;
}
// Note: Url(it->url).asString() to hide password in logs
- MIL << "Creating source: url:[" << it->url().asString() << "] product_dir:[" << it->path() << "] alias:[" << it->alias() << "] cache_dir:[" << it->cacheDir() << "] auto_refresh:[ " << it->autorefresh() << "]" << endl;
+ MIL << "Creating source: url:[" << url.asString() << "] product_dir:[" << it->path() << "] alias:[" << it->alias() << "] cache_dir:[" << it->cacheDir() << "] auto_refresh:[ " << it->autorefresh() << "]" << endl;
try
{
- Source_Ref src = SourceFactory().createFrom(it->type(), it->url(), it->path(), it->alias(), it->cacheDir(), false, it->autorefresh());
+ Source_Ref src = SourceFactory().createFrom(it->type(), url, it->path(), it->alias(), it->cacheDir(), false, it->autorefresh());
src.refresh();
token_stream << "[" << src.alias() << "| " << src.url() << src.timestamp() << "]";
MIL << "Source: " << src.alias() << " from " << src.timestamp() << std::endl;
// skip sources without patches sources for now
- if ( src.hasResolvablesOfKind( ResTraits<zypp::Patch>::kind ) )
+ bool has_patches = true;
+#ifndef LIBZYPP_1xx
+ has_patches = src.hasResolvablesOfKind( ResTraits<zypp::Patch>::kind );
+#endif
+ if ( has_patches )
{
MIL << "Including source " << src.url() << std::endl;
gData.sources.push_back(src);