]> code.ossystems Code Review - openembedded-core.git/commitdiff
scripts/cleanup-workdir: Adpat to new workdir layout
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 23 Nov 2012 20:19:56 +0000 (20:19 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 24 Nov 2012 15:12:03 +0000 (15:12 +0000)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/cleanup-workdir

index 9d161c24d1732cf20ec1535569e0f76f89e58ba6..b2408fcfc69f91f420e7d8fa4dcd483b8907aa1e 100755 (executable)
@@ -22,7 +22,7 @@ import re
 import subprocess
 import shutil
 
-pkg_cur_dirs = []
+pkg_cur_dirs = {}
 obsolete_dirs = []
 parser = None
 
@@ -101,7 +101,7 @@ will be deleted. Be CAUTIOUS.""")
             version = parse_version(elems[1])
         else:
             version = parse_version(elems[2])
-        pkg_cur_dirs.append(elems[0] + '-' + version)
+        pkg_cur_dirs[elems[0]] = version
 
     cmd = "bitbake -e"
     output = run_command(cmd)
@@ -156,6 +156,14 @@ will be deleted. Be CAUTIOUS.""")
                 for pkgdir in sorted(pkgdirs):
                     if pkgdir not in pkg_cur_dirs:
                         obsolete_dirs.append(os.path.join(pkgroot, pkgdir))
+                    else:
+                        for verroot, verdirs, verfiles in os.walk(os.path.join(pkgroot, pkgdir)):
+                            for f in verfiles:
+                                obsolete_dirs.append(os.path.join(pkgroot, f))
+                            for v in sorted(verdirs):
+                               if v not in pkg_cur_dirs[pkgdir]:
+                                   obsolete_dirs.append(os.path.join(pkgroot, pkgdir, v))
+                            break
 
                 # just process the top dir of every package under tmp/work/*/,
                 # then jump out of the above os.walk()