From 7cd90408efd0ccf9727037233dfa1266f57d48d2 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 23 Jun 2007 11:07:16 +0000 Subject: For bug #182964, replace os.rename() with shutil.move() in order to handle EXDEV errors that are triggered by layered filesystems. (trunk r6967) svn path=/main/branches/2.1.2/; revision=6968 --- pym/dispatch_conf.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'pym/dispatch_conf.py') diff --git a/pym/dispatch_conf.py b/pym/dispatch_conf.py index 690772bf8..6df0146d5 100644 --- a/pym/dispatch_conf.py +++ b/pym/dispatch_conf.py @@ -7,7 +7,7 @@ # Library by Wayne Davison , derived from code # written by Jeremy Wohl (http://igmus.org) -from stat import * +from stat import ST_GID, ST_MODE, ST_UID import os, sys, commands, shutil import portage @@ -72,7 +72,7 @@ def rcs_archive(archive, curconf, newconf, mrgconf): os.system(RCS_GET + ' -r' + RCS_BRANCH + ' ' + archive) has_branch = os.path.exists(archive) if has_branch: - os.rename(archive, archive + '.dist') + shutil.move(archive, archive + '.dist') try: shutil.copy2(newconf, archive) @@ -87,7 +87,7 @@ def rcs_archive(archive, curconf, newconf, mrgconf): mystat = os.lstat(newconf) os.chmod(mrgconf, mystat[ST_MODE]) os.chown(mrgconf, mystat[ST_UID], mystat[ST_GID]) - os.rename(archive, archive + '.dist.new') + shutil.move(archive, archive + '.dist.new') return ret @@ -112,10 +112,10 @@ def file_archive(archive, curconf, newconf, mrgconf): suf += 1 while suf > 1: - os.rename(archive + '.' + str(suf-1), archive + '.' + str(suf)) + shutil.move(archive + '.' + str(suf-1), archive + '.' + str(suf)) suf -= 1 - os.rename(archive, archive + '.1') + shutil.move(archive, archive + '.1') try: shutil.copy2(curconf, archive) @@ -145,7 +145,7 @@ def file_archive(archive, curconf, newconf, mrgconf): def rcs_archive_post_process(archive): """Check in the archive file with the .dist.new suffix on the branch and remove the one with the .dist suffix.""" - os.rename(archive + '.dist.new', archive) + shutil.move(archive + '.dist.new', archive) if os.path.exists(archive + '.dist'): # Commit the last-distributed version onto the branch. os.system(RCS_LOCK + RCS_BRANCH + ' ' + archive) @@ -158,4 +158,4 @@ def rcs_archive_post_process(archive): def file_archive_post_process(archive): """Rename the archive file with the .dist.new suffix to a .dist suffix""" - os.rename(archive + '.dist.new', archive + '.dist') + shutil.move(archive + '.dist.new', archive + '.dist') -- cgit v1.2.3-1-g7c22