Esempio n. 1
0
def update(git_tree, is_weekly=False):
    g = Git(git_tree)
    today = datetime.now().strftime('%Y-%m-%dT%H:%M:%S.%f')
    version = g.describe()
    published = False
    data = get_versions()

    found = list(
        filter(
            lambda item: (isinstance(item, dict) and item.get('version') ==
                          version) or item == version, data))
    if found:
        published = True
        print("version already published")
    else:
        print(f"New version {version}, adding to file...")

    if data and not published:
        with open(VERSIONS_FILE, "w") as versions:
            item = {}
            item['version'] = version
            item['date'] = today
            item['weekly'] = is_weekly
            data.append(item)
            json.dump(data, versions)
Esempio n. 2
0
def run():
    jenkins_project = args.projectName
    jenkins_build_number = args.buildNumber

    if not jenkins.find_if_build_is_green(jenkins_project, jenkins_build_number):
        print "Build #" + jenkins_build_number + " of '" + jenkins_project + "' is not a green build."
        sys.exit(1)

    repo_url = jenkins.find_github_repo_url_from_build(jenkins_project)

    git = Git(WORKSPACE, repo_url)

    commit_id = jenkins.find_commit_id_from_build(jenkins_project, jenkins_build_number)
    verbose("commit_id=" + commit_id)

    repo_name = git.repo_name()
    verbose("repo_name=" + repo_name)

    git.clone()
    verbose("Git repo '" + repo_name + "' cloned to " + WORKSPACE)

    most_recent_tag = git.describe()
    verbose("Most recent release: " + most_recent_tag)

    new_version_number = lib.read_user_preferred_version(repo_name, most_recent_tag)

    git.tag(commit_id, "release/" + new_version_number)
Esempio n. 3
0
def run():
    jenkins_project = args.projectName
    jenkins_build_number = args.buildNumber

    if not jenkins.find_if_build_is_green(jenkins_project,
                                          jenkins_build_number):
        print("Build #" + jenkins_build_number + " of '" + jenkins_project +
              "' is not a green build.")
        sys.exit(1)

    repo_url = jenkins.find_github_repo_url_from_build(jenkins_project)

    git = Git(WORKSPACE, repo_url)

    commit_id = jenkins.find_commit_id_from_build(jenkins_project,
                                                  jenkins_build_number)
    verbose("commit_id=" + commit_id)

    repo_name = git.repo_name()
    verbose("repo_name=" + repo_name)

    git.clone()
    verbose("Git repo '" + repo_name + "' cloned to " + WORKSPACE)

    most_recent_tag = git.describe(commit_id)
    verbose("Most recent release: " + most_recent_tag)

    new_version_number = lib.read_user_preferred_version(
        repo_name, most_recent_tag)

    git.tag(commit_id, "release/" + new_version_number)
Esempio n. 4
0
 def test_describe_never_tagged_before(self):
     git = Git(root_dir_local, test_repo_dir)
     git.clone()
     lib.call_and_exit_if_failed(
         'git tag -a release/0.1.1 -m \'releasing version\'')
     latest_tag = git.describe()
     self.assertEqual(latest_tag, "0.1.1")
Esempio n. 5
0
def update(git_tree):
    g = Git(git_tree)
    version = g.describe()
    published = False
    data = get_versions()
    if version in data:
        published = True
        print("version already published")
    else:
        print(f"New version {version}, adding to file...")

    if data and not published:
        with open(VERSIONS_FILE, "w") as versions:
            data.append(version)
            json.dump(data, versions)
Esempio n. 6
0
def main():
    args = parse_args()
    g = Git(".")
    version = g.describe("--abbrev=12")
    pathlib.Path(f'footprint_data/{version}').mkdir(exist_ok=True,
                                                    parents=True)

    with open(args.plan) as csvfile:
        csvreader = csv.reader(csvfile)
        for row in csvreader:
            name = row[0]
            feature = row[1]
            board = row[2]
            app = row[3]
            options = row[4]

            cmd = [
                'west', 'build', '-d', f'out/{name}/{feature}/{board}', '-b',
                board, f'{app}', '-t', 'footprint'
            ]

            if options != '':
                cmd += ['--', f'{options}']

            print(" ".join(cmd))

            try:
                subprocess.check_output(cmd,
                                        stderr=subprocess.STDOUT,
                                        timeout=120,
                                        universal_newlines=True)
                print("Copying files...")
                pathlib.Path(
                    f'footprint_data/{version}/{name}/{feature}/{board}'
                ).mkdir(parents=True, exist_ok=True)

                shutil.copy(
                    f'out/{name}/{feature}/{board}/ram.json',
                    f'footprint_data/{version}/{name}/{feature}/{board}')
                shutil.copy(
                    f'out/{name}/{feature}/{board}/rom.json',
                    f'footprint_data/{version}/{name}/{feature}/{board}')
            except subprocess.CalledProcessError as exc:
                print("Status : FAIL", exc.returncode, exc.output)
Esempio n. 7
0
 def test_describe_never_tagged_before(self):
     git = Git(root_dir_local, test_repo_dir)
     git.clone()
     lib.call_and_exit_if_failed("git tag -a release/0.1.1 -m 'releasing version'")
     latest_tag = git.describe()
     self.assertEqual(latest_tag, "0.1.1")
Esempio n. 8
0
 def test_describe_never_tagged_before(self):
     git = Git(root_dir_local, test_repo_dir)
     git.clone()
     latest_tag = git.describe()
     self.assertEqual(latest_tag, "0.0.0")
Esempio n. 9
0
 def test_describe_never_tagged_before(self):
     git = Git(root_dir_local, test_repo_dir)
     git.clone()
     latest_tag = git.describe()
     self.assertEqual(latest_tag, "0.0.0")