VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/testmanager/batch/del_build.py@ 79723

Last change on this file since 79723 was 79087, checked in by vboxsync, 6 years ago

ValKit: New pylint version - cleanup in progress.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# $Id: del_build.py 79087 2019-06-11 11:58:28Z vboxsync $
4# pylint: disable=line-too-long
5
6"""
7Interface used by the tinderbox server side software to mark build binaries
8deleted.
9"""
10
11from __future__ import print_function;
12
13__copyright__ = \
14"""
15Copyright (C) 2012-2019 Oracle Corporation
16
17This file is part of VirtualBox Open Source Edition (OSE), as
18available from http://www.virtualbox.org. This file is free software;
19you can redistribute it and/or modify it under the terms of the GNU
20General Public License (GPL) as published by the Free Software
21Foundation, in version 2 as it comes in the "COPYING" file of the
22VirtualBox OSE distribution. VirtualBox OSE is distributed in the
23hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
24
25The contents of this file may alternatively be used under the terms
26of the Common Development and Distribution License Version 1.0
27(CDDL) only, as it comes in the "COPYING.CDDL" file of the
28VirtualBox OSE distribution, in which case the provisions of the
29CDDL are applicable instead of those of the GPL.
30
31You may elect to license modified versions of this file under the
32terms and conditions of either the GPL or the CDDL or both.
33"""
34__version__ = "$Revision: 79087 $"
35
36# Standard python imports
37import sys
38import os
39from optparse import OptionParser; # pylint: disable=deprecated-module
40
41# Add Test Manager's modules path
42g_ksTestManagerDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
43sys.path.append(g_ksTestManagerDir)
44
45# Test Manager imports
46from testmanager.core.db import TMDatabaseConnection
47from testmanager.core.build import BuildLogic
48
49
50def markBuildsDeleted():
51 """
52 Marks the builds using the specified binaries as deleted.
53 """
54
55 oParser = OptionParser()
56 oParser.add_option('-q', '--quiet', dest='fQuiet', action='store_true',
57 help='Quiet execution');
58
59 (oConfig, asArgs) = oParser.parse_args()
60 if not asArgs:
61 if not oConfig.fQuiet:
62 sys.stderr.write('syntax error: No builds binaries specified\n');
63 return 1;
64
65
66 oDb = TMDatabaseConnection()
67 oLogic = BuildLogic(oDb)
68
69 for sBuildBin in asArgs:
70 try:
71 cBuilds = oLogic.markDeletedByBinaries(sBuildBin, fCommit = True)
72 except:
73 if oConfig.fQuiet:
74 sys.exit(1);
75 raise;
76 else:
77 if not oConfig.fQuiet:
78 print("del_build.py: Marked %u builds associated with '%s' as deleted." % (cBuilds, sBuildBin,));
79
80 oDb.close()
81 return 0;
82
83if __name__ == '__main__':
84 sys.exit(markBuildsDeleted())
85
Note: See TracBrowser for help on using the repository browser.

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