diff options
Diffstat (limited to 'poky/scripts')
46 files changed, 489 insertions, 646 deletions
diff --git a/poky/scripts/autobuilder-worker-prereq-tests b/poky/scripts/autobuilder-worker-prereq-tests new file mode 100755 index 000000000..bb46c6913 --- /dev/null +++ b/poky/scripts/autobuilder-worker-prereq-tests @@ -0,0 +1,65 @@ +#!/bin/bash +# +# Script which can be run on new autobuilder workers to check all needed configuration is present. +# Designed to be run in a repo where bitbake/oe-core are already present. +# + +# +# Todo +# Add testtools/subunit import test +# Add python3-git test +# Add pigz test +# vnc tests/checkvnc? +# test sendmail works (for QA email notification) +# test error report submission works +# test buildistory git repo works? +# + +. ./oe-init-build-env > /dev/null +if [ "$?" != "0" ]; then + exit 1 +fi +git config --global user.name > /dev/null +if [ "$?" != "0" ]; then + echo "Please set git config --global user.name" + exit 1 +fi +git config --global user.email > /dev/null +if [ "$?" != "0" ]; then + echo "Please set git config --global user.email" + exit 1 +fi +bitbake -p +if [ "$?" != "0" ]; then + echo "Bitbake parsing failed" + exit 1 +fi + +WATCHES=$(PATH="/sbin:/usr/sbin:$PATH" sysctl fs.inotify.max_user_watches -n) +if (( $WATCHES < 65000 )); then + echo 'Need to increase watches (echo fs.inotify.max_user_watches=65536 | sudo tee -a /etc/sysctl.conf' + exit 1 +fi +mkdir -p tmp/deploy/images/qemux86-64 +pushd tmp/deploy/images/qemux86-64 +if [ ! -e core-image-minimal-qemux86-64.ext4 ]; then + wget http://downloads.yoctoproject.org/releases/yocto/yocto-2.5.1/machines/qemu/qemux86-64/core-image-minimal-qemux86-64.ext4 +fi +if [ ! -e core-image-minimal-qemux86-64.qemuboot.conf ]; then + wget http://downloads.yoctoproject.org/releases/yocto/yocto-2.5.1/machines/qemu/qemux86-64/core-image-minimal-qemux86-64.qemuboot.conf +fi +if [ ! -e bzImage-qemux86-64.bin ]; then + wget http://downloads.yoctoproject.org/releases/yocto/yocto-2.5.1/machines/qemu/qemux86-64/bzImage-qemux86-64.bin +fi +popd +bitbake qemu-helper-native +runqemu qemux86-64 +if [ "$?" != "0" ]; then + echo "Unable to use runqemu" + exit 1 +fi +runqemu qemux86-64 kvm +if [ "$?" != "0" ]; then + echo "Unable to use runqemu with kvm" + exit 1 +fi diff --git a/poky/scripts/combo-layer b/poky/scripts/combo-layer index d04d88b07..dc40e7240 100755 --- a/poky/scripts/combo-layer +++ b/poky/scripts/combo-layer @@ -246,7 +246,7 @@ def action_init(conf, args): # traditional behavior from "git archive" (preserved # here) it to choose the first one. This might not be # intended, so at least warn about it. - logger.warn("%s: initial revision '%s' not unique, picking result of rev-parse = %s" % + logger.warning("%s: initial revision '%s' not unique, picking result of rev-parse = %s" % (name, initialrev, refs[0])) initialrev = rev except: diff --git a/poky/scripts/contrib/mkefidisk.sh b/poky/scripts/contrib/mkefidisk.sh deleted file mode 100755 index 39e4bcf08..000000000 --- a/poky/scripts/contrib/mkefidisk.sh +++ /dev/null @@ -1,472 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2012, Intel Corporation. -# All rights reserved. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -# the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - -LANG=C - -echo -echo "WARNING: This script is deprecated and will be removed soon." -echo "Please consider using wic EFI images instead." -echo - -# Set to 1 to enable additional output -DEBUG=0 -OUT="/dev/null" - -# -# Defaults -# -# 20 Mb for the boot partition -BOOT_SIZE=20 -# 5% for swap -SWAP_RATIO=5 - -# Cleanup after die() -cleanup() { - debug "Syncing and unmounting devices" - # Unmount anything we mounted - unmount $ROOTFS_MNT || error "Failed to unmount $ROOTFS_MNT" - unmount $BOOTFS_MNT || error "Failed to unmount $BOOTFS_MNT" - unmount $HDDIMG_ROOTFS_MNT || error "Failed to unmount $HDDIMG_ROOTFS_MNT" - unmount $HDDIMG_MNT || error "Failed to unmount $HDDIMG_MNT" - - # Remove the TMPDIR - debug "Removing temporary files" - if [ -d "$TMPDIR" ]; then - rm -rf $TMPDIR || error "Failed to remove $TMPDIR" - fi -} - -trap 'die "Signal Received, Aborting..."' HUP INT TERM - -# Logging routines -WARNINGS=0 -ERRORS=0 -CLEAR="$(tput sgr0)" -INFO="$(tput bold)" -RED="$(tput setaf 1)$(tput bold)" -GREEN="$(tput setaf 2)$(tput bold)" -YELLOW="$(tput setaf 3)$(tput bold)" -info() { - echo "${INFO}$1${CLEAR}" -} -error() { - ERRORS=$((ERRORS+1)) - echo "${RED}$1${CLEAR}" -} -warn() { - WARNINGS=$((WARNINGS+1)) - echo "${YELLOW}$1${CLEAR}" -} -success() { - echo "${GREEN}$1${CLEAR}" -} -die() { - error "$1" - cleanup - exit 1 -} -debug() { - if [ $DEBUG -eq 1 ]; then - echo "$1" - fi -} - -usage() { - echo "Usage: $(basename $0) [-v] DEVICE HDDIMG TARGET_DEVICE" - echo " -v: Verbose debug" - echo " DEVICE: The device to write the image to, e.g. /dev/sdh" - echo " HDDIMG: The hddimg file to generate the efi disk from" - echo " TARGET_DEVICE: The device the target will boot from, e.g. /dev/mmcblk0" -} - -image_details() { - IMG=$1 - info "Image details" - echo " image: $(stat --printf '%N\n' $IMG)" - echo " size: $(stat -L --printf '%s bytes\n' $IMG)" - echo " modified: $(stat -L --printf '%y\n' $IMG)" - echo " type: $(file -L -b $IMG)" - echo "" -} - -device_details() { - DEV=$1 - BLOCK_SIZE=512 - - info "Device details" - echo " device: $DEVICE" - if [ -f "/sys/class/block/$DEV/device/vendor" ]; then - echo " vendor: $(cat /sys/class/block/$DEV/device/vendor)" - else - echo " vendor: UNKOWN" - fi - if [ -f "/sys/class/block/$DEV/device/model" ]; then - echo " model: $(cat /sys/class/block/$DEV/device/model)" - else - echo " model: UNKNOWN" - fi - if [ -f "/sys/class/block/$DEV/size" ]; then - echo " size: $(($(cat /sys/class/block/$DEV/size) * $BLOCK_SIZE)) bytes" - else - echo " size: UNKNOWN" - fi - echo "" -} - -unmount_device() { - grep -q $DEVICE /proc/mounts - if [ $? -eq 0 ]; then - warn "$DEVICE listed in /proc/mounts, attempting to unmount" - umount $DEVICE* 2>/dev/null - return $? - fi - return 0 -} - -unmount() { - if [ "$1" = "" ] ; then - return 0 - fi - grep -q $1 /proc/mounts - if [ $? -eq 0 ]; then - debug "Unmounting $1" - umount $1 - return $? - fi - return 0 -} - -# -# Parse and validate arguments -# -if [ $# -lt 3 ] || [ $# -gt 4 ]; then - if [ $# -eq 1 ]; then - AVAILABLE_DISK=`lsblk | grep "disk" | cut -f 1 -d " "` - X=0 - for disk in `echo $AVAILABLE_DISK`; do - mounted=`lsblk /dev/$disk | awk {'print $7'} | sed "s/MOUNTPOINT//"` - if [ -z "$mounted" ]; then - UNMOUNTED_AVAILABLES="$UNMOUNTED_AVAILABLES /dev/$disk" - info "$X - /dev/$disk" - X=`expr $X + 1` - fi - done - if [ $X -eq 0 ]; then - die "No unmounted device found." - fi - read -p "Choose unmounted device number: " DISK_NUMBER - X=0 - for line in `echo $UNMOUNTED_AVAILABLES`; do - if [ $DISK_NUMBER -eq $X ]; then - DISK_TO_BE_FLASHED=$line - break - else - X=`expr $X + 1` - fi - done - if [ -z "$DISK_TO_BE_FLASHED" ]; then - die "Option \"$DISK_NUMBER\" is invalid. Choose a valid option" - else - if [ -z `echo $DISK_TO_BE_FLASHED | grep "mmc"` ]; then - TARGET_TO_BE_BOOT="/dev/sda" - else - TARGET_TO_BE_BOOT="/dev/mmcblk0" - fi - fi - echo "" - echo "Choose a name of the device that will be boot from" - echo -n "Recommended name is: " - info "$TARGET_TO_BE_BOOT" - read -p "Is target device okay? [y/N]: " RESPONSE - if [ "$RESPONSE" != "y" ]; then - read -p "Choose target device name: " TARGET_TO_BE_BOOT - fi - echo "" - if [ -z "$TARGET_TO_BE_BOOT" ]; then - die "Error: choose a valid target name" - fi - else - usage - exit 1 - fi -fi - -if [ "$1" = "-v" ]; then - DEBUG=1 - OUT="1" - shift -fi - -if [ -z "$AVAILABLE_DISK" ]; then - DEVICE=$1 - HDDIMG=$2 - TARGET_DEVICE=$3 -else - DEVICE=$DISK_TO_BE_FLASHED - HDDIMG=$1 - TARGET_DEVICE=$TARGET_TO_BE_BOOT -fi - -LINK=$(readlink $DEVICE) -if [ $? -eq 0 ]; then - DEVICE="$LINK" -fi - -if [ ! -w "$DEVICE" ]; then - usage - if [ ! -e "${DEVICE}" ] ; then - die "Device $DEVICE cannot be found" - else - die "Device $DEVICE is not writable (need to run under sudo?)" - fi -fi - -if [ ! -e "$HDDIMG" ]; then - usage - die "HDDIMG $HDDIMG does not exist" -fi - -# -# Ensure the hddimg is not mounted -# -unmount "$HDDIMG" || die "Failed to unmount $HDDIMG" - -# -# Check if any $DEVICE partitions are mounted -# -unmount_device || die "Failed to unmount $DEVICE" - -# -# Confirm device with user -# -image_details $HDDIMG -device_details $(basename $DEVICE) -echo -n "${INFO}Prepare EFI image on $DEVICE [y/N]?${CLEAR} " -read RESPONSE -if [ "$RESPONSE" != "y" ]; then - echo "Image creation aborted" - exit 0 -fi - - -# -# Prepare the temporary working space -# -TMPDIR=$(mktemp -d mkefidisk-XXX) || die "Failed to create temporary mounting directory." -HDDIMG_MNT=$TMPDIR/hddimg -HDDIMG_ROOTFS_MNT=$TMPDIR/hddimg_rootfs -ROOTFS_MNT=$TMPDIR/rootfs -BOOTFS_MNT=$TMPDIR/bootfs -mkdir $HDDIMG_MNT || die "Failed to create $HDDIMG_MNT" -mkdir $HDDIMG_ROOTFS_MNT || die "Failed to create $HDDIMG_ROOTFS_MNT" -mkdir $ROOTFS_MNT || die "Failed to create $ROOTFS_MNT" -mkdir $BOOTFS_MNT || die "Failed to create $BOOTFS_MNT" - - -# -# Partition $DEVICE -# -DEVICE_SIZE=$(parted -s $DEVICE unit mb print | grep ^Disk | cut -d" " -f 3 | sed -e "s/MB//") -# If the device size is not reported there may not be a valid label -if [ "$DEVICE_SIZE" = "" ] ; then - parted -s $DEVICE mklabel msdos || die "Failed to create MSDOS partition table" - DEVICE_SIZE=$(parted -s $DEVICE unit mb print | grep ^Disk | cut -d" " -f 3 | sed -e "s/MB//") -fi -SWAP_SIZE=$((DEVICE_SIZE*SWAP_RATIO/100)) -ROOTFS_SIZE=$((DEVICE_SIZE-BOOT_SIZE-SWAP_SIZE)) -ROOTFS_START=$((BOOT_SIZE)) -ROOTFS_END=$((ROOTFS_START+ROOTFS_SIZE)) -SWAP_START=$((ROOTFS_END)) - -# MMC devices use a partition prefix character 'p' -PART_PREFIX="" -if [ ! "${DEVICE#/dev/mmcblk}" = "${DEVICE}" ] || [ ! "${DEVICE#/dev/loop}" = "${DEVICE}" ]; then - PART_PREFIX="p" -fi -BOOTFS=$DEVICE${PART_PREFIX}1 -ROOTFS=$DEVICE${PART_PREFIX}2 -SWAP=$DEVICE${PART_PREFIX}3 - -TARGET_PART_PREFIX="" -if [ ! "${TARGET_DEVICE#/dev/mmcblk}" = "${TARGET_DEVICE}" ]; then - TARGET_PART_PREFIX="p" -fi -TARGET_ROOTFS=$TARGET_DEVICE${TARGET_PART_PREFIX}2 -TARGET_SWAP=$TARGET_DEVICE${TARGET_PART_PREFIX}3 - -echo "" -info "Boot partition size: $BOOT_SIZE MB ($BOOTFS)" -info "ROOTFS partition size: $ROOTFS_SIZE MB ($ROOTFS)" -info "Swap partition size: $SWAP_SIZE MB ($SWAP)" -echo "" - -# Use MSDOS by default as GPT cannot be reliably distributed in disk image form -# as it requires the backup table to be on the last block of the device, which -# of course varies from device to device. - -info "Partitioning installation media ($DEVICE)" - -debug "Deleting partition table on $DEVICE" -dd if=/dev/zero of=$DEVICE bs=512 count=2 >$OUT 2>&1 || die "Failed to zero beginning of $DEVICE" - -debug "Creating new partition table (MSDOS) on $DEVICE" -parted -s $DEVICE mklabel msdos >$OUT 2>&1 || die "Failed to create MSDOS partition table" - -debug "Creating boot partition on $BOOTFS" -parted -s $DEVICE mkpart primary 0% $BOOT_SIZE >$OUT 2>&1 || die "Failed to create BOOT partition" - -debug "Enabling boot flag on $BOOTFS" -parted -s $DEVICE set 1 boot on >$OUT 2>&1 || die "Failed to enable boot flag" - -debug "Creating ROOTFS partition on $ROOTFS" -parted -s $DEVICE mkpart primary $ROOTFS_START $ROOTFS_END >$OUT 2>&1 || die "Failed to create ROOTFS partition" - -debug "Creating swap partition on $SWAP" -parted -s $DEVICE mkpart primary $SWAP_START 100% >$OUT 2>&1 || die "Failed to create SWAP partition" - -if [ $DEBUG -eq 1 ]; then - parted -s $DEVICE print -fi - - -# -# Check if any $DEVICE partitions are mounted after partitioning -# -unmount_device || die "Failed to unmount $DEVICE partitions" - - -# -# Format $DEVICE partitions -# -info "Formatting partitions" -debug "Formatting $BOOTFS as vfat" -if [ ! "${DEVICE#/dev/loop}" = "${DEVICE}" ]; then - mkfs.vfat -I $BOOTFS -n "EFI" >$OUT 2>&1 || die "Failed to format $BOOTFS" -else - mkfs.vfat $BOOTFS -n "EFI" >$OUT 2>&1 || die "Failed to format $BOOTFS" -fi - -debug "Formatting $ROOTFS as ext3" -mkfs.ext3 -F $ROOTFS -L "ROOT" >$OUT 2>&1 || die "Failed to format $ROOTFS" - -debug "Formatting swap partition ($SWAP)" -mkswap $SWAP >$OUT 2>&1 || die "Failed to prepare swap" - - -# -# Installing to $DEVICE -# -debug "Mounting images and device in preparation for installation" -mount -o ro,loop $HDDIMG $HDDIMG_MNT >$OUT 2>&1 || error "Failed to mount $HDDIMG" -mount -o ro,loop $HDDIMG_MNT/rootfs.img $HDDIMG_ROOTFS_MNT >$OUT 2>&1 || error "Failed to mount rootfs.img" -mount $ROOTFS $ROOTFS_MNT >$OUT 2>&1 || error "Failed to mount $ROOTFS on $ROOTFS_MNT" -mount $BOOTFS $BOOTFS_MNT >$OUT 2>&1 || error "Failed to mount $BOOTFS on $BOOTFS_MNT" - -info "Preparing boot partition" -EFIDIR="$BOOTFS_MNT/EFI/BOOT" -# Get kernel image name -if [ -e "$HDDIMG_MNT/vmlinuz" ]; then - kernel_image="vmlinuz" -elif [ "$HDDIMG_MNT/bzImage" ]; then - kernel_image="bzImage" -else - die "No kernel image found" -fi -cp $HDDIMG_MNT/${kernel_image} $BOOTFS_MNT >$OUT 2>&1 || error "Failed to copy ${kernel_image}" -# Copy the efi loader and configs (booti*.efi and grub.cfg if it exists) -cp -r $HDDIMG_MNT/EFI $BOOTFS_MNT >$OUT 2>&1 || error "Failed to copy EFI dir" -# Silently ignore a missing systemd-boot loader dir (we might just be a GRUB image) -cp -r $HDDIMG_MNT/loader $BOOTFS_MNT >$OUT 2>&1 - -# Update the boot loaders configurations for an installed image -# Remove any existing root= kernel parameters and: -# o Add a root= parameter with the target rootfs -# o Specify ro so fsck can be run during boot -# o Specify rootwait in case the target media is an asyncronous block device -# such as MMC or USB disks -# o Specify "quiet" to minimize boot time when using slow serial consoles - -# Look for a GRUB installation -GRUB_CFG="$EFIDIR/grub.cfg" -if [ -e "$GRUB_CFG" ]; then - info "Configuring GRUB" - # Delete the install entry - sed -i "/menuentry 'install'/,/^}/d" $GRUB_CFG - # Delete the initrd lines - sed -i "/initrd /d" $GRUB_CFG - # Delete any LABEL= strings - sed -i "s/ LABEL=[^ ]*/ /" $GRUB_CFG - - sed -i "s@ root=[^ ]*@ @" $GRUB_CFG - sed -i "s@${kernel_image} @${kernel_image} root=$TARGET_ROOTFS ro rootwait console=ttyS0 console=tty0 @" $GRUB_CFG -fi - -# Look for a systemd-boot installation -SYSTEMD_BOOT_ENTRIES="$BOOTFS_MNT/loader/entries" -SYSTEMD_BOOT_CFG="$SYSTEMD_BOOT_ENTRIES/boot.conf" -if [ -d "$SYSTEMD_BOOT_ENTRIES" ]; then - info "Configuring SystemD-boot" - # remove the install target if it exists - rm $SYSTEMD_BOOT_ENTRIES/install.conf >$OUT 2>&1 - - if [ ! -e "$SYSTEMD_BOOT_CFG" ]; then - echo "ERROR: $SYSTEMD_BOOT_CFG not found" - fi - - sed -i "/initrd /d" $SYSTEMD_BOOT_CFG - sed -i "s@ root=[^ ]*@ @" $SYSTEMD_BOOT_CFG - sed -i "s@options *LABEL=boot @options LABEL=Boot root=$TARGET_ROOTFS ro rootwait console=ttyS0 console=tty0 @" $SYSTEMD_BOOT_CFG -fi - -# Ensure we have at least one EFI bootloader configured -if [ ! -e $GRUB_CFG ] && [ ! -e $SYSTEMD_BOOT_CFG ]; then - die "No EFI bootloader configuration found" -fi - - -info "Copying ROOTFS files (this may take a while)" -cp -a $HDDIMG_ROOTFS_MNT/* $ROOTFS_MNT >$OUT 2>&1 || die "Root FS copy failed" - -echo "$TARGET_SWAP swap swap defaults 0 0" >> $ROOTFS_MNT/etc/fstab - -# We dont want udev to mount our root device while we're booting... -if [ -d $ROOTFS_MNT/etc/udev/ ] ; then - echo "$TARGET_DEVICE" >> $ROOTFS_MNT/etc/udev/mount.blacklist -fi - -# Add startup.nsh script for automated boot -printf "fs0:\%s\BOOT\%s\n" "EFI" "bootx64.efi" > $BOOTFS_MNT/startup.nsh - - -# Call cleanup to unmount devices and images and remove the TMPDIR -cleanup - -echo "" -if [ $WARNINGS -ne 0 ] && [ $ERRORS -eq 0 ]; then - echo "${YELLOW}Installation completed with warnings${CLEAR}" - echo "${YELLOW}Warnings: $WARNINGS${CLEAR}" -elif [ $ERRORS -ne 0 ]; then - echo "${RED}Installation encountered errors${CLEAR}" - echo "${RED}Errors: $ERRORS${CLEAR}" - echo "${YELLOW}Warnings: $WARNINGS${CLEAR}" -else - success "Installation completed successfully" -fi -echo "" diff --git a/poky/scripts/contrib/patchreview.py b/poky/scripts/contrib/patchreview.py index 4e3e73c7a..a4d5ba686 100755 --- a/poky/scripts/contrib/patchreview.py +++ b/poky/scripts/contrib/patchreview.py @@ -132,8 +132,8 @@ def analyse(results, want_blame=False, verbose=True): need_blame = True if verbose: print("Missing Signed-off-by tag (%s)" % patch) - # TODO: disable this for now as too much fails - if False and r.malformed_sob: + + if r.malformed_sob: need_blame = True if verbose: print("Malformed Signed-off-by '%s' (%s)" % (r.malformed_sob, patch)) @@ -203,7 +203,7 @@ if __name__ == "__main__": if args.directory: os.chdir(args.directory) - patches = subprocess.check_output(("git", "ls-files", "*.patch", "*.diff")).decode("utf-8").split() + patches = subprocess.check_output(("git", "ls-files", "recipes-*/**/*.patch", "recipes-*/**/*.diff")).decode("utf-8").split() results = patchreview(patches) analyse(results, want_blame=args.blame, verbose=args.verbose) if args.histogram: diff --git a/poky/scripts/contrib/verify-homepage.py b/poky/scripts/contrib/verify-homepage.py index 76f1749cf..cc6e797d8 100755 --- a/poky/scripts/contrib/verify-homepage.py +++ b/poky/scripts/contrib/verify-homepage.py @@ -27,7 +27,7 @@ logger = scriptutils.logger_create('verify_homepage') def wgetHomepage(pn, homepage): result = subprocess.call('wget ' + '-q -T 5 -t 1 --spider ' + homepage, shell = True) if result: - logger.warn("%s: failed to verify HOMEPAGE: %s " % (pn, homepage)) + logger.warning("%s: failed to verify HOMEPAGE: %s " % (pn, homepage)) return 1 else: return 0 diff --git a/poky/scripts/devtool b/poky/scripts/devtool index d681a1929..0e578c0de 100755 --- a/poky/scripts/devtool +++ b/poky/scripts/devtool @@ -51,7 +51,7 @@ class ConfigHandler(object): def __init__(self, filename): self.config_file = filename - self.config_obj = configparser.SafeConfigParser() + self.config_obj = configparser.ConfigParser() def get(self, section, option, default=None): try: diff --git a/poky/scripts/lib/build_perf/html/report.html b/poky/scripts/lib/build_perf/html/report.html index 291ad9d72..d1ba6f257 100644 --- a/poky/scripts/lib/build_perf/html/report.html +++ b/poky/scripts/lib/build_perf/html/report.html @@ -136,10 +136,13 @@ h3 { {% else %} {% set result_style = "color: orange" %} {%endif %} + {% if measurement.reldiff|abs > 2 %} + {% set result_style = result_style + "; font-weight: bold" %} + {% endif %} <td>{{ measurement.description }}</td> <td style="font-weight: bold">{{ measurement.value.mean }}</td> <td style="{{ result_style }}">{{ measurement.absdiff_str }}</td> - <td style="{{ result_style }}">{{ measurement.reldiff }}</td> + <td style="{{ result_style }}">{{ measurement.reldiff_str }}</td> </tr> {% endfor %} {% else %} @@ -167,7 +170,7 @@ h3 { {% else %} <span style="color: orange"> {% endif %} - {{ measurement.absdiff_str }} ({{measurement.reldiff}}) + {{ measurement.absdiff_str }} ({{measurement.reldiff_str}}) </span></span> </div> {# Table for trendchart and the statistics #} diff --git a/poky/scripts/lib/devtool/build.py b/poky/scripts/lib/devtool/build.py index 252379e9b..ba9593f1a 100644 --- a/poky/scripts/lib/devtool/build.py +++ b/poky/scripts/lib/devtool/build.py @@ -54,7 +54,11 @@ def build(args, config, basepath, workspace): """Entry point for the devtool 'build' subcommand""" workspacepn = check_workspace_recipe(workspace, args.recipename, bbclassextend=True) - build_tasks = _get_build_tasks(config) + if args.clean: + # use clean instead of cleansstate to avoid messing things up in eSDK + build_tasks = ['do_clean'] + else: + build_tasks = _get_build_tasks(config) bbappend = workspace[workspacepn]['bbappend'] if args.disable_parallel_make: @@ -83,4 +87,5 @@ def register_commands(subparsers, context): group='working', order=50) parser_build.add_argument('recipename', help='Recipe to build') parser_build.add_argument('-s', '--disable-parallel-make', action="store_true", help='Disable make parallelism') + parser_build.add_argument('-c', '--clean', action='store_true', help='clean up recipe building results') parser_build.set_defaults(func=build) diff --git a/poky/scripts/lib/devtool/export.py b/poky/scripts/lib/devtool/export.py index 13ee258e7..35349e2cd 100644 --- a/poky/scripts/lib/devtool/export.py +++ b/poky/scripts/lib/devtool/export.py @@ -84,7 +84,7 @@ def export(args, config, basepath, workspace): # if all workspace is excluded, quit if not len(set(workspace.keys()).difference(set(args.exclude))): - logger.warn('All recipes in workspace excluded, nothing to export') + logger.warning('All recipes in workspace excluded, nothing to export') return 0 exported = [] diff --git a/poky/scripts/lib/devtool/import.py b/poky/scripts/lib/devtool/import.py index c13a180d1..4264b7d82 100644 --- a/poky/scripts/lib/devtool/import.py +++ b/poky/scripts/lib/devtool/import.py @@ -81,7 +81,7 @@ def devimport(args, config, basepath, workspace): break else: non_importables.append(fn) - logger.warn('No recipe to append %s.bbapppend, skipping' % fn) + logger.warning('No recipe to append %s.bbapppend, skipping' % fn) # Extract imported = [] @@ -104,9 +104,9 @@ def devimport(args, config, basepath, workspace): try: tar.extract(member, path=config.workspace_path) except PermissionError as pe: - logger.warn(pe) + logger.warning(pe) else: - logger.warn('File already present. Use --overwrite/-o to overwrite it: %s' % member.name) + logger.warning('File already present. Use --overwrite/-o to overwrite it: %s' % member.name) continue else: tar.extract(member, path=config.workspace_path) @@ -129,7 +129,7 @@ def devimport(args, config, basepath, workspace): if imported: logger.info('Imported recipes into workspace %s: %s' % (config.workspace_path, ', '.join(imported))) else: - logger.warn('No recipes imported into the workspace') + logger.warning('No recipes imported into the workspace') return 0 diff --git a/poky/scripts/lib/devtool/standard.py b/poky/scripts/lib/devtool/standard.py index a1e8e1d32..d14b7a654 100644 --- a/poky/scripts/lib/devtool/standard.py +++ b/poky/scripts/lib/devtool/standard.py @@ -66,7 +66,7 @@ def add(args, config, basepath, workspace): args.srctree = args.recipename args.recipename = None elif os.path.isdir(args.recipename): - logger.warn('Ambiguous argument "%s" - assuming you mean it to be the recipe name' % args.recipename) + logger.warning('Ambiguous argument "%s" - assuming you mean it to be the recipe name' % args.recipename) if not args.fetchuri: if args.srcrev: @@ -82,7 +82,7 @@ def add(args, config, basepath, workspace): if args.fetchuri: raise DevtoolError('URI specified as positional argument as well as -f/--fetch') else: - logger.warn('-f/--fetch option is deprecated - you can now simply specify the URL to fetch as a positional argument instead') + logger.warning('-f/--fetch option is deprecated - you can now simply specify the URL to fetch as a positional argument instead') args.fetchuri = args.fetch if args.recipename: @@ -217,7 +217,7 @@ def add(args, config, basepath, workspace): raise DevtoolError('Command \'%s\' did not create any recipe file:\n%s' % (e.command, e.stdout)) attic_recipe = os.path.join(config.workspace_path, 'attic', recipename, os.path.basename(recipefile)) if os.path.exists(attic_recipe): - logger.warn('A modified recipe from a previous invocation exists in %s - you may wish to move this over the top of the new recipe if you had changes in it that you want to continue with' % attic_recipe) + logger.warning('A modified recipe from a previous invocation exists in %s - you may wish to move this over the top of the new recipe if you had changes in it that you want to continue with' % attic_recipe) finally: if tmpsrcdir and os.path.exists(tmpsrcdir): shutil.rmtree(tmpsrcdir) @@ -295,7 +295,7 @@ def add(args, config, basepath, workspace): with open(layerconf_file, 'a') as f: f.write('%s = "%s"\n' % (preferred_provider, recipe_name)) else: - logger.warn('Set \'%s\' in order to use the recipe' % preferred_provider) + logger.warning('Set \'%s\' in order to use the recipe' % preferred_provider) break _add_md5(config, recipename, appendfile) @@ -704,7 +704,7 @@ def _check_preserve(config, recipename): if splitline[2] != md5: bb.utils.mkdirhier(preservepath) preservefile = os.path.basename(removefile) - logger.warn('File %s modified since it was written, preserving in %s' % (preservefile, preservepath)) + logger.warning('File %s modified since it was written, preserving in %s' % (preservefile, preservepath)) shutil.move(removefile, os.path.join(preservepath, preservefile)) else: os.remove(removefile) @@ -795,7 +795,7 @@ def modify(args, config, basepath, workspace): if branchname.startswith(override_branch_prefix): branches.append(branchname) if branches: - logger.warn('SRC_URI is conditionally overridden in this recipe, thus several %s* branches have been created, one for each override that makes changes to SRC_URI. It is recommended that you make changes to the %s branch first, then checkout and rebase each %s* branch and update any unique patches there (duplicates on those branches will be ignored by devtool finish/update-recipe)' % (override_branch_prefix, args.branch, override_branch_prefix)) + logger.warning('SRC_URI is conditionally overridden in this recipe, thus several %s* branches have been created, one for each override that makes changes to SRC_URI. It is recommended that you make changes to the %s branch first, then checkout and rebase each %s* branch and update any unique patches there (duplicates on those branches will be ignored by devtool finish/update-recipe)' % (override_branch_prefix, args.branch, override_branch_prefix)) branches.insert(0, args.branch) seen_patches = [] for branch in branches: @@ -1720,7 +1720,7 @@ def update_recipe(args, config, basepath, workspace): if updated: rf = rd.getVar('FILE') if rf.startswith(config.workspace_path): - logger.warn('Recipe file %s has been updated but is inside the workspace - you will need to move it (and any associated files next to it) out to the desired layer before using "devtool reset" in order to keep any changes' % rf) + logger.warning('Recipe file %s has been updated but is inside the workspace - you will need to move it (and any associated files next to it) out to the desired layer before using "devtool reset" in order to keep any changes' % rf) finally: tinfoil.shutdown() @@ -1803,7 +1803,7 @@ def _reset(recipes, no_clean, config, basepath, workspace): if os.path.exists(origdir): for root, dirs, files in os.walk(origdir): for fn in files: - logger.warn('Preserving %s in %s' % (fn, preservepath)) + logger.warning('Preserving %s in %s' % (fn, preservepath)) _move_file(os.path.join(origdir, fn), os.path.join(preservepath, fn)) for dn in dirs: diff --git a/poky/scripts/lib/devtool/upgrade.py b/poky/scripts/lib/devtool/upgrade.py index c3fd866ef..202007793 100644 --- a/poky/scripts/lib/devtool/upgrade.py +++ b/poky/scripts/lib/devtool/upgrade.py @@ -264,7 +264,7 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, srcbranch, branch, kee if no_patch: patches = oe.recipeutils.get_recipe_patches(crd) if patches: - logger.warn('By user choice, the following patches will NOT be applied to the new source tree:\n %s' % '\n '.join([os.path.basename(patch) for patch in patches])) + logger.warning('By user choice, the following patches will NOT be applied to the new source tree:\n %s' % '\n '.join([os.path.basename(patch) for patch in patches])) else: __run('git checkout devtool-patched -b %s' % branch) skiptag = False @@ -273,9 +273,9 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, srcbranch, branch, kee except bb.process.ExecutionError as e: skiptag = True if 'conflict' in e.stdout: - logger.warn('Command \'%s\' failed:\n%s\n\nYou will need to resolve conflicts in order to complete the upgrade.' % (e.command, e.stdout.rstrip())) + logger.warning('Command \'%s\' failed:\n%s\n\nYou will need to resolve conflicts in order to complete the upgrade.' % (e.command, e.stdout.rstrip())) else: - logger.warn('Command \'%s\' failed:\n%s' % (e.command, e.stdout)) + logger.warning('Command \'%s\' failed:\n%s' % (e.command, e.stdout)) if not skiptag: if uri.startswith('git://'): suffix = 'new' @@ -420,7 +420,10 @@ def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, srcsubdir_old, src logger.info('Source subdirectory has changed, updating S value') if license_diff: - newlicchksum = " ".join(["file://{};md5={}".format(l["path"], l["actual_md5"]) + (";beginline={}".format(l["beginline"]) if l["beginline"] else "") + (";endline={}".format(l["endline"]) if l["endline"] else "") for l in new_licenses]) + newlicchksum = " ".join(["file://{}".format(l['path']) + + (";beginline={}".format(l['beginline']) if l['beginline'] else "") + + (";endline={}".format(l['endline']) if l['endline'] else "") + + (";md5={}".format(l['actual_md5'])) for l in new_licenses]) newvalues["LIC_FILES_CHKSUM"] = newlicchksum _add_license_diff_to_recipe(fullpath, license_diff) diff --git a/poky/scripts/lib/recipetool/append.py b/poky/scripts/lib/recipetool/append.py index 69c8bb77a..3f2c134ad 100644 --- a/poky/scripts/lib/recipetool/append.py +++ b/poky/scripts/lib/recipetool/append.py @@ -238,7 +238,7 @@ def appendfile(args): if stdout: logger.debug('file command output: %s' % stdout.rstrip()) if ('executable' in stdout and not 'shell script' in stdout) or 'shared object' in stdout: - logger.warn('This file looks like it is a binary or otherwise the output of compilation. If it is, you should consider building it properly instead of substituting a binary file directly.') + logger.warning('This file looks like it is a binary or otherwise the output of compilation. If it is, you should consider building it properly instead of substituting a binary file directly.') if args.recipe: recipes = {args.targetpath: [args.recipe],} @@ -275,7 +275,7 @@ def appendfile(args): if selectpn: logger.debug('Selecting recipe %s for file %s' % (selectpn, args.targetpath)) if postinst_pns: - logger.warn('%s be modified by postinstall scripts for the following recipes:\n %s\nThis may or may not be an issue depending on what modifications these postinstall scripts make.' % (args.targetpath, '\n '.join(postinst_pns))) + logger.warning('%s be modified by postinstall scripts for the following recipes:\n %s\nThis may or may not be an issue depending on what modifications these postinstall scripts make.' % (args.targetpath, '\n '.join(postinst_pns))) rd = _parse_recipe(selectpn, tinfoil) if not rd: # Error message already shown @@ -286,12 +286,12 @@ def appendfile(args): sourcetype, sourcepath = sourcefile.split('://', 1) logger.debug('Original source file is %s (%s)' % (sourcepath, sourcetype)) if sourcetype == 'patch': - logger.warn('File %s is added by the patch %s - you may need to remove or replace this patch in order to replace the file.' % (args.targetpath, sourcepath)) + logger.warning('File %s is added by the patch %s - you may need to remove or replace this patch in order to replace the file.' % (args.targetpath, sourcepath)) sourcepath = None else: logger.debug('Unable to determine source file, proceeding anyway') if modpatches: - logger.warn('File %s is modified by the following patches:\n %s' % (args.targetpath, '\n '.join(modpatches))) + logger.warning('File %s is modified by the following patches:\n %s' % (args.targetpath, '\n '.join(modpatches))) if instelements and sourcepath: install = None @@ -343,7 +343,7 @@ def appendsrc(args, files, rd, extralines=None): if rd.getVar('S') == rd.getVar('STAGING_KERNEL_DIR'): srcdir = os.path.join(workdir, 'git') if not bb.data.inherits_class('kernel-yocto', rd): - logger.warn('S == STAGING_KERNEL_DIR and non-kernel-yocto, unable to determine path to srcdir, defaulting to ${WORKDIR}/git') + logger.warning('S == STAGING_KERNEL_DIR and non-kernel-yocto, unable to determine path to srcdir, defaulting to ${WORKDIR}/git') src_destdir = os.path.join(os.path.relpath(srcdir, workdir), src_destdir) src_destdir = os.path.normpath(src_destdir) @@ -357,9 +357,9 @@ def appendsrc(args, files, rd, extralines=None): if simple_str in simplified: existing = simplified[simple_str] if source_uri != existing: - logger.warn('{0!r} is already in SRC_URI, with different parameters: {1!r}, not adding'.format(source_uri, existing)) + logger.warning('{0!r} is already in SRC_URI, with different parameters: {1!r}, not adding'.format(source_uri, existing)) else: - logger.warn('{0!r} is already in SRC_URI, not adding'.format(source_uri)) + logger.warning('{0!r} is already in SRC_URI, not adding'.format(source_uri)) else: extralines.append('SRC_URI += {0}'.format(source_uri)) copyfiles[newfile] = srcfile diff --git a/poky/scripts/lib/recipetool/create.py b/poky/scripts/lib/recipetool/create.py index a3710285b..1810c70ae 100644 --- a/poky/scripts/lib/recipetool/create.py +++ b/poky/scripts/lib/recipetool/create.py @@ -98,7 +98,7 @@ class RecipeHandler(object): break except IOError as ioe: if ioe.errno == 2: - logger.warn('unable to find a pkgdata file for package %s' % pkg) + logger.warning('unable to find a pkgdata file for package %s' % pkg) else: raise @@ -437,7 +437,7 @@ def create_recipe(args): if scriptutils.is_src_url(source): # Warn about github archive URLs if re.match('https?://github.com/[^/]+/[^/]+/archive/.+(\.tar\..*|\.zip)$', source): - logger.warn('github archive files are not guaranteed to be stable and may be re-generated over time. If the latter occurs, the checksums will likely change and the recipe will fail at do_fetch. It is recommended that you point to an actual commit or tag in the repository instead (using the repository URL in conjunction with the -S/--srcrev option).') + logger.warning('github archive files are not guaranteed to be stable and may be re-generated over time. If the latter occurs, the checksums will likely change and the recipe will fail at do_fetch. It is recommended that you point to an actual commit or tag in the repository instead (using the repository URL in conjunction with the -S/--srcrev option).') # Fetch a URL fetchuri = reformat_git_uri(urldefrag(source)[0]) if args.binary: diff --git a/poky/scripts/lib/recipetool/create_kmod.py b/poky/scripts/lib/recipetool/create_kmod.py index 4569b53c8..3982537a4 100644 --- a/poky/scripts/lib/recipetool/create_kmod.py +++ b/poky/scripts/lib/recipetool/create_kmod.py @@ -141,7 +141,7 @@ class KernelModuleRecipeHandler(RecipeHandler): warnmsg = 'Unable to find means of passing kernel path into install makefile - if kernel path is hardcoded you will need to patch the makefile' if warnmsg: warnmsg += '. Note that the variable KERNEL_SRC will be passed in as the kernel source path.' - logger.warn(warnmsg) + logger.warning(warnmsg) lines_after.append('# %s' % warnmsg) return True diff --git a/poky/scripts/lib/recipetool/create_npm.py b/poky/scripts/lib/recipetool/create_npm.py index bb42a5ca5..03667887f 100644 --- a/poky/scripts/lib/recipetool/create_npm.py +++ b/poky/scripts/lib/recipetool/create_npm.py @@ -90,7 +90,7 @@ class NpmRecipeHandler(RecipeHandler): runenv = dict(os.environ, PATH=d.getVar('PATH')) bb.process.run('npm shrinkwrap', cwd=srctree, stderr=subprocess.STDOUT, env=runenv, shell=True) except bb.process.ExecutionError as e: - logger.warn('npm shrinkwrap failed:\n%s' % e.stdout) + logger.warning('npm shrinkwrap failed:\n%s' % e.stdout) return tmpfile = os.path.join(localfilesdir, 'npm-shrinkwrap.json') @@ -107,12 +107,12 @@ class NpmRecipeHandler(RecipeHandler): cwd=srctree, stderr=subprocess.STDOUT, env=runenv, shell=True) relockbin = os.path.join(NpmRecipeHandler.lockdownpath, 'node_modules', 'lockdown', 'relock.js') if not os.path.exists(relockbin): - logger.warn('Could not find relock.js within lockdown directory; skipping lockdown') + logger.warning('Could not find relock.js within lockdown directory; skipping lockdown') return try: bb.process.run('node %s' % relockbin, cwd=srctree, stderr=subprocess.STDOUT, env=runenv, shell=True) except bb.process.ExecutionError as e: - logger.warn('lockdown-relock failed:\n%s' % e.stdout) + logger.warning('lockdown-relock failed:\n%s' % e.stdout) return tmpfile = os.path.join(localfilesdir, 'lockdown.json') diff --git a/poky/scripts/lib/recipetool/edit.py b/poky/scripts/lib/recipetool/edit.py new file mode 100644 index 000000000..c4789a999 --- /dev/null +++ b/poky/scripts/lib/recipetool/edit.py @@ -0,0 +1,54 @@ +# Recipe creation tool - edit plugin +# +# This sub-command edits the recipe and appends for the specified target +# +# Example: recipetool edit busybox +# +# Copyright (C) 2018 Mentor Graphics Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +import argparse +import errno +import logging +import os +import re +import subprocess +import sys +import scriptutils + + +logger = logging.getLogger('recipetool') +tinfoil = None + + +def tinfoil_init(instance): + global tinfoil + tinfoil = instance + + +def edit(args): + import oe.recipeutils + + recipe_path = tinfoil.get_recipe_file(args.target) + appends = tinfoil.get_file_appends(recipe_path) + + return scriptutils.run_editor([recipe_path] + appends, logger) + + +def register_commands(subparsers): + parser = subparsers.add_parser('edit', + help='Edit the recipe and appends for the specified target. This obeys $VISUAL if set, otherwise $EDITOR, otherwise vi.') + parser.add_argument('target', help='Target recipe/provide to edit') + parser.set_defaults(func=edit, parserecipes=True) diff --git a/poky/scripts/lib/recipetool/newappend.py b/poky/scripts/lib/recipetool/newappend.py index decce83fa..76707b4c9 100644 --- a/poky/scripts/lib/recipetool/newappend.py +++ b/poky/scripts/lib/recipetool/newappend.py @@ -58,11 +58,11 @@ def newappend(args): return 1 if not path_ok: - logger.warn('Unable to determine correct subdirectory path for bbappend file - check that what %s adds to BBFILES also matches .bbappend files. Using %s for now, but until you fix this the bbappend will not be applied.', os.path.join(args.destlayer, 'conf', 'layer.conf'), os.path.dirname(append_path)) + logger.warning('Unable to determine correct subdirectory path for bbappend file - check that what %s adds to BBFILES also matches .bbappend files. Using %s for now, but until you fix this the bbappend will not be applied.', os.path.join(args.destlayer, 'conf', 'layer.conf'), os.path.dirname(append_path)) layerdirs = [os.path.abspath(layerdir) for layerdir in rd.getVar('BBLAYERS').split()] if not os.path.abspath(args.destlayer) in layerdirs: - logger.warn('Specified layer is not currently enabled in bblayers.conf, you will need to add it before this bbappend will be active') + logger.warning('Specified layer is not currently enabled in bblayers.conf, you will need to add it before this bbappend will be active') if not os.path.exists(append_path): bb.utils.mkdirhier(os.path.dirname(append_path)) diff --git a/poky/scripts/lib/scriptutils.py b/poky/scripts/lib/scriptutils.py index 85b1c949b..31e48ea4d 100644 --- a/poky/scripts/lib/scriptutils.py +++ b/poky/scripts/lib/scriptutils.py @@ -15,16 +15,17 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -import sys -import os -import logging -import glob import argparse -import subprocess -import tempfile -import shutil +import glob +import logging +import os import random +import shlex +import shutil import string +import subprocess +import sys +import tempfile def logger_create(name, stream=None): logger = logging.getLogger(name) @@ -214,15 +215,14 @@ def fetch_url(tinfoil, srcuri, srcrev, destdir, logger, preserve_tmp=False, mirr def run_editor(fn, logger=None): if isinstance(fn, str): - params = '"%s"' % fn + files = [fn] else: - params = '' - for fnitem in fn: - params += ' "%s"' % fnitem + files = fn editor = os.getenv('VISUAL', os.getenv('EDITOR', 'vi')) try: - return subprocess.check_call('%s %s' % (editor, params), shell=True) + #print(shlex.split(editor) + files) + return subprocess.check_call(shlex.split(editor) + files) except subprocess.CalledProcessError as exc: logger.error("Execution of '%s' failed: %s" % (editor, exc)) return 1 diff --git a/poky/scripts/lib/wic/canned-wks/mkhybridiso.wks b/poky/scripts/lib/wic/canned-wks/mkhybridiso.wks index 9d34e9b47..48c5ac479 100644 --- a/poky/scripts/lib/wic/canned-wks/mkhybridiso.wks +++ b/poky/scripts/lib/wic/canned-wks/mkhybridiso.wks @@ -2,6 +2,6 @@ # long-description: Creates an EFI and legacy bootable hybrid ISO image # which can be used on optical media as well as USB media. -part /boot --source isoimage-isohybrid --sourceparams="loader=grub-efi,image_name=HYBRID_ISO_IMG" --ondisk cd --label HYBRIDISO --fstype=ext4 +part /boot --source isoimage-isohybrid --sourceparams="loader=grub-efi,image_name=HYBRID_ISO_IMG" --ondisk cd --label HYBRIDISO bootloader --timeout=15 --append="" diff --git a/poky/scripts/lib/wic/engine.py b/poky/scripts/lib/wic/engine.py index f0c5ff0aa..4662c665c 100644 --- a/poky/scripts/lib/wic/engine.py +++ b/poky/scripts/lib/wic/engine.py @@ -191,7 +191,7 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, if not os.path.exists(options.outdir): os.makedirs(options.outdir) - pname = 'direct' + pname = options.imager plugin_class = PluginMgr.get_plugins('imager').get(pname) if not plugin_class: raise WicError('Unknown plugin: %s' % pname) @@ -266,10 +266,15 @@ class Disk: out = exec_cmd("%s -sm %s unit B print" % (self.parted, self.imagepath)) parttype = namedtuple("Part", "pnum start end size fstype") splitted = out.splitlines() - lsector_size, psector_size, self._ptable_format = splitted[1].split(":")[3:6] + # skip over possible errors in exec_cmd output + try: + idx =splitted.index("BYT;") + except ValueError: + raise WicError("Error getting partition information from %s" % (self.parted)) + lsector_size, psector_size, self._ptable_format = splitted[idx + 1].split(":")[3:6] self._lsector_size = int(lsector_size) self._psector_size = int(psector_size) - for line in splitted[2:]: + for line in splitted[idx + 2:]: pnum, start, end, size, fstype = line.split(':')[:5] partition = parttype(int(pnum), int(start[:-1]), int(end[:-1]), int(size[:-1]), fstype) @@ -340,9 +345,21 @@ class Disk: """Remove files/dirs from the partition.""" partimg = self._get_part_image(pnum) if self.partitions[pnum].fstype.startswith('ext'): - exec_cmd("{} {} -wR 'rm {}'".format(self.debugfs, + cmd = "{} {} -wR 'rm {}'".format(self.debugfs, self._get_part_image(pnum), - path), as_shell=True) + path) + out = exec_cmd(cmd , as_shell=True) + for line in out.splitlines(): + if line.startswith("rm:"): + if "file is a directory" in line: + # Try rmdir to see if this is an empty directory. This won't delete + # any non empty directory so let user know about any error that this might + # generate. + print(exec_cmd("{} {} -wR 'rmdir {}'".format(self.debugfs, + self._get_part_image(pnum), + path), as_shell=True)) + else: + raise WicError("Could not complete operation: wic %s" % str(line)) else: # fat cmd = "{} -i {} ::{}".format(self.mdel, partimg, path) try: @@ -494,7 +511,7 @@ class Disk: sparse_copy(partfname, target, seek=part['start'] * self._lsector_size) os.unlink(partfname) elif part['type'] != 'f': - logger.warn("skipping partition {}: unsupported fstype {}".format(pnum, fstype)) + logger.warning("skipping partition {}: unsupported fstype {}".format(pnum, fstype)) def wic_ls(args, native_sysroot): """List contents of partitioned image or vfat partition.""" diff --git a/poky/scripts/lib/wic/filemap.py b/poky/scripts/lib/wic/filemap.py index a72fa09ef..abbf958b8 100644 --- a/poky/scripts/lib/wic/filemap.py +++ b/poky/scripts/lib/wic/filemap.py @@ -22,6 +22,7 @@ and returns an instance of the class. # * Too many instance attributes (R0902) # pylint: disable=R0902 +import errno import os import struct import array @@ -189,9 +190,9 @@ def _lseek(file_obj, offset, whence): except OSError as err: # The 'lseek' system call returns the ENXIO if there is no data or # hole starting from the specified offset. - if err.errno == os.errno.ENXIO: + if err.errno == errno.ENXIO: return -1 - elif err.errno == os.errno.EINVAL: + elif err.errno == errno.EINVAL: raise ErrorNotSupp("the kernel or file-system does not support " "\"SEEK_HOLE\" and \"SEEK_DATA\"") else: @@ -394,12 +395,12 @@ class FilemapFiemap(_FilemapBase): except IOError as err: # Note, the FIEMAP ioctl is supported by the Linux kernel starting # from version 2.6.28 (year 2008). - if err.errno == os.errno.EOPNOTSUPP: + if err.errno == errno.EOPNOTSUPP: errstr = "FilemapFiemap: the FIEMAP ioctl is not supported " \ "by the file-system" self._log.debug(errstr) raise ErrorNotSupp(errstr) - if err.errno == os.errno.ENOTTY: + if err.errno == errno.ENOTTY: errstr = "FilemapFiemap: the FIEMAP ioctl is not supported " \ "by the kernel" self._log.debug(errstr) diff --git a/poky/scripts/lib/wic/help.py b/poky/scripts/lib/wic/help.py index 842b868a5..64f08052c 100644 --- a/poky/scripts/lib/wic/help.py +++ b/poky/scripts/lib/wic/help.py @@ -866,11 +866,11 @@ DESCRIPTION Partitions with a <mountpoint> specified will be automatically mounted. This is achieved by wic adding entries to the fstab during image generation. In order for a valid fstab to be generated one of the - --ondrive, --ondisk or --use-uuid partition options must be used for - each partition that specifies a mountpoint. Note that with --use-uuid - and non-root <mountpoint>, including swap, the mount program must - understand the PARTUUID syntax. This currently excludes the busybox - versions of these applications. + --ondrive, --ondisk, --use-uuid or --use-label partition options must + be used for each partition that specifies a mountpoint. Note that with + --use-{uuid,label} and non-root <mountpoint>, including swap, the mount + program must understand the PARTUUID or LABEL syntax. This currently + excludes the busybox versions of these applications. The following are supported 'part' options: @@ -945,6 +945,14 @@ DESCRIPTION label is already in use by another filesystem, a new label is created for the partition. + --use-label: This option is specific to wic. It makes wic to use the + label in /etc/fstab to specify a partition. If the + --use-label and --use-uuid are used at the same time, + we prefer the uuid because it is less likely to cause + name confliction. We don't support using this parameter + on the root partition since it requires an initramfs to + parse this value and we do not currently support that. + --active: Marks the partition as active. --align (in KBytes): This option is specific to wic and says diff --git a/poky/scripts/lib/wic/ksparser.py b/poky/scripts/lib/wic/ksparser.py index e590b2fe3..7e5a9c509 100644 --- a/poky/scripts/lib/wic/ksparser.py +++ b/poky/scripts/lib/wic/ksparser.py @@ -141,6 +141,7 @@ class KickStart(): 'squashfs', 'vfat', 'msdos', 'swap')) part.add_argument('--mkfs-extraopts', default='') part.add_argument('--label') + part.add_argument('--use-label', action='store_true') part.add_argument('--no-table', action='store_true') part.add_argument('--ondisk', '--ondrive', dest='disk', default='sda') part.add_argument("--overhead-factor", type=overheadtype) @@ -196,9 +197,18 @@ class KickStart(): raise KickStartError('%s:%d: %s' % \ (confpath, lineno, err)) if line.startswith('part'): - # SquashFS does not support UUID - if parsed.fstype == 'squashfs' and parsed.use_uuid: - err = "%s:%d: SquashFS does not support UUID" \ + # SquashFS does not support filesystem UUID + if parsed.fstype == 'squashfs': + if parsed.fsuuid: + err = "%s:%d: SquashFS does not support UUID" \ + % (confpath, lineno) + raise KickStartError(err) + if parsed.label: + err = "%s:%d: SquashFS does not support LABEL" \ + % (confpath, lineno) + raise KickStartError(err) + if parsed.use_label and not parsed.label: + err = "%s:%d: Must set the label with --label" \ % (confpath, lineno) raise KickStartError(err) # using ArgumentParser one cannot easily tell if option diff --git a/poky/scripts/lib/wic/partition.py b/poky/scripts/lib/wic/partition.py index 3fe5c4e26..3da7e23e6 100644 --- a/poky/scripts/lib/wic/partition.py +++ b/poky/scripts/lib/wic/partition.py @@ -47,6 +47,7 @@ class Partition(): self.fsopts = args.fsopts self.fstype = args.fstype self.label = args.label + self.use_label = args.use_label self.mkfs_extraopts = args.mkfs_extraopts self.mountpoint = args.mountpoint self.no_table = args.no_table @@ -66,7 +67,6 @@ class Partition(): self.lineno = lineno self.source_file = "" - self.sourceparams_dict = {} def get_extra_block_count(self, current_blocks): """ @@ -211,7 +211,7 @@ class Partition(): """ p_prefix = os.environ.get("PSEUDO_PREFIX", "%s/usr" % native_sysroot) p_localstatedir = os.environ.get("PSEUDO_LOCALSTATEDIR", - "%s/../pseudo" % get_bitbake_var("IMAGE_ROOTFS")) + "%s/../pseudo" % rootfs_dir) p_passwd = os.environ.get("PSEUDO_PASSWD", rootfs_dir) p_nosymlinkexp = os.environ.get("PSEUDO_NOSYMLINKEXP", "1") pseudo = "export PSEUDO_PREFIX=%s;" % p_prefix diff --git a/poky/scripts/lib/wic/plugins/imager/direct.py b/poky/scripts/lib/wic/plugins/imager/direct.py index 1fa6b917e..bb14a334b 100644 --- a/poky/scripts/lib/wic/plugins/imager/direct.py +++ b/poky/scripts/lib/wic/plugins/imager/direct.py @@ -122,6 +122,10 @@ class DirectPlugin(ImagerPlugin): if self._update_fstab(fstab_lines, self.parts): # copy rootfs dir to workdir to update fstab # as rootfs can be used by other tasks and can't be modified + new_pseudo = os.path.realpath(os.path.join(self.workdir, "pseudo")) + from_dir = os.path.join(os.path.join(image_rootfs, ".."), "pseudo") + from_dir = os.path.realpath(from_dir) + copyhardlinktree(from_dir, new_pseudo) new_rootfs = os.path.realpath(os.path.join(self.workdir, "rootfs_copy")) copyhardlinktree(image_rootfs, new_rootfs) fstab_path = os.path.join(new_rootfs, 'etc/fstab') @@ -151,6 +155,8 @@ class DirectPlugin(ImagerPlugin): device_name = "UUID=%s" % part.fsuuid else: device_name = "PARTUUID=%s" % part.uuid + elif part.use_label: + device_name = "LABEL=%s" % part.label else: # mmc device partitions are named mmcblk0p1, mmcblk0p2.. prefix = 'p' if part.disk.startswith('mmcblk') else '' diff --git a/poky/scripts/lib/wic/plugins/source/bootimg-partition.py b/poky/scripts/lib/wic/plugins/source/bootimg-partition.py index b239fc0b4..ddc880be3 100644 --- a/poky/scripts/lib/wic/plugins/source/bootimg-partition.py +++ b/poky/scripts/lib/wic/plugins/source/bootimg-partition.py @@ -30,6 +30,7 @@ import re from glob import glob from wic import WicError +from wic.engine import get_custom_config from wic.pluginbase import SourcePlugin from wic.misc import exec_cmd, get_bitbake_var @@ -44,15 +45,11 @@ class BootimgPartitionPlugin(SourcePlugin): name = 'bootimg-partition' @classmethod - def do_prepare_partition(cls, part, source_params, cr, cr_workdir, + def do_configure_partition(cls, part, source_params, cr, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, - rootfs_dir, native_sysroot): + native_sysroot): """ - Called to do the actual content population for a partition i.e. it - 'prepares' the partition to be incorporated into the image. - In this case, does the following: - - sets up a vfat partition - - copies all files listed in IMAGE_BOOT_FILES variable + Called before do_prepare_partition(), create u-boot specific boot config """ hdddir = "%s/boot.%d" % (cr_workdir, part.lineno) install_cmd = "install -d %s" % hdddir @@ -63,8 +60,6 @@ class BootimgPartitionPlugin(SourcePlugin): if not kernel_dir: raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") - logger.debug('Kernel dir: %s', bootimg_dir) - boot_files = None for (fmt, id) in (("_uuid-%s", part.uuid), ("_label-%s", part.label), (None, None)): if fmt: @@ -94,9 +89,9 @@ class BootimgPartitionPlugin(SourcePlugin): logger.debug('Destination entry: %r', dst_entry) deploy_files.append(dst_entry) + cls.install_task = []; for deploy_entry in deploy_files: src, dst = deploy_entry - install_task = [] if '*' in src: # by default install files under their basename entry_name_fn = os.path.basename @@ -111,21 +106,101 @@ class BootimgPartitionPlugin(SourcePlugin): logger.debug('Globbed sources: %s', ', '.join(srcs)) for entry in srcs: + src = os.path.relpath(entry, kernel_dir) entry_dst_name = entry_name_fn(entry) - install_task.append((entry, - os.path.join(hdddir, - entry_dst_name))) + cls.install_task.append((src, entry_dst_name)) else: - install_task = [(os.path.join(kernel_dir, src), - os.path.join(hdddir, dst))] - - for task in install_task: - src_path, dst_path = task - logger.debug('Install %s as %s', - os.path.basename(src_path), dst_path) - install_cmd = "install -m 0644 -D %s %s" \ - % (src_path, dst_path) - exec_cmd(install_cmd) + cls.install_task.append((src, dst)) + + if source_params.get('loader') != "u-boot": + return + + configfile = cr.ks.bootloader.configfile + custom_cfg = None + if configfile: + custom_cfg = get_custom_config(configfile) + if custom_cfg: + # Use a custom configuration for extlinux.conf + extlinux_conf = custom_cfg + logger.debug("Using custom configuration file " + "%s for extlinux.cfg", configfile) + else: + raise WicError("configfile is specified but failed to " + "get it from %s." % configfile) + + if not custom_cfg: + # The kernel types supported by the sysboot of u-boot + kernel_types = ["zImage", "Image", "fitImage", "uImage", "vmlinux"] + has_dtb = False + fdt_dir = '/' + kernel_name = None + + # Find the kernel image name, from the highest precedence to lowest + for image in kernel_types: + for task in cls.install_task: + src, dst = task + if re.match(image, src): + kernel_name = os.path.join('/', dst) + break + if kernel_name: + break + + for task in cls.install_task: + src, dst = task + # We suppose that all the dtb are in the same directory + if re.search(r'\.dtb', src) and fdt_dir == '/': + has_dtb = True + fdt_dir = os.path.join(fdt_dir, os.path.dirname(dst)) + break + + if not kernel_name: + raise WicError('No kernel file founded') + + # Compose the extlinux.conf + extlinux_conf = "default Yocto\n" + extlinux_conf += "label Yocto\n" + extlinux_conf += " kernel %s\n" % kernel_name + if has_dtb: + extlinux_conf += " fdtdir %s\n" % fdt_dir + bootloader = cr.ks.bootloader + extlinux_conf += "append root=%s rootwait %s\n" \ + % (cr.rootdev, bootloader.append if bootloader.append else '') + + install_cmd = "install -d %s/extlinux/" % hdddir + exec_cmd(install_cmd) + cfg = open("%s/extlinux/extlinux.conf" % hdddir, "w") + cfg.write(extlinux_conf) + cfg.close() + + + @classmethod + def do_prepare_partition(cls, part, source_params, cr, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + rootfs_dir, native_sysroot): + """ + Called to do the actual content population for a partition i.e. it + 'prepares' the partition to be incorporated into the image. + In this case, does the following: + - sets up a vfat partition + - copies all files listed in IMAGE_BOOT_FILES variable + """ + hdddir = "%s/boot.%d" % (cr_workdir, part.lineno) + + if not kernel_dir: + kernel_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") + if not kernel_dir: + raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") + + logger.debug('Kernel dir: %s', bootimg_dir) + + + for task in cls.install_task: + src_path, dst_path = task + logger.debug('Install %s as %s', src_path, dst_path) + install_cmd = "install -m 0644 -D %s %s" \ + % (os.path.join(kernel_dir, src_path), + os.path.join(hdddir, dst_path)) + exec_cmd(install_cmd) logger.debug('Prepare boot partition using rootfs in %s', hdddir) part.prepare_rootfs(cr_workdir, oe_builddir, hdddir, diff --git a/poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py index d599112dd..9347aa7fc 100644 --- a/poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py +++ b/poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py @@ -26,6 +26,7 @@ import logging import os +import re from wic import WicError from wic.engine import get_custom_config @@ -47,10 +48,17 @@ class BootimgPcbiosPlugin(SourcePlugin): """ Check if dirname exists in default bootimg_dir or in STAGING_DIR. """ - for result in (bootimg_dir, get_bitbake_var("STAGING_DATADIR")): + staging_datadir = get_bitbake_var("STAGING_DATADIR") + for result in (bootimg_dir, staging_datadir): if os.path.exists("%s/%s" % (result, dirname)): return result + # STAGING_DATADIR is expanded with MLPREFIX if multilib is enabled + # but dependency syslinux is still populated to original STAGING_DATADIR + nonarch_datadir = re.sub('/[^/]*recipe-sysroot', '/recipe-sysroot', staging_datadir) + if os.path.exists(os.path.join(nonarch_datadir, dirname)): + return nonarch_datadir + raise WicError("Couldn't find correct bootimg_dir, exiting") @classmethod diff --git a/poky/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/poky/scripts/lib/wic/plugins/source/isoimage-isohybrid.py index b119c9c2f..170077c22 100644 --- a/poky/scripts/lib/wic/plugins/source/isoimage-isohybrid.py +++ b/poky/scripts/lib/wic/plugins/source/isoimage-isohybrid.py @@ -47,7 +47,7 @@ class IsoImagePlugin(SourcePlugin): Example kickstart file: part /boot --source isoimage-isohybrid --sourceparams="loader=grub-efi, \\ - image_name= IsoImage" --ondisk cd --label LIVECD --fstype=ext2 + image_name= IsoImage" --ondisk cd --label LIVECD bootloader --timeout=10 --append=" " In --sourceparams "loader" specifies the bootloader used for booting in EFI @@ -191,10 +191,9 @@ class IsoImagePlugin(SourcePlugin): else: raise WicError("Couldn't find or build initrd, exiting.") - exec_cmd("cd %s && find . | cpio -o -H newc -R +0:+0 >./initrd.cpio " \ - % initrd_dir, as_shell=True) - exec_cmd("gzip -f -9 -c %s/initrd.cpio > %s" \ - % (cr_workdir, initrd), as_shell=True) + exec_cmd("cd %s && find . | cpio -o -H newc -R root:root >%s/initrd.cpio " \ + % (initrd_dir, cr_workdir), as_shell=True) + exec_cmd("gzip -f -9 %s/initrd.cpio" % cr_workdir, as_shell=True) shutil.rmtree(initrd_dir) return initrd @@ -253,33 +252,8 @@ class IsoImagePlugin(SourcePlugin): raise WicError("Couldn't find IMAGE_ROOTFS, exiting.") part.rootfs_dir = rootfs_dir - - # Prepare rootfs.img deploy_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") img_iso_dir = get_bitbake_var("ISODIR") - rootfs_img = "%s/rootfs.img" % img_iso_dir - if not os.path.isfile(rootfs_img): - # check if rootfs.img is in deploydir - deploy_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") - image_name = get_bitbake_var("IMAGE_LINK_NAME") - rootfs_img = "%s/%s.%s" \ - % (deploy_dir, image_name, part.fstype) - - if not os.path.isfile(rootfs_img): - # create image file with type specified by --fstype - # which contains rootfs - du_cmd = "du -bks %s" % rootfs_dir - out = exec_cmd(du_cmd) - part.size = int(out.split()[0]) - part.extra_space = 0 - part.overhead_factor = 1.2 - part.prepare_rootfs(cr_workdir, oe_builddir, rootfs_dir, \ - native_sysroot) - rootfs_img = part.source_file - - install_cmd = "install -m 0644 %s %s/rootfs.img" \ - % (rootfs_img, isodir) - exec_cmd(install_cmd) # Remove the temporary file created by part.prepare_rootfs() if os.path.isfile(part.source_file): @@ -342,7 +316,7 @@ class IsoImagePlugin(SourcePlugin): grub_src = os.path.join(deploy_dir, grub_src_image) if not os.path.exists(grub_src): raise WicError("Grub loader %s is not found in %s. " - "Please build grub-efi first" % (grub_image, deploy_dir)) + "Please build grub-efi first" % (grub_src_image, deploy_dir)) shutil.copy(grub_src, grub_target) if not os.path.isfile(os.path.join(target_dir, "boot.cfg")): diff --git a/poky/scripts/oe-build-perf-report b/poky/scripts/oe-build-perf-report index dc999c45c..0bd05f44e 100755 --- a/poky/scripts/oe-build-perf-report +++ b/poky/scripts/oe-build-perf-report @@ -416,9 +416,11 @@ def print_html_report(data, id_comp, buildstats): samples[-1]['commit_num'] = commit_num absdiff = samples[-1]['val_cls'](samples[-1]['mean'] - samples[id_comp]['mean']) + reldiff = absdiff * 100 / samples[id_comp]['mean'] new_meas['absdiff'] = absdiff new_meas['absdiff_str'] = str(absdiff) if absdiff < 0 else '+' + str(absdiff) - new_meas['reldiff'] = "{:+.1f} %".format(absdiff * 100 / samples[id_comp]['mean']) + new_meas['reldiff'] = reldiff + new_meas['reldiff_str'] = "{:+.1f} %".format(reldiff) new_meas['samples'] = samples new_meas['value'] = samples[-1] new_meas['value_type'] = samples[-1]['val_cls'] diff --git a/poky/scripts/oe-buildenv-internal b/poky/scripts/oe-buildenv-internal index 677387232..52ce32987 100755 --- a/poky/scripts/oe-buildenv-internal +++ b/poky/scripts/oe-buildenv-internal @@ -40,16 +40,7 @@ if [ -z "$OE_SKIP_SDK_CHECK" ] && [ -n "$OECORE_SDK_VERSION" ]; then return 1 fi -# Make sure we're not using python v3.x as 'python', we don't support it. -py_v2_check=$(/usr/bin/env python --version 2>&1 | grep "Python 3") -if [ -n "$py_v2_check" ]; then - echo >&2 "OpenEmbedded requires 'python' to be python v2 (>= 2.7.3), not python v3." - echo >&2 "Please set up python v2 as your default 'python' interpreter." - return 1 -fi -unset py_v2_check - -py_v27_check=$(python -c 'import sys; print sys.version_info >= (2,7,3)') +py_v27_check=$(python2 -c 'import sys; print sys.version_info >= (2,7,3)') if [ "$py_v27_check" != "True" ]; then echo >&2 "OpenEmbedded requires 'python' to be python v2 (>= 2.7.3), not python v3." echo >&2 "Please upgrade your python v2." diff --git a/poky/scripts/oe-depends-dot b/poky/scripts/oe-depends-dot index 5cec23bf0..6c7e9d338 100755 --- a/poky/scripts/oe-depends-dot +++ b/poky/scripts/oe-depends-dot @@ -47,6 +47,51 @@ class Dot(object): if len(sys.argv) != 3 and len(sys.argv) < 5: print('ERROR: Not enough args, see --help for usage') + @staticmethod + def insert_dep_chain(chain, rdeps, alldeps): + """ + insert elements to chain from rdeps, according to alldeps + """ + # chain should at least contain one element + if len(chain) == 0: + raise + + inserted_elements = [] + for rdep in rdeps: + if rdep in chain: + continue + else: + for i in range(0, len(chain)-1): + if chain[i] in alldeps[rdep] and rdep in alldeps[chain[i+1]]: + chain.insert(i+1, rdep) + inserted_elements.append(rdep) + break + if chain[-1] in alldeps[rdep] and rdep not in chain: + chain.append(rdep) + inserted_elements.append(rdep) + return inserted_elements + + @staticmethod + def print_dep_chains(key, rdeps, alldeps): + rlist = rdeps.copy() + chain = [] + removed_rdeps = [] # hold rdeps removed from rlist + + chain.append(key) + while (len(rlist) != 0): + # insert chain from rlist + inserted_elements = Dot.insert_dep_chain(chain, rlist, alldeps) + if not inserted_elements: + if chain[-1] in rlist: + rlist.remove(chain[-1]) + removed_rdeps.append(chain[-1]) + chain.pop() + continue + else: + # insert chain from removed_rdeps + Dot.insert_dep_chain(chain, removed_rdeps, alldeps) + print(' -> '.join(list(reversed(chain)))) + def main(self): #print(self.args.dotfile[0]) # The format is {key: depends} @@ -109,6 +154,7 @@ class Dot(object): if self.args.key in v and not k in reverse_deps: reverse_deps.append(k) print('Because: %s' % ' '.join(reverse_deps)) + Dot.print_dep_chains(self.args.key, reverse_deps, depends) if __name__ == "__main__": try: diff --git a/poky/scripts/oe-find-native-sysroot b/poky/scripts/oe-find-native-sysroot index 350ea2137..cc146b3fd 100755 --- a/poky/scripts/oe-find-native-sysroot +++ b/poky/scripts/oe-find-native-sysroot @@ -110,6 +110,4 @@ pseudo="$OECORE_NATIVE_SYSROOT/usr/bin/pseudo" if [ -e "$pseudo" ]; then echo "PSEUDO=$pseudo" PSEUDO="$pseudo" -else - echo "PSEUDO $pseudo is not found." fi diff --git a/poky/scripts/oe-pkgdata-util b/poky/scripts/oe-pkgdata-util index e6c9df94e..53739b0bf 100755 --- a/poky/scripts/oe-pkgdata-util +++ b/poky/scripts/oe-pkgdata-util @@ -279,10 +279,14 @@ def lookup_recipe(args): parse_pkgdatafile(pkgdatafile) continue pkgdatafile = os.path.join(args.pkgdata_dir, 'runtime-reverse', pkg) - if not os.path.exists(pkgdatafile): - logger.error("The following packages could not be found: %s" % pkg) - sys.exit(1) - parse_pkgdatafile(pkgdatafile) + if os.path.exists(pkgdatafile): + parse_pkgdatafile(pkgdatafile) + else: + if args.carryon: + print("The following packages could not be found: %s" % pkg) + else: + logger.error("The following packages could not be found: %s" % pkg) + sys.exit(1) def package_info(args): def parse_pkgdatafile(pkgdatafile): @@ -558,6 +562,7 @@ def main(): help='Find recipe producing one or more packages', description='Looks up the specified runtime package(s) to see which recipe they were produced by') parser_lookup_recipe.add_argument('pkg', nargs='+', help='Runtime package name to look up') + parser_lookup_recipe.add_argument('-c', '--continue', dest="carryon", help='Continue looking up recipes even if we can not find one', action='store_true') parser_lookup_recipe.set_defaults(func=lookup_recipe) parser_package_info = subparsers.add_parser('package-info', diff --git a/poky/scripts/oe-run-native b/poky/scripts/oe-run-native index 1131122e6..a29e99438 100755 --- a/poky/scripts/oe-run-native +++ b/poky/scripts/oe-run-native @@ -55,12 +55,12 @@ fi OLD_PATH=$PATH # look for a tool only in native sysroot -PATH=$OECORE_NATIVE_SYSROOT/usr/bin:$OECORE_NATIVE_SYSROOT/bin:$OECORE_NATIVE_SYSROOT/usr/sbin:$OECORE_NATIVE_SYSROOT/sbin +PATH=$OECORE_NATIVE_SYSROOT/usr/bin:$OECORE_NATIVE_SYSROOT/bin:$OECORE_NATIVE_SYSROOT/usr/sbin:$OECORE_NATIVE_SYSROOT/sbin$(find $OECORE_NATIVE_SYSROOT/usr/bin/*-native -maxdepth 1 -type d -printf ":%p") tool_find=`/usr/bin/which $tool 2>/dev/null` if [ -n "$tool_find" ] ; then # add old path to allow usage of host tools - PATH=$PATH:$OLD_PATH $@ + PATH=$PATH:$OLD_PATH "$@" else echo "Error: Unable to find '$tool' in $PATH" echo "Error: Have you run 'bitbake $native_recipe -caddto_recipe_sysroot'?" diff --git a/poky/scripts/postinst-intercepts/update_font_cache b/poky/scripts/postinst-intercepts/update_font_cache index bf65e19a4..e0ec47196 100644 --- a/poky/scripts/postinst-intercepts/update_font_cache +++ b/poky/scripts/postinst-intercepts/update_font_cache @@ -2,6 +2,5 @@ set -e -PSEUDO_UNLOAD=1 qemuwrapper -L $D -E LD_LIBRARY_PATH=$D/${libdir}:$D/${base_libdir} \ - -E ${fontconfigcacheenv} $D${bindir}/fc-cache --sysroot=$D --system-only ${fontconfigcacheparams} +PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D -E ${fontconfigcacheenv} $D${libexecdir}/${binprefix}fc-cache --sysroot=$D --system-only ${fontconfigcacheparams} chown -R root:root $D${fontconfigcachedir} diff --git a/poky/scripts/postinst-intercepts/update_gio_module_cache b/poky/scripts/postinst-intercepts/update_gio_module_cache index fc3f9d0d6..d1f014094 100644 --- a/poky/scripts/postinst-intercepts/update_gio_module_cache +++ b/poky/scripts/postinst-intercepts/update_gio_module_cache @@ -2,8 +2,7 @@ set -e -PSEUDO_UNLOAD=1 qemuwrapper -L $D -E LD_LIBRARY_PATH=$D${libdir}:$D${base_libdir} \ - $D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/ +PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libexecdir}/${binprefix}gio-querymodules $D${libdir}/gio/modules/ [ ! -e $D${libdir}/gio/modules/giomodule.cache ] || chown root:root $D${libdir}/gio/modules/giomodule.cache diff --git a/poky/scripts/postinst-intercepts/update_gtk_immodules_cache b/poky/scripts/postinst-intercepts/update_gtk_immodules_cache new file mode 100644 index 000000000..395516971 --- /dev/null +++ b/poky/scripts/postinst-intercepts/update_gtk_immodules_cache @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +if [ -x $D${libexecdir}/${binprefix}gtk-query-immodules-2.0 ]; then + PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libexecdir}/${binprefix}gtk-query-immodules-2.0 \ + > $D${libdir}/gtk-2.0/2.10.0/immodules.cache && + sed -i -e "s:$D::" $D${libdir}/gtk-2.0/2.10.0/immodules.cache + chown root:root $D${libdir}/gtk-2.0/2.10.0/immodules.cache +fi +if [ -x $D${libexecdir}/${binprefix}gtk-query-immodules-3.0 ]; then + PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libexecdir}/${binprefix}gtk-query-immodules-3.0 \ + > $D${libdir}/gtk-3.0/3.0.0/immodules.cache && + sed -i -e "s:$D::" $D${libdir}/gtk-3.0/3.0.0/immodules.cache + chown root:root $D${libdir}/gtk-3.0/3.0.0/immodules.cache +fi diff --git a/poky/scripts/postinst-intercepts/update_pixbuf_cache b/poky/scripts/postinst-intercepts/update_pixbuf_cache index 5d44075fb..ebea07c35 100644 --- a/poky/scripts/postinst-intercepts/update_pixbuf_cache +++ b/poky/scripts/postinst-intercepts/update_pixbuf_cache @@ -5,7 +5,6 @@ set -e export GDK_PIXBUF_MODULEDIR=$D${libdir}/gdk-pixbuf-2.0/2.10.0/loaders export GDK_PIXBUF_FATAL_LOADER=1 -PSEUDO_UNLOAD=1 qemuwrapper -L $D -E LD_LIBRARY_PATH=$D/${libdir}:$D/${base_libdir}\ - $D${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders \ +PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders \ >$GDK_PIXBUF_MODULEDIR/../loaders.cache && \ sed -i -e "s:$D::g" $GDK_PIXBUF_MODULEDIR/../loaders.cache diff --git a/poky/scripts/postinst-intercepts/update_udev_hwdb b/poky/scripts/postinst-intercepts/update_udev_hwdb new file mode 100644 index 000000000..b5cce0a09 --- /dev/null +++ b/poky/scripts/postinst-intercepts/update_udev_hwdb @@ -0,0 +1,6 @@ +#!/bin/sh + +set -e + +PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${libexecdir}/${binprefix}udevadm hwdb --update --root $D +chown root:root $D${sysconfdir}/udev/hwdb.bin diff --git a/poky/scripts/runqemu b/poky/scripts/runqemu index c6b7580dd..295c8b1b6 100755 --- a/poky/scripts/runqemu +++ b/poky/scripts/runqemu @@ -290,7 +290,7 @@ class BaseConfig(object): def check_arg_fstype(self, fst): """Check and set FSTYPE""" if fst not in self.fstypes + self.vmtypes: - logger.warn("Maybe unsupported FSTYPE: %s" % fst) + logger.warning("Maybe unsupported FSTYPE: %s" % fst) if not self.fstype or self.fstype == fst: if fst == 'ramfs': fst = 'cpio.gz' @@ -352,7 +352,7 @@ class BaseConfig(object): self.qemuboot = qb self.qbconfload = True else: - logger.warn("%s doesn't exist" % qb) + logger.warning("%s doesn't exist" % qb) else: raise RunQemuError("Can't find FSTYPE from: %s" % p) @@ -672,7 +672,10 @@ class BaseConfig(object): logger.info('QB_MEM is not set, use 512M by default') self.set('QB_MEM', '-m 512') - self.kernel_cmdline_script += ' mem=%s' % self.get('QB_MEM').replace('-m','').strip() + 'M' + mach = self.get('MACHINE') + if not mach.startswith('qemumips'): + self.kernel_cmdline_script += ' mem=%s' % self.get('QB_MEM').replace('-m','').strip() + 'M' + self.qemu_opt_script += ' %s' % self.get('QB_MEM') def check_tcpserial(self): @@ -692,7 +695,7 @@ class BaseConfig(object): if not self.get('QB_AUDIO_DRV'): raise RunQemuError("QB_AUDIO_DRV is NULL, this board doesn't support audio") if not self.get('QB_AUDIO_OPT'): - logger.warn('QB_AUDIO_OPT is NULL, you may need define it to make audio work') + logger.warning('QB_AUDIO_OPT is NULL, you may need define it to make audio work') else: self.qemu_opt_script += ' %s' % self.get('QB_AUDIO_OPT') os.putenv('QEMU_AUDIO_DRV', self.get('QB_AUDIO_DRV')) @@ -714,7 +717,7 @@ class BaseConfig(object): if self.get('DEPLOY_DIR_IMAGE'): deploy_dir_image = self.get('DEPLOY_DIR_IMAGE') else: - logger.warn("Can't find qemuboot conf file, DEPLOY_DIR_IMAGE is NULL!") + logger.warning("Can't find qemuboot conf file, DEPLOY_DIR_IMAGE is NULL!") return if self.rootfs and not os.path.exists(self.rootfs): @@ -1061,9 +1064,9 @@ class BaseConfig(object): # virtio might have been selected explicitly (just use it), or # is used as fallback (then warn about that). if not drive_type.startswith("/dev/vd"): - logger.warn("Unknown QB_DRIVE_TYPE: %s" % drive_type) - logger.warn("Failed to figure out drive type, consider define or fix QB_DRIVE_TYPE") - logger.warn('Trying to use virtio block drive') + logger.warning("Unknown QB_DRIVE_TYPE: %s" % drive_type) + logger.warning("Failed to figure out drive type, consider define or fix QB_DRIVE_TYPE") + logger.warning('Trying to use virtio block drive') vm_drive = '-drive if=virtio,file=%s,format=%s' % (self.rootfs, rootfs_format) # All branches above set vm_drive. @@ -1279,7 +1282,7 @@ class BaseConfig(object): self.bitbake_e = subprocess.check_output(cmd, shell=True).decode('utf-8') except subprocess.CalledProcessError as err: self.bitbake_e = '' - logger.warn("Couldn't run 'bitbake -e' to gather environment information:\n%s" % err.output.decode('utf-8')) + logger.warning("Couldn't run 'bitbake -e' to gather environment information:\n%s" % err.output.decode('utf-8')) def validate_combos(self): if (self.fstype in self.vmtypes) and self.kernel: diff --git a/poky/scripts/runqemu-extract-sdk b/poky/scripts/runqemu-extract-sdk index f4286efb1..4da3eb10a 100755 --- a/poky/scripts/runqemu-extract-sdk +++ b/poky/scripts/runqemu-extract-sdk @@ -31,9 +31,9 @@ fi SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot 2> /dev/null` if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then - echo "Error: Unable to find the oe-find-native-sysroot script" - echo "Did you forget to source your build system environment setup script?" - exit 1 + echo "Error: Unable to find the oe-find-native-sysroot script" + echo "Did you forget to source your build system environment setup script?" + exit 1 fi . $SYSROOT_SETUP_SCRIPT meta-ide-support PSEUDO_OPTS="-P $OECORE_NATIVE_SYSROOT/usr" @@ -42,9 +42,9 @@ ROOTFS_TARBALL=$1 SDK_ROOTFS_DIR=$2 if [ ! -e "$ROOTFS_TARBALL" ]; then - echo "Error: sdk tarball '$ROOTFS_TARBALL' does not exist" - usage - exit 1 + echo "Error: sdk tarball '$ROOTFS_TARBALL' does not exist" + usage + exit 1 fi # Convert SDK_ROOTFS_DIR to a full pathname @@ -53,6 +53,9 @@ if [[ ${SDK_ROOTFS_DIR:0:1} != "/" ]]; then fi TAR_OPTS="" +if [[ "$ROOTFS_TARBALL" =~ tar\.xz$ ]]; then + TAR_OPTS="--numeric-owner -xJf" +fi if [[ "$ROOTFS_TARBALL" =~ tar\.bz2$ ]]; then TAR_OPTS="--numeric-owner -xjf" fi @@ -64,7 +67,7 @@ if [[ "$ROOTFS_TARBALL" =~ \.tar$ ]]; then fi if [ -z "$TAR_OPTS" ]; then echo "Error: Unable to determine sdk tarball format" - echo "Accepted types: .tar / .tar.gz / .tar.bz2" + echo "Accepted types: .tar / .tar.gz / .tar.bz2 / .tar.xz" exit 1 fi @@ -81,7 +84,7 @@ debug_image="`echo $ROOTFS_TARBALL | grep '\-dbg\.tar\.'`" if [ -e "$pseudo_state_dir" -a -z "$debug_image" ]; then echo "Error: $pseudo_state_dir already exists!" echo "Please delete the rootfs tree and pseudo directory manually" - echo "if this is really what you want." + echo "if this is really what you want." exit 1 fi diff --git a/poky/scripts/runqemu-ifdown b/poky/scripts/runqemu-ifdown index ffbc9de44..248696858 100755 --- a/poky/scripts/runqemu-ifdown +++ b/poky/scripts/runqemu-ifdown @@ -51,6 +51,16 @@ fi $TUNCTL -d $TAP +IFCONFIG=`which ip 2> /dev/null` +if [ "x$IFCONFIG" = "x" ]; then + # better than nothing... + IFCONFIG=/sbin/ip +fi +if [ -x "$IFCONFIG" ]; then + if `$IFCONFIG link show $TAP > /dev/null 2>&1`; then + $IFCONFIG link del $TAP + fi +fi # cleanup the remaining iptables rules IPTABLES=`which iptables 2> /dev/null` if [ "x$IPTABLES" = "x" ]; then diff --git a/poky/scripts/send-error-report b/poky/scripts/send-error-report index cd2e7f4b9..8939f5f59 100755 --- a/poky/scripts/send-error-report +++ b/poky/scripts/send-error-report @@ -88,7 +88,7 @@ def prepare_data(args): log.error("Name needs to be provided either via "+userfile+" or as an argument (-n).") sys.exit(1) - while len(args.name) <= 0 and len(args.name) < 50: + while len(args.name) <= 0 or len(args.name) > 50: print("\nName needs to be given and must not more than 50 characters.") args.name, args.email = ask_for_contactdetails() @@ -140,7 +140,7 @@ def send_data(data, args): try: response = urllib.request.urlopen(req) except urllib.error.HTTPError as e: - logging.error(e.reason) + logging.error(str(e)) sys.exit(1) print(response.read().decode('utf-8')) diff --git a/poky/scripts/wic b/poky/scripts/wic index 7392bc4e7..37dfe2dc5 100755 --- a/poky/scripts/wic +++ b/poky/scripts/wic @@ -362,6 +362,8 @@ def wic_init_parser_create(subparser): "bitbake variables") subparser.add_argument("-D", "--debug", dest="debug", action="store_true", default=False, help="output debug information") + subparser.add_argument("-i", "--imager", dest="imager", + default="direct", help="the wic imager plugin") return diff --git a/poky/scripts/yocto-check-layer b/poky/scripts/yocto-check-layer index 5a4fd752c..9b7e53679 100755 --- a/poky/scripts/yocto-check-layer +++ b/poky/scripts/yocto-check-layer @@ -169,7 +169,14 @@ def main(): td['bbvars'] = get_bb_vars() logger.info('Getting initial signatures ...') td['builddir'] = builddir - td['sigs'], td['tunetasks'] = get_signatures(td['builddir']) + try: + td['sigs'], td['tunetasks'] = get_signatures(td['builddir']) + except RuntimeError as e: + logger.info(str(e)) + results[layer['name']] = None + results_status[layer['name']] = 'FAIL (Generating world signatures)' + layers_tested = layers_tested + 1 + continue td['machines'] = args.machines if not add_layer(bblayersconf, layer, dep_layers, logger): |