Index: branches/ariel/xmldumps-backup/incrementals/IncrDumpLib.py |
— | — | @@ -85,11 +85,10 @@ |
86 | 86 | self.statusFile = StatusFile(self._config, self.date, self.wikiName) |
87 | 87 | |
88 | 88 | def getStatus(self, date = None): |
| 89 | + status = "" |
89 | 90 | if exists(self.statusFile.getPath(date)): |
90 | 91 | status = FileUtils.readFile(self.statusFile.getPath(date)).rstrip() |
91 | | - if status == "done": |
92 | | - return True |
93 | | - return False |
| 92 | + return(status) |
94 | 93 | |
95 | 94 | def setStatus(self, status): |
96 | 95 | FileUtils.writeFileInPlace(self.statusFile.getPath(),status, self._config.fileperms) |
Index: branches/ariel/xmldumps-backup/incrementals/generateincrementals.py |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | self.OK = 0 |
29 | 29 | |
30 | 30 | class IncrDump(object): |
31 | | - def __init__(self,config, date, wikiName, doStubs, doRevs, dryrun, verbose): |
| 31 | + def __init__(self,config, date, wikiName, doStubs, doRevs, dryrun, verbose, forcerun): |
32 | 32 | self._config = config |
33 | 33 | self.date = date |
34 | 34 | self.wikiName = wikiName |
— | — | @@ -35,6 +35,7 @@ |
36 | 36 | self.doStubs = doStubs |
37 | 37 | self.doRevs = doRevs |
38 | 38 | self.dryrun = dryrun |
| 39 | + self.forcerun = forcerun |
39 | 40 | self.maxRevIDFile = MaxRevIDFile(self._config, self.date, self.wikiName) |
40 | 41 | self.statusInfo = StatusInfo(self._config, self.date, self.wikiName) |
41 | 42 | self.stubFile = StubFile(self._config, self.date, self.wikiName) |
— | — | @@ -54,7 +55,7 @@ |
55 | 56 | if not exists(self.incrDir.getIncDir(self.wikiName)): |
56 | 57 | os.makedirs(self.incrDir.getIncDir(self.wikiName)) |
57 | 58 | status = self.statusInfo.getStatus() |
58 | | - if status == "done": |
| 59 | + if status == "done" and not forcerun: |
59 | 60 | if (self.verbose): |
60 | 61 | print "wiki",self.wikiName,"skipped, adds/changes dump already complete" |
61 | 62 | return retCodes.OK |
— | — | @@ -170,20 +171,21 @@ |
171 | 172 | return False |
172 | 173 | |
173 | 174 | class IncrDumpLoop(object): |
174 | | - def __init__(self, config, date, doStubs, doRevs, dryrun, verbose): |
| 175 | + def __init__(self, config, date, doStubs, doRevs, dryrun, verbose, forcerun): |
175 | 176 | self._config = config |
176 | 177 | self.date = date |
177 | 178 | self.doStubs = doStubs |
178 | 179 | self.doRevs = doRevs |
179 | 180 | self.dryrun = dryrun |
180 | 181 | self.verbose = verbose |
| 182 | + self.forcerun = forcerun |
181 | 183 | |
182 | 184 | def doRunOnAllWikis(self): |
183 | 185 | retCodes = DumpResults() |
184 | 186 | failures = 0 |
185 | 187 | todos = 0 |
186 | 188 | for w in self._config.allWikisList: |
187 | | - dump = IncrDump(config, date, w, doStubs, doRevs, dryrun, self.verbose) |
| 189 | + dump = IncrDump(self._config, self.date, w, self.doStubs, self.doRevs, self.dryrun, self.verbose, self.forcerun) |
188 | 190 | result = dump.doOneWiki() |
189 | 191 | if result == retCodes.FAILED: |
190 | 192 | failures = failures + 1 |
— | — | @@ -212,6 +214,7 @@ |
213 | 215 | print "--configfile: Specify an alternate config file to read. Default file is 'dumpincr.conf' in the current directory." |
214 | 216 | print "--date: (Re)run incremental of a given date (use with care)." |
215 | 217 | print "--dryrun: Don't actually dump anything but print the commands that would be run." |
| 218 | + print "--forcerun: Do the run even if there is already a successful run in place." |
216 | 219 | print "--revsonly: Do only the stubs part of the dumps." |
217 | 220 | print "--stubsonly: Do only the revision text part of the dumps." |
218 | 221 | print "--verbose: Print error messages and other informative messages (normally the" |
— | — | @@ -227,10 +230,11 @@ |
228 | 231 | doRevs = True |
229 | 232 | dryrun = False |
230 | 233 | verbose = False |
| 234 | + forcerun = False |
231 | 235 | |
232 | 236 | try: |
233 | 237 | (options, remainder) = getopt.gnu_getopt(sys.argv[1:], "", |
234 | | - ['date=', 'configfile=', 'stubsonly', 'revsonly', 'dryrun', 'verbose' ]) |
| 238 | + ['date=', 'configfile=', 'stubsonly', 'revsonly', 'dryrun', 'verbose', 'forcerun' ]) |
235 | 239 | except: |
236 | 240 | usage("Unknown option specified") |
237 | 241 | |
— | — | @@ -247,6 +251,8 @@ |
248 | 252 | dryrun = True |
249 | 253 | elif opt == "--verbose": |
250 | 254 | verbose = True |
| 255 | + elif opt == "--forcerun": |
| 256 | + forcerun = True |
251 | 257 | |
252 | 258 | if not doRevs and not doStubs: |
253 | 259 | usage("You may not specify stubsonly and revsonly options together.") |
— | — | @@ -263,5 +269,5 @@ |
264 | 270 | dump = IncrDump(config, date, remainder[0], doStubs, doRevs, dryrun, verbose) |
265 | 271 | dump.doOneWiki() |
266 | 272 | else: |
267 | | - dump = IncrDumpLoop(config, date, doStubs, doRevs, dryrun, verbose) |
| 273 | + dump = IncrDumpLoop(config, date, doStubs, doRevs, dryrun, verbose, forcerun) |
268 | 274 | dump.doAllWikisTilDone(3) |