pkgs: factor out commit size for image version.

Image tarball size is the same as the one defined
in lib, factor out to avoid future errors if is modified.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
This commit is contained in:
Jose Carlos Venegas Munoz 2019-04-30 17:51:40 -05:00
parent f8189fa9be
commit b4732a9bf9
5 changed files with 8 additions and 5 deletions

View File

@ -20,6 +20,7 @@ export GOPATH="${tmp_dir}/go"
export GOPATH=${GOPATH:-${HOME}/go}
source "${script_dir}/../../scripts/lib.sh"
source "${script_dir}/../scripts/pkglib.sh"
exit_handler() {
[ -d "${tmp_dir}" ] && sudo rm -rf "$tmp_dir"
@ -62,7 +63,7 @@ build_image() {
create_tarball() {
agent_sha=$(get_repo_hash "${GOPATH}/src/github.com/kata-containers/agent")
#reduce sha size for short names
agent_sha=${agent_sha:0:11}
agent_sha=${agent_sha:0:${short_commit_length}}
tarball_name="kata-containers-${kata_osbuilder_version}-${agent_sha}-${arch_target}.tar.gz"
image_name="kata-containers-image_${img_distro}_${kata_osbuilder_version}_agent_${agent_sha}.img"
initrd_name="kata-containers-initrd_${initrd_distro}_${kata_osbuilder_version}_agent_${agent_sha}.initrd"

View File

@ -48,7 +48,7 @@ replace_list=(
verify
rm -rf kata-containers.tar.gz
image_tarball=$(find . -name 'kata-containers-'"${VERSION/\~/-}"'-'"${kata_agent_hash:0:11}"'-*.tar.gz')
image_tarball=$(find . -name 'kata-containers-'"${VERSION/\~/-}"'-'"${kata_agent_hash:0:${short_commit_length}}"'-*.tar.gz')
[ -f "${image_tarball}" ] || die "image not found"
cp "${image_tarball}" kata-containers.tar.gz

View File

@ -38,7 +38,7 @@ set_versions "${qemu_lite_hash}"
replace_list=(
"VERSION=$VERSION"
"RELEASE=$RELEASE"
"QEMU_LITE_HASH=${qemu_lite_hash:0:10}"
"QEMU_LITE_HASH=${qemu_lite_hash:0:${short_commit_length}}"
)
verify
echo "Verify succeed."

View File

@ -39,7 +39,7 @@ set_versions "${qemu_vanilla_hash}"
replace_list=(
"VERSION=$VERSION"
"RELEASE=$RELEASE"
"QEMU_VANILLA_HASH=${qemu_vanilla_hash:0:10}"
"QEMU_VANILLA_HASH=${qemu_vanilla_hash:0:${short_commit_length}}"
)
verify

View File

@ -26,6 +26,8 @@ VERBOSE=false
# package was compiled for.
DEB_ARCH="$(go env GOARCH)"
short_commit_length=7
if command -v go; then
export GO_ARCH=$(go env GOARCH)
else
@ -295,7 +297,7 @@ function pkg_version() {
pkg_version="${project_version}"
if [ -n "$commit_id" ]; then
pkg_version+="+git.${commit_id:0:7}"
pkg_version+="+git.${commit_id:0:${short_commit_length}}"
fi
if [ -n "$pkg_release" ]; then
pkg_version+="-${pkg_release}"