From 41310a4a047af310a0130abb6274caaa1ffbdb1d Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Sat, 21 Feb 2009 11:16:38 +0100 Subject: [PATCH] legacy remove the legacy support Signed-off-by: Joerg Jaspert --- config/debian-security/dak.conf | 6 - dak/poolize.py | 191 -------------------------------- dak/process_accepted.py | 26 +---- daklib/queue.py | 16 +-- docs/manpages/poolize.1.sgml | 63 ----------- 5 files changed, 5 insertions(+), 297 deletions(-) delete mode 100755 dak/poolize.py delete mode 100644 docs/manpages/poolize.1.sgml diff --git a/config/debian-security/dak.conf b/config/debian-security/dak.conf index 357438a3..6035bf01 100644 --- a/config/debian-security/dak.conf +++ b/config/debian-security/dak.conf @@ -345,12 +345,6 @@ OverrideType Location { - /org/security.debian.org/ftp/dists/ - { - Archive "security"; - Type "legacy"; - }; - /org/security.debian.org/ftp/pool/ { Archive "security"; diff --git a/dak/poolize.py b/dak/poolize.py deleted file mode 100755 index ef41d742..00000000 --- a/dak/poolize.py +++ /dev/null @@ -1,191 +0,0 @@ -#!/usr/bin/env python - -""" Poolify (move packages from "legacy" type locations to pool locations) """ -# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006 James Troup - -# 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 -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -################################################################################ - -# "Welcome to where time stands still, -# No one leaves and no one will." -# - Sanitarium - Metallica / Master of the puppets - -################################################################################ - -import os, pg, re, stat, sys -import apt_pkg, apt_inst -import daklib.database -import daklib.utils -from daklib.regexes import re_isadeb, re_extract_src_version, re_no_epoch, re_issource - -################################################################################ - -Cnf = None -projectB = None - -################################################################################ - -def usage (exit_code=0): - print """Usage: dak poolize [OPTIONS] -Migrate packages from legacy locations into the pool. - - -l, --limit=AMOUNT only migrate AMOUNT Kb of packages - -n, --no-action don't do anything - -v, --verbose explain what is being done - -h, --help show this help and exit""" - - sys.exit(exit_code) - -################################################################################ - -# Q is a python-postgresql query result set and must have the -# following four columns: -# o files.id (as 'files_id') -# o files.filename -# o location.path -# o component.name (as 'component') -# -# limit is a value in bytes or -1 for no limit (use with care!) -# verbose and no_action are booleans - -def poolize (q, limit, verbose, no_action): - poolized_size = 0L - poolized_count = 0 - - # Parse -l/--limit argument - qd = q.dictresult() - for qid in qd: - legacy_filename = qid["path"]+qid["filename"] - size = os.stat(legacy_filename)[stat.ST_SIZE] - if (poolized_size + size) > limit and limit >= 0: - daklib.utils.warn("Hit %s limit." % (daklib.utils.size_type(limit))) - break - poolized_size += size - poolized_count += 1 - base_filename = os.path.basename(legacy_filename) - destination_filename = base_filename - # Work out the source package name - if re_isadeb.match(base_filename): - control = apt_pkg.ParseSection(apt_inst.debExtractControl(daklib.utils.open_file(legacy_filename))) - package = control.Find("Package", "") - source = control.Find("Source", package) - if source.find("(") != -1: - m = re_extract_src_version.match(source) - source = m.group(1) - # If it's a binary, we need to also rename the file to include the architecture - version = control.Find("Version", "") - architecture = control.Find("Architecture", "") - if package == "" or version == "" or architecture == "": - daklib.utils.fubar("%s: couldn't determine required information to rename .deb file." % (legacy_filename)) - version = re_no_epoch.sub('', version) - destination_filename = "%s_%s_%s.deb" % (package, version, architecture) - else: - m = re_issource.match(base_filename) - if m: - source = m.group(1) - else: - daklib.utils.fubar("expansion of source filename '%s' failed." % (legacy_filename)) - # Work out the component name - component = qid["component"] - if component == "": - q = projectB.query("SELECT DISTINCT(c.name) FROM override o, component c WHERE o.package = '%s' AND o.component = c.id;" % (source)) - ql = q.getresult() - if not ql: - daklib.utils.fubar("No override match for '%s' so I can't work out the component." % (source)) - if len(ql) > 1: - daklib.utils.fubar("Multiple override matches for '%s' so I can't work out the component." % (source)) - component = ql[0][0] - # Work out the new location - q = projectB.query("SELECT l.id FROM location l, component c WHERE c.name = '%s' AND c.id = l.component AND l.type = 'pool';" % (component)) - ql = q.getresult() - if len(ql) != 1: - daklib.utils.fubar("couldn't determine location ID for '%s'. [query returned %d matches, not 1 as expected]" % (source, len(ql))) - location_id = ql[0][0] - # First move the files to the new location - pool_location = daklib.utils.poolify (source, component) - pool_filename = pool_location + destination_filename - destination = Cnf["Dir::Pool"] + pool_location + destination_filename - if os.path.exists(destination): - daklib.utils.fubar("'%s' already exists in the pool; serious FUBARity." % (legacy_filename)) - if verbose: - print "Moving: %s -> %s" % (legacy_filename, destination) - if not no_action: - daklib.utils.move(legacy_filename, destination) - # Then Update the DB's files table - if verbose: - print "SQL: UPDATE files SET filename = '%s', location = '%s' WHERE id = '%s'" % (pool_filename, location_id, qid["files_id"]) - if not no_action: - q = projectB.query("UPDATE files SET filename = '%s', location = '%s' WHERE id = '%s'" % (pool_filename, location_id, qid["files_id"])) - - sys.stderr.write("Poolized %s in %s files.\n" % (daklib.utils.size_type(poolized_size), poolized_count)) - -################################################################################ - -def main (): - global Cnf, projectB - - Cnf = daklib.utils.get_conf() - - for i in ["help", "limit", "no-action", "verbose" ]: - if not Cnf.has_key("Poolize::Options::%s" % (i)): - Cnf["Poolize::Options::%s" % (i)] = "" - - - Arguments = [('h',"help","Poolize::Options::Help"), - ('l',"limit", "Poolize::Options::Limit", "HasArg"), - ('n',"no-action","Poolize::Options::No-Action"), - ('v',"verbose","Poolize::Options::Verbose")] - - apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv) - Options = Cnf.SubTree("Poolize::Options") - - if Options["Help"]: - usage() - - projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])) - daklib.database.init(Cnf, projectB) - - if not Options["Limit"]: - limit = -1 - else: - limit = int(Options["Limit"]) * 1024 - - # -n/--no-action implies -v/--verbose - if Options["No-Action"]: - Options["Verbose"] = "true" - - # Sanity check the limit argument - if limit > 0 and limit < 1024: - daklib.utils.fubar("-l/--limit takes an argument with a value in kilobytes.") - - # Grab a list of all files not already in the pool - q = projectB.query(""" -SELECT l.path, f.filename, f.id as files_id, c.name as component - FROM files f, location l, component c WHERE - NOT EXISTS (SELECT 1 FROM location l WHERE l.type = 'pool' AND f.location = l.id) - AND NOT (f.filename ~ '^potato') AND f.location = l.id AND l.component = c.id -UNION SELECT l.path, f.filename, f.id as files_id, null as component - FROM files f, location l WHERE - NOT EXISTS (SELECT 1 FROM location l WHERE l.type = 'pool' AND f.location = l.id) - AND NOT (f.filename ~ '^potato') AND f.location = l.id AND NOT EXISTS - (SELECT 1 FROM location l WHERE l.component IS NOT NULL AND f.location = l.id);""") - - poolize(q, limit, Options["Verbose"], Options["No-Action"]) - -####################################################################################### - -if __name__ == '__main__': - main() diff --git a/dak/process_accepted.py b/dak/process_accepted.py index 683b1191..dce0cdbe 100755 --- a/dak/process_accepted.py +++ b/dak/process_accepted.py @@ -372,34 +372,12 @@ def install (): suite_id = database.get_suite_id(suite) projectB.query("INSERT INTO bin_associations (suite, bin) VALUES (%d, currval('binaries_id_seq'))" % (suite_id)) - # If the .orig.tar.gz is in a legacy directory we need to poolify - # it, so that apt-get source (and anything else that goes by the - # "Directory:" field in the Sources.gz file) works. - orig_tar_id = Upload.pkg.orig_tar_id - orig_tar_location = Upload.pkg.orig_tar_location - legacy_source_untouchable = Upload.pkg.legacy_source_untouchable - if orig_tar_id and orig_tar_location == "legacy": - q = projectB.query("SELECT DISTINCT ON (f.id) l.path, f.filename, f.id as files_id, df.source, df.id as dsc_files_id, f.size, f.md5sum FROM files f, dsc_files df, location l WHERE df.source IN (SELECT source FROM dsc_files WHERE file = %s) AND f.id = df.file AND l.id = f.location AND (l.type = 'legacy' OR l.type = 'legacy-mixed')" % (orig_tar_id)) - qd = q.dictresult() - for qid in qd: - # Is this an old upload superseded by a newer -sa upload? (See check_dsc() for details) - if legacy_source_untouchable.has_key(qid["files_id"]): - continue - # First move the files to the new location - legacy_filename = qid["path"] + qid["filename"] - pool_location = utils.poolify (changes["source"], files[newfile]["component"]) - pool_filename = pool_location + os.path.basename(qid["filename"]) - destination = Cnf["Dir::Pool"] + pool_location - utils.move(legacy_filename, destination) - # Then Update the DB's files table - q = projectB.query("UPDATE files SET filename = '%s', location = '%s' WHERE id = '%s'" % (pool_filename, dsc_location_id, qid["files_id"])) - - # If this is a sourceful diff only upload that is moving non-legacy + # If this is a sourceful diff only upload that is moving # cross-component we need to copy the .orig.tar.gz into the new # component too for the same reasons as above. # if changes["architecture"].has_key("source") and orig_tar_id and \ - orig_tar_location != "legacy" and orig_tar_location != dsc_location_id: + orig_tar_location != dsc_location_id: q = projectB.query("SELECT l.path, f.filename, f.size, f.md5sum, f.sha1sum, f.sha256sum FROM files f, location l WHERE f.id = %s AND f.location = l.id" % (orig_tar_id)) ql = q.getresult()[0] old_filename = ql[0] + ql[1] diff --git a/daklib/queue.py b/daklib/queue.py index 29d2260b..599b077f 100755 --- a/daklib/queue.py +++ b/daklib/queue.py @@ -212,8 +212,7 @@ class Upload: self.accept_count = 0 self.accept_bytes = 0L self.reject_message = "" - self.pkg = Pkg(changes = {}, dsc = {}, dsc_files = {}, files = {}, - legacy_source_untouchable = {}) + self.pkg = Pkg(changes = {}, dsc = {}, dsc_files = {}, files = {}) # Initialize the substitution template mapping global Subst = self.Subst = {} @@ -233,7 +232,6 @@ class Upload: self.pkg.dsc.clear() self.pkg.files.clear() self.pkg.dsc_files.clear() - self.pkg.legacy_source_untouchable.clear() self.pkg.orig_tar_id = None self.pkg.orig_tar_location = "" self.pkg.orig_tar_gz = None @@ -252,7 +250,6 @@ class Upload: self.pkg.dsc.update(p.load()) self.pkg.files.update(p.load()) self.pkg.dsc_files.update(p.load()) - self.pkg.legacy_source_untouchable.update(p.load()) self.pkg.orig_tar_id = p.load() self.pkg.orig_tar_location = p.load() @@ -279,7 +276,6 @@ class Upload: dsc = self.pkg.dsc files = self.pkg.files dsc_files = self.pkg.dsc_files - legacy_source_untouchable = self.pkg.legacy_source_untouchable orig_tar_id = self.pkg.orig_tar_id orig_tar_location = self.pkg.orig_tar_location @@ -351,7 +347,7 @@ class Upload: d_dsc_files[file_entry][i] = dsc_files[file_entry][i] for i in [ d_changes, d_dsc, d_files, d_dsc_files, - legacy_source_untouchable, orig_tar_id, orig_tar_location ]: + orig_tar_id, orig_tar_location ]: p.dump(i) dump_file.close() @@ -1181,7 +1177,6 @@ SELECT s.version, su.suite_name FROM source s, src_associations sa, suite su self.reject_message = "" files = self.pkg.files dsc_files = self.pkg.dsc_files - legacy_source_untouchable = self.pkg.legacy_source_untouchable self.pkg.orig_tar_gz = None # Try and find all files mentioned in the .dsc. This has @@ -1253,8 +1248,6 @@ SELECT s.version, su.suite_name FROM source s, src_associations sa, suite su actual_size = os.stat(old_file)[stat.ST_SIZE] if actual_md5 == dsc_files[dsc_file]["md5sum"] and actual_size == int(dsc_files[dsc_file]["size"]): x = i - else: - legacy_source_untouchable[i[3]] = "" old_file = x[0] + x[1] old_file_fh = utils.open_file(old_file) @@ -1268,10 +1261,7 @@ SELECT s.version, su.suite_name FROM source s, src_associations sa, suite su # See install() in process-accepted... self.pkg.orig_tar_id = x[3] self.pkg.orig_tar_gz = old_file - if suite_type == "legacy" or suite_type == "legacy-mixed": - self.pkg.orig_tar_location = "legacy" - else: - self.pkg.orig_tar_location = x[4] + self.pkg.orig_tar_location = x[4] else: # Not there? Check the queue directories... diff --git a/docs/manpages/poolize.1.sgml b/docs/manpages/poolize.1.sgml deleted file mode 100644 index 6d54d902..00000000 --- a/docs/manpages/poolize.1.sgml +++ /dev/null @@ -1,63 +0,0 @@ - - -%dakent; - -]> - - - &dak-docinfo; - - - dak_poolize - 1 - - - - - dak poolize - Utility to poolize files (move them from legacy to pool location) - - - - - - dak poolize - - - - - Description</> - <para> - <command>dak poolize</command> is the command line tool to poolize files; i.e. move files from legacy locations to their corresponding pool locations. - </PARA> - </REFSECT1> - - <RefSect1><Title>Options</> - <VariableList> - <varlistentry> - <term><option>-l/--limit</option>=<replaceable>size in kilobytes</replaceable></term> - <listitem> - <para>Set the maximum amount of data to poolize. <emphasis>Note:</emphasis> Without this option, all files will be poolized.</para> - </listitem> - </varlistentry> - - <varlistentry> - <term><option>-n/--no-action</option></term> - <listitem> - <para>Don't actually do anything, just show what would be done.</para> - </listitem> - </varlistentry> - </VariableList> - </RefSect1> - - <RefSect1><Title>Diagnostics</> - <para> - <command>dak poolize</command> returns zero on normal operation, non-zero on error. - </PARA> - </RefSect1> - - &manauthor; - -</refentry> -- 2.39.5