Bug 756808 - Fix build error due to a trailing slash in the |DIRS| makefile variable; r=AryehGregor
authorMs2ger <ms2ger@gmail.com>
Sun, 20 May 2012 13:12:41 +0200
changeset 96729 b35ff14182870d708239be21cc11f6dc81628fe2
parent 96728 443c0c79e54f31c5887da1baf0ece0b2ee39a4bc
child 96730 5648c9a38933b385c3aa762c5ed579ea7100dcff
push id1439
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 20:19:22 +0000
treeherdermozilla-aurora@ea74834dccd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersAryehGregor
bugs756808
milestone15.0a1
Bug 756808 - Fix build error due to a trailing slash in the |DIRS| makefile variable; r=AryehGregor
dom/imptests/editing.mk
dom/imptests/importTestsuite.py
--- a/dom/imptests/editing.mk
+++ b/dom/imptests/editing.mk
@@ -1,3 +1,3 @@
 DIRS += \
-  editing/ \
+  editing \
   $(NULL)
--- a/dom/imptests/importTestsuite.py
+++ b/dom/imptests/importTestsuite.py
@@ -41,56 +41,62 @@ def getData(confFile):
         dest = line[idx + 1:].strip()
         first = False
       else:
         directories.append(line.strip())
   finally:
     fp.close()
     return repo, dest, directories
 
+def makePath(a, b):
+  if not b:
+    # Empty directory, i.e., the repository root.
+    return a
+  return "%s/%s" % (a, b)
+
 def copy(thissrcdir, dest, directories):
   """Copy mochitests and support files from the external HG directory to their
   place in mozilla-central.
   """
   print "Copying %s..." % (directories, )
   for d in directories:
     dirtocreate = dest
 
     subdirs, mochitests, supportfiles = parseManifestFile(dest, d)
-    if d:
-      sourcedir = "hg-%s/%s" % (dest, d)
-      destdir = "%s/%s" % (dest, d)
-    else:
-      # Empty directory, i.e., the repository root
-      sourcedir = "hg-%s" % dest
-      destdir = dest
+    sourcedir = makePath("hg-%s" % dest, d)
+    destdir = makePath(dest, d)
     os.makedirs(destdir)
 
     for mochitest in mochitests:
       shutil.copy("%s/%s" % (sourcedir, mochitest), "%s/test_%s" % (destdir, mochitest))
     for support in supportfiles:
       shutil.copy("%s/%s" % (sourcedir, support), "%s/%s" % (destdir, support))
 
     if len(subdirs):
       if d:
         importDirs(thissrcdir, dest, ["%s/%s" % (d, subdir) for subdir in subdirs])
       else:
         # Empty directory, i.e., the repository root
         importDirs(thissrcdir, dest, subdirs)
 
+def makefileString(entries):
+  if not len(entries):
+    return "  $(NULL)"
+  return "\n".join(["  %s \\" % (entry, ) for entry in entries]) + "\n  $(NULL)"
+
 def printMakefile(dest, directories):
   """Create a .mk file to be included into the main Makefile.in, which lists the
   directories with tests.
   """
   print "Creating .mk..."
   path = dest + ".mk"
   fp = open(path, "wb")
   fp.write("DIRS += \\\n")
-  fp.writelines(["  %s/%s \\\n" % (dest, d) for d in directories])
-  fp.write("  $(NULL)\n")
+  fp.write(makefileString([makePath(dest, d) for d in directories]))
+  fp.write("\n")
   fp.close()
   subprocess.check_call(["hg", "add", path])
 
 makefileTemplate = """# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
 
 DEPTH = ${depth}
 
 topsrcdir = @top_srcdir@
@@ -110,21 +116,16 @@ testsTemplate = """
 
 _TESTS += \\
 ${support}
 
 libs:: $$(_TESTS)
 \t$$(INSTALL) $$(foreach f,$$^,"$$f") $$(DEPTH)/_tests/testing/mochitest/tests/$$(relativesrcdir)
 """
 
-def makefileString(entries):
-  if not len(entries):
-    return "  $(NULL)"
-  return "\n".join(["  %s \\" % (entry, ) for entry in entries]) + "\n  $(NULL)"
-
 def printMakefiles(thissrcdir, dest, directories):
   """Create Makefile.in files for each directory that contains tests we import.
   """
   print "Creating Makefile.ins..."
   for d in directories:
     if d:
       path = "%s/%s" % (dest, d)
     else: