Gentoo Archives: gentoo-catalyst

From: Rick Farina <sidhayn@×××××.com>
To: gentoo-catalyst@l.g.o
Cc: Rick Farina <sidhayn@×××××.com>
Subject: [gentoo-catalyst] [PATCH] Support snapshot.tar.xz format
Date: Wed, 22 Aug 2012 18:02:44
Message-Id: 1345651927-17587-1-git-send-email-sidhayn@gmail.com
1 This patch adds in support for automatically detecting and decompressing
2 both formats gentoo currently ships portage snapshots in. To make the
3 change as minimal as possible I am using recent gnu/bsd tar ability to
4 automatically pick the correct format and decompress. This should work
5 on all gentoo supported platforms including linux, freebsd, and
6 prefix-macosx.
7
8 Signed-off-by: Rick Farina <sidhayn@×××××.com>
9 ---
10 modules/generic_stage_target.py | 18 +++++++++++++-----
11 1 files changed, 13 insertions(+), 5 deletions(-)
12
13 diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py
14 index c4ef239..b971741 100644
15 --- a/modules/generic_stage_target.py
16 +++ b/modules/generic_stage_target.py
17 @@ -404,12 +404,20 @@ class generic_stage_target(generic_target):
18
19 def set_snapshot_path(self):
20 self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
21 - "/snapshots/portage-"+self.settings["snapshot"]+".tar.bz2")
22 + "/snapshots/portage-"+self.settings["snapshot"]+".tar.xz")
23
24 if os.path.exists(self.settings["snapshot_path"]):
25 self.settings["snapshot_path_hash"]=\
26 generate_hash(self.settings["snapshot_path"],\
27 hash_function=self.settings["hash_function"],verbose=False)
28 + else:
29 + self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\
30 + "/snapshots/portage-"+self.settings["snapshot"]+".tar.bz2")
31 +
32 + if os.path.exists(self.settings["snapshot_path"]):
33 + self.settings["snapshot_path_hash"]=\
34 + generate_hash(self.settings["snapshot_path"],\
35 + hash_function=self.settings["hash_function"],verbose=False)
36
37 def set_snapcache_path(self):
38 if self.settings.has_key("SNAPCACHE"):
39 @@ -635,7 +643,7 @@ class generic_stage_target(generic_target):
40 self.settings["source_path"]+"\nto "+\
41 self.settings["chroot_path"]+\
42 " (This may take some time) ...\n"
43 - unpack_cmd="tar xjpf "+self.settings["source_path"]+" -C "+\
44 + unpack_cmd="tar xpf "+self.settings["source_path"]+" -C "+\
45 self.settings["chroot_path"]
46 error_msg="Tarball extraction of "+\
47 self.settings["source_path"]+" to "+\
48 @@ -646,7 +654,7 @@ class generic_stage_target(generic_target):
49 self.settings["source_path"]+"\nto "+\
50 self.settings["chroot_path"]+\
51 " (This may take some time) ...\n"
52 - unpack_cmd="tar xjpf "+self.settings["source_path"]+" -C "+\
53 + unpack_cmd="tar xpf "+self.settings["source_path"]+" -C "+\
54 self.settings["chroot_path"]
55 error_msg="Tarball extraction of "+self.settings["source_path"]+\
56 " to "+self.settings["chroot_path"]+" failed."
57 @@ -744,7 +752,7 @@ class generic_stage_target(generic_target):
58 read_from_clst(self.settings["snapshot_cache_path"]+\
59 "catalyst-hash")
60 destdir=self.settings["snapshot_cache_path"]
61 - unpack_cmd="tar xjpf "+self.settings["snapshot_path"]+" -C "+destdir
62 + unpack_cmd="tar xpf "+self.settings["snapshot_path"]+" -C "+destdir
63 unpack_errmsg="Error unpacking snapshot"
64 cleanup_msg="Cleaning up invalid snapshot cache at \n\t"+\
65 self.settings["snapshot_cache_path"]+\
66 @@ -760,7 +768,7 @@ class generic_stage_target(generic_target):
67 cleanup_errmsg="Error removing existing snapshot directory."
68 cleanup_msg=\
69 "Cleaning up existing portage tree (This can take a long time)..."
70 - unpack_cmd="tar xjpf "+self.settings["snapshot_path"]+" -C "+\
71 + unpack_cmd="tar xpf "+self.settings["snapshot_path"]+" -C "+\
72 self.settings["chroot_path"]+"/usr"
73 unpack_errmsg="Error unpacking snapshot"
74
75 --
76 1.7.8.6

Replies

Subject Author
[gentoo-catalyst] Re: [PATCH] Support snapshot.tar.xz format Richard Farina <sidhayn@×××××.com>