From ad2118adbea1483fe4d88204afacc74e668c4284 Mon Sep 17 00:00:00 2001 From: James Troup Date: Sun, 26 Nov 2000 16:35:41 +0000 Subject: [PATCH] Fix CopyChanges handling --- katie | 7 +++---- utils.py | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/katie b/katie index 4884a513..dee7a971 100755 --- a/katie +++ b/katie @@ -2,7 +2,7 @@ # Installs Debian packaes # Copyright (C) 2000 James Troup -# $Id: katie,v 1.2 2000-11-24 00:35:45 troup Exp $ +# $Id: katie,v 1.3 2000-11-26 16:35: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 @@ -663,9 +663,8 @@ def install (changes_filename, summary, short_summary): # Copy the .changes file across for suite which need it. for suite in changes["distribution"].keys(): - if Cnf.has_key("Suties::%s::CopyChanges" % (suite)): - destination = Cnf["Dir::RootDir"] + Cnf["Suite::%s::CopyChanges" % (suite)] + os.path.basename(changes_filename) - copy_file (changes_filename, destination) + if Cnf.has_key("Suite::%s::CopyChanges" % (suite)): + utils.copy (changes_filename, Cnf["Dir::RootDir"] + Cnf["Suite::%s::CopyChanges" % (suite)]); # 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 diff --git a/utils.py b/utils.py index 1afcb77b..57a2cdba 100644 --- a/utils.py +++ b/utils.py @@ -1,6 +1,6 @@ # Utility functions # Copyright (C) 2000 James Troup -# $Id: utils.py,v 1.2 2000-11-25 04:18:30 troup Exp $ +# $Id: utils.py,v 1.3 2000-11-26 16:35: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 @@ -209,6 +209,19 @@ def move (src, dest): os.chmod(dest, 0664); os.unlink(src); +def copy (src, dest): + if os.path.exists(dest) and stat.S_ISDIR(os.stat(dest)[stat.ST_MODE]): + dest_dir = dest; + else: + dest_dir = os.path.dirname(dest); + if not os.path.exists(dest_dir): + umask = os.umask(00000); + os.makedirs(dest_dir, 02775); + os.umask(umask); + #print "Copying %s to %s..." % (src, dest); + shutil.copy2(src, dest); + os.chmod(dest, 0664); + ###################################################################################### # FIXME: this is inherently nasty. Can't put this mapping in a conf -- 2.39.5