From 997f4432f3c09863ff906a55f5205245352f56b5 Mon Sep 17 00:00:00 2001 From: James Troup Date: Tue, 19 Dec 2000 17:23:03 +0000 Subject: [PATCH] Hopefully fix permissions problems. --- TODO | 1 + add_constraints.sql | 2 +- apt.conf | 10 +++++++ contrib/fix.b | 73 +++++++++++++++++++++++++++++++++++++++++++++ katie | 14 ++++++--- utils.py | 12 ++++++-- 6 files changed, 104 insertions(+), 8 deletions(-) create mode 100755 contrib/fix.b diff --git a/TODO b/TODO index ed959d74..e8cbcd3d 100644 --- a/TODO +++ b/TODO @@ -12,6 +12,7 @@ Less Urgent o Optimize all the queries by using EXAMINE and building some INDEXs. o enclose all the setting SQL stuff in transactions (mostly done). o clear out maintainers table + o jenna needs to use order by to keep aj from going nutzo == diff --git a/add_constraints.sql b/add_constraints.sql index a23951f7..d3f4fb97 100644 --- a/add_constraints.sql +++ b/add_constraints.sql @@ -77,7 +77,7 @@ GRANT ALL ON maintainer, maintainer_id_seq, source, source_id_seq, src_associations, src_associations_id_seq, suite, suite_architectures, suite_id_seq - TO GROUP ftpmaster; + TO troup; -- Give write privileges to the associations tables for AJ for the purposes of `testing' GRANT ALL ON diff --git a/apt.conf b/apt.conf index 6d0e6658..524c1aea 100644 --- a/apt.conf +++ b/apt.conf @@ -30,6 +30,16 @@ tree "dists/stable" SrcOverride "override.potato.$(SECTION).src"; }; +tree "dists/testing" +{ + FileList "/org/ftp.debian.org/database/dists/testing_$(SECTION)_binary-$(ARCH).list"; + SourceFileList "/org/ftp.debian.org/database/dists/testing_$(SECTION)_source.list"; + Sections "main contrib non-free"; + Architectures "alpha arm i386 m68k powerpc sparc source"; + BinOverride "override.woody.$(SECTION)"; + SrcOverride "override.woody.$(SECTION).src"; +}; + tree "dists/unstable" { FileList "/org/ftp.debian.org/database/dists/unstable_$(SECTION)_binary-$(ARCH).list"; diff --git a/contrib/fix.b b/contrib/fix.b new file mode 100755 index 00000000..d9866967 --- /dev/null +++ b/contrib/fix.b @@ -0,0 +1,73 @@ +#!/usr/bin/env python + +# Fix for bug in katie where dsc_files was initialized from changes and not dsc +# Copyright (C) 2000 James Troup +# $Id: fix.b,v 1.1 2000-12-19 17:23:03 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, re +import utils, db_access +import apt_pkg; + +################################################################################ + +Cnf = None; +projectB = None; + +bad_arch = re.compile(r'/binary-(hppa|mips|mipsel|sh|hurd-i386)/'); + +################################################################################ + +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); + + file = utils.open_file('x', 'r'); + for line in file.readlines(): + if string.find(line, '/binary-') != -1: + if bad_arch.search(line) != None: + new_line = string.replace(line, 'woody/', 'sid/'); + if new_line == line: + print line; + sys.exit(2); + line = new_line; + sys.stdout.write(line); + +####################################################################################### + +if __name__ == '__main__': + main() + diff --git a/katie b/katie index 194354a0..98083dea 100755 --- a/katie +++ b/katie @@ -2,7 +2,7 @@ # Installs Debian packaes # Copyright (C) 2000 James Troup -# $Id: katie,v 1.12 2000-12-18 07:11:25 troup Exp $ +# $Id: katie,v 1.13 2000-12-19 17:23:03 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 @@ -848,11 +848,17 @@ def reject (changes_filename, manual_reject_mail_filename): reason_filename = re_changes.sub("reason", base_changes_filename); reject_filename = "%s/REJECT/%s" % (Cnf["Dir::IncomingDir"], reason_filename); - # Move the .changes files and it's contents into REJECT/ - utils.move (changes_filename, "%s/REJECT/%s" % (Cnf["Dir::IncomingDir"], base_changes_filename)); + # Move the .changes files and it's contents into REJECT/ (if we can; errors are ignored) + try: + utils.move (changes_filename, "%s/REJECT/%s" % (Cnf["Dir::IncomingDir"], base_changes_filename)); + except cant_overwrite_exc: + pass; for file in files.keys(): if os.access(file,os.R_OK) == 0: - utils.move (file, "%s/REJECT/%s" % (Cnf["Dir::IncomingDir"], file)); + try: + utils.move (file, "%s/REJECT/%s" % (Cnf["Dir::IncomingDir"], file)); + except cant_overwrite_exc: + pass; # If this is not a manual rejection generate the .reason file and rejection mail message if manual_reject_mail_filename == "": diff --git a/utils.py b/utils.py index 193deafc..122b8dd7 100644 --- a/utils.py +++ b/utils.py @@ -1,6 +1,6 @@ # Utility functions # Copyright (C) 2000 James Troup -# $Id: utils.py,v 1.9 2000-12-18 07:11:25 troup Exp $ +# $Id: utils.py,v 1.10 2000-12-19 17:23:03 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 @@ -29,6 +29,7 @@ nk_format_exc = "Unknown Format: in .changes file"; no_files_exc = "No Files: field in .dsc file."; cant_open_exc = "Can't read file."; unknown_hostname_exc = "Unknown hostname"; +cant_overwrite_exc = "Permission denied; can't overwrite existent file." ###################################################################################### @@ -208,9 +209,12 @@ def move (src, dest): os.makedirs(dest_dir, 02775); os.umask(umask); #print "Moving %s to %s..." % (src, dest); - shutil.copy2(src, dest); if os.path.exists(dest) and os.path.isdir(dest): dest = dest + '/' + os.path.basename(src); + # Check for overwrite permission on existent files + if os.path.exists(dest) and not os.access(dest, os.W_OK): + raise cant_overwrite_exc + shutil.copy2(src, dest); os.chmod(dest, 0664); os.unlink(src); @@ -224,9 +228,11 @@ def copy (src, dest): os.makedirs(dest_dir, 02775); os.umask(umask); #print "Copying %s to %s..." % (src, dest); - shutil.copy2(src, dest); if os.path.exists(dest) and os.path.isdir(dest): dest = dest + '/' + os.path.basename(src); + if os.path.exists(dest) and not os.access(dest, os.W_OK): + raise cant_overwrite_exc + shutil.copy2(src, dest); os.chmod(dest, 0664); ###################################################################################### -- GitLab