| OLD | NEW |
| 1 # Copyright 1999-2011 Gentoo Foundation | 1 # Copyright 1999-2011 Gentoo Foundation |
| 2 # Distributed under the terms of the GNU General Public License v2 | 2 # Distributed under the terms of the GNU General Public License v2 |
| 3 | 3 |
| 4 from __future__ import print_function | 4 from __future__ import print_function |
| 5 | 5 |
| 6 import logging | 6 import logging |
| 7 import signal | 7 import signal |
| 8 import stat | 8 import stat |
| 9 import sys | 9 import sys |
| 10 import textwrap | 10 import textwrap |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 else: | 504 else: |
| 505 new_args.append(opt_arg) | 505 new_args.append(opt_arg) |
| 506 | 506 |
| 507 if saved_opts is not None: | 507 if saved_opts is not None: |
| 508 # Recycle these on arg_stack since they | 508 # Recycle these on arg_stack since they |
| 509 # might contain another match. | 509 # might contain another match. |
| 510 arg_stack.append("-" + saved_opts) | 510 arg_stack.append("-" + saved_opts) |
| 511 | 511 |
| 512 return new_args | 512 return new_args |
| 513 | 513 |
| 514 def _find_bad_atoms(atoms): |
| 515 bad_atoms = [] |
| 516 for x in ' '.join(atoms).split(): |
| 517 bad_atom = False |
| 518 try: |
| 519 atom = portage.dep.Atom(x, allow_wildcard=True) |
| 520 except portage.exception.InvalidAtom: |
| 521 try: |
| 522 atom = portage.dep.Atom("*/"+x, allow_wildcard=T
rue) |
| 523 except portage.exception.InvalidAtom: |
| 524 bad_atom = True |
| 525 |
| 526 if bad_atom or atom.operator or atom.blocker or atom.use: |
| 527 bad_atoms.append(x) |
| 528 return bad_atoms |
| 529 |
| 530 |
| 514 def parse_opts(tmpcmdline, silent=False): | 531 def parse_opts(tmpcmdline, silent=False): |
| 515 myaction=None | 532 myaction=None |
| 516 myopts = {} | 533 myopts = {} |
| 517 myfiles=[] | 534 myfiles=[] |
| 518 | 535 |
| 519 global options, shortmapping | 536 global options, shortmapping |
| 520 | 537 |
| 521 actions = frozenset([ | 538 actions = frozenset([ |
| 522 "clean", "config", "depclean", "help", | 539 "clean", "config", "depclean", "help", |
| 523 "info", "list-sets", "metadata", | 540 "info", "list-sets", "metadata", |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 "help":"include unnecessary build time dependencies", | 650 "help":"include unnecessary build time dependencies", |
| 634 "type":"choice", | 651 "type":"choice", |
| 635 "choices":("y", "n") | 652 "choices":("y", "n") |
| 636 }, | 653 }, |
| 637 "--reinstall": { | 654 "--reinstall": { |
| 638 "help":"specify conditions to trigger package reinstalla
tion", | 655 "help":"specify conditions to trigger package reinstalla
tion", |
| 639 "type":"choice", | 656 "type":"choice", |
| 640 "choices":["changed-use"] | 657 "choices":["changed-use"] |
| 641 }, | 658 }, |
| 642 | 659 |
| 660 "--reinstall-atoms": { |
| 661 "help" :"A space separated list of package names or sl
ot atoms. " + \ |
| 662 "Emerge will treat matching packages as if they
are not " + \ |
| 663 "installed, and reinstall them if necessary. Imp
lies --deep.", |
| 664 |
| 665 "action" : "append", |
| 666 }, |
| 667 |
| 643 "--binpkg-respect-use": { | 668 "--binpkg-respect-use": { |
| 644 "help" : "discard binary packages if their use flags
\ | 669 "help" : "discard binary packages if their use flags
\ |
| 645 don't match the current configuration", | 670 don't match the current configuration", |
| 646 "type" : "choice", | 671 "type" : "choice", |
| 647 "choices" : true_y_or_n | 672 "choices" : true_y_or_n |
| 648 }, | 673 }, |
| 649 | 674 |
| 650 "--getbinpkg": { | 675 "--getbinpkg": { |
| 651 "shortopt" : "-g", | 676 "shortopt" : "-g", |
| 652 "help" : "fetch binary packages", | 677 "help" : "fetch binary packages", |
| 653 "type" : "choice", | 678 "type" : "choice", |
| 654 "choices" : true_y_or_n | 679 "choices" : true_y_or_n |
| 655 }, | 680 }, |
| 656 | 681 |
| 657 "--getbinpkgonly": { | 682 "--getbinpkgonly": { |
| 658 "shortopt" : "-G", | 683 "shortopt" : "-G", |
| 659 "help" : "fetch binary packages only", | 684 "help" : "fetch binary packages only", |
| 660 "type" : "choice", | 685 "type" : "choice", |
| 661 "choices" : true_y_or_n | 686 "choices" : true_y_or_n |
| 662 }, | 687 }, |
| 663 | 688 |
| 689 "--nousepkg-atoms": { |
| 690 "help" :"A space separated list of package names or sl
ot atoms. " + \ |
| 691 "Emerge will ignore matching binary packages. ", |
| 692 |
| 693 "action" : "append", |
| 694 }, |
| 695 |
| 664 "--package-moves": { | 696 "--package-moves": { |
| 665 "help" : "perform package moves when necessary", | 697 "help" : "perform package moves when necessary", |
| 666 "type" : "choice", | 698 "type" : "choice", |
| 667 "choices" : true_y_or_n | 699 "choices" : true_y_or_n |
| 668 }, | 700 }, |
| 669 | 701 |
| 670 "--rebuilt-binaries": { | 702 "--rebuilt-binaries": { |
| 671 "help" : "replace installed packages with binary " +
\ | 703 "help" : "replace installed packages with binary " +
\ |
| 672 "packages that have been rebuilt", | 704 "packages that have been rebuilt", |
| 673 "type" : "choice", | 705 "type" : "choice", |
| (...skipping 30 matching lines...) Expand all Loading... |
| 704 "type" : "choice", | 736 "type" : "choice", |
| 705 "choices" : true_y_or_n | 737 "choices" : true_y_or_n |
| 706 }, | 738 }, |
| 707 | 739 |
| 708 "--use-ebuild-visibility": { | 740 "--use-ebuild-visibility": { |
| 709 "help" : "use unbuilt ebuild metadata for visibility
checks on built packages", | 741 "help" : "use unbuilt ebuild metadata for visibility
checks on built packages", |
| 710 "type" : "choice", | 742 "type" : "choice", |
| 711 "choices" : true_y_or_n | 743 "choices" : true_y_or_n |
| 712 }, | 744 }, |
| 713 | 745 |
| 746 "--useoldpkg-atoms": { |
| 747 "help" :"A space separated list of package names or sl
ot atoms. " + \ |
| 748 "Emerge will prefer matching binary packages ove
r newer unbuilt packages. ", |
| 749 |
| 750 "action" : "append", |
| 751 }, |
| 752 |
| 714 "--usepkg": { | 753 "--usepkg": { |
| 715 "shortopt" : "-k", | 754 "shortopt" : "-k", |
| 716 "help" : "use binary packages", | 755 "help" : "use binary packages", |
| 717 "type" : "choice", | 756 "type" : "choice", |
| 718 "choices" : true_y_or_n | 757 "choices" : true_y_or_n |
| 719 }, | 758 }, |
| 720 | 759 |
| 721 "--usepkgonly": { | 760 "--usepkgonly": { |
| 722 "shortopt" : "-K", | 761 "shortopt" : "-K", |
| 723 "help" : "use only binary packages", | 762 "help" : "use only binary packages", |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 if myoptions.complete_graph in true_y: | 826 if myoptions.complete_graph in true_y: |
| 788 myoptions.complete_graph = True | 827 myoptions.complete_graph = True |
| 789 else: | 828 else: |
| 790 myoptions.complete_graph = None | 829 myoptions.complete_graph = None |
| 791 | 830 |
| 792 if _ENABLE_DYN_LINK_MAP: | 831 if _ENABLE_DYN_LINK_MAP: |
| 793 if myoptions.depclean_lib_check in true_y: | 832 if myoptions.depclean_lib_check in true_y: |
| 794 myoptions.depclean_lib_check = True | 833 myoptions.depclean_lib_check = True |
| 795 | 834 |
| 796 if myoptions.exclude: | 835 if myoptions.exclude: |
| 797 » » exclude = [] | 836 » » bad_atoms = _find_bad_atoms(myoptions.exclude) |
| 798 » » bad_atoms = [] | |
| 799 » » for x in ' '.join(myoptions.exclude).split(): | |
| 800 » » » bad_atom = False | |
| 801 » » » try: | |
| 802 » » » » atom = portage.dep.Atom(x, allow_wildcard=True) | |
| 803 » » » except portage.exception.InvalidAtom: | |
| 804 » » » » try: | |
| 805 » » » » » atom = portage.dep.Atom("*/"+x, allow_wi
ldcard=True) | |
| 806 » » » » except portage.exception.InvalidAtom: | |
| 807 » » » » » bad_atom = True | |
| 808 » » » | |
| 809 » » » if bad_atom: | |
| 810 » » » » bad_atoms.append(x) | |
| 811 » » » else: | |
| 812 » » » » if atom.operator or atom.blocker or atom.use: | |
| 813 » » » » » bad_atoms.append(x) | |
| 814 » » » » else: | |
| 815 » » » » » exclude.append(atom) | |
| 816 | |
| 817 if bad_atoms and not silent: | 837 if bad_atoms and not silent: |
| 818 parser.error("Invalid Atom(s) in --exclude parameter: '%
s' (only package names and slot atoms (with wildcards) allowed)\n" % \ | 838 parser.error("Invalid Atom(s) in --exclude parameter: '%
s' (only package names and slot atoms (with wildcards) allowed)\n" % \ |
| 819 (",".join(bad_atoms),)) | 839 (",".join(bad_atoms),)) |
| 820 | 840 |
| 821 » if myoptions.fail_clean in true_y: | 841 » if myoptions.reinstall_atoms: |
| 822 » » myoptions.fail_clean = True | 842 » » bad_atoms = _find_bad_atoms(myoptions.reinstall_atoms) |
| 843 » » if bad_atoms and not silent: |
| 844 » » » parser.error("Invalid Atom(s) in --reinstall-atoms param
eter: '%s' (only package names and slot atoms (with wildcards) allowed)\n" % \ |
| 845 » » » » (",".join(bad_atoms),)) |
| 846 |
| 847 » if myoptions.nousepkg_atoms: |
| 848 » » bad_atoms = _find_bad_atoms(myoptions.nousepkg_atoms) |
| 849 » » if bad_atoms and not silent: |
| 850 » » » parser.error("Invalid Atom(s) in --nousepkg-atoms parame
ter: '%s' (only package names and slot atoms (with wildcards) allowed)\n" % \ |
| 851 » » » » (",".join(bad_atoms),)) |
| 852 |
| 853 » if myoptions.useoldpkg_atoms: |
| 854 » » bad_atoms = _find_bad_atoms(myoptions.useoldpkg_atoms) |
| 855 » » if bad_atoms and not silent: |
| 856 » » » parser.error("Invalid Atom(s) in --useoldpkg-atoms param
eter: '%s' (only package names and slot atoms (with wildcards) allowed)\n" % \ |
| 857 » » » » (",".join(bad_atoms),)) |
| 823 | 858 |
| 824 if myoptions.getbinpkg in true_y: | 859 if myoptions.getbinpkg in true_y: |
| 825 myoptions.getbinpkg = True | 860 myoptions.getbinpkg = True |
| 826 else: | 861 else: |
| 827 myoptions.getbinpkg = None | 862 myoptions.getbinpkg = None |
| 828 | 863 |
| 829 if myoptions.getbinpkgonly in true_y: | 864 if myoptions.getbinpkgonly in true_y: |
| 830 myoptions.getbinpkgonly = True | 865 myoptions.getbinpkgonly = True |
| 831 else: | 866 else: |
| 832 myoptions.getbinpkgonly = None | 867 myoptions.getbinpkgonly = None |
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1696 return 1 | 1731 return 1 |
| 1697 | 1732 |
| 1698 if "--pretend" not in myopts: | 1733 if "--pretend" not in myopts: |
| 1699 display_news_notification(root_config, myopts) | 1734 display_news_notification(root_config, myopts) |
| 1700 retval = action_build(settings, trees, mtimedb, | 1735 retval = action_build(settings, trees, mtimedb, |
| 1701 myopts, myaction, myfiles, spinner) | 1736 myopts, myaction, myfiles, spinner) |
| 1702 root_config = trees[settings["ROOT"]]["root_config"] | 1737 root_config = trees[settings["ROOT"]]["root_config"] |
| 1703 post_emerge(root_config, myopts, mtimedb, retval) | 1738 post_emerge(root_config, myopts, mtimedb, retval) |
| 1704 | 1739 |
| 1705 return retval | 1740 return retval |
| OLD | NEW |