diff options
Diffstat (limited to 'poky/scripts')
-rwxr-xr-x | poky/scripts/create-pull-request | 7 | ||||
-rw-r--r-- | poky/scripts/lib/devtool/standard.py | 2 | ||||
-rw-r--r-- | poky/scripts/lib/devtool/upgrade.py | 2 | ||||
-rw-r--r-- | poky/scripts/lib/recipetool/create.py | 4 | ||||
-rw-r--r-- | poky/scripts/lib/resulttool/regression.py | 16 | ||||
-rw-r--r-- | poky/scripts/lib/resulttool/report.py | 5 | ||||
-rw-r--r-- | poky/scripts/lib/resulttool/resultutils.py | 6 | ||||
-rw-r--r-- | poky/scripts/lib/wic/partition.py | 2 | ||||
-rw-r--r-- | poky/scripts/lib/wic/plugins/source/bootimg-efi.py | 2 | ||||
-rwxr-xr-x | poky/scripts/oe-setup-builddir | 14 | ||||
-rwxr-xr-x | poky/scripts/runqemu | 48 | ||||
-rwxr-xr-x | poky/scripts/runqemu-gen-tapdevs | 89 | ||||
-rwxr-xr-x | poky/scripts/runqemu-ifdown | 14 | ||||
-rwxr-xr-x | poky/scripts/runqemu-ifup | 31 |
14 files changed, 139 insertions, 103 deletions
diff --git a/poky/scripts/create-pull-request b/poky/scripts/create-pull-request index 2f91a355b0..885105fab3 100755 --- a/poky/scripts/create-pull-request +++ b/poky/scripts/create-pull-request @@ -149,13 +149,10 @@ fi WEB_URL="" case "$REMOTE_URL" in *git.yoctoproject.org*) - WEB_URL="http://git.yoctoproject.org/cgit.cgi/$REMOTE_REPO/log/?h=$BRANCH" - ;; - *git.pokylinux.org*) - WEB_URL="http://git.pokylinux.org/cgit.cgi/$REMOTE_REPO/log/?h=$BRANCH" + WEB_URL="https://git.yoctoproject.org/$REMOTE_REPO/log/?h=$BRANCH" ;; *git.openembedded.org*) - WEB_URL="http://cgit.openembedded.org/$REMOTE_REPO/log/?h=$BRANCH" + WEB_URL="https://git.openembedded.org/$REMOTE_REPO/log/?h=$BRANCH" ;; *github.com*) WEB_URL="https://github.com/$REMOTE_REPO/tree/$BRANCH" diff --git a/poky/scripts/lib/devtool/standard.py b/poky/scripts/lib/devtool/standard.py index 0339d12763..abf80e2f31 100644 --- a/poky/scripts/lib/devtool/standard.py +++ b/poky/scripts/lib/devtool/standard.py @@ -1629,7 +1629,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil else: patchdir_params = {'patchdir': relpatchdir} - def srcuri_entry(fname): + def srcuri_entry(basepath): if patchdir_params: paramstr = ';' + ';'.join('%s=%s' % (k,v) for k,v in patchdir_params.items()) else: diff --git a/poky/scripts/lib/devtool/upgrade.py b/poky/scripts/lib/devtool/upgrade.py index 6c4a62b558..e015a85982 100644 --- a/poky/scripts/lib/devtool/upgrade.py +++ b/poky/scripts/lib/devtool/upgrade.py @@ -35,6 +35,8 @@ def _get_srctree(tmpdir): dirs = scriptutils.filter_src_subdirs(tmpdir) if len(dirs) == 1: srctree = os.path.join(tmpdir, dirs[0]) + else: + raise DevtoolError("Cannot determine where the source tree is after unpacking in {}: {}".format(tmpdir,dirs)) return srctree def _copy_source_code(orig, dest): diff --git a/poky/scripts/lib/recipetool/create.py b/poky/scripts/lib/recipetool/create.py index 824ac6350d..e99e0714bf 100644 --- a/poky/scripts/lib/recipetool/create.py +++ b/poky/scripts/lib/recipetool/create.py @@ -745,6 +745,10 @@ def create_recipe(args): for handler in handlers: handler.process(srctree_use, classes, lines_before, lines_after, handled, extravalues) + # native and nativesdk classes are special and must be inherited last + # If present, put them at the end of the classes list + classes.sort(key=lambda c: c in ("native", "nativesdk")) + extrafiles = extravalues.pop('extrafiles', {}) extra_pn = extravalues.pop('PN', None) extra_pv = extravalues.pop('PV', None) diff --git a/poky/scripts/lib/resulttool/regression.py b/poky/scripts/lib/resulttool/regression.py index 1facbcd85e..f80a9182a9 100644 --- a/poky/scripts/lib/resulttool/regression.py +++ b/poky/scripts/lib/resulttool/regression.py @@ -178,6 +178,8 @@ def compare_result(logger, base_name, target_name, base_result, target_result): base_result = base_result.get('result') target_result = target_result.get('result') result = {} + new_tests = 0 + if base_result and target_result: for k in base_result: base_testcase = base_result[k] @@ -189,6 +191,13 @@ def compare_result(logger, base_name, target_name, base_result, target_result): result[k] = {'base': base_status, 'target': target_status} else: logger.error('Failed to retrieved base test case status: %s' % k) + + # Also count new tests that were not present in base results: it + # could be newly added tests, but it could also highlights some tests + # renames or fixed faulty ptests + for k in target_result: + if k not in base_result: + new_tests += 1 if result: new_pass_count = sum(test['target'] is not None and test['target'].startswith("PASS") for test in result.values()) # Print a regression report only if at least one test has a regression status (FAIL, SKIPPED, absent...) @@ -200,10 +209,13 @@ def compare_result(logger, base_name, target_name, base_result, target_result): if new_pass_count > 0: resultstring += f' Additionally, {new_pass_count} previously failing test(s) is/are now passing\n' else: - resultstring = "Improvement: %s\n %s\n (+%d test(s) passing)" % (base_name, target_name, new_pass_count) + resultstring = "Improvement: %s\n %s\n (+%d test(s) passing)\n" % (base_name, target_name, new_pass_count) result = None else: - resultstring = "Match: %s\n %s" % (base_name, target_name) + resultstring = "Match: %s\n %s\n" % (base_name, target_name) + + if new_tests > 0: + resultstring += f' Additionally, {new_tests} new test(s) is/are present\n' return result, resultstring def get_results(logger, source): diff --git a/poky/scripts/lib/resulttool/report.py b/poky/scripts/lib/resulttool/report.py index f0ca50ebe2..a349510ab8 100644 --- a/poky/scripts/lib/resulttool/report.py +++ b/poky/scripts/lib/resulttool/report.py @@ -176,7 +176,10 @@ class ResultsTextReport(object): vals['sort'] = line['testseries'] + "_" + line['result_id'] vals['failed_testcases'] = line['failed_testcases'] for k in cols: - vals[k] = "%d (%s%%)" % (line[k], format(line[k] / total_tested * 100, '.0f')) + if total_tested: + vals[k] = "%d (%s%%)" % (line[k], format(line[k] / total_tested * 100, '.0f')) + else: + vals[k] = "0 (0%)" for k in maxlen: if k in vals and len(vals[k]) > maxlen[k]: maxlen[k] = len(vals[k]) diff --git a/poky/scripts/lib/resulttool/resultutils.py b/poky/scripts/lib/resulttool/resultutils.py index 7666331ba2..c5521d81bd 100644 --- a/poky/scripts/lib/resulttool/resultutils.py +++ b/poky/scripts/lib/resulttool/resultutils.py @@ -58,7 +58,11 @@ def append_resultsdata(results, f, configmap=store_map, configvars=extra_configv testseries = posixpath.basename(posixpath.dirname(url.path)) else: with open(f, "r") as filedata: - data = json.load(filedata) + try: + data = json.load(filedata) + except json.decoder.JSONDecodeError: + print("Cannot decode {}. Possible corruption. Skipping.".format(f)) + data = "" testseries = os.path.basename(os.path.dirname(f)) else: data = f diff --git a/poky/scripts/lib/wic/partition.py b/poky/scripts/lib/wic/partition.py index 382afa44bc..29b9dc4457 100644 --- a/poky/scripts/lib/wic/partition.py +++ b/poky/scripts/lib/wic/partition.py @@ -133,7 +133,7 @@ class Partition(): self.update_fstab_in_rootfs = True if not self.source: - if self.fstype == "none": + if self.fstype == "none" or self.no_table: return if not self.size and not self.fixed_size: raise WicError("The %s partition has a size of zero. Please " diff --git a/poky/scripts/lib/wic/plugins/source/bootimg-efi.py b/poky/scripts/lib/wic/plugins/source/bootimg-efi.py index d6aeab2aad..8ebb2a9be8 100644 --- a/poky/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/poky/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -351,6 +351,8 @@ class BootimgEFIPlugin(SourcePlugin): # https://www.freedesktop.org/software/systemd/man/systemd-stub.html objcopy_cmd = "%s-objcopy" % target_sys + objcopy_cmd += " --enable-deterministic-archives" + objcopy_cmd += " --preserve-dates" objcopy_cmd += " --add-section .osrel=%s/usr/lib/os-release" % staging_dir_host objcopy_cmd += " --change-section-vma .osrel=0x20000" objcopy_cmd += " --add-section .cmdline=%s" % cmdline.name diff --git a/poky/scripts/oe-setup-builddir b/poky/scripts/oe-setup-builddir index 89ae30f609..678aeac4be 100755 --- a/poky/scripts/oe-setup-builddir +++ b/poky/scripts/oe-setup-builddir @@ -98,9 +98,17 @@ EOM SHOWYPDOC=yes fi +if [ -z "$OECORENOTESCONF" ]; then + OECORENOTESCONF="$OEROOT/meta/conf/templates/default/conf-notes.txt" +fi +if [ ! -r "$BUILDDIR/conf/conf-notes.txt" ]; then + [ ! -r "$OECORENOTESCONF" ] || cp "$OECORENOTESCONF" "$BUILDDIR/conf/conf-notes.txt" +fi + # Prevent disturbing a new GIT clone in same console unset OECORELOCALCONF unset OECORELAYERCONF +unset OECORENOTESCONF # Ending the first-time run message. Show the YP Documentation banner. if [ -n "$SHOWYPDOC" ]; then @@ -116,11 +124,7 @@ EOM # unset SHOWYPDOC fi -if [ -z "$OECORENOTESCONF" ]; then - OECORENOTESCONF="$OEROOT/meta/conf/templates/default/conf-notes.txt" -fi -[ ! -r "$OECORENOTESCONF" ] || cat "$OECORENOTESCONF" -unset OECORENOTESCONF +[ ! -r "$BUILDDIR/conf/conf-notes.txt" ] || cat "$BUILDDIR/conf/conf-notes.txt" if [ ! -f "$BUILDDIR/conf/templateconf.cfg" ]; then echo "$ORG_TEMPLATECONF" >"$BUILDDIR/conf/templateconf.cfg" diff --git a/poky/scripts/runqemu b/poky/scripts/runqemu index 4c06cefbff..ef24ddc6b2 100755 --- a/poky/scripts/runqemu +++ b/poky/scripts/runqemu @@ -1011,17 +1011,14 @@ to your build configuration. else: self.nfs_server = '192.168.7.@GATEWAY@' - # Figure out a new nfs_instance to allow multiple qemus running. - ps = subprocess.check_output(("ps", "auxww")).decode('utf-8') - pattern = '/bin/unfsd .* -i .*\.pid -e .*/exports([0-9]+) ' - all_instances = re.findall(pattern, ps, re.M) - if all_instances: - all_instances.sort(key=int) - self.nfs_instance = int(all_instances.pop()) + 1 - - nfsd_port = 3049 + 2 * self.nfs_instance - mountd_port = 3048 + 2 * self.nfs_instance + nfsd_port = 3048 + self.nfs_instance + lockdir = "/tmp/qemu-port-locks" + self.make_lock_dir(lockdir) + while not self.check_free_port('localhost', nfsd_port, lockdir): + self.nfs_instance += 1 + nfsd_port += 1 + mountd_port = nfsd_port # Export vars for runqemu-export-rootfs export_dict = { 'NFS_INSTANCE': self.nfs_instance, @@ -1083,6 +1080,17 @@ to your build configuration. self.set('NETWORK_CMD', '-netdev bridge,br=%s,id=net0,helper=%s -device virtio-net-pci,netdev=net0 ' % ( self.net_bridge, os.path.join(self.bindir_native, 'qemu-oe-bridge-helper'))) + def make_lock_dir(self, lockdir): + if not os.path.exists(lockdir): + # There might be a race issue when multi runqemu processess are + # running at the same time. + try: + os.mkdir(lockdir) + os.chmod(lockdir, 0o777) + except FileExistsError: + pass + return + def setup_slirp(self): """Setup user networking""" @@ -1101,14 +1109,7 @@ to your build configuration. mac = 2 lockdir = "/tmp/qemu-port-locks" - if not os.path.exists(lockdir): - # There might be a race issue when multi runqemu processess are - # running at the same time. - try: - os.mkdir(lockdir) - os.chmod(lockdir, 0o777) - except FileExistsError: - pass + self.make_lock_dir(lockdir) # Find a free port to avoid conflicts for p in ports[:]: @@ -1148,14 +1149,7 @@ to your build configuration. logger.error("ip: %s" % ip) raise OEPathError("runqemu-ifup, runqemu-ifdown or ip not found") - if not os.path.exists(lockdir): - # There might be a race issue when multi runqemu processess are - # running at the same time. - try: - os.mkdir(lockdir) - os.chmod(lockdir, 0o777) - except FileExistsError: - pass + self.make_lock_dir(lockdir) cmd = (ip, 'link') logger.debug('Running %s...' % str(cmd)) @@ -1598,13 +1592,13 @@ to your build configuration. logger.debug('Running %s' % str(cmd)) subprocess.check_call(cmd) self.release_taplock() - self.release_portlock() if self.nfs_running: logger.info("Shutting down the userspace NFS server...") cmd = ("runqemu-export-rootfs", "stop", self.rootfs) logger.debug('Running %s' % str(cmd)) subprocess.check_call(cmd) + self.release_portlock() if self.saved_stty: subprocess.check_call(("stty", self.saved_stty)) diff --git a/poky/scripts/runqemu-gen-tapdevs b/poky/scripts/runqemu-gen-tapdevs index a6ee4517da..ffb82adce6 100755 --- a/poky/scripts/runqemu-gen-tapdevs +++ b/poky/scripts/runqemu-gen-tapdevs @@ -44,10 +44,10 @@ GID=$2 COUNT=$3 STAGING_BINDIR_NATIVE=$4 -TUNCTL=$STAGING_BINDIR_NATIVE/tunctl -if [[ ! -x "$TUNCTL" || -d "$TUNCTL" ]]; then - echo "Error: $TUNCTL is not an executable" - usage +# check if COUNT is a number and >= 0 +if ! [ $COUNT -ge 0 ]; then + echo "Error: Incorrect count: $COUNT" + exit 1 fi if [ $EUID -ne 0 ]; then @@ -62,48 +62,53 @@ if [ ! -x "$RUNQEMU_IFUP" ]; then exit 1 fi -IFCONFIG=`which ip 2> /dev/null` -if [ -z "$IFCONFIG" ]; then - # Is it ever anywhere else? - IFCONFIG=/sbin/ip -fi -if [ ! -x "$IFCONFIG" ]; then - echo "$IFCONFIG cannot be executed" - exit 1 +TUNCTL=$STAGING_BINDIR_NATIVE/tunctl +ip_supports_tuntap=false +if interfaces=`ip tuntap list` 2>/dev/null; then + ip_supports_tuntap=true + interfaces=`echo "$interfaces |cut -f1 -d:` +elif [[ ! -x "$TUNCTL" || -d "$TUNCTL" ]]; then + echo "Error: $TUNCTL is not an executable" + usage +elif interfaces=`ip link` 2>/dev/null; then + interfaces=`echo "$interfaces" | sed '/^[0-9]\+: \(docker[0-9]\+\):.*/!d; s//\1/'` +else + echo "Failed to call 'ip link'" >&2 + exit 1 fi -if [ $COUNT -ge 0 ]; then - # Ensure we start with a clean slate - for tap in `$IFCONFIG link | grep tap | awk '{ print \$2 }' | sed s/://`; do - echo "Note: Destroying pre-existing tap interface $tap..." +# Ensure we start with a clean slate +for tap in $interfaces; do + echo "Note: Destroying pre-existing tap interface $tap..." + if $ip_supports_tuntap; then + ip tuntap del $tap mode tap + else $TUNCTL -d $tap - done - rm -f /etc/runqemu-nosudo -else - echo "Error: Incorrect count: $COUNT" - exit 1 + fi +done +rm -f /etc/runqemu-nosudo + +if [ $COUNT -eq 0 ]; then + exit 0 fi -if [ $COUNT -gt 0 ]; then - echo "Creating $COUNT tap devices for UID: $TUID GID: $GID..." - for ((index=0; index < $COUNT; index++)); do - echo "Creating tap$index" - ifup=`$RUNQEMU_IFUP $TUID $GID $STAGING_BINDIR_NATIVE 2>&1` - if [ $? -ne 0 ]; then - echo "Error running tunctl: $ifup" - exit 1 - fi - done +echo "Creating $COUNT tap devices for UID: $TUID GID: $GID..." +for ((index=0; index < $COUNT; index++)); do + echo "Creating tap$index" + if ! ifup=`$RUNQEMU_IFUP $TUID $GID $STAGING_BINDIR_NATIVE 2>&1`; then + echo "Error running tunctl: $ifup" + exit 1 + fi +done - echo "Note: For systems running NetworkManager, it's recommended" - echo "Note: that the tap devices be set as unmanaged in the" - echo "Note: NetworkManager.conf file. Add the following lines to" - echo "Note: /etc/NetworkManager/NetworkManager.conf" - echo "[keyfile]" - echo "unmanaged-devices=interface-name:tap*" +echo "Note: For systems running NetworkManager, it's recommended" +echo "Note: that the tap devices be set as unmanaged in the" +echo "Note: NetworkManager.conf file. Add the following lines to" +echo "Note: /etc/NetworkManager/NetworkManager.conf" +echo "[keyfile]" +echo "unmanaged-devices=interface-name:tap*" - # The runqemu script will check for this file, and if it exists, - # will use the existing bank of tap devices without creating - # additional ones via sudo. - touch /etc/runqemu-nosudo -fi +# The runqemu script will check for this file, and if it exists, +# will use the existing bank of tap devices without creating +# additional ones via sudo. +touch /etc/runqemu-nosudo diff --git a/poky/scripts/runqemu-ifdown b/poky/scripts/runqemu-ifdown index e0eb5344c6..f72166b32b 100755 --- a/poky/scripts/runqemu-ifdown +++ b/poky/scripts/runqemu-ifdown @@ -33,13 +33,15 @@ fi TAP=$1 STAGING_BINDIR_NATIVE=$2 -TUNCTL=$STAGING_BINDIR_NATIVE/tunctl -if [ ! -e "$TUNCTL" ]; then - echo "Error: Unable to find tunctl binary in '$STAGING_BINDIR_NATIVE', please bitbake qemu-helper-native" - exit 1 -fi +if !ip tuntap del $TAP mode tap 2>/dev/null; then + TUNCTL=$STAGING_BINDIR_NATIVE/tunctl + if [ ! -e "$TUNCTL" ]; then + echo "Error: Unable to find tunctl binary in '$STAGING_BINDIR_NATIVE', please bitbake qemu-helper-native" + exit 1 + fi -$TUNCTL -d $TAP + $TUNCTL -d $TAP +fi IFCONFIG=`which ip 2> /dev/null` if [ "x$IFCONFIG" = "x" ]; then diff --git a/poky/scripts/runqemu-ifup b/poky/scripts/runqemu-ifup index bb661740c5..5fdcddeeda 100755 --- a/poky/scripts/runqemu-ifup +++ b/poky/scripts/runqemu-ifup @@ -41,22 +41,29 @@ USERID="-u $1" GROUP="-g $2" STAGING_BINDIR_NATIVE=$3 -TUNCTL=$STAGING_BINDIR_NATIVE/tunctl -if [ ! -x "$TUNCTL" ]; then - echo "Error: Unable to find tunctl binary in '$STAGING_BINDIR_NATIVE', please bitbake qemu-helper-native" - exit 1 +if taps=$(ip tuntap list 2>/dev/null); then + tap_no=$(( $(echo "$taps" |sort -r |sed 's/^tap//; s/:.*//; q') + 1 )) + ip tuntap add tap$tap_no mode tap group $2 && TAP=tap$tap_no fi -TAP=`$TUNCTL -b $GROUP 2>&1` -STATUS=$? -if [ $STATUS -ne 0 ]; then -# If tunctl -g fails, try using tunctl -u, for older host kernels -# which do not support the TUNSETGROUP ioctl - TAP=`$TUNCTL -b $USERID 2>&1` +if [ -z $TAP ]; then + TUNCTL=$STAGING_BINDIR_NATIVE/tunctl + if [ ! -x "$TUNCTL" ]; then + echo "Error: Unable to find tunctl binary in '$STAGING_BINDIR_NATIVE', please bitbake qemu-helper-native" + exit 1 + fi + + TAP=`$TUNCTL -b $GROUP 2>&1` STATUS=$? if [ $STATUS -ne 0 ]; then - echo "tunctl failed:" - exit 1 + # If tunctl -g fails, try using tunctl -u, for older host kernels + # which do not support the TUNSETGROUP ioctl + TAP=`$TUNCTL -b $USERID 2>&1` + STATUS=$? + if [ $STATUS -ne 0 ]; then + echo "tunctl failed:" + exit 1 + fi fi fi |