add --missing-milestone flag to list-deliverables

This argument can be used to query for cycle-with-milestones
deliverables that have not yet tagged a specific milestone.

Also fix a bug in the logic for determining the latest release.

Change-Id: Ibe71cdd60e5ccdd03cec3bc7148c2bafc2bf2c5a
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2016-12-15 13:09:14 -05:00
parent 0af240bb6b
commit 2478e9826d
2 changed files with 19 additions and 3 deletions

View File

@ -67,12 +67,19 @@ def main():
action='store_true',
help='limit the list to deliverables without a stable branch',
)
parser.add_argument(
grp = parser.add_mutually_exclusive_group()
grp.add_argument(
'--unreleased',
default=False,
action='store_true',
help='limit the list to deliverables not released in the cycle',
)
grp.add_argument(
'--missing-milestone',
help=('deliverables that do not have the specified milestone as '
'the most current release; for example 2 would look for .0b2 '
'in the version number (implies --model cycle-with-milestones)'),
)
args = parser.parse_args()
# Deal with the inconsistency of the name for the independent
@ -81,6 +88,13 @@ def main():
if series == 'independent':
series = '_independent'
if args.missing_milestone:
model = 'cycle-with-milestones'
version_ending = '.0b{}'.format(args.missing_milestone)
else:
model = args.model
version_ending = None
all_deliv = deliverable.Deliverables(
root_dir=args.deliverables_dir,
collapse_history=False,
@ -88,7 +102,7 @@ def main():
for entry in all_deliv.get_deliverables(args.team, series):
deliv = deliverable.Deliverable(*entry)
if args.model and deliv.model != args.model:
if model and deliv.model != model:
continue
if args.cycle_based and not deliv.is_cycle_based:
continue
@ -99,6 +113,8 @@ def main():
continue
if args.unreleased and deliv.versions:
continue
if version_ending and deliv.latest_release and deliv.latest_release.endswith(version_ending):
continue
if args.verbose:
print('{:30} {:15} {}'.format(deliv.name, deliv.latest_release, deliv.team))
else:

View File

@ -210,7 +210,7 @@ class Deliverable(object):
@property
def latest_release(self):
rel = (self.releases or [{}])[0]
rel = (self.releases or [{}])[-1]
return rel.get('version')
@property