Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
5f3a7fa6
Commit
5f3a7fa6
authored
15 years ago
by
Bryan O'Sullivan
Browse files
Options
Downloads
Patches
Plain Diff
Patch in some other useful scripts from trunk.
parent
d508beb0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/lib/python/indra/util/llversion.py
+25
-4
25 additions, 4 deletions
indra/lib/python/indra/util/llversion.py
scripts/update_version_files.py
+9
-29
9 additions, 29 deletions
scripts/update_version_files.py
with
34 additions
and
33 deletions
indra/lib/python/indra/util/llversion.py
+
25
−
4
View file @
5f3a7fa6
"""
@file llversion.py
"""
@file llversion.py
@brief Utility for parsing llcommon/llversion${server}.h
@brief Utility for parsing llcommon/llversion${server}.h
for the version string and channel string
for the version string and channel string
Utility that parses svn info for branch and revision
Utility that parses
hg or
svn info for branch and revision
$LicenseInfo:firstyear=2006&license=mit$
$LicenseInfo:firstyear=2006&license=mit$
...
@@ -79,8 +79,8 @@ def get_svn_status_matching(regular_expression):
...
@@ -79,8 +79,8 @@ def get_svn_status_matching(regular_expression):
status
,
output
=
commands
.
getstatusoutput
(
'
svn info %s
'
%
get_src_root
())
status
,
output
=
commands
.
getstatusoutput
(
'
svn info %s
'
%
get_src_root
())
m
=
regular_expression
.
search
(
output
)
m
=
regular_expression
.
search
(
output
)
if
not
m
:
if
not
m
:
print
"
Failed to parse svn info output, resultfollows:
"
print
>>
sys
.
stderr
,
"
Failed to parse svn info output, result
follows:
"
print
output
print
>>
sys
.
stderr
,
output
raise
Exception
,
"
No matching svn status in
"
+
src_root
raise
Exception
,
"
No matching svn status in
"
+
src_root
return
m
.
group
(
1
)
return
m
.
group
(
1
)
...
@@ -92,4 +92,25 @@ def get_svn_revision():
...
@@ -92,4 +92,25 @@ def get_svn_revision():
last_rev_re
=
re
.
compile
(
'
Last Changed Rev: (\d+)
'
)
last_rev_re
=
re
.
compile
(
'
Last Changed Rev: (\d+)
'
)
return
get_svn_status_matching
(
last_rev_re
)
return
get_svn_status_matching
(
last_rev_re
)
def
get_hg_repo
():
status
,
output
=
commands
.
getstatusoutput
(
'
hg showconfig paths.default
'
)
if
status
:
print
>>
sys
.
stderr
,
output
sys
.
exit
(
1
)
if
not
output
:
print
>>
sys
.
stderr
,
'
ERROR: cannot find repo we cloned from
'
sys
.
exit
(
1
)
return
output
def
get_hg_changeset
():
status
,
output
=
commands
.
getstatusoutput
(
'
hg id -i
'
)
if
status
:
print
>>
sys
.
stderr
,
output
sys
.
exit
(
1
)
return
output
def
using_svn
():
return
os
.
path
.
isdir
(
os
.
path
.
join
(
get_src_root
(),
'
.svn
'
))
def
using_hg
():
return
os
.
path
.
isdir
(
os
.
path
.
join
(
get_src_root
(),
'
.hg
'
))
This diff is collapsed.
Click to expand it.
scripts/update_version_files.py
+
9
−
29
View file @
5f3a7fa6
...
@@ -37,8 +37,6 @@ def add_indra_lib_path():
...
@@ -37,8 +37,6 @@ def add_indra_lib_path():
import
getopt
,
os
,
re
,
commands
import
getopt
,
os
,
re
,
commands
from
indra.util
import
llversion
from
indra.util
import
llversion
hg
=
os
.
path
.
expandvars
(
"
${HG}
"
)
if
not
hg
or
hg
==
"
${HG}
"
:
hg
=
"
hg
"
svn
=
os
.
path
.
expandvars
(
"
${SVN}
"
)
svn
=
os
.
path
.
expandvars
(
"
${SVN}
"
)
if
not
svn
or
svn
==
"
${SVN}
"
:
svn
=
"
svn
"
if
not
svn
or
svn
==
"
${SVN}
"
:
svn
=
"
svn
"
...
@@ -154,8 +152,6 @@ def _getstatusoutput(cmd):
...
@@ -154,8 +152,6 @@ def _getstatusoutput(cmd):
version_re
=
re
.
compile
(
'
(\d+).(\d+).(\d+).(\d+)
'
)
version_re
=
re
.
compile
(
'
(\d+).(\d+).(\d+).(\d+)
'
)
svn_branch_re
=
re
.
compile
(
'
^URL:\s+\S+/([^/\s]+)$
'
,
re
.
MULTILINE
)
svn_branch_re
=
re
.
compile
(
'
^URL:\s+\S+/([^/\s]+)$
'
,
re
.
MULTILINE
)
svn_revision_re
=
re
.
compile
(
'
^Last Changed Rev: (\d+)$
'
,
re
.
MULTILINE
)
svn_revision_re
=
re
.
compile
(
'
^Last Changed Rev: (\d+)$
'
,
re
.
MULTILINE
)
hg_branch_re
=
re
.
compile
(
'
^.*_([^_\s]*)\s*$
'
,
re
.
MULTILINE
)
hg_revision_re
=
re
.
compile
(
'
^changeset:\s+(\d+):
'
,
re
.
MULTILINE
)
def
main
():
def
main
():
script_path
=
os
.
path
.
dirname
(
__file__
)
script_path
=
os
.
path
.
dirname
(
__file__
)
...
@@ -245,33 +241,17 @@ def main():
...
@@ -245,33 +241,17 @@ def main():
if
update_server
:
if
update_server
:
server_version
=
new_version
server_version
=
new_version
else
:
else
:
# Assume we're updating just the build number
cl
=
'
%s info
"
%s
"'
%
(
svn
,
src_root
)
if
llversion
.
using_svn
():
status
,
output
=
_getstatusoutput
(
cl
)
revision
=
llversion
.
get_svn_revision
()
branch_match
=
None
branch
=
llversion
.
get_svn_branch
()
revision_match
=
None
elif
llversion
.
using_hg
():
if
status
==
0
:
revision
=
llversion
.
get_hg_changeset
()
branch_match
=
svn_branch_re
.
search
(
output
)
branch
=
llversion
.
get_hg_repo
()
revision_match
=
svn_revision_re
.
search
(
output
)
else
:
else
:
cl
=
'
%s log --limit 1
'
%
hg
print
>>
sys
.
stderr
,
"
ERROR: could not determine revision and branch
"
status
,
output
=
_getstatusoutput
(
cl
)
if
status
==
0
:
branch_match
=
hg_branch_re
.
search
(
os
.
path
.
expandvars
(
"
${PARABUILD_BUILD_NAME}
"
))
revision_match
=
hg_revision_re
.
search
(
output
)
if
verbose
:
print
print
"
svn info output:
"
print
"
----------------
"
print
output
if
not
branch_match
or
not
revision_match
:
print
"
Failed to execute svn info, output follows:
"
print
output
return
-
1
return
-
1
branch
=
branch_match
.
group
(
1
)
revision
=
revision_match
.
group
(
1
)
if
skip_on_branch_re
and
skip_on_branch_re
.
match
(
branch
):
if
skip_on_branch_re
and
skip_on_branch_re
.
match
(
branch
):
print
"
Release Candidate Build, leaving version files untouched.
"
print
"
Release Candidate Build, leaving version files untouched.
"
return
0
return
0
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment