Gentoo Archives: gentoo-portage-dev

From: Brian Harring <ferringb@g.o>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] [ferringb@lark.gentoo.org: r2267 - main/trunk/bin] (pre/post hooks)
Date: Wed, 09 Nov 2005 20:10:22
Message-Id: 20051109200844.GJ7414@nightcrawler.questgraphic.com
1 Just forwarding this to the ml; commited it to svn earlier today.
2
3 If people are after having the commit mail dumped in their mbox,
4 please contact either jstubbs, genone, or myself.
5
6 ~harring
7
8 ----- Forwarded message from Brian Harring <ferringb@×××××××××××.org> -----
9
10 Date: Wed, 9 Nov 2005 20:06:12 +0000
11 To: portage-commits@g.o
12 From: Brian Harring <ferringb@×××××××××××.org>
13 Subject: r2267 - main/trunk/bin
14
15 Author: ferringb
16 Date: 2005-11-09 20:06:11 +0000 (Wed, 09 Nov 2005)
17 New Revision: 2267
18
19 Modified:
20 main/trunk/bin/ebuild.sh
21 Log:
22 pre/post hooks originally from 2.1, quick rewrite by axxo for 2.0
23 Not to be used by ebuilds/eclasses (with the sole exception of java eclass var reset till ebd is stabled), this is user hooks.
24
25
26 Modified: main/trunk/bin/ebuild.sh
27 ===================================================================
28 --- main/trunk/bin/ebuild.sh 2005-11-09 12:56:10 UTC (rev 2266)
29 +++ main/trunk/bin/ebuild.sh 2005-11-09 20:06:11 UTC (rev 2267)
30 @@ -634,11 +634,14 @@
31
32 dyn_setup()
33 {
34 + [ "$(type -t pre_pkg_setup)" == "function" ] && pre_pkg_setup
35 pkg_setup
36 + [ "$(type -t post_pkg_setup)" == "function" ] && post_pkg_setup
37 }
38
39 dyn_unpack() {
40 trap "abort_unpack" SIGINT SIGQUIT
41 + [ "$(type -t pre_src_unpack)" == "function" ] && pre_src_unpack
42 local newstuff="no"
43 if [ -e "${WORKDIR}" ]; then
44 local x
45 @@ -665,6 +668,7 @@
46 if [ -e "${WORKDIR}" ]; then
47 if [ "$newstuff" == "no" ]; then
48 echo ">>> WORKDIR is up-to-date, keeping..."
49 + [ "$(type -t post_src_unpack)" == "function" ] && post_src_unpack
50 return 0
51 fi
52 fi
53 @@ -676,6 +680,9 @@
54 touch "${BUILDDIR}/.unpacked" || die "IO Failure -- Failed 'touch .unpacked' in BUILDIR"
55 echo ">>> Source unpacked."
56 cd "$BUILDDIR"
57 +
58 + [ "$(type -t post_src_unpack)" == "function" ] && post_src_unpack
59 +
60 trap SIGINT SIGQUIT
61 }
62
63 @@ -857,6 +864,9 @@
64
65 dyn_compile() {
66 trap "abort_compile" SIGINT SIGQUIT
67 +
68 + [ "$(type -t pre_src_compile)" == "function" ] && pre_src_compile
69 +
70 [ "${CFLAGS-unset}" != "unset" ] && export CFLAGS
71 [ "${CXXFLAGS-unset}" != "unset" ] && export CXXFLAGS
72 [ "${LIBCFLAGS-unset}" != "unset" ] && export LIBCFLAGS
73 @@ -895,6 +905,7 @@
74 echo ">>> It appears that ${PN} is already compiled; skipping."
75 echo ">>> (clean to force compilation)"
76 trap SIGINT SIGQUIT
77 + [ "$(type -t post_src_compile)" == "function" ] && post_src_compile
78 return
79 fi
80 if [ -d "${S}" ]; then
81 @@ -951,6 +962,9 @@
82 if hasq nostrip $FEATURES $RESTRICT; then
83 touch DEBUGBUILD
84 fi
85 +
86 + [ "$(type -t post_src_compile)" == "function" ] && post_src_compile
87 +
88 trap SIGINT SIGQUIT
89 }
90
91 @@ -975,8 +989,10 @@
92
93
94 dyn_test() {
95 + [ "$(type -t pre_src_test)" == "function" ] && pre_src_test
96 if [ ${BUILDDIR}/.tested -nt "${WORKDIR}" ]; then
97 echo ">>> It appears that ${PN} has already been tested; skipping."
98 + [ "$(type -t post_src_test)" == "function" ] && post_src_test
99 return
100 fi
101 trap "abort_test" SIGINT SIGQUIT
102 @@ -995,6 +1011,7 @@
103
104 cd "${BUILDDIR}"
105 touch .tested || die "Failed to 'touch .tested' in ${BUILDDIR}"
106 + [ "$(type -t post_src_test)" == "function" ] && post_src_test
107 trap SIGINT SIGQUIT
108 }
109
110 @@ -1004,6 +1021,7 @@
111
112 dyn_install() {
113 trap "abort_install" SIGINT SIGQUIT
114 + [ "$(type -t pre_src_install)" == "function" ] && pre_src_install
115 rm -rf "${BUILDDIR}/image"
116 mkdir "${BUILDDIR}/image"
117 if [ -d "${S}" ]; then
118 @@ -1207,6 +1225,7 @@
119 echo ">>> Completed installing ${PF} into ${D}"
120 echo
121 cd ${BUILDDIR}
122 + [ "$(type -t post_src_install)" == "function" ] && post_src_install
123 trap SIGINT SIGQUIT
124 }
125
126 @@ -1214,6 +1233,8 @@
127 # set IMAGE depending if this is a binary or compile merge
128 [ "${EMERGE_FROM}" == "binary" ] && IMAGE=${PKG_TMPDIR}/${PF}/bin \
129 || IMAGE=${D}
130 +
131 + [ "$(type -t pre_pkg_preinst)" == "function" ] && pre_pkg_preinst
132
133 D=${IMAGE} pkg_preinst
134
135 @@ -1322,6 +1343,9 @@
136 echo "!!! Unable to set SELinux security labels"
137 fi
138 fi
139 +
140 + [ "$(type -t post_pkg_preinst)" == "function" ] && post_pkg_preinst
141 +
142 trap SIGINT SIGQUIT
143 }
144
145 @@ -1848,11 +1872,15 @@
146 prerm|postrm|postinst|config)
147 export SANDBOX_ON="0"
148 if [ "$PORTAGE_DEBUG" != "1" ]; then
149 + [ "$(type -t pre_pkg_${myarg})" == "function" ] && pre_pkg_${myarg}
150 pkg_${myarg}
151 + [ "$(type -t post_pkg_${myarg})" == "function" ] && post_pkg_${myarg}
152 #Allow non-zero return codes since they can be caused by &&
153 else
154 set -x
155 + [ "$(type -t pre_pkg_${myarg})" == "function" ] && pre_pkg_${myarg}
156 pkg_${myarg}
157 + [ "$(type -t post_pkg_${myarg})" == "function" ] && post_pkg_${myarg}
158 #Allow non-zero return codes since they can be caused by &&
159 set +x
160 fi
161
162
163 ----- End forwarded message -----

Replies