Gentoo Archives: gentoo-commits

From: Brian Dolbec <brian.dolbec@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/catalyst:master commit in: targets/support/, modules/
Date: Fri, 07 Feb 2014 23:24:55
Message-Id: 1389559694.2718211aa28019b8142ae8efe2eefdbb67b6aedb.dol-sen@gentoo
1 commit: 2718211aa28019b8142ae8efe2eefdbb67b6aedb
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jan 12 04:53:12 2014 +0000
4 Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
5 CommitDate: Sun Jan 12 20:48:14 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=2718211a
7
8 Remove some troublesome trailing slashes from paths
9
10 Change the docstring to warn to use a proper path join function.
11 Modify the functions.sh output to display the actual command it
12 is about to run.
13
14 ---
15 modules/generic_stage_target.py | 19 ++++++++++---------
16 targets/support/functions.sh | 5 +++--
17 2 files changed, 13 insertions(+), 11 deletions(-)
18
19 diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py
20 index 3d66231..89b891b 100644
21 --- a/modules/generic_stage_target.py
22 +++ b/modules/generic_stage_target.py
23 @@ -466,20 +466,20 @@ class generic_stage_target(generic_target):
24
25 def set_snapcache_path(self):
26 if "SNAPCACHE" in self.settings:
27 - self.settings["snapshot_cache_path"]=\
28 - normpath(self.settings["snapshot_cache"]+"/"+\
29 - self.settings["snapshot"]+"/")
30 + self.settings["snapshot_cache_path"] = \
31 + normpath(self.settings["snapshot_cache"] + "/" +
32 + self.settings["snapshot"])
33 self.snapcache_lock=\
34 catalyst_lock.LockDir(self.settings["snapshot_cache_path"])
35 print "Caching snapshot to "+self.settings["snapshot_cache_path"]
36
37 def set_chroot_path(self):
38 """
39 - NOTE: the trailing slash is very important!
40 - Things *will* break without it!
41 + NOTE: the trailing slash has been removed
42 + Things *could* break if you don't use a proper join()
43 """
44 self.settings["chroot_path"]=normpath(self.settings["storedir"]+\
45 - "/tmp/"+self.settings["target_subpath"]+"/")
46 + "/tmp/"+self.settings["target_subpath"])
47 self.chroot_lock=catalyst_lock.LockDir(self.settings["chroot_path"])
48
49 def set_autoresume_path(self):
50 @@ -807,8 +807,8 @@ class generic_stage_target(generic_target):
51
52 if "SNAPCACHE" in self.settings:
53 snapshot_cache_hash=\
54 - read_from_clst(self.settings["snapshot_cache_path"]+\
55 - "catalyst-hash")
56 + read_from_clst(self.settings["snapshot_cache_path"] + "/" +
57 + "catalyst-hash")
58 destdir=self.settings["snapshot_cache_path"]
59 if "bz2" == self.settings["chroot_path"][-3:]:
60 unpack_cmd="tar -I lbzip2 -xpf "+self.settings["snapshot_path"]+" -C "+destdir
61 @@ -861,7 +861,8 @@ class generic_stage_target(generic_target):
62 cmd(unpack_cmd,unpack_errmsg,env=self.env)
63
64 if "SNAPCACHE" in self.settings:
65 - myf=open(self.settings["snapshot_cache_path"]+"catalyst-hash","w")
66 + myf=open(self.settings["snapshot_cache_path"] +
67 + "/" + "catalyst-hash","w")
68 myf.write(self.settings["snapshot_path_hash"])
69 myf.close()
70 else:
71
72 diff --git a/targets/support/functions.sh b/targets/support/functions.sh
73 index 80e371c..c8757d4 100755
74 --- a/targets/support/functions.sh
75 +++ b/targets/support/functions.sh
76 @@ -20,7 +20,7 @@ exec_in_chroot(){
77 # and executes it.
78 local file_name=$(basename ${1})
79 local subdir=${2}
80 - local destdir=".${subdir}/tmp"
81 + local destdir="${subdir}/tmp"
82
83 echo "Copying ${file_name} to ${destdir}"
84 copy_to_chroot ${1} ${destdir}
85 @@ -32,7 +32,8 @@ exec_in_chroot(){
86 echo "Ensure the file has the executable bit set"
87 chmod +x ${chroot_path}/${destdir}/${file_name}
88
89 - echo "Running ${file_name} in chroot ${chroot_path}"
90 + echo "Running ${file_name} in chroot:"
91 + echo " ${clst_CHROOT} ${chroot_path} ${destdir}/${file_name}"
92 ${clst_CHROOT} ${chroot_path} ${destdir}/${file_name} || exit 1
93
94 delete_from_chroot ${destdir}/${file_name}