Skip to content

Commit fcfdd36

Browse files
committed
Update MAINTAINER_TZ_OFFSET on release.
This also fixes a string with \s that wasn't a r'...' string.
1 parent 89b8473 commit fcfdd36

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packaging/release-rsync

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@ def main():
3838
if not os.path.isfile('packaging/release-rsync'):
3939
die('You must run this script from the top of your rsync checkout.')
4040

41-
now = datetime.now()
41+
now = datetime.now().astimezone() # Requires python 3.6 or later
4242
cl_today = now.strftime('* %a %b %d %Y')
4343
year = now.strftime('%Y')
4444
ztoday = now.strftime('%d %b %Y')
4545
today = ztoday.lstrip('0')
4646

47+
# The MAINTAINER_TZ_OFFSET is a float number of hours vs UTC. It can start with '-' but not '+'.
48+
tz_now = now.strftime('%z')
49+
tz_num = tz_now[0:1].replace('+', '') + str(float(tz_now[1:3]) + float(tz_now[3:]) / 60)
50+
4751
curdir = os.getcwd()
4852

4953
signal.signal(signal.SIGINT, signal_handler)
@@ -213,14 +217,17 @@ About to:
213217
x_re = re.compile(r'^(#define RSYNC_VERSION).*', re.M)
214218
msg = f"Unable to update RSYNC_VERSION in {fn}"
215219
txt = replace_or_die(x_re, r'\1 "%s"' % version, txt, msg)
220+
x_re = re.compile(r'^(#define MAINTAINER_TZ_OFFSET).*', re.M)
221+
msg = f"Unable to update MAINTAINER_TZ_OFFSET in {fn}"
222+
txt = replace_or_die(x_re, r'\1 ' + tz_num, txt, msg)
216223
elif '.spec' in fn:
217224
for var, val in specvars.items():
218225
x_re = re.compile(r'^%s .*' % re.escape(var), re.M)
219226
txt = replace_or_die(x_re, var + ' ' + val, txt, f"Unable to update {var} in {fn}")
220227
x_re = re.compile(r'^\* \w\w\w \w\w\w \d\d \d\d\d\d (.*)', re.M)
221228
txt = replace_or_die(x_re, r'%s \1' % cl_today, txt, f"Unable to update ChangeLog header in {fn}")
222229
elif fn == 'rsync.h':
223-
x_re = re.compile('(#define\s+SUBPROTOCOL_VERSION)\s+(\d+)')
230+
x_re = re.compile(r'(#define\s+SUBPROTOCOL_VERSION)\s+(\d+)')
224231
repl = lambda m: m[1] + ' ' + ('0' if not pre or not proto_changed else '1' if m[2] == '0' else m[2])
225232
txt = replace_or_die(x_re, repl, txt, f"Unable to find SUBPROTOCOL_VERSION define in {fn}")
226233
elif fn == 'NEWS.md':

0 commit comments

Comments
 (0)