dispatch-conf: suppress 'No such file' errors.
authorZac Medico <zmedico@gentoo.org>
Thu, 21 Oct 2010 15:28:24 +0000 (08:28 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 21 Oct 2010 16:09:33 +0000 (09:09 -0700)
This will fix bug #341463.

pym/portage/dispatch_conf.py

index e51e5cd138760bef51521f7c734542a6b9cd7906..5724d9169ecf2255166cf43c39fadd797ce4a37e 100644 (file)
@@ -83,11 +83,13 @@ def rcs_archive(archive, curconf, newconf, mrgconf):
     except OSError:
         pass
 
-    try:
-        shutil.copy2(curconf, archive)
-    except(IOError, os.error) as why:
-        print(_('dispatch-conf: Error copying %(curconf)s to %(archive)s: %(reason)s; fatal') % \
-              {"curconf": curconf, "archive": archive, "reason": str(why)}, file=sys.stderr)
+    if os.path.isfile(curconf):
+        try:
+            shutil.copy2(curconf, archive)
+        except(IOError, os.error) as why:
+            print(_('dispatch-conf: Error copying %(curconf)s to %(archive)s: %(reason)s; fatal') % \
+                {"curconf": curconf, "archive": archive, "reason": str(why)}, file=sys.stderr)
+
     if os.path.exists(archive + ',v'):
         os.system(RCS_LOCK + ' ' + archive)
     os.system(RCS_PUT + ' ' + archive)
@@ -142,11 +144,12 @@ def file_archive(archive, curconf, newconf, mrgconf):
 
         os.rename(archive, archive + '.1')
 
-    try:
-        shutil.copy2(curconf, archive)
-    except(IOError, os.error) as why:
-        print(_('dispatch-conf: Error copying %(curconf)s to %(archive)s: %(reason)s; fatal') % \
-              {"curconf": curconf, "archive": archive, "reason": str(why)}, file=sys.stderr)
+    if os.path.isfile(curconf):
+        try:
+            shutil.copy2(curconf, archive)
+        except(IOError, os.error) as why:
+            print(_('dispatch-conf: Error copying %(curconf)s to %(archive)s: %(reason)s; fatal') % \
+                {"curconf": curconf, "archive": archive, "reason": str(why)}, file=sys.stderr)
 
     if newconf != '':
         # Save off new config file in the archive dir with .dist.new suffix