Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: man/, pym/portage/, pym/_emerge/
Date: Tue, 30 Jul 2013 05:24:32
Message-Id: 1375161835.73a972e0cac5d7e5f59a58c11e998793fe2b1a2d.zmedico@gentoo
1 commit: 73a972e0cac5d7e5f59a58c11e998793fe2b1a2d
2 Author: Tomáš Čech <sleep_walker <AT> suse <DOT> cz>
3 AuthorDate: Sat Jul 27 23:09:39 2013 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 30 05:23:55 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=73a972e0
7
8 emerge: accept --pkg-format option
9
10 Accept --pkg-format option which will override settings of
11 PORTAGE_BINPKG_FORMAT. Currently takes choices of 'tar' (original gentoo
12 binary package), 'rpm' or its combinations.
13
14 Signed-off-by: Tomáš Čech <sleep_walker <AT> suse.cz>
15
16 ---
17 man/emerge.1 | 4 ++++
18 man/make.conf.5 | 4 ++++
19 pym/_emerge/EbuildBuild.py | 18 +++++++++++++++---
20 pym/_emerge/actions.py | 17 +++++++++++++++++
21 pym/_emerge/main.py | 5 +++++
22 pym/portage/const.py | 1 +
23 6 files changed, 46 insertions(+), 3 deletions(-)
24
25 diff --git a/man/emerge.1 b/man/emerge.1
26 index fd48089..ac4651f 100644
27 --- a/man/emerge.1
28 +++ b/man/emerge.1
29 @@ -628,6 +628,10 @@ exhaustively apply the entire history of package moves,
30 regardless of whether or not any of the package moves have
31 been previously applied.
32 .TP
33 +.BR \-\-pkg\-format
34 +Specify which binary package format will be created as target.
35 +Possible choices now are tar and rpm or their combinations.
36 +.TP
37 .BR \-\-prefix=DIR
38 Set the \fBEPREFIX\fR environment variable.
39 .TP
40
41 diff --git a/man/make.conf.5 b/man/make.conf.5
42 index ddacf56..451dba9 100644
43 --- a/man/make.conf.5
44 +++ b/man/make.conf.5
45 @@ -711,6 +711,10 @@ setting as the base URI.
46 This variable contains options to be passed to the tar command for creation
47 of binary packages.
48 .TP
49 +.B PORTAGE_BINPKG_FORMAT
50 +This variable sets default format used for binary packages. Possible values
51 +are tar and rpm or both.
52 +.TP
53 \fBPORTAGE_BUNZIP2_COMMAND\fR = \fI[bunzip2 command string]\fR
54 This variable should contain a command that is suitable for portage to call
55 for bunzip2 extraction operations.
56
57 diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py
58 index 75d906f..e13b1cf 100644
59 --- a/pym/_emerge/EbuildBuild.py
60 +++ b/pym/_emerge/EbuildBuild.py
61 @@ -10,6 +10,8 @@ from _emerge.EbuildMerge import EbuildMerge
62 from _emerge.EbuildFetchonly import EbuildFetchonly
63 from _emerge.EbuildBuildDir import EbuildBuildDir
64 from _emerge.MiscFunctionsProcess import MiscFunctionsProcess
65 +from _emerge.TaskSequence import TaskSequence
66 +
67 from portage.util import writemsg
68 import portage
69 from portage import os
70 @@ -306,10 +308,20 @@ class EbuildBuild(CompositeTask):
71 self.scheduler.output(msg,
72 log_path=self.settings.get("PORTAGE_LOG_FILE"))
73
74 - packager = EbuildBinpkg(background=self.background, pkg=self.pkg,
75 - scheduler=self.scheduler, settings=self.settings)
76 + binpkg_tasks = TaskSequence()
77 + requested_binpkg_formats = self.settings.get("PORTAGE_BINPKG_FORMAT", "tar").split()
78 + for pkg_fmt in portage.const.SUPPORTED_BINPKG_FORMATS:
79 + if pkg_fmt in requested_binpkg_formats:
80 + if pkg_fmt == "rpm":
81 + binpkg_tasks.add(EbuildPhase(background=self.background,
82 + phase="rpm", scheduler=self.scheduler,
83 + settings=self.settings))
84 + else:
85 + binpkg_tasks.add(EbuildBinpkg(background=self.background,
86 + pkg=self.pkg, scheduler=self.scheduler,
87 + settings=self.settings))
88
89 - self._start_task(packager, self._buildpkg_exit)
90 + self._start_task(binpkg_tasks, self._buildpkg_exit)
91
92 def _buildpkg_exit(self, packager):
93 """
94
95 diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
96 index 03074fe..4c53c25 100644
97 --- a/pym/_emerge/actions.py
98 +++ b/pym/_emerge/actions.py
99 @@ -39,6 +39,7 @@ from portage import shutil
100 from portage import eapi_is_supported, _encodings, _unicode_decode
101 from portage.cache.cache_errors import CacheError
102 from portage.const import GLOBAL_CONFIG_PATH, VCS_DIRS, _DEPCLEAN_LIB_CHECK_DEFAULT
103 +from portage.const import SUPPORTED_BINPKG_FORMATS
104 from portage.dbapi.dep_expand import dep_expand
105 from portage.dbapi._expand_new_virt import expand_new_virt
106 from portage.dep import Atom
107 @@ -2933,6 +2934,10 @@ def adjust_config(myopts, settings):
108 settings["NOCOLOR"] = "true"
109 settings.backup_changes("NOCOLOR")
110
111 + if "--pkg-format" in myopts:
112 + settings["PORTAGE_BINPKG_FORMAT"] = myopts["--pkg-format"]
113 + settings.backup_changes("PORTAGE_BINPKG_FORMAT")
114 +
115 def display_missing_pkg_set(root_config, set_name):
116
117 msg = []
118 @@ -3615,6 +3620,18 @@ def run_action(emerge_config):
119 adjust_configs(emerge_config.opts, emerge_config.trees)
120 apply_priorities(emerge_config.target_config.settings)
121
122 + for fmt in emerge_config.target_config.settings["PORTAGE_BINPKG_FORMAT"].split():
123 + if not fmt in portage.const.SUPPORTED_BINPKG_FORMATS:
124 + if "--pkg-format" in emerge_config.opts:
125 + problematic="--pkg-format"
126 + else:
127 + problematic="PORTAGE_BINPKG_FORMAT"
128 +
129 + writemsg_level(("emerge: %s is not set correctly. Format " + \
130 + "'%s' is not supported.\n") % (problematic, fmt),
131 + level=logging.ERROR, noiselevel=-1)
132 + return 1
133 +
134 if emerge_config.action == 'version':
135 writemsg_stdout(getportageversion(
136 emerge_config.target_config.settings["PORTDIR"],
137
138 diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
139 index fe9fb29..edf40a5 100644
140 --- a/pym/_emerge/main.py
141 +++ b/pym/_emerge/main.py
142 @@ -546,6 +546,11 @@ def parse_opts(tmpcmdline, silent=False):
143 "action" : "store"
144 },
145
146 + "--pkg-format": {
147 + "help" : "format of result binary package",
148 + "action" : "store",
149 + },
150 +
151 "--quiet": {
152 "shortopt" : "-q",
153 "help" : "reduced or condensed output",
154
155 diff --git a/pym/portage/const.py b/pym/portage/const.py
156 index c05b1c0..1f660a1 100644
157 --- a/pym/portage/const.py
158 +++ b/pym/portage/const.py
159 @@ -172,6 +172,7 @@ if "PORTAGE_OVERRIDE_EPREFIX" in os.environ:
160
161 VCS_DIRS = ("CVS", "RCS", "SCCS", ".bzr", ".git", ".hg", ".svn")
162
163 +SUPPORTED_BINPKG_FORMATS = ("tar", "rpm")
164 # ===========================================================================
165 # END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANT
166 # ===========================================================================