mirror of
https://github.com/zuno/slackpkgplus
synced 2025-01-13 20:01:04 +01:00
Merge branch 'test'
slackpkgplus.sh fix slackpkg search in certain condition
This commit is contained in:
commit
f3996a076a
1 changed files with 52 additions and 10 deletions
|
@ -1091,17 +1091,40 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
[ "$SENSITIVE_SEARCH" = "off" ] && GREPOPTS="--ignore-case"
|
[ "$SENSITIVE_SEARCH" = "off" ] && GREPOPTS="--ignore-case"
|
||||||
|
|
||||||
# -- PKGLIST:
|
# -- PKGLIST:
|
||||||
# temporary file used to store data about packages. It uses
|
# temporary file used to store data about handled packages. It uses
|
||||||
# the following format:
|
# the following format:
|
||||||
# repo:<repository_name>:bname:<package_basename>:ver:<package_version>:fname:<package_fullname>:
|
# 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)
|
||||||
|
|
||||||
|
|
||||||
for i in ${PRIORITY[@]}; do
|
for i in ${PRIORITY[@]}; do
|
||||||
DIR="$i"
|
DIR="$i"
|
||||||
|
PAT=""
|
||||||
if [[ "$DIR" =~ ^[-_[:alnum:]]+[:] ]] ; then # was if echo "$DIR" | grep -q "[a-zA-Z0-9]\+[:]" ; then
|
if [[ "$DIR" =~ ^[-_[:alnum:]]+[:] ]] ; then # was if echo "$DIR" | grep -q "[a-zA-Z0-9]\+[:]" ; then
|
||||||
DIR=${DIR/:*/} # was DIR=$(echo "$i" | cut -f1 -d":")
|
DIR=${i/:*/} # was DIR=$(echo "$i" | cut -f1 -d":")
|
||||||
|
|
||||||
|
# extract the pattern from $i, if and only if "$i" is to the syntax <repo>:<pattern>. Without
|
||||||
|
# this, PAT would be set to $DIR when $i is to the syntax <repo>.
|
||||||
|
#
|
||||||
|
[[ "$DIR" =~ [:][:alnum:]+ ]] && PAT=${i/*:/}
|
||||||
|
|
||||||
|
# when the current priority is of kind <REPO>:<PATTERN>, the loop must be short-circuited
|
||||||
|
# when SEARCHSTR does not match PATTERN, otherwise, some packages could be mistakenly
|
||||||
|
# selected.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
# - p7zip is present in alien and boost
|
||||||
|
# - alien has precedence over boost
|
||||||
|
# - PKGS_PRIORITY=(boost:infozip)
|
||||||
|
# - p7zip from alien is installed.
|
||||||
|
#
|
||||||
|
# In these case, the priority boost:infozip must be ignored otherwise slackpkg+ will
|
||||||
|
# wrongly shows boost:p7zip as an upgrade for alien:p7zip
|
||||||
|
#
|
||||||
|
|
||||||
|
[ ! -z "$PAT" ] && ! echo "$SEARCHSTR" | grep -qw "$PAT" && continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$CMD" == "file-search" ] ; then
|
if [ "$CMD" == "file-search" ] ; then
|
||||||
|
@ -1127,7 +1150,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
}' l_dir=${DIR} > $PKGINFOS
|
}' l_dir=${DIR} > $PKGINFOS
|
||||||
|
|
||||||
else # -- CMD==search
|
else # -- CMD==search
|
||||||
grep -h ${GREPOPTS} "^$DIR" ${WORKDIR}/pkglist ${TMPDIR}/pkglist-pre|grep -E ${GREPOPTS} "/SLACKPKGPLUS_$SEARCHSTR/|/$SEARCHSTR/|/$SEARCHSTR | [^ /]*$SEARCHSTR[^ /]* " > $PKGINFOS
|
grep -h ${GREPOPTS} "^$DIR" ${TMPDIR}/pkglist ${TMPDIR}/pkglist-pre|grep -E ${GREPOPTS} "/SLACKPKGPLUS_$SEARCHSTR/|/$SEARCHSTR/|/$SEARCHSTR | [^ /]*$SEARCHSTR[^ /]* " > $PKGINFOS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while read PKGDIR PKGBASENAME PKGVER PKGARCH PKGBUILD PKGFULLNAME PKGPATH PKGEXT ; do
|
while read PKGDIR PKGBASENAME PKGVER PKGARCH PKGBUILD PKGFULLNAME PKGPATH PKGEXT ; do
|
||||||
|
@ -1140,14 +1163,26 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
|
|
||||||
if grep ${GREPOPTS} -q ":bname:${PKGBASENAME}:" $PKGLIST ; then
|
if grep ${GREPOPTS} -q ":bname:${PKGBASENAME}:" $PKGLIST ; then
|
||||||
|
|
||||||
# if the current package P is installed, this means the previous P' will be
|
# P' has precedence over P. Therefore, P must be displayed with masked
|
||||||
# proposed as an upgrade to P. In this case, the loop must continue without
|
# attribute, unless when installed, in which case P' will be proposed
|
||||||
# any other action...
|
# as an upgrade to P.
|
||||||
grep ${GREPOPTS} -q " $PKGFULLNAME " ${TMPDIR}/tmplist && continue
|
|
||||||
|
|
||||||
# The current package P is not installed. In this case P must be shown as
|
MASKED=true
|
||||||
# being uninstalled and masked.
|
|
||||||
LIST="$LIST MASKED_${PKGDIR}:${PKGFULLNAME}"
|
if grep ${GREPOPTS} -q " $PKGFULLNAME " ${TMPDIR}/tmplist ; then
|
||||||
|
COUNT=$(grep ":$PKGFULLNAME:" $PKGLIST | wc -l)
|
||||||
|
|
||||||
|
# P is installed. It should not be masked. However, when different
|
||||||
|
# repositories offer the same package (ie. same name,version,arch,
|
||||||
|
# build) this rule must be applied only when there's *no occurence*
|
||||||
|
# of fullname(P) in PKGLIST (ie. list of handled packages).
|
||||||
|
#
|
||||||
|
[ $COUNT -eq 0 ] && MASKED=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $MASKED = true ] ; then
|
||||||
|
LIST="$LIST MASKED_${PKGDIR}:${PKGFULLNAME}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
LIST="$LIST ${PKGDIR}:${PKGFULLNAME}"
|
LIST="$LIST ${PKGDIR}:${PKGFULLNAME}"
|
||||||
fi
|
fi
|
||||||
|
@ -1227,6 +1262,13 @@ if [ "$SLACKPKGPLUS" = "on" ];then
|
||||||
STATUS="installed"
|
STATUS="installed"
|
||||||
echo " $STATUS# $REPO# $CINSTPKG"
|
echo " $STATUS# $REPO# $CINSTPKG"
|
||||||
else
|
else
|
||||||
|
|
||||||
|
INSTPKG_REPO=$(grep -m 1 " $CINSTPKG " ${WORKDIR}/pkglist | cut -f1 -d" " | sed "s/SLACKPKGPLUS_//")
|
||||||
|
|
||||||
|
if [ ! -z "$INSTPKG_REPO" ] && [ "$INSTPKG_REPO" != "$REPO" ] ; then
|
||||||
|
CINSTPKG="$INSTPKG_REPO:$CINSTPKG"
|
||||||
|
fi
|
||||||
|
|
||||||
STATUS="upgrade"
|
STATUS="upgrade"
|
||||||
echo " $STATUS# $REPO# $CINSTPKG --> ${RAWNAME}"
|
echo " $STATUS# $REPO# $CINSTPKG --> ${RAWNAME}"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue