pck-update (-a6): code cleanups
Signed-off-by: Davide Madrisan <davide.madrisan@gmail.com>
This commit is contained in:
parent
7a0c30d7ad
commit
877e3d5a37
@ -5,6 +5,10 @@ Changes in version 1.9.2
|
|||||||
* templates/library - Davide Madrisan:
|
* templates/library - Davide Madrisan:
|
||||||
Add requirements for pkgconfig.
|
Add requirements for pkgconfig.
|
||||||
|
|
||||||
|
+ update
|
||||||
|
* pck-update - Davide Madrisan:
|
||||||
|
Action 6: code cleanups.
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
Changes in version 1.9.1
|
Changes in version 1.9.1
|
||||||
|
@ -2317,19 +2317,9 @@ rpmbuild exited with error code":" \`$rpmbuild_retcode'"
|
|||||||
6) notify.note "[${NOTE}step $step${NORM}] -- ${NOTE}"$"\
|
6) notify.note "[${NOTE}step $step${NORM}] -- ${NOTE}"$"\
|
||||||
build the list of the build requirements""${NORM}"
|
build the list of the build requirements""${NORM}"
|
||||||
|
|
||||||
# notify.warning $"\
|
|
||||||
#deprecated option"": "$"use"" -a5 --norpm [--force-build]"
|
|
||||||
|
|
||||||
infofile.create
|
infofile.create
|
||||||
. $infofile
|
. $infofile
|
||||||
|
|
||||||
# rpmbuild -bs $SRPM_SPECFILE_WITH_PATH 2>&1
|
|
||||||
# [[ $? -eq 0 ]] ||
|
|
||||||
# notify.error $"rpmbuild exited with error code":" \`$?'"
|
|
||||||
|
|
||||||
local frequires=$(mktemp -q -t frequires.XXXXXXXX) ||
|
|
||||||
notify.error $"can't create temporary files"
|
|
||||||
|
|
||||||
target_cpu.set_and_check
|
target_cpu.set_and_check
|
||||||
|
|
||||||
local i pck filename pck_rpmversion pck_rpmrelease
|
local i pck filename pck_rpmversion pck_rpmrelease
|
||||||
@ -2346,8 +2336,7 @@ build the list of the build requirements""${NORM}"
|
|||||||
|
|
||||||
notify.debug "SPEC_TARGET = [${SPEC_TARGET[*]}]"
|
notify.debug "SPEC_TARGET = [${SPEC_TARGET[*]}]"
|
||||||
|
|
||||||
PERL_PREFIXES=`perl -V | grep "^ /usr/lib/perl5"`
|
local perl_prefixes=`perl -V | grep "^[[:space:]]\+/usr/lib/perl5"`
|
||||||
|
|
||||||
unset provides
|
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
|
||||||
@ -2359,7 +2348,7 @@ $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
|
||||||
#notify.note " * $filename"
|
|
||||||
[ -e $filename ] ||
|
[ -e $filename ] ||
|
||||||
notify.error $"package not found"": \`$filename'"
|
notify.error $"package not found"": \`$filename'"
|
||||||
|
|
||||||
@ -2368,9 +2357,10 @@ $pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm"
|
|||||||
while read line; do echo -n "${line/ */} "; done`"
|
while read line; do echo -n "${line/ */} "; done`"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
local frequires=$(mktemp -q -t frequires.XXXXXXXX) ||
|
||||||
|
notify.error $"can't create temporary files"
|
||||||
|
|
||||||
for pck in ${SPEC_TARGET[*]}; do
|
for pck in ${SPEC_TARGET[*]}; do
|
||||||
# FIXME : we should check and complain if the package has
|
|
||||||
# been built for a different architecture
|
|
||||||
if [ "${SPEC_BUILDARCH:-$BUILD_ARCH}" == "noarch" ]; then
|
if [ "${SPEC_BUILDARCH:-$BUILD_ARCH}" == "noarch" ]; then
|
||||||
filename="$rpms_dir/noarch/\
|
filename="$rpms_dir/noarch/\
|
||||||
$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm"
|
$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm"
|
||||||
@ -2379,11 +2369,9 @@ $pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.noarch.rpm"
|
|||||||
$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm"
|
$pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm"
|
||||||
fi
|
fi
|
||||||
notify.note " * $filename"
|
notify.note " * $filename"
|
||||||
#[ -e $filename ] ||
|
|
||||||
# notify.error $"package not found"": \`$filename'"
|
|
||||||
|
|
||||||
# display all the build requirements
|
# display all the build requirements
|
||||||
rpm -p -q $filename --requires | \
|
( rpm -p -q $filename --requires | \
|
||||||
while read line; do
|
while read line; do
|
||||||
buildreq=""
|
buildreq=""
|
||||||
req=${line/ */}
|
req=${line/ */}
|
||||||
@ -2393,22 +2381,26 @@ $pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm"
|
|||||||
elif [ "${req:0:1}" = "/" ]; then
|
elif [ "${req:0:1}" = "/" ]; then
|
||||||
# file requirement; ignore
|
# file requirement; ignore
|
||||||
:
|
:
|
||||||
elif [ "${req:0:5}" = "perl(" ]; then
|
|
||||||
# a perl requirement
|
|
||||||
preq=`echo $req | sed "s|perl(\(.*\))|\1|g"`
|
|
||||||
preq="`echo $preq | sed 's|::|/|g'`.pm"
|
|
||||||
for p in $PERL_PREFIXES; do
|
|
||||||
[ -e ${p}/${preq} ] &&
|
|
||||||
buildreq=`rpm -qf ${p}/${preq} 2>/dev/null | sed "s|\(.*\)-[^-]*-[^-]*|\1|"`
|
|
||||||
[ "$buildreq" ] && break
|
|
||||||
done
|
|
||||||
[ ! "$buildreq" ] &&
|
|
||||||
echo "# $req: perl requirement not resolved" >> $frequires
|
|
||||||
elif [ "${req:0:7}" = "rpmlib(" -o \
|
elif [ "${req:0:7}" = "rpmlib(" -o \
|
||||||
"${req:0:7}" = "config(" -o \
|
"${req:0:7}" = "config(" -o \
|
||||||
"${req:0:11}" = "executable(" ]; then
|
"${req:0:11}" = "executable(" ]; then
|
||||||
# not a build requirement
|
# not a build requirement
|
||||||
:
|
:
|
||||||
|
elif [ "${req:0:5}" = "perl(" ]; then
|
||||||
|
# a perl requirement
|
||||||
|
preq="`echo $req | \
|
||||||
|
sed -e 's|perl(\(.*\))|\1|g' -e 's|::|/|g'`"".pm"
|
||||||
|
for pp in $perl_prefixes; do
|
||||||
|
[ -e $pp/$preq ] && buildreq=`\
|
||||||
|
rpm -qf $pp/${preq} 2>/dev/null | \
|
||||||
|
sed "s|\(.*\)-[^-]*-[^-]*|\1|"`
|
||||||
|
[ "$buildreq" ] && break
|
||||||
|
done
|
||||||
|
[ "$buildreq" ] ||
|
||||||
|
echo "# $req: perl requirement not resolved"
|
||||||
|
elif [ "${req}" = "python(abi)" ]; then
|
||||||
|
# python requirement
|
||||||
|
buildreq=libpython-devel
|
||||||
elif [ "${req/.so*/}" != "$req" ]; then
|
elif [ "${req/.so*/}" != "$req" ]; then
|
||||||
# requirement is a shared library
|
# requirement is a shared library
|
||||||
req=${req/(*)/}
|
req=${req/(*)/}
|
||||||
@ -2418,46 +2410,46 @@ $pck-$pck_rpmversion-$pck_rpmrelease$DISTRO_rpm.$target_cpu.rpm"
|
|||||||
if [ "$libpath" ]; then
|
if [ "$libpath" ]; then
|
||||||
libpath=${libpath/* => /}
|
libpath=${libpath/* => /}
|
||||||
solibpath="${libpath/.so*/}.so"
|
solibpath="${libpath/.so*/}.so"
|
||||||
if [ ! -e $solibpath -a "${solibpath:0:5}" = "/lib/" ]; then
|
if [ ! -e $solibpath \
|
||||||
|
-a "${solibpath:0:5}" = "/lib/" ]; then
|
||||||
solibpath="/usr$solibpath"
|
solibpath="/usr$solibpath"
|
||||||
fi
|
fi
|
||||||
eval buildreq=`rpm -qf $solibpath 2>/dev/null | \
|
eval buildreq=`rpm -qf $solibpath 2>/dev/null | \
|
||||||
sed "s|\(.*\)-[^-]*-[^-]*|\1|"` 2>/dev/null
|
sed "s|\(.*\)-[^-]*-[^-]*|\1|"` 2>/dev/null
|
||||||
if [ ! "$buildreq" -o $? -ne 0 ]; then
|
if [ ! "$buildreq" -o $? -ne 0 ]; then
|
||||||
# let's try removing version extension in libname
|
# let's try removing version extension in libname
|
||||||
# (eg. liblber-2.2.so => liblber.so)
|
# (eg. liblber-2.2.so => liblber.so)
|
||||||
solibpath=`echo $solibpath | sed "s|-[0-9.]*\.so|.so|"`
|
solibpath=`echo $solibpath | sed "s|-[0-9.]*\.so|.so|"`
|
||||||
eval buildreq=`rpm -qf $solibpath 2>/dev/null | \
|
eval buildreq=`rpm -qf $solibpath 2>/dev/null | \
|
||||||
sed "s|\(.*\)-[^-]*-[^-]*|\1|"` 2>/dev/null
|
sed "s|\(.*\)-[^-]*-[^-]*|\1|"` 2>/dev/null
|
||||||
[ ! "$buildreq" -o $? -ne 0 ] &&
|
[ ! "$buildreq" -o $? -ne 0 ] &&
|
||||||
echo "#$req: .so link not found" >> $frequires
|
echo "#$req: .so link not found"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "\
|
echo "\
|
||||||
#$req: library not reported by ldconfig; run \`ldconfig' and try again" >> $frequires
|
#$req: library not reported by ldconfig; run \`ldconfig' and try again"
|
||||||
fi
|
fi
|
||||||
elif [ "${req}" = "python(abi)" ]; then
|
|
||||||
# python requirement
|
|
||||||
buildreq=libpython-devel
|
|
||||||
else
|
else
|
||||||
# unidentified requirement
|
# unidentified requirement
|
||||||
buildreq=`rpm -q --whatprovides $req 2>/dev/null | sed "s|\(.*\)-[^-]*-[^-]*|\1|"`
|
buildreq=`rpm -q --whatprovides $req 2>/dev/null | \
|
||||||
[ "$buildreq" ] || echo "#$req: not found; what is this?" >> $frequires
|
sed "s|\(.*\)-[^-]*-[^-]*|\1|"`
|
||||||
|
[ "$buildreq" ] || \
|
||||||
|
echo "#$req: not found; what is this?"
|
||||||
fi
|
fi
|
||||||
if [ "${buildreq}" -a "${buildreq/%-devel/}" = "${buildreq}" ]; then
|
if [ "${buildreq}" \
|
||||||
|
-a "${buildreq/%-devel/}" = "${buildreq}" ]; then
|
||||||
# if a -devel exists for this package, use it
|
# if a -devel exists for this package, use it
|
||||||
develpkg=`rpm -q ${buildreq}-devel 2>/dev/null` &&
|
develpkg=`rpm -q ${buildreq}-devel 2>/dev/null` &&
|
||||||
buildreq=`echo $develpkg | sed "s|\(.*\)-[^-]*-[^-]*|\1|"`
|
buildreq=`echo $develpkg | sed "s|\(.*\)-[^-]*-[^-]*|\1|"`
|
||||||
fi
|
fi
|
||||||
# finally print buildrequires line
|
# finally print buildrequires block
|
||||||
[ "$buildreq" ] && echo "BuildRequires: $buildreq" >> $frequires
|
[ "$buildreq" ] && echo "BuildRequires: $buildreq"
|
||||||
done
|
done ) >> $frequires
|
||||||
done
|
done
|
||||||
|
|
||||||
notify.note "## AUTOBUILDREQ-BEGIN"
|
notify.note "## AUTOBUILDREQ-BEGIN"
|
||||||
cat $frequires | sort -u
|
cat $frequires | sort -u
|
||||||
notify.note "## AUTOBUILDREQ-END"
|
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}"$"\
|
||||||
|
Loading…
Reference in New Issue
Block a user