SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I want to try to replace some if echo ..|grep ... with the operator =~ since bash supports it to try to increase performance.
Code:
$ time [[ slackware =~ "^(slackware)|(slackware64)|(extra)|(pasture)|(patches)|(testing)$" ]]
real 0m0.000s
user 0m0.000s
sys 0m0.000s
$ time echo slackware | grep -qwE "(slackware)|(slackware64)|(extra)|(pasture)|(patches)|(testing)"
real 0m0.002s
user 0m0.000s
sys 0m0.002s
what do you think?
there are many other optimization possible
Code:
$ xxx="repo:pkg"
$ time echo "$xxx" | cut -f1 -d":"
repo
real 0m0.002s
user 0m0.000s
sys 0m0.001s
$ time echo ${xxx/:*/}
repo
real 0m0.000s
user 0m0.000s
sys 0m0.000s
By curiosity, I tried that on givepriority() (which can be called, more or less, a bottleneck) and the resulting optimization is really noticeable.
1. upgrade-all before optimization
Code:
$ time slackpkg -dialog=off -batch=on -default_answer=no upgrade-all
Checking local integrity... DONE
Looking for packages to upgrade. Please wait...
DONE
Total package(s): 280
Do you wish to upgrade selected packages (Y/n)? n
real 0m26.737s
user 0m18.182s
sys 0m3.424s
2. upgrade-all after optimization
Code:
time slackpkg -dialog=off -batch=on -default_answer=no upgrade-all
Checking local integrity... DONE
Looking for packages to upgrade. Please wait...
DONE
Total package(s): 280
Do you wish to upgrade selected packages (Y/n)? n
real 0m11.785s
user 0m10.787s
sys 0m2.593s
3. upgrade-all after optimization (and use grep 2>/dev/null -w "${PAT}")
Code:
$ time slackpkg -dialog=off -batch=on -default_answer=no upgrade-all
Checking local integrity... DONE
Looking for packages to upgrade. Please wait...
DONE
Total package(s): 280
Do you wish to upgrade selected packages (Y/n)? n
real 0m9.225s
user 0m10.678s
sys 0m2.310s
Here is the changes done (slackpkg+ 1.6.1/7mt) :
Code:
--- slackpkgplus.sh.orig 2016-01-09 16:13:29.440109874 +0100
+++ slackpkgplus.sh 2016-01-11 16:56:55.278481507 +0100
@@ -8,7 +8,7 @@
# regular expression used to distinguish the 3rd party repositories from the standard slackware directories.
#
-SLACKDIR_REGEXP="(slackware)|(slackware64)|(extra)|(pasture)|(patches)|(testing)"
+SLACKDIR_REGEXP="^((slackware)|(slackware64)|(extra)|(pasture)|(patches)|(testing))$"
if [ -e $CONF/slackpkgplus.conf ];then
# You can override GREYLIST WGETOPTS SLACKPKGPLUS VERBOSE USEBL ALLOW32BIT SENSITIVE_SEARCH from command-line
@@ -363,6 +363,7 @@
fi
} # END checkmd5()
+
# Found packages in repository.
# This function selects the package from the higher priority
# repository directories.
@@ -408,8 +409,10 @@
)| grep -f - -n -m 1 ${TMPDIR}/pkglist
)
if [ ! -z "$PKGINFOS" ] ; then
- LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":")
- PKGDATA=( $(echo "$PKGINFOS" | cut -f2- -d":") )
+ LINEIDX=${$PKGINFOS/:*/}
+ PKGDATA=( ${PKGINFOS/*:/} )
+ #LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":")
+ #PKGDATA=( $(echo "$PKGINFOS" | cut -f2- -d":") )
sed -i --expression "${LINEIDX}d" --expression "${PRIORITYIDX}i${PKGDATA[*]}" ${TMPDIR}/pkglist
(( PRIORITYIDX++ ))
if [ "$PKGDATA" ]; then
@@ -422,9 +425,15 @@
for CPRIORITY in ${PRIORITY[@]} ; do
[ "$PKGDATA" ] && break
- DIR=$(echo "$CPRIORITY" | cut -f1 -d":")
- PAT=$(echo "$CPRIORITY" | cut -s -f2- -d":")
- REPOSITORY=$(echo "${DIR}" | sed "s/SLACKPKGPLUS_//")
+ #DIR=$(echo "$CPRIORITY" | cut -f1 -d":")
+ #PAT=$(echo "$CPRIORITY" | cut -s -f2- -d":")
+ #REPOSITORY=$(echo "${DIR}" | sed "s/SLACKPKGPLUS_//")
+
+ DIR=${CPRIORITY/:*/}
+ REPOSITORY=${DIR/SLACKPKGPLUS_/}
+ PAT=""
+ [[ "$CPRIORITY" =~ .*:.* ]] && PAT=${CPRIORITY/*:/}
+
# pass to the next iteration when there are priority filters and the
# current repository is not accepted by the defined filter rules ...
@@ -433,7 +442,9 @@
continue
fi
- if echo "$CPRIORITY " | grep -q "[a-zA-Z0-9]\+[:]" ; then
+ #if echo "$CPRIORITY " | grep -q "[a-zA-Z0-9]\+[:]" ; then
+
+ if [[ "$CPRIORITY" =~ ^[-_[:alnum:]]+[:] ]] ; then
# [Reminder] ARGUMENT is always a basename, but PAT can be :
# 1. a basename (ie. gcc, glibc-solibs)
@@ -442,12 +453,15 @@
#
PKGDATA=""
LINEIDX=""
- grep -n "^${DIR} " ${TMPDIR}/pkglist | grep -w "${PAT}" > ${TMPDIR}/packages.matches
- PKGINFOS=$(grep -m 1 "^[[:digit:]]\+:${DIR} ${ARGUMENT} " ${TMPDIR}/packages.matches)
+ PKGINFOS=$(grep -n "^${DIR} " ${TMPDIR}/pkglist | grep 2>/dev/null -w "${PAT}" | grep -m 1 "^[[:digit:]]\+:${DIR} ${ARGUMENT} ")
+ #grep -n "^${DIR} " ${TMPDIR}/pkglist | grep -w "${PAT}" > ${TMPDIR}/packages.matches
+ #PKGINFOS=$(grep -m 1 "^[[:digit:]]\+:${DIR} ${ARGUMENT} " ${TMPDIR}/packages.matches)
if [ ! -z "$PKGINFOS" ] ; then
- LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":")
- PKGDATA=( $(echo "$PKGINFOS" | cut -f2- -d":") )
+ LINEIDX=${PKGINFOS/:*/}
+ PKGDATA=( ${PKGINFOS/*:/} )
+ #LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":")
+ #PKGDATA=( $(echo "$PKGINFOS" | cut -f2- -d":") )
fi
else
# $CPRIORITY is of kind "repository" (ie. slackware, extra, patches,...)
Nota: I left the old code in comment to ease verifications.
My intent was to increase performance, not to triplicate it
1.7.a3
Code:
real 0m16.407s
user 0m4.569s
sys 0m7.959s
new (pushed on devel branch)
Code:
real 0m5.002s
user 0m2.650s
sys 0m1.664s
I tried, just for experiment, some other extreme bashism. But it increase performance only in very-ripetitive functions (as givepriority() ) where 0.01 seconds multiplicated for hundreds packages can make the difference.
For example,
basename $1 ==> ${1/*\//}
we have similar code near repository parsing or before a wget command, where 0.01 seconds are not a visible thing.
Yesterday I saw another issue on that patch, so I not included it in that commit. But I must to retry.
'rar' match packages containing the 'rar' pattern (for example unrar or a package called library) or a path including the directory 'rar', such as
./SLACKPKGPLUS_slackonly_141/system/rar
With the current code, searching for gcc returns the following :
Code:
$ slackpkg search gcc
DONE
The list below shows all packages with name matching "gcc".
[ Status ] [ Repository ] [ Package ]
upgrade gcc-4.8.2_multilib-x86_64-1alien --> gcc-4.8.2-x86_64-1
upgrade gcc-g++-4.8.2_multilib-x86_64-1alien --> gcc-g++-4.8.2-x86_64-1
upgrade gcc-gfortran-4.8.2_multilib-x86_64-1alien --> gcc-gfortran-4.8.2-x86_64-1
upgrade gcc-gnat-4.8.2_multilib-x86_64-1alien --> gcc-gnat-4.8.2-x86_64-1
upgrade gcc-go-4.8.2_multilib-x86_64-1alien --> gcc-go-4.8.2-x86_64-1
upgrade gcc-java-4.8.2_multilib-x86_64-1alien --> gcc-java-4.8.2-x86_64-1
upgrade gcc-objc-4.8.2_multilib-x86_64-1alien --> gcc-objc-4.8.2-x86_64-1
installed gccmakedep-1.0.2-noarch-2
installed multilib gcc-4.8.2_multilib-x86_64-1alien
installed multilib gcc-g++-4.8.2_multilib-x86_64-1alien
installed multilib gcc-gfortran-4.8.2_multilib-x86_64-1alien
installed multilib gcc-gnat-4.8.2_multilib-x86_64-1alien
installed multilib gcc-go-4.8.2_multilib-x86_64-1alien
installed multilib gcc-java-4.8.2_multilib-x86_64-1alien
installed multilib gcc-objc-4.8.2_multilib-x86_64-1alien
You can search specific files using "slackpkg file-search file".
the multilib repository has precedence over slackware64 (and patches) repositories. Therefore, the gcc upgrade proposals are inappropriates, and are caused by a bug in searchPackages :
Code:
if echo "$DIR" | grep -q "[a-zA-Z0-9]\+[:]" ; then
DIR=$(echo "$i" | cut -f2- -d":") # <= bug, the cut is bad, should be -f1 instead
fi
The patch for 1.6.1/7mt :
Code:
--- slackpkgplus.sh.orig 2016-01-09 16:13:29.440109874 +0100
+++ slackpkgplus.sh 2016-01-11 20:18:40.471107912 +0100
@@ -528,7 +528,7 @@
for i in ${PRIORITY[@]}; do
DIR="$i"
if echo "$DIR" | grep -q "[a-zA-Z0-9]\+[:]" ; then
- DIR=$(echo "$i" | cut -f2- -d":")
+ DIR=$(echo "$i" | cut -f1 -d":")
fi
if [ "$CMD" == "file-search" ] ; then
With that, the search works as it should :
Code:
slackpkg search gcc
NOTICE: remember to re-run 'slackpkg update' after modifying slackpkgplus.conf
DONE
The list below shows all packages with name matching "gcc".
[ Status ] [ Repository ] [ Package ]
installed multilib gcc-4.8.2_multilib-x86_64-1alien
installed multilib gcc-g++-4.8.2_multilib-x86_64-1alien
installed multilib gcc-gfortran-4.8.2_multilib-x86_64-1alien
installed multilib gcc-gnat-4.8.2_multilib-x86_64-1alien
installed multilib gcc-go-4.8.2_multilib-x86_64-1alien
installed multilib gcc-java-4.8.2_multilib-x86_64-1alien
installed multilib gcc-objc-4.8.2_multilib-x86_64-1alien
installed gccmakedep-1.0.2-noarch-2
You can search specific files using "slackpkg file-search file".
it is present from commit afddae5749e618bbb3b00e3c2122f60042e1f867 that is 0.9rc2 - 30/Apr/2013
I will fix in devel branch.
it just impacts the search command. Do you think that we should plan to backport it in 1.6.1 tree? (may be the first backport in slackpkg+ history and the begin of stabilizing it)
it is present from commit afddae5749e618bbb3b00e3c2122f60042e1f867 that is 0.9rc2 - 30/Apr/2013
I will fix in devel branch.
it just impacts the search command. Do you think that we should plan to backport it in 1.6.1 tree? (may be the first backport in slackpkg+ history and the begin of stabilizing it)
Yes, it would be better.
I also did some modification to optimize searchPackage, and here is the results so far :
1. current code :
Code:
$ time slackpkg search slackware
DONE
The list below shows all packages with name matching "slackware".
...
You can search specific files using "slackpkg file-search file".
real 0m46.167s
user 0m31.300s
sys 0m5.233s
2. with optimization:
Code:
time slackpkg search slackware
DONE
The list below shows all packages with name matching "slackware".
...
You can search specific files using "slackpkg file-search file".
real 0m32.716s
user 0m24.116s
sys 0m4.578s
Note: the times includes the time required to print results.
commit 6553f7d8c4b3ff077814dd192862dee3897f3bb1
Author: Matteo Rossini <zerouno@slacky.it>
Date: Mon Jan 11 18:44:06 2016 +0100
Improved givepriority() performance by using bashism.
commit fac0996698cdab713b876c4d20a53307ccd14085
I'm running the same cases that we are testing before applying that patch.
so, before bashism:
Code:
# git checkout fac0996698cdab713b876c4d20a53307ccd14085
# slackpkg -dialog=off -batch=on -default_answer=no install alienbob_current:libiptcdata-1.0.4
Looking for libiptcdata-1.0.4 in package list. Please wait... DONE
[ Repository ] [ Package ]
alienbob_current libiptcdata-1.0.4-i486-2alien.tgz
Total package(s): 1
Do you wish to install selected packages (Y/n)? n
after bashism:
Code:
# git checkout 6553f7d8c4b3ff077814dd192862dee3897f3bb1
# slackpkg -dialog=off -batch=on -default_answer=no install alienbob_current:libiptcdata-1.0.4
Looking for libiptcdata-1.0.4 in package list. Please wait... DONE
No packages match the pattern for install. Try:
/usr/sbin/slackpkg reinstall|upgrade
the diff (you can see small differences from your patch, but should not impact):
Code:
# git diff fac0996698cdab713b876c4d20a53307ccd14085 6553f7d8c4b3ff077814dd192862dee3897f3bb1|cat
diff --git a/src/slackpkgplus.sh b/src/slackpkgplus.sh
index e1605d0..bff35e7 100755
--- a/src/slackpkgplus.sh
+++ b/src/slackpkgplus.sh
@@ -10,7 +10,7 @@ CONF=${CONF:-/etc/slackpkg} # needed if you're running slackpkg 2.28.0-12
# regular expression used to distinguish the 3rd party repositories from the standard slackware directories.
#
-SLACKDIR_REGEXP="(slackware)|(slackware64)|(extra)|(pasture)|(patches)|(testing)"
+SLACKDIR_REGEXP="^((slackware)|(slackware64)|(extra)|(pasture)|(patches)|(testing))$"
if [ -e $CONF/slackpkgplus.conf ];then
# You can override GREYLIST WGETOPTS SLACKPKGPLUS VERBOSE USEBL ALLOW32BIT SENSITIVE_SEARCH from command-line
@@ -755,8 +755,8 @@ if [ "$SLACKPKGPLUS" = "on" ];then
)| grep -f - -n -m 1 ${TMPDIR}/pkglist
)
if [ ! -z "$PKGINFOS" ] ; then
- LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":")
- PKGDATA=( $(echo "$PKGINFOS" | cut -f2- -d":") )
+ LINEIDX=${$PKGINFOS/:*/} #LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":")
+ PKGDATA=( ${PKGINFOS/*:/} ) #PKGDATA=( $(echo "$PKGINFOS" | cut -f2- -d":") )
sed -i --expression "${LINEIDX}d" --expression "${PRIORITYIDX}i${PKGDATA[*]}" ${TMPDIR}/pkglist
(( PRIORITYIDX++ ))
if [ "$PKGDATA" ]; then
@@ -769,9 +769,9 @@ if [ "$SLACKPKGPLUS" = "on" ];then
for CPRIORITY in ${PRIORITY[@]} ; do
[ "$PKGDATA" ] && break
- DIR=$(echo "$CPRIORITY" | cut -f1 -d":")
- PAT=$(echo "$CPRIORITY" | cut -s -f2- -d":")
- REPOSITORY=$(echo "${DIR}" | sed "s/SLACKPKGPLUS_//")
+ DIR=${CPRIORITY/:*/} #DIR=$(echo "$CPRIORITY" | cut -f1 -d":")
+ [[ "$CPRIORITY" =~ ".*:.*" ]] && PAT=${CPRIORITY/*:/} || PAT="" #PAT=$(echo "$CPRIORITY" | cut -s -f2- -d":")
+ REPOSITORY=${DIR/SLACKPKGPLUS_/} #REPOSITORY=$(echo "${DIR}" | sed "s/SLACKPKGPLUS_//")
# pass to the next iteration when there are priority filters and the
# current repository is not accepted by the defined filter rules ...
@@ -780,7 +780,8 @@ if [ "$SLACKPKGPLUS" = "on" ];then
continue
fi
- if echo "$CPRIORITY " | grep -q "[a-zA-Z0-9]\+[:]" ; then
+ #if echo "$CPRIORITY " | grep -q "[a-zA-Z0-9]\+[:]" ; then
+ if [[ "$CPRIORITY" =~ "^[-_[:alnum:]]+[:]" ]] ; then
# [Reminder] ARGUMENT is always a basename, but PAT can be :
# 1. a basename (ie. gcc, glibc-solibs)
@@ -789,12 +790,13 @@ if [ "$SLACKPKGPLUS" = "on" ];then
#
PKGDATA=""
LINEIDX=""
- grep -n "^${DIR} " ${TMPDIR}/pkglist | grep -w "${PAT}" > ${TMPDIR}/packages.matches
- PKGINFOS=$(grep -m 1 "^[[:digit:]]\+:${DIR} ${ARGUMENT} " ${TMPDIR}/packages.matches)
+ #grep -n "^${DIR} " ${TMPDIR}/pkglist | grep -w "${PAT}" > ${TMPDIR}/packages.matches
+ #PKGINFOS=$(grep -m 1 "^[[:digit:]]\+:${DIR} ${ARGUMENT} " ${TMPDIR}/packages.matches)
+ PKGINFOS=$(grep -n "^${DIR} " ${TMPDIR}/pkglist | grep 2>/dev/null -w "${PAT}" | grep -m 1 "^[[:digit:]]\+:${DIR} ${ARGUMENT} ")
if [ ! -z "$PKGINFOS" ] ; then
- LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":")
- PKGDATA=( $(echo "$PKGINFOS" | cut -f2- -d":") )
+ LINEIDX=${PKGINFOS/:*/} #LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":")
+ PKGDATA=( ${PKGINFOS/*:/} ) #PKGDATA=( $(echo "$PKGINFOS" | cut -f2- -d":") )
fi
else
# $CPRIORITY is of kind "repository" (ie. slackware, extra, patches,...)
commit 6553f7d8c4b3ff077814dd192862dee3897f3bb1
Author: Matteo Rossini <zerouno@slacky.it>
Date: Mon Jan 11 18:44:06 2016 +0100
Improved givepriority() performance by using bashism.
commit fac0996698cdab713b876c4d20a53307ccd14085
I'm running the same cases that we are testing before applying that patch.
so, before bashism:
Code:
# git checkout fac0996698cdab713b876c4d20a53307ccd14085
# slackpkg -dialog=off -batch=on -default_answer=no install alienbob_current:libiptcdata-1.0.4
Looking for libiptcdata-1.0.4 in package list. Please wait... DONE
[ Repository ] [ Package ]
alienbob_current libiptcdata-1.0.4-i486-2alien.tgz
Total package(s): 1
Do you wish to install selected packages (Y/n)? n
after bashism:
Code:
# git checkout 6553f7d8c4b3ff077814dd192862dee3897f3bb1
# slackpkg -dialog=off -batch=on -default_answer=no install alienbob_current:libiptcdata-1.0.4
Looking for libiptcdata-1.0.4 in package list. Please wait... DONE
No packages match the pattern for install. Try:
/usr/sbin/slackpkg reinstall|upgrade
the diff (you can see small differences from your patch, but should not impact):
Code:
# git diff fac0996698cdab713b876c4d20a53307ccd14085 6553f7d8c4b3ff077814dd192862dee3897f3bb1|cat
diff --git a/src/slackpkgplus.sh b/src/slackpkgplus.sh
index e1605d0..bff35e7 100755
--- a/src/slackpkgplus.sh
+++ b/src/slackpkgplus.sh
@@ -10,7 +10,7 @@ CONF=${CONF:-/etc/slackpkg} # needed if you're running slackpkg 2.28.0-12
# regular expression used to distinguish the 3rd party repositories from the standard slackware directories.
#
-SLACKDIR_REGEXP="(slackware)|(slackware64)|(extra)|(pasture)|(patches)|(testing)"
+SLACKDIR_REGEXP="^((slackware)|(slackware64)|(extra)|(pasture)|(patches)|(testing))$"
if [ -e $CONF/slackpkgplus.conf ];then
# You can override GREYLIST WGETOPTS SLACKPKGPLUS VERBOSE USEBL ALLOW32BIT SENSITIVE_SEARCH from command-line
@@ -755,8 +755,8 @@ if [ "$SLACKPKGPLUS" = "on" ];then
)| grep -f - -n -m 1 ${TMPDIR}/pkglist
)
if [ ! -z "$PKGINFOS" ] ; then
- LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":")
- PKGDATA=( $(echo "$PKGINFOS" | cut -f2- -d":") )
+ LINEIDX=${$PKGINFOS/:*/} #LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":")
+ PKGDATA=( ${PKGINFOS/*:/} ) #PKGDATA=( $(echo "$PKGINFOS" | cut -f2- -d":") )
sed -i --expression "${LINEIDX}d" --expression "${PRIORITYIDX}i${PKGDATA[*]}" ${TMPDIR}/pkglist
(( PRIORITYIDX++ ))
if [ "$PKGDATA" ]; then
@@ -769,9 +769,9 @@ if [ "$SLACKPKGPLUS" = "on" ];then
for CPRIORITY in ${PRIORITY[@]} ; do
[ "$PKGDATA" ] && break
- DIR=$(echo "$CPRIORITY" | cut -f1 -d":")
- PAT=$(echo "$CPRIORITY" | cut -s -f2- -d":")
- REPOSITORY=$(echo "${DIR}" | sed "s/SLACKPKGPLUS_//")
+ DIR=${CPRIORITY/:*/} #DIR=$(echo "$CPRIORITY" | cut -f1 -d":")
+ [[ "$CPRIORITY" =~ ".*:.*" ]] && PAT=${CPRIORITY/*:/} || PAT="" #PAT=$(echo "$CPRIORITY" | cut -s -f2- -d":")
+ REPOSITORY=${DIR/SLACKPKGPLUS_/} #REPOSITORY=$(echo "${DIR}" | sed "s/SLACKPKGPLUS_//")
# pass to the next iteration when there are priority filters and the
# current repository is not accepted by the defined filter rules ...
@@ -780,7 +780,8 @@ if [ "$SLACKPKGPLUS" = "on" ];then
continue
fi
- if echo "$CPRIORITY " | grep -q "[a-zA-Z0-9]\+[:]" ; then
+ #if echo "$CPRIORITY " | grep -q "[a-zA-Z0-9]\+[:]" ; then
+ if [[ "$CPRIORITY" =~ "^[-_[:alnum:]]+[:]" ]] ; then
# [Reminder] ARGUMENT is always a basename, but PAT can be :
# 1. a basename (ie. gcc, glibc-solibs)
@@ -789,12 +790,13 @@ if [ "$SLACKPKGPLUS" = "on" ];then
#
PKGDATA=""
LINEIDX=""
- grep -n "^${DIR} " ${TMPDIR}/pkglist | grep -w "${PAT}" > ${TMPDIR}/packages.matches
- PKGINFOS=$(grep -m 1 "^[[:digit:]]\+:${DIR} ${ARGUMENT} " ${TMPDIR}/packages.matches)
+ #grep -n "^${DIR} " ${TMPDIR}/pkglist | grep -w "${PAT}" > ${TMPDIR}/packages.matches
+ #PKGINFOS=$(grep -m 1 "^[[:digit:]]\+:${DIR} ${ARGUMENT} " ${TMPDIR}/packages.matches)
+ PKGINFOS=$(grep -n "^${DIR} " ${TMPDIR}/pkglist | grep 2>/dev/null -w "${PAT}" | grep -m 1 "^[[:digit:]]\+:${DIR} ${ARGUMENT} ")
if [ ! -z "$PKGINFOS" ] ; then
- LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":")
- PKGDATA=( $(echo "$PKGINFOS" | cut -f2- -d":") )
+ LINEIDX=${PKGINFOS/:*/} #LINEIDX=$(echo "$PKGINFOS" | cut -f1 -d":")
+ PKGDATA=( ${PKGINFOS/*:/} ) #PKGDATA=( $(echo "$PKGINFOS" | cut -f2- -d":") )
fi
else
# $CPRIORITY is of kind "repository" (ie. slackware, extra, patches,...)
When these statements are corrected, slackpkg install alienbob_current::libiptcdata-1.0.4 works as expected :
Code:
slackpkg -dialog=off -batch=on -default_answer=no install alienbob_current:libiptcdata-1.0.4
Looking for libiptcdata-1.0.4 in package list. Please wait... install -> 0 s ellapsed
DONE
[ Repository ] [ Package ]
alienbob_current libiptcdata-1.0.4-i486-2alien.tgz
Total package(s): 1
Do you wish to install selected packages (Y/n)? n
ok, english is not the best for me, so I not undestood well the "quoting" paragraph. I added it to clarify, without think that it may broke the working.
Thankyou.
Today I will have less time to work for slackpkg+
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.