+++ /dev/null
-#!/usr/bin/env python
-
-# Fix for bug in katie where dsc_files was initialized from changes and not dsc
-# Copyright (C) 2000 James Troup <james@nocrew.org>
-# $Id: fix.9,v 1.3 2001-11-04 22:28:44 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
-# 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
-
-# "Look around... leaves are brown... and the sky is hazy shade of winter,
-# Look around... leaves are brown... there's a patch of snow on the ground."
-# -- Simon & Garfunkel / 'A Hazy Shade'
-
-################################################################################
-
-import pg, sys, os, string, stat
-import utils, db_access
-import apt_pkg;
-
-################################################################################
-
-Cnf = None;
-projectB = None;
-
-################################################################################
-
-def main ():
- global Cnf, projectB;
-
- apt_pkg.init();
-
- Cnf = apt_pkg.newConfiguration();
- apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file());
-
- Arguments = [('d',"debug","Claire::Options::Debug", "IntVal"),
- ('h',"help","Claire::Options::Help"),
- ('v',"version","Claire::Options::Version")];
-
- apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv);
-
- projectB = pg.connect('projectb', 'localhost');
-
- db_access.init(Cnf, projectB);
-
- for dsc_file in sys.stdin.readlines():
- dsc_file = dsc_file[:-1];
- base_dsc_file = os.path.basename(dsc_file);
- print dsc_file
- dsc = utils.parse_changes(dsc_file);
- dsc_files = utils.build_file_list(dsc, 1);
- q = projectB.query("SELECT s.id, l.id, l.path FROM source s, location l, files f WHERE s.source = '%s' AND s.version = '%s' AND f.id = s.file AND f.location = l.id" % (dsc["source"], dsc["version"]));
- ql = q.getresult();
- if not ql or len(ql) > 1:
- print " EEEEEEEEEEEEEEK!!!"
- print " ",base_dsc_file
- source_id = ql[0][0];
- location_id = ql[0][1];
- location = ql[0][2];
- dsc_files[base_dsc_file] = {};
- dsc_files[base_dsc_file]["size"] = os.stat(dsc_file)[stat.ST_SIZE];
- dsc_files[base_dsc_file]["md5sum"] = apt_pkg.md5sum(utils.open_file(dsc_file,"r"));
- q = projectB.query("SELECT f.filename FROM dsc_files df, source s, files f WHERE s.id = '%s' AND df.source = s.id AND f.id = df.file" % (source_id));
- for i in q.getresult():
- file = os.path.basename(i[0]);
- if not dsc_files.has_key(file):
- if file != base_dsc_file:
- print " MWAAAP! MWAAP! Can't find %s!" % (file)
- else:
- del dsc_files[file];
- for i in dsc_files.keys():
- filename = os.path.dirname(dsc_file) + '/' + i;
- if not os.path.exists(filename):
- print " MWAAP!!!!!!!!!!!!!"
- print filename
- filename = string.replace(filename, location, '');
- #print " filename: ",filename
- #print " size: ", dsc_files[i]["size"]
- #print " md5sum: ",dsc_files[i]["md5sum"]
- #print " location_id: ", location_id
- files_id = db_access.get_files_id(filename, dsc_files[i]["size"], dsc_files[i]["md5sum"], location_id);
- if files_id < 0 or files_id == None:
- print " BORK!!!!!!!!!!!!"
- print " ",filename
- else:
- foo = 1
- #print "INSERT INTO dsc_files (source, file) VALUES ('%s', '%s')" % (source_id, files_id);
- projectB.query("INSERT INTO dsc_files (source, file) VALUES ('%s', '%s')" % (source_id, files_id));
- print " doh:",i
-
-#######################################################################################
-
-if __name__ == '__main__':
- main()
-