Skip to content

Commit 40feb6d

Browse files
committed
make the release script generic
1 parent c6daac8 commit 40feb6d

File tree

3 files changed

+30
-8
lines changed

3 files changed

+30
-8
lines changed

build.xml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,10 +1050,18 @@ Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
10501050
<exec os="SunOS" executable="${tools.dir}/dorelease.py" failonerror="true">
10511051
<arg value="-d"/>
10521052
<arg value="-D new"/>
1053+
<arg value="-r OpenGrok/OpenGrok"/>
10531054
<arg value="-t ${version}"/>
1054-
<!-- The directory of the files should really be ${dist.dir} however it does not work. -->
1055+
<!--
1056+
The directory of the files should really be ${dist.dir}
1057+
however it does not work.
1058+
-->
10551059
<arg file="dist/${tardest}"/>
1056-
<!-- These 2 files should really be conditional to avoid the whole target to be SunOS dependent. -->
1060+
<!--
1061+
These 2 files should really be conditional
1062+
to avoid the whole target to be SunOS dependent
1063+
however 'arg' does not allow 'if'.
1064+
-->
10571065
<arg file="dist/OSOLopengrok-${version}.pkg"/>
10581066
<arg file="dist/${distname}-${version}.p5p"/>
10591067
</exec>

doc/release.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ number (0.12))
7272
GITHUB_USER (your Github user name)
7373
GITHUB_PASSWORD (your Github password)
7474
https_proxy (set to host:port of proxy if behind HTTP proxy)
75-
OPENGROK_PRERELEASE (set to non-empty if creating release candidate)
75+
DO_PRERELEASE (set to non-empty if creating release candidate)
7676

7777
Next:
7878

tools/dorelease.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#
2525

2626
'''
27-
Create OpenGrok release using Github v3 API
27+
Create release using Github v3 API
2828
2929
This is supposed to be no-nonsense one-purpose script that:
3030
- is standalone, i.e. runs without any non-Python-core modules
@@ -107,7 +107,8 @@ def get_args():
107107
description='Create release using Github API.')
108108
parser.add_argument("-d", "--debug", help="turn on debugging",
109109
action="store_true")
110-
parser.add_argument("-n", "--dryrun", help="perform dry run",
110+
parser.add_argument("-n", "--dryrun",
111+
help="perform dry run (also can use DO_DRYRUN env var)",
111112
action="store_true")
112113
parser.add_argument("-u", "--user", nargs=1, metavar='user',
113114
help="GitHub user. Specify user with GITHUB_USER and password with GITHUB_PASSWORD env var.")
@@ -116,9 +117,11 @@ def get_args():
116117
help="Description text for the release")
117118
parser.add_argument("-P", "--prerelease",
118119
default = False, action="store_true",
119-
help="Is this a pre-release ? (also can use OPENGROK_PRERELEASE env var)")
120+
help="Is this a pre-release ? (also can use DO_PRERELEASE env var)")
120121
parser.add_argument("-t", "--tag", nargs=1, metavar='tag',
121122
required=True, help="New release tag")
123+
parser.add_argument("-r", "--repository", nargs=1, metavar='repo',
124+
required=True, help="Repository path (user/repo)")
122125
parser.add_argument("-p", "--proxy", nargs=1,
123126
metavar='host:port',
124127
help="Proxy host and port (host:port)")
@@ -209,6 +212,7 @@ def main():
209212
description = arguments.description[0]
210213
tag = arguments.tag[0].strip()
211214
logger.debug("using tag '{}'".format(tag))
215+
repo = arguments.repository[0]
212216

213217
proxy = None
214218
if arguments.proxy:
@@ -250,7 +254,7 @@ def main():
250254
prerelease = True
251255
else:
252256
try:
253-
if os.environ["OPENGROK_PRERELEASE"]:
257+
if os.environ["DO_PRERELEASE"]:
254258
prerelease = True
255259
except:
256260
prerelease = False
@@ -263,13 +267,23 @@ def main():
263267
pprint(payload)
264268
upload_url = None
265269

270+
dryrun = False
266271
if arguments.dryrun:
272+
dryrun = True
273+
else:
274+
try:
275+
os.environ["DO_DRYRUN"]
276+
dryrun = True
277+
except:
278+
dryrun = False
279+
if dryrun:
267280
print "Dry run in effect, exiting"
268281
sys.exit(0)
269282

270283
try:
271284
_url = "https://api.github.com"
272-
url = '%s%s' % (_url, "/repos/OpenGrok/OpenGrok/releases")
285+
_path = '%s%s%s' % ("/repos/", repo, "/releases")
286+
url = '%s%s' % (_url, _path)
273287
release_json = post_request(url,
274288
arguments.timeout, payload, headers, proxy)
275289
upload_url = release_json["upload_url"]

0 commit comments

Comments
 (0)