VirtualBox

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

Last change on this file since 98655 was 98655, checked in by vboxsync, 2 years ago

ValKit: Pylint 2.16.2 adjustments.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# $Id: del_build.py 98655 2023-02-20 15:05:40Z 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-2023 Oracle and/or its affiliates.
16
17This file is part of VirtualBox base platform packages, as
18available from https://www.virtualbox.org.
19
20This program is free software; you can redistribute it and/or
21modify it under the terms of the GNU General Public License
22as published by the Free Software Foundation, in version 3 of the
23License.
24
25This program is distributed in the hope that it will be useful, but
26WITHOUT ANY WARRANTY; without even the implied warranty of
27MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28General Public License for more details.
29
30You should have received a copy of the GNU General Public License
31along with this program; if not, see <https://www.gnu.org/licenses>.
32
33The contents of this file may alternatively be used under the terms
34of the Common Development and Distribution License Version 1.0
35(CDDL), a copy of it is provided in the "COPYING.CDDL" file included
36in the VirtualBox distribution, in which case the provisions of the
37CDDL are applicable instead of those of the GPL.
38
39You may elect to license modified versions of this file under the
40terms and conditions of either the GPL or the CDDL or both.
41
42SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
43"""
44__version__ = "$Revision: 98655 $"
45
46# Standard python imports
47import sys
48import os
49from optparse import OptionParser; # pylint: disable=deprecated-module
50
51# Add Test Manager's modules path
52g_ksTestManagerDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
53sys.path.append(g_ksTestManagerDir)
54
55# Test Manager imports
56from testmanager.core.db import TMDatabaseConnection
57from testmanager.core.build import BuildLogic
58
59
60def markBuildsDeleted():
61 """
62 Marks the builds using the specified binaries as deleted.
63 """
64
65 oParser = OptionParser()
66 oParser.add_option('-q', '--quiet', dest='fQuiet', action='store_true',
67 help='Quiet execution');
68
69 (oConfig, asArgs) = oParser.parse_args()
70 if not asArgs:
71 if not oConfig.fQuiet:
72 sys.stderr.write('syntax error: No builds binaries specified\n');
73 return 1;
74
75
76 oDb = TMDatabaseConnection()
77 oLogic = BuildLogic(oDb)
78
79 for sBuildBin in asArgs:
80 try:
81 cBuilds = oLogic.markDeletedByBinaries(sBuildBin, fCommit = True)
82 except:
83 if oConfig.fQuiet:
84 sys.exit(1);
85 raise;
86 if not oConfig.fQuiet:
87 print("del_build.py: Marked %u builds associated with '%s' as deleted." % (cBuilds, sBuildBin,));
88
89 oDb.close()
90 return 0;
91
92if __name__ == '__main__':
93 sys.exit(markBuildsDeleted())
94
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