diff options
Diffstat (limited to 'meta/classes/cml1.bbclass')
-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 | ||