diff options
Diffstat (limited to 'poky/scripts')
-rw-r--r-- | poky/scripts/lib/devtool/deploy.py | 2 | ||||
-rw-r--r-- | poky/scripts/lib/devtool/upgrade.py | 44 | ||||
-rw-r--r-- | poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py | 6 | ||||
-rwxr-xr-x | poky/scripts/oe-time-dd-test.sh | 96 | ||||
-rwxr-xr-x | poky/scripts/runqemu | 27 |
5 files changed, 130 insertions, 45 deletions
diff --git a/poky/scripts/lib/devtool/deploy.py b/poky/scripts/lib/devtool/deploy.py index e5af2c95ae..833322571f 100644 --- a/poky/scripts/lib/devtool/deploy.py +++ b/poky/scripts/lib/devtool/deploy.py @@ -168,7 +168,7 @@ def deploy(args, config, basepath, workspace): if args.strip and not args.dry_run: # Fakeroot copy to new destination srcdir = recipe_outdir - recipe_outdir = os.path.join(rd.getVar('WORKDIR'), 'deploy-target-stripped') + recipe_outdir = os.path.join(rd.getVar('WORKDIR'), 'devtool-deploy-target-stripped') if os.path.isdir(recipe_outdir): bb.utils.remove(recipe_outdir, True) exec_fakeroot(rd, "cp -af %s %s" % (os.path.join(srcdir, '.'), recipe_outdir), shell=True) diff --git a/poky/scripts/lib/devtool/upgrade.py b/poky/scripts/lib/devtool/upgrade.py index 24e3700ece..da1456a01a 100644 --- a/poky/scripts/lib/devtool/upgrade.py +++ b/poky/scripts/lib/devtool/upgrade.py @@ -261,21 +261,20 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, srcbranch, branch, kee 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 - try: - __run('git rebase %s' % rev) - except bb.process.ExecutionError as e: - skiptag = True - if 'conflict' in e.stdout: - 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.warning('Command \'%s\' failed:\n%s' % (e.command, e.stdout)) - if not skiptag: - if uri.startswith('git://') or uri.startswith('gitsm://'): - suffix = 'new' - else: - suffix = newpv - __run('git tag -f devtool-patched-%s' % suffix) + (stdout, _) = __run('git branch --list devtool-override-*') + branches_to_rebase = [branch] + stdout.split() + for b in branches_to_rebase: + logger.info("Rebasing {} onto {}".format(b, rev)) + __run('git checkout %s' % b) + try: + __run('git rebase %s' % rev) + except bb.process.ExecutionError as e: + if 'conflict' in e.stdout: + 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())) + __run('git rebase --abort') + else: + logger.warning('Command \'%s\' failed:\n%s' % (e.command, e.stdout)) + __run('git checkout %s' % branch) if tmpsrctree: if keep_temp: @@ -522,6 +521,15 @@ def upgrade(args, config, basepath, workspace): else: srctree = standard.get_default_srctree(config, pn) + # Check that recipe isn't using a shared workdir + s = os.path.abspath(rd.getVar('S')) + workdir = os.path.abspath(rd.getVar('WORKDIR')) + srctree_s = srctree + if s.startswith(workdir) and s != workdir and os.path.dirname(s) != workdir: + # Handle if S is set to a subdirectory of the source + srcsubdir = os.path.relpath(s, workdir).split(os.sep, 1)[1] + srctree_s = os.path.join(srctree, srcsubdir) + # try to automatically discover latest version and revision if not provided on command line if not args.version and not args.srcrev: version_info = oe.recipeutils.get_recipe_upstream_version(rd) @@ -551,12 +559,12 @@ def upgrade(args, config, basepath, workspace): try: logger.info('Extracting current version source...') rev1, srcsubdir1 = standard._extract_source(srctree, False, 'devtool-orig', False, config, basepath, workspace, args.fixed_setup, rd, tinfoil, no_overrides=args.no_overrides) - old_licenses = _extract_licenses(srctree, (rd.getVar('LIC_FILES_CHKSUM') or "")) + old_licenses = _extract_licenses(srctree_s, (rd.getVar('LIC_FILES_CHKSUM') or "")) logger.info('Extracting upgraded version source...') rev2, md5, sha256, srcbranch, srcsubdir2 = _extract_new_source(args.version, srctree, args.no_patch, args.srcrev, args.srcbranch, args.branch, args.keep_temp, tinfoil, rd) - new_licenses = _extract_licenses(srctree, (rd.getVar('LIC_FILES_CHKSUM') or "")) + new_licenses = _extract_licenses(srctree_s, (rd.getVar('LIC_FILES_CHKSUM') or "")) license_diff = _generate_license_diff(old_licenses, new_licenses) rf, copied = _create_new_recipe(args.version, md5, sha256, args.srcrev, srcbranch, srcsubdir1, srcsubdir2, config.workspace_path, tinfoil, rd, license_diff, new_licenses, srctree, args.keep_failure) except bb.process.CmdError as e: @@ -565,7 +573,7 @@ def upgrade(args, config, basepath, workspace): _upgrade_error(e, rf, srctree, args.keep_failure) standard._add_md5(config, pn, os.path.dirname(rf)) - af = _write_append(rf, srctree, args.same_dir, args.no_same_dir, rev2, + af = _write_append(rf, srctree_s, args.same_dir, args.no_same_dir, rev2, copied, config.workspace_path, rd) standard._add_md5(config, pn, af) diff --git a/poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py index f2639e7004..32e47f1831 100644 --- a/poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py +++ b/poky/scripts/lib/wic/plugins/source/bootimg-pcbios.py @@ -186,8 +186,10 @@ class BootimgPcbiosPlugin(SourcePlugin): # dosfs image, created by mkdosfs bootimg = "%s/boot%s.img" % (cr_workdir, part.lineno) - dosfs_cmd = "mkdosfs -n boot -i %s -S 512 -C %s %d" % \ - (part.fsuuid, bootimg, blocks) + label = part.label if part.label else "boot" + + dosfs_cmd = "mkdosfs -n %s -i %s -S 512 -C %s %d" % \ + (label, part.fsuuid, bootimg, blocks) exec_native_cmd(dosfs_cmd, native_sysroot) mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir) diff --git a/poky/scripts/oe-time-dd-test.sh b/poky/scripts/oe-time-dd-test.sh index ccdd55e66e..386de83dce 100755 --- a/poky/scripts/oe-time-dd-test.sh +++ b/poky/scripts/oe-time-dd-test.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # oe-time-dd-test records how much time it takes to # write <count> number of kilobytes to the filesystem. @@ -8,23 +8,24 @@ # The purporse of this script is to find which part of # the build system puts stress on the filesystem io and # log all the processes. - usage() { - echo "Usage: $0 <count>" -} - -TIMEOUT=15 + echo "$0 is used to detect i/o latency and runs commands to display host information." + echo "The following commands are run in order:" + echo "1) top -c -b -n1 -w 512" + echo "2) iostat -y -z -x 5 1" + echo "3) tail -30 tmp*/log/cooker/*/console-latest.log to gather cooker log." + echo " " + echo "Options:" + echo "-c | --count <amount> dd (transfer) <amount> KiB of data within specified timeout to detect latency." + echo " Must enable -t option." + echo "-t | --timeout <time> timeout in seconds for the <count> amount of data to be transferred." + echo "-l | --log-only run the commands without performing the data transfer." + echo "-h | --help show help" -if [ $# -ne 1 ]; then - usage - exit 1 -fi +} -uptime -timeout ${TIMEOUT} dd if=/dev/zero of=oe-time-dd-test.dat bs=1024 count=$1 conv=fsync -if [ $? -ne 0 ]; then - echo "Timeout used: ${TIMEOUT}" - echo "start: top output" +run_cmds() { + echo "start: top output" top -c -b -n1 -w 512 echo "end: top output" echo "start: iostat" @@ -33,4 +34,69 @@ if [ $? -ne 0 ]; then echo "start: cooker log" tail -30 tmp*/log/cooker/*/console-latest.log echo "end: cooker log" +} + +if [ $# -lt 1 ]; then + usage + exit 1 +fi + +re_c='^[0-9]+$' +#re_t='^[0-9]+([.][0-9]+)?$' + +while [[ $# -gt 0 ]]; do + key="$1" + + case $key in + -c|--count) + COUNT=$2 + shift + shift + if ! [[ $COUNT =~ $re_c ]] || [[ $COUNT -le 0 ]] ; then + usage + exit 1 + fi + ;; + -t|--timeout) + TIMEOUT=$2 + shift + shift + if ! [[ $TIMEOUT =~ $re_c ]] || [[ $TIMEOUT -le 0 ]] ; then + usage + exit 1 + fi + ;; + -l|--log-only) + LOG_ONLY="true" + shift + shift + ;; + -h|--help) + usage + exit 0 + ;; + *) + usage + exit 1 + ;; + esac +done + + +if [ "$LOG_ONLY" = "true" ] ; then + uptime + run_cmds + exit +fi + +if [ -z ${TIMEOUT+x} ] || [ -z ${COUNT+x} ] ; then + usage + exit 1 +fi + +uptime +echo "Timeout used: ${TIMEOUT}" +timeout ${TIMEOUT} dd if=/dev/zero of=oe-time-dd-test.dat bs=1024 count=${COUNT} conv=fsync +if [ $? -ne 0 ]; then + run_cmds fi diff --git a/poky/scripts/runqemu b/poky/scripts/runqemu index 1f332ef525..2914f15d06 100755 --- a/poky/scripts/runqemu +++ b/poky/scripts/runqemu @@ -233,9 +233,12 @@ class BaseConfig(object): def release_taplock(self): if self.taplock_descriptor: logger.debug("Releasing lockfile for tap device '%s'" % self.tap) - fcntl.flock(self.taplock_descriptor, fcntl.LOCK_UN) + # We pass the fd to the qemu process and if we unlock here, it would unlock for + # that too. Therefore don't unlock, just close + # fcntl.flock(self.taplock_descriptor, fcntl.LOCK_UN) self.taplock_descriptor.close() - os.remove(self.taplock) + # Removing the file is a potential race, don't do that either + # os.remove(self.taplock) self.taplock_descriptor = None def check_free_port(self, host, port, lockdir): @@ -273,17 +276,23 @@ class BaseConfig(object): def release_portlock(self, lockfile=None): if lockfile != None: - logger.debug("Releasing lockfile '%s'" % lockfile) - fcntl.flock(self.portlocks[lockfile], fcntl.LOCK_UN) - self.portlocks[lockfile].close() - os.remove(lockfile) - del self.portlocks[lockfile] + logger.debug("Releasing lockfile '%s'" % lockfile) + # We pass the fd to the qemu process and if we unlock here, it would unlock for + # that too. Therefore don't unlock, just close + # fcntl.flock(self.portlocks[lockfile], fcntl.LOCK_UN) + self.portlocks[lockfile].close() + # Removing the file is a potential race, don't do that either + # os.remove(lockfile) + del self.portlocks[lockfile] elif len(self.portlocks): for lockfile, descriptor in self.portlocks.items(): logger.debug("Releasing lockfile '%s'" % lockfile) - fcntl.flock(descriptor, fcntl.LOCK_UN) + # We pass the fd to the qemu process and if we unlock here, it would unlock for + # that too. Therefore don't unlock, just close + # fcntl.flock(descriptor, fcntl.LOCK_UN) descriptor.close() - os.remove(lockfile) + # Removing the file is a potential race, don't do that either + # os.remove(lockfile) self.portlocks = {} def get(self, key): |