]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
build.py: Add a symlink for the logging
authorMark Hatle <mark.hatle@windriver.com>
Thu, 30 Sep 2010 20:04:18 +0000 (15:04 -0500)
committerChris Larson <chris_larson@mentor.com>
Fri, 3 Dec 2010 19:24:46 +0000 (12:24 -0700)
[BUGID #375]

When configuring for the log file output, we generate a symlink to the
target filename.  This link uses the same file naming, but without the
active pid, making it easier to see which log file is the last one
generated.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
lib/bb/build.py

index 2e7d75bc3341a11bbd0188377195f57ade43b072..8e8e31c4da692d1c72033404c109143c16406c97 100644 (file)
@@ -142,9 +142,22 @@ def exec_func(func, d, dirs = None):
     if not t:
         raise SystemExit("T variable not set, unable to build")
     bb.utils.mkdirhier(t)
+    loglink = "%s/log.%s" % (t, func)
     logfile = "%s/log.%s.%s" % (t, func, str(os.getpid()))
     runfile = "%s/run.%s.%s" % (t, func, str(os.getpid()))
 
+    # Even though the log file has not yet been opened, lets create the link
+    if loglink:
+        try:
+           os.remove(loglink)
+        except OSError as e:
+           pass
+
+        try:
+           os.symlink(logfile, loglink)
+        except OSError as e:
+           pass
+
     # Change to correct directory (if specified)
     if adir and os.access(adir, os.F_OK):
         os.chdir(adir)
@@ -210,6 +223,10 @@ def exec_func(func, d, dirs = None):
         if os.path.exists(logfile) and os.path.getsize(logfile) == 0:
             logger.debug(2, "Zero size logfile %s, removing", logfile)
             os.remove(logfile)
+            try:
+               os.remove(loglink)
+            except OSError as e:
+               pass
 
         # Close the backup fds
         os.close(osi[0])