# Check for fixable discrepancies between stable and unstable
# Copyright (C) 2000, 2001 James Troup <james@nocrew.org>
-# $Id: andrea,v 1.3 2001-03-20 00:28:11 troup Exp $
+# $Id: andrea,v 1.4 2001-09-27 01:23:41 troup Exp $
# 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
global Cnf, projectB;
apt_pkg.init();
-
+
Cnf = apt_pkg.newConfiguration();
apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file());
- Arguments = [('D',"debug","Catherine::Options::Debug", "IntVal"),
- ('h',"help","Catherine::Options::Help"),
- ('V',"version","Catherine::Options::Version")]
-
- apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv);
+ apt_pkg.ParseCommandLine(Cnf,[],sys.argv);
projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]));
db_access.init(Cnf, projectB);
FROM binaries b_src, bin_associations ba, override o, architecture a
WHERE ba.bin = b_src.id AND ba.suite = %s AND b_src.architecture = %s
AND a.id = b_src.architecture AND o.package = b_src.package
- AND o.suite = %s AND o.type != %s AND NOT EXISTS
- (SELECT b_dst.id FROM bin_associations ba2, binaries b_dst
- WHERE ba2.bin = b_dst.id AND b_dst.package = b_src.package
- AND (b_dst.architecture = %s OR b_dst.architecture = %s)
- AND ba2.suite = %s AND EXISTS
- (SELECT b2.id FROM bin_associations ba3, binaries b2
+ AND o.suite = %s AND o.type != %s AND NOT EXISTS
+ (SELECT b_dst.id FROM bin_associations ba2, binaries b_dst
+ WHERE ba2.bin = b_dst.id AND b_dst.package = b_src.package
+ AND (b_dst.architecture = %s OR b_dst.architecture = %s)
+ AND ba2.suite = %s AND EXISTS
+ (SELECT b2.id FROM bin_associations ba3, binaries b2
WHERE ba3.bin = b2.id AND ba3.suite = %s AND b2.package = b_dst.package))
ORDER BY b_src.package;"""
% (src_suite_id, arch_id, dst_suite_id, dsc_type_id, arch_id, arch_all_id, dst_suite_id, dst_suite_id));
# Generate Maintainers file used by e.g. the Debian Bug Tracking System
# Copyright (C) 2000, 2001 James Troup <james@nocrew.org>
-# $Id: charisma,v 1.10 2001-09-26 03:47:15 troup Exp $
+# $Id: charisma,v 1.11 2001-09-27 01:23:41 troup Exp $
# 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
fixed_maintainer_cache = {}
################################################################################
-def usage (exit_code):
+
+def usage (exit_code=0):
print """Usage: charisma [OPTION] EXTRA_FILE[...]
Generate an index of packages <=> Maintainers.
+
+ -h, --help show this help and exit
"""
sys.exit(exit_code)
Cnf = apt_pkg.newConfiguration();
apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file());
- extra_files = apt_pkg.ParseCommandLine(Cnf,[],sys.argv);
+ Arguments = [('h',"help","Charisma::Options::Help")];
+ Cnf["Charisma::Options::Help"] = "";
+ extra_files = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv);
+ Options = Cnf.SubTree("Charisma::Options");
+
+ if Options["Help"]:
+ usage();
- #projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]), None, None, Cnf["DB::ROUser"]);
projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]));
db_access.init(Cnf, projectB);
# Sync PostgreSQL with (LDAP-generated) passwd file
# Copyright (C) 2001 James Troup <james@nocrew.org>
-# $Id: julia,v 1.1 2001-09-13 23:55:51 troup Exp $
+# $Id: julia,v 1.2 2001-09-27 01:23:41 troup Exp $
# 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+################################################################################
+
# <aj> ARRRGGGHHH
# <aj> what's wrong with me!?!?!?
# <aj> i was just nice to some mormon doorknockers!!!
projectB = None;
################################################################################
-def usage (exit_code):
+def usage (exit_code=0):
print """Usage: julia [OPTION]... PASSWD_FILE
-Sync postgres' pg_shadow with PASSWD_FILE.
+Sync PostgreSQL's pg_user with PASSWD_FILE.
- -v, --verbose explain what is being done
- -h, --help display this help and exit"""
+ -q, --quiet be quiet about what is being done
+ -v, --verbose explain what is being done
+ -h, --help show this help and exit"""
sys.exit(exit_code)
################################################################################
Arguments = [('q',"quiet","Julia::Options::Quiet"),
('v',"verbose","Julia::Options::Verbose"),
- ('D',"debug","Julia::Options::Debug", "IntVal"),
- ('h',"help","Julia::Options::Help"),
- ('V',"version","Julia::Options::Version")];
+ ('h',"help","Julia::Options::Help")];
+ for i in ["quiet", "verbose", "help" ]:
+ Cnf["Julia::Options::%s" % (i)] = "";
arguments = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv);
Options = Cnf.SubTree("Julia::Options")
if Options["Help"]:
- usage(0);
+ usage();
if arguments == []:
utils.warn("julia needs the name of the passwd file to sync with as an argument.");
usage(1);
# Display information about package(s) (suite, version, etc.)
# Copyright (C) 2000, 2001 James Troup <james@nocrew.org>
-# $Id: madison,v 1.10 2001-09-13 23:57:17 troup Exp $
+# $Id: madison,v 1.11 2001-09-27 01:23:41 troup Exp $
# 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
################################################################################
-def usage (exit_code):
+def usage (exit_code=0):
print """Usage: madison [OPTION] PACKAGE[...]
Display information about PACKAGE(s).
- -a, --architecture=ARCH only show information for this architecture
- -s, --suite=SUITE only show information for this suite
+ -a, --architecture=ARCH only show information for this architecture
+ -s, --suite=SUITE only show information for this suite
+ -h, --help show this help and exit
Both ARCH and SUITE can be space seperated lists, e.g.
--architecture=\"m68k i386\""""
apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file());
Arguments = [('a',"architecture","Madison::Options::Architecture", "HasArg"),
- ('m',"maintainer","Madison::Options::Architecture"),
('s',"suite","Madison::Options::Suite", "HasArg"),
- ('D',"debug","Madison::Options::Debug", "IntVal"),
- ('h',"help","Madison::Options::Help"),
- ('V',"version","Madison::Options::Version")];
+ ('h',"help","Madison::Options::Help")];
+ for i in ["architecture", "suite", "help" ]:
+ Cnf["Madison::Options::%s" % (i)] = "";
packages = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv);
Options = Cnf.SubTree("Madison::Options")
if Options["Help"]:
- usage(0);
+ usage();
if packages == []:
utils.fubar("need at least one package name as an argument.");
#!/usr/bin/env python
-# General purpose archive tool for ftpmaster
+# General purpose package removal tool for ftpmaster
# Copyright (C) 2000, 2001 James Troup <james@nocrew.org>
-# $Id: melanie,v 1.16 2001-09-26 03:15:16 troup Exp $
+# $Id: melanie,v 1.17 2001-09-27 01:23:41 troup Exp $
# 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
################################################################################
-def usage (exit_code):
- print """Usage: melanie [OPTIONS] package[...]
- -D, --debug=VALUE turn on debugging
- -h, --help show this help and exit
+def usage (exit_code=0):
+ print """Usage: melanie [OPTIONS] PACKAGE[...]
+Remove PACKAGE(s) from suite(s).
+
-a, --architecture=ARCH only act on this architecture
-b, --binary remove binaries only
-c, --component=COMPONENT act on this component
-n, --no-action don't do anything
-p, --partial don't affect override files
-s, --suite=SUITE act on this suite
- -S, --source-only remove source only"""
+ -S, --source-only remove source only
+ -h, --help show this help and exit
+
+ARCH, BUG#, COMPONENT and SUITE can be space seperated lists, e.g.
+ --architecture=\"m68k i386\""""
+
sys.exit(exit_code)
################################################################################
Cnf = apt_pkg.newConfiguration();
apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file());
- Arguments = [('D',"debug","Melanie::Options::Debug", "IntVal"),
- ('h',"help","Melanie::Options::Help"),
- ('V',"version","Melanie::Options::Version"),
+ Arguments = [('h',"help","Melanie::Options::Help"),
('a',"architecture","Melanie::Options::Architecture", "HasArg"),
('b',"binary", "Melanie::Options::Binary-Only"),
('c',"component", "Melanie::Options::Component", "HasArg"),
('S',"source-only", "Melanie::Options::Source-Only"),
];
+ for i in ["help", "architecture", "binary", "component", "carbon-copy", "done", "reason", "no-action", "partial", "source-only" ]:
+ Cnf["Melanie::Options::%s" % (i)] = "";
+ Cnf["Melanie::Options::Suite"] = "unstable";
+
arguments = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv);
Options = Cnf.SubTree("Melanie::Options")
if Options["Help"]:
- usage(0)
+ usage();
projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]));
db_access.init(Cnf, projectB);
else:
bcc = "Bcc: " + bcc;
Subst["__BCC__"] = bcc[:-2];
- Subst["__CC__"] = "X-Melanie: $Revision: 1.16 $\n" + carbon_copy[:-1];
+ Subst["__CC__"] = "X-Melanie: $Revision: 1.17 $\n" + carbon_copy[:-1];
Subst["__SUITE_LIST__"] = suites_list;
Subst["__SUMMARY__"] = summary;
Subst["__ADMIN_ADDRESS__"] = Cnf["Dinstall::MyAdminAddress"];
# Manipulate override files
# Copyright (C) 2000, 2001 James Troup <james@nocrew.org>
-# $Id: natalie.py,v 1.10 2001-09-17 11:18:37 troup Exp $
+# $Id: natalie.py,v 1.11 2001-09-27 01:23:41 troup Exp $
# 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
################################################################################
-def usage (exit_code):
+def usage (exit_code=0):
print """Usage: natalie.py [OPTIONS]
- -D, --debug=VALUE debug
-h, --help this help
- -V, --version retrieve version
-c, --component=CMPT list/set overrides by component
(contrib,*main,non-free)
-s, --suite=SUITE list/set overrides by suite
Cnf = apt_pkg.newConfiguration();
apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file());
- Arguments = [('D',"debug","Natalie::Options::Debug", "IntVal"),
- ('h',"help","Natalie::Options::Help"),
- ('V',"version","Natalie::Options::Version"),
+ Arguments = [('h',"help","Natalie::Options::Help"),
('c',"component", "Natalie::Options::Component", "HasArg"),
('l',"list", "Natalie::Options::List"),
('s',"suite","Natalie::Options::Suite", "HasArg"),
('S',"set","Natalie::Options::Set"),
('t',"type","Natalie::Options::Type", "HasArg")];
+
+ # Default arguments
+ for i in ["help", "list", "set" ]:
+ Cnf["Natalie::Options::%s" % (i)] = "";
+ Cnf["Natalie::Options::Component"] = "main";
+ Cnf["Natalie::Options::Suite"] = "unstable";
+ Cnf["Natalie::Options::Type"] = "deb";
+
file_list = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv);
if Cnf["Natalie::Options::Help"]:
- usage(0);
+ usage();
init();
# rhona, cleans up unassociated binary and source packages
# Copyright (C) 2000, 2001 James Troup <james@nocrew.org>
-# $Id: rhona,v 1.16 2001-06-22 23:30:21 troup Exp $
+# $Id: rhona,v 1.17 2001-09-27 01:23:41 troup Exp $
# 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-###################################################################################################
+################################################################################
# 07:05|<elmo> well.. *shrug*.. no, probably not.. but to fix it,
# | we're going to have to implement reference counting
#
# 07:05|<Culus> elmo: Augh! <brain jumps out of skull>
-###################################################################################################
+################################################################################
import os, pg, stat, string, sys, time
import apt_pkg
import utils
-###################################################################################################
+################################################################################
-projectB = None
-Cnf = None
+projectB = None;
+Cnf = None;
+Options = None;
now_date = None; # mark newly "deleted" things as deleted "now"
delete_date = None; # delete things marked "deleted" earler than this
-###################################################################################################
+################################################################################
-def usage (exit_code):
- print """Usage: rhona [OPTION]... [CHANGES]...
- -D, --debug=VALUE debug
- -n, --no-action don't do anything
- -v, --verbose be verbose
- -V, --version display version number and exit"""
+def usage (exit_code=0):
+ print """Usage: rhona [OPTIONS]
+Clean old packages from suites.
+
+ -n, --no-action don't do anything
+ -h, --help show this help and exit"""
sys.exit(exit_code)
-###################################################################################################
-
+################################################################################
+
def check_binaries():
global delete_date, now_date;
-
+
print "Checking for orphaned binary packages..."
# Get the list of binary packages not in a suite and mark them for
#### byebye and sources go byebye is 0 instead of StayOfExecution)
ql = q.getresult();
-
+
projectB.query("BEGIN WORK");
for i in ql:
source_id = i[0];
file_id = i[0];
projectB.query("UPDATE files SET last_used = '%s' WHERE id = %s" % (now_date, file_id));
projectB.query("COMMIT WORK");
-
+
def clean_binaries():
global delete_date, now_date;
# XXX: why doesn't this remove the files here as well? I don't think it
# buys anything keeping this separate
print "Cleaning binaries from the DB..."
- if not Cnf["Rhona::Options::No-Action"]:
+ if not Options["No-Action"]:
before = time.time();
sys.stdout.write("[Deleting from binaries table... ");
projectB.query("DELETE FROM binaries WHERE EXISTS (SELECT id FROM files WHERE binaries.file = files.id AND files.last_used <= '%s')" % (delete_date));
dest = Cnf["Dir::Morgue"] + '/' + Cnf["Rhona::MorgueSubDir"] + '/' + date;
if not os.path.exists(dest):
os.mkdir(dest);
-
+
# Delete from source
- if not Cnf["Rhona::Options::No-Action"]:
+ if not Options["No-Action"]:
before = time.time();
sys.stdout.write("[Deleting from source table... ");
projectB.query("DELETE FROM dsc_files WHERE EXISTS (SELECT df.id FROM source s, files f, dsc_files df WHERE f.last_used <= '%s' AND s.file = f.id AND s.id = df.source AND df.id = dsc_files.id)" % (delete_date));
projectB.query("DELETE FROM source WHERE EXISTS (SELECT id FROM files WHERE source.file = files.id AND files.last_used <= '%s')" % (delete_date));
sys.stdout.write("done. (%d seconds)]\n" % (int(time.time()-before)));
-
+
# Delete files from the pool
q = projectB.query("SELECT l.path, f.filename FROM location l, files f WHERE f.last_used <= '%s' AND l.id = f.location" % (delete_date));
for i in q.getresult():
if os.path.isfile(filename):
if os.path.islink(filename):
count = count + 1;
- if Cnf["Rhona::Options::No-Action"]:
+ if Options["No-Action"]:
print "Removing symlink %s..." % (filename);
else:
os.unlink(filename);
# If the destination file exists; try to find another filename to use
if os.path.exists(dest_filename):
dest_filename = utils.find_next_free(dest_filename);
-
- if Cnf["Rhona::Options::No-Action"]:
+
+ if Options["No-Action"]:
print "Cleaning %s -> %s ..." % (filename, dest_filename);
else:
utils.move(filename, dest_filename);
else:
utils.fubar("%s is neither symlink nor file?!" % (filename));
-
+
# Delete from the 'files' table
- if not Cnf["Rhona::Options::No-Action"]:
+ if not Options["No-Action"]:
before = time.time();
sys.stdout.write("[Deleting from files table... ");
projectB.query("DELETE FROM files WHERE last_used <= '%s'" % (delete_date));
def clean_maintainers():
print "Cleaning out unused Maintainer entries..."
-
+
q = projectB.query("""
SELECT m.id FROM maintainer m
WHERE NOT EXISTS (SELECT id FROM binaries b WHERE b.maintainer = m.id)
projectB.query("BEGIN WORK");
for i in ql:
maintainer_id = i[0];
- if not Cnf["Rhona::Options::No-Action"]:
+ if not Options["No-Action"]:
projectB.query("DELETE FROM maintainer WHERE id = %s" % (maintainer_id));
count = count + 1;
projectB.query("COMMIT WORK");
if count > 0:
sys.stderr.write("Cleared out %d maintainer entries.\n" % (count));
+################################################################################
+
def main():
- global Cnf, projectB, delete_date, now_date;
-
+ global Cnf, Options, projectB, delete_date, now_date;
+
apt_pkg.init();
-
+
Cnf = apt_pkg.newConfiguration();
apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file());
projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]));
- Arguments = [('D',"debug","Rhona::Options::Debug", "IntVal"),
- ('h',"help","Rhona::Options::Help"),
- ('n',"no-action","Rhona::Options::No-Action"),
- ('V',"version","Rhona::Options::Version")];
-
+ Arguments = [('h',"help","Rhona::Options::Help"),
+ ('n',"no-action","Rhona::Options::No-Action")];
+
apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv);
Options = Cnf.SubTree("Rhona::Options")
if Options["Help"]:
- usage(0);
-
- if Options["Version"]:
- print "rhona version 0.0000000000";
- usage(0);
+ usage();
now_date = time.strftime("%Y-%m-%d %H:%M", time.localtime(time.time()));
delete_date = time.strftime("%Y-%m-%d %H:%M", time.localtime(time.time()-int(Cnf["Rhona::StayOfExecution"])));
-
+
check_binaries();
clean_binaries();
check_sources();
clean();
clean_maintainers();
+################################################################################
+
if __name__ == '__main__':
main()
# Sanity check the database
# Copyright (C) 2000, 2001 James Troup <james@nocrew.org>
-# $Id: tea,v 1.11 2001-06-22 22:53:14 troup Exp $
+# $Id: tea,v 1.12 2001-09-27 01:23:41 troup Exp $
# 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
def process_dir (arg, dirname, filenames):
global waste, db_files, excluded;
-
- if string.find(dirname, '/disks-') != -1 or string.find(dirname, 'upgrade-') != -1:
+
+ if string.find(dirname, '/disks-') != -1 or string.find(dirname, 'upgrade-') != -1:
return;
# hack; can't handle .changes files
if string.find(dirname, 'proposed-updates') != -1:
print "Getting file information from database...";
q = projectB.query("SELECT l.path, f.filename, f.md5sum, f.size FROM files f, location l WHERE f.location = l.id")
ql = q.getresult();
-
+
print "Checking file md5sums & sizes...";
for i in ql:
filename = os.path.abspath(i[0] + i[1]);
global Cnf, projectB, db_files, waste, excluded;
apt_pkg.init();
-
+
Cnf = apt_pkg.newConfiguration();
apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file());
- Arguments = [('d',"debug","Tea::Options::Debug", "IntVal"),
- ('h',"help","Tea::Options::Help"),
- ('v',"version","Tea::Options::Version")];
-
- apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv);
+ apt_pkg.ParseCommandLine(Cnf,[],sys.argv);
projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]));
db_access.init(Cnf, projectB);
-
+
#check_md5sums();
check_source_in_one_dir();
#check_override();