Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1059)

Side by Side Diff: parallel_emerge

Issue 2868094: Fix --onlydeps flag. (Closed) Base URL: ssh://git@chromiumos-git/crosutils.git
Patch Set: s/, This/, this/g Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 resolved.add(pkg) 657 resolved.add(pkg)
658 658
659 cycles, unresolved, resolved = {}, [], set() 659 cycles, unresolved, resolved = {}, [], set()
660 for pkg in deps_map: 660 for pkg in deps_map:
661 FindCyclesAtNode(pkg, cycles, unresolved, resolved) 661 FindCyclesAtNode(pkg, cycles, unresolved, resolved)
662 return cycles 662 return cycles
663 663
664 def RemoveInstalledPackages(): 664 def RemoveInstalledPackages():
665 """Remove installed packages, propagating dependencies.""" 665 """Remove installed packages, propagating dependencies."""
666 666
667 # If we're not in selective mode, the packages on the command line are 667 # If we're in non-selective mode, the packages specified on the command
668 # not optional. 668 # line are generally mandatory.
669 #
670 # There are a few exceptions to this rule:
671 # 1. If the package isn't getting installed because it's in
672 # package.provided, it's not mandatory.
673 # 2. If the package isn't getting installed because we're in --onlydeps
674 # mode, it's not mandatory either.
669 if "--selective" in emerge.opts: 675 if "--selective" in emerge.opts:
670 selective = emerge.opts["--selective"] != "n" 676 selective = emerge.opts["--selective"] != "n"
671 else: 677 else:
672 selective = "--noreplace" in emerge.opts or "--update" in emerge.opts 678 selective = "--noreplace" in emerge.opts or "--update" in emerge.opts
679 onlydeps = "--onlydeps" in emerge.opts
673 if not selective: 680 if not selective:
674 for pkg in emerge.cmdline_packages: 681 for pkg in emerge.cmdline_packages:
682 # If the package specified on the command-line is in our install
683 # list, mark it as non-optional.
684 found = False
675 for db_pkg in final_db.match_pkgs(pkg): 685 for db_pkg in final_db.match_pkgs(pkg):
676 deps_info[db_pkg.cpv]["optional"] = False 686 this_pkg = deps_info.get(db_pkg.cpv)
687 if this_pkg:
688 found = True
689 this_pkg["optional"] = False
690
691 # We didn't find the package in our final db. If we're not in
692 # --onlydeps mode, this likely means that the package was specified
693 # in package.provided.
694 if not found and not onlydeps and "--verbose" in emerge.opts:
695 print "Skipping %s (is it in package.provided?)" % pkg
677 696
678 # Schedule packages that aren't on the install list for removal 697 # Schedule packages that aren't on the install list for removal
679 rm_pkgs = set(deps_map.keys()) - set(deps_info.keys()) 698 rm_pkgs = set(deps_map.keys()) - set(deps_info.keys())
680 699
681 # Schedule optional packages for removal 700 # Schedule optional packages for removal
682 for pkg, info in deps_info.items(): 701 for pkg, info in deps_info.items():
683 if info["optional"]: 702 if info["optional"]:
684 rm_pkgs.add(pkg) 703 rm_pkgs.add(pkg)
685 704
686 # Remove the packages we don't want, simplifying the graph and making 705 # Remove the packages we don't want, simplifying the graph and making
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 for db_pkg in final_db.match_pkgs(pkg): 1312 for db_pkg in final_db.match_pkgs(pkg):
1294 print "Adding %s to world" % db_pkg.cp 1313 print "Adding %s to world" % db_pkg.cp
1295 new_world_pkgs.append(db_pkg.cp) 1314 new_world_pkgs.append(db_pkg.cp)
1296 if new_world_pkgs: 1315 if new_world_pkgs:
1297 world_set.update(new_world_pkgs) 1316 world_set.update(new_world_pkgs)
1298 1317
1299 print "Done" 1318 print "Done"
1300 1319
1301 if __name__ == "__main__": 1320 if __name__ == "__main__":
1302 main() 1321 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698