From ef864c51e3eab9518c58c946b31346e598d91bb1 Mon Sep 17 00:00:00 2001 From: James Troup Date: Wed, 26 Sep 2001 03:47:15 +0000 Subject: [PATCH] Maintainers_Versions stuff --- charisma | 51 +++++++++++++++++++++++++++++++++-------------- cron.daily-non-US | 9 ++++++++- mkmaintainers | 10 ++++++---- 3 files changed, 50 insertions(+), 20 deletions(-) diff --git a/charisma b/charisma index 6a23ab9c..2e801dc7 100755 --- a/charisma +++ b/charisma @@ -2,7 +2,7 @@ # Generate Maintainers file used by e.g. the Debian Bug Tracking System # Copyright (C) 2000, 2001 James Troup -# $Id: charisma,v 1.9 2001-09-13 23:51:51 troup Exp $ +# $Id: charisma,v 1.10 2001-09-26 03:47:15 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 @@ -18,19 +18,19 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -#################################################################################################################################### +################################################################################ # ``As opposed to "Linux sucks. Respect my academic authoritah, damn # you!" or whatever all this hot air amounts to.'' # -- ajt@ in _that_ thread on debian-devel@ -#################################################################################################################################### +################################################################################ import os, pg, re, string, sys import db_access, utils import apt_pkg -#################################################################################################################################### +################################################################################ projectB = None Cnf = None @@ -38,9 +38,14 @@ maintainer_from_source_cache = {} packages = {} fixed_maintainer_cache = {} -re_split = re.compile(r"(\S+)\s+(\S+.*)") +################################################################################ +def usage (exit_code): + print """Usage: charisma [OPTION] EXTRA_FILE[...] +Generate an index of packages <=> Maintainers. +""" + sys.exit(exit_code) -#################################################################################################################################### +################################################################################ def fix_maintainer (maintainer): global fixed_maintainer_cache; @@ -63,7 +68,7 @@ def get_maintainer_from_source (source_id): return maintainer_from_source_cache[source_id] -#################################################################################################################################### +################################################################################ def main(): global Cnf, projectB; @@ -75,6 +80,7 @@ def main(): extra_files = apt_pkg.ParseCommandLine(Cnf,[],sys.argv); + #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); @@ -117,19 +123,34 @@ def main(): # Process any additional Maintainer files (e.g. from non-US or pseudo packages) for filename in extra_files: - file = utils.open_file(filename, 'r') + file = utils.open_file(filename); for line in file.readlines(): - m = re_split.match(line[:-1]) - package = m.group(1) - maintainer = fix_maintainer(m.group(2)) - if not packages.has_key(package): - packages[package] = { "maintainer": maintainer, "priority": 0 } - file.close() + line = string.strip(utils.re_comments.sub('', line[:-1])) + if line == "": + continue; + split = string.split(line); + lhs = split[0]; + maintainer = fix_maintainer(string.join(split[1:])); + if string.find(lhs,'~') != -1: + lhs_split = string.split(lhs, '~'); + package = lhs_split[0]; + version = lhs_split[1]; + else: + package = lhs; + version = '*'; + # A version of '*' overwhelms all real version numbers + if not packages.has_key(package) or version == '*' \ + or apt_pkg.VersionCompare(packages[package]["version"], version) == -1: + packages[package] = { "maintainer": maintainer, "version": version }; + file.close(); package_keys = packages.keys() package_keys.sort() for package in package_keys: - print "%-20s %s" % (package, packages[package]["maintainer"]) + lhs = string.join([package, packages[package]["version"]], '~'); + print "%-30s %s" % (lhs, packages[package]["maintainer"]); + +################################################################################ if __name__ == '__main__': main() diff --git a/cron.daily-non-US b/cron.daily-non-US index 77b5626f..9b1cba26 100755 --- a/cron.daily-non-US +++ b/cron.daily-non-US @@ -70,11 +70,18 @@ ziyi # Clean out old packages rhona +# Generate the Maintainers file cd $indices -charisma > .new-maintainers +charisma > .new-maintainers_versions +mv -f .new-maintainers_versions Maintainers_Versions +sed -e "s/~[^ ]*\([ ]\)/\1/" < Maintainers_Versions | awk '{printf "%-20s ", $1; for (i=2; i<=NF; i++) printf "%s ", $i; printf "\n";}' > .new-maintainers mv -f .new-maintainers Maintainers gzip -9v .new-maintainers.gz mv -f .new-maintainers.gz Maintainers.gz +gzip -9v .new-maintainers_versions.gz +mv -f .new-maintainers_versions.gz Maintainers_Versions.gz +rm -f Maintainers_Versions + cd $masterdir copyoverrides mklslar diff --git a/mkmaintainers b/mkmaintainers index 29019ef6..57e8dd8f 100755 --- a/mkmaintainers +++ b/mkmaintainers @@ -1,5 +1,5 @@ #! /bin/sh -# $Id: mkmaintainers,v 1.1 2000-12-15 00:15:30 troup Exp $ +# $Id: mkmaintainers,v 1.2 2001-09-26 03:47:15 troup Exp $ echo echo -n 'Creating Maintainers index ... ' @@ -8,15 +8,17 @@ set -e . $SCRIPTVARS cd $masterdir -nonusmaint="$masterdir/Maintainers" -if lftp -e 'set net:timeout 600; set net:max-retries 1; get /debian-non-US/indices-non-US/Maintainers.gz; exit' nonus.debian.org >/dev/null ; then +nonusmaint="$masterdir/Maintainers_Versions-non-US" + + +if wget -q -O Maintainers_Versions-non-US.gz http://non-us.debian.org/indices-non-US/Maintainers_Versions.gz; then rm -f $nonusmaint gunzip -c ${nonusmaint}.gz > $nonusmaint rm -f ${nonusmaint}.gz fi cd $indices -$masterdir/charisma $nonusmaint $masterdir/pseudo-packages.maintainers >.new-maintainers +$masterdir/charisma $nonusmaint $masterdir/pseudo-packages.maintainers | sed -e "s/~[^ ]*\([ ]\)/\1/" | awk '{printf "%-20s ", $1; for (i=2; i<=NF; i++) printf "%s ", $i; printf "\n";}' > .new-maintainers set +e cmp .new-maintainers Maintainers >/dev/null -- 2.39.5