Closed Bug 1385743 Opened 6 years ago Closed 6 years ago

build-clang.py fails to build recent trunk on windows

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(firefox57 fixed)

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: glandium, Assigned: ting)

Details

Attachments

(1 file)

Traceback (most recent call last):
  File "build/src/build/build-clang/build-clang.py", line 496, in <module>
    symlink(l[0], l[1])
  File "build/src/build/build-clang/build-clang.py", line 31, in symlink
    copy_dir_contents(source, link_name)
  File "build/src/build/build-clang/build-clang.py", line 109, in copy_dir_contents
    shutil.copy2(f, destname)
  File "c:\mozilla-build\python\Lib\shutil.py", line 130, in copy2
    copyfile(src, dst)
  File "c:\mozilla-build\python\Lib\shutil.py", line 83, in copyfile
    with open(dst, 'wb') as fdst:
IOError: [Errno 2] No such file or directory: 'Z:\\task_1501385262\\llvm-sources/src/llvm/projects/libcxx/appveyor-reqs-install.cmd'
It's because the first |f| to copy in copy_dir_contents() is a file not a directory which the destination directory haven't been created yet, so copy2() raises the error. If the first |f| is a directory, copytree() will create the target directory.

delete Z:\task_1502879543\llvm-sources/src/llvm/projects/libcxx
copy Z:\task_1502879543\llvm-sources/src/libcxx\appveyor-reqs-install.cmd to Z:\task_1502879543\llvm-sources/src/llvm/projects/libcxx/appveyor-reqs-install.cmd
Traceback (most recent call last):
  File "build/src/build/build-clang/build-clang.py", line 492, in <module>
    symlink(l[0], l[1])
  File "build/src/build/build-clang/build-clang.py", line 29, in symlink
    copy_dir_contents(source, link_name)
  File "build/src/build/build-clang/build-clang.py", line 103, in copy_dir_contents
    shutil.copy2(f, destname)
  File "c:\mozilla-build\python\Lib\shutil.py", line 130, in copy2
    copyfile(src, dst)
  File "c:\mozilla-build\python\Lib\shutil.py", line 83, in copyfile
    with open(dst, 'wb') as fdst:
IOError: [Errno 2] No such file or directory: 'Z:\\task_1502879543\\llvm-sources/src/llvm/projects/libcxx/appveyor-reqs-install.cmd'
Assignee: nobody → janus926
Status: NEW → ASSIGNED
Comment on attachment 8898122 [details]
Bug 1385743 - Use copy_tree() to copy directory recursively instead.

https://reviewboard.mozilla.org/r/169462/#review174898

Wow, thank you!  I didn't know Python has a built-in way to do this.  Much better!

::: commit-message-6ebc2:3
(Diff revision 1)
> +Bug 1385743 - Use copy_tree() to copy directory recursively instead. r?ehsan
> +
> +shutil.copy2() will fail if the destination directory isn't existed.

Nit: s/isn't existed/doesn't exist/  :-)
Attachment #8898122 - Flags: review?(ehsan) → review+
Pushed by tchou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/156a87d9fb99
Use copy_tree() to copy directory recursively instead. r=Ehsan
https://hg.mozilla.org/mozilla-central/rev/156a87d9fb99
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.