diff options
author | João Henrique Ferreira de Freitas <joaohf@gmail.com> | 2014-02-16 18:40:58 -0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-02-20 14:28:10 +0000 |
commit | 4166062ea72fec32cb23b7b67f1e3a8e412a91ba (patch) | |
tree | 401eb18410165596daad448c7f3f9b29276027f3 | |
parent | 07e59b5ff659bde6e6a60c4781c0a2deb406c667 (diff) | |
download | poky-4166062ea72fec32cb23b7b67f1e3a8e412a91ba.tar.gz |
cml1.bbclass: Add diffconfig task to cml1
diffconfig() is a new task that makes a diff between the
old and new config files and writes to the fragment.cfg result file.
menuconfig() always copy the original config file, so the user
doesn't need to copy it.
(From OE-Core rev: f0dcbbdcc37da12f84f730b8235f50be8c150c50)
Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/cml1.bbclass | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/meta/classes/cml1.bbclass b/meta/classes/cml1.bbclass index e292ecbcf4..34c0c4e6c7 100644 --- a/meta/classes/cml1.bbclass +++ b/meta/classes/cml1.bbclass | |||
@@ -16,8 +16,11 @@ HOST_LOADLIBES = "-lncurses" | |||
16 | TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo" | 16 | TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo" |
17 | 17 | ||
18 | python do_menuconfig() { | 18 | python do_menuconfig() { |
19 | import shutil | ||
20 | |||
19 | try: | 21 | try: |
20 | mtime = os.path.getmtime(".config") | 22 | mtime = os.path.getmtime(".config") |
23 | shutil.copy(".config", ".config.orig") | ||
21 | except OSError: | 24 | except OSError: |
22 | mtime = 0 | 25 | mtime = 0 |
23 | 26 | ||
@@ -38,3 +41,33 @@ do_menuconfig[depends] += "ncurses-native:do_populate_sysroot" | |||
38 | do_menuconfig[nostamp] = "1" | 41 | do_menuconfig[nostamp] = "1" |
39 | addtask menuconfig after do_configure | 42 | addtask menuconfig after do_configure |
40 | 43 | ||
44 | python do_diffconfig() { | ||
45 | import shutil | ||
46 | import subprocess | ||
47 | |||
48 | workdir = d.getVar('WORKDIR', True) | ||
49 | fragment = workdir + '/fragment.cfg' | ||
50 | configorig = '.config.orig' | ||
51 | config = '.config' | ||
52 | |||
53 | try: | ||
54 | md5newconfig = bb.utils.md5_file(configorig) | ||
55 | md5config = bb.utils.md5_file(config) | ||
56 | isdiff = md5newconfig != md5config | ||
57 | except IOError as e: | ||
58 | bb.fatal("No config files found. Did you do menuconfig ?\n%s" % e) | ||
59 | |||
60 | if isdiff: | ||
61 | statement = 'diff -Nurp ' + configorig + ' ' + config + '| sed -n "s/^\+//p" >' + fragment | ||
62 | subprocess.call(statement, shell=True) | ||
63 | |||
64 | shutil.copy(configorig, config) | ||
65 | |||
66 | bb.plain("Config fragment has been dumped into:\n %s" % fragment) | ||
67 | else: | ||
68 | if os.path.exists(fragment): | ||
69 | os.unlink(fragment) | ||
70 | } | ||
71 | |||
72 | do_diffconfig[nostamp] = "1" | ||
73 | addtask diffconfig | ||