diff options
Diffstat (limited to 'scripts/cleanup-workdir')
-rwxr-xr-x | scripts/cleanup-workdir | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/scripts/cleanup-workdir b/scripts/cleanup-workdir index 01ebd526e3..fee464c31d 100755 --- a/scripts/cleanup-workdir +++ b/scripts/cleanup-workdir | |||
@@ -27,7 +27,7 @@ obsolete_dirs = [] | |||
27 | parser = None | 27 | parser = None |
28 | 28 | ||
29 | def err_quit(msg): | 29 | def err_quit(msg): |
30 | print msg | 30 | print(msg) |
31 | parser.print_usage() | 31 | parser.print_usage() |
32 | sys.exit(1) | 32 | sys.exit(1) |
33 | 33 | ||
@@ -43,7 +43,7 @@ def run_command(cmd): | |||
43 | pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) | 43 | pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) |
44 | output = pipe.communicate()[0] | 44 | output = pipe.communicate()[0] |
45 | if pipe.returncode != 0: | 45 | if pipe.returncode != 0: |
46 | print "Execute command '%s' failed." % cmd | 46 | print("Execute command '%s' failed." % cmd) |
47 | sys.exit(1) | 47 | sys.exit(1) |
48 | return output | 48 | return output |
49 | 49 | ||
@@ -84,7 +84,7 @@ will be deleted. Be CAUTIOUS.""") | |||
84 | if os.getcwd() != builddir: | 84 | if os.getcwd() != builddir: |
85 | err_quit("Please run %s under: %s\n" % (os.path.basename(args[0]), builddir)) | 85 | err_quit("Please run %s under: %s\n" % (os.path.basename(args[0]), builddir)) |
86 | 86 | ||
87 | print 'Updating bitbake caches...' | 87 | print('Updating bitbake caches...') |
88 | cmd = "bitbake -s" | 88 | cmd = "bitbake -s" |
89 | output = run_command(cmd) | 89 | output = run_command(cmd) |
90 | 90 | ||
@@ -129,13 +129,13 @@ will be deleted. Be CAUTIOUS.""") | |||
129 | 129 | ||
130 | # won't fail just in case | 130 | # won't fail just in case |
131 | if not tmpdir or not image_rootfs: | 131 | if not tmpdir or not image_rootfs: |
132 | print "Can't get TMPDIR or IMAGE_ROOTFS." | 132 | print("Can't get TMPDIR or IMAGE_ROOTFS.") |
133 | return 1 | 133 | return 1 |
134 | 134 | ||
135 | pattern = tmpdir + '/(.*?)/(.*?)/' | 135 | pattern = tmpdir + '/(.*?)/(.*?)/' |
136 | m = re.match(pattern, image_rootfs) | 136 | m = re.match(pattern, image_rootfs) |
137 | if not m: | 137 | if not m: |
138 | print "Can't get WORKDIR." | 138 | print("Can't get WORKDIR.") |
139 | return 1 | 139 | return 1 |
140 | 140 | ||
141 | workdir = os.path.join(tmpdir, m.group(1)) | 141 | workdir = os.path.join(tmpdir, m.group(1)) |
@@ -178,13 +178,13 @@ will be deleted. Be CAUTIOUS.""") | |||
178 | break | 178 | break |
179 | 179 | ||
180 | for d in obsolete_dirs: | 180 | for d in obsolete_dirs: |
181 | print "Deleting %s" % d | 181 | print("Deleting %s" % d) |
182 | shutil.rmtree(d, True) | 182 | shutil.rmtree(d, True) |
183 | 183 | ||
184 | if len(obsolete_dirs): | 184 | if len(obsolete_dirs): |
185 | print '\nTotal %d items.' % len(obsolete_dirs) | 185 | print('\nTotal %d items.' % len(obsolete_dirs)) |
186 | else: | 186 | else: |
187 | print '\nNo obsolete directory found under %s.' % workdir | 187 | print('\nNo obsolete directory found under %s.' % workdir) |
188 | 188 | ||
189 | return 0 | 189 | return 0 |
190 | 190 | ||