Add arch arg to download_image.py 25/69725/17
authorAleksander Mistewicz <a.mistewicz@samsung.com>
Fri, 13 May 2016 11:58:40 +0000 (13:58 +0200)
committerAleksander Mistewicz <a.mistewicz@samsung.com>
Mon, 11 Jul 2016 08:29:46 +0000 (10:29 +0200)
Change-Id: I4cf908205b9dcbd242d2df4405c3aaade6f120eb
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
tsp/scripts/download_image.py

index 28d1803..5678f86 100755 (executable)
@@ -26,7 +26,7 @@ import re
 import urllib2
 import argparse
 
-__version__ = "0.1.2"
+__version__ = "0.2.1"
 __license__ = "APACHE-2.0"
 __author__ = "Aleksander Mistewicz"
 __author_email__ = "a.mistewicz@samsung.com"
@@ -100,10 +100,14 @@ class ImageDownloader:
     BOOT_NAME = "common-boot-armv7l-odroidu3"
     USR_NAME = "common-wayland-3parts-armv7l-odroidu3"
 
-    BASE_IA32_WAYLAND = "images/ia32-wayland/"
-    IA32_NAME = "common-wayland-efi-i586"
+    def __init__(self, url, arch):
+        if not arch or "i586" in arch:
+            self.BASE_MINNOW_WAYLAND = "images/ia32-wayland/"
+            self.MINNOW_NAME = "common-wayland-efi-i586"
+        else:
+            self.BASE_MINNOW_WAYLAND = "images/x86_64-wayland/"
+            self.MINNOW_NAME = "common-wayland-efi-x86_64"
 
-    def __init__(self, url):
         self.url = url
 
         img_ver = ImageVersion(url)
@@ -124,13 +128,13 @@ class ImageDownloader:
                 + self.snap_nr + "/" + self.BASE_ARM_WAYLAND + self.USR_NAME \
                 + "/tizen-common_" + self.snap_nr + "_" + self.USR_NAME + ".packages"
 
-        minnow_common_ia32_prefix = self.url + self.BASE_IA32_WAYLAND + self.IA32_NAME
-        self.minnow_usr_path = minnow_common_ia32_prefix \
-                + "/tizen-common_" + self.ver_nr + "_" + self.IA32_NAME
-        self.minnow_usr_path_md5 = minnow_common_ia32_prefix + "/MD5SUMS"
+        minnow_common_minnow_prefix = self.url + self.BASE_MINNOW_WAYLAND + self.MINNOW_NAME
+        self.minnow_usr_path = minnow_common_minnow_prefix \
+                + "/tizen-common_" + self.ver_nr + "_" + self.MINNOW_NAME
+        self.minnow_usr_path_md5 = minnow_common_minnow_prefix + "/MD5SUMS"
         self.minnow_snap_pkgs = "http://download.tizen.org/snapshots/tizen/common/tizen-common_" \
-                + self.snap_nr + "/" + self.BASE_IA32_WAYLAND + self.IA32_NAME \
-                + "/tizen-common_" + self.snap_nr + "_" + self.IA32_NAME + ".packages"
+                + self.snap_nr + "/" + self.BASE_MINNOW_WAYLAND + self.MINNOW_NAME \
+                + "/tizen-common_" + self.snap_nr + "_" + self.MINNOW_NAME + ".packages"
 
         print self.snap_nr, self.ver_nr
         print self.odroid_boot_path
@@ -242,6 +246,10 @@ def parse_arguments():
             action="store_true", default=False, dest="odroid",
             help="Download images for odroid")
 
+    parser.add_argument("-a", "--arch",
+            action="store", dest="arch",
+            help="Choose architecture of minnowboard images")
+
     args = parser.parse_args()
 
     return args
@@ -249,7 +257,7 @@ def parse_arguments():
 def main():
     print "Begin"
     args = parse_arguments()
-    downloader = ImageDownloader(args.url)
+    downloader = ImageDownloader(args.url, args.arch)
     if args.odroid:
         downloader.odroid()
     if args.minnow: