Allow sync for unpriviledges users if they have write access to $PORTDIR
authorMarius Mauch <genone@gentoo.org>
Sat, 23 Jun 2007 15:50:35 +0000 (15:50 -0000)
committerMarius Mauch <genone@gentoo.org>
Sat, 23 Jun 2007 15:50:35 +0000 (15:50 -0000)
svn path=/main/trunk/; revision=6973

pym/emerge/__init__.py

index 17ff8d58dd324350a40627f310eb1950ed169ace..fc23f5dc62070b4c0f79fbf2f2fe7e794f3c6ba1 100644 (file)
@@ -5618,12 +5618,12 @@ def emerge_main():
        # check if root user is the current user for the actions where emerge needs this
        if portage.secpass < 2:
                # We've already allowed "--version" and "--help" above.
-               if "--pretend" not in myopts and \
-               myaction not in ("search","info"):
+               if "--pretend" not in myopts and myaction not in ("search","info"):
                        need_superuser = not \
                                ("--fetchonly" in myopts or \
                                "--fetch-all-uri" in myopts or \
-                               myaction in ("metadata", "regen"))
+                               myaction in ("metadata", "regen") or \
+                               (myaction == "sync" and os.access(settings["PORTDIR"], os.W_OK))
                        if portage.secpass < 1 or \
                                need_superuser:
                                if need_superuser: