Skip to content

Commit 078c726

Browse files
committed
pkg-auto: Add a "bunch of maps" struct
The purpose of this struct is to collect all the information that is needed for handling package updates in one place. It is not really used right now, but when the package handling is split off into a separate function, it will come in handy as we can then pass a couple of parameters to the new function instead of many. Also, in future the struct will grow, when we add ignoring irrelevant information in summary stubs or license filtering.
1 parent f7cb37f commit 078c726

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

pkg_auto/impl/pkg_auto_lib.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,6 +1909,53 @@ function read_package_sources() {
19091909
done
19101910
}
19111911

1912+
# Fields of the bunch of maps struct.
1913+
#
1914+
# BOM_PKG_TO_TAGS_MVM_IDX - mapping of a package name to an array of
1915+
# tags (mostly describing where the package
1916+
# is used, like SDK or azure OEM or python
1917+
# sysext)
1918+
#
1919+
# BOM_PKG_SLOTS_SET_MVM_IDX - mapping of a package name to a set of
1920+
# slots available for the package (slots
1921+
# before the update and after the update
1922+
# are mixed here)
1923+
#
1924+
# BOM_OLD_PKG_SLOT_VERMINMAX_MAP_MVM_IDX - mapping of a package name
1925+
# to used slots, each slot is
1926+
# associated with a pair of
1927+
# versions - lowest and
1928+
# greatest used version (for
1929+
# consistent packages, these
1930+
# versions are the same); the
1931+
# mapping is for packages
1932+
# before the update
1933+
#
1934+
# BOM_NEW_PKG_SLOT_VERMINMAX_MAP_MVM_IDX - same as above, but for
1935+
# packages after the update
1936+
#
1937+
# BOM_PKG_SOURCES_MAP_IDX - mapping of package name to the repository
1938+
# name
1939+
declare -gri BOM_PKG_TO_TAGS_MVM_IDX=0 BOM_PKG_SLOTS_SET_MVM_IDX=1 BOM_OLD_PKG_SLOT_VERMINMAX_MAP_MVM_IDX=2 BOM_NEW_PKG_SLOT_VERMINMAX_MAP_MVM_IDX=3 BOM_PKG_SOURCES_MAP_IDX=4
1940+
1941+
# Declare bunch of maps variables.
1942+
#
1943+
# Parameters:
1944+
#
1945+
# @ - names of variables to be used for bunch of maps
1946+
function bunch_of_maps_declare() {
1947+
struct_declare -ga "${@}" "( '' '' '' '' '' )"
1948+
}
1949+
1950+
# Unset bunch of maps variables.
1951+
#
1952+
# Parameters:
1953+
#
1954+
# @ - names of bunch of maps variables
1955+
function bunch_of_maps_unset() {
1956+
unset "${@}"
1957+
}
1958+
19121959
# Fields of the package output paths struct.
19131960
#
19141961
# POP_OUT_DIR_IDX - toplevel output directory.
@@ -2057,6 +2104,13 @@ function handle_package_changes() {
20572104
done
20582105
unset added_pkg_to_index_map
20592106

2107+
bunch_of_maps_declare hpc_bunch_of_maps
2108+
hpc_bunch_of_maps[BOM_PKG_TO_TAGS_MVM_IDX]=${pkg_to_tags_mvm_var_name}
2109+
hpc_bunch_of_maps[BOM_PKG_SLOTS_SET_MVM_IDX]=hpc_pkg_slots_set_mvm
2110+
hpc_bunch_of_maps[BOM_OLD_PKG_SLOT_VERMINMAX_MAP_MVM_IDX]=hpc_old_pkg_slot_verminmax_map_mvm
2111+
hpc_bunch_of_maps[BOM_NEW_PKG_SLOT_VERMINMAX_MAP_MVM_IDX]=hpc_new_pkg_slot_verminmax_map_mvm
2112+
hpc_bunch_of_maps[BOM_PKG_SOURCES_MAP_IDX]=hpc_package_sources_map
2113+
20602114
# The loop below goes over the pairs of old and new package
20612115
# names. For each name there will be some checks done (like does
20622116
# this package even exist). Each name in the pair has a set of
@@ -2336,6 +2390,8 @@ function handle_package_changes() {
23362390
pkg_debug_disable
23372391
done
23382392

2393+
bunch_of_maps_unset hpc_bunch_of_maps
2394+
23392395
mvm_unset hpc_new_pkg_slot_verminmax_map_mvm
23402396
mvm_unset hpc_old_pkg_slot_verminmax_map_mvm
23412397
mvm_unset hpc_pkg_slots_set_mvm

0 commit comments

Comments
 (0)