def _downloadAndUnpackScriptZips(self): """ Downloads/copies the script ZIPs into TESTBOX_SCRIPT and unzips them to the same directory. Raises no exceptions, returns log + success indicator instead. """ sPathScript = self._oTestBoxScript.getPathScripts(); asArchives = self._sScriptZips.split(','); for sArchive in asArchives: sArchive = sArchive.strip(); if not sArchive: continue; # Figure the destination name (in scripts). sDstFile = webutils.getFilename(sArchive); if len(sDstFile) < 1 \ or re.search('[^a-zA-Z0-9 !#$%&\'()@^_`{}~.-]', sDstFile) is not None: # FAT charset sans 128-255 + '.'. self._log('Malformed script zip filename: %s' % (sArchive,)); return False; sDstFile = os.path.join(sPathScript, sDstFile); # Do the work. if webutils.downloadFile(sArchive, sDstFile, self._oTestBoxScript.getPathBuilds(), self._log, self._log) is not True: return False; asFiles = utils.unpackFile(sDstFile, sPathScript, self._log, self._log); if asFiles is None: return False; # Since zip files doesn't always include mode masks, set the X bit # of all of them so we can execute binaries and hash-bang scripts. for sFile in asFiles: utils.chmodPlusX(sFile); return True;
def _anchorAndAppendBinaries(self, sBinaries, aoRows): """ Formats each binary (if any) into a row with a download link. """ if sBinaries is not None: for sBinary in sBinaries.split(','): if not webutils.hasSchema(sBinary): sBinary = config.g_ksBuildBinUrlPrefix + sBinary; aoRows.append([WuiLinkBase(webutils.getFilename(sBinary), sBinary, fBracketed = False),]); return aoRows;
def completeOptions(self): # # Check that we've got what we need. # if len(self._asBuildUrls) == 0: reporter.error('No build files specfiied ("--vbox-build file1[,file2[...]]")'); return False; if len(self._asSubDriver) == 0: reporter.error('No sub testdriver specified. (" -- test/stuff/tdStuff1.py args")'); return False; # # Construct _asBuildFiles as an array parallel to _asBuildUrls. # for sUrl in self._asBuildUrls: sDstFile = os.path.join(self.sScratchPath, webutils.getFilename(sUrl)); self._asBuildFiles.append(sDstFile); return TestDriverBase.completeOptions(self);
def completeOptions(self): # # Check that we've got what we need. # if not self._asBuildUrls: reporter.error('No build files specfiied ("--vbox-build file1[,file2[...]]")'); return False; if not self._asSubDriver: reporter.error('No sub testdriver specified. (" -- test/stuff/tdStuff1.py args")'); return False; # # Construct _asBuildFiles as an array parallel to _asBuildUrls. # for sUrl in self._asBuildUrls: sDstFile = os.path.join(self.sScratchPath, webutils.getFilename(sUrl)); self._asBuildFiles.append(sDstFile); return TestDriverBase.completeOptions(self);