summaryrefslogtreecommitdiffstats
path: root/openembedded/classes/package.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'openembedded/classes/package.bbclass')
-rw-r--r--openembedded/classes/package.bbclass51
1 files changed, 49 insertions, 2 deletions
diff --git a/openembedded/classes/package.bbclass b/openembedded/classes/package.bbclass
index db479d5847..fd8d1b7b09 100644
--- a/openembedded/classes/package.bbclass
+++ b/openembedded/classes/package.bbclass
@@ -81,6 +81,53 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
81 81
82 bb.data.setVar('PACKAGES', ' '.join(packages), d) 82 bb.data.setVar('PACKAGES', ' '.join(packages), d)
83 83
84# Function to strip a single file, called from RUNSTRIP below
85# A working 'file' (one which works on the target architecture)
86# is necessary for this stuff to work.
87PACKAGE_DEPENDS ?= "file-native"
88DEPENDS_prepend =+ "${PACKAGE_DEPENDS} "
89#FIXME: this should be "" when any errors are gone!
90IGNORE_STRIP_ERRORS ?= "1"
91
92runstrip() {
93 local ro st
94 st=0
95 if { file "$1" || {
96 oewarn "file $1: failed (forced strip)" >&2
97 echo 'not stripped'
98 }
99 } | grep -q 'not stripped'
100 then
101 oenote "${STRIP} $1"
102 ro=
103 test -w "$1" || {
104 ro=1
105 chmod +w "$1"
106 }
107 '${STRIP}' "$1"
108 st=$?
109 test -n "$ro" && chmod -w "$1"
110 if test $st -ne 0
111 then
112 oewarn "runstrip: ${STRIP} $1: strip failed" >&2
113 if [ x${IGNORE_STRIP_ERRORS} == x1 ]
114 then
115 #FIXME: remove this, it's for error detection
116 if file "$1" 2>/dev/null >&2
117 then
118 (oefatal "${STRIP} $1: command failed" >/dev/tty)
119 else
120 (oefatal "file $1: command failed" >/dev/tty)
121 fi
122 st=0
123 fi
124 fi
125 else
126 oenote "runstrip: skip $1"
127 fi
128 return $st
129}
130
84python populate_packages () { 131python populate_packages () {
85 import glob, stat, errno, re 132 import glob, stat, errno, re
86 133
@@ -166,14 +213,14 @@ python populate_packages () {
166 dpath = os.path.dirname(fpath) 213 dpath = os.path.dirname(fpath)
167 bb.mkdirhier(dpath) 214 bb.mkdirhier(dpath)
168 if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1') and not os.path.islink(file) and isexec(file): 215 if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1') and not os.path.islink(file) and isexec(file):
169 stripfunc += "${STRIP} %s || : ;\n" % fpath 216 stripfunc += "\trunstrip %s || st=1\n" % fpath
170 ret = bb.movefile(file,fpath) 217 ret = bb.movefile(file,fpath)
171 if ret is None or ret == 0: 218 if ret is None or ret == 0:
172 raise bb.build.FuncFailed("File population failed") 219 raise bb.build.FuncFailed("File population failed")
173 if not stripfunc == "": 220 if not stripfunc == "":
174 from bb import build 221 from bb import build
175 # strip 222 # strip
176 bb.data.setVar('RUNSTRIP', '%s\nreturn 0' % stripfunc, localdata) 223 bb.data.setVar('RUNSTRIP', '\tlocal st\n\tst=0\n%s\treturn $st' % stripfunc, localdata)
177 bb.data.setVarFlag('RUNSTRIP', 'func', 1, localdata) 224 bb.data.setVarFlag('RUNSTRIP', 'func', 1, localdata)
178 bb.build.exec_func('RUNSTRIP', localdata) 225 bb.build.exec_func('RUNSTRIP', localdata)
179 del localdata 226 del localdata