[ostree] ostbuild: Don't run fakeroot if we are root



commit 86adf002ffd1ccf527a3bb82a43f0cda4548bf53
Author: Colin Walters <walters verbum org>
Date:   Sun Nov 27 20:31:23 2011 -0500

    ostbuild: Don't run fakeroot if we are root
    
    For efficiency reasons, as well as a quick shortcut to avoid pulling
    fakeroot into the gnomeos yocto layer.

 src/ostbuild/ostbuild-compile-one-impl |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/src/ostbuild/ostbuild-compile-one-impl b/src/ostbuild/ostbuild-compile-one-impl
index f71c1e1..fce90f3 100755
--- a/src/ostbuild/ostbuild-compile-one-impl
+++ b/src/ostbuild/ostbuild-compile-one-impl
@@ -217,7 +217,11 @@ def make_artifact(name, from_files, fakeroot_temp=None, tempdir=None):
         f.write(filename)
         f.write('\n')
     f.close()
-    args = ['fakeroot', '-i', fakeroot_temp, 'tar', '-c', '-z', '-C', tempdir, '-f', targz_name, '-T', filelist_temp]
+    if fakeroot_temp:
+        args = ['fakeroot', '-i', fakeroot_temp]
+    else:
+        args = []
+    args.extend(['tar', '-c', '-z', '-C', tempdir, '-f', targz_name, '-T', filelist_temp])
     run_sync(args)
     log("created: %s" % (os.path.abspath (targz_name), ))
 
@@ -232,12 +236,19 @@ def phase_make_artifacts(builddir=None):
 
     artifact_prefix='artifact-%s,%s' % (basename, version)
 
-    (fd,fakeroot_temp)=tempfile.mkstemp(prefix='ostree-fakeroot-%s-' % (basename,))
-    os.close(fd)
-    tempfiles.append(fakeroot_temp)
+    if os.getuid() != 0:
+        (fd,fakeroot_temp)=tempfile.mkstemp(prefix='ostree-fakeroot-%s-' % (basename,))
+        os.close(fd)
+        tempfiles.append(fakeroot_temp)
+    else:
+        fakeroot_temp = None
     tempdir = tempfile.mkdtemp(prefix='ostree-build-%s-' % (basename,))
     tempfiles.append(tempdir)
-    args = ['fakeroot', '-s', fakeroot_temp, 'make', 'install', 'DESTDIR=' + tempdir]
+    if fakeroot_temp is not None:
+        args = ['fakeroot', '-s', fakeroot_temp]
+    else:
+        args = []
+    args.extend(['make', 'install', 'DESTDIR=' + tempdir])
     run_sync(args, cwd=builddir)
 
     devel_files = set()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]