Use enhanced framework for 'ct-ng update-samples'

Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
Alexey Neyman 2019-02-09 15:55:16 -08:00
parent 09cb590847
commit 74a53fdf3e
6 changed files with 19 additions and 20 deletions

1
.gitignore vendored
View File

@ -15,6 +15,7 @@ config/configure.in
config/gen/
config/versions/
.config
.config.*
verbatim-data.mk
maintainer/package-versions

View File

@ -780,7 +780,7 @@ msg "*** Gathering the list of data files to install"
# Implement some kind of .installignore for these files?
case "${f}" in
# Avoid temp files
.*.swp|.*.swo)
*.sw[po])
continue
;;
# And, some files automake insists we must have

View File

@ -145,7 +145,10 @@ defconfig: check-config
$(SILENT)CT_VCHECK=save $(CONF) --defconfig=$${DEFCONFIG-defconfig} $(KCONFIG_TOP)
upgradeconfig: .config check-config
$(SILENT)cp .config .config.before-upgrade
$(SILENT)CT_UPGRADECONFIG=yes $(bash) $(CT_LIB_DIR)/scripts/version-check.sh .config
@$(CT_ECHO) "Saving .config as .config.before-olddefconfig before running 'ct-ng olddefconfig'"
$(SILENT)cp .config .config.before-olddefconfig
$(SILENT)$(CONF) --olddefconfig $(KCONFIG_TOP)
@$(CT_ECHO) "Done. You may now run 'ct-ng menuconfig' to edit the configuration."

View File

@ -43,7 +43,6 @@ help-env::
PHONY += show-config
show-config: .config
@cp .config .config.sample
@$(bash) $(CT_LIB_DIR)/scripts/version-check.sh .config
@$(bash) $(CT_LIB_DIR)/scripts/show-config.sh -v current
@rm -f .config.sample
@ -54,7 +53,6 @@ $(patsubst %,show-%,$(CT_SAMPLES)): show-%:
CT_VCHECK=load \
$(CONF) --defconfig=$(call sample_dir,$*)/crosstool.config \
$(KCONFIG_TOP) >/dev/null
@$(bash) $(CT_LIB_DIR)/scripts/version-check.sh .config.sample
@$(bash) $(CT_LIB_DIR)/scripts/show-config.sh -v $*
@rm -f .config.sample
@ -69,6 +67,7 @@ list-samples: list-samples-pre $(patsubst %,list-%,$(CT_SAMPLES))
@echo ' G (Global) : sample was installed with crosstool-NG'
@echo ' X (EXPERIMENTAL): sample may use EXPERIMENTAL features'
@echo ' B (BROKEN) : sample is currently broken'
@echo ' O (OBSOLETE) : sample needs to be upgraded'
PHONY += list-samples-pre
list-samples-pre: FORCE
@ -80,7 +79,6 @@ $(patsubst %,list-%,$(CT_SAMPLES)): list-%:
CT_VCHECK=load \
$(CONF) --defconfig=$(call sample_dir,$*)/crosstool.config \
$(KCONFIG_TOP) >/dev/null
@$(bash) $(CT_LIB_DIR)/scripts/version-check.sh .config.sample
@$(bash) $(CT_LIB_DIR)/scripts/show-config.sh $*
@rm -f .config.sample
@ -90,17 +88,21 @@ list-samples-short: FORCE
printf "%s\n" "$${s}"; \
done
# Check one sample
# Check one sample. Note that we are not loading but rather copying the defconfig;
# loading it while it contains some removed options would reset them to currently
# supported default values.
PHONY += $(patsubst %,check-%,$(CT_SAMPLES))
$(patsubst %,check-%,$(CT_SAMPLES)): check-%:
@set -e; export KCONFIG_CONFIG=$$(pwd)/.config.sample; \
CT_NG_SAMPLE=$(call sample_dir,$*)/crosstool.config; \
CT_VCHECK=load $(CONF) -s --defconfig=$${CT_NG_SAMPLE} $(KCONFIG_TOP) &>/dev/null; \
CT_UPGRADECONFIG=yes $(bash) $(CT_LIB_DIR)/scripts/version-check.sh .config.sample; \
CT_VCHECK=save $(CONF) -s --savedefconfig=$$(pwd)/.defconfig $(KCONFIG_TOP) &>/dev/null; \
old_sha1=$$( sha1sum "$${CT_NG_SAMPLE}" |cut -d ' ' -f 1 ); \
new_sha1=$$( sha1sum .defconfig |cut -d ' ' -f 1 ); \
if [ $${old_sha1} != $${new_sha1} ]; then \
cp $${CT_NG_SAMPLE} .config.sample; \
CT_UPGRADECONFIG=yes \
$(bash) $(CT_LIB_DIR)/scripts/version-check.sh .config.sample &>/dev/null; \
CT_VCHECK=load $(CONF) -s --olddefconfig \
$(KCONFIG_TOP) &>/dev/null; \
CT_VCHECK=save $(CONF) -s --savedefconfig=$$(pwd)/.defconfig \
$(KCONFIG_TOP) &>/dev/null; \
if ! cmp -s "$${CT_NG_SAMPLE}" .defconfig; then \
if [ $(CT_UPDATE_SAMPLES) = yes ]; then \
echo "Updating $*"; \
mv .defconfig "$${CT_NG_SAMPLE}"; \

View File

@ -72,6 +72,7 @@ dump_single_sample()
esac
printf "[%s" "${sample_type}"
[ -f "${sample_top}/samples/${sample}/broken" ] && printf "B" || printf "."
[ "${CT_CONFIG_VERSION}" != "${CT_CONFIG_VERSION_CURRENT}" ] && printf "O" || printf "."
[ "${CT_EXPERIMENTAL}" = "y" ] && printf "X" || printf "."
printf "] %s\n" "${sample}"
if [ ${verbose} -ne 0 ]; then

View File

@ -141,7 +141,6 @@ set_opt_and_val()
# Main upgrade driver. One version at a time, read line by line, interpret
# the options and replace anything that needs replacing.
cp "${CFGFILE}" "${CFGFILE}.before-upgrade"
input="${CFGFILE}"
while :; do
# Purge any possibly stale values
@ -181,7 +180,7 @@ while :; do
q=
if set_opt_and_val; then
case "${opt}" in
CT_CONFIG_VERSION_CURRENT=*|CT_CONFIG_VERSION=*)
CT_CONFIG_VERSION_CURRENT|CT_CONFIG_VERSION)
continue
;;
esac
@ -213,10 +212,3 @@ while :; do
# keep the versions where there is such a dependency.
done
mv "${CFGFILE}.${MY_CONFIG_VERSION_CURRENT}" "${CFGFILE}"
cp "${CFGFILE}" "${CFGFILE}.before-olddefconfig"
cat >&2 <<EOF
Done. The original '${CFGFILE}' has been saved as '${CFGFILE}.before-upgrade'.
Will now run through 'ct-ng olddefconfig'. The intermediate configuration (after the upgrade script,
but before running 'ct-ng olddefconfig') has been saved as '${CFGFILE}.before-olddefconfig'.
EOF