}
QString gitroot = argv[1];
QString target = argv[2];
- QString version;
+ QString version, commit, archivetime;
if(QFile::exists(gitroot + "/.git")) {
// try to execute git-describe to get a version string
// hmm, Git failed... let's check for version.dist instead
QFile dist(gitroot + "/version.dist");
if(dist.open(QIODevice::ReadOnly | QIODevice::Text)) {
- version = dist.readAll();
+ QRegExp rxCommit("(^[0-9a-f]+)");
+ QRegExp rxTimestamp("(^[0-9]+)");
+ if(rxCommit.indexIn(dist.readLine()) > -1) commit = rxCommit.cap(1);
+ if(rxTimestamp.indexIn(dist.readLine()) > -1) archivetime = rxTimestamp.cap(1);
dist.close();
}
}
}
gen.write(QString("quasselGeneratedVersion = \"%1\";\n"
"quasselBuildDate = \"%2\";\n"
- "quasselBuildTime = \"%3\";\n").arg(version).arg(__DATE__).arg(__TIME__).toAscii());
+ "quasselBuildTime = \"%3\";\n"
+ "quasselCommit = \"%4\";\n"
+ "quasselArchiveDate = %5;\n")
+ .arg(version).arg(__DATE__).arg(__TIME__).arg(commit).arg(archivetime.toUInt()).toAscii());
gen.close();
return EXIT_SUCCESS;
}
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
+#include <QDateTime>
#include <QObject>
#include <QMetaType>
void Global::setupVersion() {
# include "version.inc"
-# ifdef HAVE_VERSION_GEN
-# include "version.gen"
-# endif
+# include "version.gen"
if(quasselGeneratedVersion.isEmpty()) {
- quasselVersion = QString("v%1 (unknown rev)").arg(quasselBaseVersion);
+ if(quasselCommit.isEmpty())
+ quasselVersion = QString("v%1 (unknown rev)").arg(quasselBaseVersion);
+ else
+ quasselVersion = QString("v%1 (dist-%2, %3)").arg(quasselBaseVersion).arg(quasselCommit.left(7))
+ .arg(QDateTime::fromTime_t(quasselArchiveDate).toLocalTime().toString("yyyy-MM-dd"));
} else {
QStringList parts = quasselGeneratedVersion.split(':');
quasselVersion = QString("v%1").arg(parts[0]);
QString Global::quasselGeneratedVersion;
QString Global::quasselBuildDate;
QString Global::quasselBuildTime;
+QString Global::quasselCommit;
+uint Global::quasselArchiveDate;
uint Global::protocolVersion;
uint Global::clientNeedsProtocol;
uint Global::coreNeedsProtocol;
extern QString quasselBaseVersion;
extern QString quasselBuildDate;
extern QString quasselBuildTime;
+ extern QString quasselCommit;
+ extern uint quasselArchiveDate;
extern uint protocolVersion;
extern uint clientNeedsProtocol; //< Minimum protocol version the client needs