Example #1
0
    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;
Example #2
0
    def prepareEnv(self):
        """
        Prepares the environment for annotating Linux reports.
        """
        fRc = False;
        try:
            sDbgArchive = os.path.join(self.sBuildRoot, 'bin', 'VirtualBoxDebug.tar.bz2');

            # Extract debug symbol archive if it was found.
            if os.path.exists(sDbgArchive):
                asMembers = utils.unpackFile(sDbgArchive, self.sScratchPath, self.fnLog,
                                             self.fnLog);
                if asMembers:
                    # Populate the list of debug files.
                    for sMember in asMembers:
                        if os.path.isfile(sMember):
                            sArch = '';
                            if 'amd64' in sMember:
                                sArch = 'amd64';
                            else:
                                sArch = 'x86';
                            self.asDbgFiles[os.path.basename(sMember) + '/' + sArch] = sMember;
                    fRc = True;
                else:
                    self.log('Unpacking the debug archive failed');
        except:
            self.log('Failed to setup debug symbols');

        return fRc;
    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 prepareEnv(self):
        """
        Prepares the environment for annotating Linux reports.
        """
        fRc = False;
        try:
            sDbgArchive = os.path.join(self.sBuildRoot, 'bin', 'VirtualBoxDebug.tar.bz2');

            # Extract debug symbol archive if it was found.
            if os.path.exists(sDbgArchive):
                asMembers = utils.unpackFile(sDbgArchive, self.sScratchPath, self.fnLog,
                                             self.fnLog);
                if asMembers:
                    # Populate the list of debug files.
                    for sMember in asMembers:
                        if os.path.isfile(sMember):
                            sArch = '';
                            if 'amd64' in sMember:
                                sArch = 'amd64';
                            else:
                                sArch = 'x86';
                            self.asDbgFiles[os.path.basename(sMember) + '/' + sArch] = sMember;
                    fRc = True;
                else:
                    self.log('Unpacking the debug archive failed');
        except:
            self.log('Failed to setup debug symbols');

        return fRc;
 def _maybeUnpackArchive(self, sMaybeArchive, fNonFatal = False):
     """
     Attempts to unpack the given build file.
     Updates _asBuildFiles.
     Returns True/False. No exceptions.
     """
     asMembers = utils.unpackFile(sMaybeArchive, self.sScratchPath, reporter.log,
                                  reporter.log if fNonFatal else reporter.error);
     if asMembers is None:
         return False;
     self._asBuildFiles.extend(asMembers);
     return True;
Example #6
0
 def _maybeUnpackArchive(self, sMaybeArchive, fNonFatal=False):
     """
     Attempts to unpack the given build file.
     Updates _asBuildFiles.
     Returns True/False. No exceptions.
     """
     asMembers = utils.unpackFile(
         sMaybeArchive, self.sScratchPath, reporter.log,
         reporter.log if fNonFatal else reporter.error)
     if asMembers is None:
         return False
     self._asBuildFiles.extend(asMembers)
     return True
    def _maybeUnpackArchive(self, sMaybeArchive, fNonFatal = False):
        """
        Attempts to unpack the given build file.
        Updates _asBuildFiles.
        Returns True/False. No exceptions.
        """
        def unpackFilter(sMember):
            # type: (string) -> bool
            """ Skips debug info. """
            sLower = sMember.lower();
            if sLower.endswith('.pdb'):
                return False;
            return True;

        asMembers = utils.unpackFile(sMaybeArchive, self.sScratchPath, reporter.log,
                                     reporter.log if fNonFatal else reporter.error,
                                     fnFilter = unpackFilter);
        if asMembers is None:
            return False;
        self._asBuildFiles.extend(asMembers);
        return True;
Example #8
0
    def _maybeUnpackArchive(self, sMaybeArchive, fNonFatal = False):
        """
        Attempts to unpack the given build file.
        Updates _asBuildFiles.
        Returns True/False. No exceptions.
        """
        def unpackFilter(sMember):
            # type: (string) -> bool
            """ Skips debug info. """
            sLower = sMember.lower();
            if sLower.endswith('.pdb'):
                return False;
            return True;

        asMembers = utils.unpackFile(sMaybeArchive, self.sScratchPath, reporter.log,
                                     reporter.log if fNonFatal else reporter.error,
                                     fnFilter = unpackFilter);
        if asMembers is None:
            return False;
        self._asBuildFiles.extend(asMembers);
        return True;
    def prepareEnv(self):
        """
        Prepares the environment for annotating Linux reports.
        """
        fRc = False
        try:
            sDbgArchive = os.path.join(self.sBuildRoot, 'bin',
                                       'VirtualBox-dbg.tar.bz2')

            # Extract debug symbol archive if it was found.
            if os.path.exists(sDbgArchive):
                asMembers = utils.unpackFile(sDbgArchive, self.sScratchPath,
                                             self.fnLog, self.fnLog)
                if asMembers:
                    # Populate the list of debug files.
                    for sMember in asMembers:
                        if os.path.isfile(sMember):
                            self.asDbgFiles[os.path.basename(
                                sMember)] = sMember
                    fRc = True
        except:
            self.log('Failed to setup debug symbols')

        return fRc