When inside fakeroot, directories with portage's gid appear
authorZac Medico <zmedico@gentoo.org>
Mon, 9 Jun 2008 15:17:18 +0000 (15:17 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 9 Jun 2008 15:17:18 +0000 (15:17 -0000)
to have root's gid. Therefore, use root's gid instead of
portage's gid to avoid spurrious permissions adjustments
when inside fakeroot. (trunk r10608)

svn path=/main/branches/2.1.2/; revision=10620

pym/portage.py

index 2a5f292573b10f5db06a6b0dd219fe7099fc52ad..68354a35831decf05fefd382d9f12907cfedf41d 100644 (file)
@@ -3380,6 +3380,13 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
                dirmode  = 02070
                filemode =   060
                modemask =    02
+               dir_gid = portage_gid
+               if "FAKED_MODE" in mysettings:
+                       # When inside fakeroot, directories with portage's gid appear
+                       # to have root's gid. Therefore, use root's gid instead of
+                       # portage's gid to avoid spurrious permissions adjustments
+                       # when inside fakeroot.
+                       dir_gid = 0
                distdir_dirs = [""]
                if "distlocks" in features:
                        distdir_dirs.append(".locks")
@@ -3387,13 +3394,13 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
                        
                        for x in distdir_dirs:
                                mydir = os.path.join(mysettings["DISTDIR"], x)
-                               if portage_util.ensure_dirs(mydir, gid=portage_gid, mode=dirmode, mask=modemask):
+                               if portage_util.ensure_dirs(mydir, gid=dir_gid, mode=dirmode, mask=modemask):
                                        writemsg("Adjusting permissions recursively: '%s'\n" % mydir,
                                                noiselevel=-1)
                                        def onerror(e):
                                                raise # bail out on the first error that occurs during recursion
                                        if not apply_recursive_permissions(mydir,
-                                               gid=portage_gid, dirmode=dirmode, dirmask=modemask,
+                                               gid=dir_gid, dirmode=dirmode, dirmask=modemask,
                                                filemode=filemode, filemask=modemask, onerror=onerror):
                                                raise portage_exception.OperationNotPermitted(
                                                        "Failed to apply recursive permissions for the portage group.")