Gentoo Archives: gentoo-dev

From: "Rick \\\"Zero_Chaos\\\" Farina" <zerochaos@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] bzr.eclass changes, please review
Date: Fri, 14 Sep 2012 13:16:29
Message-Id: 50532DE2.1060908@gentoo.org
In Reply to: [gentoo-dev] bzr.eclass changes, please review by Ulrich Mueller
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA1
3
4 On 09/14/2012 05:01 AM, Ulrich Mueller wrote:
5 > In bug 434746 it has been suggested that ${WORKDIR} should look like a
6 > bzr branch or checkout. Proposed changes for bzr.eclass are included
7 > below, comprising the following:
8 >
9 > - bzr_fetch can optionally call bzr checkout --lightweight instead of
10 > bzr export. The default behaviour won't change, the new behaviour
11 > can be enabled with:
12 > - New variable EBZR_WORKDIR_CHECKOUT, (Or can anyone come up with a
13 > better/shorter name?)
14 > - New variable EBZR_CHECKOUT_CMD.
15 > - The sandbox environment is now always restored; before it was only
16 > restored if ${EBZR_STORE_DIR} didn't exist. This is to prevent the
17 > package's build system from writing to ${EBZR_STORE_DIR} when it's
18 > calling bzr (which wasn't an issue for an export, but could be for
19 > a checkout).
20 > - Unrelated to the above, some old cleanup code (around line 220) is
21 > removed.
22 >
23 > The updated bzr.eclass is available in the emacs overlay, along with
24 > an app-editors/emacs-vcs ebuild that I've used for testing.
25 >
26 > Ulrich
27 >
28 >
29 > --- bzr.eclass 18 Jul 2012 15:12:54 -0000 1.18
30 > +++ bzr.eclass 14 Sep 2012 08:02:08 -0000
31 > @@ -61,6 +61,11 @@
32 > # The Bazaar command to export a branch.
33 > : ${EBZR_EXPORT_CMD:="bzr export"}
34 >
35 > +# @ECLASS-VARIABLE: EBZR_CHECKOUT_CMD
36 > +# @DESCRIPTION:
37 > +# The Bazaar command to checkout a branch.
38 > +: ${EBZR_CHECKOUT_CMD:="bzr checkout --lightweight -q"}
39 > +
40 > # @ECLASS-VARIABLE: EBZR_REVNO_CMD
41 > # @DESCRIPTION:
42 > # The Bazaar command to list a revision number of the branch.
43 > @@ -145,6 +150,12 @@
44 > # by users.
45 > : ${EBZR_OFFLINE=${EVCS_OFFLINE}}
46 >
47 > +# @ECLASS-VARIABLE: EBZR_WORKDIR_CHECKOUT
48 > +# @DEFAULT_UNSET
49 > +# @DESCRIPTION:
50 > +# If this variable is set to a non-empty value, EBZR_CHECKOUT_CMD will
51 > +# be used instead of EBZR_EXPORT_CMD to copy the sources to WORKDIR.
52 > +
53 > # @FUNCTION: bzr_initial_fetch
54 > # @USAGE: <repository URI> <branch directory>
55 > # @DESCRIPTION:
56 > @@ -196,11 +207,11 @@
57 > # working copy.
58 > bzr_fetch() {
59 > local repo_dir branch_dir
60 > + local save_sandbox_write=${SANDBOX_WRITE}
61 >
62 > [[ -n ${EBZR_REPO_URI} ]] || die "${EBZR}: EBZR_REPO_URI is empty"
63 >
64 > if [[ ! -d ${EBZR_STORE_DIR} ]] ; then
65 > - local save_sandbox_write=${SANDBOX_WRITE}
66 > addwrite /
67 Am I reading this wrong, or is "addwrite /" being more than just a
68 little lazy? I know this isn't part of your change set but it has
69 always bothered me that it needs to unlocking writing on the whole
70 filesystem to save something in distdir.
71
72 Thanks,
73 Zero
74 > mkdir -p "${EBZR_STORE_DIR}" \
75 > || die "${EBZR}: can't mkdir ${EBZR_STORE_DIR}"
76 > @@ -215,19 +226,6 @@
77 >
78 > addwrite "${EBZR_STORE_DIR}"
79 >
80 > - # Clean up if the existing local copy is a checkout (as was the case
81 > - # with an older version of bzr.eclass).
82 > - # This test can be removed after 1 Mar 2012.
83 > - if [[ ${EBZR_FETCH_CMD} != *checkout* && -d ${repo_dir}/.bzr/checkout ]]
84 > - then
85 > - local tmpname=$(mktemp -u "${repo_dir}._old_.XXXXXX")
86 > - ewarn "checkout from old version of ${EBZR} found, moving it to:"
87 > - ewarn "${tmpname}"
88 > - ewarn "you may manually remove it"
89 > - mv "${repo_dir}" "${tmpname}" \
90 > - || die "${EBZR}: can't move old checkout out of the way"
91 > - fi
92 > -
93 > if [[ ! -d ${branch_dir}/.bzr ]]; then
94 > if [[ ${repo_dir} != "${branch_dir}" && ! -d ${repo_dir}/.bzr ]]; then
95 > einfo "creating shared bzr repository: ${repo_dir}"
96 > @@ -252,14 +250,23 @@
97 > bzr_update "${EBZR_REPO_URI}" "${branch_dir}"
98 > fi
99 >
100 > + # Restore sandbox environment
101 > + SANDBOX_WRITE=${save_sandbox_write}
102 > +
103 > cd "${branch_dir}" || die "${EBZR}: can't chdir to ${branch_dir}"
104 >
105 > # Save revision number in environment. #311101
106 > export EBZR_REVNO=$(${EBZR_REVNO_CMD})
107 >
108 > - einfo "exporting ..."
109 > - ${EBZR_EXPORT_CMD} ${EBZR_REVISION:+-r ${EBZR_REVISION}} \
110 > - "${WORKDIR}/${P}" . || die "${EBZR}: export failed"
111 > + if [[ -n ${EBZR_WORKDIR_CHECKOUT} ]]; then
112 > + einfo "checking out ..."
113 > + ${EBZR_CHECKOUT_CMD} ${EBZR_REVISION:+-r ${EBZR_REVISION}} \
114 > + . "${WORKDIR}/${P}" || die "${EBZR}: checkout failed"
115 > + else
116 > + einfo "exporting ..."
117 > + ${EBZR_EXPORT_CMD} ${EBZR_REVISION:+-r ${EBZR_REVISION}} \
118 > + "${WORKDIR}/${P}" . || die "${EBZR}: export failed"
119 > + fi
120 > einfo "revision ${EBZR_REVISION:-${EBZR_REVNO}} is now in ${WORKDIR}/${P}"
121 >
122 > popd > /dev/null
123 >
124 >
125
126 -----BEGIN PGP SIGNATURE-----
127 Version: GnuPG v2.0.19 (GNU/Linux)
128 Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
129
130 iQIcBAEBAgAGBQJQUy3iAAoJEKXdFCfdEflKGn8P/2nWVsOWor82RWYneDHpxaFU
131 U0rZn7D3PPNCLhNpIH9/61BlJsarOW7MuFSgTwTRlAnyKN8gLMyOYvr5bBi9URgT
132 7rC6pKxy+tH9EoyemZks9SoTjSQk6d+jZLx+0nvFUqvqtK+Elp0qs4FyxyWDqq0j
133 ZL3dunSIcNHhekQYbuaIJQ6bCBTUyqtUTLyzIWRveoHaGPE0Nl5r7y/LJOeOA4JX
134 my+3UyK6snWvpuUqYjEXjTTRvZivoD1hoX9ALtFOFquzQ6ITHYAWSYgfGP96cTAo
135 +IiSt2DgSCz1wnGyXPgRgj7I0cijtBZ/ozkIZVfEAdbyzatVkOh+vkepF3Fw8698
136 1V5SDjqqPCEtHTcLEvTD5Q7yUhx805N78v47GsYAdwul3ZCFCW8nNUdzbCEIQXWD
137 QXwOZQ9wsYFhedJgbO6Sd68au4OP4L1yL+u/+wdyag5ipnBRcCMuInYmL8n2Orkq
138 UZR+XI6QURauCqg/MoaiUcbRbE6uUQarke93uU0hR3odZlBDk3Evo9Vvs+veK5Cq
139 a9VJig3PD+b+EjFfenDlwptI3oBXtd0NMZgkqL3NrOAxsz4osDj7Un9TXqbdHHt7
140 LAlIgAxWjGZBjGDoj+uFT5DBb+bhI2g0XHik96O5+47oDqw4VORtdOyo0/oo1p14
141 FdwcD7TA9Xb/WDqCKicg
142 =dB/J
143 -----END PGP SIGNATURE-----

Replies

Subject Author
Re: [gentoo-dev] bzr.eclass changes, please review Ulrich Mueller <ulm@g.o>