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.
Sometimes slackpkg behaves oddly. For example "slackpkg install aspell" will pull every aspell-* from extra. The same goes for some *python* packages. It turns out that "grep -w" doesn't work for package names like aspell-en.
Quote:
-w, --word-regexp
Select only those lines containing matches that form whole words. The test is that the matching
substring must either be at the beginning of the line, or preceded by a non-word constituent character.
Similarly, it must be either at the end of the line or followed by a non-word constituent character. Word-constituent characters are letters, digits, and the underscore.
Here is a patch for core-functions.sh:
Code:
--- core-functions.sh.orig 2015-12-16 02:01:12.000000000 -0500
+++ core-functions.sh 2016-03-15 18:01:18.000000000 -0400
@@ -591,7 +591,7 @@
case "$CMD" in
download)
for ARGUMENT in $(echo $INPUTLIST); do
- for i in $(grep -w -- "${ARGUMENT}" ${TMPDIR}/pkglist | cut -f2 -d\ | sort -u); do
+ for i in $(grep " ${ARGUMENT} " ${TMPDIR}/pkglist | cut -f2 -d\ | sort -u); do
LIST="$LIST $(grep " ${i} " ${TMPDIR}/pkglist | cut -f6,8 -d\ --output-delimiter=.)"
done
LIST="$(echo -e $LIST | sort -u)"
@@ -600,14 +600,14 @@
blacklist)
for ARGUMENT in $(echo $INPUTLIST); do
for i in $(cat ${TMPDIR}/pkglist ${TMPDIR}/tmplist | \
- grep -w -- "${ARGUMENT}" | cut -f2 -d\ | sort -u); do
+ grep " ${ARGUMENT} " | cut -f2 -d\ | sort -u); do
grep -qx "${i}" ${CONF}/blacklist || LIST="$LIST $i"
done
done
;;
install|upgrade|reinstall)
for ARGUMENT in $(echo $INPUTLIST); do
- for i in $(grep -w -- "${ARGUMENT}" ${TMPDIR}/pkglist | cut -f2 -d\ | sort -u); do
+ for i in $(grep " ${ARGUMENT} " ${TMPDIR}/pkglist | cut -f2 -d\ | sort -u); do
givepriority $i
[ ! "$FULLNAME" ] && continue
@@ -634,8 +634,8 @@
remove)
for ARGUMENT in $(echo $INPUTLIST); do
for i in $(cat ${TMPDIR}/pkglist ${TMPDIR}/tmplist | \
- grep -w -- "${ARGUMENT}" | cut -f6 -d\ | sort -u); do
- PKGDATA=( $(grep -w -- "$i" ${TMPDIR}/tmplist) )
+ grep " ${ARGUMENT} " | cut -f6 -d\ | sort -u); do
+ PKGDATA=( $(grep " $i " ${TMPDIR}/tmplist) )
[ ! "$PKGDATA" ] && continue
LIST="$LIST ${PKGDATA[5]}"
unset PKGDATA
Sometimes slackpkg behaves oddly. For example "slackpkg install aspell" will pull every aspell-* from extra. The same goes for some *python* packages. It turns out that "grep -w" doesn't work for package names like aspell-en.
It works:
Code:
$ grep --color -w "aspell-en" /var/lib/slackpkg/pkglist
slackware64 aspell-en 6.0_0 noarch 4 aspell-en-6.0_0-noarch-4 ./slackware64/l txz
$ slackpkg -dialog=off reinstall aspell-en
Looking for aspell-en in package list. Please wait... DONE
aspell-en-6.0_0-noarch-4.txz
Total package(s): 1
Do you wish to reinstall selected packages (Y/n)? n
Quote:
Originally Posted by ivandi
Here is a patch for core-functions.sh
[...]
With this patch, some requests will not be honored anymore.
1. before applying patch:
Code:
$ slackpkg -dialog=off upgrade firefox
Checking local integrity... DONE
Looking for firefox in package list. Please wait... DONE
mozilla-firefox-38.7.0esr-x86_64-1_slack14.1.txz
Total package(s): 1
Do you wish to upgrade selected packages (Y/n)? n
$ slackpkg -dialog=off upgrade mozilla
Checking local integrity... DONE
Looking for mozilla in package list. Please wait... DONE
mozilla-firefox-38.7.0esr-x86_64-1_slack14.1.txz
mozilla-nss-3.23-x86_64-1_slack14.1.txz
mozilla-thunderbird-38.6.0-x86_64-1_slack14.1.txz
Total package(s): 3
Do you wish to upgrade selected packages (Y/n)? n
$ slackpkg -dialog=off upgrade solibs
Checking local integrity... DONE
Looking for solibs in package list. Please wait... DONE
glibc-solibs-2.17-x86_64-11_slack14.1.txz
openssl-solibs-1.0.1s-x86_64-1_slack14.1.txz
seamonkey-solibs-2.40-x86_64-1_slack14.1.txz
Total package(s): 3
Do you wish to upgrade selected packages (Y/n)? n
2. after applying patch:
Code:
$ slackpkg -dialog=off upgrade firefox
Checking local integrity... DONE
Looking for firefox in package list. Please wait... DONE
No packages match the pattern for upgrade. Try:
/usr/sbin/slackpkg install|reinstall
$ slackpkg -dialog=off upgrade mozilla
Checking local integrity... DONE
Looking for mozilla in package list. Please wait... DONE
No packages match the pattern for upgrade. Try:
/usr/sbin/slackpkg install|reinstall
$ slackpkg -dialog=off upgrade solibs
Checking local integrity... DONE
Looking for solibs in package list. Please wait... DONE
No packages match the pattern for upgrade. Try:
/usr/sbin/slackpkg install|reinstall
The best example of the issue is these 3 packages:
at-3.1.12-i486-1
at-spi2-atk-2.18.1-i586-1
at-spi2-core-2.18.3-i586-1
'at' is completely unrelated to the two 'at-spi2-*' packages.
Now try getting slackpkg to do something to 'at' without also impacting the other two.
IMO Ivandi's approach is better and if you want wider matching then you should have to explicitly request it by using wildcards.
from slackpkg man-page :
Code:
slackpkg [OPTIONS] {install|remove|search|upgrade|reinstall|blacklist} {PATTERN|FILE}
[...]
PATTERNcan be a package name or just part of package name. It can also be a software series (like kde, a, ap, ...).
Actually only parts separated by a hyphen from the rest of the package name can be used because "grep -w" matches them as whole words.
That makes sense, and I don't see anything wrong here. There are more chance that users issue a slackpkg install firefox or slackpkg install mozilla than a slackpkg install fox, or slackpkg install zilla.
Furthermore, as stated in the man page, a Pattern can also be a software series (ie. kde, a, ap,...). But, with your patch, this does not work anymore :
Code:
slackpkg reinstall slackware64
Looking for slackware64 in package list. Please wait... DONE
No packages match the pattern for reinstall. Try:
/usr/sbin/slackpkg install|upgrade
root@blackdog [slackpkg] >slackpkg upgrade patches
Checking local integrity... DONE
Looking for patches in package list. Please wait... DONE
No packages match the pattern for upgrade. Try:
/usr/sbin/slackpkg install|reinstall
This can be "fixed" by not putting ${ARGUMENT} between spaces :
Code:
--- core-functions.sh.orig.16 2016-03-16 16:26:22.712425439 +0100
+++ core-functions.sh 2016-03-16 16:29:50.726434721 +0100
@@ -591,7 +591,7 @@
case "$CMD" in
download)
for ARGUMENT in $(echo $INPUTLIST); do
- for i in $(grep -w -- "${ARGUMENT}" ${TMPDIR}/pkglist | cut -f2 -d\ | sort -u); do
+ for i in $(grep "${ARGUMENT}" ${TMPDIR}/pkglist | cut -f2 -d\ | sort -u); do
LIST="$LIST $(grep " ${i} " ${TMPDIR}/pkglist | cut -f6,8 -d\ --output-delimiter=.)"
done
LIST="$(echo -e $LIST | sort -u)"
@@ -600,14 +600,14 @@
blacklist)
for ARGUMENT in $(echo $INPUTLIST); do
for i in $(cat ${TMPDIR}/pkglist ${TMPDIR}/tmplist | \
- grep -w -- "${ARGUMENT}" | cut -f2 -d\ | sort -u); do
+ grep "${ARGUMENT}" | cut -f2 -d\ | sort -u); do
grep -qx "${i}" ${CONF}/blacklist || LIST="$LIST $i"
done
done
;;
install|upgrade|reinstall)
for ARGUMENT in $(echo $INPUTLIST); do
- for i in $(grep -w -- "${ARGUMENT}" ${TMPDIR}/pkglist | cut -f2 -d\ | sort -u); do
+ for i in $(grep "${ARGUMENT}" ${TMPDIR}/pkglist | cut -f2 -d\ | sort -u); do
givepriority $i
[ ! "$FULLNAME" ] && continue
@@ -634,8 +634,8 @@
remove)
for ARGUMENT in $(echo $INPUTLIST); do
for i in $(cat ${TMPDIR}/pkglist ${TMPDIR}/tmplist | \
- grep -w -- "${ARGUMENT}" | cut -f6 -d\ | sort -u); do
- PKGDATA=( $(grep -w -- "$i" ${TMPDIR}/tmplist) )
+ grep "${ARGUMENT}" | cut -f6 -d\ | sort -u); do
+ PKGDATA=( $(grep "$i" ${TMPDIR}/tmplist) )
[ ! "$PKGDATA" ] && continue
LIST="$LIST ${PKGDATA[5]}"
unset PKGDATA
With this code, the pattern passed in argument can be a package name, part of a package name, or even a slackware series :
Code:
$ slackpkg -dialog=off reinstall aspell-en
Looking for aspell-en in package list. Please wait...
DONE
aspell-en-6.0_0-noarch-4.txz
Total package(s): 1
$ slackpkg -dialog=off reinstall spel
Looking for spel in package list. Please wait...
DONE
aspell-0.60.6-x86_64-1.txz
aspell-en-6.0_0-noarch-4.txz
gtkspell-2.0.16-x86_64-1.txz
hunspell-1.3.2-x86_64-1.txz
ispell-3.2.06-x86_64-1.txz
Total package(s): 5
$ slackpkg -dialog=off reinstall slackware64
Looking for slackware64 in package list. Please wait...
DONE
ConsoleKit-0.4.5-x86_64-1.txz
...
Total package(s): 1191
However, the returned packages can be unrelated, even more than with current slackpkg :
Code:
slackpkg -dialog=off reinstall at
Looking for at in package list. Please wait...
DONE
apr-1.5.0-x86_64-1_slack14.1.txz
apr-util-1.5.3-x86_64-1_slack14.1.txz
at-3.1.12-x86_64-1.txz
at-spi2-atk-2.8.1-x86_64-1.txz
at-spi2-core-2.8.0-x86_64-1.txz
...
Total package(s): 76
For instance, apr is selected because it is in patches directory which matches the pattern "at".
As for slackpkg+, I think it will be best solution, to have the re-defineable variable like GREPOPTS=${GREPOPTS:--word-regexp}, for instance, in the configuration file.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.