示例#1
0
void check(JobInfoPtr info)
{
  if(info->isSuccess())
    cout << "SUCCESS: " << info->getMessage() << " prog=" << info->getCurrent()
         << "/" << info->getTotal() << endl;
  else
    cout << "FAILURE: " << info->getMessage() << endl;
}
示例#2
0
void inst(const std::string &where, bool doUpgrade)
{
  cout << "\nINSTALLING to " << where << endl;
  JobInfoPtr inf = spr->installPack("test", "test", where, NULL, false, doUpgrade);
  if(inf)
    if(inf->isSuccess()) cout << "SUCCESS!\n";
    else inf->failError();
  else cout << "NO JOB EXECUTED\n";
  printDir(where);
}
示例#3
0
void uninst(const std::string &where)
{
  cout << "\nUNINSTALLING " << where << endl;
  JobInfoPtr inf = spr->uninstallPack("test", "test", where, false);
  if(inf)
    if(inf->isSuccess()) cout << "SUCCESS!\n";
    else inf->failError();
  else cout << "NO JOB EXECUTED\n";
  shortStatus(*spr);
  if(bf::exists(where)) throw runtime_error("ERROR: dir still exists!\n");
}
示例#4
0
void testStatus(Job &j)
{
  JobInfoPtr info = j.getInfo();

  if(info->isBusy()) cout << "Busy!";
  else if(!info->hasStarted()) cout << "Not started yet!";
  else if(info->isSuccess()) cout << "Success!";
  else if(info->isError()) cout << "Failure: " << info->getMessage();
  else if(info->isAbort()) cout << "Abort!";
  cout << "  - progress " << info->getCurrent() << "/" << info->getTotal() << endl;
}