summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2019-02-09 23:55:16 (GMT)
committerAlexey Neyman <stilor@att.net>2019-02-09 23:55:16 (GMT)
commit74a53fdf3eb383f09bdbf0d4adf8d2e26f838bd1 (patch)
tree59f7c27a3d83f8ede979e58407c0a40c2d75b10b
parent09cb590847e5e26e5bb029c1a2693cfa7a1e99b6 (diff)
Use enhanced framework for 'ct-ng update-samples'
Signed-off-by: Alexey Neyman <stilor@att.net>
-rw-r--r--.gitignore1
-rwxr-xr-xbootstrap2
-rw-r--r--ct-ng.in3
-rw-r--r--samples/samples.mk22
-rw-r--r--scripts/show-config.sh1
-rw-r--r--scripts/version-check.sh10
6 files changed, 19 insertions, 20 deletions
diff --git a/.gitignore b/.gitignore
index 8010036..30e7c36 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,6 +15,7 @@ config/configure.in
config/gen/
config/versions/
.config
+.config.*
verbatim-data.mk
maintainer/package-versions
diff --git a/bootstrap b/bootstrap
index c7d01ba..e4aad7f 100755
--- a/bootstrap
+++ b/bootstrap
@@ -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
diff --git a/ct-ng.in b/ct-ng.in
index 0120d35..0a12e09 100644
--- a/ct-ng.in
+++ b/ct-ng.in
@@ -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."
diff --git a/samples/samples.mk b/samples/samples.mk
index 3c4d4c3..48bbbb9 100644
--- a/samples/samples.mk
+++ b/samples/samples.mk
@@ -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}"; \
diff --git a/scripts/show-config.sh b/scripts/show-config.sh
index 4bc82e1..36ade9e 100644
--- a/scripts/show-config.sh
+++ b/scripts/show-config.sh
@@ -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
diff --git a/scripts/version-check.sh b/scripts/version-check.sh
index f49b1d8..1f4fea4 100644
--- a/scripts/version-check.sh
+++ b/scripts/version-check.sh
@@ -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