From 6110a9f8b7a7d25407810b52df39ba836c5c6ac0 Mon Sep 17 00:00:00 2001 From: Piotr Kubik Date: Wed, 17 Jan 2024 13:47:12 +0100 Subject: [PATCH] scripts: Move feeds_update, genconfig commands to '-legacy' suffix Move old 'feeds_update, genconfig, genconfig_min' commands to the ones with '-legacy' suffix for backwards-compatibility refs #13080 --- iop/iop.completion | 3 +- iop/scripts/feeds_update-legacy.sh | 88 +++++++++++++++++++ iop/scripts/feeds_update.sh | 81 +---------------- .../{genconfig.sh => genconfig-legacy.sh} | 10 +-- ...nconfig_min.sh => genconfig_min-legacy.sh} | 10 +-- 5 files changed, 101 insertions(+), 91 deletions(-) create mode 100755 iop/scripts/feeds_update-legacy.sh rename iop/scripts/{genconfig.sh => genconfig-legacy.sh} (97%) rename iop/scripts/{genconfig_min.sh => genconfig_min-legacy.sh} (97%) mode change 100644 => 100755 diff --git a/iop/iop.completion b/iop/iop.completion index 882327cb1..8445c5966 100644 --- a/iop/iop.completion +++ b/iop/iop.completion @@ -33,7 +33,8 @@ _iop() prev="${COMP_WORDS[COMP_CWORD-1]}" iopcmds="bootstrap cfe_upgrade cfe_upgrade_latest extract_core \ - feeds_update genconfig generate_tarballs install_key \ + feeds_update feeds_update-legacy genconfig genconfig-legacy \ + generate_tarballs install_key \ scp_changes setup_host ssh_install_key status \ update_package update_feed_branches ssh_upgrade smoketest" diff --git a/iop/scripts/feeds_update-legacy.sh b/iop/scripts/feeds_update-legacy.sh new file mode 100755 index 000000000..663f8e8ae --- /dev/null +++ b/iop/scripts/feeds_update-legacy.sh @@ -0,0 +1,88 @@ +#!/bin/bash + +function feeds_update-legacy { + heads=1 + developer=0 + override=1 + force=1 + + function update_failure { + if [ $force == 1 ]; then + echo "WARNING: Failed to update feed(s). Forced update, proceeding anyway." >&2 + else + echo "ERROR: Failed to update feed(s). Omit -F to proceed anyway." >&2 + exit 1 + fi + } + + while getopts "inFh" opt; do + case $opt in + i) + heads=0 + ;; + n) + override=0 + ;; + F) + force=0 + ;; + h|\?) + echo "Usage: ./iop feeds_update-legacy [-i] [-n] [-F] [-h]" + echo + echo "OPTIONS:" + echo " -i - Only update index. Do not change HEAD in feeds." + echo " -n - Do not replace core packages with iopsys versions." + echo " -F - Do not force update if there are inaccessible feeds." + echo " -h - Display this help message and exit." + exit 1 + ;; + esac + done + + git remote -v | grep -qE '(git@|ssh://)' && developer=1 + + cp .config .genconfig_config_bak + + if [ $heads == 1 ]; then + if [ $developer == 1 ]; then + ./scripts/feeds update -g || update_failure + else + ./scripts/feeds update || update_failure + fi + fi + ./scripts/feeds update -ai || exit 1 + + # replace core packages with iopsys versions + if [ $override == 1 ]; then + ./scripts/feeds install -f -p openwrt_core -a || exit 1 + ./scripts/feeds install -f -p qualcomm -a || exit 1 + fi + + ( + echo '# DO NOT EDIT. Autogenerated file by ./iop feeds_update' + echo 'FEED_DEVICES_DIRS:=' + find feeds -type f -name .is-feed-devices-dir -printf 'FEED_DEVICES_DIRS+=$(TOPDIR)/%h\n' + ) > target/linux/feed-devices/feed-devices-list.mk || exit 1 + + # targets need to be installed explicitly + for target in $(ls ./feeds/targets); do + ./scripts/feeds install -f -p targets $target || exit 1 + done + + # install all packages + ./scripts/feeds install -a || exit 1 + + # remove broken symlinks ( for packages that are no longer in the feed ) + find -L package/feeds -maxdepth 2 -type l -delete || exit 1 + + cp .genconfig_config_bak .config + make defconfig || exit 1 + + # record when we last run this script + touch tmp/.iop_bootstrap || exit 1 + + # always return true + exit 0 +} + +register_command "feeds_update-legacy" "Update feeds to point to commit hashes from feeds.conf - legacy mode" diff --git a/iop/scripts/feeds_update.sh b/iop/scripts/feeds_update.sh index 8f1bc341f..110bc8f90 100755 --- a/iop/scripts/feeds_update.sh +++ b/iop/scripts/feeds_update.sh @@ -1,88 +1,9 @@ #!/bin/bash function feeds_update { - heads=1 - developer=0 - override=1 - force=1 - - function update_failure { - if [ $force == 1 ]; then - echo "WARNING: Failed to update feed(s). Forced update, proceeding anyway." >&2 - else - echo "ERROR: Failed to update feed(s). Omit -F to proceed anyway." >&2 - exit 1 - fi - } - - while getopts "inFh" opt; do - case $opt in - i) - heads=0 - ;; - n) - override=0 - ;; - F) - force=0 - ;; - h|\?) - echo "Usage: ./iop feeds_update [-i] [-n] [-F] [-h]" - echo - echo "OPTIONS:" - echo " -i - Only update index. Do not change HEAD in feeds." - echo " -n - Do not replace core packages with iopsys versions." - echo " -F - Do not force update if there are inaccessible feeds." - echo " -h - Display this help message and exit." - exit 1 - ;; - esac - done - - git remote -v | grep -qE '(git@|ssh://)' && developer=1 - - cp .config .genconfig_config_bak - - if [ $heads == 1 ]; then - if [ $developer == 1 ]; then - ./scripts/feeds update -g || update_failure - else - ./scripts/feeds update || update_failure - fi - fi - ./scripts/feeds update -ai || exit 1 - - # replace core packages with iopsys versions - if [ $override == 1 ]; then - ./scripts/feeds install -f -p openwrt_core -a || exit 1 - ./scripts/feeds install -f -p qualcomm -a || exit 1 - fi - - ( - echo '# DO NOT EDIT. Autogenerated file by ./iop feeds_update' - echo 'FEED_DEVICES_DIRS:=' - find feeds -type f -name .is-feed-devices-dir -printf 'FEED_DEVICES_DIRS+=$(TOPDIR)/%h\n' - ) > target/linux/feed-devices/feed-devices-list.mk || exit 1 - - # targets need to be installed explicitly - for target in $(ls ./feeds/targets); do - ./scripts/feeds install -f -p targets $target || exit 1 - done - - # install all packages - ./scripts/feeds install -a || exit 1 - - # remove broken symlinks ( for packages that are no longer in the feed ) - find -L package/feeds -maxdepth 2 -type l -delete || exit 1 - - cp .genconfig_config_bak .config - make defconfig || exit 1 - - # record when we last run this script - touch tmp/.iop_bootstrap || exit 1 # always return true exit 0 } -register_command "feeds_update" "Update feeds to point to commit hashes from feeds.conf" +register_command "feeds_update" "Compatibility function only" diff --git a/iop/scripts/genconfig.sh b/iop/scripts/genconfig-legacy.sh similarity index 97% rename from iop/scripts/genconfig.sh rename to iop/scripts/genconfig-legacy.sh index a5cb51f9a..331d227c9 100755 --- a/iop/scripts/genconfig.sh +++ b/iop/scripts/genconfig-legacy.sh @@ -1,6 +1,6 @@ #!/bin/bash -function genconfig { +function genconfig-legacy { export CLEAN=0 export DIRTY="--dirty" export IMPORT=1 @@ -196,7 +196,7 @@ function genconfig { usage() { echo - echo 1>&2 "Usage: $0 [ OPTIONS ] < Board_Type > [ Customer [customer2 ]...]" + echo 1>&2 "Usage: $0 genconfig-legacy [ OPTIONS ] < Board_Type > [ Customer [customer2 ]...]" echo echo -e " -c|--clean\t\tRemove all files under ./files and import from config " echo -e " -D|--no-dirty\t\tIgnore dirty tree" @@ -210,7 +210,7 @@ function genconfig { echo -e " -a|--list-all\t\tList all Customers and their board types" echo -e " -b|--boards\t\tList all board types" echo - echo "Example ./iop genconfig eg400 OPERATORX" + echo "Example ./iop genconfig-legacy eg400 OPERATORX" echo "(if no customerconfig is chosen, iopsys config will be used)" echo exit 0 @@ -496,7 +496,7 @@ function genconfig { if [ $# -eq 0 ]; then echo Current profile: cat $CURRENT_CONFIG_FILE - echo "Try ./iop genconfig -h' to get instructions if you want to change current config" + echo "Try ./iop genconfig-legacy -h' to get instructions if you want to change current config" exit 0 else while [ -n "$1" ]; do @@ -532,4 +532,4 @@ function genconfig { fi } -register_command "genconfig" "Generate configuration for board and customer" +register_command "genconfig-legacy" "Generate configuration for board and customer - legacy mode" diff --git a/iop/scripts/genconfig_min.sh b/iop/scripts/genconfig_min-legacy.sh old mode 100644 new mode 100755 similarity index 97% rename from iop/scripts/genconfig_min.sh rename to iop/scripts/genconfig_min-legacy.sh index 21ffc6eb7..cfec183d1 --- a/iop/scripts/genconfig_min.sh +++ b/iop/scripts/genconfig_min-legacy.sh @@ -1,6 +1,6 @@ #!/bin/bash -function genconfig_min { +function genconfig_min-legacy { export CLEAN=0 export DIRTY="--dirty" export SRCTREEOVERR=0 @@ -195,7 +195,7 @@ function genconfig_min { usage() { echo - echo 1>&2 "Usage: $0 [ OPTIONS ] < Board_Type > [ Customer [customer2 ]...]" + echo 1>&2 "Usage: $0 genconfig_min-legacy [ OPTIONS ] < Board_Type > [ Customer [customer2 ]...]" echo echo -e " -c|--clean\t\tRemove all files under ./files and import from config " echo -e " -D|--no-dirty\t\tIgnore dirty tree" @@ -209,7 +209,7 @@ function genconfig_min { echo -e " -a|--list-all\t\tList all Customers and their board types" echo -e " -b|--boards\t\tList all board types" echo - echo "Example ./iop genconfig eg400 OPERATORX" + echo "Example ./iop genconfig_min-legacy eg400 OPERATORX" echo "(if no customerconfig is chosen, iopsys config will be used)" echo exit 0 @@ -464,7 +464,7 @@ function genconfig_min { if [ $# -eq 0 ]; then echo Current profile: cat $CURRENT_CONFIG_FILE - echo "Try ./iop genconfig -h' to get instructions if you want to change current config" + echo "Try ./iop genconfig_min-legacy -h' to get instructions if you want to change current config" exit 0 else while [ -n "$1" ]; do @@ -500,4 +500,4 @@ function genconfig_min { fi } -register_command "genconfig_min" "Generate configuration for customer with manual board configuration" +register_command "genconfig_min-legacy" "Generate configuration for customer with manual board configuration - legacy mode"