mcdutchie / sbodeps Goto Github PK
View Code? Open in Web Editor NEWHeretically convenient dependency resolver for sbopkg
License: Other
Heretically convenient dependency resolver for sbopkg
License: Other
Hi @McDutchie,
Thank you for this great little script.
The check_for_updates()
is great! It does almost everything I need to keep my sanity with SBo package upgrades. That is, to get a list of upgrading package candidates respecting its dependency order for the build time. sbopkg
fails miserably in this task, as its package upgrade check function just detect what packages should be upgraded in the alphabetic order! If one try to run this queue without sorting it by dependency first, it'll bite for sure. Sorting that queue is a pain when there's lots of packages to upgrade.
sbodep -c
almost fix that, with one exception: it doesn't exclude the packages that may already be installed in the system. When check_for_updates()
runs, it calls almost in the end resolve_deps()
. This functions does what it's supposed to: get the package dependencies recursively. But this poses a problem if one have a package already installed.
Let me show you what I'm talking about with some examples.
$ sbodeps -c
[...suppressed output]
gst-plugins-ugly
gst-python
ffmpeg
guvcview
[...suppressed output]
ffmpeg and its friends are a dependency to guvcview.
Now look at this:
$ ls /var/log/packages/ | grep ffmpeg
ffmpeg-2.8-x86_64-1alien
Turns out that ffmpeg is already installed on that system. In that case, the AlienBob's package. I don't need to rebuild it, and I don't want to replace that package with a SBo one. sbodep's resolve_deps()
doesn't take that into account. It just solve the dependencies by checking which package from SBo is required and is not already installed.
To fix that, I came up with an external, poorly written script. Here it goes:
#!/bin/bash
IFS=$'\n'
SBODEP=( $(sbodeps -c 2> /dev/null) )
PKGLOG="/var/log/packages/"
# If verbose, print a header
[ "-v" = "$1" ] && printf "U | %-20s | %-25s | %-25s\n" "UPDATE CANDIDATE" "SYSTEM PACKAGE" "SLACKBUILD PACKAGE"
[ "-v" = "$1" ] && printf "%.0s-" {1..80} && echo
# Main loop
for i in ${SBODEP[@]}
do
update=false
# Check for installed packages
sysinst=$(ls $PKGLOG | grep "^$i\-" | grep -v "ponce$\|_SBo$")
sboinst=$(ls $PKGLOG | grep "^$i\-.*ponce$\|^$i\-.*_SBo")
if [ -z "$sysinst" ] && [ -z "$sboinst" ] || [ -n "$sboinst" ];then
# Package is not a system one or was not installed from SBo
update=true
fi
if $update;then
# If verbose, print that package is a candidate to upgrade from SBo
[ "-v" = "$1" ] && printf "+ | %-20s | %-25s | %-25s\n" "${i::20}" "${sysinst::25}" "${sboinst::25}"
# No runtime arguments, add to queue
[ "-v" = "$1" ] || echo $i
else
# If verbose, print that package is a system one, DO NOT upgrade from SBo
[ "-v" = "$1" ] && printf " | %-20s | %-25s | %-25s\n" "${i::20}" "${sysinst::25}" "${sboinst::25}"
fi
done
Let's see what it does:
$ sbosafeup -v
U | UPDATE CANDIDATE | SYSTEM PACKAGE | SLACKBUILD PACKAGE
--------------------------------------------------------------------------------
[...suppressed output]
+ | gst-plugins-ugly | | gst-plugins-ugly-0.10.19-
+ | gst-python | | gst-python-0.10.22-x86_64
| ffmpeg | ffmpeg-2.8-x86_64-1alien |
+ | guvcview | | guvcview-2.0.2-x86_64-1po
[...suppressed output]
Hummm! What does that mean?
gst-plugins-ugly
, gst-python
and guvcview
itself were installed from SBo, thus they are good candidates to the queue, which is shown by the +
sign. But ffmpeg
is present as a system package (well, not really a system one, but it's already there anyway), so we can let it out of the party and gets no sign.
With that information, what the sbopkg queue itself will look like? Let's see:
$ sbosafeup
[...suppressed output]
gst-plugins-ugly
gst-python
guvcview
[...suppressed output]
Look! No ffmpeg! \o/
Well, I'm talking and talking here just to tell you that, if you want to, there's room to improve your nice little sbodeps
. This is not a real issue nor a feature request, although it would be nice to see this implemented.
My script is crap and do not cares about any kind of optimization. It just works. I think that you are much more capable to improve it. ;)
Thank you!
How can i install sbodeps?
Thanks for your work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.