]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Update MAINTAINER_TZ_OFFSET on release.
authorWayne Davison <wayne@opencoder.net>
Thu, 16 Jan 2025 07:24:26 +0000 (23:24 -0800)
committerWayne Davison <wayne@opencoder.net>
Thu, 16 Jan 2025 07:27:27 +0000 (23:27 -0800)
This also fixes a string with \s that wasn't a r'...' string.

packaging/release-rsync

index 755a38a013f004c078f7ec398e0116190dde4912..2d1486b8d01667129806c7d0ffdb0295e7b3bb92 100755 (executable)
@@ -38,12 +38,16 @@ def main():
     if not os.path.isfile('packaging/release-rsync'):
         die('You must run this script from the top of your rsync checkout.')
 
-    now = datetime.now()
+    now = datetime.now().astimezone() # Requires python 3.6 or later
     cl_today = now.strftime('* %a %b %d %Y')
     year = now.strftime('%Y')
     ztoday = now.strftime('%d %b %Y')
     today = ztoday.lstrip('0')
 
+    # The MAINTAINER_TZ_OFFSET is a float number of hours vs UTC. It can start with '-' but not '+'.
+    tz_now = now.strftime('%z')
+    tz_num = tz_now[0:1].replace('+', '') + str(float(tz_now[1:3]) + float(tz_now[3:]) / 60)
+
     curdir = os.getcwd()
 
     signal.signal(signal.SIGINT, signal_handler)
@@ -213,6 +217,9 @@ About to:
             x_re = re.compile(r'^(#define RSYNC_VERSION).*', re.M)
             msg = f"Unable to update RSYNC_VERSION in {fn}"
             txt = replace_or_die(x_re, r'\1 "%s"' % version, txt, msg)
+            x_re = re.compile(r'^(#define MAINTAINER_TZ_OFFSET).*', re.M)
+            msg = f"Unable to update MAINTAINER_TZ_OFFSET in {fn}"
+            txt = replace_or_die(x_re, r'\1 ' + tz_num, txt, msg)
         elif '.spec' in fn:
             for var, val in specvars.items():
                 x_re = re.compile(r'^%s .*' % re.escape(var), re.M)
@@ -220,7 +227,7 @@ About to:
             x_re = re.compile(r'^\* \w\w\w \w\w\w \d\d \d\d\d\d (.*)', re.M)
             txt = replace_or_die(x_re, r'%s \1' % cl_today, txt, f"Unable to update ChangeLog header in {fn}")
         elif fn == 'rsync.h':
-            x_re = re.compile('(#define\s+SUBPROTOCOL_VERSION)\s+(\d+)')
+            x_re = re.compile(r'(#define\s+SUBPROTOCOL_VERSION)\s+(\d+)')
             repl = lambda m: m[1] + ' ' + ('0' if not pre or not proto_changed else '1' if m[2] == '0' else m[2])
             txt = replace_or_die(x_re, repl, txt, f"Unable to find SUBPROTOCOL_VERSION define in {fn}")
         elif fn == 'NEWS.md':