Fix emerge --sync PORTDIR creation.
authorZac Medico <zmedico@gentoo.org>
Fri, 19 Nov 2010 18:57:35 +0000 (10:57 -0800)
committerZac Medico <zmedico@gentoo.org>
Fri, 19 Nov 2010 18:57:35 +0000 (10:57 -0800)
pym/_emerge/actions.py
pym/_emerge/main.py

index 03f7d313018fb3647e4bc91ff1326cf537575203..0247fd3f0b4225d648d7b8202373e7f2f9a28250 100644 (file)
@@ -1898,6 +1898,12 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
        emergelog(xterm_titles, " === sync")
        portdb = trees[settings["ROOT"]]["porttree"].dbapi
        myportdir = portdb.porttree_root
+       if not myportdir:
+               myportdir = settings.get('PORTDIR', '')
+               if myportdir and myportdir.strip():
+                       myportdir = os.path.realpath(myportdir)
+               else:
+                       myportdir = None
        out = portage.output.EOutput()
        global_config_path = GLOBAL_CONFIG_PATH
        if settings['EPREFIX']:
@@ -1915,7 +1921,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
                st = None
        if st is None:
                print(">>>",myportdir,"not found, creating it.")
-               os.makedirs(myportdir,0o755)
+               portage.util.ensure_dirs(myportdir, mode=0o755)
                st = os.stat(myportdir)
 
        usersync_uid = None
index fa8ddefc28b2bae0b7deebbe00136c7bfce7cae9..ec56e9d3df54148439bc90bf00d36d4b386cc6ae 100644 (file)
@@ -1511,8 +1511,7 @@ def emerge_main():
                                'prune', 'unmerge') or not \
                                (fetchonly or \
                                (buildpkgonly and secpass >= 1) or \
-                               myaction in ("metadata", "regen") or \
-                               (myaction == "sync" and os.access(settings["PORTDIR"], os.W_OK)))
+                               myaction in ("metadata", "regen", "sync"))
                        if portage.secpass < 1 or \
                                need_superuser:
                                if need_superuser: