run.sh: more userfriendly "stale configs" message

Make the message easy to understand at first glance, print what needs to
be done to regenerate the configs. Add an empty line before listing the
stale file that has been found, so it stands out from the (at this
point) less relevant path listings. It looks like the following now:

$ ./run.sh
using config file '/home/user/code/osmo-dev/net/config_2g3g_osmith'
on templates '/home/user/code/osmo-dev/net/tmpl_std'
with NET_DIR '/home/user/code/osmo-dev/net/osmith'

Stale: '/home/user/code/osmo-dev/net/tmpl_std/run.sh' is newer than 'run.sh'

WARNING: STALE CONFIGS - your net configs are older than the templates they should be based on!
 * Hit enter to continue, and use the stale config files
 * Hit ^C and run 'make regen' to regenerate your configs

Change-Id: If225e094619a07a228e0e2f337153ee18cdb420c
This commit is contained in:
Oliver Smith 2019-01-30 16:48:18 +01:00
parent 0a5dd920ad
commit 24ddf9c941
2 changed files with 9 additions and 1 deletions

View File

@ -96,6 +96,7 @@ idx = 0
def check_stale(src_path, target_path):
if file_newer(src_path, target_path):
print()
print('Stale: %r is newer than %r' % (src_path, target_path))
exit(1)

View File

@ -1,5 +1,12 @@
#!/usr/bin/env bash
../fill_config.py --check-stale || ( echo "STALE CONFIGS. Hit enter to continue anyway."; read enter_to_continue )
if ! ../fill_config.py --check-stale; then
echo
echo "WARNING: STALE CONFIGS - your net configs are older than the templates they should be based on!"
echo " * Hit enter to continue, and use the stale config files"
echo " * Hit ^C and run 'make regen' to regenerate your configs"
read enter_to_continue
fi
dev="${ETH_DEV}"
ip2="${PUBLIC_IP2}"