From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/5] defaultenv: simplify env dependencies
Date: Wed, 19 Feb 2014 11:50:44 +0100 [thread overview]
Message-ID: <1392807047-32080-3-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1392807047-32080-1-git-send-email-s.hauer@pengutronix.de>
Finding out whether to rebuild the environment is a difficult task
since we have to track all files in a directory. Instead of trying
this, just rebuild the environment during every build and only if
it differs to the last one overwrite the target. This way make
only sees a change when the environment is changed.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/Makefile | 15 ++++-----------
scripts/genenv | 12 ++++++++++--
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/common/Makefile b/common/Makefile
index ce34d98..0429336 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -65,23 +65,16 @@ ifneq ($(CONFIG_DEFAULT_ENVIRONMENT_PATH),"")
DEFAULT_ENVIRONMENT_PATH += $(CONFIG_DEFAULT_ENVIRONMENT_PATH)
endif
-ENV_FILES := $(shell cd $(srctree); for i in $(DEFAULT_ENVIRONMENT_PATH); do find $${i} -type f ; done)
-
endif # ifdef CONFIG_DEFAULT_ENVIRONMENT
#
# Generate a barebox envfs image.
#
-# echo $(ENV_FILES) > /dev/null is just for letting if_changed
-# recognize that something has changed when the environment has
-# other files,
-#
-quiet_cmd_env = ENV $@
-cmd_env = ($(srctree)/scripts/genenv $(srctree) $(objtree) $@ $(DEFAULT_ENVIRONMENT_PATH)) || \
- (echo $(ENV_FILES) > /dev/null; rm -f $@ ; false)
+quiet_cmd_envs = ENV $@
+cmd_envs = ($(srctree)/scripts/genenv $(srctree) $(objtree) $@ $(DEFAULT_ENVIRONMENT_PATH))
-$(obj)/barebox_default_env: $(ENV_FILES) FORCE
- $(call if_changed,env)
+$(obj)/barebox_default_env: FORCE
+ $(call cmd,envs)
barebox_default_env_comp =
ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_COMPRESSED_GZIP),y)
diff --git a/scripts/genenv b/scripts/genenv
index c14cd87..d0b0ffd 100755
--- a/scripts/genenv
+++ b/scripts/genenv
@@ -10,7 +10,8 @@ basedir=$1
target=$3
shift 3
-tempdir="$objtree/.barebox_default_env"
+tempdir="${target}.genenv.tmp"
+tmpfile="$(mktemp)"
mkdir -p "$tempdir"
@@ -26,6 +27,13 @@ done
find $tempdir -name '.svn' -o -name '*~' -delete
-$objtree/scripts/bareboxenv -s $tempdir $target
+$objtree/scripts/bareboxenv -s $tempdir ${tmpfile}
+
+diff "${tmpfile}" "${target}" >/dev/null 2>/dev/null
+if [ $? != 0 ]; then
+ mv "${tmpfile}" "${target}"
+else
+ rm ${tmpfile}
+fi
rm -r $tempdir
--
1.8.5.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2014-02-19 10:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-19 10:50 Cleanup environment dependencies and compressed file generation Sascha Hauer
2014-02-19 10:50 ` [PATCH 1/5] common/Makefile: reorder targets Sascha Hauer
2014-02-19 10:50 ` Sascha Hauer [this message]
2014-02-19 10:50 ` [PATCH 3/5] make: Add wildcard rules for compressed files Sascha Hauer
2014-02-19 10:50 ` [PATCH 4/5] defaultenv: use wildcard compression rules Sascha Hauer
2014-02-19 10:50 ` [PATCH 5/5] Kconfig: Select default compression type Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1392807047-32080-3-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox