Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: "Justin Lecher (jlec)" <jlec@g.o>
Cc: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] RFC: intel-sdp-r1.eclass
Date: Mon, 15 Feb 2016 14:35:36
Message-Id: 20160215153512.19c28892.mgorny@gentoo.org
In Reply to: Re: [gentoo-dev] RFC: intel-sdp-r1.eclass by "Justin Lecher (jlec)"
1 On Mon, 15 Feb 2016 14:37:41 +0100
2 "Justin Lecher (jlec)" <jlec@g.o> wrote:
3
4 > On 15/02/16 13:59, Michał Górny wrote:
5 > > On Mon, 15 Feb 2016 09:16:53 +0100
6 > > "Justin Lecher (jlec)" <jlec@g.o> wrote:
7 > >
8 > >> # @ECLASS-VARIABLE: INTEL_SUBDIR
9 > >> # @DEFAULT_UNSET
10 > >> # @DESCRIPTION:
11 > >> # The package sub-directory where it will end-up in /opt/intel
12 > >> # To find out its value, you have to do a raw install from the Intel tar ball
13 > >
14 > > To be honest, I find this kinda terrible. There's a huge block of docs
15 > > which makes me feel small and confused. Maybe it'd useful to give some
16 > > semi-complete example on top (in global doc)?
17 >
18 > That makes definitely make sense. We will add one.
19 >
20 > Although nobody other then the maintainer of this eclass will ever use it.
21
22 Remember that maintainers can change. It's better to have good then
23 have new maintainers figure out all stuff over again.
24
25 > >> # e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli
26 > >> : ${INTEL_BIN_RPMS:=()}
27 > >
28 > > $ : ${foo:=()}
29 > > $ declare -p foo
30 > > declare -- foo="()"
31 > >
32 > > In other words, it doesn't work the way you expect it to.
33 >
34 > I already wondered about this. Is there any way to force a variable to
35 > be an array in bash? Or define it as an empty array?
36
37 Look at e.g. python-utils-r1.
38
39 To check for array:
40
41 if [[ $(declare -p foo) != "declare -a"* ]]; then
42 ...
43 fi
44
45 To default to empty, simple (yet a bit imperfect) way:
46
47 [[ ${foo[@]} }] || foo=()
48
49 > >> # @ECLASS-VARIABLE: INTEL_SINGLE_ARCH
50 > >> # @DESCRIPTION:
51 > >> # Unset, if only the multilib package will be provided by intel
52 > >> : ${INTEL_SINGLE_ARCH:=true}
53 > >
54 > > This is really weird. It sounds like I'm supposed to do:
55 > >
56 > > inherit intel-sdp-r1
57 > > unset INTEL_SINGLE_ARCH
58 > >
59 > > I suggest you used positive logic instead.
60 >
61 > The wording is wrong. Setting it to anything but "true" like
62 > "INTEL_SINGLE_ARCH=false" works. We will fix the wording.
63
64 I still think positive logic is better. That is, a variable which
65 defaults to, say, unset, and changes behavior if it becomes set to
66 non-empty value.
67
68 > >> _isdp_big-warning() {
69 > >> debug-print-function ${FUNCNAME} "${@}"
70 > >>
71 > >> case ${1} in
72 > >> pre-check )
73 > >> echo ""
74 > >
75 > > Don't mix echo with ewarn.
76 >
77 > Why?
78
79 Because they won't go through the same output channels.
80
81 > >> comp_full="${ED}/${INTEL_SDP_DIR}/linux/bin/${arch}/${comp}"
82 > >
83 > > Double slash imminent (ED has one).
84 >
85 > Always? Per definition?
86
87 Yes, sadly. i wanted to change this but it's unlikely to go since it
88 makes EAPI migration hard. If you really want to cover both cases, you
89 can always do ${foo%/}/bar.
90
91 > >> # @CODE
92 > >
93 > > Err, this is not code, you know.
94 >
95 > This is needed for nice formatting. Otherwise there is no line break
96
97 Add an empty line between the two. That should do it correctly, without
98 code blocks in devmanual.
99
100 > >> #maybe use nullglob or [[ $(echo ${dir/*lic) != "${dir}/*lic" ]]
101 > >> [[ $( ls "${dir}"/*lic 2>/dev/null ) ]]; ret=$?
102 > >
103 > > Maybe you should use something sane indeed.
104
105 Maybe file_exists from eutils could help here btw.
106
107 > > Wouldn't you be able to collapse that into one loop?
108 >
109 > no, because the first has ${INTEL_X86}.rpm as suffeix and the later has
110 > ${INTEL_X86}.rpm.
111
112 Errrrr... am I reading wrong, or did you just type the same thing twice?
113
114 > >> einfo "Unpacking ${rb}"
115 > >> rpm2tar -O ${r} | tar xvf - | sed -e \
116 > >> "s:^\.:${EROOT#/}:g" > /dev/null; assert "unpacking ${r} failed"
117 > >
118 > > What's the deal with this sed?
119 >
120 > Good question, but it was there since always and probably the original
121 > author had good reasons for it. We will look into it and comment the code.
122
123 Didn't it change in the past? As I see it, tar here outputs file names,
124 sed edits them and then you discard them to /dev/null. In this case,
125 sed doesn't return any specific exit code so it seems to be a complete
126 no-op.
127
128 Maybe originally it verbosely output the extracted files.
129
130 > >> EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst pkg_postrm pkg_pretend
131 > >
132 > > We usually do this on top, and it's better to do it outside guards so
133 > > that order from inherit is always respected.
134 >
135 > we will move it up. I don't get your second comment. Do you mean the
136 > case someone does
137 >
138 > inherit intel-sdp-r1 some-other-eclass intel-sdp
139 >
140 > ?
141
142 Rather something unlikely like:
143
144 inherit foo bar intel-sdp-r1
145
146 where foo inherits intel-sdp-r1, and therefore the exports occur before
147 bar, and bar takes over even though intel-sdp-r1 is explicitly
148 listed last.
149
150 --
151 Best regards,
152 Michał Górny
153 <http://dev.gentoo.org/~mgorny/>

Replies

Subject Author
Re: [gentoo-dev] RFC: intel-sdp-r1.eclass "Justin Lecher (jlec)" <jlec@g.o>
[gentoo-dev] Re: RFC: intel-sdp-r1.eclass Ryan Hill <rhill@g.o>