Developing lightweight computation at the DSG edge

Commit 7e73dbd2 authored by p4u's avatar p4u Committed by Roger Pueyo Centelles
Browse files

Implement smart packet merging



User defined extra packages have preference over community and flavor
packages. Related issue #19
Signed-off-by: default avatarp4u <p4u@dabax.net>
parent 8de2eec5
......@@ -121,18 +121,14 @@ cook() {
mkdir -p ${ib_files}
[ -n "$community_files" ] && {
[ -f "${community_files}/PACKAGES" ] && {
echo -n "--> Adding community packages: "
for p in $(cat "${community_files}/PACKAGES"); do
PKG="$PKG $p"
echo -n "$p "
done
echo ""
echo "--> Adding community packages: "
join_packages $(cat "${community_files}/PACKAGES")
}
echo "--> Copying community files"
cp -rf ${community_files}/* $ib_files/
cp -rf ${community_files}/* $ib_files/ 2>/dev/null
[ -f ${ib_files}/PACKAGES ] && rm -f ${ib_files}/PACKAGES
}
cp -rf ${myfiles}/* ${ib_files}/
cp -rf ${myfiles}/* ${ib_files}/ 2>/dev/null
# make binary using imagebuilder
local fw_extra_name="$flavor"
......@@ -143,7 +139,10 @@ cook() {
[ -n "$no_update" ] && force_no_update="NO_UPDATE=1"
[ -f "files_remove" ] && files_remove="FILES_REMOVE=$(pwd)/files_remove"
echo "-> Cooking firmware image"
make -C $ib image $profile PACKAGES="${!flavor} $PKG" EXTRA_IMAGE_NAME="$fw_extra_name" BIN_DIR="$output_dir" $ib_files $force_no_update $files_remove
join_packages ${!flavor}
echo "--> Selected extra packages: $PKG"
read a
make -C $ib image $profile PACKAGES="$PKG" EXTRA_IMAGE_NAME="$fw_extra_name" BIN_DIR="$output_dir" $ib_files $force_no_update $files_remove
ERROR=$?
if (($ERROR != 0)); then
echo -e "\n-> Firmware not cooked, something wrong happened on the ImageBuilder compilation process"
......@@ -427,6 +426,14 @@ list_profiles() {
make -C $release/$target/ib info
}
# join a list of new packages into PKG var, older has preference
join_packages() {
local new="$@"
for p in $new; do
echo "$PKG" | egrep -q "(^| |-)${p#*-}($| )" || PKG="$PKG $p"
done
}
[ -z "$1" ] && usage
OPTS=$(getopt -o hd:fb:c:d:i:j: -l targets,build-all,download-all,profiles:,flavors,profile:,flavor:,\
update-feeds,no-update,no-link-ib,only-sdk,only-ib,remote,ib,sdk,sdk-file:,ib-file:,help,force,clean,\
......@@ -562,7 +569,9 @@ while true; do
shift;shift
;;
--extra-pkg)
system_pkg="$PKG"
PKG="$2"
join_packages $system_pkg
shift;shift
;;
-h)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment