A new temporary release (and new git branch): Dependencies support!!!
slackpkg+ 1.9.a introduced dependencies list in slackpkg info
Now I'm looking for a way to add dependencies support in installing mode.
This is a very draft. The purpose is to taste the feedback and the way to implement it.
This build only works with slackpkg install in dialog mode
Code:
# slackpkg install sratom pyqt-distutils
Looking for sratom pyqt-distutils in package list. Please wait... DONE
Preparing list [2/2]
┌─────────────────────────────install────────────────────────────────┐
│ Choose packages to install: │
│ ┌────────────────────────────────────────────────────────────────┐ │
│ │[*] pyqt-distutils-0.7.3-x86_64-1smt.txz sbomt │ │
│ │[*] sratom-0.6.2-x86_64-1alien.tgz alienbob │ │
├─└────────────────────────────────────────────────────────────────┘─┤
│ < OK > <ChangeLog> < Cancel > <SolveDeps> │
└────────────────────────────────────────────────────────────────────┘
There is a new button "SolveDeps"
it solves dependencies of new packages to install (not packages to upgrade) the restart slackpkg
Note that this is a NEW run of slackpkg.
Currently it will no preserve some parameters/variable you passed, but it is a draft, and I don't know if it the best way
Code:
Restarting slackpkg to install dependencies...
Looking for pyqt-distutils-0.7.3-x86_64-1smt sratom-0.6.2-x86_64-1alien lv2, serd, sord, docopt, in package list. Please wait... DONE
Preparing list [6/6]
┌─────────────────────────────install────────────────────────────────┐
│ Choose packages to install: │
│ ┌────────────────────────────────────────────────────────────────┐ │
│ │[*] docopt-0.6.2-x86_64-2smt.txz sbomt │ │
│ │[*] lv2-1.18.0-x86_64-1alien.tgz alienbob │ │
│ │[*] pyqt-distutils-0.7.3-x86_64-1smt.txz sbomt │ │
│ │[*] serd-0.30.0-x86_64-1alien.tgz alienbob │ │
│ │[*] sord-0.16.2-x86_64-1alien.tgz alienbob │ │
│ │[*] sratom-0.6.2-x86_64-1alien.tgz alienbob │ │
├─└────────────────────────────────────────────────────────────────┘─┤
│ < OK > <ChangeLog> < Cancel > │
└────────────────────────────────────────────────────────────────────┘
Note that the "SolveDeps" button is no longer present. The Cancel button abort the process, does not return to the previous form.
When it look for dependencies the priority system does not follow the priority configuration, but search them in the same repository of the original package.
But when you - in future - will run upgrade-all it follow the priority configuration and it may broke the package.
Be sure you have a predictable priority configuration
People not liking dependency support simply can avoid to press the SolveDeps button
In future some settings and some options will be added.
Limits:
1) obviously it works with dependencies declared from the repository owners, so official repository is not supported, nor some other repository
2) cross repository dependencies is not supported; some repository declares which official packages is needed; slackpkg+ ignores it; just look into the original repository
3) if a dependencies is already installed from another repository slackpkg+ does not report it
4) if an upgrade requires a new package slackpkg+ does not report it
I just made a couple of tests and not non-regression tests.
Tell me what do you think and what may be improved or other ways you consider best for the user experience.
Code:
# wget https://raw.githubusercontent.com/zuno/slackpkgplus/deps/src/slackpkgplus.sh -O /usr/libexec/slackpkg/functions.d/slackpkgplus.sh
currently no new configuration settings are needed.
Code:
diff --git a/src/slackpkgplus.sh b/src/slackpkgplus.sh
index 445b31e..9a1e4d7 100755
--- a/src/slackpkgplus.sh
+++ b/src/slackpkgplus.sh
@@ -1897,8 +1897,13 @@ if [ "$SLACKPKGPLUS" = "on" ];then
while ! $EXIT ; do
+ SolveDeps=""
+ if [ "$2" == "install" ] && [ -z "$NO_SOLVE_DEP" ]; then
+ SolveDeps='--help-button --help-status --help-label SolveDeps'
+ fi
+ unset DEPSSOLVE
if $CLOGopt ; then
- dialog --extra-button \
+ dialog $SolveDeps --extra-button \
--extra-label "ChangeLog" \
--title "$DTITLE" \
--backtitle "slackpkg $VERSION" $HINT \
@@ -1906,7 +1911,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
19 70 13 \
--file $TMPDIR/dialog.tmp >&$DIALOGFD 2>$TMPDIR/dialog.out
else
- dialog --title "$DTITLE" \
+ dialog $SolveDeps --title "$DTITLE" \
--backtitle "slackpkg $VERSION" $HINT \
--checklist "Choose packages to $2:" \
19 70 13 \
@@ -1919,6 +1924,21 @@ if [ "$SLACKPKGPLUS" = "on" ];then
dialog --clear >&$DIALOGFD
;;
+ 2)
+ dialog --clear >&$DIALOGFD
+ SHOWLIST=$(cat $TMPDIR/dialog.out | tr -d \" |cut -f3- -d" ")
+ if [ -z "$SHOWLIST" ]; then
+ echo "No packages selected for $2, exiting."
+ cleanup
+ fi
+ DEPSSOLVE=$(solve_deps $( for i in $SHOWLIST;do r=$(cat $TMPDIR/dialog.tmp|grep ^$i|cut -f2 -d'"'); echo $r:$i; done ))
+ rm /var/lock/slackpkg.$$
+ echo "Restarting slackpkg to install dependencies..."
+ NO_SOLVE_DEP=1 slackpkg $CMD $DEPSSOLVE
+ touch /var/lock/slackpkg.$$
+ cleanup
+ ;;
+
3)
dialog --clear >&$DIALOGFD
@@ -1978,6 +1998,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
echo "No packages selected for $2, exiting."
cleanup
fi
+
if [ "$2" != "remove" ] && [ "$CHECKDISKSPACE" == "on" ];then
COUNTLIST=$(echo $SHOWLIST|wc -w)
compressed=0
@@ -2142,6 +2163,29 @@ if [ "$SLACKPKGPLUS" = "on" ];then
} # END updatedeps()
+ function solve_deps(){
+ # input: list of repository:package where package must match full-package-name (extention optional) or package-name
+ local deps
+ local repository
+ local argument
+ local name
+ local DEP
+ deps=""
+ for argument in $*;do
+ repository=${argument/:*/}
+ name=${argument/*:/}
+ name=${name%.t?z}
+ if echo $name|grep -E -- "-[^-]+-(${ARCH}|fw|noarch)-[^-]+";then
+ name=${name%-*-*-*}
+ fi
+ DEP=$(cat $WORKDIR/deplist|grep ^${repository/SLACKPKGPLUS_/}:$name:)
+ deps="$deps $(echo "$DEP"|cut -f5 -d:|sed -r -e "s/(^|,)([^,]+)/ ${repository/SLACKPKGPLUS_/}:\2,/g") ${repository/SLACKPKGPLUS_/}:$name, "
+ done
+ deps=$(printf "%s\n" $deps|grep -v ^$|sort -u)
+ echo $deps
+
+ }
+
#### ===== END OTHER ====== ######
#### ===== PREPARE ======== ######
@@ -2323,8 +2367,8 @@ For details see 'man slackpkgplus.conf'"
fi
# 07. slackpkg+ version
- SPKGPLUS_VERSION="1.9.e"
- SPKGBUILD=1660934354
+ SPKGPLUS_VERSION="1.9.f"
+ SPKGBUILD=1661089194
VERSION="$VERSION / slackpkg+ $SPKGPLUS_VERSION-$SPKGBUILD"
# 09. Be sure upgrade 14.2 to 15 does not delete /usr/bin/vi