~fginther/jenkins-launchpad-plugin/getPackageVersion-dev

« back to all changes in this revision

Viewing changes to getPackageVersion.py

  • Committer: Francis Ginther
  • Date: 2012-10-16 20:42:58 UTC
  • Revision ID: francis.ginther@canonical.com-20121016204258-422fcmkzc1oeebcl
Add option for specifing a merge event to auto-increment the trunk revisions

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
from bzrrecipe import BzrRecipe
6
6
from dputrunner import DputRunner
7
7
import os
 
8
import sys
8
9
 
9
10
 
10
11
class StringSplitAction(argparse.Action):
31
32
                        help="Distribution (e.g. quantal)")
32
33
    parser.add_argument('-b', '--build-number', required=True,
33
34
                        help="Build number")
 
35
    parser.add_argument('-m', '--merge', action='store_true',
 
36
                        help="Build is a merge, automatically increment " +
 
37
                        "trunk rev (cannot be combined with --trunk-rev)")
34
38
    args = vars(parser.parse_args())
 
39
    if (args['merge'] == True) and (not args['trunk_rev'] is None):
 
40
        print("ERROR: -m/--merge and -r/--trunk-rev cannot be combined")
 
41
        parser.print_help()
 
42
        sys.exit(-1)
35
43
 
36
44
    dputrunner = DputRunner(ppas=None,
37
45
                            trunk=args['target_branch'],
48
56
    # recipe.getTrunkRevno() will return the latest revno in launchpad.
49
57
    # For the package version string, we want the next version so as to
50
58
    # sync up with the MP candidate after it is merged to trunk.
51
 
    trunk_rev = recipe.getTrunkRevno() + 1
 
59
    trunk_rev = recipe.getTrunkRevno()
 
60
    if args['merge'] == True:
 
61
        trunk_rev += 1
52
62
    if not args['trunk_rev'] is None:
53
63
        trunk_rev = args['trunk_rev']
54
64