def tweaker(snap,src_snap): old_desc = upgrade.get_description(src_snap) old_version = upgrade.get_version(src_snap) if old_desc and not old_desc.endswith('\n'): old_desc=old_desc+'\n' old_desc = old_desc + 'upgraded from '+old_version+'\n' upgrade.set_version(snap,version.version) upgrade.set_upgrade(snap,True) upgrade.set_description(snap,old_desc) snap.save(0,'upgraded to %s' % version.version)
def edit_file(self,orig,path,desc=''): if orig!=path: os.rename(orig,path) database = state.open_database(path,True) trunk = database.get_trunk() upgrade.set_description(trunk,desc) trunk.save(piw.tsd_time(),'') database.flush() self.setups_changed(path)
def edit_setup(self, orig, slot, tag, desc): self.savcond.acquire() try: if self.quitting: return else: self.saving = True finally: self.savcond.release() path = agentd.user_setup_file(slot, tag) if orig != path: orig_d = os.path.dirname(orig) orig_f = os.path.basename(orig) path_d = os.path.dirname(path) path_f = os.path.basename(path) for f in resource.os_listdir(orig_d): if f.startswith(orig_f): f2 = os.path.join(path_d, path_f + f[len(orig_f):]) resource.os_rename(os.path.join(orig_d, f), f2) database = state.open_database(path, True) trunk = database.get_trunk() upgrade.set_description(trunk, desc) trunk.save(piw.tsd_time(), '') database.flush() self.setups_changed(path) self.savcond.acquire() try: self.saving = False self.savcond.notify() finally: self.savcond.release() print 'editing complete', path self.info_dialog( 'Setup Edited', 'Setup Edited', "The user setup '" + slot + "' was successfully edited") return path
def save_tweaker(snap,src_snap): upgrade.set_upgrade(snap,False) upgrade.set_description(snap,description)
def annotate(file,text): database = state.open_database(file,True) trunk = database.get_trunk() upgrade.set_description(trunk,text) trunk.save(piw.tsd_time(),'') database.flush()