Gentoo Archives: gentoo-portage-dev

From: "Tomáš Čech" <sleep_walker@××××.cz>
To: gentoo-portage-dev@l.g.o
Cc: "Tomáš Čech" <sleep_walker@××××.cz>
Subject: [gentoo-portage-dev] [PATCH] emerge: accept --pkg-format option
Date: Wed, 24 Jul 2013 06:33:37
Message-Id: 1374647594-3701-1-git-send-email-sleep_walker@suse.cz
In Reply to: [gentoo-portage-dev] emerge: add support for --pkg-format by "Tomáš Čech"
1 Accept --pkg-format option which will override settings of
2 PORTAGE_BINPKG_FORMAT. Currently takes only one choice of
3 'tar' (original gentoo binary package) and 'rpm'.
4
5 Signed-off-by: Tomáš Čech <sleep_walker@××××.cz>
6 ---
7 man/emerge.1 | 4 ++++
8 man/make.conf.5 | 5 +++++
9 pym/_emerge/EbuildBinpkg.py | 17 +++++++++++------
10 pym/_emerge/actions.py | 4 ++++
11 pym/_emerge/main.py | 7 +++++++
12 5 files changed, 31 insertions(+), 6 deletions(-)
13
14 diff --git a/man/emerge.1 b/man/emerge.1
15 index da6bcba..23e7aed 100644
16 --- a/man/emerge.1
17 +++ b/man/emerge.1
18 @@ -633,6 +633,10 @@ exhaustively apply the entire history of package moves,
19 regardless of whether or not any of the package moves have
20 been previously applied.
21 .TP
22 +.BR \-\-pkg-format
23 +Specify which binary package format will be created as target.
24 +Possible choices now are tar and rpm.
25 +.TP
26 .BR \-\-prefix=DIR
27 Set the \fBEPREFIX\fR environment variable.
28 .TP
29 diff --git a/man/make.conf.5 b/man/make.conf.5
30 index adf32bd..fff4c90 100644
31 --- a/man/make.conf.5
32 +++ b/man/make.conf.5
33 @@ -1,3 +1,4 @@
34 +
35 .TH "MAKE.CONF" "5" "May 2013" "Portage VERSION" "Portage"
36 .SH "NAME"
37 make.conf \- custom settings for Portage
38 @@ -707,6 +708,10 @@ setting as the base URI.
39 This variable contains options to be passed to the tar command for creation
40 of binary packages.
41 .TP
42 +.B PORTAGE_BINPKG_FORMAT
43 +This variable sets default format used for binary packages. Possible values
44 +are tar and rpm.
45 +.TP
46 \fBPORTAGE_BUNZIP2_COMMAND\fR = \fI[bunzip2 command string]\fR
47 This variable should contain a command that is suitable for portage to call
48 for bunzip2 extraction operations.
49 diff --git a/pym/_emerge/EbuildBinpkg.py b/pym/_emerge/EbuildBinpkg.py
50 index 34a6aef..c636a1e 100644
51 --- a/pym/_emerge/EbuildBinpkg.py
52 +++ b/pym/_emerge/EbuildBinpkg.py
53 @@ -17,15 +17,20 @@ class EbuildBinpkg(CompositeTask):
54 root_config = pkg.root_config
55 bintree = root_config.trees["bintree"]
56 bintree.prevent_collision(pkg.cpv)
57 - binpkg_tmpfile = os.path.join(bintree.pkgdir,
58 - pkg.cpv + ".tbz2." + str(os.getpid()))
59 - bintree._ensure_dir(os.path.dirname(binpkg_tmpfile))
60
61 - self._binpkg_tmpfile = binpkg_tmpfile
62 - self.settings["PORTAGE_BINPKG_TMPFILE"] = self._binpkg_tmpfile
63 + if self.settings["PORTAGE_BINPKG_FORMAT"] == "rpm":
64 + requested_phase = "rpm"
65 + else:
66 + requested_phase = "package"
67 + binpkg_tmpfile = os.path.join(bintree.pkgdir,
68 + pkg.cpv + ".tbz2." + str(os.getpid()))
69 + bintree._ensure_dir(os.path.dirname(binpkg_tmpfile))
70 +
71 + self._binpkg_tmpfile = binpkg_tmpfile
72 + self.settings["PORTAGE_BINPKG_TMPFILE"] = self._binpkg_tmpfile
73
74 package_phase = EbuildPhase(background=self.background,
75 - phase='package', scheduler=self.scheduler,
76 + phase=requested_phase, scheduler=self.scheduler,
77 settings=self.settings)
78
79 self._start_task(package_phase, self._package_phase_exit)
80 diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
81 index 6d5d535..30a9746 100644
82 --- a/pym/_emerge/actions.py
83 +++ b/pym/_emerge/actions.py
84 @@ -2909,6 +2909,10 @@ def adjust_config(myopts, settings):
85 settings["NOCOLOR"] = "true"
86 settings.backup_changes("NOCOLOR")
87
88 + if "--pkg-format" in myopts:
89 + settings["PORTAGE_BINPKG_FORMAT"] = myopts["--pkg-format"]
90 + settings.backup_changes("PORTAGE_BINPKG_FORMAT")
91 +
92 def display_missing_pkg_set(root_config, set_name):
93
94 msg = []
95 diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
96 index fe9fb29..df7a41f 100644
97 --- a/pym/_emerge/main.py
98 +++ b/pym/_emerge/main.py
99 @@ -138,6 +138,7 @@ def insert_optional_args(args):
100 '--keep-going' : y_or_n,
101 '--load-average' : valid_floats,
102 '--package-moves' : y_or_n,
103 + '--pkg-format' : ('tar','rpm'),
104 '--quiet' : y_or_n,
105 '--quiet-build' : y_or_n,
106 '--quiet-fail' : y_or_n,
107 @@ -546,6 +547,12 @@ def parse_opts(tmpcmdline, silent=False):
108 "action" : "store"
109 },
110
111 + "--pkg-format": {
112 + "help" : "format of result binary package",
113 + "type" : "choice",
114 + "choices" : ("tar", "rpm")
115 + },
116 +
117 "--quiet": {
118 "shortopt" : "-q",
119 "help" : "reduced or condensed output",
120 --
121 1.8.3.1

Replies