1 |
Accept --pkg-format option which will override settings of |
2 |
PORTAGE_BINPKG_FORMAT. Currently takes choices of 'tar' (original gentoo |
3 |
binary package), 'rpm' or its combinations. |
4 |
|
5 |
Signed-off-by: Tomáš Čech <sleep_walker@××××.cz> |
6 |
--- |
7 |
man/emerge.1 | 4 ++++ |
8 |
man/make.conf.5 | 4 ++++ |
9 |
pym/_emerge/EbuildBinpkg.py | 18 +++++++++++------- |
10 |
pym/_emerge/EbuildBuild.py | 12 +++++++++--- |
11 |
pym/_emerge/actions.py | 17 +++++++++++++++++ |
12 |
pym/_emerge/main.py | 5 +++++ |
13 |
pym/portage/const.py | 1 + |
14 |
7 files changed, 51 insertions(+), 10 deletions(-) |
15 |
|
16 |
diff --git a/man/emerge.1 b/man/emerge.1 |
17 |
index da6bcba..1571e8a 100644 |
18 |
--- a/man/emerge.1 |
19 |
+++ b/man/emerge.1 |
20 |
@@ -633,6 +633,10 @@ exhaustively apply the entire history of package moves, |
21 |
regardless of whether or not any of the package moves have |
22 |
been previously applied. |
23 |
.TP |
24 |
+.BR \-\-pkg-format |
25 |
+Specify which binary package format will be created as target. |
26 |
+Possible choices now are tar and rpm or their combinations. |
27 |
+.TP |
28 |
.BR \-\-prefix=DIR |
29 |
Set the \fBEPREFIX\fR environment variable. |
30 |
.TP |
31 |
diff --git a/man/make.conf.5 b/man/make.conf.5 |
32 |
index adf32bd..8811513 100644 |
33 |
--- a/man/make.conf.5 |
34 |
+++ b/man/make.conf.5 |
35 |
@@ -707,6 +707,10 @@ setting as the base URI. |
36 |
This variable contains options to be passed to the tar command for creation |
37 |
of binary packages. |
38 |
.TP |
39 |
+.B PORTAGE_BINPKG_FORMAT |
40 |
+This variable sets default format used for binary packages. Possible values |
41 |
+are tar and rpm or both. |
42 |
+.TP |
43 |
\fBPORTAGE_BUNZIP2_COMMAND\fR = \fI[bunzip2 command string]\fR |
44 |
This variable should contain a command that is suitable for portage to call |
45 |
for bunzip2 extraction operations. |
46 |
diff --git a/pym/_emerge/EbuildBinpkg.py b/pym/_emerge/EbuildBinpkg.py |
47 |
index 34a6aef..145cd31 100644 |
48 |
--- a/pym/_emerge/EbuildBinpkg.py |
49 |
+++ b/pym/_emerge/EbuildBinpkg.py |
50 |
@@ -10,22 +10,26 @@ class EbuildBinpkg(CompositeTask): |
51 |
This assumes that src_install() has successfully completed. |
52 |
""" |
53 |
__slots__ = ('pkg', 'settings') + \ |
54 |
- ('_binpkg_tmpfile',) |
55 |
+ ('_binpkg_tmpfile', 'pkg_format') |
56 |
|
57 |
def _start(self): |
58 |
pkg = self.pkg |
59 |
root_config = pkg.root_config |
60 |
bintree = root_config.trees["bintree"] |
61 |
bintree.prevent_collision(pkg.cpv) |
62 |
- binpkg_tmpfile = os.path.join(bintree.pkgdir, |
63 |
- pkg.cpv + ".tbz2." + str(os.getpid())) |
64 |
- bintree._ensure_dir(os.path.dirname(binpkg_tmpfile)) |
65 |
+ if self.pkg_format == "rpm": |
66 |
+ requested_phase = "rpm" |
67 |
+ else: |
68 |
+ requested_phase = "package" |
69 |
+ binpkg_tmpfile = os.path.join(bintree.pkgdir, |
70 |
+ pkg.cpv + ".tbz2." + str(os.getpid())) |
71 |
+ bintree._ensure_dir(os.path.dirname(binpkg_tmpfile)) |
72 |
|
73 |
- self._binpkg_tmpfile = binpkg_tmpfile |
74 |
- self.settings["PORTAGE_BINPKG_TMPFILE"] = self._binpkg_tmpfile |
75 |
+ self._binpkg_tmpfile = binpkg_tmpfile |
76 |
+ self.settings["PORTAGE_BINPKG_TMPFILE"] = self._binpkg_tmpfile |
77 |
|
78 |
package_phase = EbuildPhase(background=self.background, |
79 |
- phase='package', scheduler=self.scheduler, |
80 |
+ phase=requested_phase, scheduler=self.scheduler, |
81 |
settings=self.settings) |
82 |
|
83 |
self._start_task(package_phase, self._package_phase_exit) |
84 |
diff --git a/pym/_emerge/EbuildBuild.py b/pym/_emerge/EbuildBuild.py |
85 |
index 75d906f..8755815 100644 |
86 |
--- a/pym/_emerge/EbuildBuild.py |
87 |
+++ b/pym/_emerge/EbuildBuild.py |
88 |
@@ -10,6 +10,8 @@ from _emerge.EbuildMerge import EbuildMerge |
89 |
from _emerge.EbuildFetchonly import EbuildFetchonly |
90 |
from _emerge.EbuildBuildDir import EbuildBuildDir |
91 |
from _emerge.MiscFunctionsProcess import MiscFunctionsProcess |
92 |
+from _emerge.TaskSequence import TaskSequence |
93 |
+ |
94 |
from portage.util import writemsg |
95 |
import portage |
96 |
from portage import os |
97 |
@@ -306,10 +308,14 @@ class EbuildBuild(CompositeTask): |
98 |
self.scheduler.output(msg, |
99 |
log_path=self.settings.get("PORTAGE_LOG_FILE")) |
100 |
|
101 |
- packager = EbuildBinpkg(background=self.background, pkg=self.pkg, |
102 |
- scheduler=self.scheduler, settings=self.settings) |
103 |
+ binpkg_tasks = TaskSequence() |
104 |
+ requested_binpkg_formats = self.settings.get("PORTAGE_BINPKG_FORMAT", "tar").split() |
105 |
+ for pkg_fmt in portage.const.SUPPORTED_BINPKG_FORMATS: |
106 |
+ if pkg_fmt in requested_binpkg_formats: |
107 |
+ binpkg_tasks.add(EbuildBinpkg(background=self.background, pkg=self.pkg, |
108 |
+ pkg_format=pkg_fmt, scheduler=self.scheduler, settings=self.settings)) |
109 |
|
110 |
- self._start_task(packager, self._buildpkg_exit) |
111 |
+ self._start_task(binpkg_tasks, self._buildpkg_exit) |
112 |
|
113 |
def _buildpkg_exit(self, packager): |
114 |
""" |
115 |
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py |
116 |
index 6d5d535..9ba50a0 100644 |
117 |
--- a/pym/_emerge/actions.py |
118 |
+++ b/pym/_emerge/actions.py |
119 |
@@ -38,6 +38,7 @@ from portage import shutil |
120 |
from portage import eapi_is_supported, _encodings, _unicode_decode |
121 |
from portage.cache.cache_errors import CacheError |
122 |
from portage.const import GLOBAL_CONFIG_PATH, VCS_DIRS, _DEPCLEAN_LIB_CHECK_DEFAULT |
123 |
+from portage.const import SUPPORTED_BINPKG_FORMATS |
124 |
from portage.dbapi.dep_expand import dep_expand |
125 |
from portage.dbapi._expand_new_virt import expand_new_virt |
126 |
from portage.dep import Atom |
127 |
@@ -2909,6 +2910,10 @@ def adjust_config(myopts, settings): |
128 |
settings["NOCOLOR"] = "true" |
129 |
settings.backup_changes("NOCOLOR") |
130 |
|
131 |
+ if "--pkg-format" in myopts: |
132 |
+ settings["PORTAGE_BINPKG_FORMAT"] = myopts["--pkg-format"] |
133 |
+ settings.backup_changes("PORTAGE_BINPKG_FORMAT") |
134 |
+ |
135 |
def display_missing_pkg_set(root_config, set_name): |
136 |
|
137 |
msg = [] |
138 |
@@ -3591,6 +3596,18 @@ def run_action(emerge_config): |
139 |
adjust_configs(emerge_config.opts, emerge_config.trees) |
140 |
apply_priorities(emerge_config.target_config.settings) |
141 |
|
142 |
+ for fmt in emerge_config.target_config.settings["PORTAGE_BINPKG_FORMAT"].split(): |
143 |
+ if not fmt in portage.const.SUPPORTED_BINPKG_FORMATS: |
144 |
+ if "--pkg-format" in emerge_config.opts: |
145 |
+ problematic="--pkg-format" |
146 |
+ else: |
147 |
+ problematic="PORTAGE_BINPKG_FORMAT" |
148 |
+ |
149 |
+ writemsg_level(("emerge: %s is not set correctly. Format " + \ |
150 |
+ "'%s' is not supported.\n") % (problematic, fmt), |
151 |
+ level=logging.ERROR, noiselevel=-1) |
152 |
+ return 1 |
153 |
+ |
154 |
if emerge_config.action == 'version': |
155 |
writemsg_stdout(getportageversion( |
156 |
emerge_config.target_config.settings["PORTDIR"], |
157 |
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py |
158 |
index fe9fb29..edf40a5 100644 |
159 |
--- a/pym/_emerge/main.py |
160 |
+++ b/pym/_emerge/main.py |
161 |
@@ -546,6 +546,11 @@ def parse_opts(tmpcmdline, silent=False): |
162 |
"action" : "store" |
163 |
}, |
164 |
|
165 |
+ "--pkg-format": { |
166 |
+ "help" : "format of result binary package", |
167 |
+ "action" : "store", |
168 |
+ }, |
169 |
+ |
170 |
"--quiet": { |
171 |
"shortopt" : "-q", |
172 |
"help" : "reduced or condensed output", |
173 |
diff --git a/pym/portage/const.py b/pym/portage/const.py |
174 |
index 087c0e7..bf22977 100644 |
175 |
--- a/pym/portage/const.py |
176 |
+++ b/pym/portage/const.py |
177 |
@@ -169,6 +169,7 @@ if "PORTAGE_OVERRIDE_EPREFIX" in os.environ: |
178 |
|
179 |
VCS_DIRS = ("CVS", "RCS", "SCCS", ".bzr", ".git", ".hg", ".svn") |
180 |
|
181 |
+SUPPORTED_BINPKG_FORMATS = ("tar", "rpm") |
182 |
# =========================================================================== |
183 |
# END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANT |
184 |
# =========================================================================== |
185 |
-- |
186 |
1.8.3.1 |