File enforce-architecture.patch of Package python-ec2uploadimg.9843

--- ec2uploadimg.orig
+++ ec2uploadimg
@@ -97,7 +97,7 @@ argparse.add_argument(
 argparse.add_argument(
     '-m', '--machine',
     dest='arch',
-    help='Machine architecture i386|x86_64 for the uploaded image',
+    help='Machine architecture arm64|i386|x86_64 for the uploaded image',
     metavar='ARCH',
     required=True
 )
@@ -303,6 +303,12 @@ if not secret_key:
     print >> sys.stderr, 'Could not determine account secret access key'
     sys.exit(1)
 
+supported_arch = ['arm64', 'i386', 'x86_64']
+if args.arch not in supported_arch:
+    msg = 'Specified architecture must be one of %s' % str(supported_arch)
+    print >> sys.stderr, msg
+    sys.exit(1)
+
 sriov_type = args.sriov
 if sriov_type:
     sriov_type = 'simple'
@@ -385,6 +391,10 @@ try:
                 except:
                     print >> sys.stderr, 'Could not find bootkernel in config'
                     sys.exit(1)
+            elif args.arch == 'arm64' and args.virtType != 'hvm':
+                msg = 'Images for arm64 must use hvm virtualization'
+                print >> sys.stderr, msg
+                sys.exit(1)
             else:
                 print >> sys.stderr, 'Could not reliable determine the ',
                 print >> sys.stderr, 'bootkernel to use '
openSUSE Build Service is sponsored by