public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Tomáš Čech" <sleep_walker@suse.cz>
To: gentoo-portage-dev@lists.gentoo.org
Cc: "Tomáš Čech" <sleep_walker@suse.cz>
Subject: [gentoo-portage-dev] [PATCH] emerge: accept --pkg-format option
Date: Wed, 24 Jul 2013 08:33:14 +0200	[thread overview]
Message-ID: <1374647594-3701-1-git-send-email-sleep_walker@suse.cz> (raw)
In-Reply-To: <20130724062813.GG31719@crashnator.suse.cz>

Accept --pkg-format option which will override settings of
PORTAGE_BINPKG_FORMAT. Currently takes only one choice of
'tar' (original gentoo binary package) and 'rpm'.

Signed-off-by: Tomáš Čech <sleep_walker@suse.cz>
---
 man/emerge.1                |  4 ++++
 man/make.conf.5             |  5 +++++
 pym/_emerge/EbuildBinpkg.py | 17 +++++++++++------
 pym/_emerge/actions.py      |  4 ++++
 pym/_emerge/main.py         |  7 +++++++
 5 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/man/emerge.1 b/man/emerge.1
index da6bcba..23e7aed 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -633,6 +633,10 @@ exhaustively apply the entire history of package moves,
 regardless of whether or not any of the package moves have
 been previously applied.
 .TP
+.BR \-\-pkg-format
+Specify which binary package format will be created as target.
+Possible choices now are tar and rpm.
+.TP
 .BR \-\-prefix=DIR
 Set the \fBEPREFIX\fR environment variable.
 .TP
diff --git a/man/make.conf.5 b/man/make.conf.5
index adf32bd..fff4c90 100644
--- a/man/make.conf.5
+++ b/man/make.conf.5
@@ -1,3 +1,4 @@
+
 .TH "MAKE.CONF" "5" "May 2013" "Portage VERSION" "Portage"
 .SH "NAME"
 make.conf \- custom settings for Portage
@@ -707,6 +708,10 @@ setting as the base URI.
 This variable contains options to be passed to the tar command for creation
 of binary packages.
 .TP
+.B PORTAGE_BINPKG_FORMAT
+This variable sets default format used for binary packages. Possible values
+are tar and rpm.
+.TP
 \fBPORTAGE_BUNZIP2_COMMAND\fR = \fI[bunzip2 command string]\fR
 This variable should contain a command that is suitable for portage to call
 for bunzip2 extraction operations.
diff --git a/pym/_emerge/EbuildBinpkg.py b/pym/_emerge/EbuildBinpkg.py
index 34a6aef..c636a1e 100644
--- a/pym/_emerge/EbuildBinpkg.py
+++ b/pym/_emerge/EbuildBinpkg.py
@@ -17,15 +17,20 @@ class EbuildBinpkg(CompositeTask):
 		root_config = pkg.root_config
 		bintree = root_config.trees["bintree"]
 		bintree.prevent_collision(pkg.cpv)
-		binpkg_tmpfile = os.path.join(bintree.pkgdir,
-			pkg.cpv + ".tbz2." + str(os.getpid()))
-		bintree._ensure_dir(os.path.dirname(binpkg_tmpfile))
 
-		self._binpkg_tmpfile = binpkg_tmpfile
-		self.settings["PORTAGE_BINPKG_TMPFILE"] = self._binpkg_tmpfile
+		if self.settings["PORTAGE_BINPKG_FORMAT"] == "rpm":
+			requested_phase = "rpm"
+		else:
+			requested_phase = "package"
+			binpkg_tmpfile = os.path.join(bintree.pkgdir,
+						      pkg.cpv + ".tbz2." + str(os.getpid()))
+			bintree._ensure_dir(os.path.dirname(binpkg_tmpfile))
+
+			self._binpkg_tmpfile = binpkg_tmpfile
+			self.settings["PORTAGE_BINPKG_TMPFILE"] = self._binpkg_tmpfile
 
 		package_phase = EbuildPhase(background=self.background,
-			phase='package', scheduler=self.scheduler,
+			phase=requested_phase, scheduler=self.scheduler,
 			settings=self.settings)
 
 		self._start_task(package_phase, self._package_phase_exit)
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 6d5d535..30a9746 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -2909,6 +2909,10 @@ def adjust_config(myopts, settings):
 		settings["NOCOLOR"] = "true"
 		settings.backup_changes("NOCOLOR")
 
+	if "--pkg-format" in myopts:
+		settings["PORTAGE_BINPKG_FORMAT"] = myopts["--pkg-format"]
+		settings.backup_changes("PORTAGE_BINPKG_FORMAT")
+
 def display_missing_pkg_set(root_config, set_name):
 
 	msg = []
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index fe9fb29..df7a41f 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -138,6 +138,7 @@ def insert_optional_args(args):
 		'--keep-going'           : y_or_n,
 		'--load-average'         : valid_floats,
 		'--package-moves'        : y_or_n,
+		'--pkg-format'           : ('tar','rpm'),
 		'--quiet'                : y_or_n,
 		'--quiet-build'          : y_or_n,
 		'--quiet-fail'           : y_or_n,
@@ -546,6 +547,12 @@ def parse_opts(tmpcmdline, silent=False):
 			"action"   : "store"
 		},
 
+		"--pkg-format": {
+			"help"     : "format of result binary package",
+			"type"     : "choice",
+			"choices"  : ("tar", "rpm")
+		},
+
 		"--quiet": {
 			"shortopt" : "-q",
 			"help"     : "reduced or condensed output",
-- 
1.8.3.1



  reply	other threads:[~2013-07-24  6:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-24  6:28 [gentoo-portage-dev] emerge: add support for --pkg-format Tomáš Čech
2013-07-24  6:33 ` Tomáš Čech [this message]
2013-07-24 16:48   ` [gentoo-portage-dev] [PATCH] emerge: accept --pkg-format option Zac Medico
2013-07-27 23:09     ` Tomáš Čech
2013-07-30  5:25       ` Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1374647594-3701-1-git-send-email-sleep_walker@suse.cz \
    --to=sleep_walker@suse.cz \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox