diff options
Diffstat (limited to 'scripts/wic')
| -rwxr-xr-x | scripts/wic | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/scripts/wic b/scripts/wic index 2286f20a96..11c8316b97 100755 --- a/scripts/wic +++ b/scripts/wic | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | # AUTHORS | 28 | # AUTHORS |
| 29 | # Tom Zanussi <tom.zanussi (at] linux.intel.com> | 29 | # Tom Zanussi <tom.zanussi (at] linux.intel.com> |
| 30 | # | 30 | # |
| 31 | from __future__ import print_function | ||
| 31 | 32 | ||
| 32 | __version__ = "0.2.0" | 33 | __version__ = "0.2.0" |
| 33 | 34 | ||
| @@ -140,8 +141,8 @@ def wic_create_subcommand(args, usage_str): | |||
| 140 | if not val: | 141 | if not val: |
| 141 | missed.append(opt) | 142 | missed.append(opt) |
| 142 | if missed: | 143 | if missed: |
| 143 | print "The following build artifacts are not specified:" | 144 | print("The following build artifacts are not specified:") |
| 144 | print " " + ", ".join(missed) | 145 | print(" " + ", ".join(missed)) |
| 145 | sys.exit(1) | 146 | sys.exit(1) |
| 146 | 147 | ||
| 147 | if options.image_name: | 148 | if options.image_name: |
| @@ -153,12 +154,12 @@ def wic_create_subcommand(args, usage_str): | |||
| 153 | BB_VARS.vars_dir = options.vars_dir | 154 | BB_VARS.vars_dir = options.vars_dir |
| 154 | 155 | ||
| 155 | if options.build_check: | 156 | if options.build_check: |
| 156 | print "Checking basic build environment..." | 157 | print("Checking basic build environment...") |
| 157 | if not engine.verify_build_env(): | 158 | if not engine.verify_build_env(): |
| 158 | print "Couldn't verify build environment, exiting\n" | 159 | print("Couldn't verify build environment, exiting\n") |
| 159 | sys.exit(1) | 160 | sys.exit(1) |
| 160 | else: | 161 | else: |
| 161 | print "Done.\n" | 162 | print("Done.\n") |
| 162 | 163 | ||
| 163 | bootimg_dir = "" | 164 | bootimg_dir = "" |
| 164 | 165 | ||
| @@ -168,7 +169,7 @@ def wic_create_subcommand(args, usage_str): | |||
| 168 | if options.debug: | 169 | if options.debug: |
| 169 | argv.append("--debug") | 170 | argv.append("--debug") |
| 170 | 171 | ||
| 171 | print "Building rootfs...\n" | 172 | print("Building rootfs...\n") |
| 172 | if bitbake_main(BitBakeConfigParameters(argv), | 173 | if bitbake_main(BitBakeConfigParameters(argv), |
| 173 | cookerdata.CookerConfiguration()): | 174 | cookerdata.CookerConfiguration()): |
| 174 | sys.exit(1) | 175 | sys.exit(1) |
| @@ -179,7 +180,7 @@ def wic_create_subcommand(args, usage_str): | |||
| 179 | options.image_name) | 180 | options.image_name) |
| 180 | else: | 181 | else: |
| 181 | if options.build_rootfs: | 182 | if options.build_rootfs: |
| 182 | print "Image name is not specified, exiting. (Use -e/--image-name to specify it)\n" | 183 | print("Image name is not specified, exiting. (Use -e/--image-name to specify it)\n") |
| 183 | sys.exit(1) | 184 | sys.exit(1) |
| 184 | 185 | ||
| 185 | wks_file = args[0] | 186 | wks_file = args[0] |
| @@ -187,9 +188,9 @@ def wic_create_subcommand(args, usage_str): | |||
| 187 | if not wks_file.endswith(".wks"): | 188 | if not wks_file.endswith(".wks"): |
| 188 | wks_file = engine.find_canned_image(scripts_path, wks_file) | 189 | wks_file = engine.find_canned_image(scripts_path, wks_file) |
| 189 | if not wks_file: | 190 | if not wks_file: |
| 190 | print "No image named %s found, exiting. (Use 'wic list images' "\ | 191 | print("No image named %s found, exiting. (Use 'wic list images' "\ |
| 191 | "to list available images, or specify a fully-qualified OE "\ | 192 | "to list available images, or specify a fully-qualified OE "\ |
| 192 | "kickstart (.wks) filename)\n" % args[0] | 193 | "kickstart (.wks) filename)\n" % args[0]) |
| 193 | sys.exit(1) | 194 | sys.exit(1) |
| 194 | 195 | ||
| 195 | image_output_dir = "" | 196 | image_output_dir = "" |
| @@ -204,16 +205,16 @@ def wic_create_subcommand(args, usage_str): | |||
| 204 | kernel_dir = options.kernel_dir | 205 | kernel_dir = options.kernel_dir |
| 205 | native_sysroot = options.native_sysroot | 206 | native_sysroot = options.native_sysroot |
| 206 | if rootfs_dir and not os.path.isdir(rootfs_dir): | 207 | if rootfs_dir and not os.path.isdir(rootfs_dir): |
| 207 | print "--roofs-dir (-r) not found, exiting\n" | 208 | print("--roofs-dir (-r) not found, exiting\n") |
| 208 | sys.exit(1) | 209 | sys.exit(1) |
| 209 | if not os.path.isdir(bootimg_dir): | 210 | if not os.path.isdir(bootimg_dir): |
| 210 | print "--bootimg-dir (-b) not found, exiting\n" | 211 | print("--bootimg-dir (-b) not found, exiting\n") |
| 211 | sys.exit(1) | 212 | sys.exit(1) |
| 212 | if not os.path.isdir(kernel_dir): | 213 | if not os.path.isdir(kernel_dir): |
| 213 | print "--kernel-dir (-k) not found, exiting\n" | 214 | print("--kernel-dir (-k) not found, exiting\n") |
| 214 | sys.exit(1) | 215 | sys.exit(1) |
| 215 | if not os.path.isdir(native_sysroot): | 216 | if not os.path.isdir(native_sysroot): |
| 216 | print "--native-sysroot (-n) not found, exiting\n" | 217 | print("--native-sysroot (-n) not found, exiting\n") |
| 217 | sys.exit(1) | 218 | sys.exit(1) |
| 218 | else: | 219 | else: |
| 219 | not_found = not_found_dir = "" | 220 | not_found = not_found_dir = "" |
| @@ -226,12 +227,12 @@ def wic_create_subcommand(args, usage_str): | |||
| 226 | if not_found: | 227 | if not_found: |
| 227 | if not not_found_dir: | 228 | if not not_found_dir: |
| 228 | not_found_dir = "Completely missing artifact - wrong image (.wks) used?" | 229 | not_found_dir = "Completely missing artifact - wrong image (.wks) used?" |
| 229 | print "Build artifacts not found, exiting." | 230 | print("Build artifacts not found, exiting.") |
| 230 | print " (Please check that the build artifacts for the machine" | 231 | print(" (Please check that the build artifacts for the machine") |
| 231 | print " selected in local.conf actually exist and that they" | 232 | print(" selected in local.conf actually exist and that they") |
| 232 | print " are the correct artifacts for the image (.wks file)).\n" | 233 | print(" are the correct artifacts for the image (.wks file)).\n") |
| 233 | print "The artifact that couldn't be found was %s:\n %s" % \ | 234 | print("The artifact that couldn't be found was %s:\n %s" % \ |
| 234 | (not_found, not_found_dir) | 235 | (not_found, not_found_dir)) |
| 235 | sys.exit(1) | 236 | sys.exit(1) |
| 236 | 237 | ||
| 237 | krootfs_dir = options.rootfs_dir | 238 | krootfs_dir = options.rootfs_dir |
| @@ -241,7 +242,7 @@ def wic_create_subcommand(args, usage_str): | |||
| 241 | 242 | ||
| 242 | rootfs_dir = rootfs_dir_to_args(krootfs_dir) | 243 | rootfs_dir = rootfs_dir_to_args(krootfs_dir) |
| 243 | 244 | ||
| 244 | print "Creating image(s)...\n" | 245 | print("Creating image(s)...\n") |
| 245 | engine.wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, | 246 | engine.wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, |
| 246 | native_sysroot, scripts_path, image_output_dir, | 247 | native_sysroot, scripts_path, image_output_dir, |
| 247 | options.compressor, options.debug) | 248 | options.compressor, options.debug) |
| @@ -318,6 +319,6 @@ if __name__ == "__main__": | |||
| 318 | try: | 319 | try: |
| 319 | sys.exit(main(sys.argv[1:])) | 320 | sys.exit(main(sys.argv[1:])) |
| 320 | except WicError as err: | 321 | except WicError as err: |
| 321 | print >> sys.stderr, "ERROR:", err | 322 | print("ERROR:", err, file=sys.stderr) |
| 322 | sys.exit(1) | 323 | sys.exit(1) |
| 323 | 324 | ||
