VirtualBox

Ignore:
Timestamp:
Sep 1, 2022 3:39:51 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
153442
Message:

Validation Kit/testmanager/batch: Added maintain_archived_testsets.py batch job. Currently only supports deleting files within archived testset ZIPs and re-packing them, based on set criteria. See syntax help [pylint fixes]. bugref:8733

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/batch/maintain_archived_testsets.py

    r96566 r96567  
    6060from common                     import utils;
    6161from testmanager                import config;
    62 from testmanager.core.db        import TMDatabaseConnection;
    63 from testmanager.core.testset   import TestSetData, TestSetLogic;
    64 
    6562
    6663
     
    8279        self.sTempDir       = oOptions.sTempDir;
    8380        if not self.sTempDir:
    84             self.sTempDir   = '/tmp'; ## @todo Make this more flexible.
     81            self.sTempDir   = tempfile.gettempdir();
    8582        #self.oTestSetLogic = TestSetLogic(TMDatabaseConnection(self.dprint if self.fVerbose else None));
    8683        #self.oTestSetLogic = TestSetLogic(TMDatabaseConnection(None));
     
    109106        """
    110107
     108        _ = idTestSet
     109
    111110        sSrcZipFileAbs = os.path.join(sCurDir, sFile);
    112111        print('Processing ZIP archive "%s" ...' % (sSrcZipFileAbs));
    113112
    114         sDstZipFileAbs = os.path.join(self.sTempDir, next(tempfile._get_candidate_names()) + ".zip");
     113        with tempfile.NamedTemporaryFile(dir=self.sTempDir, delete=False) as tmpfile:
     114            sDstZipFileAbs = tmpfile.name
    115115        self.dprint('Using temporary ZIP archive "%s"' % (sDstZipFileAbs));
    116116
     
    190190                    return (None, 'Error opening "%s": %s' % (sSrcZipFileAbs, oXcpt1), None);
    191191                if not os.path.exists(sFile):
    192                     return (None, 'File "%s" not found. [%s, %s]' % (sSrcZipFileAbs, sFile), None);
     192                    return (None, 'File "%s" not found. [%s]' % (sSrcZipFileAbs, sFile), None);
    193193                return (None, 'Error opening "%s" inside "%s": %s' % (sSrcZipFileAbs, sFile, oXcpt1), None);
    194194            except Exception as oXcpt2:
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette