コード例 #1
0
ファイル: RpmBackEnd.cpp プロジェクト: marigostra/deepsolver
bool RpmBackEnd::transaction(const StringVector& toInstall,
			     const StringVector& toRemove,
			     const StringToStringMap& toUpgrade,
			     const StringToStringMap& toDowngrade)
{
  if (!toDowngrade.empty())
    throw NotImplementedException("Downgrading tasks in a transaction");
  logMsg(LOG_DEBUG, "backend:starting transaction with %zu packages to install, %zu packages to remove, %zu packages to upgrade and %zu packages to downgrade", toInstall.size(), toRemove.size(), toUpgrade.size(), toDowngrade.size());
  for(StringVector::size_type i = 0;i < toInstall.size();i++)
    logMsg(LOG_DEBUG, "backend:%s to install", toInstall[i].c_str());
  for(StringVector::size_type i = 0;i < toRemove.size();i++)
    logMsg(LOG_DEBUG, "backend:%s to remove", toRemove[i].c_str());
  for(StringToStringMap::const_iterator it = toUpgrade.begin();it != toUpgrade.end();it++)
    logMsg(LOG_DEBUG, "backend:%s -> %s to upgrade", it->first.c_str(), it->second.c_str());
  for(StringToStringMap::const_iterator it = toDowngrade.begin();it != toDowngrade.end();it++)
    logMsg(LOG_DEBUG, "backend:%s -> %s to downgrade", it->first.c_str(), it->second.c_str());
  RpmTransaction transact;
  transact.init();
  transact.process(toInstall, toRemove, toUpgrade, toDowngrade);
  transact.close();
  logMsg(LOG_DEBUG, "backend:transaction is completed");
  return 1;
}
コード例 #2
0
ファイル: FilesFetch.cpp プロジェクト: marigostra/deepsolver
DEEPSOLVER_BEGIN_NAMESPACE

void FilesFetch::fetch(const StringToStringMap& files)
{
  curlInitialize();
  m_lastPartPercents = 0;
  m_lastTotalPercents = 0;
  m_partCount = files.size();
  m_currentPartNumber = 0;
  for(StringToStringMap::const_iterator it = files.begin();it != files.end();it++)
    {
      logMsg(LOG_DEBUG, "fetch:fetching \'%s\'", it->first.c_str());
      m_currentFileName = it->first;
      processFile(it->first, it->second);
      m_currentPartNumber++;
    }
}
コード例 #3
0
ファイル: RepoParams.cpp プロジェクト: marigostra/deepsolver
static void writeInfoFileParamsToDisk(const std::string& fileName, const StringToStringMap& params)
{
  std::ostringstream ss;
  time_t t;
  time(&t);
  ss << "# Deepsolver repository index information file" << std::endl;
  ss << "# Generated on " << ctime(&t);
  ss << "#" << std::endl;
  ss << "# This file was created automatically. Do not edit!" << std::endl;
  ss << "#" << std::endl;
  ss << std::endl;
  for(StringToStringMap::const_iterator it = params.begin();it != params.end();it++)
      ss << it->first << " = " << escapeString(it->second) << std::endl;
  File f;
  f.create(fileName);
  f.write(ss.str().c_str(), ss.str().length());
}
コード例 #4
0
void RpmTransaction::addToTransactionUpgrade(const StringToStringMap& files)
{
  for (StringToStringMap::const_iterator it = files.begin();it != files.end();it++)
    {
      FD_t fd = Fopen(it->second.c_str(), "r.ufdio");
      if (fd == NULL)
	throw PkgBackEndException("Fopen(" + it->second + ")");
      Header hdr;
      int rc = rpmReadPackageHeader(fd, &hdr, 0, NULL, NULL);
      if (rc != 0)
	throw PkgBackEndException("rpmReadPackageHeader()");
      rc = rpmtransAddPackage(m_ts, hdr, NULL, it->second.c_str(), 1, 0);
      if (rc != 0)
	throw PkgBackEndException("rpmtransAddPackage()");
      headerFree(hdr);
      Fclose(fd);
    }
}
コード例 #5
0
void HunspellInterface::UpdatePossibleValues(SpellCheckEngineOption& OptionDependency, SpellCheckEngineOption& OptionToUpdate)
{
  if ((OptionDependency.GetName().IsSameAs(_T("dictionary-path"))) && (OptionToUpdate.GetName().IsSameAs(_T("language"))))
  {
    StringToStringMap tempLookupMap;
    wxString strDictionaryPath = OptionDependency.GetValueAsString();
    PopulateDictionaryMap(&tempLookupMap, strDictionaryPath);

    StringToStringMap::iterator start = tempLookupMap.begin();
    StringToStringMap::iterator stop = tempLookupMap.end();
    while (start != stop)
    {
      OptionToUpdate.AddPossibleValue((*start).first);
      start++;
    }
  }
  else
  {
    wxMessageOutput* msgOut = wxMessageOutput::Get();
    if (msgOut)
      msgOut->Printf(_T("Unsure how to update the possible values for %s based on the value of %s"), OptionDependency.GetText().c_str(), OptionToUpdate.GetText().c_str());
  }
}
コード例 #6
0
ファイル: RepoParams.cpp プロジェクト: marigostra/deepsolver
void RepoParams::readInfoFile(const std::string& fileName)
{
  File f;
  logMsg(LOG_DEBUG, "Opening \'%s\' info file in read-only mode", fileName.c_str());
  f.openReadOnly(fileName);
  std::string content;
  f.readTextFile(content);
  InfoFileReader reader;
  StringToStringMap params;
  reader.read(content, params);
  for(StringToStringMap::const_iterator it = params.begin();it != params.end();it++)
    {
      const std::string& name = it->first;
      const std::string& value = it->second;
      logMsg(LOG_DEBUG, "%s:parsing \'%s\' = \'%s\'", fileName.c_str(), name.c_str(), value.c_str());
      //Format type;
      if (trim(name) == INFO_FILE_FORMAT_TYPE)
	{
	  if (trim(value) == INFO_FILE_FORMAT_TYPE_TEXT)
	    formatType = FormatTypeText; else
	    if (trim(value) == INFO_FILE_FORMAT_TYPE_BINARY)
	      formatType = FormatTypeBinary; else
	      throw InfoFileValueException(InfoFileValueException::InvalidFormatType, trim(value));
	  continue;
	} //Format type;
      //Compression type;
      if (trim(name) == INFO_FILE_COMPRESSION_TYPE)
	{
	  if (trim(value) == INFO_FILE_COMPRESSION_TYPE_NONE)
	    compressionType = CompressionTypeNone; else
	    if (trim(value) == INFO_FILE_COMPRESSION_TYPE_GZIP)
	      compressionType = CompressionTypeGzip; else
	      throw InfoFileValueException(InfoFileValueException::InvalidCompressionType, trim(value));
	  continue;
	} //Compression type;
      //Version;
      if (trim(name) == INFO_FILE_VERSION)
	{
	  version = trim(value);
	  continue;
	} //Version;
      //Md5sum;
      if (trim(name) == INFO_FILE_MD5SUM)
	{
	md5sumFileName = trim(value);
	continue;
	} //Md5sum;
      // Change log binary;
      if (trim(name) == INFO_FILE_CHANGELOG_BINARY)
	{
	  changeLogBinary = parseBooleanValue(trim(value), trim(name));
	  continue;
	} //Change log binary;
      //Change log sources;
      if (trim(name) == INFO_FILE_CHANGELOG_SOURCES)
	{
	  changeLogSources = parseBooleanValue(trim(value), trim(name));
	  continue;
	} //Change log sources;
      //Filter provides by references;
      if (trim(name) == INFO_FILE_FILTER_PROVIDES_BY_REFS)
	{
	  filterProvidesByRefs = parseBooleanValue(trim(value), trim(name));
	  continue;
	}
      //Filter provides by dirs;
      if (trim(name) == INFO_FILE_FILTER_PROVIDES_BY_DIRS)
	{
	  parseStringVector(trim(value), filterProvidesByDirs);
	  continue;
	} //Filter provides by dirs;
      //Exclude requires;
      if (trim(name) == INFO_FILE_EXCLUDE_REQUIRES)
	{
	  parseStringVector(trim(value), excludeRequiresRegExp);
	  continue;
	}
      userParams.insert(StringToStringMap::value_type(trim(name), trim(value)));
    } //for(values);
}