Gentoo Archives: gentoo-portage-dev

From: Brian Harring <ferringb@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] pre/post phase hooks for users
Date: Sat, 29 Oct 2005 14:35:32
Message-Id: 20051029143430.GM24883@nightcrawler
In Reply to: Re: [gentoo-portage-dev] [PATCH] pre/post phase hooks for users by Thomas Matthijs
1 On Wed, Oct 26, 2005 at 11:38:00AM +0200, Thomas Matthijs wrote:
2 If you're doing up a 53_rc7, I'd be curious if anyone is going to have
3 issues with this one sliding into .53; it's a shoe in for .54 (it's
4 bloody simple, mainly), but .54 is going to be a ways out, and this is
5 useful _now_ for ebuild devs.
6
7 Yay/nay?
8 ~harring
9
10 > Corrected patch
11 >
12 > --
13 > Thomas Matthijs (axxo, knu)
14
15 > Index: ebuild.sh
16 > ===================================================================
17 > --- bin/ebuild.sh (revision 2122)
18 > +++ bin/ebuild.sh (working copy)
19 > @@ -631,11 +631,14 @@
20 >
21 > dyn_setup()
22 > {
23 > + [ "$(type -t pre_pkg_setup)" == "function" ] && pre_pkg_setup
24 > pkg_setup
25 > + [ "$(type -t post_pkg_setup)" == "function" ] && post_pkg_setup
26 > }
27 >
28 > dyn_unpack() {
29 > trap "abort_unpack" SIGINT SIGQUIT
30 > + [ "$(type -t pre_src_unpack)" == "function" ] && pre_src_unpack
31 > local newstuff="no"
32 > if [ -e "${WORKDIR}" ]; then
33 > local x
34 > @@ -662,6 +665,7 @@
35 > if [ -e "${WORKDIR}" ]; then
36 > if [ "$newstuff" == "no" ]; then
37 > echo ">>> WORKDIR is up-to-date, keeping..."
38 > + [ "$(type -t post_src_unpack)" == "function" ] && post_src_unpack
39 > return 0
40 > fi
41 > fi
42 > @@ -673,6 +677,9 @@
43 > touch "${BUILDDIR}/.unpacked" || die "IO Failure -- Failed 'touch .unpacked' in BUILDIR"
44 > echo ">>> Source unpacked."
45 > cd "$BUILDDIR"
46 > +
47 > + [ "$(type -t post_src_unpack)" == "function" ] && post_src_unpack
48 > +
49 > trap SIGINT SIGQUIT
50 > }
51 >
52 > @@ -854,6 +861,9 @@
53 >
54 > dyn_compile() {
55 > trap "abort_compile" SIGINT SIGQUIT
56 > +
57 > + [ "$(type -t pre_src_compile)" == "function" ] && pre_src_compile
58 > +
59 > [ "${CFLAGS-unset}" != "unset" ] && export CFLAGS
60 > [ "${CXXFLAGS-unset}" != "unset" ] && export CXXFLAGS
61 > [ "${LIBCFLAGS-unset}" != "unset" ] && export LIBCFLAGS
62 > @@ -892,6 +902,7 @@
63 > echo ">>> It appears that ${PN} is already compiled; skipping."
64 > echo ">>> (clean to force compilation)"
65 > trap SIGINT SIGQUIT
66 > + [ "$(type -t post_src_compile)" == "function" ] && post_src_compile
67 > return
68 > fi
69 > if [ -d "${S}" ]; then
70 > @@ -948,6 +959,9 @@
71 > if hasq nostrip $FEATURES $RESTRICT; then
72 > touch DEBUGBUILD
73 > fi
74 > +
75 > + [ "$(type -t post_src_compile)" == "function" ] && post_src_compile
76 > +
77 > trap SIGINT SIGQUIT
78 > }
79 >
80 > @@ -972,8 +986,10 @@
81 >
82 >
83 > dyn_test() {
84 > + [ "$(type -t pre_src_test)" == "function" ] && pre_src_test
85 > if [ ${BUILDDIR}/.tested -nt "${WORKDIR}" ]; then
86 > echo ">>> It appears that ${PN} has already been tested; skipping."
87 > + [ "$(type -t post_src_test)" == "function" ] && post_src_test
88 > return
89 > fi
90 > trap "abort_test" SIGINT SIGQUIT
91 > @@ -992,6 +1008,7 @@
92 >
93 > cd "${BUILDDIR}"
94 > touch .tested || die "Failed to 'touch .tested' in ${BUILDDIR}"
95 > + [ "$(type -t post_src_test)" == "function" ] && post_src_test
96 > trap SIGINT SIGQUIT
97 > }
98 >
99 > @@ -1001,6 +1018,7 @@
100 >
101 > dyn_install() {
102 > trap "abort_install" SIGINT SIGQUIT
103 > + [ "$(type -t pre_src_install)" == "function" ] && pre_src_install
104 > rm -rf "${BUILDDIR}/image"
105 > mkdir "${BUILDDIR}/image"
106 > if [ -d "${S}" ]; then
107 > @@ -1204,6 +1222,7 @@
108 > echo ">>> Completed installing ${PF} into ${D}"
109 > echo
110 > cd ${BUILDDIR}
111 > + [ "$(type -t post_src_install)" == "function" ] && post_src_install
112 > trap SIGINT SIGQUIT
113 > }
114 >
115 > @@ -1211,6 +1230,8 @@
116 > # set IMAGE depending if this is a binary or compile merge
117 > [ "${EMERGE_FROM}" == "binary" ] && IMAGE=${PKG_TMPDIR}/${PF}/bin \
118 > || IMAGE=${D}
119 > +
120 > + [ "$(type -t pre_pkg_preinst)" == "function" ] && pre_pkg_preinst
121 >
122 > pkg_preinst
123 >
124 > @@ -1319,6 +1340,9 @@
125 > echo "!!! Unable to set SELinux security labels"
126 > fi
127 > fi
128 > +
129 > + [ "$(type -t post_pkg_preinst)" == "function" ] && post_pkg_preinst
130 > +
131 > trap SIGINT SIGQUIT
132 > }
133 >
134 > @@ -1845,11 +1869,15 @@
135 > prerm|postrm|postinst|config)
136 > export SANDBOX_ON="0"
137 > if [ "$PORTAGE_DEBUG" != "1" ]; then
138 > + [ "$(type -t pre_pkg_${myarg})" == "function" ] && pre_pkg_${myarg}
139 > pkg_${myarg}
140 > + [ "$(type -t post_pkg_${myarg})" == "function" ] && post_pkg_${myarg}
141 > #Allow non-zero return codes since they can be caused by &&
142 > else
143 > set -x
144 > + [ "$(type -t pre_pkg_${myarg})" == "function" ] && pre_pkg_${myarg}
145 > pkg_${myarg}
146 > + [ "$(type -t post_pkg_${myarg})" == "function" ] && post_pkg_${myarg}
147 > #Allow non-zero return codes since they can be caused by &&
148 > set +x
149 > fi