[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    [gentoo-dev] RFC: intel-sdp.eclass - support for absolute location of rpms
From:       justin <jlec () gentoo ! org>
Date:       2013-07-22 12:04:30
Message-ID: 51ED1FCE.7090401 () gentoo ! org
[Download RAW message or body]


Hi,

this patch adds proper support for rpm location outside the main directory.

The old API only allowed defining the rpm basic name, which gets
combined with the possible subdirs containing rpms.

The new API only allows a single main directory where it expects rpms
in. If there are rpms outside this dir, you need to give the full path.

Thanks for comments,
Justin


--- /local/home/justin/tree/eclass/intel-sdp.eclass	2013-07-19
16:00:50.000000000 +0200
+++ intel-sdp.eclass	2013-07-22 14:02:16.686582103 +0200
@@ -65,11 +65,10 @@
 # Possibility to skip the mandatory check for licenses. Only set this
if there
 # is really no fix.

-# @ECLASS-VARIABLE: INTEL_RPMS_DIRS
+# @ECLASS-VARIABLE: INTEL_RPMS_DIR
 # @DESCRIPTION:
-# List of subdirectories in the main archive which contains the
-# rpms to extract.
-: ${INTEL_RPMS_DIRS:=rpm}
+# Main subdirectory which contains the rpms to extract.
+: ${INTEL_RPMS_DIR:=rpm}

 # @ECLASS-VARIABLE: INTEL_X86
 # @DESCRIPTION:
@@ -84,6 +83,11 @@
 # Functional name of rpm without any version/arch tag
 #
 # e.g. compilerprof
+#
+# if the rpm is located in a directory different to INTEL_RPMS_DIR you can
+# specify the full path
+#
+# e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli

 # @ECLASS-VARIABLE: INTEL_DAT_RPMS
 # @DEFAULT_UNSET
@@ -92,6 +96,11 @@
 # without any version tag
 #
 # e.g. openmp
+#
+# if the rpm is located in a directory different to INTEL_RPMS_DIR you can
+# specify the full path
+#
+# e.g. CLI_install/rpm/intel-vtune-amplifier-xe-cli-common

 # @ECLASS-VARIABLE: INTEL_SDP_DB
 # @DESCRIPTION:
@@ -328,14 +337,23 @@
 			INTEL_ARCH="intel64 ia32"
 		fi
 	fi
-	INTEL_RPMS=""
+	INTEL_RPMS=()
+	INTEL_RPMS_FULL=()
 	for p in ${INTEL_BIN_RPMS}; do
-		for a in ${arch}; do
-			INTEL_RPMS+="
intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.${a}.rpm"
-		done
+		if [ ${p} == $(basename ${p}) ]; then
+			for a in ${arch}; do
+				INTEL_RPMS+=(
intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.${a}.rpm
)
+			done
+		else
+			INTEL_RPMS_FULL+=(
${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.${a}.rpm )
+		fi
 	done
 	for p in ${INTEL_DAT_RPMS}; do
-		INTEL_RPMS+="
intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.noarch.rpm"
+		if [ ${p} == $(basename ${p}) ]; then
+			INTEL_RPMS+=(
intel-${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.noarch.rpm
)
+		else
+			INTEL_RPMS_FULL+=(
${p}-${_INTEL_PV4}-${_INTEL_PV1}.${_INTEL_PV2}-${_INTEL_PV3}.noarch.rpm )
+		fi
 	done

 	case "${EAPI:-0}" in
@@ -347,23 +365,31 @@
 # @DESCRIPTION:
 # Unpacking necessary rpms from tarball, extract them and rearrange the
output.
 intel-sdp_src_unpack() {
-	local l r subdir rb t list=()
+	local l r subdir rb t list=() debug_list

 	for t in ${A}; do
-		for r in ${INTEL_RPMS}; do
-			for subdir in ${INTEL_RPMS_DIRS}; do
-				rpmdir=${t%%.*}/${subdir}
-				debug-print "Adding to decompression list: ${rpmdir}/${r}"
-				list+=( ${rpmdir}/${r})
-			done
+		for r in ${INTEL_RPMS[@]}; do
+			rpmdir=${t%%.*}/${INTEL_RPMS_DIR}
+			list+=( ${rpmdir}/${r} )
+		done
+
+		for r in ${INTEL_RPMS_FULL[@]}; do
+			list+=( ${t%%.*}/${r} )
 		done
-		tar xvf "${DISTDIR}"/${t} ${list[@]} &> "${T}"/rpm-extraction.log || die
+
+		debug_list="$(IFS=$'\n'; echo ${list[@]} )"
+
+		debug-print "Adding to decompression list:"
+		debug-print ${debug_list}
+
+		tar xvf "${DISTDIR}"/${t} ${list[@]} &> "${T}"/rpm-extraction.log
+
 		for r in ${list[@]}; do
 			rb=$(basename ${r})
 			l=.${rb}_$(date +'%d%m%y_%H%M%S').log
 			einfo "Unpacking ${rb}"
 			rpm2tar -O ${r} | tar xvf - | sed -e \
-				"s:^\.:${EROOT#/}:g" > ${l} || die "unpacking ${r} failed"
+				"s:^\.:${EROOT#/}:g" > ${l}; assert "unpacking ${r} failed"
 			mv ${l} opt/intel/ || die "failed moving extract log file"
 		done
 	done



["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic