Skip to content

Commit

Permalink
src/tarball.py: set new checkout fields
Browse files Browse the repository at this point in the history
Set recently added checkout fields such as git commit
tags, commit message, and flag denoting if the commit
is at the tip of the branch.

Signed-off-by: Jeny Sadadia <jeny.sadadia@collabora.com>
  • Loading branch information
Jeny Sadadia committed Sep 25, 2024
1 parent b99852f commit 9b0728f
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions src/tarball.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,28 @@ def _get_version_from_describe(self):
if value
}

def _update_node(self, checkout_node, describe, version, tarball_url):
def _get_commit_info(self, path, commit, tree, branch):
commit_tags = kernelci.build.git_commit_tags(
path, commit
)
commit_message = kernelci.build.git_commit_message(
path, commit
)
branch_tip = kernelci.build.git_branch_tip(
path, commit, tree, branch
)
return commit_tags, commit_message, branch_tip

# pylint: disable=too-many-arguments
def _update_node(self, checkout_node, describe, version, tarball_url,
commit_tags, commit_message, branch_tip):
node = checkout_node.copy()
node['data']['kernel_revision'].update({
'describe': describe,
'version': version,
'commit_tags': commit_tags,
'commit_message': commit_message,
'tip_of_branch': branch_tip,
})
node.update({
'state': 'available',
Expand Down Expand Up @@ -209,22 +226,28 @@ def _run(self, sub_id):
os._exit(1)
self._checkout_commitid(commitid)

config_tree = build_config.tree.name
config_branch = build_config.branch

describe = kernelci.build.git_describe(
build_config.tree.name, self._service_config.kdir
config_tree, self._service_config.kdir
)
version = self._get_version_from_describe()
tarball_name = '-'.join([
'linux',
build_config.tree.name,
build_config.branch,
config_tree,
config_branch,
describe
])
tarball_path = self._make_tarball(
self._service_config.kdir,
tarball_name
)
tarball_url = self._push_tarball(tarball_path)
self._update_node(checkout_node, describe, version, tarball_url)
commit_tags, commit_message, branch_tip = self._get_commit_info(
self._service_config.kdir, commitid, config_tree, config_branch)
self._update_node(checkout_node, describe, version, tarball_url,
commit_tags, commit_message, branch_tip)


class cmd_run(Command):
Expand Down

0 comments on commit 9b0728f

Please sign in to comment.