This repository was archived by the owner on Jan 3, 2023. It is now read-only.
forked from ashutoshshanker/reltools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprepForBuild.py
More file actions
69 lines (55 loc) · 2.23 KB
/
prepForBuild.py
File metadata and controls
69 lines (55 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import os
import json
from fabric.api import run, env, local
from fabric.context_managers import lcd
from json import dumps, load
from optparse import OptionParser
SETUPFILE = 'setupInfo.json'
PKGFILE = 'pkgInfo.json'
if __name__ == '__main__':
parser = OptionParser()
parser.add_option("-e", "--edit",
dest="edit",
action='store_true',
default=False,
help="Edit revision")
parser.add_option("-b", "--branch",
dest="branch",
action='store',
default="rel_1.x_ga",
help="Branch Version for which you want to do the build")
(options, args) = parser.parse_args()
with open(SETUPFILE) as fd:
info = json.load(fd)
repoList = info['PrivateRepos'] + ['reltools']
baseDir = os.getenv('SR_CODE_BASE','~/git/')
for repo in repoList:
print "path of repo %s is : %s/snaproute/src/%s" %(baseDir, repo, repo)
if repo == 'reltools':
srcPath = baseDir + '/'
else:
srcPath = baseDir + '/snaproute/src/'
with lcd (srcPath + repo):
local ('git reset --hard')
try:
local ('git checkout %s' %(options.branch))
except:
local ('git checkout -b %s remotes/upstream/%s' %(options.branch, options.branch))
local ('git fetch upstream %s' %(options.branch))
local ('git merge upstream/%s' %(options.branch))
if repo == 'asicd' :
with lcd (baseDir + '/snaproute/src/'+repo):
local('git lfs install')
local('git lfs fetch')
local('git lfs checkout')
with open(PKGFILE) as pkg_info:
pk_info = json.load(pkg_info)
if options.edit != False:
pk_info["changeindex"] = str(int(pk_info["changeindex"]) + 1)
with open(PKGFILE, "w+") as fd_pkg:
json.dump(pk_info, fd_pkg, indent=4, sort_keys=True)
if options.edit != False:
with lcd(baseDir + '/reltools/'):
local('git add %s ' %(PKGFILE))
local('git commit -m \"Bumping up the release number\"')
local('git push origin %s' % (options.branch))