Convert pkg-map and svc-map copies to explicit variables
Using the explicit variables, these elements don't have to walk the path to find the files in other elements; they can extract it directly Change-Id: I0a64b45e9f2cfa28e84b2859d76b065a6c4590f0
This commit is contained in:
parent
37a53354ec
commit
412b333bda
@ -8,10 +8,14 @@ set -o pipefail
|
|||||||
|
|
||||||
sudo mkdir -p $TMP_MOUNT_PATH/usr/share/pkg-map/
|
sudo mkdir -p $TMP_MOUNT_PATH/usr/share/pkg-map/
|
||||||
|
|
||||||
for ELEMENT in $IMAGE_ELEMENT ; do
|
eval declare -A image_elements=($(get_image_element_array))
|
||||||
for DIR in ${ELEMENTS_PATH//:/ }; do
|
|
||||||
if [ -f "$DIR/$ELEMENT/pkg-map" ]; then
|
for i in "${!image_elements[@]}"; do
|
||||||
sudo cp "$DIR/$ELEMENT/pkg-map" "$TMP_MOUNT_PATH/usr/share/pkg-map/$ELEMENT"
|
element=$i
|
||||||
fi
|
element_dir=${image_elements[$i]}
|
||||||
done
|
|
||||||
|
pkg_map="${element_dir}/pkg-map"
|
||||||
|
if [ -f "${pkg_map}" ]; then
|
||||||
|
sudo cp "${pkg_map}" "$TMP_MOUNT_PATH/usr/share/pkg-map/$element"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
@ -61,26 +61,22 @@ def write_data_to_file(data, service_file_path):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
elements = os.environ.get("IMAGE_ELEMENT").split(' ')
|
elements = yaml.safe_load(os.environ.get("IMAGE_ELEMENT_YAML"))
|
||||||
element_paths = os.environ.get("ELEMENTS_PATH").split(':')
|
|
||||||
service_names = dict()
|
service_names = dict()
|
||||||
for element in elements:
|
for element, path in elements.items():
|
||||||
if not element.strip():
|
data_path = os.path.join(path, "svc-map")
|
||||||
continue
|
if os.path.exists(data_path):
|
||||||
for element_path in element_paths:
|
with open(data_path, 'r') as dataFile:
|
||||||
data_path = os.path.join(element_path, element, "svc-map")
|
data = yaml.load(dataFile.read())
|
||||||
if os.path.exists(data_path):
|
try:
|
||||||
with open(data_path, 'r') as dataFile:
|
service_names = merge_data(
|
||||||
data = yaml.load(dataFile.read())
|
data,
|
||||||
try:
|
service_names,
|
||||||
service_names = merge_data(
|
os.environ.get("DISTRO_NAME"))
|
||||||
data,
|
except Exception as err:
|
||||||
service_names,
|
print("%s. Check %s for duplicate"
|
||||||
os.environ.get("DISTRO_NAME"))
|
" service name." % (err, element))
|
||||||
except Exception as err:
|
sys.exit(1)
|
||||||
print("%s. Check %s for duplicate"
|
|
||||||
" service name." % (err, element))
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
write_data_to_file(
|
write_data_to_file(
|
||||||
service_names,
|
service_names,
|
||||||
|
Loading…
Reference in New Issue
Block a user