pkg-auto: Add md5-metadata cache to reports

This adds an explicit generation of md5-metadata cache before any we
do any emerge invocations. That way we can have a copy of reports even
if emerge fails for some reason. But mostly the reason for this
copying is to consume the data later, outside the SDK container.
This commit is contained in:
Krzesimir Nowak 2025-02-17 09:05:21 +01:00
parent b52676a64b
commit 7b5841c039
2 changed files with 33 additions and 6 deletions

View File

@ -98,16 +98,18 @@ function package_info_for_board() {
function set_eo() { function set_eo() {
local dir=${1}; shift local dir=${1}; shift
SDK_EO="${dir}/sdk-emerge-output" # shellcheck disable=SC2034 # used externally
BOARD_EO="${dir}/board-emerge-output" declare -g EGENCACHE_W="${dir}/egencache-warnings"
declare -g SDK_EO="${dir}/sdk-emerge-output"
declare -g BOARD_EO="${dir}/board-emerge-output"
# shellcheck disable=SC2034 # used indirectly in cat_eo_f # shellcheck disable=SC2034 # used indirectly in cat_eo_f
SDK_EO_F="${SDK_EO}-filtered" declare -g SDK_EO_F="${SDK_EO}-filtered"
# shellcheck disable=SC2034 # used indirectly in cat_eo_f # shellcheck disable=SC2034 # used indirectly in cat_eo_f
BOARD_EO_F="${BOARD_EO}-filtered" declare -g BOARD_EO_F="${BOARD_EO}-filtered"
# shellcheck disable=SC2034 # used indirectly in cat_eo_w # shellcheck disable=SC2034 # used indirectly in cat_eo_w
SDK_EO_W="${SDK_EO}-warnings" declare -g SDK_EO_W="${SDK_EO}-warnings"
# shellcheck disable=SC2034 # used indirectly in cat_eo_w # shellcheck disable=SC2034 # used indirectly in cat_eo_w
BOARD_EO_W="${BOARD_EO}-warnings" declare -g BOARD_EO_W="${BOARD_EO}-warnings"
} }
# Print the contents of file, path of which is stored in a variable of # Print the contents of file, path of which is stored in a variable of
@ -484,4 +486,19 @@ function clean_empty_warning_files() {
done done
} }
function generate_cache_for() {
local repo=${1}; shift
egencache --repo "${repo}" --update
}
function copy_cache_to_reports() {
local repo=${1}; shift
local reports_dir=${1}; shift
local repo_dir
repo_dir=$(portageq get_repo_path / "${repo}")
cp -a "${repo_dir}/metadata/md5-cache" "${reports_dir}/${repo}-cache"
}
fi fi

View File

@ -65,6 +65,16 @@ mkdir -p "${reports_dir}"
set_eo "${reports_dir}" set_eo "${reports_dir}"
echo 'Running egencache for portage-stable'
generate_cache_for 'portage-stable' 2>"${EGENCACHE_W}"
echo 'Running egencache for coreos-overlay'
generate_cache_for 'coreos-overlay' 2>>"${EGENCACHE_W}"
echo 'Copying portage-stable cache to reports'
copy_cache_to_reports 'portage-stable' "${reports_dir}" 2>>"${EGENCACHE_W}"
echo 'Copying coreos-overlay cache to reports'
copy_cache_to_reports 'coreos-overlay' "${reports_dir}" 2>>"${EGENCACHE_W}"
echo 'Running pretend-emerge to get complete report for SDK' echo 'Running pretend-emerge to get complete report for SDK'
package_info_for_sdk >"${SDK_EO}" 2>"${SDK_EO_W}" package_info_for_sdk >"${SDK_EO}" 2>"${SDK_EO_W}"
echo 'Running pretend-emerge to get complete report for board' echo 'Running pretend-emerge to get complete report for board'