Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r15364 - in main/trunk: man pym/_emerge
Date: Thu, 18 Feb 2010 07:07:44
Message-Id: E1Ni0U9-0005kA-Qh@stork.gentoo.org
1 Author: zmedico
2 Date: 2010-02-18 07:07:41 +0000 (Thu, 18 Feb 2010)
3 New Revision: 15364
4
5 Modified:
6 main/trunk/man/emerge.1
7 main/trunk/pym/_emerge/depgraph.py
8 main/trunk/pym/_emerge/help.py
9 main/trunk/pym/_emerge/main.py
10 Log:
11 Add a --rebuilt-binaries[=n] option, causing automatic replacement of
12 installed packages with binary packages that have been rebuilt. Rebuilds
13 are detected by comparison of BUILD_TIME package metadata. This option is
14 enabled automatically when using binary packages, so rebuilt binaries are
15 installed with a user's typical update command. This isn't possible with
16 the existing @rebuild-binaries package set since that only works with
17 --selective=n and therefore can't be used with a typical world update.
18 The package set framework should support this type of behavior sometime
19 in the future.
20
21
22 Modified: main/trunk/man/emerge.1
23 ===================================================================
24 --- main/trunk/man/emerge.1 2010-02-17 05:30:40 UTC (rev 15363)
25 +++ main/trunk/man/emerge.1 2010-02-18 07:07:41 UTC (rev 15364)
26 @@ -477,6 +477,13 @@
27 Redirect all build output to logs alone, and do not
28 display it on stdout.
29 .TP
30 +.BR "\-\-rebuilt\-binaries[=n]"
31 +Replace installed packages with binary packages that have
32 +been rebuilt. Rebuilds are detected by comparison of
33 +BUILD_TIME package metadata. This option is enabled
34 +automatically when using binary packages (see
35 +\fB\-\-usepkg\fR and \fB\-\-getbinpkg\fR).
36 +.TP
37 .BR "\-\-reinstall changed\-use"
38 Tells emerge to include installed packages where USE flags have
39 changed since installation. Unlike \fB\-\-newuse\fR, this option does
40
41 Modified: main/trunk/pym/_emerge/depgraph.py
42 ===================================================================
43 --- main/trunk/pym/_emerge/depgraph.py 2010-02-17 05:30:40 UTC (rev 15363)
44 +++ main/trunk/pym/_emerge/depgraph.py 2010-02-18 07:07:41 UTC (rev 15364)
45 @@ -2396,6 +2396,9 @@
46 atom_set = InternalPackageSet(initial_atoms=(atom,))
47 existing_node = None
48 myeb = None
49 + usepkg = "--usepkg" in self._frozen_config.myopts
50 + rebuilt_binaries = usepkg and \
51 + self._frozen_config.myopts.get('--rebuilt-binaries') != 'n'
52 usepkgonly = "--usepkgonly" in self._frozen_config.myopts
53 empty = "empty" in self._dynamic_config.myparams
54 selective = "selective" in self._dynamic_config.myparams
55 @@ -2615,10 +2618,26 @@
56 if pkg.cp == cp]
57 break
58
59 + if existing_node is not None and \
60 + existing_node in matched_packages:
61 + return existing_node, existing_node
62 +
63 if len(matched_packages) > 1:
64 + if rebuilt_binaries:
65 + inst_pkg = None
66 + built_pkg = None
67 + for pkg in matched_packages:
68 + if pkg.installed:
69 + inst_pkg = pkg
70 + elif pkg.built:
71 + built_pkg = pkg
72 + if built_pkg is not None and inst_pkg is not None:
73 + if built_pkg >= inst_pkg and \
74 + built_pkg.metadata['BUILD_TIME'] != \
75 + inst_pkg.metadata['BUILD_TIME']:
76 + return built_pkg, built_pkg
77 +
78 if avoid_update:
79 - if existing_node is not None:
80 - return existing_node, existing_node
81 for pkg in matched_packages:
82 if pkg.installed:
83 return pkg, existing_node
84
85 Modified: main/trunk/pym/_emerge/help.py
86 ===================================================================
87 --- main/trunk/pym/_emerge/help.py 2010-02-17 05:30:40 UTC (rev 15363)
88 +++ main/trunk/pym/_emerge/help.py 2010-02-18 07:07:41 UTC (rev 15364)
89 @@ -506,6 +506,15 @@
90 for line in wrap(desc, desc_width):
91 print(desc_indent + line)
92 print()
93 + print(" "+green("--rebuilt-binaries[=n]"))
94 + desc = "Replace installed packages with binary packages that have " + \
95 + "been rebuilt. Rebuilds are detected by comparison of " + \
96 + "BUILD_TIME package metadata. This option is enabled " + \
97 + "automatically when using binary packages (see " + \
98 + "--usepkg and --getbinpkg)."
99 + for line in wrap(desc, desc_width):
100 + print(desc_indent + line)
101 + print()
102 print(" "+green("--reinstall ") + turquoise("changed-use"))
103 print(" Tells emerge to include installed packages where USE flags have")
104 print(" changed since installation. Unlike --newuse, this option does")
105
106 Modified: main/trunk/pym/_emerge/main.py
107 ===================================================================
108 --- main/trunk/pym/_emerge/main.py 2010-02-17 05:30:40 UTC (rev 15363)
109 +++ main/trunk/pym/_emerge/main.py 2010-02-18 07:07:41 UTC (rev 15364)
110 @@ -395,6 +395,7 @@
111 '--getbinpkgonly' : ('n',),
112 '--jobs' : valid_integers,
113 '--keep-going' : ('n',),
114 + '--rebuilt-binaries' : ('n',),
115 '--root-deps' : ('rdeps',),
116 '--select' : ('n',),
117 '--selective' : ('n',),
118 @@ -620,6 +621,13 @@
119 "choices" : ("True", "n")
120 },
121
122 + "--rebuilt-binaries": {
123 + "help" : "replace installed packages with binary " + \
124 + "packages that have been rebuilt",
125 + "type" : "choice",
126 + "choices" : ("True", "n")
127 + },
128 +
129 "--root": {
130 "help" : "specify the target root filesystem for merging packages",
131 "action" : "store"
132 @@ -732,6 +740,10 @@
133 else:
134 myoptions.keep_going = None
135
136 + if myoptions.rebuilt_binaries in ("True",):
137 + # The depgraph will enable this by default unless 'n' is specified.
138 + myoptions.rebuilt_binaries = None
139 +
140 if myoptions.root_deps == "True":
141 myoptions.root_deps = True