aclmanager: do not keep old stable sections around
When patching ACL files, rather than just add a section for stable/$newseries, we should also delete old stable/$series sections. Otherwise around $newseries release time, stable/$series would be owned by release managers again. Change-Id: I1fdc8e370f0f56df54ba27736046d7d6893ca240
This commit is contained in:
parent
989ae8da6e
commit
105dd6d1e8
@ -20,6 +20,7 @@
|
||||
import argparse
|
||||
import getpass
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
import requests
|
||||
@ -106,13 +107,32 @@ label-Workflow = -1..+1 group {group}
|
||||
else:
|
||||
with open(fullfilename) as aclfile:
|
||||
hit = False
|
||||
skip = False
|
||||
for line in aclfile:
|
||||
if line.startswith("[receive]"):
|
||||
# Skip until start of next section if in skip mode
|
||||
if skip:
|
||||
if line.startswith('['):
|
||||
skip = False
|
||||
else:
|
||||
continue
|
||||
|
||||
if re.match('^\[access "refs/heads/stable/[a-z]', line):
|
||||
# We just hit a specific stable section.
|
||||
# Skip the file until the next section starts.
|
||||
skip = True
|
||||
continue
|
||||
|
||||
if line.startswith("[receive]") and not hit:
|
||||
# We reached the [receive] section: let's place
|
||||
# our specific stable section here.
|
||||
newcontent += blob.format(
|
||||
branch=args.series,
|
||||
group=group)
|
||||
hit = True
|
||||
|
||||
# Copy the current line over
|
||||
newcontent += line
|
||||
|
||||
if not hit:
|
||||
print("Could not update %s automatically" % fullfilename)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user