summaryrefslogtreecommitdiff
path: root/tsp/scripts
diff options
context:
space:
mode:
authorAleksander Mistewicz <a.mistewicz@samsung.com>2016-11-04 10:05:36 (GMT)
committerAleksander Mistewicz <a.mistewicz@samsung.com>2017-01-16 10:07:48 (GMT)
commite54b9b8fc5197c32d02cfab7a17e30effe3b20df (patch)
tree3a44982e21335c2be5268b75e8ffbfc169aeb546 /tsp/scripts
parent3c368184c138a3c0268aedae3f24edace66deae4 (diff)
downloadmajor-e54b9b8fc5197c32d02cfab7a17e30effe3b20df.zip
major-e54b9b8fc5197c32d02cfab7a17e30effe3b20df.tar.gz
major-e54b9b8fc5197c32d02cfab7a17e30effe3b20df.tar.bz2
Add --map argument to tsp/scripts/download_all.pyrefs/changes/17/108717/3
Add tsp/image_map.example Change-Id: Ic35154314076253696e20972835adb0e4d97a48b Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
Diffstat (limited to 'tsp/scripts')
-rwxr-xr-xtsp/scripts/download_all.py31
1 files changed, 25 insertions, 6 deletions
diff --git a/tsp/scripts/download_all.py b/tsp/scripts/download_all.py
index 82c06f2..feb0656 100755
--- a/tsp/scripts/download_all.py
+++ b/tsp/scripts/download_all.py
@@ -238,9 +238,10 @@ class Downloader(threading.Thread):
class ImageDownloader(object):
- def __init__(self, url, dry):
+ def __init__(self, url, dry, mapping=None):
self.url = url
self.dry = dry
+ self.mapping = mapping
self.img_ver = ImageVersion(url)
self.diff_report_filename = "diff.report"
@@ -270,10 +271,25 @@ class ImageDownloader(object):
work = threading.Event()
work.set()
signal.signal(signal.SIGINT, handler)
- for url in self.urls:
- dwn = Downloader(work, self.img_ver, s, url)
- dwn.start()
- downloaders.add(dwn)
+
+ if self.mapping:
+ with open(self.mapping, 'r') as f:
+ mapped = f.read().splitlines()
+ logging.debug(mapped)
+
+ for url in self.urls:
+ for image in mapped:
+ if image in url:
+ dwn = Downloader(work, self.img_ver, s, url)
+ dwn.start()
+ downloaders.add(dwn)
+ break
+ else:
+ for url in self.urls:
+ dwn = Downloader(work, self.img_ver, s, url)
+ dwn.start()
+ downloaders.add(dwn)
+
for dwn in downloaders:
dwn.join()
@@ -292,6 +308,9 @@ def parse_arguments():
parser.add_argument("url", metavar='<url>', type=str,
help='URL of prerelease or snapshot to download images from.')
+ parser.add_argument("-m", "--map", type=str,
+ help='Path to file with list of images to download')
+
parser.add_argument("-d", "--dry-run",
action="store_true", dest="dry",
help="Dry run - do not actually download images")
@@ -312,7 +331,7 @@ def main():
raise ValueError('Invalid log level: %s' % args.loglevel)
logging.basicConfig(format='%(asctime)s %(message)s',level=numeric_level)
logging.debug("Begin")
- ImageDownloader(args.url, args.dry)
+ ImageDownloader(args.url, args.dry, mapping=args.map)
logging.debug("End")
if __name__ == '__main__':