Cleaned up directory after copy of tools from perforce directory

Got rid of stale copies of some tools like "crosperf" and moved all
files under v14 directory (that came from perforce) into the top
directory.

BUG=None
TEST=None

Change-Id: I408d17a36ceb00e74db71403d2351fd466a14f8e
Reviewed-on: https://gerrit-int.chromium.org/33887
Tested-by: Luis Lozano <llozano@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@google.com>
Commit-Queue: Luis Lozano <llozano@chromium.org>
diff --git a/utils/misc.py b/utils/misc.py
index 4062251..175a6e0 100644
--- a/utils/misc.py
+++ b/utils/misc.py
@@ -145,19 +145,25 @@
   return os.path.exists(image_label)
 
 
-def GetBuildPackagesCommand(board, usepkg=False):
+def GetBuildPackagesCommand(board, usepkg=False, debug=False):
   if usepkg:
     usepkg_flag = "--usepkg"
   else:
     usepkg_flag = "--nousepkg"
+  if debug:
+    withdebug_flag = '--withdebug'
+  else:
+    withdebug_flag = '--nowithdebug'
   return ("./build_packages %s --withdev --withtest --withautotest "
-          "--skip_toolchain_update --nowithdebug --board=%s" %
-          (usepkg_flag, board))
+          "--skip_toolchain_update %s --board=%s" %
+          (usepkg_flag, withdebug_flag, board))
 
 
-def GetBuildImageCommand(board):
-  return "./build_image --board=%s test" % board
-
+def GetBuildImageCommand(board, dev=False):
+  dev_args = ""
+  if dev:
+    dev_args = "--noenable_rootfs_verification --disk_layout=2gb-rootfs"
+  return "./build_image --board=%s %s test" % (board, dev_args)
 
 def GetSetupBoardCommand(board, gcc_version=None, binutils_version=None,
                          usepkg=None, force=None):
@@ -252,14 +258,17 @@
   abs_path = os.path.abspath(lock_file)
   dir_path = os.path.dirname(abs_path)
   sleep_time = min(10, timeout/10.0)
+  reason = "pid: {0}, commad: {1}".format(os.getpid(),
+                                          sys.argv[0])
   if not os.path.exists(dir_path):
     try:
-      os.makedirs(dir_path)
+      with lock_machine.FileCreationMask(0002):
+        os.makedirs(dir_path)
     except OSError:
       print "Cannot create dir {0}, exiting...".format(dir_path)
       exit(0)
   while True:
-    locked = (lock_machine.Lock(lock_file).NonBlockingLock(True, sys.argv[0]))
+    locked = (lock_machine.Lock(lock_file).NonBlockingLock(True, reason))
     if locked:
       break
     time.sleep(sleep_time)