Пример #1
0
	bool exec()
	{
		if(getenv("QC_VERBOSE") == "Y")
			do_debug = true;

		ConfObjListIt it(list);
		for(ConfObj *o; (o = it.current()); ++it) {
			// if this was a disabled-by-default option, check if it was enabled
			if(o->disabled) {
				QString v = QString("QC_ENABLE_") + o->shortname();
				if(getenv(v) != "Y")
					continue;
			}
			// and the opposite?
			else {
				QString v = QString("QC_DISABLE_") + o->shortname();
				if(getenv(v) == "Y")
					continue;
			}

			QString check = o->checkString();
			if(check.isEmpty())
				check = QString("Checking for %1 ...").arg(o->name());
			printf("%s", check.latin1());
			fflush(stdout);

			done_debug = false;
			bool ok = o->exec();

			QString result = o->resultString();
			if(result.isEmpty()) {
				if(ok)
					result = "yes";
				else
					result = "no";
			}
			if(done_debug)
				printf(" -> %s\n", result.latin1());
			else
				printf(" %s\n", result.latin1());

			if(!ok && o->required) {
				printf("\nError: need %s!\n", o->name().latin1());
				return false;
			}
		}
		return true;
	}
Пример #2
0
bool Conf::exec()
{
	for(int n = 0; n < list.count(); ++n)
	{
		ConfObj *o = list[n];

		// if this was a disabled-by-default option, check if it was enabled
		if(o->disabled)
		{
			QString v = QString("QC_ENABLE_") + qc_escapeArg(o->shortname());
			if(getenv(v) != "Y")
				continue;
		}
		// and the opposite?
		else
		{
			QString v = QString("QC_DISABLE_") + qc_escapeArg(o->shortname());
			if(getenv(v) == "Y")
				continue;
		}

		bool output = true;
		QString check = o->checkString();
		if(check.isEmpty())
			output = false;

		if(output)
		{
			printf("%s", check.toLatin1().data());
			fflush(stdout);
		}

		first_debug = true;
		bool ok = o->exec();
		o->success = ok;

		if(output)
		{
			QString result = o->resultString();
			if(!first_debug)
				printf(" -> %s\n", result.toLatin1().data());
			else
				printf(" %s\n", result.toLatin1().data());
		}

		if(!ok && o->required)
		{
			printf("\nError: need %s!\n", o->name().toLatin1().data());
			return false;
		}
	}
	return true;
}