#!/usr/bin/env python
# Dependency check proposed-updates
-# Copyright (C) 2001, 2002, 2004 James Troup <james@nocrew.org>
-# $Id: jeri,v 1.15 2005-02-08 22:43:45 troup Exp $
+# Copyright (C) 2001, 2002, 2004, 2006 James Troup <james@nocrew.org>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
################################################################################
# | > amd64 is more mature than even some released architectures
-# |
+# |
# | This might be true of the architecture, unfortunately it seems to be the
# | exact opposite for most of the people involved with it.
-#
+#
# <1089213290.24029.6.camel@descent.netsplit.com>
################################################################################
import pg, sys, os
-import utils, db_access
import apt_pkg, apt_inst
+from daklib import database
+from daklib import utils
################################################################################
################################################################################
def usage (exit_code=0):
- print """Usage: jeri [OPTION] <CHANGES FILE | DEB FILE | ADMIN FILE>[...]
+ print """Usage: dak check-proposed-updates [OPTION] <CHANGES FILE | DEB FILE | ADMIN FILE>[...]
(Very) Basic dependency checking for proposed-updates.
-q, --quiet be quieter about what is being done
# Move to the pool directory
cwd = os.getcwd()
- file = files.keys()[0]
- pool_dir = Cnf["Dir::Pool"] + '/' + utils.poolify(changes["source"], files[file]["component"])
+ f = files.keys()[0]
+ pool_dir = Cnf["Dir::Pool"] + '/' + utils.poolify(changes["source"], files[f]["component"])
os.chdir(pool_dir)
changes_result = 0
- for file in files.keys():
- if file.endswith(".deb"):
- result = check_package(file, files)
+ for f in files.keys():
+ if f.endswith(".deb"):
+ result = check_package(f, files)
if Options["verbose"]:
- pass_fail(file, result)
+ pass_fail(f, result)
changes_result += result
pass_fail (filename, changes_result)
################################################################################
def check_joey (filename):
- file = utils.open_file(filename)
+ f = utils.open_file(filename)
cwd = os.getcwd()
os.chdir("%s/dists/proposed-updates" % (Cnf["Dir::Root"]))
- for line in file.readlines():
+ for line in f.readlines():
line = line.rstrip()
if line.find('install') != -1:
split_line = line.split()
if Options["debug"]:
print "Processing %s..." % (changes_filename)
check_changes(changes_filename)
- file.close()
+ f.close()
os.chdir(cwd)
Cnf = utils.get_conf()
- Arguments = [('d', "debug", "Jeri::Options::Debug"),
- ('q',"quiet","Jeri::Options::Quiet"),
- ('v',"verbose","Jeri::Options::Verbose"),
- ('h',"help","Jeri::Options::Help")]
+ Arguments = [('d', "debug", "Check-Proposed-Updates::Options::Debug"),
+ ('q',"quiet","Check-Proposed-Updates::Options::Quiet"),
+ ('v',"verbose","Check-Proposed-Updates::Options::Verbose"),
+ ('h',"help","Check-Proposed-Updates::Options::Help")]
for i in [ "debug", "quiet", "verbose", "help" ]:
- if not Cnf.has_key("Jeri::Options::%s" % (i)):
- Cnf["Jeri::Options::%s" % (i)] = ""
+ if not Cnf.has_key("Check-Proposed-Updates::Options::%s" % (i)):
+ Cnf["Check-Proposed-Updates::Options::%s" % (i)] = ""
arguments = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv)
- Options = Cnf.SubTree("Jeri::Options")
+ Options = Cnf.SubTree("Check-Proposed-Updates::Options")
if Options["Help"]:
usage(0)
utils.fubar("need at least one package name as an argument.")
projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]))
- db_access.init(Cnf, projectB)
+ database.init(Cnf, projectB)
print "Parsing packages files...",
parse_packages()
print "done."
- for file in arguments:
- if file.endswith(".changes"):
- check_changes(file)
- elif file.endswith(".deb"):
- check_deb(file)
- elif file.endswith(".joey"):
- check_joey(file)
+ for f in arguments:
+ if f.endswith(".changes"):
+ check_changes(f)
+ elif f.endswith(".deb"):
+ check_deb(f)
+ elif f.endswith(".joey"):
+ check_joey(f)
else:
- utils.fubar("Unrecognised file type: '%s'." % (file))
+ utils.fubar("Unrecognised file type: '%s'." % (f))
#######################################################################################