Author: mlandres Date: Wed Oct 22 17:20:03 2008 New Revision: 11455 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11455&view=rev Log: remove unused code Modified: trunk/libzypp/zypp/RepoManager.cc Modified: trunk/libzypp/zypp/RepoManager.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/RepoManager.cc?rev=11455&r1=11454&r2=11455&view=diff ============================================================================== --- trunk/libzypp/zypp/RepoManager.cc (original) +++ trunk/libzypp/zypp/RepoManager.cc Wed Oct 22 17:20:03 2008 @@ -1904,183 +1904,6 @@ return repo::ServiceType::NONE; } -#if 0 - //////////////////////////////////////////////////////////////////////////// - // - // Misc. utils - // - //////////////////////////////////////////////////////////////////////////// - - bool RepoManager::getLicenseFiles(const RepoInfo & repo, const Pathname & target) - { - Pathname lpack; - for_(url, repo.baseUrlsBegin(), repo.baseUrlsEnd()) - { - // try to get /licenses.tar.gz - MediaSetAccess access(*url); - lpack = access.provideOptionalFile("/license.tar.gz"); - - // try to get /media.1/license.zip (SLE10, openSUSE10.2 used this) - if (lpack.empty()) - { - DBG << "/license.tar.gz not found, trying /media.1/license.zip" << endl; - lpack = access.provideOptionalFile("/media.1/license.zip"); - } - // unpack license.tar.gz to target dir - else - { - DBG << "got /license.tar.gz, unpacking..." << endl; - - const char* const argv[] = - { - "tar", - "-xz", - "-f", - lpack.asString().c_str(), - "-C", - target.asString().c_str(), - NULL - }; - - // execute tar in / (we dont know if there is a tar below _root !) - ExternalProgram tar(argv, ExternalProgram::Stderr_To_Stdout, false, -1, true); - - string tarmsg; - for (string output = tar.receiveLine(); output.length() ;output = tar.receiveLine()) - tarmsg += output; - - int ret = tar.close(); - if ( ret != 0 ) - { - ERR << "extracting licenses from tar failed: " << tarmsg << endl; - return false; - } - - break; - } - - if (lpack.empty()) - { - MIL << "No repository license to confirm for " << repo.alias() << endl; - return false; - } - // unpack license.zip to target dir - else - { - DBG << "got /media.1/license.zip, unpacking..." << endl; - break; - } - } - - // check whether the target dir contains license files - std::list<Pathname> files; - - if ( filesystem::readdir( files, target, false ) != 0 ) - { - ERR << "Cannot read the target directory" << endl; - return false; - } - - str::regex lfilesregex( "^license\\.?(.*)\\.txt$" ); - for_( it, files.begin(), files.end() ) - { - const string & filename = it->basename(); - if ( str::regex_match( filename, lfilesregex ) ) - return true; - } - - return false; - } - - //////////////////////////////////////////////////////////////////////////// - - Pathname RepoManager::getLicenseFile( const Pathname & ldir ) - { - return getLicenseFile(ldir, ZConfig::instance().defaultTextLocale()); - } - - //////////////////////////////////////////////////////////////////////////// - - Pathname RepoManager::getLicenseFile( const Pathname & ldir, const Locale & locale ) - { - MIL << "Looking for license file suitable for locale " - << locale << " in directory " << ldir << endl; - - std::list<Pathname> files; - std::set<Locale> available; - - if ( filesystem::readdir( files, ldir, false ) != 0 ) - { - ERR << "Cannot read the directory." << endl; - return Pathname(); - } - - str::regex lfilesregex("^license\\.?(.*)\\.txt$"); - for_( it, files.begin(), files.end() ) - { - const string & filename = it->basename(); - str::smatch what; - if( str::regex_match(filename, what, lfilesregex) ) - { - Locale l( what[1].empty() ? "" : what[1] ); - DBG << "got license file " << *it << ", locale: " << l << endl; - - if ( locale == l ) - { - MIL << "got license file " << *it << " for locale " << locale << endl; - return *it; - } - else - available.insert(l); - } - else - XXX << "got unknown file: " << it->basename() << endl; - } - - DBG << "No license file found for locale " << locale << endl; - - // fall back to language code only - if ( locale.country().hasCode() ) - { - Locale l(locale.language()); - std::set<Locale>::const_iterator it = available.find(l); - if ( it != available.end() ) - { - Pathname ret = ldir / ("license."+l.code()+".txt"); - MIL << "Got match for locale " << l << ", returning " << ret << endl; - return ret; - } - } - - Pathname def; - // check for en_US - if (PathInfo(ldir/"license.en_US.txt").isFile()) - def = ldir/"license.en_US.txt"; - // check for en_GB - if (PathInfo(ldir/"license.en_GB.txt").isFile()) - def = ldir/"license.en_GB.txt"; - // check for en - if (PathInfo(ldir/"license.en.txt").isFile()) - def = ldir/"license.en.txt"; - // check for default - if (PathInfo(ldir/"license.txt").isFile()) - def = ldir/"license.txt"; - - MIL << "Returning '" << def << "'" << endl; - - return def; - } - - //////////////////////////////////////////////////////////////////////////// - - std::set<Locale> getAvailableLicenseLocales( const Pathname & ldir ) - { - return std::set<Locale>(); -#warning getAvailableLicenseLocales not yet implemented - } - - // Pathname getInfoFile( const RepoInfo & repo ) media.1/info.txt -#endif //////////////////////////////////////////////////////////////////////////// std::ostream & operator<<( std::ostream & str, const RepoManager & obj ) -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org