Gentoo Archives: gentoo-dev

From: justin <jlec@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] RFC: intel-sdp.eclass - support for absolute location of rpms
Date: Mon, 22 Jul 2013 12:04:39
Message-Id: 51ED1FCE.7090401@gentoo.org
1 Hi,
2
3 this patch adds proper support for rpm location outside the main directory.
4
5 The old API only allowed defining the rpm basic name, which gets
6 combined with the possible subdirs containing rpms.
7
8 The new API only allows a single main directory where it expects rpms
9 in. If there are rpms outside this dir, you need to give the full path.
10
11 Thanks for comments,
12 Justin
13
14
15 --- /local/home/justin/tree/eclass/intel-sdp.eclass 2013-07-19
16 16:00:50.000000000 +0200
17 +++ intel-sdp.eclass 2013-07-22 14:02:16.686582103 +0200
18 @@ -65,11 +65,10 @@
19 # Possibility to skip the mandatory check for licenses. Only set this
20 if there
21 # is really no fix.
22
23 -# @ECLASS-VARIABLE: INTEL_RPMS_DIRS
24 +# @ECLASS-VARIABLE: INTEL_RPMS_DIR
25 # @DESCRIPTION:
26 -# List of subdirectories in the main archive which contains the
27 -# rpms to extract.
28 -: ${INTEL_RPMS_DIRS:=rpm}
29 +# Main subdirectory which contains the rpms to extract.
30 +: ${INTEL_RPMS_DIR:=rpm}
31
32 # @ECLASS-VARIABLE: INTEL_X86
33 # @DESCRIPTION:
34 @@ -84,6 +83,11 @@
35 # Functional name of rpm without any version/arch tag
36 #
37 # e.g. compilerprof
38 +#
39 +# if the rpm is located in a directory different to INTEL_RPMS_DIR you can
40 +# specify the full path
41 +#
42 +# e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli
43
44 # @ECLASS-VARIABLE: INTEL_DAT_RPMS
45 # @DEFAULT_UNSET
46 @@ -92,6 +96,11 @@
47 # without any version tag
48 #
49 # e.g. openmp
50 +#
51 +# if the rpm is located in a directory different to INTEL_RPMS_DIR you can
52 +# specify the full path
53 +#
54 +# e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli-common
55
56 # @ECLASS-VARIABLE: INTEL_SDP_DB
57 # @DESCRIPTION:
58 @@ -328,14 +337,23 @@
59 INTEL_ARCH="intel64 ia32"
60 fi
61 fi
62 - INTEL_RPMS=""
63 + INTEL_RPMS=()
64 + INTEL_RPMS_FULL=()
65 for p in ${INTEL_BIN_RPMS}; do
66 - for a in ${arch}; do
67 - INTEL_RPMS+="
68 intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.${a}.rpm"
69 - done
70 + if [ ${p} == $(basename ${p}) ]; then
71 + for a in ${arch}; do
72 + INTEL_RPMS+=(
73 intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.${a}.rpm
74 )
75 + done
76 + else
77 + INTEL_RPMS_FULL+=(
78 ${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.${a}.rpm )
79 + fi
80 done
81 for p in ${INTEL_DAT_RPMS}; do
82 - INTEL_RPMS+="
83 intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.noarch.rpm"
84 + if [ ${p} == $(basename ${p}) ]; then
85 + INTEL_RPMS+=(
86 intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.noarch.rpm
87 )
88 + else
89 + INTEL_RPMS_FULL+=(
90 ${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.noarch.rpm )
91 + fi
92 done
93
94 case "${EAPI:-0}" in
95 @@ -347,23 +365,31 @@
96 # @DESCRIPTION:
97 # Unpacking necessary rpms from tarball, extract them and rearrange the
98 output.
99 intel-sdp_src_unpack() {
100 - local l r subdir rb t list=()
101 + local l r subdir rb t list=() debug_list
102
103 for t in ${A}; do
104 - for r in ${INTEL_RPMS}; do
105 - for subdir in ${INTEL_RPMS_DIRS}; do
106 - rpmdir=${t%%.*}/${subdir}
107 - debug-print "Adding to decompression list: ${rpmdir}/${r}"
108 - list+=( ${rpmdir}/${r})
109 - done
110 + for r in ${INTEL_RPMS[@]}; do
111 + rpmdir=${t%%.*}/${INTEL_RPMS_DIR}
112 + list+=( ${rpmdir}/${r} )
113 + done
114 +
115 + for r in ${INTEL_RPMS_FULL[@]}; do
116 + list+=( ${t%%.*}/${r} )
117 done
118 - tar xvf "${DISTDIR}"/${t} ${list[@]} &> "${T}"/rpm-extraction.log || die
119 +
120 + debug_list="$(IFS=$'\n'; echo ${list[@]} )"
121 +
122 + debug-print "Adding to decompression list:"
123 + debug-print ${debug_list}
124 +
125 + tar xvf "${DISTDIR}"/${t} ${list[@]} &> "${T}"/rpm-extraction.log
126 +
127 for r in ${list[@]}; do
128 rb=$(basename ${r})
129 l=.${rb}_$(date +'%d%m%y_%H%M%S').log
130 einfo "Unpacking ${rb}"
131 rpm2tar -O ${r} | tar xvf - | sed -e \
132 - "s:^\.:${EROOT#/}:g" > ${l} || die "unpacking ${r} failed"
133 + "s:^\.:${EROOT#/}:g" > ${l}; assert "unpacking ${r} failed"
134 mv ${l} opt/intel/ || die "failed moving extract log file"
135 done
136 done

Attachments

File name MIME type
signature.asc application/pgp-signature