comparison mx/mx_graal.py @ 16862:bf499b4d86e9

mx: fix release tag detection for -dev suffix
author Bernhard Urban <bernhard.urban@jku.at>
date Tue, 19 Aug 2014 15:14:06 +0200
parents a8af2abc2039
children 0d2e3399acfe
comparison
equal deleted inserted replaced
16861:2270852ee1ef 16862:bf499b4d86e9
683 683
684 if not cached_graal_version: 684 if not cached_graal_version:
685 # extract latest release tag for graal 685 # extract latest release tag for graal
686 try: 686 try:
687 tags = [x.split() for x in subprocess.check_output(['hg', '-R', _graal_home, 'tags']).split('\n') if x.startswith("graal-")] 687 tags = [x.split() for x in subprocess.check_output(['hg', '-R', _graal_home, 'tags']).split('\n') if x.startswith("graal-")]
688 current_revision = subprocess.check_output(['hg', '-R', _graal_home, 'id', '-i']).strip() 688 current_id = subprocess.check_output(['hg', '-R', _graal_home, 'log', '--template', '{rev}\n', '--rev', 'tip']).strip()
689 except: 689 except:
690 # not a mercurial repository or hg commands are not available. 690 # not a mercurial repository or hg commands are not available.
691 tags = None 691 tags = None
692 692
693 if tags and current_revision: 693 if tags and current_id:
694 sorted_tags = sorted(tags, key=lambda e: [int(x) for x in e[0][len("graal-"):].split('.')], reverse=True) 694 sorted_tags = sorted(tags, key=lambda e: [int(x) for x in e[0][len("graal-"):].split('.')], reverse=True)
695 most_recent_tag_name, most_recent_tag_revision = sorted_tags[0] 695 most_recent_tag_name, most_recent_tag_revision = sorted_tags[0]
696 most_recent_tag_id = most_recent_tag_revision[:most_recent_tag_revision.index(":")]
696 most_recent_tag_version = most_recent_tag_name[len("graal-"):] 697 most_recent_tag_version = most_recent_tag_name[len("graal-"):]
697 698
698 if current_revision == most_recent_tag_revision: 699 # tagged commit is one-off with commit that tags it
700 if int(current_id) - int(most_recent_tag_id) <= 1:
699 cached_graal_version = most_recent_tag_version 701 cached_graal_version = most_recent_tag_version
700 else: 702 else:
701 major, minor = map(int, most_recent_tag_version.split('.')) 703 major, minor = map(int, most_recent_tag_version.split('.'))
702 cached_graal_version = str(major) + '.' + str(minor + 1) + '-' + dev_suffix 704 cached_graal_version = str(major) + '.' + str(minor + 1) + '-' + dev_suffix
703 else: 705 else: