mirror of
https://github.com/flatcar/scripts.git
synced 2025-10-01 02:22:11 +02:00
eclass: Drop unused eclasses
This commit is contained in:
parent
52207b2500
commit
014c91c935
@ -1,146 +0,0 @@
|
||||
# Copyright 1999-2014 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
# @ECLASS: openib.eclass
|
||||
# @AUTHOR:
|
||||
# Original Author: Alexey Shvetsov <alexxy@gentoo.org>
|
||||
# @BLURB: Simplify working with OFED packages
|
||||
|
||||
inherit eutils rpm versionator
|
||||
|
||||
EXPORT_FUNCTIONS src_unpack
|
||||
|
||||
HOMEPAGE="https://www.openfabrics.org/"
|
||||
LICENSE="|| ( GPL-2 BSD-2 )"
|
||||
|
||||
# @ECLASS-VARIABLE: OFED_VER
|
||||
# @DESCRIPTION:
|
||||
# Defines OFED version eg 1.4 or 1.4.0.1
|
||||
|
||||
# @ECLASS-VARIABLE: OFED_RC
|
||||
# @DESCRIPTION:
|
||||
# Sets if this version is RC
|
||||
|
||||
# @ECLASS-VARIABLE: OFED_RC_VER
|
||||
# @DESCRIPTION:
|
||||
# Sets RC version
|
||||
|
||||
|
||||
# @ECLASS-VARIABLE: OFED_SUFFIX
|
||||
# @DESCRIPTION:
|
||||
# Defines OFED package suffix eg -1.ofed1.4
|
||||
|
||||
# @ECLASS-VARIABLE: OFED_SNAPSHOT
|
||||
# @DESCRIPTION:
|
||||
# Defines if src tarball is git snapshot
|
||||
|
||||
SLOT="${OFED_VER}"
|
||||
|
||||
# @ECLASS-VARIABLE: OFED_VERSIONS
|
||||
# @DESCRIPTION:
|
||||
# Defines array of ofed version supported by eclass
|
||||
|
||||
OFED_VERSIONS=(
|
||||
"3.5"
|
||||
"3.12"
|
||||
)
|
||||
|
||||
# @FUNCTION: block_other_ofed_versions
|
||||
# @DESCRIPTION:
|
||||
# function that creates blockers list for ofed
|
||||
block_other_ofed_versions() {
|
||||
local slot
|
||||
RDEPEND="${RDEPEND} !sys-fabric/${PN}:0"
|
||||
for slot in ${OFED_VERSIONS[@]}; do
|
||||
if [[ ${slot} != ${SLOT} ]]; then
|
||||
RDEPEND+=" !sys-fabric/${PN}:${slot}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
OFED_BASE_VER=$(get_version_component_range 1-3 ${OFED_VER})
|
||||
|
||||
if [ -z $OFED_RC ] ; then
|
||||
SRC_URI="https://www.openfabrics.org/downloads/OFED/ofed-${OFED_BASE_VER}/OFED-${OFED_VER}.tgz"
|
||||
else
|
||||
SRC_URI="https://www.openfabrics.org/downloads/OFED/ofed-${OFED_BASE_VER}/OFED-${OFED_VER}-rc${OFED_RC_VER}.tgz"
|
||||
fi
|
||||
|
||||
case ${PN} in
|
||||
ofed)
|
||||
MY_PN="compat-rdma"
|
||||
;;
|
||||
*)
|
||||
MY_PN="${PN}"
|
||||
;;
|
||||
esac
|
||||
|
||||
case ${PV} in
|
||||
*p*)
|
||||
MY_PV="${PV/p/}"
|
||||
;;
|
||||
*)
|
||||
MY_PV="${PV}"
|
||||
;;
|
||||
esac
|
||||
|
||||
case ${MY_PN} in
|
||||
ofa_kernel|compat-rdma)
|
||||
EXT="tgz"
|
||||
;;
|
||||
*)
|
||||
EXT="tar.gz"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z ${OFED_SRC_SNAPSHOT} ]; then
|
||||
S="${WORKDIR}/${MY_PN}-${MY_PV}"
|
||||
else
|
||||
S="${WORKDIR}/${MY_PN}-${MY_PV}-${OFED_SUFFIX}"
|
||||
fi
|
||||
|
||||
|
||||
# @FUNCTION: openib_src_unpack
|
||||
# @DESCRIPTION:
|
||||
# This function will unpack OFED packages
|
||||
openib_src_unpack() {
|
||||
unpack ${A}
|
||||
if [ -z ${OFED_RC} ]; then
|
||||
case ${PN} in
|
||||
ofed)
|
||||
rpm_unpack "./OFED-${OFED_VER}/SRPMS/${MY_PN}-${OFED_VER}-${OFED_SUFFIX}.src.rpm"
|
||||
;;
|
||||
*)
|
||||
rpm_unpack "./OFED-${OFED_VER}/SRPMS/${MY_PN}-${MY_PV}-${OFED_SUFFIX}.src.rpm"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
case ${PN} in
|
||||
ofed)
|
||||
rpm_unpack "./OFED-${OFED_VER}-rc${OFED_RC_VER}/SRPMS/${MY_PN}-${OFED_VER}-${OFED_SUFFIX}.src.rpm"
|
||||
;;
|
||||
*)
|
||||
rpm_unpack "./OFED-${OFED_VER}-rc${OFED_RC_VER}/SRPMS/${MY_PN}-${MY_PV}-${OFED_SUFFIX}.src.rpm"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ -z ${OFED_SNAPSHOT} ]; then
|
||||
case ${PN} in
|
||||
ofed)
|
||||
unpack ./${MY_PN}-${OFED_VER}.${EXT}
|
||||
;;
|
||||
*)
|
||||
unpack ./${MY_PN}-${MY_PV}.${EXT}
|
||||
;;
|
||||
esac
|
||||
else
|
||||
case ${PN} in
|
||||
ofed)
|
||||
unpack ./${MY_PN}-${OFED_VER}-${OFED_SUFFIX}.${EXT}
|
||||
;;
|
||||
*)
|
||||
unpack ./${MY_PN}-${MY_PV}-${OFED_SUFFIX}.${EXT}
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
@ -1,126 +0,0 @@
|
||||
# Copyright 1999-2011 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
# @ECLASS: rpm.eclass
|
||||
# @MAINTAINER:
|
||||
# base-system@gentoo.org
|
||||
# @BLURB: convenience class for extracting RPMs
|
||||
|
||||
inherit eutils
|
||||
|
||||
DEPEND=">=app-arch/rpm2targz-9.0.0.3g"
|
||||
|
||||
# @FUNCTION: rpm_unpack
|
||||
# @USAGE: <rpms>
|
||||
# @DESCRIPTION:
|
||||
# Unpack the contents of the specified rpms like the unpack() function.
|
||||
rpm_unpack() {
|
||||
[[ $# -eq 0 ]] && set -- ${A}
|
||||
local a
|
||||
for a in "$@" ; do
|
||||
echo ">>> Unpacking ${a} to ${PWD}"
|
||||
if [[ ${a} == ./* ]] ; then
|
||||
: nothing to do -- path is local
|
||||
elif [[ ${a} == ${DISTDIR}/* ]] ; then
|
||||
ewarn 'QA: do not use ${DISTDIR} with rpm_unpack -- it is added for you'
|
||||
elif [[ ${a} == /* ]] ; then
|
||||
ewarn 'QA: do not use full paths with rpm_unpack -- use ./ paths instead'
|
||||
else
|
||||
a="${DISTDIR}/${a}"
|
||||
fi
|
||||
rpm2tar -O "${a}" | tar xf - || die "failure unpacking ${a}"
|
||||
done
|
||||
}
|
||||
|
||||
# @FUNCTION: srcrpm_unpack
|
||||
# @USAGE: <rpms>
|
||||
# @DESCRIPTION:
|
||||
# Unpack the contents of the specified rpms like the unpack() function as well
|
||||
# as any archives that it might contain. Note that the secondary archive
|
||||
# unpack isn't perfect in that it simply unpacks all archives in the working
|
||||
# directory (with the assumption that there weren't any to start with).
|
||||
srcrpm_unpack() {
|
||||
[[ $# -eq 0 ]] && set -- ${A}
|
||||
rpm_unpack "$@"
|
||||
|
||||
# no .src.rpm files, then nothing to do
|
||||
[[ "$* " != *".src.rpm " ]] && return 0
|
||||
|
||||
eshopts_push -s nullglob
|
||||
|
||||
# unpack everything
|
||||
local a
|
||||
for a in *.tar.{gz,bz2,xz} *.t{gz,bz2,xz,pxz} *.zip *.ZIP ; do
|
||||
unpack "./${a}"
|
||||
rm -f "${a}"
|
||||
done
|
||||
|
||||
eshopts_pop
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# @FUNCTION: rpm_src_unpack
|
||||
# @DESCRIPTION:
|
||||
# Automatically unpack all archives in ${A} including rpms. If one of the
|
||||
# archives in a source rpm, then the sub archives will be unpacked as well.
|
||||
rpm_src_unpack() {
|
||||
local a
|
||||
for a in ${A} ; do
|
||||
case ${a} in
|
||||
*.rpm) srcrpm_unpack "${a}" ;;
|
||||
*) unpack "${a}" ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
# @FUNCTION: rpm_spec_epatch
|
||||
# @USAGE: [spec]
|
||||
# @DESCRIPTION:
|
||||
# Read the specified spec (defaults to ${PN}.spec) and attempt to apply
|
||||
# all the patches listed in it. If the spec does funky things like moving
|
||||
# files around, well this won't handle that.
|
||||
rpm_spec_epatch() {
|
||||
local p spec=$1
|
||||
local dir
|
||||
|
||||
if [[ -z ${spec} ]] ; then
|
||||
# search likely places for the spec file
|
||||
for spec in "${PWD}" "${S}" "${WORKDIR}" ; do
|
||||
spec+="/${PN}.spec"
|
||||
[[ -e ${spec} ]] && break
|
||||
done
|
||||
fi
|
||||
[[ ${spec} == */* ]] \
|
||||
&& dir=${spec%/*} \
|
||||
|| dir=
|
||||
|
||||
ebegin "Applying patches from ${spec}"
|
||||
|
||||
grep '^%patch' "${spec}" | \
|
||||
while read line ; do
|
||||
# expand the %patch line
|
||||
set -- ${line}
|
||||
p=$1
|
||||
shift
|
||||
|
||||
# process the %patch arguments
|
||||
local arg
|
||||
EPATCH_OPTS=
|
||||
for arg in "$@" ; do
|
||||
case ${arg} in
|
||||
-b) EPATCH_OPTS+=" --suffix" ;;
|
||||
*) EPATCH_OPTS+=" ${arg}" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# extract the patch name from the Patch# line
|
||||
set -- $(grep "^P${p#%p}: " "${spec}")
|
||||
shift
|
||||
epatch "${dir:+${dir}/}$*"
|
||||
done
|
||||
|
||||
eend
|
||||
}
|
||||
|
||||
EXPORT_FUNCTIONS src_unpack
|
Loading…
x
Reference in New Issue
Block a user