diff options
| author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2011-11-30 16:48:47 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-12-01 16:54:07 +0000 |
| commit | 1dcb2d8eeb034ce7cca035830889e23bcae0722c (patch) | |
| tree | 17f59c28e13bbf413f02cbc9559033dd5661e680 /meta | |
| parent | 8e2c57876764a498760cc310187f96e9126e3428 (diff) | |
| download | poky-1dcb2d8eeb034ce7cca035830889e23bcae0722c.tar.gz | |
classes/buildhistory: add new output history collection class
Create a new build output history reporting class, using testlab.bbclass
from meta-oe and packagehistory.bbclass as a base. This records information
from packages and images output from the build process in text files
structured suitably for tracking within a git repository, thus enabling
monitoring of changes over time.
Build history collection can be enabled simply by adding the following
to your local.conf:
INHERIT += "buildhistory"
The output after a build can then be found in BUILDHISTORY_DIR (defaults to
TMPDIR/buildhistory). If you set up this directory as a git repository and
set BUILDHISTORY_COMMIT to "1" in local.conf, the build history data will
be committed on every build.
(From OE-Core rev: 508ff624fea705eb93cf2cc1e0c9c42cb817acf8)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/classes/buildhistory.bbclass | 350 | ||||
| -rw-r--r-- | meta/classes/rootfs_ipk.bbclass | 27 | ||||
| -rw-r--r-- | meta/classes/rootfs_rpm.bbclass | 41 |
3 files changed, 412 insertions, 6 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass new file mode 100644 index 0000000000..89b2cb1462 --- /dev/null +++ b/meta/classes/buildhistory.bbclass | |||
| @@ -0,0 +1,350 @@ | |||
| 1 | # | ||
| 2 | # Records history of build output in order to detect regressions | ||
| 3 | # | ||
| 4 | # Based in part on testlab.bbclass and packagehistory.bbclass | ||
| 5 | # | ||
| 6 | # Copyright (C) 2011 Intel Corporation | ||
| 7 | # Copyright (C) 2007, 2008 Koen Kooi <koen@openembedded.org> | ||
| 8 | # | ||
| 9 | |||
| 10 | BUILDHISTORY_DIR ?= "${TMPDIR}/buildhistory" | ||
| 11 | BUILDHISTORY_DIR_IMAGE = "${BUILDHISTORY_DIR}/images/${MACHINE_ARCH}/${TCLIBC}/${IMAGE_BASENAME}" | ||
| 12 | BUILDHISTORY_DIR_PACKAGE = "${BUILDHISTORY_DIR}/packages/${MULTIMACH_TARGET_SYS}/${PN}" | ||
| 13 | BUILDHISTORY_COMMIT ?= "0" | ||
| 14 | BUILDHISTORY_COMMIT_AUTHOR ?= "buildhistory <buildhistory@${DISTRO}>" | ||
| 15 | |||
| 16 | # Must inherit package first before changing PACKAGEFUNCS | ||
| 17 | inherit package | ||
| 18 | PACKAGEFUNCS += "buildhistory_emit_pkghistory" | ||
| 19 | |||
| 20 | # | ||
| 21 | # Called during do_package to write out metadata about this package | ||
| 22 | # for comparision when writing future packages | ||
| 23 | # | ||
| 24 | python buildhistory_emit_pkghistory() { | ||
| 25 | import re | ||
| 26 | |||
| 27 | pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) | ||
| 28 | |||
| 29 | class RecipeInfo: | ||
| 30 | def __init__(self, name): | ||
| 31 | self.name = name | ||
| 32 | self.pe = "0" | ||
| 33 | self.pv = "0" | ||
| 34 | self.pr = "r0" | ||
| 35 | self.depends = "" | ||
| 36 | self.packages = "" | ||
| 37 | |||
| 38 | class PackageInfo: | ||
| 39 | def __init__(self, name): | ||
| 40 | self.name = name | ||
| 41 | self.pe = "0" | ||
| 42 | self.pv = "0" | ||
| 43 | self.pr = "r0" | ||
| 44 | self.size = 0 | ||
| 45 | self.depends = "" | ||
| 46 | self.rdepends = "" | ||
| 47 | self.rrecommends = "" | ||
| 48 | self.files = "" | ||
| 49 | self.filelist = "" | ||
| 50 | |||
| 51 | # Should check PACKAGES here to see if anything removed | ||
| 52 | |||
| 53 | def getpkgvar(pkg, var): | ||
| 54 | val = bb.data.getVar('%s_%s' % (var, pkg), d, 1) | ||
| 55 | if val: | ||
| 56 | return val | ||
| 57 | val = bb.data.getVar('%s' % (var), d, 1) | ||
| 58 | |||
| 59 | return val | ||
| 60 | |||
| 61 | def readRecipeInfo(pn, histfile): | ||
| 62 | rcpinfo = RecipeInfo(pn) | ||
| 63 | f = open(histfile, "r") | ||
| 64 | try: | ||
| 65 | for line in f: | ||
| 66 | lns = line.split('=') | ||
| 67 | name = lns[0].strip() | ||
| 68 | value = lns[1].strip(" \t\r\n").strip('"') | ||
| 69 | if name == "PE": | ||
| 70 | rcpinfo.pe = value | ||
| 71 | elif name == "PV": | ||
| 72 | rcpinfo.pv = value | ||
| 73 | elif name == "PR": | ||
| 74 | rcpinfo.pr = value | ||
| 75 | elif name == "DEPENDS": | ||
| 76 | rcpinfo.depends = value | ||
| 77 | elif name == "PACKAGES": | ||
| 78 | rcpinfo.packages = value | ||
| 79 | finally: | ||
| 80 | f.close() | ||
| 81 | return rcpinfo | ||
| 82 | |||
| 83 | def readPackageInfo(pkg, histfile): | ||
| 84 | pkginfo = PackageInfo(pkg) | ||
| 85 | f = open(histfile, "r") | ||
| 86 | try: | ||
| 87 | for line in f: | ||
| 88 | lns = line.split('=') | ||
| 89 | name = lns[0].strip() | ||
| 90 | value = lns[1].strip(" \t\r\n").strip('"') | ||
| 91 | if name == "PE": | ||
| 92 | pkginfo.pe = value | ||
| 93 | elif name == "PV": | ||
| 94 | pkginfo.pv = value | ||
| 95 | elif name == "PR": | ||
| 96 | pkginfo.pr = value | ||
| 97 | elif name == "RDEPENDS": | ||
| 98 | pkginfo.rdepends = value | ||
| 99 | elif name == "RRECOMMENDS": | ||
| 100 | pkginfo.rrecommends = value | ||
| 101 | elif name == "PKGSIZE": | ||
| 102 | pkginfo.size = long(value) | ||
| 103 | elif name == "FILES": | ||
| 104 | pkginfo.files = value | ||
| 105 | elif name == "FILELIST": | ||
| 106 | pkginfo.filelist = value | ||
| 107 | finally: | ||
| 108 | f.close() | ||
| 109 | return pkginfo | ||
| 110 | |||
| 111 | def getlastrecipeversion(pn): | ||
| 112 | try: | ||
| 113 | histfile = os.path.join(pkghistdir, "latest") | ||
| 114 | return readRecipeInfo(pn, histfile) | ||
| 115 | except EnvironmentError: | ||
| 116 | return None | ||
| 117 | |||
| 118 | def getlastpkgversion(pkg): | ||
| 119 | try: | ||
| 120 | histfile = os.path.join(pkghistdir, pkg, "latest") | ||
| 121 | return readPackageInfo(pkg, histfile) | ||
| 122 | except EnvironmentError: | ||
| 123 | return None | ||
| 124 | |||
| 125 | def squashspaces(string): | ||
| 126 | return re.sub("\s+", " ", string) | ||
| 127 | |||
| 128 | pn = d.getVar('PN', True) | ||
| 129 | pe = d.getVar('PE', True) or "0" | ||
| 130 | pv = d.getVar('PV', True) | ||
| 131 | pr = d.getVar('PR', True) | ||
| 132 | packages = squashspaces(d.getVar('PACKAGES', True)) | ||
| 133 | |||
| 134 | rcpinfo = RecipeInfo(pn) | ||
| 135 | rcpinfo.pe = pe | ||
| 136 | rcpinfo.pv = pv | ||
| 137 | rcpinfo.pr = pr | ||
| 138 | rcpinfo.depends = squashspaces(d.getVar('DEPENDS', True) or "") | ||
| 139 | rcpinfo.packages = packages | ||
| 140 | write_recipehistory(rcpinfo, d) | ||
| 141 | write_latestlink(None, pe, pv, pr, d) | ||
| 142 | |||
| 143 | # Apparently the version can be different on a per-package basis (see Python) | ||
| 144 | pkgdest = d.getVar('PKGDEST', True) | ||
| 145 | for pkg in packages.split(): | ||
| 146 | pe = getpkgvar(pkg, 'PE') or "0" | ||
| 147 | pv = getpkgvar(pkg, 'PV') | ||
| 148 | pr = getpkgvar(pkg, 'PR') | ||
| 149 | # | ||
| 150 | # Find out what the last version was | ||
| 151 | # Make sure the version did not decrease | ||
| 152 | # | ||
| 153 | lastversion = getlastpkgversion(pkg) | ||
| 154 | if lastversion: | ||
| 155 | last_pe = lastversion.pe | ||
| 156 | last_pv = lastversion.pv | ||
| 157 | last_pr = lastversion.pr | ||
| 158 | r = bb.utils.vercmp((pe, pv, pr), (last_pe, last_pv, last_pr)) | ||
| 159 | if r < 0: | ||
| 160 | bb.fatal("Package version for package %s went backwards which would break package feeds from (%s:%s-%s to %s:%s-%s)" % (pkg, last_pe, last_pv, last_pr, pe, pv, pr)) | ||
| 161 | |||
| 162 | pkginfo = PackageInfo(pkg) | ||
| 163 | pkginfo.pe = pe | ||
| 164 | pkginfo.pv = pv | ||
| 165 | pkginfo.pr = pr | ||
| 166 | pkginfo.rdepends = squashspaces(getpkgvar(pkg, 'RDEPENDS') or "") | ||
| 167 | pkginfo.rrecommends = squashspaces(getpkgvar(pkg, 'RRECOMMENDS') or "") | ||
| 168 | pkginfo.files = squashspaces(getpkgvar(pkg, 'FILES') or "") | ||
| 169 | |||
| 170 | # Gather information about packaged files | ||
| 171 | pkgdestpkg = os.path.join(pkgdest, pkg) | ||
| 172 | filelist = [] | ||
| 173 | pkginfo.size = 0 | ||
| 174 | for root, dirs, files in os.walk(pkgdestpkg): | ||
| 175 | relpth = os.path.relpath(root, pkgdestpkg) | ||
| 176 | for f in files: | ||
| 177 | fstat = os.lstat(os.path.join(root, f)) | ||
| 178 | pkginfo.size += fstat.st_size | ||
| 179 | filelist.append(os.sep + os.path.join(relpth, f)) | ||
| 180 | pkginfo.filelist = " ".join(filelist) | ||
| 181 | |||
| 182 | write_pkghistory(pkginfo, d) | ||
| 183 | |||
| 184 | if lastversion: | ||
| 185 | check_pkghistory(pkginfo, lastversion) | ||
| 186 | |||
| 187 | write_latestlink(pkg, pe, pv, pr, d) | ||
| 188 | } | ||
| 189 | |||
| 190 | |||
| 191 | def check_pkghistory(pkginfo, lastversion): | ||
| 192 | |||
| 193 | bb.debug(2, "Checking package history") | ||
| 194 | # RDEPENDS removed? | ||
| 195 | # PKG changed? | ||
| 196 | # Each file list of each package for file removals? | ||
| 197 | |||
| 198 | |||
| 199 | def write_recipehistory(rcpinfo, d): | ||
| 200 | bb.debug(2, "Writing recipe history") | ||
| 201 | |||
| 202 | pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) | ||
| 203 | |||
| 204 | if not os.path.exists(pkghistdir): | ||
| 205 | os.makedirs(pkghistdir) | ||
| 206 | |||
| 207 | verfile = os.path.join(pkghistdir, "%s:%s-%s" % (rcpinfo.pe, rcpinfo.pv, rcpinfo.pr)) | ||
| 208 | f = open(verfile, "w") | ||
| 209 | try: | ||
| 210 | if rcpinfo.pe != "0": | ||
| 211 | f.write("PE = %s\n" % rcpinfo.pe) | ||
| 212 | f.write("PV = %s\n" % rcpinfo.pv) | ||
| 213 | f.write("PR = %s\n" % rcpinfo.pr) | ||
| 214 | f.write("DEPENDS = %s\n" % rcpinfo.depends) | ||
| 215 | f.write("PACKAGES = %s\n" % rcpinfo.packages) | ||
| 216 | finally: | ||
| 217 | f.close() | ||
| 218 | |||
| 219 | |||
| 220 | def write_pkghistory(pkginfo, d): | ||
| 221 | bb.debug(2, "Writing package history") | ||
| 222 | |||
| 223 | pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) | ||
| 224 | |||
| 225 | verpath = os.path.join(pkghistdir, pkginfo.name) | ||
| 226 | if not os.path.exists(verpath): | ||
| 227 | os.makedirs(verpath) | ||
| 228 | |||
| 229 | verfile = os.path.join(verpath, "%s:%s-%s" % (pkginfo.pe, pkginfo.pv, pkginfo.pr)) | ||
| 230 | f = open(verfile, "w") | ||
| 231 | try: | ||
| 232 | if pkginfo.pe != "0": | ||
| 233 | f.write("PE = %s\n" % pkginfo.pe) | ||
| 234 | f.write("PV = %s\n" % pkginfo.pv) | ||
| 235 | f.write("PR = %s\n" % pkginfo.pr) | ||
| 236 | f.write("RDEPENDS = %s\n" % pkginfo.rdepends) | ||
| 237 | f.write("RRECOMMENDS = %s\n" % pkginfo.rrecommends) | ||
| 238 | f.write("PKGSIZE = %d\n" % pkginfo.size) | ||
| 239 | f.write("FILES = %s\n" % pkginfo.files) | ||
| 240 | f.write("FILELIST = %s\n" % pkginfo.filelist) | ||
| 241 | finally: | ||
| 242 | f.close() | ||
| 243 | |||
| 244 | |||
| 245 | def write_latestlink(pkg, pe, pv, pr, d): | ||
| 246 | import shutil | ||
| 247 | |||
| 248 | pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) | ||
| 249 | |||
| 250 | def rm_link(path): | ||
| 251 | try: | ||
| 252 | os.unlink(path) | ||
| 253 | except OSError: | ||
| 254 | return | ||
| 255 | |||
| 256 | if pkg: | ||
| 257 | filedir = os.path.join(pkghistdir, pkg) | ||
| 258 | else: | ||
| 259 | filedir = pkghistdir | ||
| 260 | rm_link(os.path.join(filedir, "latest")) | ||
| 261 | shutil.copy(os.path.join(filedir, "%s:%s-%s" % (pe, pv, pr)), os.path.join(filedir, "latest")) | ||
| 262 | |||
| 263 | |||
| 264 | buildhistory_get_image_installed() { | ||
| 265 | # Anything requiring the use of the packaging system should be done in here | ||
| 266 | # in case the packaging files are going to be removed for this image | ||
| 267 | |||
| 268 | mkdir -p ${BUILDHISTORY_DIR_IMAGE} | ||
| 269 | |||
| 270 | # Get list of installed packages | ||
| 271 | list_installed_packages | sort > ${BUILDHISTORY_DIR_IMAGE}/installed-package-names.txt | ||
| 272 | INSTALLED_PKGS=`cat ${BUILDHISTORY_DIR_IMAGE}/installed-package-names.txt` | ||
| 273 | |||
| 274 | # Produce installed package file and size lists and dependency graph | ||
| 275 | echo -n > ${BUILDHISTORY_DIR_IMAGE}/installed-packages.txt | ||
| 276 | echo -n > ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp | ||
| 277 | echo -e "digraph depends {\n node [shape=plaintext]" > ${BUILDHISTORY_DIR_IMAGE}/depends.dot | ||
| 278 | for pkg in $INSTALLED_PKGS; do | ||
| 279 | pkgfile=`get_package_filename $pkg` | ||
| 280 | echo `basename $pkgfile` >> ${BUILDHISTORY_DIR_IMAGE}/installed-packages.txt | ||
| 281 | if [ -f $pkgfile ] ; then | ||
| 282 | pkgsize=`du -k $pkgfile | head -n1 | awk '{ print $1 }'` | ||
| 283 | echo $pkgsize $pkg >> ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp | ||
| 284 | fi | ||
| 285 | |||
| 286 | deps=`list_package_depends $pkg` | ||
| 287 | for dep in $deps ; do | ||
| 288 | echo "$pkg OPP $dep;" | sed -e 's:-:_:g' -e 's:\.:_:g' -e 's:+::g' | sed 's:OPP:->:g' >> ${BUILDHISTORY_DIR_IMAGE}/depends.dot | ||
| 289 | done | ||
| 290 | |||
| 291 | recs=`list_package_recommends $pkg` | ||
| 292 | for rec in $recs ; do | ||
| 293 | echo "$pkg OPP $rec [style=dotted];" | sed -e 's:-:_:g' -e 's:\.:_:g' -e 's:+::g' | sed 's:OPP:->:g' >> ${BUILDHISTORY_DIR_IMAGE}/depends.dot | ||
| 294 | done | ||
| 295 | done | ||
| 296 | echo "}" >> ${BUILDHISTORY_DIR_IMAGE}/depends.dot | ||
| 297 | |||
| 298 | cat ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp | sort -n -r | awk '{print $1 "\tKiB " $2}' > ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.txt | ||
| 299 | rm ${BUILDHISTORY_DIR_IMAGE}/installed-package-sizes.tmp | ||
| 300 | |||
| 301 | # Produce some cut-down graphs (for readability) | ||
| 302 | grep -v kernel_image ${BUILDHISTORY_DIR_IMAGE}/depends.dot | grep -v kernel_2 | grep -v kernel_3 > ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel.dot | ||
| 303 | grep -v libc6 ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel.dot | grep -v libgcc > ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc.dot | ||
| 304 | grep -v update_ ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc.dot > ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc-noupdate.dot | ||
| 305 | grep -v kernel_module ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc-noupdate.dot > ${BUILDHISTORY_DIR_IMAGE}/depends-nokernel-nolibc-noupdate-nomodules.dot | ||
| 306 | |||
| 307 | # Workaround for broken shell function dependencies | ||
| 308 | if false ; then | ||
| 309 | get_package_filename | ||
| 310 | list_package_depends | ||
| 311 | list_package_recommends | ||
| 312 | fi | ||
| 313 | } | ||
| 314 | |||
| 315 | buildhistory_get_imageinfo() { | ||
| 316 | # List the files in the image, but exclude date/time etc. | ||
| 317 | # This awk script is somewhat messy, but handles where the size is not printed for device files under pseudo | ||
| 318 | find ${IMAGE_ROOTFS} -ls | awk '{ if ( $7 ~ /[0-9]/ ) printf "%s %10-s %10-s %10s %s %s %s\n", $3, $5, $6, $7, $11, $12, $13 ; else printf "%s %10-s %10-s %10s %s %s %s\n", $3, $5, $6, 0, $10, $11, $12 }' > ${BUILDHISTORY_DIR_IMAGE}/files-in-image.txt | ||
| 319 | |||
| 320 | # Add some configuration information | ||
| 321 | echo "${MACHINE}: ${IMAGE_BASENAME} configured for ${DISTRO} ${DISTRO_VERSION}" > ${BUILDHISTORY_DIR_IMAGE}/build-id | ||
| 322 | echo "${@buildhistory_get_layers(d)}" >> ${BUILDHISTORY_DIR_IMAGE}/build-id | ||
| 323 | } | ||
| 324 | |||
| 325 | # By prepending we get in before the removal of packaging files | ||
| 326 | ROOTFS_POSTPROCESS_COMMAND =+ "buildhistory_get_image_installed ; " | ||
| 327 | |||
| 328 | IMAGE_POSTPROCESS_COMMAND += " buildhistory_get_imageinfo ; " | ||
| 329 | |||
| 330 | def buildhistory_get_layers(d): | ||
| 331 | layertext = "Configured metadata layers:\n%s\n" % '\n'.join(get_layers_branch_rev(d)) | ||
| 332 | return layertext | ||
| 333 | |||
| 334 | |||
| 335 | buildhistory_commit() { | ||
| 336 | ( cd ${BUILDHISTORY_DIR}/ | ||
| 337 | git add ${BUILDHISTORY_DIR}/* | ||
| 338 | git commit ${BUILDHISTORY_DIR}/ -m "Build ${BUILDNAME} for machine ${MACHINE} configured for ${DISTRO} ${DISTRO_VERSION}" --author "${BUILDHISTORY_COMMIT_AUTHOR}" > /dev/null || true) | ||
| 339 | } | ||
| 340 | |||
| 341 | python buildhistory_eventhandler() { | ||
| 342 | import bb.build | ||
| 343 | import bb.event | ||
| 344 | |||
| 345 | if isinstance(e, bb.event.BuildCompleted): | ||
| 346 | if e.data.getVar("BUILDHISTORY_COMMIT", True) == "1": | ||
| 347 | bb.build.exec_func("buildhistory_commit", e.data) | ||
| 348 | } | ||
| 349 | |||
| 350 | addhandler buildhistory_eventhandler | ||
diff --git a/meta/classes/rootfs_ipk.bbclass b/meta/classes/rootfs_ipk.bbclass index 4a5a2dd3be..b4b95c5645 100644 --- a/meta/classes/rootfs_ipk.bbclass +++ b/meta/classes/rootfs_ipk.bbclass | |||
| @@ -143,11 +143,36 @@ remove_packaging_data_files() { | |||
| 143 | mkdir ${IMAGE_ROOTFS}${opkglibdir} | 143 | mkdir ${IMAGE_ROOTFS}${opkglibdir} |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | list_installed_packages() { | ||
| 147 | grep ^Package: ${IMAGE_ROOTFS}${opkglibdir}/status | sed "s/^Package: //" | ||
| 148 | } | ||
| 149 | |||
| 150 | get_package_filename() { | ||
| 151 | name=`opkg-cl ${IPKG_ARGS} info $1 | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk '/^Package/ {printf $2"_"}'` | ||
| 152 | name=$name`opkg-cl ${IPKG_ARGS} info $1 | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk -F: '/^Version/ {printf $NF"_"}' | sed 's/^\s*//g'` | ||
| 153 | name=$name`opkg-cl ${IPKG_ARGS} info $1 | grep -B 7 -A 7 "^Status.* \(\(installed\)\|\(unpacked\)\)" | awk '/^Archi/ {print $2".ipk"}'` | ||
| 154 | |||
| 155 | fullname=`find ${DEPLOY_DIR_IPK} -name "$name" || true` | ||
| 156 | if [ "$fullname" = "" ] ; then | ||
| 157 | echo $name | ||
| 158 | else | ||
| 159 | echo $fullname | ||
| 160 | fi | ||
| 161 | } | ||
| 162 | |||
| 163 | list_package_depends() { | ||
| 164 | opkg-cl ${IPKG_ARGS} info $1 | grep ^Depends | sed -e 's/^Depends: //' -e 's/,//g' -e 's:([=<>]* [0-9a-zA-Z.~\-]*)::g' | ||
| 165 | } | ||
| 166 | |||
| 167 | list_package_recommends() { | ||
| 168 | opkg-cl ${IPKG_ARGS} info $1 | grep ^Recommends | sed -e 's/^Recommends: //' -e 's/,//g' -e 's:([=<>]* [0-9a-zA-Z.~\-]*)::g' | ||
| 169 | } | ||
| 170 | |||
| 146 | install_all_locales() { | 171 | install_all_locales() { |
| 147 | 172 | ||
| 148 | PACKAGES_TO_INSTALL="" | 173 | PACKAGES_TO_INSTALL="" |
| 149 | 174 | ||
| 150 | INSTALLED_PACKAGES=`grep ^Package: ${IMAGE_ROOTFS}${opkglibdir}/status |sed "s/^Package: //"|egrep -v -- "(-locale-|-dev$|-doc$|^kernel|^glibc|^ttf|^task|^perl|^python)"` | 175 | INSTALLED_PACKAGES=`list_installed_packages | egrep -v -- "(-locale-|-dev$|-doc$|^kernel|^glibc|^ttf|^task|^perl|^python)"` |
| 151 | 176 | ||
| 152 | for pkg in $INSTALLED_PACKAGES | 177 | for pkg in $INSTALLED_PACKAGES |
| 153 | do | 178 | do |
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass index 6973008c59..5fd45d758c 100644 --- a/meta/classes/rootfs_rpm.bbclass +++ b/meta/classes/rootfs_rpm.bbclass | |||
| @@ -160,16 +160,47 @@ remove_packaging_data_files() { | |||
| 160 | rm -rf ${IMAGE_ROOTFS}${opkglibdir} | 160 | rm -rf ${IMAGE_ROOTFS}${opkglibdir} |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | RPM_QUERY_CMD = '${RPM} --root ${IMAGE_ROOTFS} -D "_dbpath ${rpmlibdir}" \ | ||
| 164 | -D "__dbi_txn create nofsync private"' | ||
| 165 | |||
| 166 | list_installed_packages() { | ||
| 167 | ${RPM_QUERY_CMD} -qa --qf "[%{NAME}\n]" | ||
| 168 | } | ||
| 169 | |||
| 170 | get_package_filename() { | ||
| 171 | resolve_package_rpm ${RPMCONF_TARGET_BASE}-base_archs.conf $1 | ||
| 172 | } | ||
| 173 | |||
| 174 | list_package_depends() { | ||
| 175 | pkglist=`list_installed_packages` | ||
| 176 | |||
| 177 | for req in `${RPM_QUERY_CMD} -q --qf "[%{REQUIRES}\n]" $1`; do | ||
| 178 | if echo "$req" | grep -q "^rpmlib" ; then continue ; fi | ||
| 179 | |||
| 180 | realpkg="" | ||
| 181 | for dep in $pkglist; do | ||
| 182 | if [ "$dep" = "$req" ] ; then | ||
| 183 | realpkg="1" | ||
| 184 | echo $req | ||
| 185 | break | ||
| 186 | fi | ||
| 187 | done | ||
| 188 | |||
| 189 | if [ "$realdep" = "" ] ; then | ||
| 190 | ${RPM_QUERY_CMD} -q --whatprovides $req --qf "%{NAME}\n" | ||
| 191 | fi | ||
| 192 | done | ||
| 193 | } | ||
| 194 | |||
| 195 | list_package_recommends() { | ||
| 196 | : | ||
| 197 | } | ||
| 163 | 198 | ||
| 164 | install_all_locales() { | 199 | install_all_locales() { |
| 165 | PACKAGES_TO_INSTALL="" | 200 | PACKAGES_TO_INSTALL="" |
| 166 | 201 | ||
| 167 | # Generate list of installed packages... | 202 | # Generate list of installed packages... |
| 168 | INSTALLED_PACKAGES=$( \ | 203 | INSTALLED_PACKAGES=`list_installed_packages | egrep -v -- "(-locale-|-dev$|-doc$|^kernel|^glibc|^ttf|^task|^perl|^python)"` |
| 169 | ${RPM} --root ${IMAGE_ROOTFS} -D "_dbpath ${rpmlibdir}" \ | ||
| 170 | -D "__dbi_txn create nofsync private" \ | ||
| 171 | -qa --qf "[%{NAME}\n]" | egrep -v -- "(-locale-|-dev$|-doc$|^kernel|^glibc|^ttf|^task|^perl|^python)" \ | ||
| 172 | ) | ||
| 173 | 204 | ||
| 174 | # This would likely be faster if we did it in one transaction | 205 | # This would likely be faster if we did it in one transaction |
| 175 | # but this should be good enough for the few users of this function... | 206 | # but this should be good enough for the few users of this function... |
