diff options
author | Martin Jansa <Martin.Jansa@gmail.com> | 2023-03-13 13:15:40 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-03-22 13:53:29 +0000 |
commit | 92c9dfe1d3f253323482199a8a5a39816492ec2f (patch) | |
tree | 1f5bdc7b415db7fecf5eed6472905b656f0e4a9c /scripts/runqemu | |
parent | 752d8ab3edff6363c5e437dc0062c917e21fb30e (diff) | |
download | poky-92c9dfe1d3f253323482199a8a5a39816492ec2f.tar.gz |
runqemu: get_first_file() rename cmd* to glob*
* to better indicate how it's used in get_first_file
* cmd* is used in other places for actual shell commands
to execute
* RunQemuError('KERNEL not found: %s, %s or %s' % cmds)
also looked weird to me, but that works (to my python-noob surprise)
[YOCTO #12937]
(From OE-Core rev: 7c26e9dcc999a7d6a365831c39d25d98890be6d0)
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-x | scripts/runqemu | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index 38aa35fdd4..23bd440cc4 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
@@ -117,10 +117,10 @@ def check_tun(): | |||
117 | if not os.access(dev_tun, os.W_OK): | 117 | if not os.access(dev_tun, os.W_OK): |
118 | raise RunQemuError("TUN control device %s is not writable, please fix (e.g. sudo chmod 666 %s)" % (dev_tun, dev_tun)) | 118 | raise RunQemuError("TUN control device %s is not writable, please fix (e.g. sudo chmod 666 %s)" % (dev_tun, dev_tun)) |
119 | 119 | ||
120 | def get_first_file(cmds): | 120 | def get_first_file(globs): |
121 | """Return first file found in wildcard cmds""" | 121 | """Return first file found in wildcard globs""" |
122 | for cmd in cmds: | 122 | for g in globs: |
123 | all_files = glob.glob(cmd) | 123 | all_files = glob.glob(g) |
124 | if all_files: | 124 | if all_files: |
125 | for f in all_files: | 125 | for f in all_files: |
126 | if not os.path.isdir(f): | 126 | if not os.path.isdir(f): |
@@ -683,12 +683,12 @@ class BaseConfig(object): | |||
683 | self.rootfs, self.get('MACHINE'), | 683 | self.rootfs, self.get('MACHINE'), |
684 | self.fstype) | 684 | self.fstype) |
685 | elif not self.rootfs: | 685 | elif not self.rootfs: |
686 | cmd_name = '%s/%s*.%s' % (self.get('DEPLOY_DIR_IMAGE'), self.get('IMAGE_NAME'), self.fstype) | 686 | glob_name = '%s/%s*.%s' % (self.get('DEPLOY_DIR_IMAGE'), self.get('IMAGE_NAME'), self.fstype) |
687 | cmd_link = '%s/%s*.%s' % (self.get('DEPLOY_DIR_IMAGE'), self.get('IMAGE_LINK_NAME'), self.fstype) | 687 | glob_link = '%s/%s*.%s' % (self.get('DEPLOY_DIR_IMAGE'), self.get('IMAGE_LINK_NAME'), self.fstype) |
688 | cmds = (cmd_name, cmd_link) | 688 | globs = (glob_name, glob_link) |
689 | self.rootfs = get_first_file(cmds) | 689 | self.rootfs = get_first_file(globs) |
690 | if not self.rootfs: | 690 | if not self.rootfs: |
691 | raise RunQemuError("Failed to find rootfs: %s or %s" % cmds) | 691 | raise RunQemuError("Failed to find rootfs: %s or %s" % globs) |
692 | 692 | ||
693 | if not os.path.exists(self.rootfs): | 693 | if not os.path.exists(self.rootfs): |
694 | raise RunQemuError("Can't find rootfs: %s" % self.rootfs) | 694 | raise RunQemuError("Can't find rootfs: %s" % self.rootfs) |
@@ -748,10 +748,10 @@ class BaseConfig(object): | |||
748 | kernel_match_name = "%s/%s" % (deploy_dir_image, kernel_name) | 748 | kernel_match_name = "%s/%s" % (deploy_dir_image, kernel_name) |
749 | kernel_match_link = "%s/%s" % (deploy_dir_image, self.get('KERNEL_IMAGETYPE')) | 749 | kernel_match_link = "%s/%s" % (deploy_dir_image, self.get('KERNEL_IMAGETYPE')) |
750 | kernel_startswith = "%s/%s*" % (deploy_dir_image, self.get('KERNEL_IMAGETYPE')) | 750 | kernel_startswith = "%s/%s*" % (deploy_dir_image, self.get('KERNEL_IMAGETYPE')) |
751 | cmds = (kernel_match_name, kernel_match_link, kernel_startswith) | 751 | globs = (kernel_match_name, kernel_match_link, kernel_startswith) |
752 | self.kernel = get_first_file(cmds) | 752 | self.kernel = get_first_file(globs) |
753 | if not self.kernel: | 753 | if not self.kernel: |
754 | raise RunQemuError('KERNEL not found: %s, %s or %s' % cmds) | 754 | raise RunQemuError('KERNEL not found: %s, %s or %s' % globs) |
755 | 755 | ||
756 | if not os.path.exists(self.kernel): | 756 | if not os.path.exists(self.kernel): |
757 | raise RunQemuError("KERNEL %s not found" % self.kernel) | 757 | raise RunQemuError("KERNEL %s not found" % self.kernel) |
@@ -768,13 +768,13 @@ class BaseConfig(object): | |||
768 | dtb = self.get('QB_DTB') | 768 | dtb = self.get('QB_DTB') |
769 | if dtb: | 769 | if dtb: |
770 | deploy_dir_image = self.get('DEPLOY_DIR_IMAGE') | 770 | deploy_dir_image = self.get('DEPLOY_DIR_IMAGE') |
771 | cmd_match = "%s/%s" % (deploy_dir_image, dtb) | 771 | glob_match = "%s/%s" % (deploy_dir_image, dtb) |
772 | cmd_startswith = "%s/%s*" % (deploy_dir_image, dtb) | 772 | glob_startswith = "%s/%s*" % (deploy_dir_image, dtb) |
773 | cmd_wild = "%s/*.dtb" % deploy_dir_image | 773 | glob_wild = "%s/*.dtb" % deploy_dir_image |
774 | cmds = (cmd_match, cmd_startswith, cmd_wild) | 774 | globs = (glob_match, glob_startswith, glob_wild) |
775 | self.dtb = get_first_file(cmds) | 775 | self.dtb = get_first_file(globs) |
776 | if not os.path.exists(self.dtb): | 776 | if not os.path.exists(self.dtb): |
777 | raise RunQemuError('DTB not found: %s, %s or %s' % cmds) | 777 | raise RunQemuError('DTB not found: %s, %s or %s' % globs) |
778 | 778 | ||
779 | def check_bios(self): | 779 | def check_bios(self): |
780 | """Check and set bios""" | 780 | """Check and set bios""" |