Gentoo Archives: gentoo-commits

From: Richard Farina <zerochaos@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/catalyst:master commit in: targets/support/
Date: Fri, 02 Nov 2012 00:07:47
Message-Id: 1351814390.64c1787ab549a95c7350fd03c2a22c5f6a073b19.zerochaos@gentoo
1 commit: 64c1787ab549a95c7350fd03c2a22c5f6a073b19
2 Author: Rick Farina (Zero_Chaos) <zerochaos <AT> gentoo <DOT> org>
3 AuthorDate: Thu Nov 1 23:59:50 2012 +0000
4 Commit: Richard Farina <zerochaos <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 1 23:59:50 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=64c1787a
7
8 Revert "Make sure we have ${destdir} on copy_to_chroot and simplify exec_in_chroot."
9
10 This reverts commit 17b34223a4afc1f070ac2fb9bdfb51e47c03db61.
11
12 ---
13 targets/support/functions.sh | 42 ++++++++++++++++++++++++++++--------------
14 1 files changed, 28 insertions(+), 14 deletions(-)
15
16 diff --git a/targets/support/functions.sh b/targets/support/functions.sh
17 index af57c10..a0eaae2 100644
18 --- a/targets/support/functions.sh
19 +++ b/targets/support/functions.sh
20 @@ -1,7 +1,6 @@
21 copy_to_chroot() {
22 local src_file=$1
23 local dest_dir=${clst_chroot_path}${2:-/tmp}
24 - mkdir -p ${dest_dir}
25 echo "copying ${src_file##*/} to ${dest_dir}"
26 cp -pPR "${src_file}" "${dest_dir}"/
27 }
28 @@ -19,19 +18,34 @@ exec_in_chroot(){
29 # copies the file to the /tmp directory of the chroot
30 # and executes it.
31 local file_name=$(basename ${1})
32 - local subdir=${2}
33 - local destdir=${subdir}/tmp
34 - destdir=${destdir#/}
35 -
36 - copy_to_chroot ${1} ${destdir}
37 - chroot_path=${clst_chroot_path}${subdir}
38 - copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh \
39 - ${destdir}
40 - echo "Running ${file_name} in chroot ${chroot_path}"
41 - ${clst_CHROOT} ${chroot_path} ${destdir}/${file_name} || exit 1
42 -
43 - delete_from_chroot ${destdir}/${file_name}
44 - delete_from_chroot ${destdir}/chroot-functions.sh
45 + local subdir=${2#/}
46 +
47 + if [ "${subdir}" != "" ]
48 + then
49 + copy_to_chroot ${1} ${subdir}/tmp/
50 + chroot_path=${clst_chroot_path}${subdir}
51 + copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh \
52 + ${subdir}/tmp/
53 + echo "Running ${file_name} in chroot ${chroot_path}"
54 + ${clst_CHROOT} ${chroot_path} /tmp/${file_name} || exit 1
55 + else
56 + copy_to_chroot ${1} tmp/
57 + chroot_path=${clst_chroot_path}
58 + copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh \
59 + tmp/
60 + echo "Running ${file_name} in chroot ${chroot_path}"
61 + ${clst_CHROOT} ${chroot_path}/ /tmp/${file_name} || exit 1
62 + fi
63 +
64 + rm -f ${chroot_path}/tmp/${file_name}
65 + if [ "${subdir}" != "" ]
66 + then
67 + delete_from_chroot ${subdir}/tmp/${file_name}
68 + delete_from_chroot ${subdir}/tmp/chroot-functions.sh
69 + else
70 + delete_from_chroot tmp/chroot-functions.sh
71 + delete_from_chroot tmp/${file_name}
72 + fi
73 }
74
75 #return codes