Gentoo Archives: gentoo-commits

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