#!/usr/bin/env python
-# rhona, cleans up unassociated binary and source packages
-# Copyright (C) 2000, 2001, 2002, 2003 James Troup <james@nocrew.org>
-# $Id: rhona,v 1.29 2005-11-25 06:59:45 ajt Exp $
+# Cleans up unassociated binary and source packages
+# Copyright (C) 2000, 2001, 2002, 2003, 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
import os, pg, stat, sys, time
import apt_pkg
-import utils
+import dak.lib.utils as utils
################################################################################
################################################################################
def usage (exit_code=0):
- print """Usage: rhona [OPTIONS]
+ print """Usage: dak clean-suites [OPTIONS]
Clean old packages from suites.
-n, --no-action don't do anything
print "Cleaning out packages..."
date = time.strftime("%Y-%m-%d")
- dest = Cnf["Dir::Morgue"] + '/' + Cnf["Rhona::MorgueSubDir"] + '/' + date
+ dest = Cnf["Dir::Morgue"] + '/' + Cnf["Clean-Suites::MorgueSubDir"] + '/' + date
if not os.path.exists(dest):
os.mkdir(dest)
print "Cleaning out queue build symlinks..."
- our_delete_date = time.strftime("%Y-%m-%d %H:%M", time.localtime(time.time()-int(Cnf["Rhona::QueueBuildStayOfExecution"])))
+ our_delete_date = time.strftime("%Y-%m-%d %H:%M", time.localtime(time.time()-int(Cnf["Clean-Suites::QueueBuildStayOfExecution"])))
count = 0
q = projectB.query("SELECT filename FROM queue_build WHERE last_used <= '%s'" % (our_delete_date))
Cnf = utils.get_conf()
for i in ["Help", "No-Action" ]:
- if not Cnf.has_key("Rhona::Options::%s" % (i)):
- Cnf["Rhona::Options::%s" % (i)] = ""
+ if not Cnf.has_key("Clean-Suites::Options::%s" % (i)):
+ Cnf["Clean-Suites::Options::%s" % (i)] = ""
- Arguments = [('h',"help","Rhona::Options::Help"),
- ('n',"no-action","Rhona::Options::No-Action")]
+ Arguments = [('h',"help","Clean-Suites::Options::Help"),
+ ('n',"no-action","Clean-Suites::Options::No-Action")]
apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv)
- Options = Cnf.SubTree("Rhona::Options")
+ Options = Cnf.SubTree("Clean-Suites::Options")
if Options["Help"]:
usage()
projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]))
now_date = time.strftime("%Y-%m-%d %H:%M")
- delete_date = time.strftime("%Y-%m-%d %H:%M", time.localtime(time.time()-int(Cnf["Rhona::StayOfExecution"])))
+ delete_date = time.strftime("%Y-%m-%d %H:%M", time.localtime(time.time()-int(Cnf["Clean-Suites::StayOfExecution"])))
check_binaries()
clean_binaries()