slackpkg search allow to more packages with the same name but different

version on the other repositories.
This commit is contained in:
Matteo Rossini 2016-01-17 19:34:37 +01:00
parent 9db0a417a4
commit 813f2469a8

View file

@ -881,7 +881,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
# -- PKGLIST: # -- PKGLIST:
# temporary file used to store data about packages. It uses # temporary file used to store data about packages. It uses
# the following format: # the following format:
# repository:<repository_name>:basename:<package_basename>: # repo:<repository_name>:bname:<package_basename>:ver:<package_version>:fname:<package_fullname>:
# #
PKGLIST=$(tempfile --directory=$TMPDIR) PKGLIST=$(tempfile --directory=$TMPDIR)
PKGINFOS=$(tempfile --directory=$TMPDIR) PKGINFOS=$(tempfile --directory=$TMPDIR)
@ -914,23 +914,33 @@ if [ "$SLACKPKGPLUS" = "on" ];then
}' l_dir=${DIR} > $PKGINFOS }' l_dir=${DIR} > $PKGINFOS
else # -- CMD==search else # -- CMD==search
grep ${GREPOPTS} "^${DIR}.*${SEARCHSTR}" "${TMPDIR}/pkglist" > $PKGINFOS grep ${GREPOPTS} "^${DIR} \([^ ]*${SEARCHSTR}\)\|\(.*/${SEARCHSTR}/\)\|\(.*/SLACKPKGPLUS_${SEARCHSTR}\)" "${TMPDIR}/pkglist" > $PKGINFOS
fi fi
while read PKG ; do while read PKGDIR PKGBASENAME PKGVER PKGARCH PKGBUILD PKGFULLNAME PKGPATH PKGEXT ; do
PKGDATA=( $PKG ) # PKGDATA([0]=DIR,[1]=BASENMAE,[5]=FULLNAME)
PKGDIR=${PKGDATA[0]} # was PKGDIR=$(echo "$PKG" | cut -f1 -d" ") # does nothing when the package has been handled ...
PKGBASENAME=${PKGDATA[1]} # was PKGBASENAME=$(echo "$PKG" | cut -f2 -d" ") grep -q "^repo:${PKGDIR}:bname:${PKGBASENAME}:ver:${PKGVER}:fname:${PKGFULLNAME}:" $PKGLIST && continue
PKGFULLNAME=${PKGDATA[5]} # was PKGFULLNAME=$(echo "$PKG" | cut -f6 -d" ")
if [[ "$PKGDIR" =~ ^SLACKPKGPLUS_ ]] ; then # was if echo "$PKGDIR" | grep -q "SLACKPKGPLUS_" ; then # When a package P' with the same basename has been handled before the current package, this means
grep -q "^repository:${PKGDIR}:basename:${PKGBASENAME}:" $PKGLIST && continue # the package P' has precedence over P.
if grep -q ":bname:${PKGBASENAME}:" $PKGLIST ; then
# if the current package P is installed, this means the previous P' will be
# proposed as an upgrade to P. In this case, the loop must continue without
# any other action...
grep -q " $PKGFULLNAME " ${TMPDIR}/tmplist && continue
# The current package P is not installed. In this case P must be shown as
# being uninstalled and masked.
LIST="$LIST MASKED_${PKGDIR}:${PKGFULLNAME}"
else else
grep -q ":basename:${PKGBASENAME}:" $PKGLIST && continue LIST="$LIST ${PKGDIR}:${PKGFULLNAME}"
fi fi
LIST="$LIST ${PKGDIR}:${PKGFULLNAME}"
echo "repository:${PKGDIR}:basename:${PKGBASENAME}:" >> $PKGLIST echo "repo:${PKGDIR}:bname:${PKGBASENAME}:ver:${PKGVER}:fname:${PKGFULLNAME}:" >> $PKGLIST
done < $PKGINFOS done < $PKGINFOS
done done
rm -f $PKGLIST $PKGINFOS rm -f $PKGLIST $PKGINFOS
@ -976,10 +986,17 @@ if [ "$SLACKPKGPLUS" = "on" ];then
# Default is uninstalled # Default is uninstalled
STATUS="uninstalled" STATUS="uninstalled"
# First is the package already installed? if [[ $REPO =~ ^MASKED_.* ]] ; then
# Amazing what a little sleep will do REPO=${REPO/MASKED_/}
# exclusion is so much nicer :) STATUS="uninstalled(masked)"
INSTPKG=$(echo "$INSTPKGS"|grep "^${BASENAME}-[^-]\+-[^-]\+-[^-]\+$") INSTPKG=""
else
# First is the package already installed?
# Amazing what a little sleep will do
# exclusion is so much nicer :)
INSTPKG=$(echo "$INSTPKGS"|grep "^${BASENAME}-[^-]\+-[^-]\+-[^-]\+$")
fi
# INSTPKG is local version # INSTPKG is local version
if [ ! "${INSTPKG}" = "" ]; then if [ ! "${INSTPKG}" = "" ]; then
@ -988,24 +1005,24 @@ if [ "$SLACKPKGPLUS" = "on" ];then
# that match the basename ${BASENAME} must be handled # that match the basename ${BASENAME} must be handled
for CINSTPKG in ${INSTPKG} ; do for CINSTPKG in ${INSTPKG} ; do
CBASENAME=$(echo "${CINSTPKG}" | rev | cut -f4- -d- | rev) CBASENAME=${CINSTPKG%-*-*-*}
if [ "${CBASENAME}" == "${BASENAME}" ] ; then if [ "${CBASENAME}" == "${BASENAME}" ] ; then
# If installed is it uptodate? # If installed is it uptodate?
if [ "${CINSTPKG}" = "${RAWNAME}" ]; then if [ "${CINSTPKG}" = "${RAWNAME}" ]; then
STATUS=" installed " STATUS=" installed "
printf " %-16s %-24s %-40s \n" "$STATUS" "$REPO" "$CINSTPKG" printf " %-20s %-24s %-40s \n" "$STATUS" "$REPO" "$CINSTPKG"
else else
STATUS="upgrade" STATUS="upgrade"
printf " %-16s %-24s %-40s \n" "$STATUS" "$REPO" "$CINSTPKG --> ${RAWNAME}" printf " %-20s %-24s %-40s \n" "$STATUS" "$REPO" "$CINSTPKG --> ${RAWNAME}"
fi fi
fi fi
done done
else else
printf " %-16s %-24s %-40s \n" "$STATUS" "$REPO" "${RAWNAME}" printf " %-20s %-24s %-40s \n" "$STATUS" "$REPO" "${RAWNAME}"
fi fi
done done|sort
} # END function searchlistEX() } # END function searchlistEX()