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-2016 Intel Corporation 7# Copyright (C) 2007-2011 Koen Kooi <koen@openembedded.org> 8# 9# SPDX-License-Identifier: MIT 10# 11 12IMAGE_CLASSES += "image-artifact-names" 13 14BUILDHISTORY_FEATURES ?= "image package sdk" 15BUILDHISTORY_DIR ?= "${TOPDIR}/buildhistory" 16BUILDHISTORY_DIR_IMAGE = "${BUILDHISTORY_DIR}/images/${MACHINE_ARCH}/${TCLIBC}/${IMAGE_BASENAME}" 17BUILDHISTORY_DIR_PACKAGE = "${BUILDHISTORY_DIR}/packages/${MULTIMACH_TARGET_SYS}/${PN}" 18 19# Setting this to non-empty will remove the old content of the buildhistory as part of 20# the current bitbake invocation and replace it with information about what was built 21# during the build. 22# 23# This is meant to be used in continuous integration (CI) systems when invoking bitbake 24# for full world builds. The effect in that case is that information about packages 25# that no longer get build also gets removed from the buildhistory, which is not 26# the case otherwise. 27# 28# The advantage over manually cleaning the buildhistory outside of bitbake is that 29# the "version-going-backwards" check still works. When relying on that, be careful 30# about failed world builds: they will lead to incomplete information in the 31# buildhistory because information about packages that could not be built will 32# also get removed. A CI system should handle that by discarding the buildhistory 33# of failed builds. 34# 35# The expected usage is via auto.conf, but passing via the command line also works 36# with: BB_ENV_PASSTHROUGH_ADDITIONS=BUILDHISTORY_RESET BUILDHISTORY_RESET=1 37BUILDHISTORY_RESET ?= "" 38 39BUILDHISTORY_OLD_DIR = "${BUILDHISTORY_DIR}/${@ "old" if "${BUILDHISTORY_RESET}" else ""}" 40BUILDHISTORY_OLD_DIR_PACKAGE = "${BUILDHISTORY_OLD_DIR}/packages/${MULTIMACH_TARGET_SYS}/${PN}" 41BUILDHISTORY_DIR_SDK = "${BUILDHISTORY_DIR}/sdk/${SDK_NAME}${SDK_EXT}/${IMAGE_BASENAME}" 42BUILDHISTORY_IMAGE_FILES ?= "/etc/passwd /etc/group" 43BUILDHISTORY_SDK_FILES ?= "conf/local.conf conf/bblayers.conf conf/auto.conf conf/locked-sigs.inc conf/devtool.conf" 44BUILDHISTORY_COMMIT ?= "1" 45BUILDHISTORY_COMMIT_AUTHOR ?= "buildhistory <buildhistory@${DISTRO}>" 46BUILDHISTORY_PUSH_REPO ?= "" 47BUILDHISTORY_TAG ?= "build" 48BUILDHISTORY_PATH_PREFIX_STRIP ?= "" 49 50# We want to avoid influencing the signatures of the task so use vardepsexclude 51do_populate_sysroot[postfuncs] += "buildhistory_emit_sysroot" 52do_populate_sysroot_setscene[postfuncs] += "buildhistory_emit_sysroot" 53do_populate_sysroot[vardepsexclude] += "buildhistory_emit_sysroot" 54 55do_package[postfuncs] += "buildhistory_list_pkg_files" 56do_package_setscene[postfuncs] += "buildhistory_list_pkg_files" 57do_package[vardepsexclude] += "buildhistory_list_pkg_files" 58 59do_packagedata[postfuncs] += "buildhistory_emit_pkghistory" 60do_packagedata_setscene[postfuncs] += "buildhistory_emit_pkghistory" 61do_packagedata[vardepsexclude] += "buildhistory_emit_pkghistory" 62 63# Similarly for our function that gets the output signatures 64SSTATEPOSTUNPACKFUNCS:append = " buildhistory_emit_outputsigs" 65sstate_installpkgdir[vardepsexclude] += "buildhistory_emit_outputsigs" 66SSTATEPOSTUNPACKFUNCS[vardepvalueexclude] .= "| buildhistory_emit_outputsigs" 67 68# All items except those listed here will be removed from a recipe's 69# build history directory by buildhistory_emit_pkghistory(). This is 70# necessary because some of these items (package directories, files that 71# we no longer emit) might be obsolete. 72# 73# When extending build history, derive your class from buildhistory.bbclass 74# and extend this list here with the additional files created by the derived 75# class. 76BUILDHISTORY_PRESERVE = "latest latest_srcrev sysroot" 77 78PATCH_GIT_USER_EMAIL ?= "buildhistory@oe" 79PATCH_GIT_USER_NAME ?= "OpenEmbedded" 80 81# 82# Write out the contents of the sysroot 83# 84buildhistory_emit_sysroot() { 85 mkdir --parents ${BUILDHISTORY_DIR_PACKAGE} 86 case ${CLASSOVERRIDE} in 87 class-native|class-cross|class-crosssdk) 88 BASE=${SYSROOT_DESTDIR}/${STAGING_DIR_NATIVE} 89 ;; 90 *) 91 BASE=${SYSROOT_DESTDIR} 92 ;; 93 esac 94 buildhistory_list_files_no_owners $BASE ${BUILDHISTORY_DIR_PACKAGE}/sysroot 95} 96 97# 98# Write out metadata about this package for comparison when writing future packages 99# 100python buildhistory_emit_pkghistory() { 101 import re 102 import json 103 import shlex 104 import errno 105 import shutil 106 107 if not "package" in (d.getVar('BUILDHISTORY_FEATURES') or "").split(): 108 return 0 109 110 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE') 111 oldpkghistdir = d.getVar('BUILDHISTORY_OLD_DIR_PACKAGE') 112 113 class RecipeInfo: 114 def __init__(self, name): 115 self.name = name 116 self.pe = "0" 117 self.pv = "0" 118 self.pr = "r0" 119 self.depends = "" 120 self.packages = "" 121 self.srcrev = "" 122 self.layer = "" 123 self.license = "" 124 self.config = "" 125 self.src_uri = "" 126 127 128 class PackageInfo: 129 def __init__(self, name): 130 self.name = name 131 self.pe = "0" 132 self.pv = "0" 133 self.pr = "r0" 134 # pkg/pkge/pkgv/pkgr should be empty because we want to be able to default them 135 self.pkg = "" 136 self.pkge = "" 137 self.pkgv = "" 138 self.pkgr = "" 139 self.size = 0 140 self.depends = "" 141 self.rprovides = "" 142 self.rdepends = "" 143 self.rrecommends = "" 144 self.rsuggests = "" 145 self.rreplaces = "" 146 self.rconflicts = "" 147 self.files = "" 148 self.filelist = "" 149 # Variables that need to be written to their own separate file 150 self.filevars = dict.fromkeys(['pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm']) 151 152 # Should check PACKAGES here to see if anything was removed 153 154 def readPackageInfo(pkg, histfile): 155 pkginfo = PackageInfo(pkg) 156 with open(histfile, "r") as f: 157 for line in f: 158 lns = line.split('=', 1) 159 name = lns[0].strip() 160 value = lns[1].strip(" \t\r\n").strip('"') 161 if name == "PE": 162 pkginfo.pe = value 163 elif name == "PV": 164 pkginfo.pv = value 165 elif name == "PR": 166 pkginfo.pr = value 167 elif name == "PKG": 168 pkginfo.pkg = value 169 elif name == "PKGE": 170 pkginfo.pkge = value 171 elif name == "PKGV": 172 pkginfo.pkgv = value 173 elif name == "PKGR": 174 pkginfo.pkgr = value 175 elif name == "RPROVIDES": 176 pkginfo.rprovides = value 177 elif name == "RDEPENDS": 178 pkginfo.rdepends = value 179 elif name == "RRECOMMENDS": 180 pkginfo.rrecommends = value 181 elif name == "RSUGGESTS": 182 pkginfo.rsuggests = value 183 elif name == "RREPLACES": 184 pkginfo.rreplaces = value 185 elif name == "RCONFLICTS": 186 pkginfo.rconflicts = value 187 elif name == "PKGSIZE": 188 pkginfo.size = int(value) 189 elif name == "FILES": 190 pkginfo.files = value 191 elif name == "FILELIST": 192 pkginfo.filelist = value 193 # Apply defaults 194 if not pkginfo.pkg: 195 pkginfo.pkg = pkginfo.name 196 if not pkginfo.pkge: 197 pkginfo.pkge = pkginfo.pe 198 if not pkginfo.pkgv: 199 pkginfo.pkgv = pkginfo.pv 200 if not pkginfo.pkgr: 201 pkginfo.pkgr = pkginfo.pr 202 return pkginfo 203 204 def getlastpkgversion(pkg): 205 try: 206 histfile = os.path.join(oldpkghistdir, pkg, "latest") 207 return readPackageInfo(pkg, histfile) 208 except EnvironmentError: 209 return None 210 211 def sortpkglist(string): 212 pkgiter = re.finditer(r'[a-zA-Z0-9.+-]+( \([><=]+[^)]+\))?', string, 0) 213 pkglist = [p.group(0) for p in pkgiter] 214 pkglist.sort() 215 return ' '.join(pkglist) 216 217 def sortlist(string): 218 items = string.split(' ') 219 items.sort() 220 return ' '.join(items) 221 222 def preservebuildhistoryfiles(pkg, preserve): 223 if os.path.exists(os.path.join(oldpkghistdir, pkg)): 224 listofobjs = os.listdir(os.path.join(oldpkghistdir, pkg)) 225 for obj in listofobjs: 226 if obj not in preserve: 227 continue 228 try: 229 bb.utils.mkdirhier(os.path.join(pkghistdir, pkg)) 230 shutil.copyfile(os.path.join(oldpkghistdir, pkg, obj), os.path.join(pkghistdir, pkg, obj)) 231 except IOError as e: 232 bb.note("Unable to copy file. %s" % e) 233 except EnvironmentError as e: 234 bb.note("Unable to copy file. %s" % e) 235 236 pn = d.getVar('PN') 237 pe = d.getVar('PE') or "0" 238 pv = d.getVar('PV') 239 pr = d.getVar('PR') 240 layer = bb.utils.get_file_layer(d.getVar('FILE'), d) 241 license = d.getVar('LICENSE') 242 243 pkgdata_dir = d.getVar('PKGDATA_DIR') 244 packages = "" 245 try: 246 with open(os.path.join(pkgdata_dir, pn)) as f: 247 for line in f.readlines(): 248 if line.startswith('PACKAGES: '): 249 packages = oe.utils.squashspaces(line.split(': ', 1)[1]) 250 break 251 except IOError as e: 252 if e.errno == errno.ENOENT: 253 # Probably a -cross recipe, just ignore 254 return 0 255 else: 256 raise 257 258 packagelist = packages.split() 259 preserve = d.getVar('BUILDHISTORY_PRESERVE').split() 260 if not os.path.exists(pkghistdir): 261 bb.utils.mkdirhier(pkghistdir) 262 else: 263 # We need to make sure that all files kept in 264 # buildhistory/old are restored successfully 265 # otherwise next block of code wont have files to 266 # check and purge 267 if d.getVar("BUILDHISTORY_RESET"): 268 for pkg in packagelist: 269 preservebuildhistoryfiles(pkg, preserve) 270 271 # Remove files for packages that no longer exist 272 for item in os.listdir(pkghistdir): 273 if item not in preserve: 274 if item not in packagelist: 275 itempath = os.path.join(pkghistdir, item) 276 if os.path.isdir(itempath): 277 for subfile in os.listdir(itempath): 278 os.unlink(os.path.join(itempath, subfile)) 279 os.rmdir(itempath) 280 else: 281 os.unlink(itempath) 282 283 rcpinfo = RecipeInfo(pn) 284 rcpinfo.pe = pe 285 rcpinfo.pv = pv 286 rcpinfo.pr = pr 287 rcpinfo.depends = sortlist(oe.utils.squashspaces(d.getVar('DEPENDS') or "")) 288 rcpinfo.packages = packages 289 rcpinfo.layer = layer 290 rcpinfo.license = license 291 rcpinfo.config = sortlist(oe.utils.squashspaces(d.getVar('PACKAGECONFIG') or "")) 292 rcpinfo.src_uri = oe.utils.squashspaces(d.getVar('SRC_URI') or "") 293 write_recipehistory(rcpinfo, d) 294 295 bb.build.exec_func("read_subpackage_metadata", d) 296 297 for pkg in packagelist: 298 localdata = d.createCopy() 299 localdata.setVar('OVERRIDES', d.getVar("OVERRIDES", False) + ":" + pkg) 300 301 pkge = localdata.getVar("PKGE") or '0' 302 pkgv = localdata.getVar("PKGV") 303 pkgr = localdata.getVar("PKGR") 304 # 305 # Find out what the last version was 306 # Make sure the version did not decrease 307 # 308 lastversion = getlastpkgversion(pkg) 309 if lastversion: 310 last_pkge = lastversion.pkge 311 last_pkgv = lastversion.pkgv 312 last_pkgr = lastversion.pkgr 313 r = bb.utils.vercmp((pkge, pkgv, pkgr), (last_pkge, last_pkgv, last_pkgr)) 314 if r < 0: 315 msg = "Package version for package %s went backwards which would break package feeds (from %s:%s-%s to %s:%s-%s)" % (pkg, last_pkge, last_pkgv, last_pkgr, pkge, pkgv, pkgr) 316 oe.qa.handle_error("version-going-backwards", msg, d) 317 318 pkginfo = PackageInfo(pkg) 319 # Apparently the version can be different on a per-package basis (see Python) 320 pkginfo.pe = localdata.getVar("PE") or '0' 321 pkginfo.pv = localdata.getVar("PV") 322 pkginfo.pr = localdata.getVar("PR") 323 pkginfo.pkg = localdata.getVar("PKG") 324 pkginfo.pkge = pkge 325 pkginfo.pkgv = pkgv 326 pkginfo.pkgr = pkgr 327 pkginfo.rprovides = sortpkglist(oe.utils.squashspaces(localdata.getVar("RPROVIDES") or "")) 328 pkginfo.rdepends = sortpkglist(oe.utils.squashspaces(localdata.getVar("RDEPENDS") or "")) 329 pkginfo.rrecommends = sortpkglist(oe.utils.squashspaces(localdata.getVar("RRECOMMENDS") or "")) 330 pkginfo.rsuggests = sortpkglist(oe.utils.squashspaces(localdata.getVar("RSUGGESTS") or "")) 331 pkginfo.replaces = sortpkglist(oe.utils.squashspaces(localdata.getVar("RREPLACES") or "")) 332 pkginfo.rconflicts = sortpkglist(oe.utils.squashspaces(localdata.getVar("RCONFLICTS") or "")) 333 pkginfo.files = oe.utils.squashspaces(localdata.getVar("FILES") or "") 334 for filevar in pkginfo.filevars: 335 pkginfo.filevars[filevar] = localdata.getVar(filevar) or "" 336 337 # Gather information about packaged files 338 val = localdata.getVar('FILES_INFO') or '' 339 dictval = json.loads(val) 340 filelist = list(dictval.keys()) 341 filelist.sort() 342 pkginfo.filelist = " ".join([shlex.quote(x) for x in filelist]) 343 344 pkginfo.size = int(localdata.getVar('PKGSIZE') or '0') 345 346 write_pkghistory(pkginfo, d) 347 348 oe.qa.exit_if_errors(d) 349} 350 351python buildhistory_emit_outputsigs() { 352 if not "task" in (d.getVar('BUILDHISTORY_FEATURES') or "").split(): 353 return 354 355 import hashlib 356 357 taskoutdir = os.path.join(d.getVar('BUILDHISTORY_DIR'), 'task', 'output') 358 bb.utils.mkdirhier(taskoutdir) 359 currenttask = d.getVar('BB_CURRENTTASK') 360 pn = d.getVar('PN') 361 taskfile = os.path.join(taskoutdir, '%s.%s' % (pn, currenttask)) 362 363 cwd = os.getcwd() 364 filesigs = {} 365 for root, _, files in os.walk(cwd): 366 for fname in files: 367 if fname == 'fixmepath': 368 continue 369 fullpath = os.path.join(root, fname) 370 try: 371 if os.path.islink(fullpath): 372 sha256 = hashlib.sha256(os.readlink(fullpath).encode('utf-8')).hexdigest() 373 elif os.path.isfile(fullpath): 374 sha256 = bb.utils.sha256_file(fullpath) 375 else: 376 continue 377 except OSError: 378 bb.warn('buildhistory: unable to read %s to get output signature' % fullpath) 379 continue 380 filesigs[os.path.relpath(fullpath, cwd)] = sha256 381 with open(taskfile, 'w') as f: 382 for fpath, fsig in sorted(filesigs.items(), key=lambda item: item[0]): 383 f.write('%s %s\n' % (fpath, fsig)) 384} 385 386 387def write_recipehistory(rcpinfo, d): 388 bb.debug(2, "Writing recipe history") 389 390 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE') 391 392 infofile = os.path.join(pkghistdir, "latest") 393 with open(infofile, "w") as f: 394 if rcpinfo.pe != "0": 395 f.write(u"PE = %s\n" % rcpinfo.pe) 396 f.write(u"PV = %s\n" % rcpinfo.pv) 397 f.write(u"PR = %s\n" % rcpinfo.pr) 398 f.write(u"DEPENDS = %s\n" % rcpinfo.depends) 399 f.write(u"PACKAGES = %s\n" % rcpinfo.packages) 400 f.write(u"LAYER = %s\n" % rcpinfo.layer) 401 f.write(u"LICENSE = %s\n" % rcpinfo.license) 402 f.write(u"CONFIG = %s\n" % rcpinfo.config) 403 f.write(u"SRC_URI = %s\n" % rcpinfo.src_uri) 404 405 write_latest_srcrev(d, pkghistdir) 406 407def write_pkghistory(pkginfo, d): 408 bb.debug(2, "Writing package history for package %s" % pkginfo.name) 409 410 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE') 411 412 pkgpath = os.path.join(pkghistdir, pkginfo.name) 413 if not os.path.exists(pkgpath): 414 bb.utils.mkdirhier(pkgpath) 415 416 infofile = os.path.join(pkgpath, "latest") 417 with open(infofile, "w") as f: 418 if pkginfo.pe != "0": 419 f.write(u"PE = %s\n" % pkginfo.pe) 420 f.write(u"PV = %s\n" % pkginfo.pv) 421 f.write(u"PR = %s\n" % pkginfo.pr) 422 423 if pkginfo.pkg != pkginfo.name: 424 f.write(u"PKG = %s\n" % pkginfo.pkg) 425 if pkginfo.pkge != pkginfo.pe: 426 f.write(u"PKGE = %s\n" % pkginfo.pkge) 427 if pkginfo.pkgv != pkginfo.pv: 428 f.write(u"PKGV = %s\n" % pkginfo.pkgv) 429 if pkginfo.pkgr != pkginfo.pr: 430 f.write(u"PKGR = %s\n" % pkginfo.pkgr) 431 f.write(u"RPROVIDES = %s\n" % pkginfo.rprovides) 432 f.write(u"RDEPENDS = %s\n" % pkginfo.rdepends) 433 f.write(u"RRECOMMENDS = %s\n" % pkginfo.rrecommends) 434 if pkginfo.rsuggests: 435 f.write(u"RSUGGESTS = %s\n" % pkginfo.rsuggests) 436 if pkginfo.rreplaces: 437 f.write(u"RREPLACES = %s\n" % pkginfo.rreplaces) 438 if pkginfo.rconflicts: 439 f.write(u"RCONFLICTS = %s\n" % pkginfo.rconflicts) 440 f.write(u"PKGSIZE = %d\n" % pkginfo.size) 441 f.write(u"FILES = %s\n" % pkginfo.files) 442 f.write(u"FILELIST = %s\n" % pkginfo.filelist) 443 444 for filevar in pkginfo.filevars: 445 filevarpath = os.path.join(pkgpath, "latest.%s" % filevar) 446 val = pkginfo.filevars[filevar] 447 if val: 448 with open(filevarpath, "w") as f: 449 f.write(val) 450 else: 451 if os.path.exists(filevarpath): 452 os.unlink(filevarpath) 453 454# 455# rootfs_type can be: image, sdk_target, sdk_host 456# 457def buildhistory_list_installed(d, rootfs_type="image"): 458 from oe.rootfs import image_list_installed_packages 459 from oe.sdk import sdk_list_installed_packages 460 from oe.utils import format_pkg_list 461 462 process_list = [('file', 'bh_installed_pkgs_%s.txt' % os.getpid()),\ 463 ('deps', 'bh_installed_pkgs_deps_%s.txt' % os.getpid())] 464 465 if rootfs_type == "image": 466 pkgs = image_list_installed_packages(d) 467 else: 468 pkgs = sdk_list_installed_packages(d, rootfs_type == "sdk_target") 469 470 if rootfs_type == "sdk_host": 471 pkgdata_dir = d.getVar('PKGDATA_DIR_SDK') 472 else: 473 pkgdata_dir = d.getVar('PKGDATA_DIR') 474 475 for output_type, output_file in process_list: 476 output_file_full = os.path.join(d.getVar('WORKDIR'), output_file) 477 478 with open(output_file_full, 'w') as output: 479 output.write(format_pkg_list(pkgs, output_type, pkgdata_dir)) 480 481python buildhistory_list_installed_image() { 482 buildhistory_list_installed(d) 483} 484 485python buildhistory_list_installed_sdk_target() { 486 buildhistory_list_installed(d, "sdk_target") 487} 488 489python buildhistory_list_installed_sdk_host() { 490 buildhistory_list_installed(d, "sdk_host") 491} 492 493buildhistory_get_installed() { 494 mkdir -p $1 495 496 # Get list of installed packages 497 pkgcache="$1/installed-packages.tmp" 498 cat ${WORKDIR}/bh_installed_pkgs_${PID}.txt | sort > $pkgcache && rm ${WORKDIR}/bh_installed_pkgs_${PID}.txt 499 500 cat $pkgcache | awk '{ print $1 }' > $1/installed-package-names.txt 501 502 if [ -s $pkgcache ] ; then 503 cat $pkgcache | awk '{ print $2 }' | xargs -n1 basename > $1/installed-packages.txt 504 else 505 printf "" > $1/installed-packages.txt 506 fi 507 508 # Produce dependency graph 509 # First, quote each name to handle characters that cause issues for dot 510 sed 's:\([^| ]*\):"\1":g' ${WORKDIR}/bh_installed_pkgs_deps_${PID}.txt > $1/depends.tmp && 511 rm ${WORKDIR}/bh_installed_pkgs_deps_${PID}.txt 512 # Remove lines with rpmlib(...) and config(...) dependencies, change the 513 # delimiter from pipe to "->", set the style for recommend lines and 514 # turn versioned dependencies into edge labels. 515 sed -i -e '/rpmlib(/d' \ 516 -e '/config(/d' \ 517 -e 's:|: -> :' \ 518 -e 's:"\[REC\]":[style=dotted]:' \ 519 -e 's:"\([<>=]\+\)" "\([^"]*\)":[label="\1 \2"]:' \ 520 -e 's:"\([*]\+\)" "\([^"]*\)":[label="\2"]:' \ 521 -e 's:"\[RPROVIDES\]":[style=dashed]:' \ 522 $1/depends.tmp 523 # Add header, sorted and de-duped contents and footer and then delete the temp file 524 printf "digraph depends {\n node [shape=plaintext]\n" > $1/depends.dot 525 cat $1/depends.tmp | sort -u >> $1/depends.dot 526 echo "}" >> $1/depends.dot 527 rm $1/depends.tmp 528 529 # Set correct pkgdatadir 530 pkgdatadir=${PKGDATA_DIR} 531 if [ "$2" = "sdk" ] && [ "$3" = "host" ] ; then 532 pkgdatadir="${PKGDATA_DIR_SDK}" 533 fi 534 535 # Produce installed package sizes list 536 oe-pkgdata-util -p $pkgdatadir read-value "PKGSIZE" -n -f $pkgcache > $1/installed-package-sizes.tmp 537 cat $1/installed-package-sizes.tmp | awk '{print $2 "\tKiB\t" $1}' | sort -n -r > $1/installed-package-sizes.txt 538 rm $1/installed-package-sizes.tmp 539 540 # Produce package info: runtime_name, buildtime_name, recipe, version, size 541 oe-pkgdata-util -p $pkgdatadir read-value "PACKAGE,PN,PV,PKGSIZE" -n -f $pkgcache > $1/installed-package-info.tmp 542 cat $1/installed-package-info.tmp | sort -n -r -k 5 > $1/installed-package-info.txt 543 rm $1/installed-package-info.tmp 544 545 # We're now done with the cache, delete it 546 rm $pkgcache 547 548 if [ "$2" != "sdk" ] ; then 549 # Produce some cut-down graphs (for readability) 550 grep -v kernel-image $1/depends.dot | grep -v kernel-3 | grep -v kernel-4 > $1/depends-nokernel.dot 551 grep -v libc6 $1/depends-nokernel.dot | grep -v libgcc > $1/depends-nokernel-nolibc.dot 552 grep -v update- $1/depends-nokernel-nolibc.dot > $1/depends-nokernel-nolibc-noupdate.dot 553 grep -v kernel-module $1/depends-nokernel-nolibc-noupdate.dot > $1/depends-nokernel-nolibc-noupdate-nomodules.dot 554 fi 555 556 # Add complementary package information 557 if [ -e ${WORKDIR}/complementary_pkgs.txt ]; then 558 cp ${WORKDIR}/complementary_pkgs.txt $1 559 fi 560} 561 562buildhistory_get_image_installed() { 563 # Anything requiring the use of the packaging system should be done in here 564 # in case the packaging files are going to be removed for this image 565 566 if [ "${@bb.utils.contains('BUILDHISTORY_FEATURES', 'image', '1', '0', d)}" = "0" ] ; then 567 return 568 fi 569 570 buildhistory_get_installed ${BUILDHISTORY_DIR_IMAGE} 571} 572 573buildhistory_get_sdk_installed() { 574 # Anything requiring the use of the packaging system should be done in here 575 # in case the packaging files are going to be removed for this SDK 576 577 if [ "${@bb.utils.contains('BUILDHISTORY_FEATURES', 'sdk', '1', '0', d)}" = "0" ] ; then 578 return 579 fi 580 581 buildhistory_get_installed ${BUILDHISTORY_DIR_SDK}/$1 sdk $1 582} 583 584buildhistory_get_sdk_installed_host() { 585 buildhistory_get_sdk_installed host 586} 587 588buildhistory_get_sdk_installed_target() { 589 buildhistory_get_sdk_installed target 590} 591 592buildhistory_list_files() { 593 # List the files in the specified directory, but exclude date/time etc. 594 # This is somewhat messy, but handles cases where the size is not printed for device files under pseudo 595 ( cd $1 596 find_cmd='find . ! -path . -printf "%M %-10u %-10g %10s %p -> %l\n"' 597 if [ "$3" = "fakeroot" ] ; then 598 eval ${FAKEROOTENV} ${FAKEROOTCMD} $find_cmd 599 else 600 eval $find_cmd 601 fi | sort -k5 | sed 's/ * -> $//' > $2 ) 602} 603 604buildhistory_list_files_no_owners() { 605 # List the files in the specified directory, but exclude date/time etc. 606 # Also don't output the ownership data, but instead output just - - so 607 # that the same parsing code as for _list_files works. 608 # This is somewhat messy, but handles cases where the size is not printed for device files under pseudo 609 ( cd $1 610 find_cmd='find . ! -path . -printf "%M - - %10s %p -> %l\n"' 611 if [ "$3" = "fakeroot" ] ; then 612 eval ${FAKEROOTENV} ${FAKEROOTCMD} "$find_cmd" 613 else 614 eval "$find_cmd" 615 fi | sort -k5 | sed 's/ * -> $//' > $2 ) 616} 617 618buildhistory_list_pkg_files() { 619 if [ "${@bb.utils.contains('BUILDHISTORY_FEATURES', 'package', '1', '0', d)}" = "0" ] ; then 620 return 621 fi 622 623 # Create individual files-in-package for each recipe's package 624 pkgdirlist=$(find ${PKGDEST}/* -maxdepth 0 -type d) 625 for pkgdir in $pkgdirlist; do 626 pkgname=$(basename $pkgdir) 627 outfolder="${BUILDHISTORY_DIR_PACKAGE}/$pkgname" 628 outfile="$outfolder/files-in-package.txt" 629 mkdir -p $outfolder 630 buildhistory_list_files $pkgdir $outfile fakeroot 631 done 632} 633 634buildhistory_get_imageinfo() { 635 if [ "${@bb.utils.contains('BUILDHISTORY_FEATURES', 'image', '1', '0', d)}" = "0" ] ; then 636 return 637 fi 638 639 mkdir -p ${BUILDHISTORY_DIR_IMAGE} 640 buildhistory_list_files ${IMAGE_ROOTFS} ${BUILDHISTORY_DIR_IMAGE}/files-in-image.txt 641 642 # Collect files requested in BUILDHISTORY_IMAGE_FILES 643 rm -rf ${BUILDHISTORY_DIR_IMAGE}/image-files 644 for f in ${BUILDHISTORY_IMAGE_FILES}; do 645 if [ -f ${IMAGE_ROOTFS}/$f ] ; then 646 mkdir -p ${BUILDHISTORY_DIR_IMAGE}/image-files/`dirname $f` 647 cp ${IMAGE_ROOTFS}/$f ${BUILDHISTORY_DIR_IMAGE}/image-files/$f 648 fi 649 done 650 651 # Record some machine-readable meta-information about the image 652 printf "" > ${BUILDHISTORY_DIR_IMAGE}/image-info.txt 653 cat >> ${BUILDHISTORY_DIR_IMAGE}/image-info.txt <<END 654${@buildhistory_get_imagevars(d)} 655END 656 imagesize=`du -ks ${IMAGE_ROOTFS} | awk '{ print $1 }'` 657 echo "IMAGESIZE = $imagesize" >> ${BUILDHISTORY_DIR_IMAGE}/image-info.txt 658 659 # Add some configuration information 660 echo "${MACHINE}: ${IMAGE_BASENAME} configured for ${DISTRO} ${DISTRO_VERSION}" > ${BUILDHISTORY_DIR_IMAGE}/build-id.txt 661 662 cat >> ${BUILDHISTORY_DIR_IMAGE}/build-id.txt <<END 663${@buildhistory_get_build_id(d)} 664END 665} 666 667buildhistory_get_sdkinfo() { 668 if [ "${@bb.utils.contains('BUILDHISTORY_FEATURES', 'sdk', '1', '0', d)}" = "0" ] ; then 669 return 670 fi 671 672 buildhistory_list_files ${SDK_OUTPUT} ${BUILDHISTORY_DIR_SDK}/files-in-sdk.txt 673 674 # Collect files requested in BUILDHISTORY_SDK_FILES 675 rm -rf ${BUILDHISTORY_DIR_SDK}/sdk-files 676 for f in ${BUILDHISTORY_SDK_FILES}; do 677 if [ -f ${SDK_OUTPUT}/${SDKPATH}/$f ] ; then 678 mkdir -p ${BUILDHISTORY_DIR_SDK}/sdk-files/`dirname $f` 679 cp ${SDK_OUTPUT}/${SDKPATH}/$f ${BUILDHISTORY_DIR_SDK}/sdk-files/$f 680 fi 681 done 682 683 # Record some machine-readable meta-information about the SDK 684 printf "" > ${BUILDHISTORY_DIR_SDK}/sdk-info.txt 685 cat >> ${BUILDHISTORY_DIR_SDK}/sdk-info.txt <<END 686${@buildhistory_get_sdkvars(d)} 687END 688 sdksize=`du -ks ${SDK_OUTPUT} | awk '{ print $1 }'` 689 echo "SDKSIZE = $sdksize" >> ${BUILDHISTORY_DIR_SDK}/sdk-info.txt 690} 691 692python buildhistory_get_extra_sdkinfo() { 693 import operator 694 from oe.sdk import get_extra_sdkinfo 695 696 sstate_dir = d.expand('${SDK_OUTPUT}/${SDKPATH}/sstate-cache') 697 extra_info = get_extra_sdkinfo(sstate_dir) 698 699 if d.getVar('BB_CURRENTTASK') == 'populate_sdk_ext' and \ 700 "sdk" in (d.getVar('BUILDHISTORY_FEATURES') or "").split(): 701 with open(d.expand('${BUILDHISTORY_DIR_SDK}/sstate-package-sizes.txt'), 'w') as f: 702 filesizes_sorted = sorted(extra_info['filesizes'].items(), key=operator.itemgetter(1, 0), reverse=True) 703 for fn, size in filesizes_sorted: 704 f.write('%10d KiB %s\n' % (size, fn)) 705 with open(d.expand('${BUILDHISTORY_DIR_SDK}/sstate-task-sizes.txt'), 'w') as f: 706 tasksizes_sorted = sorted(extra_info['tasksizes'].items(), key=operator.itemgetter(1, 0), reverse=True) 707 for task, size in tasksizes_sorted: 708 f.write('%10d KiB %s\n' % (size, task)) 709} 710 711# By using ROOTFS_POSTUNINSTALL_COMMAND we get in after uninstallation of 712# unneeded packages but before the removal of packaging files 713ROOTFS_POSTUNINSTALL_COMMAND += "buildhistory_list_installed_image" 714ROOTFS_POSTUNINSTALL_COMMAND += "buildhistory_get_image_installed" 715ROOTFS_POSTUNINSTALL_COMMAND[vardepvalueexclude] .= "| buildhistory_list_installed_image| buildhistory_get_image_installed" 716ROOTFS_POSTUNINSTALL_COMMAND[vardepsexclude] += "buildhistory_list_installed_image buildhistory_get_image_installed" 717 718IMAGE_POSTPROCESS_COMMAND += "buildhistory_get_imageinfo" 719IMAGE_POSTPROCESS_COMMAND[vardepvalueexclude] .= "| buildhistory_get_imageinfo" 720IMAGE_POSTPROCESS_COMMAND[vardepsexclude] += "buildhistory_get_imageinfo" 721 722# We want these to be the last run so that we get called after complementary package installation 723POPULATE_SDK_POST_TARGET_COMMAND:append = " buildhistory_list_installed_sdk_target" 724POPULATE_SDK_POST_TARGET_COMMAND:append = " buildhistory_get_sdk_installed_target" 725POPULATE_SDK_POST_TARGET_COMMAND[vardepvalueexclude] .= "| buildhistory_list_installed_sdk_target| buildhistory_get_sdk_installed_target" 726POPULATE_SDK_POST_TARGET_COMMAND[vardepsexclude] += "buildhistory_list_installed_sdk_target buildhistory_get_sdk_installed_target" 727 728POPULATE_SDK_POST_HOST_COMMAND:append = " buildhistory_list_installed_sdk_host" 729POPULATE_SDK_POST_HOST_COMMAND:append = " buildhistory_get_sdk_installed_host" 730POPULATE_SDK_POST_HOST_COMMAND[vardepvalueexclude] .= "| buildhistory_list_installed_sdk_host| buildhistory_get_sdk_installed_host" 731POPULATE_SDK_POST_HOST_COMMAND[vardepsexclude] += "buildhistory_list_installed_sdk_host buildhistory_get_sdk_installed_host" 732 733SDK_POSTPROCESS_COMMAND:append = " buildhistory_get_sdkinfo buildhistory_get_extra_sdkinfo" 734SDK_POSTPROCESS_COMMAND[vardepvalueexclude] .= "| buildhistory_get_sdkinfo buildhistory_get_extra_sdkinfo" 735SDK_POSTPROCESS_COMMAND[vardepsexclude] += "buildhistory_get_sdkinfo buildhistory_get_extra_sdkinfo" 736 737python buildhistory_write_sigs() { 738 if not "task" in (d.getVar('BUILDHISTORY_FEATURES') or "").split(): 739 return 740 741 # Create sigs file 742 if hasattr(bb.parse.siggen, 'dump_siglist'): 743 taskoutdir = os.path.join(d.getVar('BUILDHISTORY_DIR'), 'task') 744 bb.utils.mkdirhier(taskoutdir) 745 bb.parse.siggen.dump_siglist(os.path.join(taskoutdir, 'tasksigs.txt'), d.getVar("BUILDHISTORY_PATH_PREFIX_STRIP")) 746} 747 748def buildhistory_get_build_id(d): 749 if d.getVar('BB_WORKERCONTEXT') != '1': 750 return "" 751 localdata = bb.data.createCopy(d) 752 statuslines = [] 753 for func in oe.data.typed_value('BUILDCFG_FUNCS', localdata): 754 g = globals() 755 if func not in g: 756 bb.warn("Build configuration function '%s' does not exist" % func) 757 else: 758 flines = g[func](localdata) 759 if flines: 760 statuslines.extend(flines) 761 762 statusheader = d.getVar('BUILDCFG_HEADER') 763 return('\n%s\n%s\n' % (statusheader, '\n'.join(statuslines))) 764 765def buildhistory_get_metadata_revs(d): 766 # We want an easily machine-readable format here 767 revisions = oe.buildcfg.get_layer_revisions(d) 768 medadata_revs = ["%-17s = %s:%s%s" % (r[1], r[2], r[3], r[4]) for r in revisions] 769 return '\n'.join(medadata_revs) 770 771def outputvars(vars, listvars, d): 772 vars = vars.split() 773 listvars = listvars.split() 774 ret = "" 775 for var in vars: 776 value = d.getVar(var) or "" 777 if var in listvars: 778 # Squash out spaces 779 value = oe.utils.squashspaces(value) 780 ret += "%s = %s\n" % (var, value) 781 return ret.rstrip('\n') 782 783def buildhistory_get_imagevars(d): 784 if d.getVar('BB_WORKERCONTEXT') != '1': 785 return "" 786 imagevars = "DISTRO DISTRO_VERSION USER_CLASSES IMAGE_CLASSES IMAGE_FEATURES IMAGE_LINGUAS IMAGE_INSTALL BAD_RECOMMENDATIONS NO_RECOMMENDATIONS PACKAGE_EXCLUDE ROOTFS_POSTPROCESS_COMMAND IMAGE_POSTPROCESS_COMMAND" 787 listvars = "USER_CLASSES IMAGE_CLASSES IMAGE_FEATURES IMAGE_LINGUAS IMAGE_INSTALL BAD_RECOMMENDATIONS PACKAGE_EXCLUDE" 788 return outputvars(imagevars, listvars, d) 789 790def buildhistory_get_sdkvars(d): 791 if d.getVar('BB_WORKERCONTEXT') != '1': 792 return "" 793 sdkvars = "DISTRO DISTRO_VERSION SDK_NAME SDK_VERSION SDKMACHINE SDKIMAGE_FEATURES TOOLCHAIN_HOST_TASK TOOLCHAIN_TARGET_TASK BAD_RECOMMENDATIONS NO_RECOMMENDATIONS PACKAGE_EXCLUDE" 794 if d.getVar('BB_CURRENTTASK') == 'populate_sdk_ext': 795 # Extensible SDK uses some additional variables 796 sdkvars += " ESDK_LOCALCONF_ALLOW ESDK_LOCALCONF_REMOVE ESDK_CLASS_INHERIT_DISABLE SDK_UPDATE_URL SDK_EXT_TYPE SDK_RECRDEP_TASKS SDK_INCLUDE_PKGDATA SDK_INCLUDE_TOOLCHAIN" 797 listvars = "SDKIMAGE_FEATURES BAD_RECOMMENDATIONS PACKAGE_EXCLUDE ESDK_LOCALCONF_ALLOW ESDK_LOCALCONF_REMOVE ESDK_CLASS_INHERIT_DISABLE" 798 return outputvars(sdkvars, listvars, d) 799 800 801def buildhistory_get_cmdline(d): 802 argv = d.getVar('BB_CMDLINE', False) 803 if argv: 804 if argv[0].endswith('bin/bitbake'): 805 bincmd = 'bitbake' 806 else: 807 bincmd = argv[0] 808 return '%s %s' % (bincmd, ' '.join(argv[1:])) 809 return '' 810 811 812buildhistory_single_commit() { 813 if [ "$3" = "" ] ; then 814 commitopts="${BUILDHISTORY_DIR}/ --allow-empty" 815 shortlogprefix="No changes: " 816 else 817 commitopts="" 818 shortlogprefix="" 819 fi 820 if [ "${BUILDHISTORY_BUILD_FAILURES}" = "0" ] ; then 821 result="succeeded" 822 else 823 result="failed" 824 fi 825 case ${BUILDHISTORY_BUILD_INTERRUPTED} in 826 1) 827 result="$result (interrupted)" 828 ;; 829 2) 830 result="$result (force interrupted)" 831 ;; 832 esac 833 commitmsgfile=`mktemp` 834 cat > $commitmsgfile << END 835${shortlogprefix}Build ${BUILDNAME} of ${DISTRO} ${DISTRO_VERSION} for machine ${MACHINE} on $2 836 837cmd: $1 838 839result: $result 840 841metadata revisions: 842END 843 cat ${BUILDHISTORY_DIR}/metadata-revs >> $commitmsgfile 844 git commit $commitopts -F $commitmsgfile --author "${BUILDHISTORY_COMMIT_AUTHOR}" > /dev/null 845 rm $commitmsgfile 846} 847 848buildhistory_commit() { 849 if [ ! -d ${BUILDHISTORY_DIR} ] ; then 850 # Code above that creates this dir never executed, so there can't be anything to commit 851 return 852 fi 853 854 # Create a machine-readable list of metadata revisions for each layer 855 cat > ${BUILDHISTORY_DIR}/metadata-revs <<END 856${@buildhistory_get_metadata_revs(d)} 857END 858 859 ( cd ${BUILDHISTORY_DIR}/ 860 # Initialise the repo if necessary 861 if [ ! -e .git ] ; then 862 git init -q 863 else 864 git tag -f ${BUILDHISTORY_TAG}-minus-3 ${BUILDHISTORY_TAG}-minus-2 > /dev/null 2>&1 || true 865 git tag -f ${BUILDHISTORY_TAG}-minus-2 ${BUILDHISTORY_TAG}-minus-1 > /dev/null 2>&1 || true 866 git tag -f ${BUILDHISTORY_TAG}-minus-1 > /dev/null 2>&1 || true 867 fi 868 869 check_git_config 870 871 # Check if there are new/changed files to commit (other than metadata-revs) 872 repostatus=`git status --porcelain | grep -v " metadata-revs$"` 873 HOSTNAME=`hostname 2>/dev/null || echo unknown` 874 CMDLINE="${@buildhistory_get_cmdline(d)}" 875 if [ "$repostatus" != "" ] ; then 876 git add -A . 877 # Porcelain output looks like "?? packages/foo/bar" 878 # Ensure we commit metadata-revs with the first commit 879 buildhistory_single_commit "$CMDLINE" "$HOSTNAME" dummy 880 else 881 buildhistory_single_commit "$CMDLINE" "$HOSTNAME" 882 fi 883 if [ "${BUILDHISTORY_PUSH_REPO}" != "" ] ; then 884 git push -q ${BUILDHISTORY_PUSH_REPO} 885 fi) || true 886} 887 888python buildhistory_eventhandler() { 889 if (e.data.getVar('BUILDHISTORY_FEATURES') or "").strip(): 890 reset = e.data.getVar("BUILDHISTORY_RESET") 891 olddir = e.data.getVar("BUILDHISTORY_OLD_DIR") 892 if isinstance(e, bb.event.BuildStarted): 893 if reset: 894 import shutil 895 # Clean up after potentially interrupted build. 896 if os.path.isdir(olddir): 897 shutil.rmtree(olddir) 898 rootdir = e.data.getVar("BUILDHISTORY_DIR") 899 bb.utils.mkdirhier(rootdir) 900 entries = [ x for x in os.listdir(rootdir) if not x.startswith('.') ] 901 bb.utils.mkdirhier(olddir) 902 for entry in entries: 903 bb.utils.rename(os.path.join(rootdir, entry), 904 os.path.join(olddir, entry)) 905 elif isinstance(e, bb.event.BuildCompleted): 906 if reset: 907 import shutil 908 shutil.rmtree(olddir) 909 if e.data.getVar("BUILDHISTORY_COMMIT") == "1": 910 bb.note("Writing buildhistory") 911 bb.build.exec_func("buildhistory_write_sigs", d) 912 import time 913 start=time.time() 914 localdata = bb.data.createCopy(e.data) 915 localdata.setVar('BUILDHISTORY_BUILD_FAILURES', str(e._failures)) 916 interrupted = getattr(e, '_interrupted', 0) 917 localdata.setVar('BUILDHISTORY_BUILD_INTERRUPTED', str(interrupted)) 918 bb.build.exec_func("buildhistory_commit", localdata) 919 stop=time.time() 920 bb.note("Writing buildhistory took: %s seconds" % round(stop-start)) 921 else: 922 bb.note("No commit since BUILDHISTORY_COMMIT != '1'") 923} 924 925addhandler buildhistory_eventhandler 926buildhistory_eventhandler[eventmask] = "bb.event.BuildCompleted bb.event.BuildStarted" 927 928 929# FIXME this ought to be moved into the fetcher 930def _get_srcrev_values(d): 931 """ 932 Return the version strings for the current recipe 933 """ 934 935 scms = [] 936 fetcher = bb.fetch.Fetch(d.getVar('SRC_URI').split(), d) 937 urldata = fetcher.ud 938 for u in urldata: 939 if urldata[u].method.supports_srcrev(): 940 scms.append(u) 941 942 dict_srcrevs = {} 943 dict_tag_srcrevs = {} 944 for scm in scms: 945 ud = urldata[scm] 946 for name in ud.names: 947 autoinc, rev = ud.method.sortable_revision(ud, d, name) 948 dict_srcrevs[name] = rev 949 if 'tag' in ud.parm: 950 tag = ud.parm['tag']; 951 key = name+'_'+tag 952 dict_tag_srcrevs[key] = rev 953 return (dict_srcrevs, dict_tag_srcrevs) 954 955do_fetch[postfuncs] += "write_srcrev" 956do_fetch[vardepsexclude] += "write_srcrev" 957python write_srcrev() { 958 write_latest_srcrev(d, d.getVar('BUILDHISTORY_DIR_PACKAGE')) 959} 960 961def write_latest_srcrev(d, pkghistdir): 962 srcrevfile = os.path.join(pkghistdir, 'latest_srcrev') 963 964 srcrevs, tag_srcrevs = _get_srcrev_values(d) 965 if srcrevs: 966 if not os.path.exists(pkghistdir): 967 bb.utils.mkdirhier(pkghistdir) 968 old_tag_srcrevs = {} 969 if os.path.exists(srcrevfile): 970 with open(srcrevfile) as f: 971 for line in f: 972 if line.startswith('# tag_'): 973 key, value = line.split("=", 1) 974 key = key.replace('# tag_', '').strip() 975 value = value.replace('"', '').strip() 976 old_tag_srcrevs[key] = value 977 with open(srcrevfile, 'w') as f: 978 for name, srcrev in sorted(srcrevs.items()): 979 suffix = "_" + name 980 if name == "default": 981 suffix = "" 982 orig_srcrev = d.getVar('SRCREV%s' % suffix, False) 983 if orig_srcrev: 984 f.write('# SRCREV%s = "%s"\n' % (suffix, orig_srcrev)) 985 f.write('SRCREV%s = "%s"\n' % (suffix, srcrev)) 986 for name, srcrev in sorted(tag_srcrevs.items()): 987 f.write('# tag_%s = "%s"\n' % (name, srcrev)) 988 if name in old_tag_srcrevs and old_tag_srcrevs[name] != srcrev: 989 pkg = d.getVar('PN') 990 bb.warn("Revision for tag %s in package %s was changed since last build (from %s to %s)" % (name, pkg, old_tag_srcrevs[name], srcrev)) 991 992 else: 993 if os.path.exists(srcrevfile): 994 os.remove(srcrevfile) 995 996do_testimage[postfuncs] += "write_ptest_result" 997do_testimage[vardepsexclude] += "write_ptest_result" 998 999python write_ptest_result() { 1000 write_latest_ptest_result(d, d.getVar('BUILDHISTORY_DIR')) 1001} 1002 1003def write_latest_ptest_result(d, histdir): 1004 import glob 1005 import subprocess 1006 test_log_dir = d.getVar('TEST_LOG_DIR') 1007 input_ptest = os.path.join(test_log_dir, 'ptest_log') 1008 output_ptest = os.path.join(histdir, 'ptest') 1009 if os.path.exists(input_ptest): 1010 try: 1011 # Lock it to avoid race issue 1012 lock = bb.utils.lockfile(output_ptest + "/ptest.lock") 1013 bb.utils.mkdirhier(output_ptest) 1014 oe.path.copytree(input_ptest, output_ptest) 1015 # Sort test result 1016 for result in glob.glob('%s/pass.fail.*' % output_ptest): 1017 bb.debug(1, 'Processing %s' % result) 1018 cmd = ['sort', result, '-o', result] 1019 bb.debug(1, 'Running %s' % cmd) 1020 ret = subprocess.call(cmd) 1021 if ret != 0: 1022 bb.error('Failed to run %s!' % cmd) 1023 finally: 1024 bb.utils.unlockfile(lock) 1025