Repository navigation
Fix firefox karma tests with support for extracting rules_webtesting archive files - #299
gregmagolan wants to merge 4 commits into
Conversation
| // We need to chmod the executable to executable since adm-zip doesn't handle that | ||
| fs.chmodSync(extractedExecutablePath, 755); | ||
| } else { | ||
| // If we're on OSX or Linux then we can use the provided rules_webtesting |
There was a problem hiding this comment.
could we do it with adm-zip always? why have two different modes if one of them is broken on windows
There was a problem hiding this comment.
that was my original plan. however on Linux the archive is a tar.xz which adm-zip doesn't handle
|
|
||
| // Helper function to find a particular namedFile | ||
| // within the webTestMetadata webTestFiles | ||
| function findNamedFile(webTestMetadata, key) { |
There was a problem hiding this comment.
seems like we could remove all the helper code for the extract_exe if we always unzip ourselves?
There was a problem hiding this comment.
same as above: that was my original plan. however on Linux the archive is a tar.xz which adm-zip doesn't handle
There was a problem hiding this comment.
what about https://www.npmjs.com/package/xz + https://www.npmjs.com/package/tar ?
I don't love adding external dependencies but also this could be a lot simpler, WDYT?
There was a problem hiding this comment.
Yea. Using the provided EXTRACT_EXE is not ideal. I'll try those packages out.
There was a problem hiding this comment.
I thought about this some more and looked at the npm packages. I think we'll run into trouble supporting the various compression formats in node. On Windows we can assume it will be a .zip file. On linux/OSX you may get .tar.bz2 (which is what it is currently actually and not tar.xz) or tar.gz or tar.xz in the future. If we stick to using EXTRACT_EXE then it ensures we can always extract on Linux and OSX:
if [[ "${BASENAME}" == *.deb ]]; then
wrap dpkg -x "${ARCHIVE}" "${OUT_DIR}"
elif [[ "${BASENAME}" == *.tar ]]; then
wrap tar xf "${ARCHIVE}" -C "${OUT_DIR}"
elif [[ "${BASENAME}" == *.tar.bz2 || "${BASENAME}" == *.tbz2 ]]; then
wrap tar xjf "${ARCHIVE}" -C "${OUT_DIR}"
elif [[ "${BASENAME}" == *.tar.gz || "${BASENAME}" == *.tgz ]]; then
wrap tar xzf "${ARCHIVE}" -C "${OUT_DIR}"
elif [[ "${BASENAME}" == *.tar.Z ]]; then
wrap tar xZf "${ARCHIVE}" -C "${OUT_DIR}"
elif [[ "${BASENAME}" == *.zip ]]; then
wrap unzip "${ARCHIVE}" -d "${OUT_DIR}"
else
>&2 printf "${ARCHIVE} is not a supported file type."
exit -1
fi
There was a problem hiding this comment.
Okay I think @DrMarcII might be interested, seems like EXTRACT EXE should be fixed in windows
There was a problem hiding this comment.
I decided trying to make this work on Windows was too much work, so made a separate script: https://github.com/bazelbuild/rules_webtesting/blob/master/web/internal/extract.bat
There was a problem hiding this comment.
@DrMarcII Ahhh. That's good to know. I didn't notice that. Can use EXTRACT_EXE on all platforms then 👍
|
@alexeagle Removed adm-zip :) Using EXTRACT_EXE on all platforms as since it is a |
| try { | ||
| // Paths are relative to the 'external' folder within runfiles | ||
| extractExe = extractExe ? path.join('external', extractExe) : extractExe; | ||
| archiveFile = path.join('external', archiveFile) |
There was a problem hiding this comment.
is this going to work with the --nolegacy_external_runfiles flag?
I'll wait for that one to land before doing this one.
also missing a trailing semicolon :0
There was a problem hiding this comment.
thanks. I'll rebase to and let CI run on it,.
Resolves #296