Fix removal of files from MD5SUMS 38/130938/3
authorAleksander Mistewicz <a.mistewicz@samsung.com>
Thu, 27 Apr 2017 14:18:09 +0000 (16:18 +0200)
committerAleksander Mistewicz <a.mistewicz@samsung.com>
Wed, 27 Sep 2017 16:58:33 +0000 (18:58 +0200)
Change-Id: I50c60113fcda7a1bd1fc11f188a891ef9f6a500a

tsp/scripts/download_all.py

index a2a67a7..4bc391d 100755 (executable)
@@ -236,9 +236,14 @@ class Downloader(threading.Thread):
         else:
             logging.warn("Checksum FAILED\nRemoving files mentioned in md5sums file")
             with open(md5_path, 'r') as f:
-                for i in f:
+                for line in f:
                     try:
-                        os.remove(self.name + "/" + i)
+                        filename = line.split('  ')
+                        if len(filename) != 2:
+                            logging.warn("Unexpected number of substrings [%d]: %s",
+                                    len(filename), line)
+                            break
+                        os.remove(self.name + "/" + filename[1])
                     except OSError as e:
                         logging.warn("rm: %s" % e.strerror)
             os.remove(md5_path)