X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Ftransitions.py;h=7c47f880a4e922f2e1621641ceafaeeb2106d55b;hb=4b277e613887f5103cd2ab64262fe29ad1bf7540;hp=a37dbef9f1da7b8bb27ec3d388114af47b68a214;hpb=c9e12bb14c839b31d48db95406b4497bb4cdffde;p=dak.git diff --git a/dak/transitions.py b/dak/transitions.py index a37dbef9..7c47f880 100755 --- a/dak/transitions.py +++ b/dak/transitions.py @@ -23,20 +23,19 @@ ################################################################################ -import os, pg, sys, time, errno, fcntl, tempfile, pwd, re +import os, pg, sys, time, errno, fcntl, tempfile, pwd import apt_pkg from daklib import database from daklib import utils from daklib.dak_exceptions import TransitionsError -import syck +from daklib.regexes import re_broken_package +import yaml # Globals Cnf = None Options = None projectB = None -re_broken_package = re.compile(r"[a-zA-Z]\w+\s+\-.*") - ################################################################################ ##################################### @@ -105,10 +104,10 @@ def load_transitions(trans_file): sourcecontent = sourcefile.read() failure = False try: - trans = syck.load(sourcecontent) - except syck.error, msg: + trans = yaml.load(sourcecontent) + except yaml.YAMLError, exc: # Someone fucked it up - print "ERROR: %s" % (msg) + print "ERROR: %s" % (exc) return None # lets do further validation here @@ -219,7 +218,7 @@ def write_transitions(from_trans): temp_lock = lock_file(trans_temp) destfile = file(trans_temp, 'w') - syck.dump(from_trans, destfile) + yaml.dump(from_trans, destfile, default_flow_style=False) destfile.close() os.rename(trans_temp, trans_file) @@ -259,7 +258,7 @@ def temp_transitions_file(transitions): (fd, path) = tempfile.mkstemp("", "transitions", Cnf["Transitions::TempPath"]) os.chmod(path, 0644) f = open(path, "w") - syck.dump(transitions, f) + yaml.dump(transitions, f, default_flow_style=False) return path ################################################################################