コード例 #1
0
 def fix_pickle_encoding(self, old_encoding):
     """Do the equivalent of master/contrib/fix_pickle_encoding.py"""
     changes_file = os.path.join(self.basedir, "changes.pck")
     with open(changes_file) as fp:
         changemgr = pickle.load(fp)
     changemgr.recode_changes(old_encoding, quiet=True)
     with open(changes_file, "w") as fp:
         pickle.dump(changemgr, fp)
コード例 #2
0
ファイル: test_upgrade.py プロジェクト: Apogeya/buildbot
 def fix_pickle_encoding(self, old_encoding):
     """Do the equivalent of master/contrib/fix_pickle_encoding.py"""
     changes_file = os.path.join(self.basedir, "changes.pck")
     with open(changes_file) as fp:
         changemgr = pickle.load(fp)
     changemgr.recode_changes(old_encoding, quiet=True)
     with open(changes_file, "w") as fp:
         pickle.dump(changemgr, fp)
コード例 #3
0
ファイル: change_import.py プロジェクト: Apogeya/buildbot
 def make_pickle(self, *changes, **kwargs):
     recode_fn = kwargs.pop('recode_fn', None)
     # this uses the now-defunct ChangeMaster, which exists only in the
     # buildbot.util.pickle module
     cm = pickle.ChangeMaster()
     cm.changes = changes
     if recode_fn:
         recode_fn(cm)
     with open(self.changes_pickle, "wb") as f:
         pickle.dump(cm, f)
コード例 #4
0
ファイル: change_import.py プロジェクト: zozo123/buildbot
 def make_pickle(self, *changes, **kwargs):
     recode_fn = kwargs.pop('recode_fn', None)
     # this uses the now-defunct ChangeMaster, which exists only in the
     # buildbot.util.pickle module
     cm = pickle.ChangeMaster()
     cm.changes = changes
     if recode_fn:
         recode_fn(cm)
     with open(self.changes_pickle, "wb") as f:
         pickle.dump(cm, f)
コード例 #5
0
ファイル: builder.py プロジェクト: PeterDaveHello/buildbot
 def saveYourself(self):
     for b in self.currentBuilds:
         if not b.isFinished:
             # interrupted build, need to save it anyway.
             # BuildStatus.saveYourself will mark it as interrupted.
             b.saveYourself()
     filename = os.path.join(self.basedir, "builder")
     tmpfilename = filename + ".tmp"
     try:
         with open(tmpfilename, "wb") as f:
             pickle.dump(self, f, -1)
         if runtime.platformType == 'win32':
             # windows cannot rename a file on top of an existing one
             if os.path.exists(filename):
                 os.unlink(filename)
         os.rename(tmpfilename, filename)
     except Exception:
         log.msg("unable to save builder %s" % self.name)
         log.err()
コード例 #6
0
ファイル: builder.py プロジェクト: trmiller/buildbot
 def saveYourself(self):
     for b in self.currentBuilds:
         if not b.isFinished:
             # interrupted build, need to save it anyway.
             # BuildStatus.saveYourself will mark it as interrupted.
             b.saveYourself()
     filename = os.path.join(self.basedir, "builder")
     tmpfilename = filename + ".tmp"
     try:
         with open(tmpfilename, "wb") as f:
             pickle.dump(self, f, -1)
         if runtime.platformType == 'win32':
             # windows cannot rename a file on top of an existing one
             if os.path.exists(filename):
                 os.unlink(filename)
         os.rename(tmpfilename, filename)
     except Exception:
         log.msg("unable to save builder %s" % self.name)
         log.err()
コード例 #7
0
ファイル: build.py プロジェクト: timt1961/buildbot
 def saveYourself(self):
     filename = os.path.join(self.builder.basedir, "%d" % self.number)
     if os.path.isdir(filename):
         # leftover from 0.5.0, which stored builds in directories
         shutil.rmtree(filename, ignore_errors=True)
     tmpfilename = filename + ".tmp"
     try:
         with open(tmpfilename, "wb") as f:
             pickle.dump(self, f, -1)
         if runtime.platformType == 'win32':
             # windows cannot rename a file on top of an existing one, so
             # fall back to delete-first. There are ways this can fail and
             # lose the builder's history, so we avoid using it in the
             # general (non-windows) case
             if os.path.exists(filename):
                 os.unlink(filename)
         os.rename(tmpfilename, filename)
     except Exception:
         log.msg("unable to save build %s-#%d" % (self.builder.name,
                                                  self.number))
         log.err()
コード例 #8
0
    if len(args) == 2:
        changes_file = args[0]
        old_encoding = args[1]
    elif len(args) == 1:
        changes_file = "changes.pck"
        old_encoding = args[0]
    else:
        parser.error("Need at least one argument")

    print "opening %s" % (changes_file,)
    try:
        fp = open(changes_file)
    except IOError, e:
        parser.error("Couldn't open %s: %s" % (changes_file, str(e)))

    changemgr = load(fp)
    fp.close()

    print "decoding bytestrings in %s using %s" % (changes_file, old_encoding)
    changemgr.recode_changes(old_encoding)

    changes_backup = changes_file + ".old"
    i = 0
    while os.path.exists(changes_backup):
        i += 1
        changes_backup = changes_file + ".old.%i" % i
    print "backing up %s to %s" % (changes_file, changes_backup)
    os.rename(changes_file, changes_backup)

    dump(changemgr, open(changes_file, "w"))
コード例 #9
0
    if len(args) == 2:
        changes_file = args[0]
        old_encoding = args[1]
    elif len(args) == 1:
        changes_file = "changes.pck"
        old_encoding = args[0]
    else:
        parser.error("Need at least one argument")

    print "opening %s" % (changes_file, )
    try:
        fp = open(changes_file)
    except IOError, e:
        parser.error("Couldn't open %s: %s" % (changes_file, str(e)))

    changemgr = load(fp)
    fp.close()

    print "decoding bytestrings in %s using %s" % (changes_file, old_encoding)
    changemgr.recode_changes(old_encoding)

    changes_backup = changes_file + ".old"
    i = 0
    while os.path.exists(changes_backup):
        i += 1
        changes_backup = changes_file + ".old.%i" % i
    print "backing up %s to %s" % (changes_file, changes_backup)
    os.rename(changes_file, changes_backup)

    dump(changemgr, open(changes_file, "w"))