For initial gentoo-x86 checkout, if $PORTDIR exists and is empty then remove it so...
authorZac Medico <zmedico@gentoo.org>
Sat, 11 Nov 2006 23:24:22 +0000 (23:24 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 11 Nov 2006 23:24:22 +0000 (23:24 -0000)
svn path=/main/trunk/; revision=5008

bin/emerge

index 89e8633a1c5f609b9bfa98f952dff8d1adfd3fc2..00fca815f5c5eadcf36282ba5cf71adaa120faf9 100755 (executable)
@@ -3405,12 +3405,17 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
                if not os.path.exists(myportdir+"/CVS"):
                        #initial checkout
                        print ">>> Starting initial cvs checkout with "+syncuri+"..."
-                       if os.path.exists(myportdir):
-                               print "!!! existing '%s' directory; exiting." % myportdir
-                               sys.exit(1)
                        if os.path.exists(cvsdir+"/gentoo-x86"):
                                print "!!! existing",cvsdir+"/gentoo-x86 directory; exiting."
                                sys.exit(1)
+                       try:
+                               os.rmdir(myportdir)
+                       except OSError, e:
+                               if e.errno != errno.ENOENT:
+                                       sys.stderr.write(
+                                               "!!! existing '%s' directory; exiting.\n" % myportdir)
+                                       sys.exit(1)
+                               del e
                        if portage.spawn("cd "+cvsdir+"; cvs -z0 -d "+cvsroot+" co -P gentoo-x86",settings,free=1):
                                print "!!! cvs checkout error; exiting."
                                sys.exit(1)