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
This commit is contained in:
Piotr Kubik 2024-01-17 13:47:12 +01:00 committed by Andreas Gnau
parent 111dc5950b
commit 6110a9f8b7
No known key found for this signature in database
5 changed files with 101 additions and 91 deletions

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"