pck-update (-a6): another bunch of code cleanups

Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
Davide Madrisan 2012-01-29 17:34:11 +01:00
parent 877e3d5a37
commit 3ce36517c5

View File

@ -2334,10 +2334,7 @@ build the list of the build requirements""${NORM}"
notify.debug "pck_rpmversion = $pck_rpmversion" notify.debug "pck_rpmversion = $pck_rpmversion"
notify.debug "pck_rpmrelease = $pck_rpmrelease" notify.debug "pck_rpmrelease = $pck_rpmrelease"
notify.debug "SPEC_TARGET = [${SPEC_TARGET[*]}]" local pcks_list
local perl_prefixes=`perl -V | grep "^[[:space:]]\+/usr/lib/perl5"`
unset provides
for pck in ${SPEC_TARGET[*]}; do for pck in ${SPEC_TARGET[*]}; do
# FIXME : we should check and complain if the package has # FIXME : we should check and complain if the package has
# been built for a different architecture # been built for a different architecture
@ -2348,35 +2345,33 @@ $pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm"
filename="$rpms_dir/$target_cpu/\ filename="$rpms_dir/$target_cpu/\
$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm" $pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm"
fi fi
[ -e $filename ] || [ -e $filename ] ||
notify.error $"package not found"": \`$filename'" notify.error $"package not found"": \`$filename'"
notify.note " * $filename"
# look for RPMs provides pcks_list=( ${pcks_list[*]} "$filename" )
provides="$provides `rpm -p -q $filename --provides | \
while read line; do echo -n "${line/ */} "; done`"
done done
notify.debug "SPEC_TARGET = [ ${SPEC_TARGET[*]} ]"
notify.debug "pcks_list = [ ${pcks_list[*]} ]"
local frequires=$(mktemp -q -t frequires.XXXXXXXX) || local frequires=$(mktemp -q -t frequires.XXXXXXXX) ||
notify.error $"can't create temporary files" notify.error $"can't create temporary files"
# FIXME: "/usr/lib/perl5" should be defined in autospec.conf
local perl_prefixes=$(perl -V | grep "^[[:space:]]\+/usr/lib/perl5")
for pck in ${SPEC_TARGET[*]}; do # look for RPMs provides
if [ "${SPEC_BUILDARCH:-$BUILD_ARCH}" == "noarch" ]; then local pcks_provides=(
filename="$rpms_dir/noarch/\ $(rpm -p -q --provides ${pcks_list[*]} 2>/dev/null | sort -u | \
$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm" while read line; do echo "${line// /}"; done) )
else notify.debug "pcks_provides = [${pcks_provides[*]}]"
filename="$rpms_dir/$target_cpu/\
$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm"
fi
notify.note " * $filename"
# display all the build requirements # display all the build requirements
( rpm -p -q $filename --requires | \ ( rpm -p -q --requires ${pcks_list[*]} | sort -u | \
while read line; do while read line; do
buildreq="" buildreq=
req=${line/ */} req=${line// /}
if [ "`echo \"$provides\" | grep ${req}`" ]; then if [ -n "$(for p in ${pcks_provides[*]}; do
# self-provided requirement # self-provided requirement
[ "$p" = "${req}" ] && echo "$p"; done)" ]; then
: :
elif [ "${req:0:1}" = "/" ]; then elif [ "${req:0:1}" = "/" ]; then
# file requirement; ignore # file requirement; ignore
@ -2388,17 +2383,18 @@ $pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm"
: :
elif [ "${req:0:5}" = "perl(" ]; then elif [ "${req:0:5}" = "perl(" ]; then
# a perl requirement # a perl requirement
preq="`echo $req | \ preq="$(echo $req | \
sed -e 's|perl(\(.*\))|\1|g' -e 's|::|/|g'`"".pm" sed -e 's|perl(\(.*\))|\1|g' -e 's|::|/|g')"".pm"
for pp in $perl_prefixes; do for pp in $perl_prefixes; do
[ -e $pp/$preq ] && buildreq=`\ [ -e $pp/$preq ] && buildreq=$(\
rpm -qf $pp/${preq} 2>/dev/null | \ rpm -qf $pp/${preq} 2>/dev/null | \
sed "s|\(.*\)-[^-]*-[^-]*|\1|"` sed "s|\(.*\)-[^-]*-[^-]*|\1|")
[ "$buildreq" ] && break [ "$buildreq" ] && break
done done
[ "$buildreq" ] || [ "$buildreq" ] ||
echo "# $req: perl requirement not resolved" echo "# $req: perl requirement not resolved"
elif [ "${req}" = "python(abi)" ]; then elif [ "${req}" = "python(abi)" ]; then
# FIXME: libpython-devel should be defined in autospec.conf
# python requirement # python requirement
buildreq=libpython-devel buildreq=libpython-devel
elif [ "${req/.so*/}" != "$req" ]; then elif [ "${req/.so*/}" != "$req" ]; then
@ -2445,11 +2441,12 @@ $pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm"
# finally print buildrequires block # finally print buildrequires block
[ "$buildreq" ] && echo "BuildRequires: $buildreq" [ "$buildreq" ] && echo "BuildRequires: $buildreq"
done ) >> $frequires done ) >> $frequires
done
notify.note "## AUTOBUILDREQ-BEGIN" notify.note "
cat $frequires | sort -u ## AUTOBUILDREQ-BEGIN"
notify.note "## AUTOBUILDREQ-END" sort -u $frequires
notify.note "## AUTOBUILDREQ-END
"
rm -f $frequires rm -f $frequires
;; ;;
7) notify.note "[${NOTE}step $step${NORM}] -- ${NOTE}"$"\ 7) notify.note "[${NOTE}step $step${NORM}] -- ${NOTE}"$"\