~ubuntu-branches/ubuntu/saucy/quassel/saucy-proposed

« back to all changes in this revision

Viewing changes to src/common/genversion.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-02-17 12:49:50 UTC
  • mto: This revision was merged to the branch mainline in revision 59.
  • Revision ID: james.westby@ubuntu.com-20100217124950-v9hajw5d2xa6fszn
Tags: upstream-0.6~beta1
ImportĀ upstreamĀ versionĀ 0.6~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
100
100
    verfile.close();
101
101
  }
102
102
 
103
 
  // ok, create our version.gen now
 
103
  // generate the contents for version.gen
 
104
  QByteArray contents = QString("QString buildinfo = \"%1,%2,%3,%4,%5,%6,%7,%8\";\n")
 
105
                                .arg(basever, descrver, dirty, committish, commitdate, protover, clientneeds, coreneeds)
 
106
                                .toAscii();
 
107
 
104
108
  QFile gen(target);
105
 
  if(!gen.open(QIODevice::WriteOnly | QIODevice::Text)) {
 
109
  if(!gen.open(QIODevice::ReadWrite | QIODevice::Text)) {
106
110
    qFatal("%s", qPrintable(QString("Could not write %1!").arg(target)));
107
111
    return EXIT_FAILURE;
108
112
  }
109
 
  gen.write(QString("QString buildinfo = \"%1,%2,%3,%4,%5,%6,%7,%8\";\n")
110
 
           .arg(basever, descrver, dirty, committish, commitdate, protover, clientneeds, coreneeds).toAscii());
 
113
  QByteArray oldContents = gen.readAll();
 
114
  if(oldContents != contents) { // only touch the file if something changed
 
115
    gen.seek(0);
 
116
    gen.write(contents);
 
117
    gen.waitForBytesWritten(10000);
 
118
  }
111
119
  gen.close();
 
120
 
112
121
  return EXIT_SUCCESS;
113
122
}