Quote:
Originally Posted by slackuser222
(Post 6316533)
Hi everybody! I know it is a silly question, but someone could tell me if there is any simple way to identify if one dependency is already installed in my slackware system? I'm struggling to install Qgis, and it has more than 60 dependencies, according to Slackbuilds site... And I am pretty sure that at least some of then is already installed.
|
slackuser222 --
That's not really a Silly Q at all. If fact, it's essential to understand how Slackware Packages are Tracked to answer your Q.
There are lots of ways to tell if a package is installed on your Slackware System using the different Package Management Tools.
However, you can actially 'see for yourself' using /bin/ls, because for each installed package, there is a plain text file in /var/lib/pkgtools/packages/
For example, to see if postgis is installed, you could simply type from the command line:
Code:
$ ls -la /var/lib/pkgtools/packages/*postgis*
-rw-r--r-- 1 root root 6766 Jan 4 07:51 /var/lib/pkgtools/packages/postgis-3.1.2-x86_64-1_SBo
See below my sig ... I created a wrapper called ver which simplifies looking for packages as with wild-card names ( :) at least for me :) )
Note1: Speaking of dependencies ... /home/local/bin/ver depends on 2regex ( /home/local/bin/2regex )... below my sig ...
Now that I have /home/local/bin/ver , I can simply type ver some_package to see if I have it like so:
Code:
$ ver postgis
-rw-r--r-- 1 root root 6766 Jan 4 07:51 /var/log/packages/postgis-3.1.2-x86_64-1_SBo
So to see what's actually provided by the postgis package, you could look at the contents of the Package Manifest Text File:
Code:
$ cat /var/lib/pkgtools/packages/postgis-3.1.2-x86_64-1_SBo
PACKAGE NAME: postgis-3.1.2-x86_64-1_SBo
COMPRESSED PACKAGE SIZE: 4.1M
UNCOMPRESSED PACKAGE SIZE: 31M
PACKAGE LOCATION: /tmp/postgis-3.1.2-x86_64-1_SBo.tgz
PACKAGE DESCRIPTION:
postgis: postgis (support for geographic objects in PostgreSQL)
postgis:
postgis: PostGIS adds support for geographic objects to the PostgreSQL
postgis: database. In effect, PostGIS "spatially enables" the PostgreSQL
postgis: server, allowing it to be used as a backend spatial database for
postgis: geographic information systems (GIS), much like ESRI's SDE or
postgis: Oracle's Spatial extension.
postgis:
postgis: http://postgis.org
postgis:
postgis:
FILE LIST:
./
install/
install/doinst.sh
install/slack-desc
<<snip>>
Note2: I am old and set in my ways ... until Slackware Current ( 15.0 ), Installed Package Manifest Files used to be in /var/log/packages/ which with Slackware 15.0, is now ( ? will be ? ) a SymLink pointing at /var/lib/pkgtools/packages/ and I've never bothered to change ver
Quote:
Another problem intrigues me... in some cases, when I try to install some pack, it gives me a error message related to the lack of some dependence. Then I install the dependence and try to install the pack again, and it returns me the same error, related to the lack of the same dependence... Why do it happen? just installing the dependence seems not be enough... I have noticed that in some cases, when it happens, the slackbuild script creates in /tmp a file with the name_of_the_pack.txz. Then I run installpkg over this .txz file, and this sometimes solves the issue, and sometimes doesn't... Is this correct?
|
I am afraid so ... and the tools depending on postgis have a few circular dependencies which requires that some of the packages be built and installed more than once !
Quote:
I guess that in some cases is necessary to add some reference in the PATH variable, but I'm not sure with cases are those.
|
I don't believe the PATH Variable will affect the dependency tree -- everything should land where it belongs.
One suggestion: after installing a REQUIRED Package, type: ldconfig
You're welcome and Hope this Helps more than it hurts :)
-- kjh
This /home/local/bin/ver
Code:
#!/bin/sh
PkgOnly=0
RetCode=0
NumErr=0
if [ "$1" = "-p" -o "$1" = "-b" ]
then
PkgOnly=1
shift
fi
for i in $(echo $@ |sed -e 's/,/ /g' -e 's/ and / /g')
do
j="`2regex $i`"
if [ "$PkgOnly" = "0" ]
then
ls -la /var/log/packages/*${j}* 2>/dev/null ; RetCode=$?
else
for k in $(ls -1 /var/log/packages/*${j}* 2>/dev/null)
do
basename $k
done
fi
[ "$RetCode" != "0" ] && NumErr=`expr $NumErr + 1`
done
[ "$NumErr" = "0" ] && exit 0
exit 1
This is /home/local/bin/2regex
Save it in your PATH and chmod 755 /path/to/2regex
Code:
#!/bin/sh
#
# 2regex command turns alpha to case-insensitive for ls
#
# B60318 - kjh added -lrspt options and help-text
#
PrgNam="`basename $0`"
DirNam="`dirname $0`"
if [ "$DirNam" = "." ]
then
if [ -f "$PrgNam" ]
then
DirNam="`pwd`"
else
DirNam="`whichone $PrgNam`"
DirNam="`dirname $DirNam`"
fi
elif [ "$DirNam" = ".." ]
then
DirNam="`pwd`"
DirNam="`dirname $DirNam`"
elif [ "`dirname $DirNam`" = ".." ]
then
FooNam="`basename $DirNam`"
DirNam="`pwd -P`"
DirNam="`dirname $DirNam`/$FooNam"
elif [ "$DirNam" = "" ] # should not happen ...
then # see: man 3 dirname
DirNam="`whichone $PrgNam`"
DirNam="`dirname $DirNam`"
fi
AllArg="$@"
CwdDir="`pwd -P`"
AnchorLeft=0
AnchorRite=0
FixSpaces=0
AddPrefix=0
AddSuffix=0
WacExt ()
{
echo "$@" |
gawk '
{
if (( L = length( $0 )) < 1 )
{
print ""
exit 0
}
for ( i = L ; i > 0 ; i -- )
{
if (( substr( $0, i, 1 ) == "." ) \
&& ( substr( $0, i-1, 1 ) != "/" ))
{
print substr( $0, 1, i-1 )
exit 0
}
}
print $0
exit 0
}'
return $?
}
GetExt ()
{
GetExtCase=""
while [ "$1" = "-l" \
-o "$1" = "-L" \
-o "$1" = "-u" \
-o "$1" = "-U" ]
do
if [ "$1" = "-l" -o "$1" = "-L" ]
then
GetExtCase="l"
shift
elif [ "$1" = "-u" -o "$1" = "-U" ]
then
GetExtCase="u"
shift
fi
done
echo "$@" |
gawk '
BEGIN {
Case = "'"$GetExtCase"'" ""
}
function FixCase( DoCase, InStr )
{
if ( DoCase == "l" )
{
return( tolower( InStr ))
}
if ( DoCase == "u" )
{
return( toupper( InStr ))
}
return( InStr )
}
# main
{
if (( L = length( $0 )) < 1 )
{
print ""
exit 0
}
for ( i = L ; i > 0 ; i -- )
{
if (( substr( $0, i, 1 ) == "." ) \
&& ( substr( $0, i-1, 1 ) != "/" ))
{
print FixCase( Case, substr( $0, i ))
exit 0
}
}
print ""
exit 0
}'
return $?
}
Usage ()
{
ErrNum=$1
shift
[ $# -gt 0 ] && echo -e "\n$*" >&2
echo -e "\nusage: $PrgNam [ -lrbps ] string" >&2
cat <<Usage_EOF >&2
Program $PrgNam converts a String to a Regular Expression suitable for ls
awk, grep or find. Includes options to anchor the string left and right
and it can also convert each space to 'one-or-more-spaces'.
Options Include:
-l - anchor left-side to Start of Line / Field
example: $PrgNam -l foo -> '`$DirNam/$PrgNam -l foo`'
-r - anchor right-side to End of Line / Field
example: $PrgNam -r bar -> '`$DirNam/$PrgNam -r bar`'
-b - translate each run of one-or-more spaces to ' *'
example: $PrgNam -b 'foo bar' -> '`$DirNam/$PrgNam -b 'foo bar'`'
-p - Prefix string with a leading space REx
example: $PrgNam -p foo -> '`$DirNam/$PrgNam -p baz`'
-s - Append a space REx Suffix to string
example: $PrgNam -s bar -> '`$DirNam/$PrgNam -s baz`'
Usage_EOF
exit $ErrNum
}
while getopts hspbrl junk 2>/dev/null
do
case $junk in
l) AnchorLeft=1
;;
r) AnchorRite=1
;;
b) FixSpaces=1
;;
p) AddPrefix=1
;;
s) AddSuffix=1
;;
h) Usage 0
;;
*) Usage 1
;;
esac
done
shift `expr $OPTIND - 1`
echo "$@" |
gawk '
BEGIN {
AnchorLeft = "'"$AnchorLeft"'" +0
AnchorRite = "'"$AnchorRite"'" +0
FixSpaces = "'"$FixSpaces"'" +0
AddPrefix = "'"$AddPrefix"'" +0
AddSuffix = "'"$AddSuffix"'" +0
#
# portable ... runs on nawk or gawk
#
Lower = "abcdefghijklmnopqrstuvwxyz"
Upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for ( i = 1 ; i <= length( Lower ) ; i ++ )
{
L = substr( Lower, i, 1 )
U = substr( Upper, i, 1 )
LoAry[L] = i
UpAry[U] = i
REAry[i] = "[" U L "]"
}
c = p = ""
}
# main
{
OutStr = ( AnchorLeft == 1 ) ? "^" : ""
if ( AddPrefix == 1 )
{
OutStr = OutStr " *"
p = " "
}
for ( i = 1 ; i <= length( $0 ) ; i ++ )
{
if (( c = substr( $0, i, 1 )) in LoAry )
{
OutStr = OutStr REAry[ LoAry[c] ]
p = c
continue
}
if ( c in UpAry )
{
OutStr = OutStr REAry[ UpAry[c] ]
p = c
continue
}
if (( FixSpaces == 1 ) && ( c == " " ))
{
if ( p == " " )
{
continue
}
OutStr = OutStr " *"
p = c
continue
}
OutStr = OutStr c
p = c
}
if (( AddSuffix == 1 ) && ( p != " " ))
{
OutStr = OutStr " *"
}
if ( AnchorRite == 1 )
{
OutStr = OutStr "$"
}
print OutStr
}'