diff options
Diffstat (limited to 'poky/meta/classes/buildhistory.bbclass')
-rw-r--r-- | poky/meta/classes/buildhistory.bbclass | 85 |
1 files changed, 52 insertions, 33 deletions
diff --git a/poky/meta/classes/buildhistory.bbclass b/poky/meta/classes/buildhistory.bbclass index fd53e92402..ce3abaa69d 100644 --- a/poky/meta/classes/buildhistory.bbclass +++ b/poky/meta/classes/buildhistory.bbclass @@ -47,18 +47,25 @@ BUILDHISTORY_PUSH_REPO ?= "" BUILDHISTORY_TAG ?= "build" BUILDHISTORY_PATH_PREFIX_STRIP ?= "" -SSTATEPOSTINSTFUNCS:append = " buildhistory_emit_pkghistory" -# We want to avoid influencing the signatures of sstate tasks - first the function itself: -sstate_install[vardepsexclude] += "buildhistory_emit_pkghistory" -# then the value added to SSTATEPOSTINSTFUNCS: -SSTATEPOSTINSTFUNCS[vardepvalueexclude] .= "| buildhistory_emit_pkghistory" +# We want to avoid influencing the signatures of the task so use vardepsexclude +do_populate_sysroot[postfuncs] += "buildhistory_emit_sysroot" +do_populate_sysroot_setscene[postfuncs] += "buildhistory_emit_sysroot" +do_populate_sysroot[vardepsexclude] += "buildhistory_emit_sysroot" + +do_package[postfuncs] += "buildhistory_list_pkg_files" +do_package_setscene[postfuncs] += "buildhistory_list_pkg_files" +do_package[vardepsexclude] += "buildhistory_list_pkg_files" + +do_packagedata[postfuncs] += "buildhistory_emit_pkghistory" +do_packagedata_setscene[postfuncs] += "buildhistory_emit_pkghistory" +do_packagedata[vardepsexclude] += "buildhistory_emit_pkghistory" # Similarly for our function that gets the output signatures SSTATEPOSTUNPACKFUNCS:append = " buildhistory_emit_outputsigs" sstate_installpkgdir[vardepsexclude] += "buildhistory_emit_outputsigs" SSTATEPOSTUNPACKFUNCS[vardepvalueexclude] .= "| buildhistory_emit_outputsigs" -# All items excepts those listed here will be removed from a recipe's +# All items except those listed here will be removed from a recipe's # build history directory by buildhistory_emit_pkghistory(). This is # necessary because some of these items (package directories, files that # we no longer emit) might be obsolete. @@ -91,25 +98,14 @@ buildhistory_emit_sysroot() { # Write out metadata about this package for comparison when writing future packages # python buildhistory_emit_pkghistory() { - if d.getVar('BB_CURRENTTASK') in ['populate_sysroot', 'populate_sysroot_setscene']: - bb.build.exec_func("buildhistory_emit_sysroot", d) - return 0 - - if not "package" in (d.getVar('BUILDHISTORY_FEATURES') or "").split(): - return 0 - - if d.getVar('BB_CURRENTTASK') in ['package', 'package_setscene']: - # Create files-in-<package-name>.txt files containing a list of files of each recipe's package - bb.build.exec_func("buildhistory_list_pkg_files", d) - return 0 - - if not d.getVar('BB_CURRENTTASK') in ['packagedata', 'packagedata_setscene']: - return 0 - import re import json import shlex import errno + import shutil + + if not "package" in (d.getVar('BUILDHISTORY_FEATURES') or "").split(): + return 0 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE') oldpkghistdir = d.getVar('BUILDHISTORY_OLD_DIR_PACKAGE') @@ -153,7 +149,7 @@ python buildhistory_emit_pkghistory() { # Variables that need to be written to their own separate file self.filevars = dict.fromkeys(['pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm']) - # Should check PACKAGES here to see if anything removed + # Should check PACKAGES here to see if anything was removed def readPackageInfo(pkg, histfile): pkginfo = PackageInfo(pkg) @@ -223,6 +219,20 @@ python buildhistory_emit_pkghistory() { items.sort() return ' '.join(items) + def preservebuildhistoryfiles(pkg, preserve): + if os.path.exists(os.path.join(oldpkghistdir, pkg)): + listofobjs = os.listdir(os.path.join(oldpkghistdir, pkg)) + for obj in listofobjs: + if obj not in preserve: + continue + try: + bb.utils.mkdirhier(os.path.join(pkghistdir, pkg)) + shutil.copyfile(os.path.join(oldpkghistdir, pkg, obj), os.path.join(pkghistdir, pkg, obj)) + except IOError as e: + bb.note("Unable to copy file. %s" % e) + except EnvironmentError as e: + bb.note("Unable to copy file. %s" % e) + pn = d.getVar('PN') pe = d.getVar('PE') or "0" pv = d.getVar('PV') @@ -250,6 +260,14 @@ python buildhistory_emit_pkghistory() { if not os.path.exists(pkghistdir): bb.utils.mkdirhier(pkghistdir) else: + # We need to make sure that all files kept in + # buildhistory/old are restored successfully + # otherwise next block of code wont have files to + # check and purge + if d.getVar("BUILDHISTORY_RESET"): + for pkg in packagelist: + preservebuildhistoryfiles(pkg, preserve) + # Remove files for packages that no longer exist for item in os.listdir(pkghistdir): if item not in preserve: @@ -535,7 +553,7 @@ buildhistory_get_installed() { grep -v kernel-module $1/depends-nokernel-nolibc-noupdate.dot > $1/depends-nokernel-nolibc-noupdate-nomodules.dot fi - # add complementary package information + # Add complementary package information if [ -e ${WORKDIR}/complementary_pkgs.txt ]; then cp ${WORKDIR}/complementary_pkgs.txt $1 fi @@ -573,7 +591,7 @@ buildhistory_get_sdk_installed_target() { buildhistory_list_files() { # List the files in the specified directory, but exclude date/time etc. - # This is somewhat messy, but handles where the size is not printed for device files under pseudo + # This is somewhat messy, but handles cases where the size is not printed for device files under pseudo ( cd $1 find_cmd='find . ! -path . -printf "%M %-10u %-10g %10s %p -> %l\n"' if [ "$3" = "fakeroot" ] ; then @@ -587,7 +605,7 @@ buildhistory_list_files_no_owners() { # List the files in the specified directory, but exclude date/time etc. # Also don't output the ownership data, but instead output just - - so # that the same parsing code as for _list_files works. - # This is somewhat messy, but handles where the size is not printed for device files under pseudo + # This is somewhat messy, but handles cases where the size is not printed for device files under pseudo ( cd $1 find_cmd='find . ! -path . -printf "%M - - %10s %p -> %l\n"' if [ "$3" = "fakeroot" ] ; then @@ -598,16 +616,17 @@ buildhistory_list_files_no_owners() { } buildhistory_list_pkg_files() { + if [ "${@bb.utils.contains('BUILDHISTORY_FEATURES', 'package', '1', '0', d)}" = "0" ] ; then + return + fi + # Create individual files-in-package for each recipe's package - for pkgdir in $(find ${PKGDEST}/* -maxdepth 0 -type d); do + pkgdirlist=$(find ${PKGDEST}/* -maxdepth 0 -type d) + for pkgdir in $pkgdirlist; do pkgname=$(basename $pkgdir) outfolder="${BUILDHISTORY_DIR_PACKAGE}/$pkgname" outfile="$outfolder/files-in-package.txt" - # Make sure the output folder exists so we can create the file - if [ ! -d $outfolder ] ; then - bbdebug 2 "Folder $outfolder does not exist, file $outfile not created" - continue - fi + mkdir -p $outfolder buildhistory_list_files $pkgdir $outfile fakeroot done } @@ -855,7 +874,7 @@ END CMDLINE="${@buildhistory_get_cmdline(d)}" if [ "$repostatus" != "" ] ; then git add -A . - # porcelain output looks like "?? packages/foo/bar" + # Porcelain output looks like "?? packages/foo/bar" # Ensure we commit metadata-revs with the first commit buildhistory_single_commit "$CMDLINE" "$HOSTNAME" dummy git gc --auto --quiet @@ -990,7 +1009,7 @@ def write_latest_ptest_result(d, histdir): output_ptest = os.path.join(histdir, 'ptest') if os.path.exists(input_ptest): try: - # Lock it avoid race issue + # Lock it to avoid race issue lock = bb.utils.lockfile(output_ptest + "/ptest.lock") bb.utils.mkdirhier(output_ptest) oe.path.copytree(input_ptest, output_ptest) |