public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
From: Rick Farina <sidhayn@gmail.com>
To: gentoo-catalyst@lists.gentoo.org
Cc: Rick Farina <sidhayn@gmail.com>
Subject: [gentoo-catalyst] [PATCH] Support snapshot.tar.xz format
Date: Wed, 22 Aug 2012 12:12:07 -0400	[thread overview]
Message-ID: <1345651927-17587-1-git-send-email-sidhayn@gmail.com> (raw)

This patch adds in support for automatically detecting and decompressing
both formats gentoo currently ships portage snapshots in. To make the
change as minimal as possible I am using recent gnu/bsd tar ability to
automatically pick the correct format and decompress. This should work
on all gentoo supported platforms including linux, freebsd, and
prefix-macosx.

Signed-off-by: Rick Farina <sidhayn@gmail.com>
---
 modules/generic_stage_target.py |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py
index c4ef239..b971741 100644
--- a/modules/generic_stage_target.py
+++ b/modules/generic_stage_target.py
@@ -404,12 +404,20 @@ class generic_stage_target(generic_target):
 
 	def set_snapshot_path(self):
 		self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
-			"/snapshots/portage-"+self.settings["snapshot"]+".tar.bz2")
+			"/snapshots/portage-"+self.settings["snapshot"]+".tar.xz")
 
 		if os.path.exists(self.settings["snapshot_path"]):
 			self.settings["snapshot_path_hash"]=\
 				generate_hash(self.settings["snapshot_path"],\
 				hash_function=self.settings["hash_function"],verbose=False)
+		else:
+			self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
+				"/snapshots/portage-"+self.settings["snapshot"]+".tar.bz2")
+
+			if os.path.exists(self.settings["snapshot_path"]):
+				self.settings["snapshot_path_hash"]=\
+					generate_hash(self.settings["snapshot_path"],\
+					hash_function=self.settings["hash_function"],verbose=False)
 
 	def set_snapcache_path(self):
 		if self.settings.has_key("SNAPCACHE"):
@@ -635,7 +643,7 @@ class generic_stage_target(generic_target):
 					self.settings["source_path"]+"\nto "+\
 					self.settings["chroot_path"]+\
 						" (This may take some time) ...\n"
-				unpack_cmd="tar xjpf "+self.settings["source_path"]+" -C "+\
+				unpack_cmd="tar xpf "+self.settings["source_path"]+" -C "+\
 					self.settings["chroot_path"]
 				error_msg="Tarball extraction of "+\
 					self.settings["source_path"]+" to "+\
@@ -646,7 +654,7 @@ class generic_stage_target(generic_target):
 				self.settings["source_path"]+"\nto "+\
 				self.settings["chroot_path"]+\
 				" (This may take some time) ...\n"
-			unpack_cmd="tar xjpf "+self.settings["source_path"]+" -C "+\
+			unpack_cmd="tar xpf "+self.settings["source_path"]+" -C "+\
 				self.settings["chroot_path"]
 			error_msg="Tarball extraction of "+self.settings["source_path"]+\
 				" to "+self.settings["chroot_path"]+" failed."
@@ -744,7 +752,7 @@ class generic_stage_target(generic_target):
 				read_from_clst(self.settings["snapshot_cache_path"]+\
 				"catalyst-hash")
 			destdir=self.settings["snapshot_cache_path"]
-			unpack_cmd="tar xjpf "+self.settings["snapshot_path"]+" -C "+destdir
+			unpack_cmd="tar xpf "+self.settings["snapshot_path"]+" -C "+destdir
 			unpack_errmsg="Error unpacking snapshot"
 			cleanup_msg="Cleaning up invalid snapshot cache at \n\t"+\
 				self.settings["snapshot_cache_path"]+\
@@ -760,7 +768,7 @@ class generic_stage_target(generic_target):
 			cleanup_errmsg="Error removing existing snapshot directory."
 			cleanup_msg=\
 				"Cleaning up existing portage tree (This can take a long time)..."
-			unpack_cmd="tar xjpf "+self.settings["snapshot_path"]+" -C "+\
+			unpack_cmd="tar xpf "+self.settings["snapshot_path"]+" -C "+\
 				self.settings["chroot_path"]+"/usr"
 			unpack_errmsg="Error unpacking snapshot"
 
-- 
1.7.8.6



             reply	other threads:[~2012-08-22 18:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-22 16:12 Rick Farina [this message]
2012-08-22 16:13 ` [gentoo-catalyst] Re: [PATCH] Support snapshot.tar.xz format Richard Farina
2012-08-24 17:48   ` Sebastian Pipping
2012-08-24 18:24     ` Sebastian Pipping
2012-08-24 18:44       ` Richard Farina
2012-08-24 18:38     ` Richard Farina
2012-08-25 19:09       ` Jorge Manuel B. S. Vicetto

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=1345651927-17587-1-git-send-email-sidhayn@gmail.com \
    --to=sidhayn@gmail.com \
    --cc=gentoo-catalyst@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