| OLD | NEW |
| 1 #!/usr/bin/python2.6 | 1 #!/usr/bin/python2.6 |
| 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Program to run emerge in parallel, for significant speedup. | 6 """Program to run emerge in parallel, for significant speedup. |
| 7 | 7 |
| 8 Usage: | 8 Usage: |
| 9 ./parallel_emerge [--board=BOARD] [--workon=PKGS] [--no-workon-deps] | 9 ./parallel_emerge [--board=BOARD] [--workon=PKGS] [--no-workon-deps] |
| 10 [emerge args] package" | 10 [emerge args] package" |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 cache: A dict, where the results are stored. | 812 cache: A dict, where the results are stored. |
| 813 | 813 |
| 814 Returns: | 814 Returns: |
| 815 True iff the prebuilts are ready for pkg and all deps. | 815 True iff the prebuilts are ready for pkg and all deps. |
| 816 """ | 816 """ |
| 817 if pkg in cache: | 817 if pkg in cache: |
| 818 return cache[pkg] | 818 return cache[pkg] |
| 819 if pkg not in pkg_db: | 819 if pkg not in pkg_db: |
| 820 cache[pkg] = False | 820 cache[pkg] = False |
| 821 else: | 821 else: |
| 822 cache[pkg] = True |
| 822 for dep in deps_map[pkg]["needs"]: | 823 for dep in deps_map[pkg]["needs"]: |
| 823 if not PrebuiltsReady(dep, pkg_db, cache): | 824 if not PrebuiltsReady(dep, pkg_db, cache): |
| 824 cache[pkg] = False | 825 cache[pkg] = False |
| 825 break | 826 break |
| 826 return cache.setdefault(pkg, True) | 827 return cache[pkg] |
| 827 | 828 |
| 828 def LastModifiedWithDeps(pkg, pkg_db, cache): | 829 def LastModifiedWithDeps(pkg, pkg_db, cache): |
| 829 """Calculate the last modified time of a package and its dependencies. | 830 """Calculate the last modified time of a package and its dependencies. |
| 830 | 831 |
| 831 This function looks at all the packages needed by the specified package | 832 This function looks at all the packages needed by the specified package |
| 832 and checks the most recent modification time of all of those packages. | 833 and checks the most recent modification time of all of those packages. |
| 833 If the dependencies of a package were modified more recently than the | 834 If the dependencies of a package were modified more recently than the |
| 834 package itself, then we know the package needs to be rebuilt. | 835 package itself, then we know the package needs to be rebuilt. |
| 835 | 836 |
| 836 Args: | 837 Args: |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 for db_pkg in final_db.match_pkgs(pkg): | 1258 for db_pkg in final_db.match_pkgs(pkg): |
| 1258 print "Adding %s to world" % db_pkg.cp | 1259 print "Adding %s to world" % db_pkg.cp |
| 1259 new_world_pkgs.append(db_pkg.cp) | 1260 new_world_pkgs.append(db_pkg.cp) |
| 1260 if new_world_pkgs: | 1261 if new_world_pkgs: |
| 1261 world_set.update(new_world_pkgs) | 1262 world_set.update(new_world_pkgs) |
| 1262 | 1263 |
| 1263 print "Done" | 1264 print "Done" |
| 1264 | 1265 |
| 1265 if __name__ == "__main__": | 1266 if __name__ == "__main__": |
| 1266 main() | 1267 main() |
| OLD | NEW |