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