# Globals
Cnf = None #: Configuration, apt_pkg.Configuration
Options = None #: Parsed CommandLine arguments
# Globals
Cnf = None #: Configuration, apt_pkg.Configuration
Options = None #: Parsed CommandLine arguments
if not Cnf.has_key("Edit-Transitions::Options::%s" % (i)):
Cnf["Edit-Transitions::Options::%s" % (i)] = ""
if not Cnf.has_key("Edit-Transitions::Options::%s" % (i)):
Cnf["Edit-Transitions::Options::%s" % (i)] = ""
- projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]))
- database.init(Cnf, projectB)
+ # Initialise DB connection
+ DBConn()
- trans = yaml.load(sourcecontent)
- except yaml.YAMLError, exc:
+ trans = yaml.safe_load(sourcecontent)
+ except yaml.YAMLError as exc:
if errno.errorcode[e.errno] == 'EACCES' or errno.errorcode[e.errno] == 'EEXIST':
print "Unable to get lock for %s (try %d of 10)" % \
(file, retry+1)
if errno.errorcode[e.errno] == 'EACCES' or errno.errorcode[e.errno] == 'EEXIST':
print "Unable to get lock for %s (try %d of 10)" % \
(file, retry+1)
trans_temp = trans_file + ".tmp"
trans_lock = lock_file(trans_file)
temp_lock = lock_file(trans_temp)
destfile = file(trans_temp, 'w')
trans_temp = trans_file + ".tmp"
trans_lock = lock_file(trans_file)
temp_lock = lock_file(trans_temp)
destfile = file(trans_temp, 'w')
- if not os.path.abspath(from_file).startswith(Cnf["Transitions::TempPath"]):
- print "Will not accept transitions file outside of %s" % (Cnf["Transitions::TempPath"])
+ if not os.path.abspath(from_file).startswith(Cnf["Dir::TempPath"]):
+ print "Will not accept transitions file outside of %s" % (Cnf["Dir::TempPath"])
- (fd, path) = tempfile.mkstemp("", "transitions", Cnf["Transitions::TempPath"])
- os.chmod(path, 0644)
+ (fd, path) = tempfile.mkstemp("", "transitions", Cnf["Dir::TempPath"])
+ os.chmod(path, 0o644)
return path
################################################################################
def edit_transitions():
""" Edit the defined transitions. """
return path
################################################################################
def edit_transitions():
""" Edit the defined transitions. """
edit_file = temp_transitions_file(load_transitions(trans_file))
editor = os.environ.get("EDITOR", "vi")
edit_file = temp_transitions_file(load_transitions(trans_file))
editor = os.environ.get("EDITOR", "vi")
- # Will be None if nothing is in testing.
- current = database.get_suite_version(source, "testing")
+ # Will be an empty list if nothing is in testing.
+ sourceobj = get_source_in_suite(source, "testing", session)
info[trans] = get_info(trans, source, expected, t["rm"], t["reason"], t["packages"])
print info[trans]
info[trans] = get_info(trans, source, expected, t["rm"], t["reason"], t["packages"])
print info[trans]
if compare < 0:
# This is still valid, the current version in database is older than
# the new version we wait for
if compare < 0:
# This is still valid, the current version in database is older than
# the new version we wait for
print get_info(trans, source, expected, t["rm"], t["reason"], t["packages"])
print get_info(trans, source, expected, t["rm"], t["reason"], t["packages"])
print "Apt compare says: %s" % (compare)
if compare < 0:
# This is still valid, the current version in database is older than
# the new version we wait for
print "Apt compare says: %s" % (compare)
if compare < 0:
# This is still valid, the current version in database is older than
# the new version we wait for
- print "%s wanted version: %s, has %s" % (source, expected, current)
+ print "%s wanted version: %s, has %s" % (source, expected, sourceobj.version)
print "-------------------------------------------------------------------------"
################################################################################
print "-------------------------------------------------------------------------"
################################################################################
sys.exit(1)
if not os.path.exists(transpath):
utils.warn("ReleaseTransitions file, %s, not found." %
sys.exit(1)
if not os.path.exists(transpath):
utils.warn("ReleaseTransitions file, %s, not found." %